summaryrefslogtreecommitdiffstats
path: root/crypto/init.c
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2021-02-18 15:31:56 -0500
committerPauli <ppzgs1@gmail.com>2021-03-14 15:33:34 +1000
commitcd3f8c1b11b0b9f4163bc8c62cbae38aec1b4030 (patch)
treede59d50b2ff9b2bd73a1ebf08eedf78d8ba44aa3 /crypto/init.c
parentf62846b703d163265176fe960ec7d087b4c3fa96 (diff)
Always check CRYPTO_LOCK_{read,write}_lock
Some functions that lock things are void, so we just return early. Also make ossl_namemap_empty return 0 on error. Updated the docs, and added some code to ossl_namemap_stored() to handle the failure, and updated the tests to allow for failure. Fixes: #14230 Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14238)
Diffstat (limited to 'crypto/init.c')
-rw-r--r--crypto/init.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/init.c b/crypto/init.c
index 50aec32c3d..3b6a16a76d 100644
--- a/crypto/init.c
+++ b/crypto/init.c
@@ -586,7 +586,8 @@ int OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings)
if (settings == NULL) {
ret = RUN_ONCE(&config, ossl_init_config);
} else {
- CRYPTO_THREAD_write_lock(init_lock);
+ if (!CRYPTO_THREAD_write_lock(init_lock))
+ return 0;
conf_settings = settings;
ret = RUN_ONCE_ALT(&config, ossl_init_config_settings,
ossl_init_config);