conformance: make the wolfSSL cross-check opt-in

The wolfssl feature adds wolfSSL and the pinned-file check; without it every
vector is still checked against the providers that are built.

Refs: R3
This commit is contained in:
JohnE 2026-11-16 20:55:55 -05:00
parent cdb600225f
commit 2861b9926a
3 changed files with 18 additions and 4 deletions

View File

@ -8,16 +8,22 @@ publish = false # Test binary — never published to crates.io.
[[bin]]
name = "conformance"
path = "src/main.rs"
required-features = ["wolfssl"]
[dependencies]
ccc-crypto-core = { path = "../../crates/ccc-crypto-core" }
ccc-crypto-wolfssl = { path = "../../crates/ccc-crypto-wolfssl" }
ccc-crypto-wolfssl = { path = "../../crates/ccc-crypto-wolfssl", optional = true }
anyhow = { workspace = true }
hex = "0.4"
log = { workspace = true }
env_logger = { workspace = true }
[features]
# wolfSSL is GPLv3 (or commercial) and off by default; turn it on to
# cross-check it and to regenerate the vectors with every provider.
wolfssl = ["dep:ccc-crypto-wolfssl"]
[dev-dependencies]
ccc-crypto-rustcrypto = { workspace = true }
ccc-crypto-boring = { path = "../../crates/ccc-crypto-boring" }

View File

@ -24,7 +24,6 @@ fn providers() -> &'static ProviderSet {
static SET: OnceLock<ProviderSet> = OnceLock::new();
SET.get_or_init(|| {
let mut p = ProviderSet::new();
p.add(Arc::new(ccc_crypto_wolfssl::WolfSslProvider::new()));
p.add(Arc::new(ccc_crypto_rustcrypto::RustCryptoProvider::new()));
p.add(Arc::new(AwsLcProvider::new()));
p

View File

@ -18,14 +18,15 @@ use std::path::PathBuf;
use serde::{Deserialize, Serialize};
use ccc_crypto_awslc::AwsLcProvider;
use ccc_crypto_boring::BoringProvider;
use ccc_crypto_core::{
algorithms::{AeadAlgorithm, HashAlgorithm, KdfAlgorithm, KemAlgorithm, MacAlgorithm},
error::CryptoError,
provider::{CryptoProvider, KemProvider},
};
use ccc_crypto_boring::BoringProvider;
use ccc_crypto_awslc::AwsLcProvider;
use ccc_crypto_rustcrypto::RustCryptoProvider;
#[cfg(feature = "wolfssl")]
use ccc_crypto_wolfssl::WolfSslProvider;
// ── Providers ────────────────────────────────────────────────────────────────
@ -35,6 +36,7 @@ impl<T: CryptoProvider + KemProvider> Provider for T {}
fn providers() -> Vec<Box<dyn Provider>> {
vec![
#[cfg(feature = "wolfssl")]
Box::new(WolfSslProvider::new()),
Box::new(RustCryptoProvider::new()),
Box::new(BoringProvider::new()),
@ -335,6 +337,9 @@ fn generate() -> Vectors {
#[test]
#[ignore = "writes vectors/conformance_v1.json; run only to regenerate"]
fn regenerate() {
if !cfg!(feature = "wolfssl") {
panic!("regenerate with --features wolfssl so every provider is listed");
}
let json = serde_json::to_string_pretty(&generate()).unwrap() + "\n";
std::fs::write(vectors_path(), json).unwrap();
}
@ -541,6 +546,10 @@ fn kem_encapsulation_interoperates() {
}
#[test]
#[cfg_attr(
not(feature = "wolfssl"),
ignore = "the pinned file lists wolfSSL too; run with --features wolfssl"
)]
fn pinned_file_is_current() {
// Catches edits to the inputs above that were not regenerated.
assert_eq!(