Skip to content

Commit b3e24d9

Browse files
committed
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.
1 parent 330bf82 commit b3e24d9

File tree

20 files changed

+1474
-2044
lines changed

20 files changed

+1474
-2044
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ jobs:
1818
runs-on: ubuntu-latest
1919
steps:
2020
- uses: actions/checkout@v4
21-
- name: Install Rust
22-
run: rustup update stable && rustup default stable
21+
- name: Install stable toolchain
22+
uses: dtolnay/rust-toolchain@master
23+
with:
24+
toolchain: stable
25+
components: rustfmt
2326
- name: Check formatting
2427
run: cargo fmt --all -- --check
2528

@@ -30,8 +33,11 @@ jobs:
3033
- uses: actions/checkout@v4
3134
with:
3235
submodules: 'recursive'
33-
- name: Install Rust
34-
run: rustup update stable && rustup default stable
36+
- name: Install stable toolchain
37+
uses: dtolnay/rust-toolchain@master
38+
with:
39+
toolchain: stable
40+
components: clippy
3541
- name: Get rust version
3642
id: rust-version
3743
run: echo "::set-output name=version::$(rustc --version)"
@@ -201,6 +207,10 @@ jobs:
201207
run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }}
202208
shell: bash
203209
- run: rustup target add ${{ matrix.target }}
210+
- name: Install golang
211+
uses: actions/setup-go@v5
212+
with:
213+
go-version: '>=1.22.0'
204214
- name: Install target-specific APT dependencies
205215
if: "matrix.apt_packages != ''"
206216
run: sudo apt update && sudo apt install -y ${{ matrix.apt_packages }}
@@ -254,18 +264,10 @@ jobs:
254264
- name: Install Rust (rustup)
255265
run: rustup update stable --no-self-update && rustup default stable
256266
shell: bash
257-
- name: Install Clang-12
258-
uses: KyleMayes/install-llvm-action@v1
259-
with:
260-
version: "12.0.0"
261-
directory: ${{ runner.temp }}/llvm
262267
- name: Install golang
263268
uses: actions/setup-go@v5
264269
with:
265270
go-version: '>=1.22.0'
266-
- name: Add clang++-12 link
267-
working-directory: ${{ runner.temp }}/llvm/bin
268-
run: ln -s clang clang++-12
269271
- name: Run tests
270272
run: cargo test --features fips
271273
- name: Test boring-sys cargo publish (FIPS)
@@ -295,6 +297,10 @@ jobs:
295297
- name: Install Rust (rustup)
296298
run: rustup update stable --no-self-update && rustup default stable && rustup target add ${{ matrix.target }}
297299
shell: bash
300+
- name: Install golang
301+
uses: actions/setup-go@v5
302+
with:
303+
go-version: '>=1.22.0'
298304
- name: Install ${{ matrix.target }} toolchain
299305
run: brew tap messense/macos-cross-toolchains && brew install ${{ matrix.target }}
300306
- name: Set BORING_BSSL_SYSROOT

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,3 @@
22
path = boring-sys/deps/boringssl
33
url = https://github.com/google/boringssl.git
44
ignore = dirty
5-
[submodule "boring-sys/deps/boringssl-fips"]
6-
path = boring-sys/deps/boringssl-fips
7-
url = https://github.com/google/boringssl.git

