Skip to content

Commit 239818b

Browse files
committed
Use BoringSSL 5.x's FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
BoringSSL 5.x consolidated the older `BORINGSSL_UNSAFE_DETERMINISTIC_MODE` and `BORINGSSL_UNSAFE_FUZZER_MODE` preprocessor switches into a single `FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION` flag. The two old defines no longer exist anywhere in the new BoringSSL tree. With our build.rs still passing only the old defines when `quiche/fuzzing` was enabled: - The deterministic RNG implementation (`crypto/rand/deterministic.cc`) is now guarded by `OPENSSL_RAND_DETERMINISTIC`, which is in turn defined only when `FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION` is set. So that file compiled to nothing and `RAND_reset_for_fuzzing` was never emitted. - `quiche-fuzz/src/lib.rs` declares the function as `extern "C"` and calls it, so `cargo fuzz build` failed at link time with `undefined symbol: RAND_reset_for_fuzzing`. Replace the two old defines with the new single one. Verified locally that `cargo build -p quiche --features=fuzzing` succeeds and the resulting `libcrypto.a` exports `RAND_reset_for_fuzzing`.
1 parent 5116121 commit 239818b

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

quiche/src/build.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -383,10 +383,15 @@ fn main() {
383383
let mut cfg = get_boringssl_cmake_config(&bssl_src);
384384

385385
if cfg!(feature = "fuzzing") {
386-
cfg.cxxflag("-DBORINGSSL_UNSAFE_DETERMINISTIC_MODE")
387-
.cxxflag("-DBORINGSSL_UNSAFE_FUZZER_MODE");
388-
cfg.cflag("-DBORINGSSL_UNSAFE_DETERMINISTIC_MODE")
389-
.cflag("-DBORINGSSL_UNSAFE_FUZZER_MODE");
386+
// BoringSSL 5.x consolidated the older
387+
// `BORINGSSL_UNSAFE_{DETERMINISTIC,FUZZER}_MODE`
388+
// defines into the single
389+
// `FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION` switch.
390+
// Setting it makes BoringSSL build the deterministic
391+
// RNG path (so `RAND_reset_for_fuzzing` is exported)
392+
// and enables the fuzzer-mode TLS shortcuts.
393+
cfg.cflag("-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION")
394+
.cxxflag("-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION");
390395
}
391396

392397
cfg.build_target("ssl").build();

0 commit comments

Comments
 (0)