openmls/ciphersuite/
mod.rs1use ::tls_codec::{TlsDeserialize, TlsDeserializeBytes, TlsSerialize, TlsSize, VLBytes};
7use openmls_traits::{
8 crypto::OpenMlsCrypto,
9 random::OpenMlsRand,
10 types::{AeadType, Ciphersuite, CryptoError, SignatureScheme},
11};
12use signable::SignedStruct;
13
14use std::hash::Hash;
15
16mod aead;
17mod codec;
18pub(crate) mod hpke;
19mod kdf_label;
20mod mac;
21mod reuse_guard;
22mod secret;
23
24pub mod hash_ref;
26pub mod signable;
27pub mod signature;
28#[cfg(feature = "extensions-draft-08")]
29pub use hpke::{
30 safe_decrypt_with_label, safe_encrypt_with_label, Error as HpkeError, SafeEncryptionContext,
31};
32
33pub(crate) use aead::*;
35pub(crate) use mac::*;
36pub(crate) use reuse_guard::*;
37pub(crate) use secret::*;
38pub(crate) use signature::*;
39
40pub(crate) use serde::{Deserialize, Serialize};
41
42#[cfg(test)]
43mod tests_and_kats;
44
45const LABEL_PREFIX: &str = "MLS 1.0 ";
46
47pub type HpkePublicKey = VLBytes;
49pub use openmls_traits::types::HpkePrivateKey;
50
51#[inline(never)]
54fn equal_ct(a: &[u8], b: &[u8]) -> bool {
55 let mut diff = 0u8;
56 for (l, r) in a.iter().zip(b.iter()) {
57 diff |= l ^ r;
58 }
59 diff == 0
60}