Fabcoin Core  0.16.2
P2P Digital Currency
Classes | Public Member Functions | Protected Member Functions | List of all members
NIST_DRBG Class Referenceabstract

Interface for NIST DRBGs from SP 800-90A. More...

#include <drbg.h>

Inheritance diagram for NIST_DRBG:
[legend]
Collaboration diagram for NIST_DRBG:
[legend]

Classes

class  Err
 Exception thrown when a NIST DRBG encounters an error. More...
 

Public Member Functions

virtual ~NIST_DRBG ()
 
virtual bool CanIncorporateEntropy () const
 Determines if a generator can accept additional entropy. More...
 
virtual void IncorporateEntropy (const byte *input, size_t length)=0
 Update RNG state with additional unpredictable values. More...
 
virtual void IncorporateEntropy (const byte *entropy, size_t entropyLength, const byte *additional, size_t additionaLength)=0
 Update RNG state with additional unpredictable values. More...
 
virtual void GenerateBlock (byte *output, size_t size)=0
 Generate random array of bytes. More...
 
virtual void GenerateBlock (const byte *additional, size_t additionaLength, byte *output, size_t size)=0
 Generate random array of bytes. More...
 
virtual unsigned int GetSecurityStrength () const =0
 Provides the security strength. More...
 
virtual unsigned int GetSeedLength () const =0
 Provides the seed length. More...
 
virtual unsigned int GetMinEntropy () const =0
 Provides the minimum entropy size. More...
 
virtual unsigned int GetMaxEntropy () const =0
 Provides the maximum entropy size. More...
 
virtual unsigned int GetMinNonce () const =0
 Provides the minimum nonce size. More...
 
virtual unsigned int GetMaxNonce () const =0
 Provides the maximum nonce size. More...
 
virtual unsigned int GetMaxBytesPerRequest () const =0
 Provides the maximum size of a request to GenerateBlock. More...
 
virtual unsigned int GetMaxRequestBeforeReseed () const =0
 Provides the maximum number of requests before a reseed. More...
 
- Public Member Functions inherited from RandomNumberGenerator
virtual ~RandomNumberGenerator ()
 
virtual byte GenerateByte ()
 Generate new random byte and return it. More...
 
virtual unsigned int GenerateBit ()
 Generate new random bit and return it. More...
 
virtual word32 GenerateWord32 (word32 min=0, word32 max=0xffffffffUL)
 Generate a random 32 bit word in the range min to max, inclusive. More...
 
virtual void GenerateIntoBufferedTransformation (BufferedTransformation &target, const std::string &channel, lword length)
 Generate random bytes into a BufferedTransformation. More...
 
virtual void DiscardBytes (size_t n)
 Generate and discard n bytes. More...
 
template<class IT >
void Shuffle (IT begin, IT end)
 Randomly shuffle the specified array. More...
 
- Public Member Functions inherited from Algorithm
virtual ~Algorithm ()
 
 Algorithm (bool checkSelfTestStatus=true)
 Interface for all crypto algorithms. More...
 
virtual std::string AlgorithmName () const
 Provides the name of this algorithm. More...
 
- Public Member Functions inherited from Clonable
virtual ~Clonable ()
 
virtual ClonableClone () const
 Copies this object. More...
 

Protected Member Functions

virtual void DRBG_Instantiate (const byte *entropy, size_t entropyLength, const byte *nonce, size_t nonceLength, const byte *personalization, size_t personalizationLength)=0
 
virtual void DRBG_Reseed (const byte *entropy, size_t entropyLength, const byte *additional, size_t additionaLength)=0
 

Detailed Description

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)

See also
Recommendation for Random Number Generation Using Deterministic Random Bit Generators, Rev 1 (June 2015)
Since
Crypto++ 5.7

Definition at line 24 of file drbg.h.

Constructor & Destructor Documentation

virtual NIST_DRBG::~NIST_DRBG ( )
inlinevirtual

Definition at line 36 of file drbg.h.

Member Function Documentation

virtual bool NIST_DRBG::CanIncorporateEntropy ( ) const
inlinevirtual

Determines if a generator can accept additional entropy.

Returns
true

All NIST_DRBG return true

