diff options
author | bcook <> | 2018-03-13 22:53:28 +0000 |
---|---|---|
committer | bcook <> | 2018-03-13 22:53:28 +0000 |
commit | 465530f1caa501bb0fc3b1adcc54d810ee97b096 (patch) | |
tree | 1c5d5325c3acd9da6ca6d59184f4611627e29dd8 | |
parent | 7232fedecfd1782f7a08e49519de4e1c7990edb6 (diff) | |
download | openbsd-465530f1caa501bb0fc3b1adcc54d810ee97b096.tar.gz openbsd-465530f1caa501bb0fc3b1adcc54d810ee97b096.tar.bz2 openbsd-465530f1caa501bb0fc3b1adcc54d810ee97b096.zip |
ensure SYS_getrandom and GRND_NONBLOCK are both defined before using getrandom(2)
Based on discussion here https://github.com/libressl-portable/openbsd/pull/82
Suggested fix from jsing@
-rw-r--r-- | src/lib/libcrypto/arc4random/getentropy_linux.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/libcrypto/arc4random/getentropy_linux.c b/src/lib/libcrypto/arc4random/getentropy_linux.c index a845239eb3..408d7fda34 100644 --- a/src/lib/libcrypto/arc4random/getentropy_linux.c +++ b/src/lib/libcrypto/arc4random/getentropy_linux.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: getentropy_linux.c,v 1.44 2017/04/29 18:43:31 beck Exp $ */ | 1 | /* $OpenBSD: getentropy_linux.c,v 1.45 2018/03/13 22:53:28 bcook Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org> | 4 | * Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org> |
@@ -74,7 +74,7 @@ | |||
74 | int getentropy(void *buf, size_t len); | 74 | int getentropy(void *buf, size_t len); |
75 | 75 | ||
76 | static int gotdata(char *buf, size_t len); | 76 | static int gotdata(char *buf, size_t len); |
77 | #ifdef SYS_getrandom | 77 | #if defined(SYS_getrandom) && defined(GRND_NONBLOCK) |
78 | static int getentropy_getrandom(void *buf, size_t len); | 78 | static int getentropy_getrandom(void *buf, size_t len); |
79 | #endif | 79 | #endif |
80 | static int getentropy_urandom(void *buf, size_t len); | 80 | static int getentropy_urandom(void *buf, size_t len); |
@@ -94,7 +94,7 @@ getentropy(void *buf, size_t len) | |||
94 | return (-1); | 94 | return (-1); |
95 | } | 95 | } |
96 | 96 | ||
97 | #ifdef SYS_getrandom | 97 | #if defined(SYS_getrandom) && defined(GRND_NONBLOCK) |
98 | /* | 98 | /* |
99 | * Try descriptor-less getrandom(), in non-blocking mode. | 99 | * Try descriptor-less getrandom(), in non-blocking mode. |
100 | * | 100 | * |
@@ -193,7 +193,7 @@ gotdata(char *buf, size_t len) | |||
193 | return (0); | 193 | return (0); |
194 | } | 194 | } |
195 | 195 | ||
196 | #ifdef SYS_getrandom | 196 | #if defined(SYS_getrandom) && defined(GRND_NONBLOCK) |
197 | static int | 197 | static int |
198 | getentropy_getrandom(void *buf, size_t len) | 198 | getentropy_getrandom(void *buf, size_t len) |
199 | { | 199 | { |