Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add build-time OpenSSL version checks #418

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.");
}
}
Loading