MagickCore  6.9.11-59
Convert, Edit, Or Compose Bitmap Images
random_.h
Go to the documentation of this file.
1 /*
2  Copyright 1999-2021 ImageMagick Studio LLC, a non-profit organization
3  dedicated to making software imaging solutions freely available.
4 
5  You may not use this file except in compliance with the License. You may
6  obtain a copy of the License at
7 
8  https://imagemagick.org/script/license.php
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 
16  MagickCore random methods.
17 */
18 #ifndef MAGICKCORE_RANDOM__H
19 #define MAGICKCORE_RANDOM__H
20 
21 #include "magick/string_.h"
22 
23 #if defined(__cplusplus) || defined(c_plusplus)
24 extern "C" {
25 #endif
26 
27 /*
28  Typedef declarations.
29 */
30 typedef struct _RandomInfo
31  RandomInfo;
32 
33 /*
34  Method declarations.
35 */
36 extern MagickExport double
39 
42 
46 
48  *GetRandomKey(RandomInfo *,const size_t);
49 
50 extern MagickExport unsigned long
52 
53 extern MagickExport void
55  SeedPseudoRandomGenerator(const unsigned long),
56  SetRandomKey(RandomInfo *,const size_t,unsigned char *),
57  SetRandomSecretKey(const unsigned long),
59 
60 #if defined(__cplusplus) || defined(c_plusplus)
61 }
62 #endif
63 
64 #endif
GetSignatureDigestsize
MagickExport unsigned int GetSignatureDigestsize(const SignatureInfo *)
Definition: signature.c:357
MaxEntropyExtent
#define MaxEntropyExtent
LockSemaphoreInfo
MagickExport void LockSemaphoreInfo(SemaphoreInfo *semaphore_info)
Definition: semaphore.c:293
MagickExport
#define MagickExport
Definition: method-attribute.h:80
RandomComponentTerminus
MagickExport void RandomComponentTerminus(void)
_RandomInfo::protocol_major
unsigned short protocol_major
Definition: random.c:99
GetRandomValue
MagickExport double GetRandomValue(RandomInfo *random_info)
Definition: random.c:738
IncrementRandomNonce
static void IncrementRandomNonce(StringInfo *nonce)
Definition: random.c:830
GetMagickModule
#define GetMagickModule()
Definition: log.h:29
MagickCoreSignature
#define MagickCoreSignature
Definition: method-attribute.h:86
O_BINARY
#define O_BINARY
Definition: studio.h:362
SetRandomKey
MagickExport void SetRandomKey(RandomInfo *, const size_t, unsigned char *)
SeedPseudoRandomGenerator
MagickExport void SeedPseudoRandomGenerator(const unsigned long)
_RandomInfo::signature
size_t signature
Definition: random.c:109
memory-private.h
magick_restrict
#define magick_restrict
Definition: MagickCore.h:41
AcquireRandomInfo
MagickExport RandomInfo * AcquireRandomInfo(void)
_RandomInfo::seed
MagickSizeType seed[4]
Definition: random.c:90
ResetStringInfo
MagickExport void ResetStringInfo(StringInfo *string_info)
Definition: string.c:1561
GetStringInfoLength
MagickExport size_t GetStringInfoLength(const StringInfo *string_info)
Definition: string.c:1212
image-private.h
MagickSizeType
size_t MagickSizeType
Definition: magick-type.h:140
resource_.h
SetRandomKey
MagickExport void SetRandomKey(RandomInfo *random_info, const size_t length, unsigned char *key)
Definition: random.c:848
GetRandomInfoSeed
MagickPrivate unsigned long * GetRandomInfoSeed(RandomInfo *random_info)
Definition: random.c:650
MagickThreadType
pid_t MagickThreadType
Definition: thread_.h:34
random_.h
string_.h
_RandomInfo::semaphore
SemaphoreInfo * semaphore
Definition: random.c:103
DestroyString
MagickExport char * DestroyString(char *string)
Definition: string.c:808
GetRandomValue
MagickExport double GetRandomValue(RandomInfo *)
RandomComponentGenesis
MagickExport MagickBooleanType RandomComponentGenesis(void)
Definition: random.c:770
MagickTrue
@ MagickTrue
Definition: magick-type.h:205
StringToStringInfo
MagickExport StringInfo * StringToStringInfo(const char *string)
Definition: string.c:2446
semaphore.h
DestroyRandomInfo
MagickExport RandomInfo * DestroyRandomInfo(RandomInfo *random_info)
Definition: random.c:272
AcquireStringInfo
MagickExport StringInfo * AcquireStringInfo(const size_t length)
Definition: string.c:184
GetRandomSecretKey
MagickExport unsigned long GetRandomSecretKey(const RandomInfo *)
Definition: random.c:713
thread-private.h
_RandomInfo::reservoir
StringInfo * reservoir
Definition: random.c:84
SetStringInfoLength
MagickExport void SetStringInfoLength(StringInfo *string_info, const size_t length)
Definition: string.c:1714
TraceEvent
@ TraceEvent
Definition: log.h:38
_RandomInfo::timestamp
ssize_t timestamp
Definition: random.c:106
SemaphoreInfo
Definition: semaphore.c:61
SetStringInfoDatum
MagickExport void SetStringInfoDatum(StringInfo *string_info, const unsigned char *source)
Definition: string.c:1681
SetStringInfo
MagickExport void SetStringInfo(StringInfo *string_info, const StringInfo *source)
Definition: string.c:1641
GetRandomSecretKey
MagickExport unsigned long GetRandomSecretKey(const RandomInfo *random_info)
Definition: random.c:713
GetRandomInfoNormalize
MagickPrivate double GetRandomInfoNormalize(const RandomInfo *random_info)
Definition: random.c:622
random_semaphore
static SemaphoreInfo * random_semaphore
Definition: random.c:129
RandomFatalError
@ RandomFatalError
Definition: exception.h:94
_RandomInfo::normalize
double normalize
Definition: random.c:93
MagickPrivate
#define MagickPrivate
Definition: method-attribute.h:81
GetMagickThreadId
static MagickThreadType GetMagickThreadId(void)
Definition: thread-private.h:58
MagickFalse
@ MagickFalse
Definition: magick-type.h:204
UpdateSignature
MagickExport void UpdateSignature(SignatureInfo *, const StringInfo *)
Definition: signature.c:750
_RandomInfo::secret_key
unsigned long secret_key
Definition: random.c:96
environ
char ** environ
AcquireRandomInfo
MagickExport RandomInfo * AcquireRandomInfo(void)
Definition: random.c:161
RandomProtocolMajorVersion
#define RandomProtocolMajorVersion
Definition: random.c:71
_RandomInfo::protocol_minor
unsigned short protocol_minor
Definition: random.c:100
_SignatureInfo
Definition: signature.c:65
AllocateSemaphoreInfo
MagickExport SemaphoreInfo * AllocateSemaphoreInfo(void)
Definition: semaphore.c:192
_RandomInfo::nonce
StringInfo * nonce
Definition: random.c:83
RandomROTL
#define RandomROTL(x, k)
GetPseudoRandomValue
MagickExport double GetPseudoRandomValue(RandomInfo *magick_restrict random_info)
Definition: random.c:582
SetRandomTrueRandom
MagickExport void SetRandomTrueRandom(const MagickBooleanType)
Definition: random.c:960
FinalizeSignature
MagickExport void FinalizeSignature(SignatureInfo *)
SeedPseudoRandomGenerator
MagickExport void SeedPseudoRandomGenerator(const unsigned long seed)
Definition: random.c:926
ActivateSemaphoreInfo
MagickExport void ActivateSemaphoreInfo(SemaphoreInfo **semaphore_info)
Definition: semaphore.c:98
DestroySignatureInfo
MagickExport SignatureInfo * DestroySignatureInfo(SignatureInfo *)
Definition: signature.c:170
DestroySemaphoreInfo
MagickExport void DestroySemaphoreInfo(SemaphoreInfo **semaphore_info)
Definition: semaphore.c:351
_RandomInfo::i
size_t i
Definition: random.c:87
MagickBooleanType
MagickBooleanType
Definition: magick-type.h:203
SetRandomSecretKey
MagickExport void SetRandomSecretKey(const unsigned long key)
Definition: random.c:931
RelinquishMagickMemory
MagickExport void * RelinquishMagickMemory(void *memory)
Definition: memory.c:1162
random_info
static RandomInfo * random_info
Definition: resource.c:112
utility-private.h
RandomComponentTerminus
MagickExport void RandomComponentTerminus(void)
Definition: random.c:795
RandomProtocolMinorVersion
#define RandomProtocolMinorVersion
Definition: random.c:72
studio.h
RandomComponentGenesis
MagickExport MagickBooleanType RandomComponentGenesis(void)
Definition: random.c:770
ConcatenateStringInfo
MagickExport void ConcatenateStringInfo(StringInfo *string_info, const StringInfo *source)
Definition: string.c:551
AcquireCriticalMemory
MagickExport void * AcquireCriticalMemory(const size_t size)
Definition: memory.c:626
ReadRandom
static ssize_t ReadRandom(int file, unsigned char *source, size_t length)
Definition: random.c:318
memory_.h
GetStringInfoDatum
MagickExport unsigned char * GetStringInfoDatum(const StringInfo *string_info)
Definition: string.c:1183
signature-private.h
AcquireSignatureInfo
MagickExport SignatureInfo * AcquireSignatureInfo(void)
gather_true_random
static MagickBooleanType gather_true_random
Definition: random.c:135
exception-private.h
ThrowFatalException
#define ThrowFatalException(severity, tag)
Definition: exception-private.h:42
UnlockSemaphoreInfo
MagickExport void UnlockSemaphoreInfo(SemaphoreInfo *semaphore_info)
Definition: semaphore.c:449
GetRandomKey
MagickExport StringInfo * GetRandomKey(RandomInfo *random_info, const size_t length)
Definition: random.c:680
exception.h
DestroyRandomInfo
MagickExport RandomInfo * DestroyRandomInfo(RandomInfo *)
Definition: random.c:272
_RandomInfo::signature_info
SignatureInfo * signature_info
Definition: random.c:80
MagickULLConstant
#define MagickULLConstant(c)
Definition: magick-type.h:39
DestroyStringInfo
MagickExport StringInfo * DestroyStringInfo(StringInfo *string_info)
Definition: string.c:835
GetRandomKey
MagickExport StringInfo * GetRandomKey(RandomInfo *, const size_t)
Definition: random.c:680
GetSignatureDigest
MagickExport const StringInfo * GetSignatureDigest(const SignatureInfo *)
Definition: signature.c:326
LogMagickEvent
MagickExport MagickBooleanType LogMagickEvent(const LogEventType type, const char *module, const char *function, const size_t line, const char *format,...)
Definition: log.c:1420
GenerateEntropicChaos
static StringInfo * GenerateEntropicChaos(RandomInfo *)
Definition: random.c:345
SetRandomSecretKey
MagickExport void SetRandomSecretKey(const unsigned long)
InitializeSignature
MagickExport void InitializeSignature(SignatureInfo *)
ResourceLimitFatalError
@ ResourceLimitFatalError
Definition: exception.h:78
AcquireString
MagickExport char * AcquireString(const char *source)
Definition: string.c:125
MagickMin
#define MagickMin(x, y)
Definition: image-private.h:37
open_utf8
static int open_utf8(const char *path, int flags, mode_t mode)
Definition: utility-private.h:166
_StringInfo
Definition: string_.h:30
secret_key
static unsigned long secret_key
Definition: random.c:132
thread_.h
_RandomInfo
Definition: random.c:78
GetPseudoRandomValue
MagickExport double GetPseudoRandomValue(RandomInfo *magick_restrict)
SetRandomTrueRandom
MagickExport void SetRandomTrueRandom(const MagickBooleanType true_random)
Definition: random.c:960