mls_rs_crypto_traits/
lib.rs1#![cfg_attr(not(feature = "std"), no_std)]
6extern crate alloc;
7
8mod aead;
9mod dh;
10mod ec;
11mod kdf;
12mod kem;
13
14pub use aead::{AeadId, AeadType, AEAD_ID_EXPORT_ONLY, AES_TAG_LEN};
15pub use dh::{DhType, SamplingMethod};
16pub use ec::Curve;
17pub use kdf::{KdfId, KdfType};
18pub use kem::{KemId, KemResult, KemType};
19use mls_rs_core::error::IntoAnyError;
20
21#[cfg(feature = "mock")]
22pub mod mock;
23
24use alloc::vec::Vec;
25
26#[cfg_attr(feature = "mock", mockall::automock(type Error = crate::mock::TestError;))]
27pub trait Hash: Send + Sync {
28 type Error: IntoAnyError + Send + Sync;
29
30 fn hash(&self, input: &[u8]) -> Result<Vec<u8>, Self::Error>;
31}
32
33#[cfg_attr(feature = "mock", mockall::automock(type Error = crate::mock::TestError;))]
34pub trait VariableLengthHash: Send + Sync {
35 type Error: IntoAnyError + Send + Sync;
36
37 fn hash(&self, input: &[u8], out_len: usize) -> Result<Vec<u8>, Self::Error>;
38}