Skip to content

Commit 8418e7b

Browse files
authored
Merge pull request #1769 from alex/require-boringssl
Refs #1768 -- reject boringssl if unstable_boringssl feature isn't specified
2 parents 8c48e42 + f95fd5b commit 8418e7b

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

openssl-sys/build/expando.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ NEW_VERSION(OPENSSL_VERSION_MAJOR, OPENSSL_VERSION_MINOR, OPENSSL_VERSION_PATCH)
1515
VERSION(OPENSSL, OPENSSL_VERSION_NUMBER)
1616
#endif
1717

18+
#ifdef OPENSSL_IS_BORINGSSL
19+
RUST_OPENSSL_IS_BORINGSSL
20+
#endif
21+
1822
#ifdef OPENSSL_NO_BF
1923
RUST_CONF_OPENSSL_NO_BF
2024
#endif

openssl-sys/build/main.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,12 +215,14 @@ See rust-openssl documentation for more information:
215215
let mut enabled = vec![];
216216
let mut openssl_version = None;
217217
let mut libressl_version = None;
218+
let mut is_boringssl = false;
218219
for line in expanded.lines() {
219220
let line = line.trim();
220221

221222
let openssl_prefix = "RUST_VERSION_OPENSSL_";
222223
let new_openssl_prefix = "RUST_VERSION_NEW_OPENSSL_";
223224
let libressl_prefix = "RUST_VERSION_LIBRESSL_";
225+
let boringsl_prefix = "RUST_OPENSSL_IS_BORINGSSL";
224226
let conf_prefix = "RUST_CONF_";
225227
if line.starts_with(openssl_prefix) {
226228
let version = &line[openssl_prefix.len()..];
@@ -233,9 +235,15 @@ See rust-openssl documentation for more information:
233235
libressl_version = Some(parse_version(version));
234236
} else if line.starts_with(conf_prefix) {
235237
enabled.push(&line[conf_prefix.len()..]);
238+
} else if line.starts_with(boringsl_prefix) {
239+
is_boringssl = true;
236240
}
237241
}
238242

243+
if is_boringssl {
244+
panic!("BoringSSL detected, but `unstable_boringssl` feature wasn't specified.")
245+
}
246+
239247
for enabled in &enabled {
240248
println!("cargo:rustc-cfg=osslconf=\"{}\"", enabled);
241249
}

0 commit comments

Comments
 (0)