Commit Graph

26 Commits

Author SHA1 Message Date
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
Ivan Nikulin 561d786c10
Merge pull request #97 from PiotrSikora/boringcrypto_4407
Update BoringCrypto to FIPS 140-2 certificate 4407.
2023-05-11 16:22:25 +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 530db8841b Bump bindgen to 0.65.1 2023-05-05 11:58:47 +02:00
Anthony Ramine 74b0cc0da7 Fix lints 2023-03-27 13:15:12 +02:00
Ivan Nikulin 3059ba6e10
Merge pull request #78 from signalapp/aarch64-cross-compilation
Add minimal cross-compilation support for Windows and AArch64 Linux
2022-09-27 16:14:52 +01:00
Joshua Nelson bd4f8d58ef Fix clippy warnings 2022-09-16 12:13:55 -05:00
Jordan Rose a117901fe0 boring-sys: Use the Android NDK sysroot when running bindgen 2022-07-25 19:31:59 -04:00
Jordan Rose 3bbb1b94b6 Add minimal cross-compilation support for Windows and AArch64 Linux
Cross-compiling to AArch64 Linux can be done with a CMake toolchain
file, along with setting the correct compiler and include paths in the
environment.

Cross-compiling from X64 Windows to ARM64 Windows doesn't look at the
toolchain at all, because CMake + Visual Studio can already
cross-compile. Unfortunately, the Visual Studio CMake generator
doesn't set CMAKE_SYSTEM_PROCESSOR, which is what the BoringSSL
CMakeLists.txt is looking at to choose the architecture. For now,
disable the use of assembly when cross-compiling on Windows (assuming
that the Visual Studio generator will be used there).
2022-06-27 18:01:55 -07:00
msoxzw 74a453d8b0 MSVC generator hack should be only applied to MSVC 2022-06-17 15:13:36 -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
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