comparison random.c @ 298:7dad470ad4aa

minor cleanups for some warnings
author Matt Johnston <matt@ucc.asn.au>
date Wed, 22 Mar 2006 05:12:18 +0000
parents 3be7ae2e8dfa
children 1876c6bb084b 36d21680a9d3
comparison
equal deleted inserted replaced
295:03f65e461915 298:7dad470ad4aa
29 29
30 static int donerandinit = 0; 30 static int donerandinit = 0;
31 31
32 /* this is used to generate unique output from the same hashpool */ 32 /* this is used to generate unique output from the same hashpool */
33 static uint32_t counter = 0; 33 static uint32_t counter = 0;
34 #define MAX_COUNTER 1<<31 /* the max value for the counter, so it won't loop */ 34 /* the max value for the counter, so it won't integer overflow */
35 #define MAX_COUNTER 1<<30
35 36
36 static unsigned char hashpool[SHA1_HASH_SIZE]; 37 static unsigned char hashpool[SHA1_HASH_SIZE];
37 38
38 #define INIT_SEED_SIZE 32 /* 256 bits */ 39 #define INIT_SEED_SIZE 32 /* 256 bits */
39 40
165 166
166 pid = getpid(); 167 pid = getpid();
167 gettimeofday(&tv, NULL); 168 gettimeofday(&tv, NULL);
168 169
169 hash_state hs; 170 hash_state hs;
170 unsigned char hash[SHA1_HASH_SIZE];
171 sha1_init(&hs); 171 sha1_init(&hs);
172 sha1_process(&hs, (void*)hashpool, sizeof(hashpool)); 172 sha1_process(&hs, (void*)hashpool, sizeof(hashpool));
173 sha1_process(&hs, (void*)&pid, sizeof(pid)); 173 sha1_process(&hs, (void*)&pid, sizeof(pid));
174 sha1_process(&hs, (void*)&tv, sizeof(tv)); 174 sha1_process(&hs, (void*)&tv, sizeof(tv));
175 sha1_done(&hs, hashpool); 175 sha1_done(&hs, hashpool);