From d300cf4d84182b111f6b364a89a9af00eca7f425 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 28 May 2001 14:12:43 +0000 Subject: T. Bharath's comments about SSL cleanup incorporated, and the two new curl_global_* functions --- lib/ssluse.c | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) (limited to 'lib/ssluse.c') diff --git a/lib/ssluse.c b/lib/ssluse.c index e8e3a4cf5..3707a4965 100644 --- a/lib/ssluse.c +++ b/lib/ssluse.c @@ -235,6 +235,40 @@ int cert_verify_callback(int ok, X509_STORE_CTX *ctx) #endif +/* Global init */ +void Curl_SSL_init(void) +{ +#ifdef USE_SSLEAY + static int only_once=0; + + /* make sure this is only done once */ + if(0 != only_once) + return; + + only_once++; /* never again */ + + /* Lets get nice error messages */ + SSL_load_error_strings(); + + /* Setup all the global SSL stuff */ + SSLeay_add_ssl_algorithms(); +#endif +} + +/* Global cleanup */ +void Curl_SSL_cleanup(void) +{ +#ifdef USE_SSLEAY + /* Free the SSL error strings */ + ERR_free_strings(); + + /* EVP_cleanup() removes all ciphers and digests from the + table. */ + EVP_cleanup(); +#endif +} + + /* ====================================================== */ CURLcode Curl_SSLConnect(struct connectdata *conn) @@ -250,15 +284,9 @@ Curl_SSLConnect(struct connectdata *conn) /* mark this is being ssl enabled from here on out. */ conn->ssl.use = TRUE; - /* Lets get nice error messages */ - SSL_load_error_strings(); - /* Make funny stuff to get random input */ random_the_seed(conn); - /* Setup all the global SSL stuff */ - SSLeay_add_ssl_algorithms(); - switch(data->ssl.version) { default: req_method = SSLv23_client_method(); -- cgit v1.2.3