• Home
  • Raw
  • Download

Lines Matching refs:random_info

169     *random_info;  in AcquireRandomInfo()  local
176 random_info=(RandomInfo *) AcquireCriticalMemory(sizeof(*random_info)); in AcquireRandomInfo()
177 (void) memset(random_info,0,sizeof(*random_info)); in AcquireRandomInfo()
178 random_info->signature_info=AcquireSignatureInfo(); in AcquireRandomInfo()
179 random_info->nonce=AcquireStringInfo(2*GetSignatureDigestsize( in AcquireRandomInfo()
180 random_info->signature_info)); in AcquireRandomInfo()
181 ResetStringInfo(random_info->nonce); in AcquireRandomInfo()
182 random_info->reservoir=AcquireStringInfo(GetSignatureDigestsize( in AcquireRandomInfo()
183 random_info->signature_info)); in AcquireRandomInfo()
184 ResetStringInfo(random_info->reservoir); in AcquireRandomInfo()
185 random_info->normalize=(double) (1.0/(MagickULLConstant(~0) >> 11)); in AcquireRandomInfo()
186 random_info->seed[0]=MagickULLConstant(0x76e15d3efefdcbbf); in AcquireRandomInfo()
187 random_info->seed[1]=MagickULLConstant(0xc5004e441c522fb3); in AcquireRandomInfo()
188 random_info->seed[2]=MagickULLConstant(0x77710069854ee241); in AcquireRandomInfo()
189 random_info->seed[3]=MagickULLConstant(0x39109bb02acbe635); in AcquireRandomInfo()
190 random_info->secret_key=secret_key; in AcquireRandomInfo()
191 random_info->protocol_major=RandomProtocolMajorVersion; in AcquireRandomInfo()
192 random_info->protocol_minor=RandomProtocolMinorVersion; in AcquireRandomInfo()
193 random_info->semaphore=AcquireSemaphoreInfo(); in AcquireRandomInfo()
194 random_info->timestamp=(ssize_t) time(0); in AcquireRandomInfo()
195 random_info->signature=MagickCoreSignature; in AcquireRandomInfo()
199 nonce=GenerateEntropicChaos(random_info); in AcquireRandomInfo()
202 InitializeSignature(random_info->signature_info); in AcquireRandomInfo()
203 UpdateSignature(random_info->signature_info,nonce); in AcquireRandomInfo()
204 FinalizeSignature(random_info->signature_info); in AcquireRandomInfo()
206 random_info->signature_info)+1)/2); in AcquireRandomInfo()
207 SetStringInfo(nonce,GetSignatureDigest(random_info->signature_info)); in AcquireRandomInfo()
208 SetStringInfo(random_info->nonce,nonce); in AcquireRandomInfo()
213 entropy=GenerateEntropicChaos(random_info); in AcquireRandomInfo()
216 UpdateSignature(random_info->signature_info,entropy); in AcquireRandomInfo()
217 FinalizeSignature(random_info->signature_info); in AcquireRandomInfo()
218 SetStringInfo(random_info->reservoir,GetSignatureDigest( in AcquireRandomInfo()
219 random_info->signature_info)); in AcquireRandomInfo()
224 if (random_info->secret_key == ~0UL) in AcquireRandomInfo()
226 key=GetRandomKey(random_info,sizeof(random_info->seed)); in AcquireRandomInfo()
227 (void) memcpy(random_info->seed,GetStringInfoDatum(key), in AcquireRandomInfo()
228 sizeof(random_info->seed)); in AcquireRandomInfo()
237 key=AcquireStringInfo(sizeof(random_info->secret_key)); in AcquireRandomInfo()
238 SetStringInfoDatum(key,(unsigned char *) &random_info->secret_key); in AcquireRandomInfo()
243 (void) memcpy(random_info->seed,GetStringInfoDatum(digest), in AcquireRandomInfo()
245 sizeof(random_info->seed))); in AcquireRandomInfo()
248 return(random_info); in AcquireRandomInfo()
274 MagickExport RandomInfo *DestroyRandomInfo(RandomInfo *random_info) in DestroyRandomInfo() argument
277 assert(random_info != (RandomInfo *) NULL); in DestroyRandomInfo()
278 assert(random_info->signature == MagickCoreSignature); in DestroyRandomInfo()
279 LockSemaphoreInfo(random_info->semaphore); in DestroyRandomInfo()
280 if (random_info->reservoir != (StringInfo *) NULL) in DestroyRandomInfo()
281 random_info->reservoir=DestroyStringInfo(random_info->reservoir); in DestroyRandomInfo()
282 if (random_info->nonce != (StringInfo *) NULL) in DestroyRandomInfo()
283 random_info->nonce=DestroyStringInfo(random_info->nonce); in DestroyRandomInfo()
284 if (random_info->signature_info != (SignatureInfo *) NULL) in DestroyRandomInfo()
285 random_info->signature_info=DestroySignatureInfo( in DestroyRandomInfo()
286 random_info->signature_info); in DestroyRandomInfo()
287 (void) memset(random_info->seed,0,sizeof(random_info->seed)); in DestroyRandomInfo()
288 random_info->signature=(~MagickCoreSignature); in DestroyRandomInfo()
289 UnlockSemaphoreInfo(random_info->semaphore); in DestroyRandomInfo()
290 RelinquishSemaphoreInfo(&random_info->semaphore); in DestroyRandomInfo()
291 random_info=(RandomInfo *) RelinquishMagickMemory(random_info); in DestroyRandomInfo()
292 return(random_info); in DestroyRandomInfo()
347 static StringInfo *GenerateEntropicChaos(RandomInfo *random_info) in GenerateEntropicChaos() argument
369 LockSemaphoreInfo(random_info->semaphore); in GenerateEntropicChaos()
582 UnlockSemaphoreInfo(random_info->semaphore); in GenerateEntropicChaos()
611 RandomInfo *magick_restrict random_info) in GetPseudoRandomValue() argument
616 alpha = (random_info->seed[1] << 17), in GetPseudoRandomValue()
617 value = (random_info->seed[0]+random_info->seed[3]); in GetPseudoRandomValue()
619 random_info->seed[2]^=random_info->seed[0]; in GetPseudoRandomValue()
620 random_info->seed[3]^=random_info->seed[1]; in GetPseudoRandomValue()
621 random_info->seed[1]^=random_info->seed[2]; in GetPseudoRandomValue()
622 random_info->seed[0]^=random_info->seed[3]; in GetPseudoRandomValue()
623 random_info->seed[2]^=alpha; in GetPseudoRandomValue()
624 random_info->seed[3]=RandomROTL(random_info->seed[3],45); in GetPseudoRandomValue()
625 return((double) ((value >> 11)*random_info->normalize)); in GetPseudoRandomValue()
650 MagickPrivate double GetRandomInfoNormalize(const RandomInfo *random_info) in GetRandomInfoNormalize() argument
652 assert(random_info != (const RandomInfo *) NULL); in GetRandomInfoNormalize()
653 return(random_info->normalize); in GetRandomInfoNormalize()
678 MagickPrivate unsigned long *GetRandomInfoSeed(RandomInfo *random_info) in GetRandomInfoSeed() argument
680 assert(random_info != (RandomInfo *) NULL); in GetRandomInfoSeed()
681 return((unsigned long *) random_info->seed); in GetRandomInfoSeed()
708 MagickExport StringInfo *GetRandomKey(RandomInfo *random_info, in GetRandomKey() argument
714 assert(random_info != (RandomInfo *) NULL); in GetRandomKey()
716 SetRandomKey(random_info,length,GetStringInfoDatum(key)); in GetRandomKey()
741 MagickExport unsigned long GetRandomSecretKey(const RandomInfo *random_info) in GetRandomSecretKey() argument
743 return(random_info->secret_key); in GetRandomSecretKey()
766 MagickExport double GetRandomValue(RandomInfo *random_info) in GetRandomValue() argument
775 SetRandomKey(random_info,sizeof(key),(unsigned char *) &key); in GetRandomValue()
876 MagickExport void SetRandomKey(RandomInfo *random_info,const size_t length, in SetRandomKey() argument
891 assert(random_info != (RandomInfo *) NULL); in SetRandomKey()
894 LockSemaphoreInfo(random_info->semaphore); in SetRandomKey()
895 signature_info=random_info->signature_info; in SetRandomKey()
896 datum=GetStringInfoDatum(random_info->reservoir); in SetRandomKey()
898 for (p=key; (i != 0) && (random_info->i != 0); i--) in SetRandomKey()
900 *p++=datum[random_info->i]; in SetRandomKey()
901 random_info->i++; in SetRandomKey()
902 if (random_info->i == GetSignatureDigestsize(signature_info)) in SetRandomKey()
903 random_info->i=0; in SetRandomKey()
908 UpdateSignature(signature_info,random_info->nonce); in SetRandomKey()
910 IncrementRandomNonce(random_info->nonce); in SetRandomKey()
919 UpdateSignature(signature_info,random_info->nonce); in SetRandomKey()
921 IncrementRandomNonce(random_info->nonce); in SetRandomKey()
922 SetStringInfo(random_info->reservoir,GetSignatureDigest(signature_info)); in SetRandomKey()
923 random_info->i=i; in SetRandomKey()
924 datum=GetStringInfoDatum(random_info->reservoir); in SetRandomKey()
928 UnlockSemaphoreInfo(random_info->semaphore); in SetRandomKey()