Skip to main content

securedrop_protocol_minimal/
constants.rs

1// Key lengths
2pub(crate) const LEN_DHKEM_ENCAPS_KEY: usize = libcrux_curve25519::EK_LEN;
3pub(crate) const LEN_DHKEM_DECAPS_KEY: usize = libcrux_curve25519::DK_LEN;
4pub(crate) const LEN_DHKEM_SHAREDSECRET_ENCAPS: usize = libcrux_curve25519::SS_LEN;
5pub(crate) const LEN_DHKEM_SHARED_SECRET: usize = libcrux_curve25519::SS_LEN;
6pub const LEN_DH_ITEM: usize = LEN_DHKEM_DECAPS_KEY;
7
8// https://openquantumsafe.org/liboqs/algorithms/kem/ml-kem.html
9// todo, source from crates instead of hardcoding
10pub const LEN_MLKEM_ENCAPS_KEY: usize = 1184;
11pub(crate) const LEN_MLKEM_DECAPS_KEY: usize = 2400;
12pub(crate) const LEN_MLKEM_SHAREDSECRET_ENCAPS: usize = 1088;
13pub(crate) const LEN_MLKEM_SHAREDSECRET: usize = 32;
14pub(crate) const LEN_MLKEM_RAND_SEED_SIZE: usize = 64;
15
16// https://datatracker.ietf.org/doc/draft-connolly-cfrg-xwing-kem/#name-encoding-and-sizes
17pub const LEN_XWING_ENCAPS_KEY: usize = 1216;
18pub(crate) const LEN_XWING_DECAPS_KEY: usize = 32;
19pub(crate) const LEN_XWING_SHAREDSECRET_ENCAPS: usize = 1120;
20pub(crate) const LEN_XWING_SHAREDSECRET: usize = 32;
21pub(crate) const LEN_XWING_RAND_SEED_SIZE: usize = 96;
22
23// Message ID (uuid) and KMID
24pub(crate) const LEN_MESSAGE_ID: usize = 16;
25// TODO: this will be aes-gcm and use AES GCM TagSize
26// TODO: current implementation prepends the nonce to the encrypted message.
27// Recheck this when switching implementations.
28pub(crate) const LEN_KMID: usize =
29    libcrux_chacha20poly1305::TAG_LEN + libcrux_chacha20poly1305::NONCE_LEN + LEN_MESSAGE_ID;