• Home
  • Raw
  • Download

Lines Matching refs:random_info

169     *random_info;  in AcquireRandomInfo()  local
176 random_info=(RandomInfo *) AcquireMagickMemory(sizeof(*random_info)); in AcquireRandomInfo()
177 if (random_info == (RandomInfo *) NULL) in AcquireRandomInfo()
179 (void) ResetMagickMemory(random_info,0,sizeof(*random_info)); in AcquireRandomInfo()
180 random_info->signature_info=AcquireSignatureInfo(); in AcquireRandomInfo()
181 random_info->nonce=AcquireStringInfo(2*GetSignatureDigestsize( in AcquireRandomInfo()
182 random_info->signature_info)); in AcquireRandomInfo()
183 ResetStringInfo(random_info->nonce); in AcquireRandomInfo()
184 random_info->reservoir=AcquireStringInfo(GetSignatureDigestsize( in AcquireRandomInfo()
185 random_info->signature_info)); in AcquireRandomInfo()
186 ResetStringInfo(random_info->reservoir); in AcquireRandomInfo()
187 random_info->normalize=1.0/(~0UL); in AcquireRandomInfo()
188 random_info->secret_key=secret_key; in AcquireRandomInfo()
189 random_info->protocol_major=RandomProtocolMajorVersion; in AcquireRandomInfo()
190 random_info->protocol_minor=RandomProtocolMinorVersion; in AcquireRandomInfo()
191 random_info->semaphore=AcquireSemaphoreInfo(); in AcquireRandomInfo()
192 random_info->timestamp=(ssize_t) time(0); in AcquireRandomInfo()
193 random_info->signature=MagickCoreSignature; in AcquireRandomInfo()
197 nonce=GenerateEntropicChaos(random_info); in AcquireRandomInfo()
200 InitializeSignature(random_info->signature_info); in AcquireRandomInfo()
201 UpdateSignature(random_info->signature_info,nonce); in AcquireRandomInfo()
202 FinalizeSignature(random_info->signature_info); in AcquireRandomInfo()
204 random_info->signature_info)+1)/2); in AcquireRandomInfo()
205 SetStringInfo(nonce,GetSignatureDigest(random_info->signature_info)); in AcquireRandomInfo()
206 SetStringInfo(random_info->nonce,nonce); in AcquireRandomInfo()
211 entropy=GenerateEntropicChaos(random_info); in AcquireRandomInfo()
214 UpdateSignature(random_info->signature_info,entropy); in AcquireRandomInfo()
215 FinalizeSignature(random_info->signature_info); in AcquireRandomInfo()
216 SetStringInfo(random_info->reservoir,GetSignatureDigest( in AcquireRandomInfo()
217 random_info->signature_info)); in AcquireRandomInfo()
222 if (random_info->secret_key == ~0UL) in AcquireRandomInfo()
224 key=GetRandomKey(random_info,sizeof(random_info->secret_key)); in AcquireRandomInfo()
225 (void) CopyMagickMemory(random_info->seed,GetStringInfoDatum(key), in AcquireRandomInfo()
235 key=AcquireStringInfo(sizeof(random_info->secret_key)); in AcquireRandomInfo()
236 SetStringInfoDatum(key,(unsigned char *) &random_info->secret_key); in AcquireRandomInfo()
241 (void) CopyMagickMemory(random_info->seed,GetStringInfoDatum(digest), in AcquireRandomInfo()
243 sizeof(*random_info->seed))); in AcquireRandomInfo()
246 random_info->seed[1]=0x50a7f451UL; in AcquireRandomInfo()
247 random_info->seed[2]=0x5365417eUL; in AcquireRandomInfo()
248 random_info->seed[3]=0xc3a4171aUL; in AcquireRandomInfo()
249 return(random_info); in AcquireRandomInfo()
275 MagickExport RandomInfo *DestroyRandomInfo(RandomInfo *random_info) in DestroyRandomInfo() argument
278 assert(random_info != (RandomInfo *) NULL); in DestroyRandomInfo()
279 assert(random_info->signature == MagickCoreSignature); in DestroyRandomInfo()
280 LockSemaphoreInfo(random_info->semaphore); in DestroyRandomInfo()
281 if (random_info->reservoir != (StringInfo *) NULL) in DestroyRandomInfo()
282 random_info->reservoir=DestroyStringInfo(random_info->reservoir); in DestroyRandomInfo()
283 if (random_info->nonce != (StringInfo *) NULL) in DestroyRandomInfo()
284 random_info->nonce=DestroyStringInfo(random_info->nonce); in DestroyRandomInfo()
285 if (random_info->signature_info != (SignatureInfo *) NULL) in DestroyRandomInfo()
286 random_info->signature_info=DestroySignatureInfo( in DestroyRandomInfo()
287 random_info->signature_info); in DestroyRandomInfo()
288 (void) ResetMagickMemory(random_info->seed,0,sizeof(*random_info->seed)); in DestroyRandomInfo()
289 random_info->signature=(~MagickCoreSignature); in DestroyRandomInfo()
290 UnlockSemaphoreInfo(random_info->semaphore); in DestroyRandomInfo()
291 RelinquishSemaphoreInfo(&random_info->semaphore); in DestroyRandomInfo()
292 random_info=(RandomInfo *) RelinquishMagickMemory(random_info); in DestroyRandomInfo()
293 return(random_info); in DestroyRandomInfo()
348 static StringInfo *GenerateEntropicChaos(RandomInfo *random_info) in GenerateEntropicChaos() argument
370 LockSemaphoreInfo(random_info->semaphore); in GenerateEntropicChaos()
587 UnlockSemaphoreInfo(random_info->semaphore); in GenerateEntropicChaos()
615 MagickExport double GetPseudoRandomValue(RandomInfo *random_info) in GetPseudoRandomValue() argument
623 seed=random_info->seed; in GetPseudoRandomValue()
632 return(random_info->normalize*seed[0]); in GetPseudoRandomValue()
657 MagickPrivate double GetRandomInfoNormalize(const RandomInfo *random_info) in GetRandomInfoNormalize() argument
659 assert(random_info != (const RandomInfo *) NULL); in GetRandomInfoNormalize()
660 return(random_info->normalize); in GetRandomInfoNormalize()
685 MagickPrivate unsigned long *GetRandomInfoSeed(RandomInfo *random_info) in GetRandomInfoSeed() argument
687 assert(random_info != (RandomInfo *) NULL); in GetRandomInfoSeed()
688 return(random_info->seed); in GetRandomInfoSeed()
715 MagickExport StringInfo *GetRandomKey(RandomInfo *random_info, in GetRandomKey() argument
721 assert(random_info != (RandomInfo *) NULL); in GetRandomKey()
723 SetRandomKey(random_info,length,GetStringInfoDatum(key)); in GetRandomKey()
748 MagickExport unsigned long GetRandomSecretKey(const RandomInfo *random_info) in GetRandomSecretKey() argument
750 return(random_info->secret_key); in GetRandomSecretKey()
773 MagickExport double GetRandomValue(RandomInfo *random_info) in GetRandomValue() argument
782 SetRandomKey(random_info,sizeof(key),(unsigned char *) &key); in GetRandomValue()
883 MagickExport void SetRandomKey(RandomInfo *random_info,const size_t length, in SetRandomKey() argument
898 assert(random_info != (RandomInfo *) NULL); in SetRandomKey()
901 LockSemaphoreInfo(random_info->semaphore); in SetRandomKey()
902 signature_info=random_info->signature_info; in SetRandomKey()
903 datum=GetStringInfoDatum(random_info->reservoir); in SetRandomKey()
905 for (p=key; (i != 0) && (random_info->i != 0); i--) in SetRandomKey()
907 *p++=datum[random_info->i]; in SetRandomKey()
908 random_info->i++; in SetRandomKey()
909 if (random_info->i == GetSignatureDigestsize(signature_info)) in SetRandomKey()
910 random_info->i=0; in SetRandomKey()
915 UpdateSignature(signature_info,random_info->nonce); in SetRandomKey()
917 IncrementRandomNonce(random_info->nonce); in SetRandomKey()
926 UpdateSignature(signature_info,random_info->nonce); in SetRandomKey()
928 IncrementRandomNonce(random_info->nonce); in SetRandomKey()
929 SetStringInfo(random_info->reservoir,GetSignatureDigest(signature_info)); in SetRandomKey()
930 random_info->i=i; in SetRandomKey()
931 datum=GetStringInfoDatum(random_info->reservoir); in SetRandomKey()
935 UnlockSemaphoreInfo(random_info->semaphore); in SetRandomKey()