Commit Graph

3128 Commits

Author SHA1 Message Date
Anthony Ramine 72f4bf5724 Introduce set_custom_verify_callback and set_async_custom_verify_callback 2023-12-14 16:31:09 +01:00
Anthony Ramine b97446a3c9 Restore rpk feature in tokio-boring
It serves no purpose as there is no additional API in tokio-boring when
this feature is enabled, but there is a test gated by it and it can't
be conditionnally enabled only when boring's feature is enabled.
2023-12-14 16:30:49 +01:00
Anthony Ramine 6f5f59d7a9 Remove rpk from hyper docsrs features
The feature doesn't exist anymore.
2023-12-14 16:30:49 +01:00
Anthony Ramine 446b65550a Introduce tokio_boring::SslStreamBuilder 2023-12-14 16:05:09 +01:00
Chris Eager dd281f6ab6 Swap build and run order; always build 2023-12-14 13:25:47 +01:00
Chris Eager 59ef71327f Remove unused target_env from boring-sys build config 2023-12-14 13:25:47 +01:00
Jordan Rose 44f8f72a16 boring-sys: Blocklist max_align_t in bindgen
https://github.com/rust-lang/rust-bindgen/issues/1823
2023-12-14 13:25:47 +01:00
Jordan Rose 5dc531a38c boring-sys: Don't check for MSVC with target_env
x86_64-pc-windows-gnu is identified as `target_env = "msvc"` too,
but doesn't use the Visual Studio CMake generator.
2023-12-14 13:25:47 +01:00
Jordan Rose 4d66ada007 Use gcc/g++ as the compilers for windows-gnu, not Clang 2023-12-14 13:25:47 +01:00
Jordan Rose 016d5cb61e Always run tests in bash
This is only necessary for the windows-gnu target, but causes no
issues anywhere else.
2023-12-14 13:25:47 +01:00
Jordan Rose 8b86852d8a Add arm64-macos cross-compile to CI 2023-12-14 13:25:47 +01:00
Jordan Rose f82f3fcb0f Add custom linker for Android cross-compilation 2023-12-14 13:25:47 +01:00
Jordan Rose 16327cf5c5 Add custom environment for ARM Linux cross-compilation 2023-12-14 13:25:47 +01:00
Chris Eager 2f62df492b Build tests even for cross-compiling 2023-12-14 13:25:47 +01:00
Jordan Rose 1028909b40 Remove musl test; there's no standard musl C++ setup for us to use 2023-12-14 13:25:47 +01:00
Chris Eager 08c417a97e Make arm and Android builds check-only 2023-12-14 13:25:47 +01:00
Chris Eager f5583312c5 Add matrix.apt_packages 2023-12-14 13:25:47 +01:00
Chris Eager bccb80b115 Refactor check-only and extra-test-args 2023-12-14 13:25:47 +01:00
Chris Eager bbe8cd1b9e Add relevant `--target` to `cargo test` in CI 2023-12-14 13:25:47 +01:00
vuittont60 4d1b7fc816 Fix typos 2023-12-14 02:28:11 +01:00
Jordan Rose af0c36a22f boring-sys: Don't use CMake cross-compilation for macOS->iOS
(or macOS->macOS)
2023-11-30 15:03:23 +01:00
Anthony Ramine 9cf03ae4c1 Move async callbacks infra to boring itself
This helps drive async callbacks from outside tokio-boring, such as in quiche.

Not a breaking change because every public item in tokio-boring is preserved as is.
2023-11-27 11:53:35 +01:00
Anthony Ramine c38ed71511 Use replace_ex_data more
Setting callbacks multiple times on a SslContextBuilder causes the previous callback
installed to leak, using replace_ex_data internally prevents that.

