mirror of
https://github.com/QuasarApp/openssl.git
synced 2025-05-01 04:04:39 +00:00
DragonFlyBSD build fix and update.
getentropy call is not supported however getrandom since the 5.7.x branch is. current LTS stable is 5.8. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/13375)
This commit is contained in:
parent
a04400fc74
commit
0bb450fe2f
@ -36,7 +36,10 @@
|
|||||||
#if defined(__OpenBSD__)
|
#if defined(__OpenBSD__)
|
||||||
# include <sys/param.h>
|
# include <sys/param.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(__DragonFly__)
|
||||||
|
# include <sys/param.h>
|
||||||
|
# include <sys/random.h>
|
||||||
|
#endif
|
||||||
/*
|
/*
|
||||||
* Provide a compile time error if the FIPS module is being built and none
|
* Provide a compile time error if the FIPS module is being built and none
|
||||||
* of the supported entropy sources are available.
|
* of the supported entropy sources are available.
|
||||||
@ -380,6 +383,7 @@ static ssize_t syscall_random(void *buf, size_t buflen)
|
|||||||
* Note: Sometimes getentropy() can be provided but not implemented
|
* Note: Sometimes getentropy() can be provided but not implemented
|
||||||
* internally. So we need to check errno for ENOSYS
|
* internally. So we need to check errno for ENOSYS
|
||||||
*/
|
*/
|
||||||
|
# if !defined(__DragonFly__)
|
||||||
# if defined(__GNUC__) && __GNUC__>=2 && defined(__ELF__) && !defined(__hpux)
|
# if defined(__GNUC__) && __GNUC__>=2 && defined(__ELF__) && !defined(__hpux)
|
||||||
extern int getentropy(void *buffer, size_t length) __attribute__((weak));
|
extern int getentropy(void *buffer, size_t length) __attribute__((weak));
|
||||||
|
|
||||||
@ -405,12 +409,15 @@ static ssize_t syscall_random(void *buf, size_t buflen)
|
|||||||
if (p_getentropy.p != NULL)
|
if (p_getentropy.p != NULL)
|
||||||
return p_getentropy.f(buf, buflen) == 0 ? (ssize_t)buflen : -1;
|
return p_getentropy.f(buf, buflen) == 0 ? (ssize_t)buflen : -1;
|
||||||
# endif
|
# endif
|
||||||
|
# endif /* !__DragonFly__ */
|
||||||
|
|
||||||
/* Linux supports this since version 3.17 */
|
/* Linux supports this since version 3.17 */
|
||||||
# if defined(__linux) && defined(__NR_getrandom)
|
# if defined(__linux) && defined(__NR_getrandom)
|
||||||
return syscall(__NR_getrandom, buf, buflen, 0);
|
return syscall(__NR_getrandom, buf, buflen, 0);
|
||||||
# elif (defined(__FreeBSD__) || defined(__NetBSD__)) && defined(KERN_ARND)
|
# elif (defined(__FreeBSD__) || defined(__NetBSD__)) && defined(KERN_ARND)
|
||||||
return sysctl_random(buf, buflen);
|
return sysctl_random(buf, buflen);
|
||||||
|
# elif (defined(__DragonFly__) && __DragonFly_version >= 500700)
|
||||||
|
return getrandom(buf, buflen, 0);
|
||||||
# else
|
# else
|
||||||
errno = ENOSYS;
|
errno = ENOSYS;
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user