|
WizardsToolkit
1.0.7
|
#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"
Go to the source code of this file.
| #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().
| WizardExport RandomInfo* AcquireRandomInfo | ( | const HashType | hash | ) |
Definition at line 167 of file random.c.
References random_info, AcquireWizardMemory(), ThrowWizardFatalError, HashDomain, MemoryError, ResetWizardMemory(), _RandomInfo::hmac_info, AcquireHMACInfo(), _RandomInfo::nonce, AcquireStringInfo(), GetHMACDigestsize(), ResetStringInfo(), _RandomInfo::reservoir, _RandomInfo::normalize, _RandomInfo::semaphore, AllocateSemaphoreInfo(), _RandomInfo::protocol_major, RandomProtocolMajorVersion, _RandomInfo::protocol_minor, RandomProtocolMinorVersion, _RandomInfo::timestamp, _RandomInfo::signature, WizardSignature, AcquireExceptionInfo(), GenerateEntropicChaos(), ThrowFatalException, RandomFatalError, InitializeHMAC(), SetStringInfoLength(), SetStringInfo(), GetHMACDigest(), DestroyStringInfo(), SaveEntropyToReservoir(), DestroyExceptionInfo(), WizardFalse, DestroyRandomInfo(), random_seed, GetRandomKey(), CopyWizardMemory(), _RandomInfo::seed, GetStringInfoDatum(), GetStringInfoLength(), AcquireHashInfo(), PseudoRandomHash, SetStringInfoDatum(), UpdateHash(), FinalizeHash(), GetHashDigest(), WizardMin(), GetHashDigestsize(), and DestroyHashInfo().
Referenced by AcquireCipherInfo(), AcquireKeyInfo(), AcquireUniqueFileResource(), and AcquireSecretInfo().
| WizardExport RandomInfo* DestroyRandomInfo | ( | RandomInfo * | random_info | ) |
Definition at line 289 of file random.c.
References LogWizardEvent(), TraceEvent, GetWizardModule, WizardAssert, CipherDomain, _RandomInfo::signature, WizardSignature, LockSemaphoreInfo(), _RandomInfo::semaphore, _RandomInfo::reservoir, DestroyStringInfo(), _RandomInfo::nonce, _RandomInfo::hmac_info, DestroyHMACInfo(), ResetWizardMemory(), _RandomInfo::seed, UnlockSemaphoreInfo(), DestroySemaphoreInfo(), and RelinquishWizardMemory().
Referenced by DestroyCipherInfo(), DestroyKeyInfo(), AcquireRandomInfo(), AsynchronousResourceComponentTerminus(), and DestroySecretInfo().
| static StringInfo * GenerateEntropicChaos | ( | RandomInfo * | random_info, |
| ExceptionInfo * | exception | ||
| ) | [static] |
Definition at line 362 of file random.c.
References GetEntropyFromReservoir(), AcquireStringInfo(), LockSemaphoreInfo(), _RandomInfo::semaphore, SetStringInfoDatum(), ConcatenateStringInfo(), getpid, SetStringInfoLength(), GetWizardThreadId(), gettimeofday(), AcquireString(), close, ThrowWizardException(), GetWizardModule, RandomError, remove_utf8(), DestroyString(), NTElapsedTime(), NTUserTime(), MaxEntropyExtent, NTGatherRandomData(), GetStringInfoDatum(), WizardFalse, environ, StringToStringInfo(), GetStringInfoCRC(), ThrowFatalException, RandomFatalError, DestroyStringInfo(), open_utf8(), O_BINARY, ReadRandom(), gather_true_random, AcquireEntropyInfo(), ZIPEntropy, RandomEntropyLevel, IncreaseEntropy(), GetEntropyChaos(), GetStringInfoLength(), DestroyEntropyInfo(), and UnlockSemaphoreInfo().
Referenced by AcquireRandomInfo().
| static StringInfo * GetEntropyFromReservoir | ( | RandomInfo * | random_info, |
| ExceptionInfo * | exception | ||
| ) |
Definition at line 651 of file random.c.
References LogWizardEvent(), TraceEvent, GetWizardModule, WizardAssert, CipherDomain, _RandomInfo::signature, WizardSignature, LockSemaphoreInfo(), _RandomInfo::semaphore, AcquireFileInfo(), RandomFilename, ReadFileMode, UnlockSemaphoreInfo(), GetWizardMagick(), WizardMagick, CloneStringInfo(), ReadFileChunk(), GetStringInfoDatum(), GetStringInfoLength(), WizardFalse, CompareStringInfo(), DestroyFileInfo(), ThrowWizardException(), RandomError, GetFilePath(), DestroyStringInfo(), RandomFiletype, ReadFile16Bits(), _RandomInfo::protocol_major, _RandomInfo::protocol_minor, ReadFile64Bits(), _RandomInfo::timestamp, ReadFile32Bits(), AcquireStringInfo(), and GetStringInfoCRC().
Referenced by GenerateEntropicChaos().
| 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 | ||
| ) |
Definition at line 820 of file random.c.
References WizardAssert, CipherDomain, AcquireStringInfo(), SetRandomKey(), and GetStringInfoDatum().
Referenced by GenerateCipherNonce(), GenerateSessionKey(), AcquireRandomInfo(), AcquireUniqueFileResource(), and GenerateSecretKey().
| 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] |
| static WizardBooleanType SaveEntropyToReservoir | ( | RandomInfo * | random_info, |
| ExceptionInfo * | exception | ||
| ) | [static] |
Definition at line 940 of file random.c.
References LogWizardEvent(), TraceEvent, GetWizardModule, WizardAssert, CipherDomain, _RandomInfo::signature, WizardSignature, LockSemaphoreInfo(), _RandomInfo::semaphore, AcquireFileInfo(), RandomFilename, WriteFileMode, UnlockSemaphoreInfo(), WizardFalse, GetWizardMagick(), WizardMagick, WriteFileChunk(), GetStringInfoDatum(), GetStringInfoLength(), DestroyStringInfo(), RandomFiletype, WriteFile16Bits(), _RandomInfo::protocol_major, _RandomInfo::protocol_minor, WriteFile64Bits(), _RandomInfo::timestamp, GetHMACDigest(), _RandomInfo::hmac_info, WriteFile32Bits(), GetStringInfoCRC(), ThrowWizardException(), RandomError, GetFilePath(), DestroyFileInfo(), and WizardTrue.
Referenced by AcquireRandomInfo().
| WizardExport void SeedPseudoRandomGenerator | ( | const unsigned long | seed | ) |
Definition at line 1018 of file random.c.
References random_seed.
| WizardExport void SetRandomKey | ( | RandomInfo * | random_info, |
| const size_t | length, | ||
| unsigned char * | key | ||
| ) |
Definition at line 1069 of file random.c.
References WizardAssert, CipherDomain, LockSemaphoreInfo(), _RandomInfo::semaphore, _RandomInfo::hmac_info, GetStringInfoDatum(), _RandomInfo::reservoir, _RandomInfo::i, GetHMACDigestsize(), ResetHMAC(), UpdateHMAC(), _RandomInfo::nonce, FinalizeHMAC(), IncrementRandomNonce(), CopyWizardMemory(), GetHMACDigest(), SetStringInfo(), and UnlockSemaphoreInfo().
Referenced by EncipherCBCMode(), EncipherCTRMode(), EncipherECBMode(), EncipherOFBMode(), GenerateCipherNonce(), GetRandomKey(), and GetRandomValue().
| 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().
| 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().
SemaphoreInfo* random_semaphore = (SemaphoreInfo *) NULL [static] |
Definition at line 119 of file random.c.
Referenced by RandomComponentGenesis(), and RandomComponentTerminus().