aboutsummaryrefslogtreecommitdiff
path: root/crypto/rand
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2021-03-25 15:05:31 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2021-03-25 15:05:31 +0000
commit94fa08a4bcdfbb3434b025d67d014af3b18e5380 (patch)
treed9b51f32dc4f6bcd110a92d0374694a93bfa2fb0 /crypto/rand
parent4f55bd5321b72491d4eff396e4928e9ab0706735 (diff)
downloadsrc-94fa08a4bcdfbb3434b025d67d014af3b18e5380.tar.gz
src-94fa08a4bcdfbb3434b025d67d014af3b18e5380.zip
Import OpenSSL 1.1.1k.vendor/openssl/1.1.1k
Diffstat (limited to 'crypto/rand')
-rw-r--r--crypto/rand/rand_lib.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/crypto/rand/rand_lib.c b/crypto/rand/rand_lib.c
index ba3a29e58468..5c72fad8ca26 100644
--- a/crypto/rand/rand_lib.c
+++ b/crypto/rand/rand_lib.c
@@ -1,5 +1,5 @@
/*
- * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -432,9 +432,13 @@ err:
RAND_POOL *rand_pool_new(int entropy_requested, int secure,
size_t min_len, size_t max_len)
{
- RAND_POOL *pool = OPENSSL_zalloc(sizeof(*pool));
+ RAND_POOL *pool;
size_t min_alloc_size = RAND_POOL_MIN_ALLOCATION(secure);
+ if (!RUN_ONCE(&rand_init, do_rand_init))
+ return NULL;
+
+ pool = OPENSSL_zalloc(sizeof(*pool));
if (pool == NULL) {
RANDerr(RAND_F_RAND_POOL_NEW, ERR_R_MALLOC_FAILURE);
return NULL;