Skip to content

Commit c804db7

Browse files
committed
Fix LibreSSL version checking in openssl/
Previously it only did exact version matching -- different from how OpenSSL worked, and causing it to make many APIs exposed only on a single version of LibreSSL. This fixes that, and in the process identifies a bug in openssl-sys.
1 parent 8f92004 commit c804db7

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

openssl-sys/build/cfgs.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ pub fn get(openssl_version: Option<u64>, libressl_version: Option<u64>) -> Vec<&
3131
if libressl_version >= 0x2_09_01_00_0 {
3232
cfgs.push("libressl291");
3333
}
34+
if libressl_version >= 0x3_01_00_00_0 {
35+
cfgs.push("libressl310");
36+
}
3437
if libressl_version >= 0x3_02_01_00_0 {
3538
cfgs.push("libressl321");
3639
}

openssl/build.rs

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,56 @@ fn main() {
1717
}
1818

1919
if let Ok(v) = env::var("DEP_OPENSSL_LIBRESSL_VERSION") {
20-
println!("cargo:rustc-cfg=libressl{}", v);
20+
let version = v.parse::<u64>().unwrap();
21+
22+
if version >= 250 {
23+
println!("cargo:rustc-cfg=libressl{}", 250);
24+
}
25+
if version >= 251 {
26+
println!("cargo:rustc-cfg=libressl{}", 251);
27+
}
28+
if version >= 261 {
29+
println!("cargo:rustc-cfg=libressl{}", 261);
30+
}
31+
if version >= 270 {
32+
println!("cargo:rustc-cfg=libressl{}", 270);
33+
}
34+
if version >= 271 {
35+
println!("cargo:rustc-cfg=libressl{}", 271);
36+
}
37+
if version >= 273 {
38+
println!("cargo:rustc-cfg=libressl{}", 273);
39+
}
40+
if version >= 280 {
41+
println!("cargo:rustc-cfg=libressl{}", 280);
42+
}
43+
if version >= 291 {
44+
println!("cargo:rustc-cfg=libressl{}", 291);
45+
}
46+
if version >= 310 {
47+
println!("cargo:rustc-cfg=libressl{}", 310);
48+
}
49+
if version >= 321 {
50+
println!("cargo:rustc-cfg=libressl{}", 321);
51+
}
52+
if version >= 332 {
53+
println!("cargo:rustc-cfg=libressl{}", 332);
54+
}
55+
if version >= 340 {
56+
println!("cargo:rustc-cfg=libressl{}", 340);
57+
}
58+
if version >= 350 {
59+
println!("cargo:rustc-cfg=libressl{}", 350);
60+
}
61+
if version >= 360 {
62+
println!("cargo:rustc-cfg=libressl{}", 360);
63+
}
64+
if version >= 361 {
65+
println!("cargo:rustc-cfg=libressl{}", 361);
66+
}
67+
if version >= 370 {
68+
println!("cargo:rustc-cfg=libressl{}", 370);
69+
}
2170
}
2271

2372
if let Ok(vars) = env::var("DEP_OPENSSL_CONF") {

0 commit comments

Comments
 (0)