Crypto++  5.6.5
Free C++ class library of cryptographic schemes
Classes | Functions
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
 Wrapper for Microsoft crypto service provider. More...
 
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

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

Detailed Description

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

Definition in file osrng.h.

Function Documentation

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

OS_GenerateRandomBlock.

Generate random array of bytes

Parameters
blockingspecifies whther a bobcking 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.

Definition at line 238 of file osrng.cpp.