rand_unix.c: Only enable hack for old FreeBSD versions on FreeBSD

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11689)
This commit is contained in:
nia 2020-04-30 14:42:09 +01:00 committed by Matt Caswell
parent e2e4b784e6
commit 0c27ce7322

View File

@ -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 * when the sysctl returns long and we want to request something not a
* multiple of longs, which should never be the case. * multiple of longs, which should never be the case.
*/ */
#if defined(__FreeBSD__)
if (!ossl_assert(buflen % sizeof(long) == 0)) { if (!ossl_assert(buflen % sizeof(long) == 0)) {
errno = EINVAL; errno = EINVAL;
return -1; return -1;
} }
#endif
/* /*
* On NetBSD before 4.0 KERN_ARND was an alias for KERN_URND, and only * On NetBSD before 4.0 KERN_ARND was an alias for KERN_URND, and only