We also start using it in tokio-boring in with_ex_data_future, my understanding
is that the futures currently in use are never installed twice by that function
but that could change in the future with the addition of more async callbacks.
2023-11-23 11:07:17 +01:00
Anthony Ramine 2ab71411c1 Release 4.1.0 2023-11-16 19:50:55 +01:00
Anthony Ramine a32783374f Properly drop overwritten ex data
We introduce new methods replace_ex_data for both SslContextBuilder
and Ssl in case anyone is relying on the leaking behaviour of their
set_ex_data methods, but we do document that they leak now.
2023-11-16 19:47:16 +01:00
Anthony Ramine d7a13a8468 Fix clippy lint 2023-11-16 19:47:16 +01:00
Chris Branch cdb76dcba2 Release 4.0.0 2023-11-10 11:51:13 +00:00
Anthony Ramine d4518f5af7 Release 4.0.0-rc.2 2023-11-06 13:31:47 +00:00
Anthony Ramine 8c90adbcdc Update release notes 2023-11-06 13:31:47 +00:00
Anthony Ramine b5c76432b8 Add cargo-release metadata 2023-11-06 13:31:47 +00:00
Anthony Ramine 7c5fdfa0a8 Remove Sync trait bounds on callback futures
They are unnecessary as we ever only retrieve the futures from ex data
to poll them, thus when we have mutable access to them, so Send is all we need.
2023-11-03 13:31:11 +00:00
Anthony Ramine 7a7de40833 Update Cargo.toml 2023-10-30 13:21:44 +01:00
Sebastian Hahn fdef98407c hyper and tokio "full" feature for dev builds only
This was an accidental regression in
d1ee9bfd86 which leads to pulling in the
full featureset of tokio and hyper for all dependents of tokio-boring
and hyper-boring.

Fixes #179.
2023-10-30 13:21:44 +01:00
Chris Branch fa155a1bf2 Release 4.0.0-rc.1 2023-10-26 16:31:07 +01:00
Chris Branch 46d482a734 Specify exact versions of dependent crates in the workspace manifest
This is needed for cargo release to update to a release candidate
version successfully; without it, only the major version is bumped,
and cargo prevents you from using a prerelease version if you didn't
specifically request it.
2023-10-26 16:31:07 +01:00
Anthony Ramine 0f74eade4b Add CI for cross-building from macOS 2023-10-26 11:31:47 +01:00
Anthony Ramine 7434e35faa Introduce BORING_BSSL_SYSROOT and BORING_BSSL_EXTERNAL_TOOLCHAIN
These variables let us configure CMAKE_SYSROOT and
CMAKE_{C,CXX,ASM}_EXTERNAL_TOOLCHAIN from env variables
without needing an error-prone custom toolchain file.

Most users won't need BORING_BSSL_EXTERNAL_TOOLCHAIN, but some
packages (such as Homebrew package
messense/macos-cross-toolchains/x86_64-unknown-linux-gnu) don't
install the sysroot at the root of the GCC installation, so clang-12
cannot find crt1.o and crti.o.

Finally, we also set up CMAKE_CROSSCOMPILING and
CMAKE_{C,CXX,ASM}_COMPILER_TARGET to make cross compilation work
with compilers that have cross-compiling drivers (i.e. clang).

We can now cross build boring-sys from macOS to Linux with
fips feature turned on:

brew tap nox/misc
brew install llvm@12.0.0
export PATH="$(brew --prefix llvm@12.0.0)/bin:$PATH"

brew tap messense/macos-cross-toolchains
brew install x86_64-unknown-linux-gnu
export BORING_BSSL_FIPS_EXTERNAL_TOOLCHAIN="$(brew --prefix x86_64-unknown-linux-gnu)/toolchain"
export BORING_BSSL_FIPS_SYSROOT="$BORING_BSSL_FIPS_EXTERNAL_TOOLCHAIN/x86_unknown-linux-gnu/sysroot"

