Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions crypto/rand_extra/getrandom_fillin.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
#include "internal.h"


#if defined(OPENSSL_RAND_URANDOM)

#if defined(OPENSSL_RAND_URANDOM) && defined(OPENSSL_LINUX)
#include <sys/syscall.h>

#if defined(OPENSSL_X86_64)
Expand Down Expand Up @@ -54,7 +53,7 @@
#define GRND_RANDOM 2
#endif

#endif // OPENSSL_LINUX
#endif // OPENSSL_RAND_URANDOM && OPENSSL_LINUX


#endif // OPENSSL_HEADER_CRYPTO_RAND_GETRANDOM_FILLIN_H
4 changes: 4 additions & 0 deletions crypto/rand_extra/urandom.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,9 @@ static void ensure_dev_urandom_is_initialized(void) {

// On platforms where urandom doesn't block at startup, we ensure that the
// kernel has sufficient entropy before continuing.
//
// RNDGETENTCNT is a Linux kernel ioctl (from <linux/random.h>)
#if defined(HAVE_LINUX_RANDOM_H)
Comment thread
pgimalac marked this conversation as resolved.
Outdated
Comment thread
pgimalac marked this conversation as resolved.
Outdated
for (;;) {
int entropy_bits = 0;
if (ioctl(urandom_fd, RNDGETENTCNT, &entropy_bits)) {
Expand All @@ -376,6 +379,7 @@ static void ensure_dev_urandom_is_initialized(void) {
struct timespec sleep_time = {.tv_sec = 0, .tv_nsec = MILLISECONDS_250 };
nanosleep(&sleep_time, &sleep_time);
}
#endif // HAVE_LINUX_RANDOM_H

random_flavor_state = STATE_READY;
}
Expand Down
Loading