Skip to content
Open
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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ base32ct = { version = "0.3.1", features = ["alloc"] }
base64ct = { version = "1.8.3", features = ["alloc"] }
rand = "0.10.1"
openssl = { version = "0.10.78" }
openssl-sys = { version = "0.9.109" }
yubikey = "0.8"
tempfile = "3.27.0"
clap = { version = "4.6.1", features = ["derive"] }
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ Both bundle the `rite-ls` language server. For other LSP-aware editors, run `rit
- [ ] Teardown act on abort or failure
- [x] **Cryptographic backends**
- [x] OpenSSL: RSA, ECDSA-P256, signing, wrapping, PKI
- [x] Post-quantum: ML-DSA-44/65/87 signatures and certificates (needs OpenSSL 3.5+)
- [ ] Post-quantum: ML-KEM key encapsulation
- [x] Hardware backends
- [x] YubiKey PIV: key generation, signing, certificate read, on-device attestation
Expand Down
5 changes: 5 additions & 0 deletions crates/rite-openssl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ vendored = ["openssl/vendored"]
[dependencies]
rite-sdk = { workspace = true }
openssl = { workspace = true }
# Referenced by build.rs, not by the source. `openssl-sys` carries the
# `links = "openssl"` key, and Cargo only hands `DEP_OPENSSL_*` metadata to
# build scripts of *direct* dependents. Removing this as an "unused" dependency
# silently drops ML-DSA support from every build.
openssl-sys = { workspace = true }
base16ct = { workspace = true }
zeroize = { workspace = true }

Expand Down
33 changes: 33 additions & 0 deletions crates/rite-openssl/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//! Detects the linked OpenSSL version so ML-DSA support is compiled in only
//! where the provider exists.
//!
//! ML-DSA landed in OpenSSL 3.5, and the `openssl` crate gates the
//! corresponding bindings behind its own `ossl350` cfg. That cfg is private to
//! that crate, so this build script re-derives it from the version number
//! `openssl-sys` publishes through its `links` metadata.

fn main() {
println!("cargo::rustc-check-cfg=cfg(ossl350)");

// LibreSSL and BoringSSL report an OpenSSL version number for source
// compatibility but do not ship the ML-DSA provider. Each signals itself
// through a separate variable, so bail out rather than trusting the
// version number alone.
if std::env::var_os("DEP_OPENSSL_LIBRESSL_VERSION_NUMBER").is_some()
|| std::env::var_os("DEP_OPENSSL_BORINGSSL").is_some()
{
return;
}

let Ok(raw) = std::env::var("DEP_OPENSSL_VERSION_NUMBER") else {
return;
};
let Ok(version) = u64::from_str_radix(&raw, 16) else {
return;
};

// OPENSSL_VERSION_NUMBER is 0xMNN00PPSL, so 3.5.0 is 0x30500000.
if version >= 0x3050_0000 {
println!("cargo::rustc-cfg=ossl350");
}
}
Loading
Loading