Move OpenSSL calls out from the generic crypto layer and into the
OpenSSL specific layer. Also don't load all algortihms if SSL
isn't enabled.
Error strings will also not be loaded into memory if ENABLE_SMALL
is configured.
Signed-off-by: Igor Novgorodov <igor@novg.net>
Acked-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: David Sommerseth <davids@redhat.com>
Signed-off-by: David Sommerseth <davids@redhat.com>
void
init_ssl_lib (void)
{
- ERR_load_crypto_strings ();
- OpenSSL_add_all_algorithms ();
crypto_init_lib ();
}
{
crypto_uninit_lib ();
prng_uninit();
- EVP_cleanup ();
- ERR_free_strings ();
}
#endif /* ENABLE_SSL */
void
crypto_init_lib (void)
{
+#ifndef USE_SSL
+#ifndef ENABLE_SMALL
+ ERR_load_crypto_strings ();
+#endif
+ OpenSSL_add_all_algorithms ();
+#endif
+
/*
* If you build the OpenSSL library and OpenVPN with
* CRYPTO_MDEBUG, you will get a listing of OpenSSL
* memory leaks on program termination.
*/
+
#ifdef CRYPTO_MDEBUG
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
#endif
void
crypto_uninit_lib (void)
{
+#ifndef USE_SSL
+ EVP_cleanup ();
+#ifndef ENABLE_SMALL
+ ERR_free_strings ();
+#endif
+#endif
+
#ifdef CRYPTO_MDEBUG
FILE* fp = fopen ("sdlog", "w");
ASSERT (fp);
tls_init_lib()
{
SSL_library_init();
+#ifndef ENABLE_SMALL
SSL_load_error_strings();
+#endif
OpenSSL_add_all_algorithms ();
mydata_index = SSL_get_ex_new_index(0, "struct session *", NULL, NULL, NULL);
tls_free_lib()
{
EVP_cleanup();
+#ifndef ENABLE_SMALL
ERR_free_strings();
+#endif
}
void