boring-sys/Cargo.toml

Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -18,35 +18,22 @@ include = [
1818
"/*.toml",
1919
"/LICENSE-MIT",
2020
"/cmake/*.cmake",
21-
# boringssl (non-FIPS)
22-
"/deps/boringssl/src/util/32-bit-toolchain.cmake",
2321
"/deps/boringssl/**/*.[chS]",
2422
"/deps/boringssl/**/*.asm",
25-
"/deps/boringssl/sources.json",
26-
"/deps/boringssl/src/crypto/obj/obj_mac.num",
27-
"/deps/boringssl/src/crypto/obj/objects.txt",
23+
"/deps/boringssl/**/*.pl",
24+
"/deps/boringssl/**/*.go",
25+
"/deps/boringssl/**/*.cmake",
26+
"/deps/boringssl/**/go.mod",
27+
"/deps/boringssl/**/go.sum",
28+
"/deps/boringssl/crypto/obj/obj_mac.num",
29+
"/deps/boringssl/crypto/obj/objects.txt",
30+
"/deps/boringssl/crypto/err/*.errordata",
2831
"/deps/boringssl/**/*.bzl",
29-
"/deps/boringssl/src/**/*.cc",
32+
"/deps/boringssl/**/*.cc",
3033
"/deps/boringssl/**/CMakeLists.txt",
3134
"/deps/boringssl/**/sources.cmake",
35+
"/deps/boringssl/**/util/go_tests.txt",
3236
"/deps/boringssl/LICENSE",
33-
# boringssl (FIPS)
34-
"/deps/boringssl-fips/src/util/32-bit-toolchain.cmake",
35-
"/deps/boringssl-fips/**/*.[chS]",
36-
"/deps/boringssl-fips/**/*.asm",
37-
"/deps/boringssl-fips/**/*.pl",
38-
"/deps/boringssl-fips/**/*.go",
39-
"/deps/boringssl-fips/**/go.mod",
40-
"/deps/boringssl-fips/**/go.sum",
41-
"/deps/boringssl-fips/sources.json",
42-
"/deps/boringssl-fips/crypto/obj/obj_mac.num",
43-
"/deps/boringssl-fips/crypto/obj/objects.txt",
44-
"/deps/boringssl-fips/crypto/err/*.errordata",
45-
"/deps/boringssl-fips/**/*.bzl",
46-
"/deps/boringssl-fips/**/*.cc",
47-
"/deps/boringssl-fips/**/CMakeLists.txt",
48-
"/deps/boringssl-fips/**/sources.cmake",
49-
"/deps/boringssl-fips/LICENSE",
5037
"/build/*",
5138
"/src",
5239
"/patches",
@@ -65,14 +52,6 @@ rustdoc-args = ["--cfg", "docsrs"]
6552
# for instructions and more details on the boringssl FIPS flag.
6653
fips = []
6754

68-
# Use a precompiled FIPS-validated version of BoringSSL. Meant to be used with
69-
# FIPS-20230428 or newer. Users must set `BORING_BSSL_FIPS_PATH` to use this
70-
# feature, or else the build will fail.
71-
fips-precompiled = []
72-
73-
# Link with precompiled FIPS-validated `bcm.o` module.
74-
fips-link-precompiled = []
75-
7655
# Enables Raw public key API (https://datatracker.ietf.org/doc/html/rfc7250)
7756
rpk = []
7857

boring-sys/build/config.rs

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ pub(crate) struct Config {
1616

1717
pub(crate) struct Features {
1818
pub(crate) fips: bool,
19-
pub(crate) fips_precompiled: bool,
20-
pub(crate) fips_link_precompiled: bool,
2119
pub(crate) pq_experimental: bool,
2220
pub(crate) rpk: bool,
2321
pub(crate) underscore_wildcards: bool,
@@ -27,7 +25,6 @@ pub(crate) struct Env {
2725
pub(crate) path: Option<PathBuf>,
2826
pub(crate) include_path: Option<PathBuf>,
2927
pub(crate) source_path: Option<PathBuf>,
30-
pub(crate) precompiled_bcm_o: Option<PathBuf>,
3128
pub(crate) assume_patched: bool,
3229
pub(crate) sysroot: Option<PathBuf>,
3330
pub(crate) compiler_external_toolchain: Option<PathBuf>,
@@ -78,10 +75,6 @@ impl Config {
7875
panic!("`fips` and `rpk` features are mutually exclusive");
7976
}
8077

81-
if self.features.fips_precompiled && self.features.rpk {
82-
panic!("`fips-precompiled` and `rpk` features are mutually exclusive");
83-
}
84-
8578
let is_precompiled_native_lib = self.env.path.is_some();
8679
let is_external_native_lib_source =
8780
!is_precompiled_native_lib && self.env.source_path.is_none();
@@ -104,40 +97,26 @@ impl Config {
10497
"cargo:warning=precompiled BoringSSL was provided, so patches will be ignored"
10598
);
10699
}
107-
108-
// todo(rmehra): should this even be a restriction? why not let people link a custom bcm.o?
109-
// precompiled boringssl will include libcrypto.a
110-
if is_precompiled_native_lib && self.features.fips_link_precompiled {
111-
panic!("precompiled BoringSSL was provided, so FIPS configuration can't be applied");
112-
}
113-
114-
if !is_precompiled_native_lib && self.features.fips_precompiled {
115-
panic!("`fips-precompiled` feature requires `BORING_BSSL_FIPS_PATH` to be set");
116-
}
117100
}
118101
}
119102

120103
impl Features {
121104
fn from_env() -> Self {
122105
let fips = env::var_os("CARGO_FEATURE_FIPS").is_some();
123-
let fips_precompiled = env::var_os("CARGO_FEATURE_FIPS_PRECOMPILED").is_some();
124-
let fips_link_precompiled = env::var_os("CARGO_FEATURE_FIPS_LINK_PRECOMPILED").is_some();
125106
let pq_experimental = env::var_os("CARGO_FEATURE_PQ_EXPERIMENTAL").is_some();
126107
let rpk = env::var_os("CARGO_FEATURE_RPK").is_some();
127108
let underscore_wildcards = env::var_os("CARGO_FEATURE_UNDERSCORE_WILDCARDS").is_some();
128109

129110
Self {
130111
fips,
131-
fips_precompiled,
132-
fips_link_precompiled,
133112
pq_experimental,
134113
rpk,
135114
underscore_wildcards,
136115
}
137116
}
138117

139118
pub(crate) fn is_fips_like(&self) -> bool {
140-
self.fips || self.fips_precompiled || self.fips_link_precompiled
119+
self.fips
141120
}
142121
}
143122

@@ -175,7 +154,6 @@ impl Env {
175154
path: boringssl_var("BORING_BSSL_PATH").map(PathBuf::from),
176155
include_path: boringssl_var("BORING_BSSL_INCLUDE_PATH").map(PathBuf::from),
177156
source_path: boringssl_var("BORING_BSSL_SOURCE_PATH").map(PathBuf::from),
178-
precompiled_bcm_o: boringssl_var("BORING_BSSL_PRECOMPILED_BCM_O").map(PathBuf::from),
179157
assume_patched: boringssl_var("BORING_BSSL_ASSUME_PATCHED")
180158
.is_some_and(|v| !v.is_empty()),
181159
sysroot: boringssl_var("BORING_BSSL_SYSROOT").map(PathBuf::from),

0 commit comments

Comments
 (0)