use crate::{
AeadAlgorithm, Algorithm, CryptoError, Family, HashAlgorithm, KdfAlgorithm,
KeyAgreementAlgorithm, MacAlgorithm, Module, ModuleLine, Options, Profile, SignatureAlgorithm,
TlsSignatureScheme,
};
#[doc(hidden)]
#[derive(Debug, Clone)]
pub struct Golden {
pub profile: Profile,
pub pq: bool,
pub versions: &'static [u16],
pub suites: &'static [u16],
pub groups: &'static [u16],
pub schemes: &'static [u16],
pub keys: &'static [&'static str],
pub excluded: &'static [Algorithm],
}
#[doc(hidden)]
pub const ALL_SCHEMES: &[u16] = &[
0x0906, 0x0503, 0x0403, 0x0603, 0x0807, 0x0805, 0x0806, 0x0804, 0x0501, 0x0601, 0x0401,
];
#[doc(hidden)]
pub const ALL_SCHEMES_BUT_PKCS1: &[u16] = &[
0x0906, 0x0503, 0x0403, 0x0603, 0x0807, 0x0805, 0x0806, 0x0804,
];
#[doc(hidden)]
pub const ALL_KEYS: &[&str] = &[
"ml-dsa-87",
"ecdsa-p384-sha384",
"ecdsa-p256-sha256",
"ecdsa-p521-sha512",
"ecdsa-p521-sha384",
"ed25519",
"rsa3072-sha384",
"rsa4096-sha384",
"rsa2048-sha384",
];
#[doc(hidden)]
pub const FIPS_SUITES: &[u16] = &[0x1302, 0x1301, 0xC02C, 0xC030, 0xC02B, 0xC02F];
#[doc(hidden)]
pub const PREFERRED_SCHEMES: &[u16] = &[0x0906, 0x0503, 0x0403, 0x0603, 0x0805, 0x0806, 0x0804];
#[doc(hidden)]
pub const PREFERRED_KEYS: &[&str] = &[
"ml-dsa-87",
"ecdsa-p384-sha384",
"ecdsa-p256-sha256",
"ecdsa-p521-sha512",
"ecdsa-p521-sha384",
"rsa3072-sha384",
"rsa4096-sha384",
];
#[doc(hidden)]
pub const GOLDEN: &[Golden] = &[
Golden {
excluded: &[],
profile: Profile::Unrestricted,
pq: false,
versions: &[0x0304, 0x0303],
suites: &[
0x1302, 0x1301, 0x1303, 0xC02C, 0xC030, 0xC02B, 0xC02F, 0xCCA9, 0xCCA8,
],
groups: &[0x0202, 0x11ED, 0x11EC, 0x11EB, 0x0018, 0x0017, 0x001D],
schemes: ALL_SCHEMES,
keys: ALL_KEYS,
},
Golden {
excluded: &[],
profile: Profile::Unrestricted,
pq: true,
versions: &[0x0304],
suites: &[0x1302, 0x1301, 0x1303],
groups: &[0x0202, 0x11ED, 0x11EC, 0x11EB],
schemes: ALL_SCHEMES_BUT_PKCS1,
keys: ALL_KEYS,
},
Golden {
excluded: &[],
profile: Profile::Preferred,
pq: false,
versions: &[0x0304],
suites: &[0x1302, 0x1301],
groups: &[0x0202, 0x11ED, 0x11EC, 0x11EB, 0x0018, 0x0017],
schemes: PREFERRED_SCHEMES,
keys: PREFERRED_KEYS,
},
Golden {
excluded: &[],
profile: Profile::Preferred,
pq: true,
versions: &[0x0304],
suites: &[0x1302, 0x1301],
groups: &[0x0202, 0x11ED, 0x11EC, 0x11EB],
schemes: PREFERRED_SCHEMES,
keys: PREFERRED_KEYS,
},
Golden {
excluded: &[],
profile: Profile::Cnsa2,
pq: false,
versions: &[0x0304],
suites: &[0x1302],
groups: &[0x0202],
schemes: &[0x0906],
keys: &["ml-dsa-87"],
},
Golden {
excluded: &[],
profile: Profile::Cnsa2,
pq: true,
versions: &[0x0304],
suites: &[0x1302],
groups: &[0x0202],
schemes: &[0x0906],
keys: &["ml-dsa-87"],
},
Golden {
excluded: &[],
profile: Profile::Cnsa1,
pq: false,
versions: &[0x0304, 0x0303],
suites: &[0x1302, 0xC02C, 0xC030],
groups: &[0x0018],
schemes: &[0x0503, 0x0805, 0x0501],
keys: &["ecdsa-p384-sha384", "rsa3072-sha384", "rsa4096-sha384"],
},
Golden {
excluded: &[],
profile: Profile::Bsi,
pq: false,
versions: &[0x0304, 0x0303],
suites: FIPS_SUITES,
groups: &[0x0018, 0x0017],
schemes: &[0x0503, 0x0403, 0x0603, 0x0805, 0x0806, 0x0804],
keys: &[
"ecdsa-p384-sha384",
"ecdsa-p256-sha256",
"ecdsa-p521-sha512",
],
},
Golden {
excluded: &[],
profile: Profile::Fips1403,
pq: false,
versions: &[0x0304, 0x0303],
suites: FIPS_SUITES,
groups: &[0x0202, 0x11ED, 0x11EC, 0x11EB, 0x0018, 0x0017],
schemes: ALL_SCHEMES,
keys: ALL_KEYS,
},
Golden {
excluded: &[],
profile: Profile::Fips1403,
pq: true,
versions: &[0x0304],
suites: &[0x1302, 0x1301],
groups: &[0x0202, 0x11ED, 0x11EC, 0x11EB],
schemes: ALL_SCHEMES_BUT_PKCS1,
keys: ALL_KEYS,
},
Golden {
excluded: &[],
profile: Profile::Fips1402,
pq: false,
versions: &[0x0304, 0x0303],
suites: FIPS_SUITES,
groups: &[0x0018, 0x0017],
schemes: &[
0x0503, 0x0403, 0x0603, 0x0805, 0x0806, 0x0804, 0x0501, 0x0601, 0x0401,
],
keys: &[
"ecdsa-p384-sha384",
"ecdsa-p256-sha256",
"ecdsa-p521-sha512",
"ecdsa-p521-sha384",
"rsa3072-sha384",
"rsa4096-sha384",
"rsa2048-sha384",
],
},
Golden {
excluded: &[],
profile: Profile::Cnsa1,
pq: true,
versions: &[0x0304],
suites: &[0x1302],
groups: &[],
schemes: &[0x0503, 0x0805],
keys: &["ecdsa-p384-sha384", "rsa3072-sha384", "rsa4096-sha384"],
},
Golden {
excluded: &[],
profile: Profile::Bsi,
pq: true,
versions: &[0x0304],
suites: &[0x1302, 0x1301],
groups: &[],
schemes: &[0x0503, 0x0403, 0x0603, 0x0805, 0x0806, 0x0804],
keys: &[
"ecdsa-p384-sha384",
"ecdsa-p256-sha256",
"ecdsa-p521-sha512",
],
},
Golden {
excluded: &[],
profile: Profile::Fips1402,
pq: true,
versions: &[0x0304],
suites: &[0x1302, 0x1301],
groups: &[],
schemes: &[0x0503, 0x0403, 0x0603, 0x0805, 0x0806, 0x0804],
keys: &[
"ecdsa-p384-sha384",
"ecdsa-p256-sha256",
"ecdsa-p521-sha512",
"ecdsa-p521-sha384",
"rsa3072-sha384",
"rsa4096-sha384",
"rsa2048-sha384",
],
},
];
#[doc(hidden)]
pub fn expected(module: Module, profile: Profile, options: Options) -> Result<Golden, CryptoError> {
let mut g = GOLDEN
.iter()
.find(|g| g.profile == profile && g.pq == options.pq_key_exchange_required)
.unwrap_or_else(|| panic!("no golden row for {profile} {options}"))
.clone();
match module.line {
ModuleLine::AwsLcFips4 => {}
ModuleLine::AwsLcFips3 => {
match profile {
Profile::Unrestricted | Profile::Fips1403 => {
g.schemes = if options.pq_key_exchange_required {
&[0x0503, 0x0403, 0x0603, 0x0807, 0x0805, 0x0806, 0x0804]
} else {
&[
0x0503, 0x0403, 0x0603, 0x0807, 0x0805, 0x0806, 0x0804, 0x0501, 0x0601,
0x0401,
]
};
g.keys = &[
"ecdsa-p384-sha384",
"ecdsa-p256-sha256",
"ecdsa-p521-sha512",
"ecdsa-p521-sha384",
"ed25519",
"rsa3072-sha384",
"rsa4096-sha384",
"rsa2048-sha384",
];
}
Profile::Preferred => {
g.schemes = &[0x0503, 0x0403, 0x0603, 0x0805, 0x0806, 0x0804];
g.keys = &[
"ecdsa-p384-sha384",
"ecdsa-p256-sha256",
"ecdsa-p521-sha512",
"ecdsa-p521-sha384",
"rsa3072-sha384",
"rsa4096-sha384",
];
}
Profile::Cnsa2 => {
g.schemes = &[];
g.keys = &[];
}
Profile::Cnsa1 | Profile::Bsi | Profile::Fips1402 => {}
}
match profile {
Profile::Unrestricted | Profile::Preferred | Profile::Fips1403 | Profile::Cnsa2 => {
g.excluded = &[
Algorithm::Scheme(TlsSignatureScheme::MlDsa87),
Algorithm::Signature(SignatureAlgorithm::MlDsa87),
];
}
Profile::Cnsa1 | Profile::Bsi | Profile::Fips1402 => {}
}
}
}
for (empty, category) in [
(g.versions.is_empty(), Family::Version),
(g.suites.is_empty(), Family::CipherSuite),
(g.groups.is_empty(), Family::KxGroup),
(g.schemes.is_empty(), Family::SignatureScheme),
(g.keys.is_empty(), Family::KeyAlgorithm),
] {
if empty {
return Err(CryptoError::EmptyProfile {
profile,
options,
category,
});
}
}
Ok(g)
}
#[doc(hidden)]
pub const MAC_GOLDEN: &[(Profile, &[MacAlgorithm], &[MacAlgorithm])] = &{
use MacAlgorithm::{HmacSha256 as H256, HmacSha384 as H384, HmacSha512 as H512};
[
(
Profile::Unrestricted,
&[H512, H384, H256],
&[H512, H384, H256],
),
(Profile::Preferred, &[H512, H384, H256], &[H512, H384, H256]),
(Profile::Cnsa2, &[H384, H512], &[H384, H512]),
(Profile::Cnsa1, &[H384], &[H384, H256]),
(Profile::Bsi, &[H512, H384, H256], &[H512, H384, H256]),
(Profile::Fips1403, &[H512, H384, H256], &[H512, H384, H256]),
(Profile::Fips1402, &[H512, H384, H256], &[H512, H384, H256]),
]
};
#[doc(hidden)]
pub const KDF_GOLDEN: &[(Profile, &[KdfAlgorithm], &[KdfAlgorithm])] = &{
use KdfAlgorithm::{
HkdfSha256 as K256, HkdfSha384 as K384, HkdfSha512 as K512, OneStepSha256 as O256,
OneStepSha384 as O384, OneStepSha512 as O512,
};
const ALL: &[KdfAlgorithm] = &[K512, K384, K256, O512, O384, O256];
[
(Profile::Unrestricted, ALL, ALL),
(Profile::Preferred, ALL, ALL),
(Profile::Cnsa2, &[K384, K512], &[K384, K512]),
(Profile::Cnsa1, &[K384], &[K384, K256]),
(Profile::Bsi, &[K512, K384, K256], &[K512, K384, K256]),
(Profile::Fips1403, ALL, ALL),
(Profile::Fips1402, ALL, ALL),
]
};
#[doc(hidden)]
pub const KEY_AGREEMENT_GOLDEN: &[(Profile, &[KeyAgreementAlgorithm])] = &{
use KeyAgreementAlgorithm::{EcdhP256 as P256, EcdhP384 as P384, EcdhP521 as P521, X25519};
[
(Profile::Unrestricted, &[P384, P521, P256, X25519]),
(Profile::Preferred, &[P384, P521, P256]),
(Profile::Cnsa2, &[]),
(Profile::Cnsa1, &[P384]),
(Profile::Bsi, &[]),
(Profile::Fips1403, &[P384, P521, P256]),
(Profile::Fips1402, &[P384, P521, P256]),
]
};
#[doc(hidden)]
pub const AEAD_GOLDEN: &[(Profile, &[AeadAlgorithm])] = &{
use AeadAlgorithm::{Aes128Gcm as A128, Aes256Gcm as A256, Chacha20Poly1305 as C20};
[
(Profile::Unrestricted, &[A256, A128, C20]),
(Profile::Preferred, &[A256, A128]),
(Profile::Cnsa2, &[A256]),
(Profile::Cnsa1, &[A256]),
(Profile::Bsi, &[A256, A128]),
(Profile::Fips1403, &[A256, A128]),
(Profile::Fips1402, &[A256, A128]),
]
};
#[doc(hidden)]
pub const HASH_GOLDEN: &[(Profile, &[HashAlgorithm], &[HashAlgorithm])] = &{
use HashAlgorithm::{
Sha3_256 as S3_256, Sha3_384 as S3_384, Sha3_512 as S3_512, Sha256 as S256, Sha384 as S384,
Sha512 as S512,
};
const SHA2: &[HashAlgorithm] = &[S512, S384, S256];
const ALL: &[HashAlgorithm] = &[S512, S384, S256, S3_512, S3_384, S3_256];
[
(Profile::Unrestricted, ALL, ALL),
(Profile::Preferred, SHA2, SHA2),
(Profile::Cnsa2, &[S384, S512], &[S384, S512]),
(Profile::Cnsa1, &[S384], &[S384, S256]),
(Profile::Bsi, ALL, ALL),
(Profile::Fips1403, ALL, ALL),
(Profile::Fips1402, ALL, ALL),
]
};
#[doc(hidden)]
pub const SIGNATURE_GOLDEN: &[(Profile, &[SignatureAlgorithm], &[SignatureAlgorithm])] = &{
use SignatureAlgorithm::{
EcdsaP256Sha256 as P256, EcdsaP384Sha384 as P384, EcdsaP521Sha384 as P521_384,
EcdsaP521Sha512 as P521_512, Ed25519 as Ed, MlDsa87 as Ml, Rsa2048Sha384 as R2048,
Rsa2048Sha384Pss as P2048, Rsa3072Sha384 as R3072, Rsa3072Sha384Pss as P3072,
Rsa4096Sha384 as R4096, Rsa4096Sha384Pss as P4096,
};
const ALL: &[SignatureAlgorithm] = &[
Ml, P384, P521_512, P521_384, P256, Ed, P4096, P3072, P2048, R4096, R3072, R2048,
];
const PREFERRED: &[SignatureAlgorithm] =
&[Ml, P384, P521_512, P256, P4096, P3072, R4096, R3072];
const CNSA1: &[SignatureAlgorithm] = &[P384, P4096, P3072, R4096, R3072];
const CNSA1_UNCLASSIFIED: &[SignatureAlgorithm] =
&[P384, P4096, P3072, R4096, R3072, P2048, R2048];
const FIPS1403: &[SignatureAlgorithm] = &[
Ml, P384, P521_512, P256, Ed, P4096, P3072, P2048, R4096, R3072, R2048,
];
const FIPS1402: &[SignatureAlgorithm] = &[
P384, P521_512, P521_384, P256, P4096, P3072, P2048, R4096, R3072, R2048,
];
[
(Profile::Unrestricted, ALL, ALL),
(Profile::Preferred, PREFERRED, PREFERRED),
(Profile::Cnsa2, &[Ml], &[Ml]),
(Profile::Cnsa1, CNSA1, CNSA1_UNCLASSIFIED),
(Profile::Bsi, &[P4096, P3072], &[P4096, P3072]),
(Profile::Fips1403, FIPS1403, FIPS1403),
(Profile::Fips1402, FIPS1402, FIPS1402),
]
};
#[cfg(test)]
mod tests {
use super::*;
use crate::capability::{Linkage, ModuleLine};
use crate::error::Family;
use crate::profile::select;
use crate::{Algorithm, TlsSignatureScheme};
const M3S: Module = Module {
line: ModuleLine::AwsLcFips3,
linkage: Linkage::Static,
};
const M3D: Module = Module {
line: ModuleLine::AwsLcFips3,
linkage: Linkage::Dynamic,
};
const M4S: Module = Module {
line: ModuleLine::AwsLcFips4,
linkage: Linkage::Static,
};
const M4D: Module = Module {
line: ModuleLine::AwsLcFips4,
linkage: Linkage::Dynamic,
};
fn admitted_excluded(m: Module, p: Profile) -> Vec<Algorithm> {
let ml_dsa = Algorithm::Signature(SignatureAlgorithm::MlDsa87);
match m.line {
ModuleLine::AwsLcFips3
if p.spec().signatures.contains(&SignatureAlgorithm::MlDsa87) =>
{
vec![ml_dsa]
}
ModuleLine::AwsLcFips3 | ModuleLine::AwsLcFips4 => vec![],
}
}
#[test]
fn select_admitted_agrees_with_the_signature_golden_rows_on_every_module() {
assert_eq!(SIGNATURE_GOLDEN.len(), Profile::ALL.len());
for (i, p) in Profile::ALL.iter().copied().enumerate() {
assert_eq!(SIGNATURE_GOLDEN[i].0, p);
}
for m in [M3S, M3D, M4S, M4D] {
for &(p, off, on) in SIGNATURE_GOLDEN {
for (unclassified, golden) in [(false, off), (true, on)] {
let o = Options {
cnsa1_unclassified_nss: unclassified,
..Options::default()
};
let s = crate::profile::select_admitted(p, o, m);
let want: Vec<SignatureAlgorithm> = golden
.iter()
.copied()
.filter(|a| {
m.line == ModuleLine::AwsLcFips4 || *a != SignatureAlgorithm::MlDsa87
})
.collect();
assert_eq!(s.signatures, want, "{m:?} {p} {unclassified}");
assert_eq!(
s.excluded,
admitted_excluded(m, p),
"{m:?} {p} {unclassified}"
);
}
}
}
assert_eq!(
admitted_excluded(M3D, Profile::Cnsa2),
[Algorithm::Signature(SignatureAlgorithm::MlDsa87)]
);
assert_eq!(admitted_excluded(M3S, Profile::Bsi), []);
assert_eq!(admitted_excluded(M4S, Profile::Unrestricted), []);
}
#[test]
fn select_admitted_agrees_with_the_mac_golden_rows_on_every_module() {
assert_eq!(MAC_GOLDEN.len(), Profile::ALL.len());
for (i, p) in Profile::ALL.iter().copied().enumerate() {
assert_eq!(MAC_GOLDEN[i].0, p);
}
for m in [M3S, M3D, M4S, M4D] {
for &(p, off, on) in MAC_GOLDEN {
for (unclassified, want) in [(false, off), (true, on)] {
let o = Options {
cnsa1_unclassified_nss: unclassified,
..Options::default()
};
let s = crate::profile::select_admitted(p, o, m);
assert_eq!(s.macs, want, "{m:?} {p} {unclassified}");
assert_eq!(
s.excluded,
admitted_excluded(m, p),
"{m:?} {p} {unclassified}"
);
}
}
}
}
#[test]
fn select_admitted_agrees_with_the_kdf_golden_rows_on_every_module() {
assert_eq!(KDF_GOLDEN.len(), Profile::ALL.len());
for (i, p) in Profile::ALL.iter().copied().enumerate() {
assert_eq!(KDF_GOLDEN[i].0, p);
}
for m in [M3S, M3D, M4S, M4D] {
for &(p, off, on) in KDF_GOLDEN {
for (unclassified, want) in [(false, off), (true, on)] {
let o = Options {
cnsa1_unclassified_nss: unclassified,
..Options::default()
};
let s = crate::profile::select_admitted(p, o, m);
assert_eq!(s.kdfs, want, "{m:?} {p} {unclassified}");
assert_eq!(
s.excluded,
admitted_excluded(m, p),
"{m:?} {p} {unclassified}"
);
}
}
}
}
#[test]
fn select_admitted_agrees_with_the_key_agreement_golden_rows_on_every_module() {
assert_eq!(KEY_AGREEMENT_GOLDEN.len(), Profile::ALL.len());
for (i, p) in Profile::ALL.iter().copied().enumerate() {
assert_eq!(KEY_AGREEMENT_GOLDEN[i].0, p);
}
for m in [M3S, M3D, M4S, M4D] {
for &(p, want) in KEY_AGREEMENT_GOLDEN {
for unclassified in [false, true] {
let o = Options {
cnsa1_unclassified_nss: unclassified,
..Options::default()
};
let s = crate::profile::select_admitted(p, o, m);
assert_eq!(s.key_agreements, want, "{m:?} {p} {unclassified}");
assert_eq!(
s.excluded,
admitted_excluded(m, p),
"{m:?} {p} {unclassified}"
);
}
}
}
}
#[test]
fn select_admitted_agrees_with_the_aead_golden_rows_on_every_module() {
assert_eq!(AEAD_GOLDEN.len(), Profile::ALL.len());
for (i, p) in Profile::ALL.iter().copied().enumerate() {
assert_eq!(AEAD_GOLDEN[i].0, p);
}
for m in [M3S, M3D, M4S, M4D] {
for &(p, want) in AEAD_GOLDEN {
for unclassified in [false, true] {
let o = Options {
cnsa1_unclassified_nss: unclassified,
..Options::default()
};
let s = crate::profile::select_admitted(p, o, m);
assert_eq!(s.aeads, want, "{m:?} {p} {unclassified}");
assert_eq!(
s.excluded,
admitted_excluded(m, p),
"{m:?} {p} {unclassified}"
);
}
}
}
}
#[test]
fn select_admitted_agrees_with_the_hash_golden_rows_on_every_module() {
assert_eq!(HASH_GOLDEN.len(), Profile::ALL.len());
for (i, p) in Profile::ALL.iter().copied().enumerate() {
assert_eq!(HASH_GOLDEN[i].0, p);
}
for m in [M3S, M3D, M4S, M4D] {
for &(p, off, on) in HASH_GOLDEN {
for (unclassified, want) in [(false, off), (true, on)] {
let o = Options {
cnsa1_unclassified_nss: unclassified,
..Options::default()
};
let s = crate::profile::select_admitted(p, o, m);
assert_eq!(s.hashes, want, "{m:?} {p} {unclassified}");
assert_eq!(
s.excluded,
admitted_excluded(m, p),
"{m:?} {p} {unclassified}"
);
}
}
}
}
const PQ: Options = Options {
peer_certificates_match_profile: false,
pq_key_exchange_required: true,
cnsa1_unclassified_nss: false,
};
type Lists = (
Vec<u16>,
Vec<u16>,
Vec<u16>,
Vec<u16>,
Vec<&'static str>,
Vec<Algorithm>,
);
#[test]
fn every_profile_and_option_has_exactly_one_golden_row() {
assert_eq!(GOLDEN.len(), 14);
for &p in Profile::ALL {
for pq in [false, true] {
let n = GOLDEN
.iter()
.filter(|g| g.profile == p && g.pq == pq)
.count();
assert_eq!(n, 1, "{p} {pq}");
}
}
}
#[test]
fn select_agrees_with_the_golden_rows_on_every_module() {
for m in [M3S, M3D, M4S, M4D] {
let mut successes = 0;
for &p in Profile::ALL {
for pq in [false, true] {
let o = Options {
peer_certificates_match_profile: false,
pq_key_exchange_required: pq,
cnsa1_unclassified_nss: false,
};
let got: Result<Lists, CryptoError> = select(p, o, m).map(|s| {
(
s.versions.iter().map(|x| x.iana()).collect(),
s.cipher_suites.iter().map(|x| x.iana()).collect(),
s.kx_groups.iter().map(|x| x.iana()).collect(),
s.signature_schemes.iter().map(|x| x.iana()).collect(),
s.key_algorithms.iter().map(|x| x.as_str()).collect(),
s.excluded,
)
});
let want: Result<Lists, CryptoError> = expected(m, p, o).map(|g| {
(
g.versions.to_vec(),
g.suites.to_vec(),
g.groups.to_vec(),
g.schemes.to_vec(),
g.keys.to_vec(),
g.excluded.to_vec(),
)
});
assert_eq!(got, want, "{m:?} {p} {o}");
successes += usize::from(got.is_ok());
}
}
assert_eq!(
successes,
match m.line {
ModuleLine::AwsLcFips3 => 9,
ModuleLine::AwsLcFips4 => 11,
}
);
}
}
#[test]
fn expected_records_the_3x_refusals() {
let d = Options::default();
assert_eq!(
expected(M3S, Profile::Cnsa2, d).map(|_| ()),
Err(CryptoError::EmptyProfile {
profile: Profile::Cnsa2,
options: d,
category: Family::SignatureScheme,
})
);
assert_eq!(
expected(M3S, Profile::Preferred, PQ).unwrap().excluded,
&[
Algorithm::Scheme(TlsSignatureScheme::MlDsa87),
Algorithm::Signature(SignatureAlgorithm::MlDsa87)
]
);
assert!(expected(M3S, Profile::Cnsa1, d).is_ok());
assert_eq!(
expected(M3S, Profile::Fips1402, PQ).map(|_| ()),
Err(CryptoError::EmptyProfile {
profile: Profile::Fips1402,
options: PQ,
category: Family::KxGroup,
})
);
assert!(expected(M4S, Profile::Cnsa2, d).is_ok());
}
}