Crypto++ 8.9
Free C++ class library of cryptographic schemes
|
Interface for NIST DRBGs from SP 800-90A. More...
#include <drbg.h>
Classes | |
class | Err |
Exception thrown when a NIST DRBG encounters an error. More... | |
Public Member Functions | |
virtual bool | CanIncorporateEntropy () const |
Determines if a generator can accept additional entropy. | |
virtual void | IncorporateEntropy (const byte *input, size_t length)=0 |
Update RNG state with additional unpredictable values. | |
virtual void | IncorporateEntropy (const byte *entropy, size_t entropyLength, const byte *additional, size_t additionaLength)=0 |
Update RNG state with additional unpredictable values. | |
virtual void | GenerateBlock (byte *output, size_t size)=0 |
Generate random array of bytes. | |
virtual void | GenerateBlock (const byte *additional, size_t additionaLength, byte *output, size_t size)=0 |
Generate random array of bytes. | |
virtual unsigned int | SecurityStrength () const =0 |
Provides the security strength. | |
virtual unsigned int | SeedLength () const =0 |
Provides the seed length. | |
virtual unsigned int | MinEntropyLength () const =0 |
Provides the minimum entropy size. | |
virtual unsigned int | MaxEntropyLength () const =0 |
Provides the maximum entropy size. | |
virtual unsigned int | MinNonceLength () const =0 |
Provides the minimum nonce size. | |
virtual unsigned int | MaxNonceLength () const =0 |
Provides the maximum nonce size. | |
virtual unsigned int | MaxBytesPerRequest () const =0 |
Provides the maximum size of a request to GenerateBlock. | |
virtual unsigned int | MaxRequestBeforeReseed () const =0 |
Provides the maximum number of requests before a reseed. | |
Public Member Functions inherited from RandomNumberGenerator | |
virtual byte | GenerateByte () |
Generate new random byte and return it. | |
virtual unsigned int | GenerateBit () |
Generate new random bit and return it. | |
virtual word32 | GenerateWord32 (word32 min=0, word32 max=0xffffffffUL) |
Generate a random 32 bit word in the range min to max, inclusive. | |
virtual void | GenerateIntoBufferedTransformation (BufferedTransformation &target, const std::string &channel, lword length) |
Generate random bytes into a BufferedTransformation. | |
virtual void | DiscardBytes (size_t n) |
Generate and discard n bytes. | |
template<class IT > | |
void | Shuffle (IT begin, IT end) |
Randomly shuffle the specified array. | |
Public Member Functions inherited from Algorithm | |
Algorithm (bool checkSelfTestStatus=true) | |
Interface for all crypto algorithms. | |
virtual std::string | AlgorithmName () const |
Provides the name of this algorithm. | |
virtual std::string | AlgorithmProvider () const |
Retrieve the provider of this algorithm. | |
Public Member Functions inherited from Clonable | |
virtual Clonable * | Clone () const |
Copies this object. | |
Interface for NIST DRBGs from SP 800-90A.
NIST_DRBG is the base class interface for NIST DRBGs from SP 800-90A Rev 1 (June 2015)
You should reseed the generator after a fork() to avoid multiple generators with the same internal state.
|
inlinevirtual |
Determines if a generator can accept additional entropy.
All NIST_DRBG return true
Reimplemented from RandomNumberGenerator.
|
pure virtual |
Update RNG state with additional unpredictable values.
input | the entropy to add to the generator |
length | the size of the input buffer |
NIST_DRBG::Err | if the generator is reseeded with insufficient entropy |
NIST instantiation and reseed requirements demand the generator is constructed with at least MINIMUM_ENTROPY
entropy. The byte array for input
must meet NIST SP 800-90B or SP 800-90C requirements.
Reimplemented from RandomNumberGenerator.
Implemented in Hash_DRBG< HASH, STRENGTH, SEEDLENGTH >, and HMAC_DRBG< HASH, STRENGTH, SEEDLENGTH >.
|
pure virtual |
Update RNG state with additional unpredictable values.
entropy | the entropy to add to the generator |
entropyLength | the size of the input buffer |
additional | additional input to add to the generator |
additionaLength | the size of the additional input buffer |
NIST_DRBG::Err | if the generator is reseeded with insufficient entropy |
IncorporateEntropy() is an overload provided to match NIST requirements. NIST instantiation and reseed requirements demand the generator is constructed with at least MINIMUM_ENTROPY
entropy. The byte array for entropy
must meet NIST SP 800-90B or SP 800-90C requirements.
Implemented in Hash_DRBG< HASH, STRENGTH, SEEDLENGTH >, and HMAC_DRBG< HASH, STRENGTH, SEEDLENGTH >.
|
pure virtual |
Generate random array of bytes.
output | the byte buffer |
size | the length of the buffer, in bytes |
NIST_DRBG::Err | if a reseed is required |
NIST_DRBG::Err | if the size exceeds MAXIMUM_BYTES_PER_REQUEST |
Reimplemented from RandomNumberGenerator.
Implemented in Hash_DRBG< HASH, STRENGTH, SEEDLENGTH >, and HMAC_DRBG< HASH, STRENGTH, SEEDLENGTH >.
|
pure virtual |
Generate random array of bytes.
additional | additional input to add to the generator |
additionaLength | the size of the additional input buffer |
output | the byte buffer |
size | the length of the buffer, in bytes |
NIST_DRBG::Err | if a reseed is required |
NIST_DRBG::Err | if the size exceeds MAXIMUM_BYTES_PER_REQUEST |
GenerateBlock() is an overload provided to match NIST requirements. The byte array for additional
input is optional. If present the additional randomness is mixed before generating the output bytes.
Implemented in Hash_DRBG< HASH, STRENGTH, SEEDLENGTH >, and HMAC_DRBG< HASH, STRENGTH, SEEDLENGTH >.
|
pure virtual |
Provides the security strength.
The equivalent class constant is SECURITY_STRENGTH
Implemented in Hash_DRBG< HASH, STRENGTH, SEEDLENGTH >, and HMAC_DRBG< HASH, STRENGTH, SEEDLENGTH >.
|
pure virtual |
Provides the seed length.
The equivalent class constant is SEED_LENGTH
. The size is used to maintain internal state of V
and C
.
Implemented in Hash_DRBG< HASH, STRENGTH, SEEDLENGTH >, and HMAC_DRBG< HASH, STRENGTH, SEEDLENGTH >.
|
pure virtual |
Provides the minimum entropy size.
The equivalent class constant is MINIMUM_ENTROPY
. All NIST DRBGs must be instaniated with at least MINIMUM_ENTROPY
bytes of entropy. The bytes must meet NIST SP 800-90B or SP 800-90C requirements.
Implemented in Hash_DRBG< HASH, STRENGTH, SEEDLENGTH >, and HMAC_DRBG< HASH, STRENGTH, SEEDLENGTH >.
|
pure virtual |
Provides the maximum entropy size.
The equivalent class constant is MAXIMUM_ENTROPY
. The bytes must meet NIST SP 800-90B or SP 800-90C requirements. MAXIMUM_ENTROPY
has been reduced from 235 to INT_MAX
to fit the underlying C++ datatype.
Implemented in Hash_DRBG< HASH, STRENGTH, SEEDLENGTH >, and HMAC_DRBG< HASH, STRENGTH, SEEDLENGTH >.
|
pure virtual |
Provides the minimum nonce size.
The equivalent class constant is MINIMUM_NONCE
. If a nonce is not required then MINIMUM_NONCE
is 0. Hash_DRBG
does not require a nonce, while HMAC_DRBG
and CTR_DRBG
require a nonce.
Implemented in Hash_DRBG< HASH, STRENGTH, SEEDLENGTH >, and HMAC_DRBG< HASH, STRENGTH, SEEDLENGTH >.
|
pure virtual |
Provides the maximum nonce size.
The equivalent class constant is MAXIMUM_NONCE
. MAXIMUM_NONCE
has been reduced from 235 to INT_MAX
to fit the underlying C++ datatype. If a nonce is not required then MINIMUM_NONCE
is 0. Hash_DRBG
does not require a nonce, while HMAC_DRBG
and CTR_DRBG
require a nonce.
Implemented in Hash_DRBG< HASH, STRENGTH, SEEDLENGTH >, and HMAC_DRBG< HASH, STRENGTH, SEEDLENGTH >.
|
pure virtual |
Provides the maximum size of a request to GenerateBlock.
The equivalent class constant is MAXIMUM_BYTES_PER_REQUEST
Implemented in Hash_DRBG< HASH, STRENGTH, SEEDLENGTH >, and HMAC_DRBG< HASH, STRENGTH, SEEDLENGTH >.
|
pure virtual |
Provides the maximum number of requests before a reseed.
The equivalent class constant is MAXIMUM_REQUESTS_BEFORE_RESEED
. MAXIMUM_REQUESTS_BEFORE_RESEED
has been reduced from 248 to INT_MAX
to fit the underlying C++ datatype.
Implemented in Hash_DRBG< HASH, STRENGTH, SEEDLENGTH >, and HMAC_DRBG< HASH, STRENGTH, SEEDLENGTH >.