Commit 2545f944 authored by Kurt Roeckx's avatar Kurt Roeckx
Browse files

Remove support for calling getrandom(), we now always call getentropy()



Only Linux and FreeBSD provide getrandom(), but they both also provide
getentropy() since the same version and we already tried to call that.

Reviewed-by: default avatarAndy Polyakov <appro@openssl.org>
GH: #6405
parent cf0891b8
Loading
Loading
Loading
Loading
+0 −18
Original line number Diff line number Diff line
@@ -164,20 +164,6 @@ size_t rand_pool_acquire_entropy(RAND_POOL *pool)
#   error "Seeding uses urandom but DEVRANDOM is not configured"
#  endif

#  if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
#   if __GLIBC_PREREQ(2, 25)
#    define OPENSSL_HAVE_GETRANDOM
#   endif
#  endif

#  if (defined(__FreeBSD__) && __FreeBSD_version >= 1200061)
#   define OPENSSL_HAVE_GETRANDOM
#  endif

#  if defined(OPENSSL_HAVE_GETRANDOM)
#   include <sys/random.h>
#  endif

#  if defined(OPENSSL_RAND_SEED_OS)
#   if !defined(DEVRANDOM)
#    error "OS seeding requires DEVRANDOM to be configured"
@@ -265,10 +251,6 @@ int syscall_random(void *buf, size_t buflen)
    if (p_getentropy.p != NULL)
        return p_getentropy.f(buf, buflen);

#  if defined(OPENSSL_HAVE_GETRANDOM)
    return (int)getrandom(buf, buflen, 0);
#  endif

    /* Linux supports this since version 3.17 */
#  if defined(__linux) && defined(SYS_getrandom)
    return (int)syscall(SYS_getrandom, buf, buflen, 0);