Commit Graph

13 Commits

Author SHA1 Message Date
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
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
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 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
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
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
Ivan Nikulin 5cb8947d7e Rename stuff 2020-11-11 17:47:30 +00:00