Crypto++ 8.7
Free C++ class library of cryptographic schemes
Classes | Functions | Variables
osrng.h File Reference

Classes for access to the operating system's random number generators. More...

Go to the source code of this file.

Classes

class  OS_RNG_Err
 Exception thrown when an operating system error is encountered. More...
 
class  MicrosoftCryptoProvider
 
class  NonblockingRng
 Wrapper class for /dev/random and /dev/srandom. More...
 
class  BlockingRng
 Wrapper class for /dev/random and /dev/srandom. More...
 
class  AutoSeededRandomPool
 Automatically Seeded Randomness Pool. More...
 
class  AutoSeededX917RNG< BLOCK_CIPHER >
 Automatically Seeded X9.17 RNG. More...
 
class  DefaultAutoSeededRNG
 A typedef providing a default generator. More...
 

Functions

CRYPTOPP_DLL void OS_GenerateRandomBlock (bool blocking, byte *output, size_t size)
 OS_GenerateRandomBlock. More...
 

Variables

 AutoSeededX917RNG< AES >
 

Detailed Description

Classes for access to the operating system's random number generators.

Definition in file osrng.h.

Function Documentation

◆ OS_GenerateRandomBlock()

CRYPTOPP_DLL void OS_GenerateRandomBlock ( bool  blocking,
byte output,
size_t  size 
)

OS_GenerateRandomBlock.

Generate random array of bytes

Parameters
blockingspecifies whether a blocking or non-blocking generator should be used
outputthe byte buffer
sizethe length of the buffer, in bytes

OS_GenerateRandomBlock() uses the underlying operating system's random number generator. On Windows, CryptGenRandom() is called using NonblockingRng.

On Unix and compatibles, /dev/urandom is called if blocking is false using NonblockingRng. If blocking is true, then either /dev/randomd or /dev/srandom is used by way of BlockingRng, if available.

Variable Documentation

◆ AutoSeededX917RNG< AES >

Definition at line 274 of file osrng.h.