1use core::ops::Add;
9
10use digest::block_api::{CoreProxy, EagerHash, SmallBlockSizeUser};
11use generic_array::ArrayLength;
12use generic_array::typenum::{IsLess, Le, NonZero, Sum, U256};
13
14use crate::envelope::NonceLen;
15use crate::hash::{Hash, OutputSize, ProxyHash};
16use crate::key_exchange::KeyExchange;
17use crate::key_exchange::group::Group;
18use crate::ksf::Ksf;
19use crate::opaque::MaskedResponseLen;
20
21pub trait CipherSuite
28where
29 OprfHash<Self>: Hash + EagerHash,
30 <OprfHash<Self> as CoreProxy>::Core: ProxyHash,
31 <<OprfHash<Self> as CoreProxy>::Core as SmallBlockSizeUser>::_BlockSize: IsLess<U256>,
32 Le<<<OprfHash<Self> as CoreProxy>::Core as SmallBlockSizeUser>::_BlockSize, U256>: NonZero,
33 OutputSize<OprfHash<Self>>: Add<NonceLen> + ArrayLength,
38 Sum<OutputSize<OprfHash<Self>>, NonceLen>: ArrayLength + Add<<KeGroup<Self> as Group>::PkLen>,
39 MaskedResponseLen<Self>: ArrayLength,
40 <OprfGroup<Self> as voprf::Group>::ScalarLen: ArrayLength,
42 <OprfGroup<Self> as voprf::Group>::ElemLen: ArrayLength,
43{
44 type OprfCs: voprf::CipherSuite;
46 type KeyExchange: KeyExchange;
48 type Ksf: Ksf;
50}
51
52pub(crate) type OprfGroup<CS: CipherSuite> = <CS::OprfCs as voprf::CipherSuite>::Group;
53pub(crate) type OprfHash<CS: CipherSuite> = <CS::OprfCs as voprf::CipherSuite>::Hash;
54pub(crate) type KeGroup<CS: CipherSuite> = <CS::KeyExchange as KeyExchange>::Group;
55pub(crate) type KeHash<CS: CipherSuite> = <CS::KeyExchange as KeyExchange>::Hash;