185 |
void generate_random(uint8 *random) |
void generate_random(uint8 *random) |
186 |
{ |
{ |
187 |
struct stat st; |
struct stat st; |
188 |
|
struct tms tmsbuf; |
189 |
uint32 *r = (uint32 *)random; |
uint32 *r = (uint32 *)random; |
190 |
int fd; |
int fd; |
191 |
|
|
200 |
/* Otherwise use whatever entropy we can gather - ideas welcome. */ |
/* Otherwise use whatever entropy we can gather - ideas welcome. */ |
201 |
r[0] = (getpid()) | (getppid() << 16); |
r[0] = (getpid()) | (getppid() << 16); |
202 |
r[1] = (getuid()) | (getgid() << 16); |
r[1] = (getuid()) | (getgid() << 16); |
203 |
r[2] = times(NULL); /* system uptime (clocks) */ |
r[2] = times(&tmsbuf); /* system uptime (clocks) */ |
204 |
gettimeofday((struct timeval *)&r[3], NULL); /* sec and usec */ |
gettimeofday((struct timeval *)&r[3], NULL); /* sec and usec */ |
205 |
stat("/tmp", &st); |
stat("/tmp", &st); |
206 |
r[5] = st.st_atime; |
r[5] = st.st_atime; |