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

## OS_GenerateRandomBlock()

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

OS_GenerateRandomBlock.

Generate random array of bytes

Parameters

  blocking | specifies whther a bobcking or non-blocking generator should be used
  output | the byte buffer
  size | the 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.