Skip to content

Commit

Permalink
fix compilation on openbsd (pyca#3814)
Browse files Browse the repository at this point in the history
the getentropy fallback is only possible on macOS, wrap it in a define
to remove it entirely on the BSDs.
  • Loading branch information
reaperhulk authored and alex committed Jul 26, 2017
1 parent 45f2a42 commit 65f41af
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/_cffi_src/openssl/src/osrandom_engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,10 @@ static int osrandom_rand_bytes(unsigned char *buffer, int size) {
int res;

switch(getentropy_works) {
#if defined(__APPLE__)
case CRYPTOGRAPHY_OSRANDOM_GETENTROPY_FALLBACK:
return dev_urandom_read(buffer, size);
#endif
case CRYPTOGRAPHY_OSRANDOM_GETENTROPY_WORKS:
while (size > 0) {
/* OpenBSD and macOS restrict maximum buffer size to 256. */
Expand Down

0 comments on commit 65f41af

Please sign in to comment.