#include "magick/studio.h"#include "magick/exception.h"#include "magick/exception-private.h"#include "magick/memory_.h"#include "magick/semaphore.h"#include "magick/random_.h"#include "magick/resource_.h"#include "magick/signature-private.h"#include "magick/string_.h"#include "magick/thread_.h"#include "magick/thread-private.h"#include "magick/utility.h"
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 0 |
| #define | MaxEntropyExtent 64 |
Functions | |
| static StringInfo * | GenerateEntropicChaos (RandomInfo *) |
| static size_t | MagickMin (const size_t x, const size_t y) |
| MagickExport RandomInfo * | AcquireRandomInfo (void) |
| MagickExport RandomInfo * | DestroyRandomInfo (RandomInfo *random_info) |
| static ssize_t | ReadRandom (int file, unsigned char *source, size_t length) |
| MagickExport double | GetPseudoRandomValue (RandomInfo *random_info) |
| MagickExport StringInfo * | GetRandomKey (RandomInfo *random_info, const size_t length) |
| MagickExport double | GetRandomValue (RandomInfo *random_info) |
| MagickExport MagickBooleanType | RandomComponentGenesis (void) |
| MagickExport void | RandomComponentTerminus (void) |
| MagickExport void | SeedPseudoRandomGenerator (const unsigned long seed) |
| static void | IncrementRandomNonce (StringInfo *nonce) |
| MagickExport void | SetRandomKey (RandomInfo *random_info, const size_t length, unsigned char *key) |
| MagickExport void | SetRandomTrueRandom (const MagickBooleanType true_random) |
Variables | |
| char ** | environ |
| static SemaphoreInfo * | random_semaphore = (SemaphoreInfo *) NULL |
| static unsigned long | random_seed = ~0UL |
| static MagickBooleanType | gather_true_random = MagickFalse |
| #define MaxEntropyExtent 64 |
Referenced by GenerateEntropicChaos().
| #define RandomProtocolMajorVersion 1 |
Definition at line 69 of file random.c.
Referenced by AcquireRandomInfo().
| #define RandomProtocolMinorVersion 0 |
Definition at line 70 of file random.c.
Referenced by AcquireRandomInfo().
| MagickExport RandomInfo* AcquireRandomInfo | ( | void | ) |
Definition at line 162 of file random.c.
References AcquireAlignedMemory(), AcquireSignatureInfo(), AcquireStringInfo(), AllocateSemaphoreInfo(), CopyMagickMemory(), DestroySignatureInfo(), DestroyStringInfo(), FinalizeSignature(), GenerateEntropicChaos(), GetRandomKey(), GetSignatureDigest(), GetSignatureDigestsize(), GetStringInfoDatum(), GetStringInfoLength(), InitializeSignature(), MagickMin(), MagickSignature, _RandomInfo::nonce, _RandomInfo::normalize, _RandomInfo::protocol_major, _RandomInfo::protocol_minor, random_info, random_seed, RandomProtocolMajorVersion, RandomProtocolMinorVersion, _RandomInfo::reservoir, ResetMagickMemory(), ResetStringInfo(), ResourceLimitFatalError, _RandomInfo::seed, _RandomInfo::semaphore, SetStringInfo(), SetStringInfoDatum(), SetStringInfoLength(), _RandomInfo::signature, _RandomInfo::signature_info, ThrowFatalException, _RandomInfo::timestamp, and UpdateSignature().
Referenced by AcquireFxInfo(), AcquireRandomInfoThreadSet(), AcquireUniqueFileResource(), GetVirtualPixelsFromNexus(), PlasmaImage(), RandomChannelThresholdImage(), and SketchImage().
| MagickExport RandomInfo* DestroyRandomInfo | ( | RandomInfo * | random_info | ) |
Definition at line 273 of file random.c.
References DestroySemaphoreInfo(), DestroySignatureInfo(), DestroyStringInfo(), GetMagickModule, LockSemaphoreInfo(), LogMagickEvent(), MagickSignature, _RandomInfo::nonce, RelinquishAlignedMemory(), _RandomInfo::reservoir, ResetMagickMemory(), _RandomInfo::seed, _RandomInfo::semaphore, _RandomInfo::signature, _RandomInfo::signature_info, TraceEvent, and UnlockSemaphoreInfo().
Referenced by DestroyFxInfo(), DestroyPixelCache(), DestroyRandomInfoThreadSet(), PlasmaImage(), RandomChannelThresholdImage(), ResourceComponentTerminus(), and SketchImage().
| static StringInfo * GenerateEntropicChaos | ( | RandomInfo * | random_info | ) | [static] |
Definition at line 346 of file random.c.
References AcquireString(), AcquireStringInfo(), close, ConcatenateStringInfo(), ConstantString(), DestroyString(), DestroyStringInfo(), environ, gather_true_random, GetMagickThreadId(), getpid, GetStringInfoDatum(), LockSemaphoreInfo(), MagickFalse, MaxEntropyExtent, NTElapsedTime(), NTGatherRandomData(), NTUserTime(), O_BINARY, open, ReadRandom(), _RandomInfo::semaphore, setmode, SetStringInfoDatum(), SetStringInfoLength(), StringToStringInfo(), and UnlockSemaphoreInfo().
Referenced by AcquireRandomInfo().
| MagickExport double GetPseudoRandomValue | ( | RandomInfo * | random_info | ) |
Definition at line 597 of file random.c.
References _RandomInfo::normalize, and _RandomInfo::seed.
Referenced by FxEvaluateSubexpression(), GenerateDifferentialNoise(), PlasmaPixel(), RandomChannelThresholdImage(), RandomThresholdImageChannel(), RandomX(), RandomY(), SketchImage(), and SpreadImage().
| MagickExport StringInfo* GetRandomKey | ( | RandomInfo * | random_info, | |
| const size_t | length | |||
| ) |
Definition at line 641 of file random.c.
References AcquireStringInfo(), GetStringInfoDatum(), and SetRandomKey().
Referenced by AcquireRandomInfo(), and AcquireUniqueFileResource().
| MagickExport double GetRandomValue | ( | RandomInfo * | random_info | ) |
Definition at line 673 of file random.c.
References SetRandomKey().
| static void IncrementRandomNonce | ( | StringInfo * | nonce | ) | [inline, static] |
Definition at line 792 of file random.c.
References GetStringInfoDatum(), GetStringInfoLength(), RandomFatalError, and ThrowFatalException.
Referenced by SetRandomKey().
| static size_t MagickMin | ( | const size_t | x, | |
| const size_t | y | |||
| ) | [inline, static] |
Definition at line 155 of file random.c.
Referenced by AcquireRandomInfo().
| MagickExport MagickBooleanType RandomComponentGenesis | ( | void | ) |
Definition at line 705 of file random.c.
References AcquireSemaphoreInfo(), MagickTrue, and random_semaphore.
Referenced by MagickCoreGenesis().
| MagickExport void RandomComponentTerminus | ( | void | ) |
Definition at line 729 of file random.c.
References AcquireSemaphoreInfo(), DestroySemaphoreInfo(), and random_semaphore.
Referenced by MagickCoreTerminus().
| static ssize_t ReadRandom | ( | int | file, | |
| unsigned char * | source, | |||
| size_t | length | |||
| ) | [static] |
| MagickExport void SeedPseudoRandomGenerator | ( | const unsigned long | seed | ) |
Definition at line 759 of file random.c.
References random_seed.
| MagickExport void SetRandomKey | ( | RandomInfo * | random_info, | |
| const size_t | length, | |||
| unsigned char * | key | |||
| ) |
Definition at line 810 of file random.c.
References CopyMagickMemory(), FinalizeSignature(), GetSignatureDigest(), GetSignatureDigestsize(), GetStringInfoDatum(), _RandomInfo::i, IncrementRandomNonce(), InitializeSignature(), LockSemaphoreInfo(), _RandomInfo::nonce, _RandomInfo::reservoir, _RandomInfo::semaphore, SetStringInfo(), _RandomInfo::signature_info, UnlockSemaphoreInfo(), and UpdateSignature().
Referenced by GetRandomKey(), and GetRandomValue().
| MagickExport void SetRandomTrueRandom | ( | const MagickBooleanType | true_random | ) |
Definition at line 889 of file random.c.
References gather_true_random.
| char** environ |
Referenced by GenerateEntropicChaos().
MagickBooleanType gather_true_random = MagickFalse [static] |
Definition at line 128 of file random.c.
Referenced by GenerateEntropicChaos(), and SetRandomTrueRandom().
unsigned long random_seed = ~0UL [static] |
Definition at line 125 of file random.c.
Referenced by AcquireRandomInfo(), and SeedPseudoRandomGenerator().
SemaphoreInfo* random_semaphore = (SemaphoreInfo *) NULL [static] |
Definition at line 122 of file random.c.
Referenced by RandomComponentGenesis(), and RandomComponentTerminus().
1.6.1