#if OPENSSL_API_COMPAT < 0x10100000L
# define SSL_load_error_strings() \
OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS \
| OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL)
#endif
#if OPENSSL_API_COMPAT < 0x10100000L
# define ERR_load_crypto_strings() \
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL)
# define ERR_free_strings() while(0) continue
#endif
static CRYPTO_ONCE load_crypto_strings = CRYPTO_ONCE_STATIC_INIT;
if ((opts & OPENSSL_INIT_LOAD_CRYPTO_STRINGS)&& !RUN_ONCE(&load_crypto_strings,ossl_init_load_crypto_strings))
return 0;
#define RUN_ONCE(once, init) \
(CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
(CRYPTO_THREAD_run_once(&CRYPTO_ONCE_STATIC_INIT,ossl_init_load_crypto_strings_ossl_)?ossl_init_load_crypto_strings_ossl_ret_:0)
#define DEFINE_RUN_ONCE_STATIC(init) \
static int init(void); \
static int init##_ossl_ret_ = 0; \
static void init##_ossl_(void) \
{ \
init##_ossl_ret_ = init(); \
} \
static int init(void)
DEFINE_RUN_ONCE_STATIC(ossl_init_load_crypto_strings)
{
int ret = 1;
#if !defined(OPENSSL_NO_ERR) && !defined(OPENSSL_NO_AUTOERRINIT)
# ifdef OPENSSL_INIT_DEBUG
fprintf(stderr, "OPENSSL_INIT: ossl_init_load_crypto_strings: "
"err_load_crypto_strings_int()\n");
# endif
ret = err_load_crypto_strings_int();
load_crypto_strings_inited = 1;
#endif
return ret;
}
DEFINE_RUN_ONCE_STATIC(ossl_init_load_crypto_strings)
static int ossl_init_load_crypto_strings(void);
static int ossl_init_load_crypto_strings_ossl_ret_ = 0;
static void ossl_init_load_crypto_strings_ossl_(void)
{
ossl_init_load_crypto_strings_ossl_ret_=ossl_init_load_crypto_strings();
}
static int ossl_init_load_crypto_strings(void)
if ((opts & OPENSSL_INIT_LOAD_CRYPTO_STRINGS)&& !CRYPTO_THREAD_run_once(&load_crypto_strings, ossl_init_load_crypto_strings))
return 0;
void err_load_crypto_strings_int(void)
{
#ifdef OPENSSL_FIPS
FIPS_set_error_callbacks(ERR_put_error, ERR_add_error_vdata);
#endif
#ifndef OPENSSL_NO_ERR
ERR_load_ERR_strings();
ERR_load_BN_strings();
# ifndef OPENSSL_NO_RSA
ERR_load_RSA_strings();
# endif
ERR_load_X509_strings();
}
void ERR_load_X509_strings(void)
{
#ifndef OPENSSL_NO_ERR
if (ERR_func_error_string(X509_str_functs[0].error) == NULL) {
ERR_load_strings(0, X509_str_functs);
ERR_load_strings(0, X509_str_reasons);
}
#endif
}
static ERR_STRING_DATA *int_err_get_item(const ERR_STRING_DATA *d)
{
ERR_STRING_DATA *p = NULL;
LHASH_OF(ERR_STRING_DATA) *hash;
CRYPTO_THREAD_read_lock(err_string_lock);
hash = get_hash(0, 0);
if (hash)
p = lh_ERR_STRING_DATA_retrieve(hash, d);
CRYPTO_THREAD_unlock(err_string_lock);
return p;
}
void ERR_load_ERR_strings(void)
{
#ifndef OPENSSL_NO_ERR
CRYPTO_THREAD_run_once(&err_string_init, do_err_strings_init);
err_load_strings(0, ERR_str_libraries);
err_load_strings(0, ERR_str_reasons);
err_load_strings(ERR_LIB_SYS, ERR_str_functs);
build_SYS_str_reasons();
err_load_strings(ERR_LIB_SYS, SYS_str_reasons);
#endif
}
static void do_err_strings_init(void)
{
err_string_lock = CRYPTO_THREAD_lock_new();
}