cargo build --target x86_64-unknown-linux-gnu -p boring-sys --features fips
2023-10-26 11:31:47 +01:00
Anthony Ramine ba0ea33ab4 Check for CMAKE_TOOLCHAIN_FILE when creating cmake config
We don't do anything fancy anymore for non-cross builds
and when a specific CMAKE_TOOLCHAIN_FILE is specified.
2023-10-26 11:31:47 +01:00
Anthony Ramine 80b97c8318 Introduce target-specific env vars
The logic is stolen from cmake-rs, and it is important to
follow it as we will need to look for CMAKE_TOOLCHAIN_FILE
the same way cmake-rs does.

When checking for env variable BORING_BSSL_PATH during a
cross build for target x86_64-unknown-linux-gnu, boring-sys
build script will attempt to read:

  BORING_BSSL_PATH_x86_64-unknown-linux-gnu
  BORING_BSSL_PATH_x86_64_unknown_linux_gnu
  TARGET_BORING_BSSL_PATH
  BORING_BSSL_PATH
2023-10-26 11:31:47 +01:00
Anthony Ramine d8c2122c73 Continue looping if candidate cxx isn't found in verify_fips_clang_version
A basic LLVM 12 build provides clang-12 but not clang++-12, but
it does provide both clang and clang++, so we shouldn't hard fail
when first checking for clang-12 and clang++-12.
2023-10-26 11:31:47 +01:00
Anthony Ramine 1ca7f76607 Introduce set_async_get_session_callback 2023-10-25 10:25:55 +01:00
Anthony Ramine 8a26577b5d Allow returning GetSessionPendingError from get session callbacks 2023-10-25 10:25:55 +01:00
Anthony Ramine 1e2a4812d2 Test set_get_session_callback 2023-10-25 10:25:55 +01:00
Anthony Ramine 965fde7bae Test new session callback on server side 2023-10-25 10:25:55 +01:00
Anthony Ramine c48ed2ef62 Move session tests to their own module 2023-10-25 10:25:55 +01:00
Anthony Ramine 9a0bd94f99 Replace feature no-patches with BORING_BSSL{,_FIPS}_ASSUME_PATCHED
Feature no-patches is ever only useful when setting other env variables
BORING_BSSL{,_FIPS}{,_SOURCE}_PATH, and it has no impact on the APIs
provided by any of the boring crates, so we may as well make it an env
variable itself so downstream users have less features to propagate
across their own crate graph.
2023-10-23 15:06:23 +02:00
Anthony Ramine f5f47dd5a7 Remove feature rpk from hyper-boring and tokio-boring
Feature rpk in boring doesn't do anything unless you
explicitly use `SslAcceptor::rpk` or `SslContext::rpk_builder`,
and neither of these types are directly reachable if the
user depends only on tokio-boring or hyper-boring, which
means you still need to explicitly depend on the boring crate
to use RPK, in which case you can enable the feature there.
2023-10-23 15:06:23 +02:00
Anthony Ramine 7ddb106c20 Introduce a new set of env variables for FIPS-like builds
Builds using feature fips or fips-link-precompiled now
read variables prefixed by BORING_BSSL_FIPS_ instead of
BORING_BSSL_. This helps complex builds where build dependencies
also use boring, where we may not want to use fips there.

Without those separate variables, the boring build for the
build dependencies end up relying on e.g. BORING_BSSL_PATH,
causing errors if this path is a boring checkout intended for
fips builds, while the fips feature isn't enabled for
the build dependency.
2023-10-23 12:28:12 +02:00
Anthony Ramine bc095478fc Use prefix BORING_BSSL_ for all boringssl env variables
This means BORING_SSL_PRECOMPILED_BCM_O is now
BORING_BSSL_PRECOMPILED_BCM_O.

Prefix BORING_BSSL_ has been chosen because that's the
one that is used the most among all the variables
the build script uses.
2023-10-23 12:28:12 +02:00
Anthony Ramine ebea825d18 Don't read BORINGSSL_BUILD_DIR anymore
It's actually unused.
2023-10-23 12:28:12 +02:00