pub struct HmacDrbgSha256 { /* private fields */ }Expand description
An HMAC_DRBG-SHA-256 instance held by the library (SP 800-90A §10.1.2).
The caller seeds it through instantiate and
reseed: the library’s entropy source is not connected to
the C ABI’s DRBG handles, so the caller supplies entropy meeting
SP 800-90A and SP 800-90B and documents its source. Freed exactly once,
when dropped; the library zeroes the state.
Implementations§
Source§impl HmacDrbgSha256
impl HmacDrbgSha256
Sourcepub fn instantiate(
&mut self,
entropy: &[u8],
nonce: &[u8],
personalization: &[u8],
) -> Result<(), Error>
pub fn instantiate( &mut self, entropy: &[u8], nonce: &[u8], personalization: &[u8], ) -> Result<(), Error>
Instantiate (SP 800-90A §10.1.2.3). Empty nonce or
personalization are passed as absent.
Sourcepub fn reseed(&mut self, entropy: &[u8], additional: &[u8]) -> Result<(), Error>
pub fn reseed(&mut self, entropy: &[u8], additional: &[u8]) -> Result<(), Error>
Reseed (SP 800-90A §10.1.2.4). An empty additional is passed as
absent.
Sourcepub fn generate(
&mut self,
additional: &[u8],
out: &mut [u8],
) -> Result<(), Error>
pub fn generate( &mut self, additional: &[u8], out: &mut [u8], ) -> Result<(), Error>
Generate (SP 800-90A §10.1.2.5) out.len() bytes into out. An empty
additional is passed as absent. out is zeroed on every error.
A request over HMAC_DRBG_MAX_REQUEST_LEN is refused with
Error::OutputTooLong before the library is called, which would
otherwise allocate a buffer of the requested length before refusing.