提交 bf24111b 编写于 作者: M Matt Caswell

Avoid a race condition in loading config settings

A race condition can occur when sending config settings to
OPENSSL_INIT_crypto_library_start()
Reviewed-by: NRichard Levitte <levitte@openssl.org>
上级 8b75603c
...@@ -679,13 +679,17 @@ void OPENSSL_INIT_crypto_library_start(uint64_t opts, ...@@ -679,13 +679,17 @@ void OPENSSL_INIT_crypto_library_start(uint64_t opts,
} }
if (opts & OPENSSL_INIT_LOAD_CONFIG) { if (opts & OPENSSL_INIT_LOAD_CONFIG) {
CRYPTO_w_lock(CRYPTO_LOCK_INIT);
if (settings != NULL) { if (settings != NULL) {
const OPENSSL_INIT_SETTINGS *curr; const OPENSSL_INIT_SETTINGS *curr;
curr = ossl_init_get_setting(settings, curr = ossl_init_get_setting(settings,
OPENSSL_INIT_SET_CONF_FILENAME); OPENSSL_INIT_SET_CONF_FILENAME);
config_filename = curr == NULL ? NULL : curr->value.type_string; config_filename = (curr == NULL) ? NULL : curr->value.type_string;
} else {
config_filename = NULL;
} }
ossl_init_once_run(&config, ossl_init_config); ossl_init_once_run(&config, ossl_init_config);
CRYPTO_w_unlock(CRYPTO_LOCK_INIT);
} }
if (opts & OPENSSL_INIT_ASYNC) { if (opts & OPENSSL_INIT_ASYNC) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册