diff options
author | Matt Caswell <matt@openssl.org> | 2018-11-20 15:32:55 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2019-01-04 13:19:39 +0000 |
commit | 660a1e0434eb5eb8548bea3ad35f3821d49c5c15 (patch) | |
tree | 5af256362cdd09642c877726e33fb1574a5f6c4f /ssl | |
parent | df5228e3b294fc546d0f8ea46e40ac111db58650 (diff) |
Fix a RUN_ONCE bug
We have a number of instances where there are multiple "init" functions for
a single CRYPTO_ONCE variable, e.g. to load config automatically or to not
load config automatically. Unfortunately the RUN_ONCE mechanism was not
correctly giving the right return value where an alternative init function
was being used.
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7647)
Diffstat (limited to 'ssl')
-rw-r--r-- | ssl/ssl_init.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ssl/ssl_init.c b/ssl/ssl_init.c index 86e6a8d52b..4ea12fd0a9 100644 --- a/ssl/ssl_init.c +++ b/ssl/ssl_init.c @@ -134,7 +134,8 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_load_ssl_strings) return 1; } -DEFINE_RUN_ONCE_STATIC(ossl_init_no_load_ssl_strings) +DEFINE_RUN_ONCE_STATIC_ALT(ossl_init_no_load_ssl_strings, + ossl_init_load_ssl_strings) { /* Do nothing in this case */ return 1; @@ -208,7 +209,8 @@ int OPENSSL_init_ssl(uint64_t opts, const OPENSSL_INIT_SETTINGS * settings) return 0; if ((opts & OPENSSL_INIT_NO_LOAD_SSL_STRINGS) - && !RUN_ONCE(&ssl_strings, ossl_init_no_load_ssl_strings)) + && !RUN_ONCE_ALT(&ssl_strings, ossl_init_no_load_ssl_strings, + ossl_init_load_ssl_strings)) return 0; if ((opts & OPENSSL_INIT_LOAD_SSL_STRINGS) |