Also try /dev/rnd for random data.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@644 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -149,9 +149,20 @@ des_rand_data(unsigned char *data, int size)
|
|||||||
{
|
{
|
||||||
int fd = open("/dev/random", O_RDONLY);
|
int fd = open("/dev/random", O_RDONLY);
|
||||||
if (fd != -1 && read(fd, data, size) == size)
|
if (fd != -1 && read(fd, data, size) == size)
|
||||||
return;
|
{
|
||||||
if (fd != -1)
|
|
||||||
close(fd);
|
close(fd);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
int fd = open("/dev/rnd", O_RDONLY);
|
||||||
|
if (fd != -1 && read(fd, data, size) == size)
|
||||||
|
{
|
||||||
|
close(fd);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Paranoia? Initialize data from /dev/mem if we can read it. */
|
/* Paranoia? Initialize data from /dev/mem if we can read it. */
|
||||||
|
Reference in New Issue
Block a user