Commit Graph

17 Commits

Author SHA1 Message Date
0x676e67 9523ac82c9
Merge patch (#8) 2024-08-12 09:56:42 +08:00
Liu Dingming b96d2b88a4 Enable layout tests on iOS target 2024-03-24 11:11:05 -07:00
Rushil Mehra d3a42b0aeb Fix building with BORING_BSSL_PATH / BORING_BSSL_FIPS_PATH
When passing BORING_BSSL_FIPS_PATH, you need to add /lib/ to the search
path, and when passing BORING_BSSL_PATH you need to add /crypto/ and
/ssl/ to the search path.
2024-02-02 10:23:41 -08:00
Rushil Mehra 5aed467dcb Fix building with non bazel commits of boringssl
We need to add `/build/crypto` and `/build/ssl` to the library search
path to handle the case where we pass `BORING_BSSL_SOURCE_PATH` when
building without enabling any fips features. Otherwise, non bazel
commits will not work because `/build/` itself will not contain any
crypto libraries to link with
2024-02-02 14:56:55 +00:00
Anthony Ramine a8dea4a22c Introduce X509CheckFlags::UNDERSCORE_WILDCARDS 2024-01-02 15:37:36 +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 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 d7a13a8468 Fix clippy lint 2023-11-16 19:47:16 +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 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 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 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 6b52c1e93c Don't use env::current_dir in build script
The current directory from a build script executed by cargo
is always the manifest dir, so we may as well only use
the manifest dir.
2023-10-23 12:28:12 +02:00
Anthony Ramine 0d25d74cd6 Introduce struct Config in build script
Using a struct improves navigation of the build script,
as we can rely on rust-analyzer to help us check how
a feature flag or an environment variable is used,
as opposed to grepping for multiple env::var calls
or #[cfg] attributes.

This commit also removes some obsolete blocks of code
related to the now defunct ndk-old-gcc and fuzzing features.
2023-10-23 12:28:12 +02:00