From 0c27ce7322e15a7e0733d48aaf9c8e1d1249541f Mon Sep 17 00:00:00 2001 From: nia Date: Thu, 30 Apr 2020 14:42:09 +0100 Subject: [PATCH] rand_unix.c: Only enable hack for old FreeBSD versions on FreeBSD Reviewed-by: Paul Dale Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/11689) --- crypto/rand/rand_unix.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crypto/rand/rand_unix.c b/crypto/rand/rand_unix.c index 6b6cc78f80..c9ee01f1b1 100644 --- a/crypto/rand/rand_unix.c +++ b/crypto/rand/rand_unix.c @@ -227,10 +227,12 @@ static ssize_t sysctl_random(char *buf, size_t buflen) * when the sysctl returns long and we want to request something not a * multiple of longs, which should never be the case. */ +#if defined(__FreeBSD__) if (!ossl_assert(buflen % sizeof(long) == 0)) { errno = EINVAL; return -1; } +#endif /* * On NetBSD before 4.0 KERN_ARND was an alias for KERN_URND, and only -- 2.25.1