Data Structures | Defines | Functions | Variables

random.c File Reference

#include "wizard/studio.h"
#include "wizard/entropy.h"
#include "wizard/exception.h"
#include "wizard/exception-private.h"
#include "wizard/file.h"
#include "wizard/hash.h"
#include "wizard/magick.h"
#include "wizard/memory_.h"
#include "wizard/random_.h"
#include "wizard/thread_.h"
#include "wizard/thread-private.h"
#include "wizard/semaphore.h"

Data Structures

struct  _RandomInfo

Defines

#define PseudoRandomHash   SHA256Hash
#define RandomEntropyLevel   9
#define RandomFilename   "reservoir.xdm"
#define RandomFiletype   "random"
#define RandomProtocolMajorVersion   1
#define RandomProtocolMinorVersion   1
#define MaxEntropyExtent   64

Functions

static WizardBooleanType SaveEntropyToReservoir (RandomInfo *, ExceptionInfo *)
static StringInfoGenerateEntropicChaos (RandomInfo *, ExceptionInfo *)
static StringInfo ** GetEntropyFromReservoir (RandomInfo *, ExceptionInfo *)
static size_t WizardMin (const size_t x, const size_t y)
WizardExport RandomInfoAcquireRandomInfo (const HashType hash)
WizardExport RandomInfoDestroyRandomInfo (RandomInfo *random_info)
static ssize_t ReadRandom (int file, unsigned char *source, size_t length)
WizardExport double GetPseudoRandomValue (RandomInfo *random_info)
WizardExport StringInfoGetRandomKey (RandomInfo *random_info, const size_t length)
WizardExport double GetRandomValue (RandomInfo *random_info)
WizardExport WizardBooleanType RandomComponentGenesis (void)
WizardExport void RandomComponentTerminus (void)
WizardExport void SeedPseudoRandomGenerator (const size_t seed)
static void IncrementRandomNonce (StringInfo *nonce)
WizardExport void SetRandomKey (RandomInfo *random_info, const size_t length, unsigned char *key)
WizardExport void SetRandomTrueRandom (const WizardBooleanType true_random)

Variables

char ** environ
static SemaphoreInforandom_semaphore = (SemaphoreInfo *) NULL
static size_t random_seed = ~0UL
static WizardBooleanType gather_true_random = WizardFalse

Define Documentation

#define MaxEntropyExtent   64

Referenced by GenerateEntropicChaos().

#define PseudoRandomHash   SHA256Hash

Referenced by AcquireRandomInfo().

#define RandomEntropyLevel   9

Referenced by GenerateEntropicChaos().

#define RandomFilename   "reservoir.xdm"
#define RandomFiletype   "random"
#define RandomProtocolMajorVersion   1
#define RandomProtocolMinorVersion   1

Function Documentation

WizardExport RandomInfo* AcquireRandomInfo ( const HashType  hash  ) 
WizardExport RandomInfo* DestroyRandomInfo ( RandomInfo random_info  ) 
static StringInfo * GenerateEntropicChaos ( RandomInfo random_info,
ExceptionInfo exception 
) [static]
static StringInfo * GetEntropyFromReservoir ( RandomInfo random_info,
ExceptionInfo exception 
)
WizardExport double GetPseudoRandomValue ( RandomInfo random_info  ) 
WizardExport StringInfo* GetRandomKey ( RandomInfo random_info,
const size_t  length 
)
WizardExport double GetRandomValue ( RandomInfo random_info  ) 

References SetRandomKey().

static void IncrementRandomNonce ( StringInfo nonce  )  [inline, static]
WizardExport WizardBooleanType RandomComponentGenesis ( void   ) 
WizardExport void RandomComponentTerminus ( void   ) 
static ssize_t ReadRandom ( int  file,
unsigned char *  source,
size_t  length 
) [static]

References read.

Referenced by GenerateEntropicChaos().

static WizardBooleanType SaveEntropyToReservoir ( RandomInfo random_info,
ExceptionInfo exception 
) [static]
WizardExport void SeedPseudoRandomGenerator ( const size_t  seed  ) 

References random_seed.

WizardExport void SetRandomKey ( RandomInfo random_info,
const size_t  length,
unsigned char *  key 
)
WizardExport void SetRandomTrueRandom ( const WizardBooleanType  true_random  ) 

References gather_true_random.

static size_t WizardMin ( const size_t  x,
const size_t  y 
) [inline, static]

Referenced by AcquireRandomInfo().


Variable Documentation

char** environ

Referenced by GenerateEntropicChaos().

WizardBooleanType gather_true_random = WizardFalse [static]
size_t random_seed = ~0UL [static]