diff options
author | bcook <bcook@cvs.openbsd.org> | 2014-08-16 18:42:42 +0000 |
---|---|---|
committer | bcook <bcook@cvs.openbsd.org> | 2014-08-16 18:42:42 +0000 |
commit | f236fe48520c92df295fe8a2becb07ac6b0dcf74 (patch) | |
tree | 6d9db398642642698a18f0199f8b386a183c11f4 /lib/libcrypto | |
parent | 6dab561ffc2a37f10882b3d2406361f900a1a097 (diff) |
only build the getrandom path if SYS_getrandom is defined.
like the sysctl path
Diffstat (limited to 'lib/libcrypto')
-rw-r--r-- | lib/libcrypto/crypto/getentropy_linux.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/libcrypto/crypto/getentropy_linux.c b/lib/libcrypto/crypto/getentropy_linux.c index a84f7ad8886..76d724af148 100644 --- a/lib/libcrypto/crypto/getentropy_linux.c +++ b/lib/libcrypto/crypto/getentropy_linux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getentropy_linux.c,v 1.33 2014/08/16 17:21:56 bcook Exp $ */ +/* $OpenBSD: getentropy_linux.c,v 1.34 2014/08/16 18:42:41 bcook Exp $ */ /* * Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org> @@ -74,7 +74,9 @@ int getentropy(void *buf, size_t len); static int gotdata(char *buf, size_t len); +#ifdef SYS_getrandom static int getentropy_getrandom(void *buf, size_t len); +#endif static int getentropy_urandom(void *buf, size_t len); #ifdef SYS__sysctl static int getentropy_sysctl(void *buf, size_t len); @@ -92,6 +94,7 @@ getentropy(void *buf, size_t len) return -1; } +#ifdef SYS_getrandom /* * Try descriptor-less getrandom() */ @@ -100,6 +103,7 @@ getentropy(void *buf, size_t len) return (ret); if (errno != ENOSYS) return (-1); +#endif /* * Try to get entropy with /dev/urandom @@ -186,10 +190,10 @@ gotdata(char *buf, size_t len) return 0; } +#ifdef SYS_getrandom static int getentropy_getrandom(void *buf, size_t len) { -#ifdef SYS_getrandom int ret; if (len > 256) return (-1); @@ -199,9 +203,9 @@ getentropy_getrandom(void *buf, size_t len) if (ret == len) return (0); -#endif return (-1); } +#endif static int getentropy_urandom(void *buf, size_t len) |