Latest update.
This commit is contained in:
@@ -27,12 +27,12 @@
|
||||
# include <sys/utsname.h>
|
||||
# endif
|
||||
#endif
|
||||
#if defined(__FreeBSD__) && !defined(OPENSSL_SYS_UEFI)
|
||||
#if (defined(__FreeBSD__) || defined(__NetBSD__)) && !defined(OPENSSL_SYS_UEFI)
|
||||
# include <sys/types.h>
|
||||
# include <sys/sysctl.h>
|
||||
# include <sys/param.h>
|
||||
#endif
|
||||
#if defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
#if defined(__OpenBSD__)
|
||||
# include <sys/param.h>
|
||||
#endif
|
||||
|
||||
@@ -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
|
||||
@@ -248,7 +250,7 @@ static ssize_t sysctl_random(char *buf, size_t buflen)
|
||||
mib[1] = KERN_ARND;
|
||||
|
||||
do {
|
||||
len = buflen;
|
||||
len = buflen > 256 ? 256 : buflen;
|
||||
if (sysctl(mib, 2, buf, &len, NULL, 0) == -1)
|
||||
return done > 0 ? done : -1;
|
||||
done += len;
|
||||
@@ -349,7 +351,7 @@ static ssize_t syscall_random(void *buf, size_t buflen)
|
||||
|
||||
if (getentropy != NULL)
|
||||
return getentropy(buf, buflen) == 0 ? (ssize_t)buflen : -1;
|
||||
# elif !defined(FIPS_MODE)
|
||||
# elif !defined(FIPS_MODULE)
|
||||
union {
|
||||
void *p;
|
||||
int (*f)(void *buffer, size_t length);
|
||||
@@ -392,7 +394,7 @@ static int keep_random_devices_open = 1;
|
||||
# if defined(__linux) && defined(DEVRANDOM_WAIT)
|
||||
static void *shm_addr;
|
||||
|
||||
# if !defined(FIPS_MODE)
|
||||
# if !defined(FIPS_MODULE)
|
||||
static void cleanup_shm(void)
|
||||
{
|
||||
shmdt(shm_addr);
|
||||
@@ -463,7 +465,7 @@ static int wait_random_seeded(void)
|
||||
* If this call fails, it isn't a big problem.
|
||||
*/
|
||||
shm_addr = shmat(shm_id, NULL, SHM_RDONLY);
|
||||
# ifndef FIPS_MODE
|
||||
# ifndef FIPS_MODULE
|
||||
/* TODO 3.0: The FIPS provider doesn't have OPENSSL_atexit */
|
||||
if (shm_addr != (void *)-1)
|
||||
OPENSSL_atexit(&cleanup_shm);
|
||||
|
||||
Reference in New Issue
Block a user