summaryrefslogtreecommitdiffstats
path: root/crypto/rand
diff options
context:
space:
mode:
authornia <nia@netbsd.org>2020-04-30 14:42:09 +0100
committerMatt Caswell <matt@openssl.org>2020-05-04 09:04:41 +0100
commit3c64c50bcf848bd341dd4c4541a70a76883f5147 (patch)
tree38d7df1de7b6fa3444f8fa37511db3bf12ec545d /crypto/rand
parent78ed03986f39a5b85ebf04e5e97eaa9602dee0a3 (diff)
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) (cherry picked from commit 0c27ce7322e15a7e0733d48aaf9c8e1d1249541f)
Diffstat (limited to 'crypto/rand')
-rw-r--r--crypto/rand/rand_unix.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/crypto/rand/rand_unix.c b/crypto/rand/rand_unix.c
index 6d30d35b90..177ee6958f 100644
--- a/crypto/rand/rand_unix.c
+++ b/crypto/rand/rand_unix.c
@@ -247,10 +247,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