• Home
  • Raw
  • Download

Lines Matching refs:random_info

170     *random_info;  in AcquireRandomInfo()  local
177 random_info=(RandomInfo *) AcquireCriticalMemory(sizeof(*random_info)); in AcquireRandomInfo()
178 (void) memset(random_info,0,sizeof(*random_info)); in AcquireRandomInfo()
179 random_info->signature_info=AcquireSignatureInfo(); in AcquireRandomInfo()
180 random_info->nonce=AcquireStringInfo(2*GetSignatureDigestsize( in AcquireRandomInfo()
181 random_info->signature_info)); in AcquireRandomInfo()
182 ResetStringInfo(random_info->nonce); in AcquireRandomInfo()
183 random_info->reservoir=AcquireStringInfo(GetSignatureDigestsize( in AcquireRandomInfo()
184 random_info->signature_info)); in AcquireRandomInfo()
185 ResetStringInfo(random_info->reservoir); in AcquireRandomInfo()
186 random_info->normalize=1.0/(~0UL); in AcquireRandomInfo()
187 random_info->secret_key=secret_key; in AcquireRandomInfo()
188 random_info->protocol_major=RandomProtocolMajorVersion; in AcquireRandomInfo()
189 random_info->protocol_minor=RandomProtocolMinorVersion; in AcquireRandomInfo()
190 random_info->semaphore=AcquireSemaphoreInfo(); in AcquireRandomInfo()
191 random_info->timestamp=(ssize_t) time(0); in AcquireRandomInfo()
192 random_info->signature=MagickCoreSignature; in AcquireRandomInfo()
196 nonce=GenerateEntropicChaos(random_info); in AcquireRandomInfo()
199 InitializeSignature(random_info->signature_info); in AcquireRandomInfo()
200 UpdateSignature(random_info->signature_info,nonce); in AcquireRandomInfo()
201 FinalizeSignature(random_info->signature_info); in AcquireRandomInfo()
203 random_info->signature_info)+1)/2); in AcquireRandomInfo()
204 SetStringInfo(nonce,GetSignatureDigest(random_info->signature_info)); in AcquireRandomInfo()
205 SetStringInfo(random_info->nonce,nonce); in AcquireRandomInfo()
210 entropy=GenerateEntropicChaos(random_info); in AcquireRandomInfo()
213 UpdateSignature(random_info->signature_info,entropy); in AcquireRandomInfo()
214 FinalizeSignature(random_info->signature_info); in AcquireRandomInfo()
215 SetStringInfo(random_info->reservoir,GetSignatureDigest( in AcquireRandomInfo()
216 random_info->signature_info)); in AcquireRandomInfo()
221 if (random_info->secret_key == ~0UL) in AcquireRandomInfo()
223 key=GetRandomKey(random_info,sizeof(random_info->secret_key)); in AcquireRandomInfo()
224 (void) memcpy(random_info->seed,GetStringInfoDatum(key), in AcquireRandomInfo()
234 key=AcquireStringInfo(sizeof(random_info->secret_key)); in AcquireRandomInfo()
235 SetStringInfoDatum(key,(unsigned char *) &random_info->secret_key); in AcquireRandomInfo()
240 (void) memcpy(random_info->seed,GetStringInfoDatum(digest), in AcquireRandomInfo()
242 sizeof(*random_info->seed))); in AcquireRandomInfo()
245 random_info->seed[1]=0x50a7f451UL; in AcquireRandomInfo()
246 random_info->seed[2]=0x5365417eUL; in AcquireRandomInfo()
247 random_info->seed[3]=0xc3a4171aUL; 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()
610 MagickExport double GetPseudoRandomValue(RandomInfo *random_info) in GetPseudoRandomValue() argument
618 seed=random_info->seed; in GetPseudoRandomValue()
627 return(random_info->normalize*seed[0]); in GetPseudoRandomValue()
652 MagickPrivate double GetRandomInfoNormalize(const RandomInfo *random_info) in GetRandomInfoNormalize() argument
654 assert(random_info != (const RandomInfo *) NULL); in GetRandomInfoNormalize()
655 return(random_info->normalize); in GetRandomInfoNormalize()
680 MagickPrivate unsigned long *GetRandomInfoSeed(RandomInfo *random_info) in GetRandomInfoSeed() argument
682 assert(random_info != (RandomInfo *) NULL); in GetRandomInfoSeed()
683 return(random_info->seed); in GetRandomInfoSeed()
710 MagickExport StringInfo *GetRandomKey(RandomInfo *random_info, in GetRandomKey() argument
716 assert(random_info != (RandomInfo *) NULL); in GetRandomKey()
718 SetRandomKey(random_info,length,GetStringInfoDatum(key)); in GetRandomKey()
743 MagickExport unsigned long GetRandomSecretKey(const RandomInfo *random_info) in GetRandomSecretKey() argument
745 return(random_info->secret_key); in GetRandomSecretKey()
768 MagickExport double GetRandomValue(RandomInfo *random_info) in GetRandomValue() argument
777 SetRandomKey(random_info,sizeof(key),(unsigned char *) &key); in GetRandomValue()
878 MagickExport void SetRandomKey(RandomInfo *random_info,const size_t length, in SetRandomKey() argument
893 assert(random_info != (RandomInfo *) NULL); in SetRandomKey()
896 LockSemaphoreInfo(random_info->semaphore); in SetRandomKey()
897 signature_info=random_info->signature_info; in SetRandomKey()
898 datum=GetStringInfoDatum(random_info->reservoir); in SetRandomKey()
900 for (p=key; (i != 0) && (random_info->i != 0); i--) in SetRandomKey()
902 *p++=datum[random_info->i]; in SetRandomKey()
903 random_info->i++; in SetRandomKey()
904 if (random_info->i == GetSignatureDigestsize(signature_info)) in SetRandomKey()
905 random_info->i=0; in SetRandomKey()
910 UpdateSignature(signature_info,random_info->nonce); in SetRandomKey()
912 IncrementRandomNonce(random_info->nonce); in SetRandomKey()
921 UpdateSignature(signature_info,random_info->nonce); in SetRandomKey()
923 IncrementRandomNonce(random_info->nonce); in SetRandomKey()
924 SetStringInfo(random_info->reservoir,GetSignatureDigest(signature_info)); in SetRandomKey()
925 random_info->i=i; in SetRandomKey()
926 datum=GetStringInfoDatum(random_info->reservoir); in SetRandomKey()
930 UnlockSemaphoreInfo(random_info->semaphore); in SetRandomKey()