Commit Graph

3218 Commits

Author SHA1 Message Date
msoxzw 74a453d8b0 MSVC generator hack should be only applied to MSVC 2022-06-17 15:13:36 -05:00
Alexis (Poliorcetics) Bourget ccc0128cba chore: update to bindgen 1.60 2022-06-07 02:17:18 -05: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
ilammy 76ba5429d7 boring-sys: Disable alignment tests for iOS ARM64 targets
As pointed out in the comment, bindgen generates tests that cause
compiler warnings about misaligned references. bindgen people are
aware of the issue, but we have to deal with our warnings that are
treated as errors. For the time being, suppress alignment tests
on platforms that are known to be triggering UB.

I suspect that other non-x86 platforms are affected as well, but I can't
get the tests to compile for those tests at the moment, so I'm not sure.
Dealing with the issues one platform at a time.
2022-06-03 09:11:38 -05:00
ilammy 51e99ea9c0 boring-sys: Configure "rustc-cdylib-link-arg" only for macOS targets
cfg!() is evaluated for the host OS executing build.rs script.
What we need here is to look whether we are building *for* macOS.

Otherwise, for example, builds for iOS on macOS will try to add this
flag, causing warnings since rustc does not build cdylibs on iOS.
2022-06-03 09:11:38 -05:00
ilammy 11910f1e7c boring-sys: Pass "-isysroot" to bindgen for iOS builds
When bindgen generates bindings for iOS, it must be told to use iOS
sysroot with all the standard C headers. Otherwise it tries using
the host macOS headers and fails miserably.
2022-06-03 09:11:38 -05:00
ilammy d3486e40c5 boring-sys: Support "aarch64-apple-ios-sim" targets
"aarch64-apple-ios" is for iOS devices running ARM64.

"aarch64-apple-ios-sim" is for iOS Simulator running on M1 macs.
2022-06-03 09:11:38 -05:00
ilammy f7673415bf boring-sys: Use TARGET to determine iOS CMake params
The architecture alone is not enough. aarch64-apple-ios and
aarch-apple-ios-sim are both building for aarch64, but they need
slightly different CMake flags.
2022-06-03 09:11:38 -05:00
ilammy 06cf604b3a boring-sys: Pull iOS CMake params into a function 2022-06-03 09:11:38 -05:00
ilammy 570cc95c90 boring-sys: Pull Android CMake params into a function 2022-06-03 09:11:38 -05:00
Jordan Rose 00b14f6379 boring-sys: Save time by not building the bssl CLI utility
We only need libcrypto and libssl.
2022-06-02 18:48:35 -05:00
BiagioFesta 863b72b3a8 ssl/test: fix UT expectations accordingly with boringssl change
- boringssl fix:
https://boringssl.googlesource.com/boringssl/+/c02c19e0d842f54d903a9b62316476f4b9c4e3f0

- Now ALPN validation with SSL_TLSEXT_ERR_ALERT_FATAL makes the server
abort the handshake with an alarm. UT now correctly asserts
connection error on both client and server side.
2022-04-28 11:29:13 -05:00
BiagioFesta e141e834f1 Update boringssl deps for quiche 0.12.0 compatibility
- ExtensionType::TOKEN_BINDING removed from implementation
d89ec688f2

- ExtensionType::ECH_IS_INNER removed from implementation
18b6836b2f
2022-04-28 11:29:13 -05:00
ilammy e6ddc40333 boring: BigNumRef::to_vec_padded()
Wrap BN_bn2bin_padded() which comes useful for exporting fixed-length
BIGNUMs, more efficient than padding result of to_vec() afterwards.

Note that in OpenSSL the function is called BN_bn2binpad() and has
a different order of arguments. BoringSSL's BN_bn2bin_padded() also
takes the desired length as "size_t".
2022-02-12 12:20:36 -06: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
ilammy 5f327aba86 boring: Suppress Clippy warnings about missing safety docs
I'm not quite sure why these are unsafe traits, probably to prevent
implementing them for random types accidentally. However, Clippy
demands a "# Safety" section in their docs. Tell it to get lost.
2022-01-04 18:27:39 -05:00
Joshua Nelson db6867b794 Add/update changelogs 2021-12-16 13:52:38 -06:00
Joshua Nelson 18650f625e Bump versions for release
- Major version for boring-sys: `PasswordCallback` was removed
- Major version for boring: the public `*Ref` types were removed and `foreign-types` appears in our public api and had a major version bump
- Patch version for tokio-boring: the only API change was removing the `S: Debug` bound
- Patch version for hyper-boring: no API changes, only removed dependencies
2021-12-16 13:52:38 -06:00
Robin Lindner 44426292e0 Remove PasswordCallback 2021-12-16 13:09:39 -06:00
Oliver Gould c4e1f47497 Relax constraints on `Display for tokio-boring::HandshakeError`
`tokio_boring::HandshakeError` currently requires that the inner stream
implements `Debug` for its `Display` implementation. This constraint is
unnecessary.

