diff options
author | Matt Caswell <matt@openssl.org> | 2018-11-20 15:32:55 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2019-01-04 20:23:16 +0000 |
commit | f725fe5b4b6504df08e30f5194d321c3025e2336 (patch) | |
tree | 269f79d1ce29c277b5877a36c70cbaba62fc7bf7 /ssl | |
parent | d6399c85b62e8300ae19cdc243d0b6a2696724bb (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/7983)
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 c0ccb9304a..96526472c5 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; @@ -207,7 +208,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) |