Remove some stale ifdefs from urandom.cc After 53f09ad241ddf7e37a426a5e3c6dfa6d4dca9706, we use getentropy on FreeBSD, so the FREEBSD_GETRANDOM check is dead code. urandom.cc can assume OPENSSL_LINUX is true and include headers accordingly. We also no longer do the ioctl dance on /dev/urandom in BORINGSSL_FIPS, so includes for those can be removed. Change-Id: I394b43ffc05a1ccd1759aac1277e2a2971eddb67 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/82107 Reviewed-by: Adam Langley <agl@google.com> Commit-Queue: Adam Langley <agl@google.com> Commit-Queue: David Benjamin <davidben@google.com> Auto-Submit: David Benjamin <davidben@google.com>
diff --git a/crypto/rand/urandom.cc b/crypto/rand/urandom.cc index 4ff6602..868b9f4 100644 --- a/crypto/rand/urandom.cc +++ b/crypto/rand/urandom.cc
@@ -28,14 +28,8 @@ #include <fcntl.h> #include <stdio.h> #include <string.h> -#include <unistd.h> - -#if defined(OPENSSL_LINUX) -#if defined(BORINGSSL_FIPS) -#include <linux/random.h> -#include <sys/ioctl.h> -#endif #include <sys/syscall.h> +#include <unistd.h> #if defined(OPENSSL_ANDROID) #include <sys/system_properties.h> @@ -57,7 +51,6 @@ #if defined(OPENSSL_HAS_GETAUXVAL) #include <sys/auxv.h> #endif -#endif // OPENSSL_LINUX #include <openssl/mem.h> @@ -248,14 +241,11 @@ return 1; } -#if defined(USE_NR_getrandom) || defined(FREEBSD_GETRANDOM) +#if defined(USE_NR_getrandom) int getrandom_flags = 0; if (!block) { getrandom_flags |= GRND_NONBLOCK; } -#endif - -#if defined(USE_NR_getrandom) if (seed) { getrandom_flags |= extra_getrandom_flags_for_seed; }