Comparison

util-src/crand.c @ 7831:201d0df6cce9

util.crand: Comment about getrandom
author Kim Alvefur <zash@zash.se>
date Sun, 22 Jan 2017 09:55:44 +0100
parent 7830:b9910a507250
child 7832:d02ef0ae94af
comparison
equal deleted inserted replaced
7830:b9910a507250 7831:201d0df6cce9
32 32
33 #ifndef SYS_getrandom 33 #ifndef SYS_getrandom
34 #error getrandom() requires Linux 3.17 or later 34 #error getrandom() requires Linux 3.17 or later
35 #endif 35 #endif
36 36
37 /* Was this not supposed to be a function? */ 37 /*
38 * This acts like a read from /dev/urandom with the exception that it
39 * *does* block if the entropy pool is not yet initialized.
40 */
38 int getrandom(void *buf, size_t len, int flags) { 41 int getrandom(void *buf, size_t len, int flags) {
39 return syscall(SYS_getrandom, buf, len, flags); 42 return syscall(SYS_getrandom, buf, len, flags);
40 } 43 }
41 44
42 #elif defined(WITH_ARC4RANDOM) 45 #elif defined(WITH_ARC4RANDOM)