This change removes this `Debug` constraint so `HandshakeError` always
implements `Display`.
2021-11-04 12:38:39 -05:00
Oliver Gould dcbe1571b3 boring-sys: Disable unnecessary bindgen dependencies
`bindgen`'s default features include dependencies like `clap` and
`env_logger` which are unnecessary when building `boring-sys`. When
using tools like `cargo-deny` to audit dependencies with mismatched
versions, these dependencies can easily conflict with application
dependencies.

This change disables `bindgen`'s default features to avoid unnecessary
dependencies.
2021-11-02 16:07:43 -05:00
Joshua Nelson 75d6ced4c9 Remove unused and deprecated `tempdir` dependency 2021-08-17 10:44:50 -05:00
Joshua Nelson 057a81b9a4 Remove unused `*Ref` parameters to macro
This doesn't actually do anything, it just makes it more clear that those parameters are ignored.
2021-08-17 10:44:50 -05:00
Joshua Nelson e46378d4de Update dependencies
In particular, this updates `foreign-types`, which had a lot of breaking changes.

- `ForeignType` is now an unsafe trait
- `*Ref` types no longer need a separate macro call, they're generated automatically
- Generated types now store `NonNull<T>` instead of `*mut T`
2021-08-17 10:44:50 -05:00
Joshua Nelson c037a438f8 Switch to 2018 edition in boring 2021-08-13 15:22:56 -05:00
Joshua Nelson 46787b7b69 Run `cargo fix --edition 2021-08-13 15:22:56 -05:00
Joshua Nelson 03dda42d1a Remove unused attribute 2021-07-30 16:24:16 -04:00
Robin Lambertz 993f68ded2 Remove unused dependency on bytes 2021-07-30 11:28:11 -04:00
Anthony Ramine 080dfa7edf Update bindgen to 0.59 and bytes to 1 2021-07-30 10:52:33 -04:00
Connor Jones 52499f5562
Merge pull request #46 from cloudflare/jnelson/rust-1.54
Fix clippy warnings for 1.54
2021-07-30 10:45:34 -04:00
Joshua Nelson 6ddfee29b7 Fix clippy warnings for 1.54 2021-07-29 12:16:55 -04:00
Joshua Nelson 3a0e2db753 Update documentation for tokio-boring
This also adds an `examples/` directory, to make sure the example in the readme doesn't get out of
date.
2021-07-29 11:28:43 -04:00
Connor Jones 8d00e01332
Merge pull request #43 from cloudflare/jnelson/submodule
Fetch git submodule automatically
2021-07-28 15:00:03 -04:00
Joshua Nelson 7c772a9832
Merge pull request #37 from Evrard-Nil/allow-pre-built-binaries
Allow pre-built binaries of BoringSSL
2021-07-28 14:58:52 -04:00
Joshua Nelson cedceb8213 Fetch git submodule automatically
Example output:

```
$ cargo check
   Compiling boring-sys v1.1.1 (/home/jnelson/src/boring/boring-sys)
warning: fetching boringssl git submodule
    Finished dev [unoptimized + debuginfo] target(s) in 28.27s
```
2021-07-28 14:21:22 -04:00
Connor Jones 6355fd816f
Merge pull request #42 from cloudflare/jnelson/warnings
Ignore bindgen warnings until they're fixed upstream
2021-07-27 23:43:10 -04:00
Joshua Nelson 57eac7dfc3 Ignore bindgen warnings until they're fixed upstream
We don't have any way of fixing these, and it's not feasible to switch away from bindgen.
Ignore the warnings for now.
2021-07-27 16:21:13 -04:00
Evrard-Nil Daillet c5010de2af pre-built binaries: Update readme and fix clippy 2021-06-01 10:52:36 +02:00
Evrard-Nil Daillet 2e8ad14f59 Check for env var for pre-built binaries of bssl 2021-05-18 20:16:16 +02:00
Ivan Nikulin 9cb2e41e1f
Merge pull request #33 from nox/bump
Bump tokio-boring to 2.1.3
2021-04-16 12:11:25 +01:00
Anthony Ramine 72e347d041 Bump tokio-boring to 2.1.3 2021-04-16 13:06:27 +02:00
Ivan Nikulin c8f13f23bd
Merge pull request #32 from nox/bump
Bump boring to 1.1.6
2021-04-16 12:01:25 +01:00
Anthony Ramine 77ef82c88d Bump boring to 1.1.6 2021-04-16 13:00:09 +02:00
Ivan Nikulin dbc4e70fcc
Merge pull request #30 from nox/client-version
Introduce ClientHello::client_version
2021-04-16 11:59:04 +01:00
Ivan Nikulin 61e69eb3e2
Merge pull request #31 from nox/unexpected-eof
Introduce HandshakeError::code
2021-04-16 11:57:48 +01:00
Anthony Ramine 4473d08df4 Introduce HandshakeError::code 2021-04-16 12:48:20 +02:00
Anthony Ramine fbdcfc3dbc Introduce ClientHello::client_version 2021-04-16 12:31:04 +02:00
Ivan Nikulin 90a195c9fe
Merge pull request #29 from nox/bump
Bump boring to 1.1.5
2021-04-13 15:12:11 +01:00
Anthony Ramine c85bf0940e Bump boring to 1.1.5 2021-04-13 16:05:40 +02:00