From d54f0721cd5e407f95b840ab4259191cd6c0bd3b Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sun, 2 Jun 2019 21:11:13 +0200 Subject: [PATCH] getentropy() may be defined but NULL on older iOS versions --- .../randombytes/internal/randombytes_internal_random.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libsodium/randombytes/internal/randombytes_internal_random.c b/src/libsodium/randombytes/internal/randombytes_internal_random.c index f0794f80..24e79696 100644 --- a/src/libsodium/randombytes/internal/randombytes_internal_random.c +++ b/src/libsodium/randombytes/internal/randombytes_internal_random.c @@ -180,6 +180,12 @@ static int _randombytes_getentropy(void * const buf, const size_t size) { assert(size <= 256U); + /* LCOV_EXCL_START */ + if (&getentropy == NULL) { + errno = ENOSYS; + return -1; + } + /* LCOV_EXCL_END */ if (getentropy(buf, size) != 0) { return -1; /* LCOV_EXCL_LINE */ }