Reimplemented from RandomNumberGenerator.

Definition at line 41 of file drbg.h.

virtual void NIST_DRBG::DRBG_Instantiate ( const byte entropy,
size_t  entropyLength,
const byte nonce,
size_t  nonceLength,
const byte personalization,
size_t  personalizationLength 
)
protectedpure virtual
virtual void NIST_DRBG::DRBG_Reseed ( const byte entropy,
size_t  entropyLength,
const byte additional,
size_t  additionaLength 
)
protectedpure virtual
virtual void NIST_DRBG::GenerateBlock ( byte output,
size_t  size 
)
pure virtual

Generate random array of bytes.

Parameters
outputthe byte buffer
sizethe length of the buffer, in bytes
Exceptions
NIST_DRBG::Errif a reseed is required
NIST_DRBG::Errif the size exceeds MAXIMUM_BYTES_PER_REQUEST

Reimplemented from RandomNumberGenerator.

Implemented in Hash_DRBG< HASH, STRENGTH, SEEDLENGTH >.

virtual void NIST_DRBG::GenerateBlock ( const byte additional,
size_t  additionaLength,
byte output,
size_t  size 
)
pure virtual

Generate random array of bytes.

Parameters
additionaladditional input to add to the generator
additionaLengththe size of the additional input buffer
outputthe byte buffer
sizethe length of the buffer, in bytes
Exceptions
NIST_DRBG::Errif a reseed is required
NIST_DRBG::Errif 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 >.

virtual unsigned int NIST_DRBG::GetMaxBytesPerRequest ( ) const
pure virtual

Provides the maximum size of a request to GenerateBlock.

Returns
The the maximum size of a request to GenerateBlock(), in bytes

The equivalent class constant is MAXIMUM_BYTES_PER_REQUEST

Implemented in Hash_DRBG< HASH, STRENGTH, SEEDLENGTH >.

virtual unsigned int NIST_DRBG::GetMaxEntropy ( ) const
pure virtual

Provides the maximum entropy size.

Returns
The maximum entropy size that can be consumed by the generator, in bytes

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 >.

virtual unsigned int NIST_DRBG::GetMaxNonce ( ) const
pure virtual

Provides the maximum nonce size.

Returns
The maximum nonce that can be consumed by the generator, in bytes

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 >.

virtual unsigned int NIST_DRBG::GetMaxRequestBeforeReseed ( ) const
pure virtual

Provides the maximum number of requests before a reseed.

Returns
The the maximum number of requests before a reseed, in bytes

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 >.

virtual unsigned int NIST_DRBG::GetMinEntropy ( ) const
pure virtual

Provides the minimum entropy size.

Returns
The minimum entropy size required by the generator, in bytes

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 >.

virtual unsigned int NIST_DRBG::GetMinNonce ( ) const
pure virtual

Provides the minimum nonce size.

Returns
The minimum nonce size recommended for the generator, in bytes

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 >.

virtual unsigned int NIST_DRBG::GetSecurityStrength ( ) const
pure virtual

Provides the security strength.

Returns
The security strength of the generator, in bytes

The equivalent class constant is SECURITY_STRENGTH

Implemented in Hash_DRBG< HASH, STRENGTH, SEEDLENGTH >.

virtual unsigned int NIST_DRBG::GetSeedLength ( ) const
pure virtual

Provides the seed length.

Returns
The seed size of the generator, in bytes

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 >.

virtual void NIST_DRBG::IncorporateEntropy ( const byte input,
size_t  length 
)
pure virtual

Update RNG state with additional unpredictable values.

Parameters
inputthe entropy to add to the generator
lengththe size of the input buffer
Exceptions
NIST_DRBG::Errif 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 >.

virtual void NIST_DRBG::IncorporateEntropy ( const byte entropy,
size_t  entropyLength,
const byte additional,
size_t  additionaLength 
)
pure virtual

Update RNG state with additional unpredictable values.

Parameters
entropythe entropy to add to the generator
entropyLengththe size of the input buffer
additionaladditional input to add to the generator
additionaLengththe size of the additional input buffer
Exceptions
NIST_DRBG::Errif 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 >.


The documentation for this class was generated from the following file: