MagickCore 7.1.0
Convert, Edit, Or Compose Bitmap Images
random.c File Reference
Include dependency graph for random.c:

Go to the source code of this file.

Data Structures

struct  _RandomInfo
 

Macros

#define PseudoRandomHash   SHA256Hash
 
#define RandomEntropyLevel   9
 
#define RandomFilename   "reservoir.xdm"
 
#define RandomFiletype   "random"
 
#define RandomProtocolMajorVersion   1
 
#define RandomProtocolMinorVersion   0
 
#define MaxEntropyExtent   64 /* max permitted: 256 */
 
#define RandomROTL(x, k)   (((x) << (k)) | ((x) >> (64-(k))))
 

Functions

static StringInfoGenerateEntropicChaos (RandomInfo *)
 
MagickExport RandomInfoAcquireRandomInfo (void)
 
MagickExport RandomInfoDestroyRandomInfo (RandomInfo *random_info)
 
static ssize_t ReadRandom (int file, unsigned char *source, size_t length)
 
MagickExport double GetPseudoRandomValue (RandomInfo *magick_restrict random_info)
 
MagickPrivate double GetRandomInfoNormalize (const RandomInfo *random_info)
 
MagickPrivate unsigned long * GetRandomInfoSeed (RandomInfo *random_info)
 
MagickExport StringInfoGetRandomKey (RandomInfo *random_info, const size_t length)
 
MagickExport unsigned long GetRandomSecretKey (const RandomInfo *random_info)
 
MagickExport double GetRandomValue (RandomInfo *random_info)
 
MagickPrivate MagickBooleanType RandomComponentGenesis (void)
 
MagickPrivate void RandomComponentTerminus (void)
 
static void IncrementRandomNonce (StringInfo *nonce)
 
MagickExport void SetRandomKey (RandomInfo *random_info, const size_t length, unsigned char *key)
 
MagickExport void SetRandomSecretKey (const unsigned long key)
 
MagickExport void SetRandomTrueRandom (const MagickBooleanType true_random)
 

Variables

char ** environ
 
static SemaphoreInforandom_semaphore = (SemaphoreInfo *) NULL
 
static unsigned long secret_key = ~0UL
 
static MagickBooleanType gather_true_random = MagickFalse
 

Macro Definition Documentation

◆ MaxEntropyExtent

#define MaxEntropyExtent   64 /* max permitted: 256 */

◆ PseudoRandomHash

#define PseudoRandomHash   SHA256Hash

Definition at line 72 of file random.c.

◆ RandomEntropyLevel

#define RandomEntropyLevel   9

Definition at line 73 of file random.c.

◆ RandomFilename

#define RandomFilename   "reservoir.xdm"

Definition at line 74 of file random.c.

◆ RandomFiletype

#define RandomFiletype   "random"

Definition at line 75 of file random.c.

◆ RandomProtocolMajorVersion

#define RandomProtocolMajorVersion   1

Definition at line 76 of file random.c.

◆ RandomProtocolMinorVersion

#define RandomProtocolMinorVersion   0

Definition at line 77 of file random.c.

◆ RandomROTL

#define RandomROTL (   x,
 
)    (((x) << (k)) | ((x) >> (64-(k))))

Function Documentation

◆ AcquireRandomInfo()

◆ DestroyRandomInfo()

◆ GenerateEntropicChaos()

◆ GetPseudoRandomValue()

◆ GetRandomInfoNormalize()

MagickPrivate double GetRandomInfoNormalize ( const RandomInfo random_info)

Definition at line 642 of file random.c.

References _RandomInfo::normalize, and random_info.

◆ GetRandomInfoSeed()

MagickPrivate unsigned long * GetRandomInfoSeed ( RandomInfo random_info)

Definition at line 670 of file random.c.

References random_info, and _RandomInfo::seed.

◆ GetRandomKey()

MagickExport StringInfo * GetRandomKey ( RandomInfo random_info,
const size_t  length 
)

◆ GetRandomSecretKey()

MagickExport unsigned long GetRandomSecretKey ( const RandomInfo random_info)

◆ GetRandomValue()

MagickExport double GetRandomValue ( RandomInfo random_info)

Definition at line 758 of file random.c.

References random_info, and SetRandomKey().

◆ IncrementRandomNonce()

static void IncrementRandomNonce ( StringInfo nonce)
inlinestatic

Definition at line 850 of file random.c.

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

Referenced by SetRandomKey().

◆ RandomComponentGenesis()

MagickPrivate MagickBooleanType RandomComponentGenesis ( void  )

Definition at line 790 of file random.c.

References AcquireSemaphoreInfo(), MagickTrue, and random_semaphore.

Referenced by MagickCoreGenesis().

◆ RandomComponentTerminus()

MagickPrivate void RandomComponentTerminus ( void  )

Definition at line 815 of file random.c.

References ActivateSemaphoreInfo(), random_semaphore, and RelinquishSemaphoreInfo().

Referenced by MagickCoreTerminus().

◆ ReadRandom()

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

Definition at line 324 of file random.c.

Referenced by GenerateEntropicChaos().

◆ SetRandomKey()

◆ SetRandomSecretKey()

MagickExport void SetRandomSecretKey ( const unsigned long  key)

Definition at line 945 of file random.c.

References secret_key.

◆ SetRandomTrueRandom()

MagickExport void SetRandomTrueRandom ( const MagickBooleanType  true_random)

Definition at line 974 of file random.c.

References gather_true_random.

Variable Documentation

◆ environ

char** environ
extern

Referenced by GenerateEntropicChaos().

◆ gather_true_random

MagickBooleanType gather_true_random = MagickFalse
static

Definition at line 140 of file random.c.

Referenced by GenerateEntropicChaos(), and SetRandomTrueRandom().

◆ random_semaphore

SemaphoreInfo* random_semaphore = (SemaphoreInfo *) NULL
static

Definition at line 134 of file random.c.

Referenced by RandomComponentGenesis(), and RandomComponentTerminus().

◆ secret_key

unsigned long secret_key = ~0UL
static

Definition at line 137 of file random.c.

Referenced by AcquireRandomInfo(), and SetRandomSecretKey().