Skip to content

Commit

Permalink
Add explicit OpenSSL version checks to attestation-ca and webauthn-rs…
Browse files Browse the repository at this point in the history
…-core
  • Loading branch information
micolous committed Feb 12, 2024
1 parent 0917fab commit c089ab8
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 0 deletions.
3 changes: 3 additions & 0 deletions attestation-ca/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ serde.workspace = true
tracing.workspace = true
openssl.workspace = true
uuid = { workspace = true, features = ["serde"] }

[build-dependencies]
openssl.workspace = true
21 changes: 21 additions & 0 deletions attestation-ca/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
use openssl::version::{number, version};

const OPENSSL_DOC: &str = "https://github.com/kanidm/webauthn-rs/blob/master/OpenSSL.md";

fn main() {
// LibreSSL reports as OpenSSL v2 (which was skipped).
if number() < 0x2_00_00_00_0 {
println!(
r#"
Your version of OpenSSL is out of date, and not supported by this library.
Please upgrade to OpenSSL v3.0.0 or later.
More info: {OPENSSL_DOC}
OpenSSL version string: {}
"#,
version(),
);
panic!("The installed version of OpenSSL is unusable.");
}
}
3 changes: 3 additions & 0 deletions webauthn-rs-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ uuid = { workspace = true, features = ["serde"] }
hex-literal = "0.3"
tracing-subscriber.workspace = true
webauthn-rs-device-catalog.workspace = true

[build-dependencies]
openssl.workspace = true
21 changes: 21 additions & 0 deletions webauthn-rs-core/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
use openssl::version::{number, version};

const OPENSSL_DOC: &str = "https://github.com/kanidm/webauthn-rs/blob/master/OpenSSL.md";

fn main() {
// LibreSSL reports as OpenSSL v2.
if number() < 0x2_00_00_00_0 {
println!(
r#"
Your version of OpenSSL is out of date, and not supported by this library.
Please upgrade to OpenSSL v3.0.0 or later.
More info: {OPENSSL_DOC}
OpenSSL version string: {}
"#,
version(),
);
panic!("The installed version of OpenSSL is unusable.");
}
}

0 comments on commit c089ab8

Please sign in to comment.