Latest update.
This commit is contained in:
+12
-2
@@ -1353,7 +1353,12 @@ RAND_DRBG *OPENSSL_CTX_get0_public_drbg(OPENSSL_CTX *ctx)
|
||||
drbg = CRYPTO_THREAD_get_local(&dgbl->public_drbg);
|
||||
if (drbg == NULL) {
|
||||
ctx = openssl_ctx_get_concrete(ctx);
|
||||
if (!ossl_init_thread_start(NULL, ctx, drbg_delete_thread_state))
|
||||
/*
|
||||
* If the private_drbg is also NULL then this is the first time we've
|
||||
* used this thread.
|
||||
*/
|
||||
if (CRYPTO_THREAD_get_local(&dgbl->private_drbg) == NULL
|
||||
&& !ossl_init_thread_start(NULL, ctx, drbg_delete_thread_state))
|
||||
return NULL;
|
||||
drbg = drbg_setup(ctx, dgbl->master_drbg, RAND_DRBG_TYPE_PUBLIC);
|
||||
CRYPTO_THREAD_set_local(&dgbl->public_drbg, drbg);
|
||||
@@ -1381,7 +1386,12 @@ RAND_DRBG *OPENSSL_CTX_get0_private_drbg(OPENSSL_CTX *ctx)
|
||||
drbg = CRYPTO_THREAD_get_local(&dgbl->private_drbg);
|
||||
if (drbg == NULL) {
|
||||
ctx = openssl_ctx_get_concrete(ctx);
|
||||
if (!ossl_init_thread_start(NULL, ctx, drbg_delete_thread_state))
|
||||
/*
|
||||
* If the public_drbg is also NULL then this is the first time we've
|
||||
* used this thread.
|
||||
*/
|
||||
if (CRYPTO_THREAD_get_local(&dgbl->public_drbg) == NULL
|
||||
&& !ossl_init_thread_start(NULL, ctx, drbg_delete_thread_state))
|
||||
return NULL;
|
||||
drbg = drbg_setup(ctx, dgbl->master_drbg, RAND_DRBG_TYPE_PRIVATE);
|
||||
CRYPTO_THREAD_set_local(&dgbl->private_drbg, drbg);
|
||||
|
||||
@@ -851,7 +851,7 @@ void RAND_add(const void *buf, int num, double randomness)
|
||||
* the default method, then just call RAND_bytes(). Otherwise make
|
||||
* sure we're instantiated and use the private DRBG.
|
||||
*/
|
||||
int rand_priv_bytes_ex(OPENSSL_CTX *ctx, unsigned char *buf, int num)
|
||||
int RAND_priv_bytes_ex(OPENSSL_CTX *ctx, unsigned char *buf, int num)
|
||||
{
|
||||
RAND_DRBG *drbg;
|
||||
const RAND_METHOD *meth = RAND_get_rand_method();
|
||||
@@ -872,10 +872,10 @@ int rand_priv_bytes_ex(OPENSSL_CTX *ctx, unsigned char *buf, int num)
|
||||
|
||||
int RAND_priv_bytes(unsigned char *buf, int num)
|
||||
{
|
||||
return rand_priv_bytes_ex(NULL, buf, num);
|
||||
return RAND_priv_bytes_ex(NULL, buf, num);
|
||||
}
|
||||
|
||||
int rand_bytes_ex(OPENSSL_CTX *ctx, unsigned char *buf, int num)
|
||||
int RAND_bytes_ex(OPENSSL_CTX *ctx, unsigned char *buf, int num)
|
||||
{
|
||||
RAND_DRBG *drbg;
|
||||
const RAND_METHOD *meth = RAND_get_rand_method();
|
||||
@@ -896,7 +896,7 @@ int rand_bytes_ex(OPENSSL_CTX *ctx, unsigned char *buf, int num)
|
||||
|
||||
int RAND_bytes(unsigned char *buf, int num)
|
||||
{
|
||||
return rand_bytes_ex(NULL, buf, num);
|
||||
return RAND_bytes_ex(NULL, buf, num);
|
||||
}
|
||||
|
||||
#if !defined(OPENSSL_NO_DEPRECATED_1_1_0) && !defined(FIPS_MODE)
|
||||
|
||||
Reference in New Issue
Block a user