diff options
Diffstat (limited to 'os/auth.c')
-rw-r--r-- | os/auth.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -314,6 +314,20 @@ GenerateAuthorization( return -1; } +#ifdef HAVE_URANDOM + +void +GenerateRandomData (int len, char *buf) +{ + int fd; + + fd = open("/dev/urandom", O_RDONLY); + read(fd, buf, len); + close(fd); +} + +#else /* !HAVE_URANDOM */ + /* A random number generator that is more unpredictable than that shipped with some systems. This code is taken from the C standard. */ @@ -351,4 +365,6 @@ GenerateRandomData (int len, char *buf) /* XXX add getrusage, popen("ps -ale") */ } +#endif /* HAVE_URANDOM */ + #endif /* XCSECURITY */ |