//! Built-in suites (R3-1): the registry's named, versioned suites. IDs are //! stable: they are part of every envelope and of the AAD. //! //! LetUsMsg's profiles pick from these in `lum-crypto` (R3-10). use ccc_crypto_core::AeadAlgorithm::{AesGcm256, AesGcmSiv256, AsconAead128, XChaCha20Poly1305}; use crate::suite::{Layer, Suite}; /// The slot for the vetted, FIPS-capable layer. Builds bind it to AWS-LC /// (default), BoringSSL or wolfSSL with [`crate::ProviderSet::bind`]. pub const VETTED: &str = "vetted"; const fn layer(aead: ccc_crypto_core::AeadAlgorithm, provider: &'static str) -> Layer { Layer { aead, provider } } /// Floor: one vetted layer (AES-256-GCM from the vetted provider). pub fn floor_aes() -> Suite { Suite { id: 1, name: "floor-aes", layers: vec![layer(AesGcm256, VETTED)] } } /// Standard+: two layers, two providers, two design families. pub fn standard_2() -> Suite { Suite { id: 2, name: "standard-2", layers: vec![layer(AesGcm256, VETTED), layer(XChaCha20Poly1305, "rustcrypto")], } } /// High: three layers alternating providers. pub fn high_3() -> Suite { Suite { id: 3, name: "high-3", layers: vec![ layer(XChaCha20Poly1305, "rustcrypto"), layer(AesGcm256, VETTED), layer(AesGcmSiv256, "rustcrypto"), ], } } /// Ultra: three layers from two providers including a conservative /// alternative (Ascon-AEAD128), with adjacent layers from different providers. pub fn ultra_3() -> Suite { Suite { id: 4, name: "ultra-3", layers: vec![ layer(XChaCha20Poly1305, "rustcrypto"), layer(AesGcm256, VETTED), layer(AsconAead128, "rustcrypto"), ], } } /// Storage at rest for Standard: two layers (design: storage cascade row). pub fn storage_2() -> Suite { Suite { id: 5, name: "storage-2", layers: vec![layer(AesGcm256, VETTED), layer(AesGcmSiv256, "rustcrypto")] } } /// Every built-in suite. pub fn all() -> Vec { vec![floor_aes(), standard_2(), high_3(), ultra_3(), storage_2()] } /// The built-in suite with `id`. pub fn by_id(id: u16) -> Option { all().into_iter().find(|s| s.id == id) }