Commit Graph

68 Commits

Author SHA1 Message Date
Christopher Patton 72dabe1d85 Remove the "kx-*" features
The "kx-*" features control default key exchange preferences. Its
implementation requires disabling APIs for manually setting curve
preferences via `set_curves()` or `set_curves_list()`.

In practice, most teams need to be able to override default preferences
at runtime anyway, which means these features were never really used.
This commit gets rid of them, thereby reducing some complexity in the
API.
2025-09-30 09:36:33 +01:00
Alessandro Ghedini 4cb7e260a8 Clean-up legacy FIPS options
Per BoringSSL's FIPS policy, its `main` branch is the "update branch"
for FedRAMP compliance's purposes.

This means that we can stop using a specific BoringSSL branch when
enabling FIPS, as well as a number of hacks that allowed us to build
more recent BoringSSL versions with an older pre-compiled FIPS modules.

This also required slightly updating the main BoringSSL submodule, as
the previous version had an issue when building with the FIPS option
enabled. This is turn required some changes to the PQ patch as well as
some APIs that don't seem to be exposed publicly, as well as changing
some paths in the other patches.

In order to allow a smooth upgrade of internal projects, the `fips-compat`
feature is reduced in scope and renamed to `legacy-compat-deprecated` so
that we can incrementally upgrade internal BoringSSL forks. In practice
this shouldn't really be something anyone else would need, since in
order to work it requires a specific mix of BoringSSL version and
backported patches.
2025-09-26 17:12:23 +01:00
Alessandro Ghedini b4bf601394 Remove support for Hyper v0 2025-09-26 13:46:44 +01:00
Kornel fa9df8081d Deprecated GHA feature 2025-09-26 13:20:26 +01:00
Kornel 4814eb8547 Ensure rustfmt and clippy are available 2025-09-26 13:20:26 +01:00
Kornel a50a39fde7 Support TARGET_CC and CC_{target} 2025-09-26 10:57:01 +01:00
Kornel c5045fb6b4 Fix patched docs.rs builds 2025-09-03 17:24:22 +01:00
Kornel 8966ca27b7 Test docs.rs docs 2025-09-03 17:24:22 +01:00
Rushil Mehra 9c4ea22f72 Use ubuntu-latest for all ci jobs
ubuntu 20.04 is now deprecated:
https://github.com/actions/runner-images/issues/11101
2025-04-17 01:18:30 -07:00
Rushil Mehra 11630058f0
Revert "Remove "fips-no-compat", decouple "fips-compat" from "fips"" (#334) 2025-03-17 21:37:14 -05:00
Christopher Patton 57307d739e Remove "fips-no-compat", decouple "fips-compat" from "fips"
Modify the "fips" feature so that it no longer implies "fips-compat".
The latter is no longer needed for recent builds of boringSSL; users who
need older builds will need to enable "fips-compat" explicitly.

Also, remove the "fipps-no-compat" feature, as it's now equivalent to
"fips".
2025-03-16 08:43:52 +00:00
andrew-signal 221efdfea9
Update to actions/cache@v4 (#328) 2025-03-10 10:03:32 -07:00
Rushil Mehra 7b4bfcbbee Revert "Refactor!: Introduce a Cargo feature for optional Hyper 0 support"
This reverts commit 49d5a61163.
2025-02-21 10:41:18 +00:00
Paul Mabileau 49d5a61163 Refactor!: Introduce a Cargo feature for optional Hyper 0 support
Closes #294. Requires breaking changes. The default v0 is changed in
favor of v1, but v0 is still kept available, just in a forced module
path. It enables dependency de-duplication when consuming it.

Signed-off-by: Paul Mabileau <paul.mabileau@harfanglab.fr>
2024-12-07 21:07:31 +00:00
Kornel 1946603e15 Work around Rust settings inconsistent iOS SDK version 2024-11-28 11:21:39 -08:00
Rushil Mehra 7bb3647406 (ci): brew link x86 toolchain for macos13 runner
It seems we need to manually symlink the x86_64-unknown-linux-gnu
toolchain for the macos13 runner. Also, we don't need to overwrite the
python version anymore

Fixes https://github.com/cloudflare/boring/issues/285
2024-10-24 09:49:47 -07:00
Anthony Ramine 193bf3b9d7
Implement optional Hyper 1 support in hyper-boring (#246) 2024-09-18 13:24:35 +02:00
Rushil Mehra a7bfe0d92c Fix macos FIPS crossbuild 2024-08-15 15:09:02 -07:00
Rushil Mehra 8786cda639 (ci): Fix macos crossbuild action by forcing brew link w python@3.11 2024-07-24 18:19:22 +01:00
Rushil Mehra b7baacc047 Fix workflows file, pin mac os FIPS crossbuild runner to macos-13
The macos-13 runner uses intel chips and thus x86, so clang 12.0.0 is
easily available.
2024-06-26 16:13:58 +01:00
Ivan Nikulin d9f7e4daf6 Fix crosscompile 2024-05-31 09:38:29 +01:00
Anthony Ramine a8dea4a22c Introduce X509CheckFlags::UNDERSCORE_WILDCARDS 2024-01-02 15:37:36 +01:00
Chris Eager dd281f6ab6 Swap build and run order; always build 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
Anthony Ramine 0f74eade4b Add CI for cross-building from macOS 2023-10-26 11:31:47 +01:00
Christopher Patton 2fa3d96966 Use features to set key exchange preferences
Overwrite boringSSL's default key exchange preferences with safe
defaults using feature flags:

* "kx-pq-supported" enables support for PQ key exchange algorithms.
  Classical key exchange is still preferred, but will be upgraded to PQ
  if requested.

* "kx-pq-preferred" enables preference for PQ key exchange,
  with fallback to classical key exchange if requested.

* "kx-nist-required" disables non-NIST key exchange.

Each feature implies "kx-safe-default". When this feature is enabled,
don't compile bindings for `SSL_CTX_set1_curves()` and `SslCurve`. This
is to prevent the feature flags from silently overriding curve
preferences chosen by the user.

Ideally we'd allow both: that is, use "kx-*" to set defaults, but still
allow the user to manually override them. However, this doesn't work
because by the time the `SSL_CTX` is constructed, we don't yet know
whether we're the client or server. (The "kx-*" features set different
preferences for each.) If "kx-sfe-default" is set, then the curve
preferences are set just before initiating a TLS handshake
(`SslStreamBuilder::connect()`) or waiting for a TLS handshake
(`SslStreamBuilder::accept()`).
2023-09-01 14:21:35 -07:00
Eliza Weisman 190fb900a0 run `publish --dry-run` instead of `pacakge` on CI
As suggested by @inikulin in
https://github.com/cloudflare/boring/pull/159#issuecomment-1697324821
2023-08-30 14:54:18 +01:00
Eliza Weisman e9318132d8 fix missing space in cargo package CI command 2023-08-30 14:54:18 +01:00
Eliza Weisman 3056660c86 ci: run the cargo package check for all targets 2023-08-30 14:54:18 +01:00
Eliza Weisman c8d52a7614 add CI jobs to run `cargo package` 2023-08-30 14:54:18 +01:00
Ivan Nikulin d4ddd16ee2 Add fips-link-precompiled feature 2023-07-26 14:35:40 +01:00
Ivan Nikulin 0b542999d4 Address review comments 2023-07-10 14:00:52 +01:00
Ivan Nikulin d1ee9bfd86 Use workspace metadata for crates 2023-07-10 11:38:18 +01:00
Ivan Nikulin c4e8a94a69 Add RPK and PQ crypto features 2023-07-07 13:50:36 +01:00
Piotr Sikora 902e7d0c92 Update BoringCrypto to FIPS 140-2 certificate 4407.
Signed-off-by: Piotr Sikora <piotr@aviatrix.com>
2023-05-09 10:37:32 +02:00
Anthony Ramine 7215070e22 Use ubuntu-20.04 image for FIPS build
Later ubuntu images don't provide clang-7 anymore.
2023-03-27 12:59:13 +02:00
ilammy 87cdcee599 ci: Test builds for iOS targets
While it's possible to build Rust tests into an iOS app, start up
a simulator instance, upload the tests there, and launch them --
that's a bit involved process. For now, just check that BoringSSL
compiles for the specified target. Use "--all-targets" to check
all targets, including the unit tests.
2022-06-03 09:11:38 -05:00
ilammy 4c5ffc7723 ci: Don't run tests when targeting iOS
Even if "cargo test --target ${arch}-apple-ios" cross-compiles tests,
it's not possible to actually run them on the host macOS, as that's
a different execution environment.

Although, I guess, we could try only building tests with "--no-run",
GitHub Actions do not make it easy to construct command lines based
on matrix parameters. Thus it's easier to disable these steps, and
the following commit adds a "--no-run" step with "--target".
2022-06-03 09:11:38 -05:00
Braden Ehrat 1507689c5b
Add fips-3678 feature (#52)
* Add rerun-if-env-changed instructions for BORING_* variables

* Use X509_get0_notBefore() and X509_get0_notAfter() instead of X509_getm_notBefore() and X509_getm_notAfter().

According to
https://www.openssl.org/docs/man1.1.0/man3/X509_getm_notBefore.html,
"X509_getm_notBefore() and X509_getm_notAfter() are similar to
X509_get0_notBefore() and X509_get0_notAfter() except they return
non-constant mutable references to the associated date field of the
certificate".

* Only update boringssl submodule if BORING_BSSL_PATH not provided

* Allow BORING_BSSL_LIB_PATH to control link search

* Add fips feature

* Use X509_set_notAfter unconditionally for FIPS compatibility

This is equivalent according to
https://boringssl.googlesource.com/boringssl/+/c947efabcbc38dcf93e8ad0e6a76206cf0ec8072

The version of boringssl that's FIPS-certified doesn't have `X509_set1_notAfter`.
The only difference between that and `X509_set_notAfter` is whether they're const-correct,
which doesn't seem worth having two different code-paths.

* Check out fips commit automatically

* Verify the version of the compiler used for building boringssl

NIST specifies that it needs to be 7.0.1; I originally tried building with clang 10 and it failed.
Theoretically this should check the versions of Go and Ninja too, but they haven't given me trouble in practice.

Example error:
```
   Compiling boring-sys v1.1.1 (/home/jnelson/work/boring/boring-sys)
error: failed to run custom build command for `boring-sys v1.1.1 (/home/jnelson/work/boring/boring-sys)`

Caused by:
  process didn't exit successfully: `/home/jnelson/work/boring/target/debug/build/boring-sys-31b8ce53031cfd83/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=BORING_BSSL_PATH

  --- stderr
  warning: missing clang-7, trying other compilers: Permission denied (os error 13)
  warning: FIPS requires clang version 7.0.1, skipping incompatible version "clang version 10.0.0-4ubuntu1 "
  thread 'main' panicked at 'unsupported clang version "cc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0": FIPS requires clang 7.0.1', boring-sys/build.rs:216:13
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```

* Add Github actions workflow testing FIPS

Co-authored-by: Joshua Nelson <jnelson@cloudflare.com>
2022-01-31 16:11:33 -06:00
Frank Denis 05c6a41270 Use bindgen to automatically generate boring-sys
This ensures that all the Rust functions, types and constants
always match the actual BoringSSL definitions.

It also removes quite a lot of manually maintained code, as well
as the need for systest.

The value for `SslOptions::ALL`, for example, was wrong. On current
BoringSSL versions, this is a no-op, and is set to `0`.

Clearing it does nothing. So, the `clear_ctx_options` test, that
passed by accident, was adjusted to use a different option.

The `libc` crate is not required, as we only use it for types that
are already defined in the standard library. It was removed from
`boring-sys`. The same can be done to other crates later.
2021-02-12 15:03:45 +01:00