vere: properly un/initialize openssl

This commit is contained in:
Joe Bryan 2019-12-11 14:32:14 -08:00
parent c945c58375
commit d71c26417a
2 changed files with 24 additions and 7 deletions

View File

@ -13,6 +13,9 @@
#include <termios.h>
#include <ncurses/term.h>
#include <dirent.h>
#include <openssl/conf.h>
#include <openssl/engine.h>
#include <openssl/err.h>
#include <openssl/ssl.h>
#include <h2o.h>
#include <curl/curl.h>
@ -744,12 +747,27 @@ main(c3_i argc,
}
}
/* Initialize OpenSSL for client and server
*/
SSL_library_init();
SSL_load_error_strings();
// Initialize OpenSSL for client and server
//
{
SSL_library_init();
SSL_load_error_strings();
}
u3_daemon_commence();
// uninitialize OpenSSL
//
// see https://wiki.openssl.org/index.php/Library_Initialization
//
{
ENGINE_cleanup();
CONF_modules_unload(1);
EVP_cleanup();
CRYPTO_cleanup_all_ex_data();
SSL_COMP_free_compression_methods();
ERR_free_strings();
}
}
return 0;

View File

@ -928,8 +928,8 @@ u3_daemon_commence()
}
}
/* listen on command socket
*/
// listen on command socket
//
{
c3_c buf_c[256];
@ -948,7 +948,6 @@ u3_daemon_commence()
uv_run(u3L, UV_RUN_DEFAULT);
_daemon_loop_exit();
exit(0);
}
/* u3_daemon_bail(): immediately shutdown.