WizardsToolkit  1.0.7
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"
#include "wizard/utility-private.h"
Include dependency graph for random.c:

Go to the source code of this file.

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 StringInfoGetEntropyFromReservoir (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 unsigned long 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 unsigned long random_seed = ~0UL
static WizardBooleanType gather_true_random = WizardFalse

Define Documentation

#define MaxEntropyExtent   64

Referenced by GenerateEntropicChaos().

#define PseudoRandomHash   SHA256Hash

Definition at line 62 of file random.c.

Referenced by AcquireRandomInfo().

#define RandomEntropyLevel   9

Definition at line 63 of file random.c.

Referenced by GenerateEntropicChaos().

#define RandomFilename   "reservoir.xdm"

Definition at line 64 of file random.c.

Referenced by GetEntropyFromReservoir(), and SaveEntropyToReservoir().

#define RandomFiletype   "random"

Definition at line 65 of file random.c.

Referenced by GetEntropyFromReservoir(), and SaveEntropyToReservoir().

#define RandomProtocolMajorVersion   1

Definition at line 66 of file random.c.

Referenced by AcquireRandomInfo().

#define RandomProtocolMinorVersion   1

Definition at line 67 of file random.c.

Referenced by AcquireRandomInfo().


Function Documentation

WizardExport double GetPseudoRandomValue ( RandomInfo random_info)

Definition at line 776 of file random.c.

References _RandomInfo::seed, and _RandomInfo::normalize.

WizardExport StringInfo* GetRandomKey ( RandomInfo random_info,
const size_t  length 
)
WizardExport double GetRandomValue ( RandomInfo random_info)

Definition at line 852 of file random.c.

References SetRandomKey().

static void IncrementRandomNonce ( StringInfo nonce) [inline, static]

Definition at line 1051 of file random.c.

References GetStringInfoDatum(), GetStringInfoLength(), ThrowFatalException, and RandomFatalError.

Referenced by SetRandomKey().

WizardExport WizardBooleanType RandomComponentGenesis ( void  )

Definition at line 884 of file random.c.

References AcquireSemaphoreInfo(), random_semaphore, and WizardTrue.

Referenced by WizardsToolkitGenesis().

WizardExport void RandomComponentTerminus ( void  )

Definition at line 908 of file random.c.

References random_semaphore, AcquireSemaphoreInfo(), and DestroySemaphoreInfo().

Referenced by WizardsToolkitTerminus().

static ssize_t ReadRandom ( int  file,
unsigned char *  source,
size_t  length 
) [static]

Definition at line 336 of file random.c.

References read.

Referenced by GenerateEntropicChaos().

WizardExport void SeedPseudoRandomGenerator ( const unsigned long  seed)

Definition at line 1018 of file random.c.

References random_seed.

WizardExport void SetRandomTrueRandom ( const WizardBooleanType  true_random)

Definition at line 1148 of file random.c.

References gather_true_random.

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

Definition at line 160 of file random.c.

Referenced by AcquireRandomInfo().


Variable Documentation

char** environ

Referenced by GenerateEntropicChaos().

WizardBooleanType gather_true_random = WizardFalse [static]

Definition at line 125 of file random.c.

Referenced by GenerateEntropicChaos(), and SetRandomTrueRandom().

unsigned long random_seed = ~0UL [static]

Definition at line 122 of file random.c.

Referenced by AcquireRandomInfo(), and SeedPseudoRandomGenerator().

Definition at line 119 of file random.c.

Referenced by RandomComponentGenesis(), and RandomComponentTerminus().