|
MagickCore 7.0.10
|
#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.
Data Structures | |
| struct | _RandomInfo |
Macros | |
| #define | PseudoRandomHash SHA2256Hash |
| #define | RandomEntropyLevel 9 |
| #define | RandomFilename "reservoir.xdm" |
| #define | RandomFiletype "random" |
| #define | RandomProtocolMajorVersion 1 |
| #define | RandomProtocolMinorVersion 1 |
| #define | MaxEntropyExtent 64 /* max permitted: 256 */ |
| #define | RandomROTL(x, k) (((x) << (k)) | ((x) >> (64-(k)))) |
Variables | |
| char ** | environ |
| static SemaphoreInfo * | random_semaphore = (SemaphoreInfo *) NULL |
| static unsigned long | secret_key = ~0UL |
| static WizardBooleanType | gather_true_random = WizardFalse |
| #define MaxEntropyExtent 64 /* max permitted: 256 */ |
| #define PseudoRandomHash SHA2256Hash |
| #define RandomROTL | ( | x, | |
| k | |||
| ) | (((x) << (k)) | ((x) >> (64-(k)))) |
| WizardExport RandomInfo * AcquireRandomInfo | ( | const HashType | hash | ) |
Definition at line 165 of file random.c.
References AcquireExceptionInfo(), AcquireHashInfo(), AcquireHMACInfo(), AcquireSemaphoreInfo(), AcquireStringInfo(), AcquireWizardMemory(), CopyWizardMemory(), DestroyExceptionInfo(), DestroyHashInfo(), DestroyRandomInfo(), DestroyStringInfo(), FinalizeHash(), GenerateEntropicChaos(), GetHashDigest(), GetHashDigestsize(), GetHMACDigest(), GetHMACDigestsize(), GetRandomKey(), GetStringInfoDatum(), HashDomain, _RandomInfo::hmac_info, InitializeHMAC(), MemoryError, _RandomInfo::nonce, _RandomInfo::normalize, _RandomInfo::protocol_major, _RandomInfo::protocol_minor, PseudoRandomHash, random_info, RandomFatalError, RandomProtocolMajorVersion, RandomProtocolMinorVersion, _RandomInfo::reservoir, ResetStringInfo(), SaveEntropyToReservoir(), _RandomInfo::secret_key, secret_key, _RandomInfo::seed, _RandomInfo::semaphore, SetStringInfo(), SetStringInfoDatum(), SetStringInfoLength(), _RandomInfo::signature, ThrowFatalException, ThrowWizardFatalError, _RandomInfo::timestamp, UpdateHash(), WizardFalse, WizardMin, WizardSignature, and WizardULLConstant.
Referenced by AcquireCipherInfo(), AcquireKeyInfo(), AcquireSecretInfo(), and AcquireUniqueFileResource().
| WizardExport RandomInfo * DestroyRandomInfo | ( | RandomInfo * | random_info | ) |
Definition at line 289 of file random.c.
References CipherDomain, DestroyHMACInfo(), DestroyStringInfo(), GetWizardModule, _RandomInfo::hmac_info, LockSemaphoreInfo(), LogWizardEvent(), _RandomInfo::nonce, random_info, RelinquishSemaphoreInfo(), RelinquishWizardMemory(), _RandomInfo::reservoir, _RandomInfo::seed, _RandomInfo::semaphore, _RandomInfo::signature, TraceEvent, UnlockSemaphoreInfo(), WizardAssert, and WizardSignature.
Referenced by AcquireRandomInfo(), AsynchronousResourceComponentTerminus(), DestroyCipherInfo(), DestroyKeyInfo(), and DestroySecretInfo().
|
static |
Definition at line 362 of file random.c.
References AcquireEntropyInfo(), AcquireString(), AcquireStringInfo(), ConcatenateStringInfo(), DestroyEntropyInfo(), DestroyString(), DestroyStringInfo(), environ, gather_true_random, GetEntropyChaos(), GetEntropyFromReservoir(), GetStringInfoCRC(), GetStringInfoDatum(), GetStringInfoLength(), GetWizardModule, GetWizardThreadId(), IncreaseEntropy(), LockSemaphoreInfo(), MaxEntropyExtent, O_BINARY, open_utf8(), random_info, RandomEntropyLevel, RandomError, RandomFatalError, ReadRandom(), _RandomInfo::semaphore, SetStringInfoDatum(), SetStringInfoLength(), StringToStringInfo(), ThrowFatalException, ThrowWizardException(), UnlockSemaphoreInfo(), WizardFalse, and ZIPEntropy.
Referenced by AcquireRandomInfo().
| static StringInfo * GetEntropyFromReservoir | ( | RandomInfo * | random_info, |
| ExceptionInfo * | exception | ||
| ) |
Definition at line 653 of file random.c.
References AcquireFileInfo(), AcquireStringInfo(), CipherDomain, CloneStringInfo(), CompareStringInfo(), DestroyFileInfo(), DestroyStringInfo(), GetFilePath(), GetStringInfoCRC(), GetStringInfoDatum(), GetStringInfoLength(), GetWizardMagick(), GetWizardModule, LockSemaphoreInfo(), LogWizardEvent(), _RandomInfo::protocol_major, _RandomInfo::protocol_minor, random_info, RandomError, RandomFilename, RandomFiletype, ReadFile16Bits(), ReadFile32Bits(), ReadFile64Bits(), ReadFileChunk(), ReadFileMode, _RandomInfo::semaphore, _RandomInfo::signature, ThrowWizardException(), _RandomInfo::timestamp, TraceEvent, UnlockSemaphoreInfo(), WizardAssert, WizardFalse, WizardMagick, and WizardSignature.
Referenced by GenerateEntropicChaos().
| WizardExport double GetPseudoRandomValue | ( | RandomInfo * | random_info | ) |
Definition at line 779 of file random.c.
References _RandomInfo::normalize, random_info, RandomROTL, and _RandomInfo::seed.
| WizardExport StringInfo * GetRandomKey | ( | RandomInfo * | random_info, |
| const size_t | length | ||
| ) |
Definition at line 820 of file random.c.
References AcquireStringInfo(), CipherDomain, GetStringInfoDatum(), random_info, SetRandomKey(), and WizardAssert.
Referenced by AcquireRandomInfo(), AcquireUniqueFileResource(), GenerateCipherNonce(), GenerateSecretKey(), and GenerateSessionKey().
| WizardExport unsigned long GetRandomSecretKey | ( | const RandomInfo * | random_info | ) |
Definition at line 853 of file random.c.
References random_info, and _RandomInfo::secret_key.
| WizardExport double GetRandomValue | ( | RandomInfo * | random_info | ) |
Definition at line 878 of file random.c.
References random_info, and SetRandomKey().
|
inlinestatic |
Definition at line 1050 of file random.c.
References GetStringInfoDatum(), GetStringInfoLength(), RandomFatalError, and ThrowFatalException.
Referenced by SetRandomKey().
| WizardExport WizardBooleanType RandomComponentGenesis | ( | void | ) |
Definition at line 910 of file random.c.
References AcquireSemaphoreInfo(), random_semaphore, and WizardTrue.
Referenced by WizardsToolkitGenesis().
| WizardExport void RandomComponentTerminus | ( | void | ) |
Definition at line 935 of file random.c.
References ActivateSemaphoreInfo(), random_semaphore, and RelinquishSemaphoreInfo().
Referenced by WizardsToolkitTerminus().
|
static |
Definition at line 336 of file random.c.
Referenced by GenerateEntropicChaos().
|
static |
Definition at line 967 of file random.c.
References AcquireFileInfo(), CipherDomain, DestroyFileInfo(), DestroyStringInfo(), GetFilePath(), GetHMACDigest(), GetStringInfoCRC(), GetStringInfoDatum(), GetStringInfoLength(), GetWizardMagick(), GetWizardModule, _RandomInfo::hmac_info, LockSemaphoreInfo(), LogWizardEvent(), _RandomInfo::protocol_major, _RandomInfo::protocol_minor, random_info, RandomError, RandomFilename, RandomFiletype, _RandomInfo::semaphore, _RandomInfo::signature, ThrowWizardException(), _RandomInfo::timestamp, TraceEvent, UnlockSemaphoreInfo(), WizardAssert, WizardFalse, WizardMagick, WizardSignature, WizardTrue, WriteFile16Bits(), WriteFile32Bits(), WriteFile64Bits(), WriteFileChunk(), and WriteFileMode.
Referenced by AcquireRandomInfo().
| WizardExport void SetRandomKey | ( | RandomInfo * | random_info, |
| const size_t | length, | ||
| unsigned char * | key | ||
| ) |
Definition at line 1068 of file random.c.
References CipherDomain, CopyWizardMemory(), FinalizeHMAC(), GetHMACDigest(), GetHMACDigestsize(), GetStringInfoDatum(), _RandomInfo::hmac_info, _RandomInfo::i, IncrementRandomNonce(), LockSemaphoreInfo(), _RandomInfo::nonce, random_info, _RandomInfo::reservoir, ResetHMAC(), _RandomInfo::semaphore, SetStringInfo(), UnlockSemaphoreInfo(), UpdateHMAC(), and WizardAssert.
Referenced by EncipherCBCMode(), EncipherCTRMode(), EncipherECBMode(), EncipherOFBMode(), GenerateCipherNonce(), GetRandomKey(), and GetRandomValue().
| WizardExport void SetRandomSecretKey | ( | const unsigned long | key | ) |
Definition at line 1145 of file random.c.
References secret_key.
| WizardExport void SetRandomTrueRandom | ( | const WizardBooleanType | true_random | ) |
Definition at line 1174 of file random.c.
References gather_true_random.
|
extern |
Referenced by GenerateEntropicChaos().
|
static |
Definition at line 131 of file random.c.
Referenced by GenerateEntropicChaos(), and SetRandomTrueRandom().
|
static |
Definition at line 125 of file random.c.
Referenced by RandomComponentGenesis(), and RandomComponentTerminus().
|
static |
Definition at line 128 of file random.c.
Referenced by AcquireRandomInfo(), and SetRandomSecretKey().