1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/// Minimal cryptographic RNG trait and OS-backed implementation.
///
/// Provides the [`CryptoRng`] trait used throughout ML-KEM for obtaining
/// random bytes, and [`OsRng`], a zero-dependency implementation backed
/// by the operating system's entropy source.
use MlKemError;
/// Trait for cryptographic-quality random byte generation.
///
/// Implementations must provide bytes suitable for key material and nonces.
/// The trait is intentionally minimal (a single method) to allow easy
/// integration with external RNG libraries or hardware RNGs.
///
/// # Errors
///
/// Returns [`MlKemError::RngFailure`] if the underlying entropy source
/// is unavailable or fails.
/// OS-backed cryptographic RNG reading from `/dev/urandom` on Unix.
///
/// Only available with the `std` feature. In `no_std` builds, callers
/// must supply their own [`CryptoRng`] implementation (typically
/// wrapping a hardware RNG on embedded targets).
;