#include <internal/cryptlib_int.h>
#include <openssl/err.h>
+#include <openssl/rand.h>
#include <openssl/evp.h>
#include <internal/evp_int.h>
#include <internal/conf.h>
#include <internal/async.h>
+#ifndef OPENSSL_NO_ENGINE
#include <internal/engine.h>
+#endif
#include <openssl/comp.h>
#include <internal/err.h>
#include <stdlib.h>
#endif
+typedef struct ossl_init_stop_st OPENSSL_INIT_STOP;
struct ossl_init_stop_st {
void (*handler)(void);
OPENSSL_INIT_STOP *next;
fprintf(stderr, "OPENSSL_INIT: ossl_init_base: Setting up stop handlers\n");
#endif
ossl_init_setup_thread_stop();
+#ifndef OPENSSL_SYS_UEFI
atexit(OPENSSL_cleanup);
+#endif
OPENSSL_cpuid_setup();
base_inited = 1;
}
config_inited = 1;
}
+#ifndef OPENSSL_NO_ASYNC
static OPENSSL_INIT_ONCE async = OPENSSL_INIT_ONCE_STATIC_INIT;
static int async_inited = 0;
static void ossl_init_async(void)
async_init();
async_inited = 1;
}
+#endif
#ifndef OPENSSL_NO_ENGINE
static int engine_inited = 0;
if (locals == NULL)
return;
+#ifndef OPENSSL_NO_ASYNC
if (locals->async) {
#ifdef OPENSSL_INIT_DEBUG
fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_stop: "
#endif
ASYNC_cleanup_thread();
}
+#endif
if (locals->err_state) {
#ifdef OPENSSL_INIT_DEBUG
}
OPENSSL_free(locals);
- ossl_init_thread_stop_cleanup();
}
void OPENSSL_thread_stop(void)
ERR_free_strings();
}
+ ossl_init_thread_stop_cleanup();
+
#ifdef OPENSSL_INIT_DEBUG
fprintf(stderr, "OPENSSL_INIT: OPENSSL_INIT_library_stop: "
"CRYPTO_cleanup_all_ex_data()\n");
base_inited = 0;
}
-static const OPENSSL_INIT_SETTINGS *ossl_init_get_setting(
- const OPENSSL_INIT_SETTINGS *settings, int name)
-{
- if (settings == NULL)
- return NULL;
-
- while (settings->name != OPENSSL_INIT_SET_END) {
- if (settings->name == name)
- return settings;
- settings++;
- }
-
- return NULL;
-}
-
/*
* If this function is called with a non NULL settings value then it must be
* called prior to any threads making calls to any OpenSSL functions,
if (opts & OPENSSL_INIT_LOAD_CONFIG) {
CRYPTO_w_lock(CRYPTO_LOCK_INIT);
- if (settings != NULL) {
- const OPENSSL_INIT_SETTINGS *curr;
- curr = ossl_init_get_setting(settings,
- OPENSSL_INIT_SET_CONF_FILENAME);
- config_filename = (curr == NULL) ? NULL : curr->value.type_string;
- } else {
- config_filename = NULL;
- }
+ config_filename = (settings == NULL) ? NULL : settings->config_name;
ossl_init_once_run(&config, ossl_init_config);
CRYPTO_w_unlock(CRYPTO_LOCK_INIT);
}
+#ifndef OPENSSL_NO_ASYNC
if (opts & OPENSSL_INIT_ASYNC) {
ossl_init_once_run(&async, ossl_init_async);
}
-
+#endif
#ifndef OPENSSL_NO_ENGINE
if (opts & OPENSSL_INIT_ENGINE_OPENSSL) {
ossl_init_once_run(&engine_openssl, ossl_init_engine_openssl);