diff options
author | Matt Caswell <matt@openssl.org> | 2021-01-08 13:48:13 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2021-01-14 17:30:46 +0000 |
commit | f5a50c2a07e288187c14b784be253b3a2a23483b (patch) | |
tree | 71ab229bb6194a7dde63dcf5fa904f5bef005158 /crypto/evp/evp_err.c | |
parent | 2c40421440d260ddb97a807b064033f61ae3b2b3 (diff) |
Enable locking on the primary DRBG when we create it
The primary DRBG may be shared across multiple threads and therefore
we must use locking to access it. Previously we were enabling that locking
lazily when we attempted to obtain one of the child DRBGs. Part of the
process of enabling the lock, is to create the lock. But if we create the
lock lazily then it is too late - we may race with other threads where each
thread is independently attempting to enable the locking. This results
in multiple locks being created - only one of which "sticks" and the rest
are leaked.
Instead we enable locking on the primary when we first create it. This is
already locked and therefore we cannot race.
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/13660)
Diffstat (limited to 'crypto/evp/evp_err.c')
-rw-r--r-- | crypto/evp/evp_err.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/evp/evp_err.c b/crypto/evp/evp_err.c index e08c373b33..ab6e3e879d 100644 --- a/crypto/evp/evp_err.c +++ b/crypto/evp/evp_err.c @@ -152,7 +152,7 @@ static const ERR_STRING_DATA EVP_str_reasons[] = { {ERR_PACK(ERR_LIB_EVP, 0, EVP_R_SET_DEFAULT_PROPERTY_FAILURE), "set default property failure"}, {ERR_PACK(ERR_LIB_EVP, 0, EVP_R_TOO_MANY_RECORDS), "too many records"}, - {ERR_PACK(ERR_LIB_EVP, 0, EVP_R_UNABLE_TO_ENABLE_PARENT_LOCKING), + {ERR_PACK(ERR_LIB_EVP, 0, EVP_R_UNABLE_TO_ENABLE_LOCKING), "unable to enable parent locking"}, {ERR_PACK(ERR_LIB_EVP, 0, EVP_R_UNABLE_TO_GET_MAXIMUM_REQUEST_SIZE), "unable to get maximum request size"}, |