Expand description
NIST SP 800-90A Rev. 1 HMAC_DRBG(SHA-256) with SP 800-90C reseed-budget enforcement.
Implements SP 800-90A Rev. 1 Section 10.1.2 (HMAC_DRBG_Update, HMAC_DRBG_Instantiate,
HMAC_DRBG_Reseed, HMAC_DRBG_Generate) and Section 11.3 health-check KATs in pure #![no_std]
Rust with zero external dependencies and zero heap allocation.
§SP 800-90A / SP 800-90C Alignment
- For 256-bit security strength (
RBG2), initialization requires at least 384 bits (48 bytes) of min-entropy (HmacDrbgSha256::instantiate_rbg2_in_place) or>= 32bytes entropy plus a>= 16byte nonce satisfying SP 800-90A Section 8.6.7 uniqueness/entropy requirements (HmacDrbgSha256::instantiate_in_place). - Reseeding requires at least 256 bits (32 bytes) of fresh min-entropy.
- After emitting
2^17bits (16,384 bytes) since the last instantiation or reseed, the DRBG returns [Error::DrbgReseedRequired] before any subsequentgeneratecall until reseeded (SP 800-90C §§5.2.3–5.3). A single request crossing the threshold completes (up toMAX_BYTES_PER_REQUEST), and the followinggeneratecall requires a reseed first. - Zero-byte
generaterequests follow SP 800-90A §10.1.2.5: they still check preconditions, reseed when prediction resistance is enabled, advance(K, V)via backtracking-resistantUpdate, and incrementreseed_counter. - Once [
Zeroize::zeroize] is called, the instance transitions to the uninitialized state and rejects allgenerate,generate_with_prediction_resistance, andreseedcalls until explicitly re-instantiated in place.
Structs§
- Hmac
Drbg Sha256 - NIST SP 800-90A Rev. 1
HMAC_DRBG(SHA-256)state (K,V, counters, lifecycle flag).