1#![cfg_attr(not(feature = "std"), no_std)]
12#![forbid(unsafe_code)]
13
14extern crate alloc;
15
16#[cfg(test)]
17pub(crate) mod test_rng {
18 use core::sync::atomic::{AtomicU64, Ordering};
19 use dcrypt_internal::random::{
20 try_fill_bytes_zeroing_on_error, ChaCha20Rng, CryptoRng, Error, RngCore,
21 };
22
23 static NEXT_STREAM: AtomicU64 = AtomicU64::new(1);
24
25 pub struct TestRng;
26
27 impl RngCore for TestRng {
28 fn try_fill_bytes(&mut self, destination: &mut [u8]) -> Result<(), Error> {
29 let stream = NEXT_STREAM.fetch_add(1, Ordering::Relaxed);
30 let mut seed = [0u8; 32];
31 seed[..8].copy_from_slice(&stream.to_le_bytes());
32 let mut rng = ChaCha20Rng::from_seed(seed);
33 try_fill_bytes_zeroing_on_error(&mut rng, destination)
34 }
35 }
36
37 impl CryptoRng for TestRng {}
38}
39
40pub mod kem;
41pub mod sign;