mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
genrand: Slightly simplify do_reseed
The only caller set "use_fd" to "true". Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Fri Jun 14 20:29:56 CEST 2013 on sn-devel-104
This commit is contained in:
parent
dd0e38b5fe
commit
c71d6ecbcb
@ -163,13 +163,12 @@ static void do_filehash(const char *fname, unsigned char *the_hash)
|
||||
above...
|
||||
**************************************************************/
|
||||
|
||||
static int do_reseed(bool use_fd, int fd)
|
||||
static int do_reseed(int fd)
|
||||
{
|
||||
unsigned char seed_inbuf[40];
|
||||
uint32_t v1, v2; struct timeval tval; pid_t mypid;
|
||||
int reseed_data = 0;
|
||||
|
||||
if (use_fd) {
|
||||
if (fd == -1) {
|
||||
fd = open( "/dev/urandom", O_RDONLY,0);
|
||||
if (fd != -1) {
|
||||
@ -181,7 +180,6 @@ static int do_reseed(bool use_fd, int fd)
|
||||
seed_random_stream(seed_inbuf, sizeof(seed_inbuf));
|
||||
return fd;
|
||||
}
|
||||
}
|
||||
|
||||
/* Add in some secret file contents */
|
||||
|
||||
@ -244,7 +242,7 @@ _PUBLIC_ void generate_random_buffer(uint8_t *out, int len)
|
||||
}
|
||||
}
|
||||
|
||||
urand_fd = do_reseed(true, urand_fd);
|
||||
urand_fd = do_reseed(urand_fd);
|
||||
done_reseed = true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user