aboutsummaryrefslogtreecommitdiff
path: root/lib/ssluse.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2001-05-30 08:00:29 +0000
committerDaniel Stenberg <daniel@haxx.se>2001-05-30 08:00:29 +0000
commitb541537c66d19660635703b18bc344789121a409 (patch)
tree9e446f35042ad65e6dc3952006f466d0ecaf867e /lib/ssluse.c
parent285e998faec7094d0093071c5262281fda5e04f4 (diff)
curl_global_init() support for CURL_GLOBAL_NOT_SSL
Diffstat (limited to 'lib/ssluse.c')
-rw-r--r--lib/ssluse.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/lib/ssluse.c b/lib/ssluse.c
index 3707a4965..0d50c07f4 100644
--- a/lib/ssluse.c
+++ b/lib/ssluse.c
@@ -235,17 +235,21 @@ int cert_verify_callback(int ok, X509_STORE_CTX *ctx)
#endif
+#ifdef USE_SSLEAY
+/* "global" init done? */
+static int init_ssl=0;
+#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)
+ if(0 != init_ssl)
return;
- only_once++; /* never again */
+ init_ssl++; /* never again */
/* Lets get nice error messages */
SSL_load_error_strings();
@@ -259,12 +263,16 @@ void Curl_SSL_init(void)
void Curl_SSL_cleanup(void)
{
#ifdef USE_SSLEAY
- /* Free the SSL error strings */
- ERR_free_strings();
+ if(init_ssl) {
+ /* only cleanup if we did a previous init */
+
+ /* Free the SSL error strings */
+ ERR_free_strings();
- /* EVP_cleanup() removes all ciphers and digests from the
- table. */
- EVP_cleanup();
+ /* EVP_cleanup() removes all ciphers and digests from the
+ table. */
+ EVP_cleanup();
+ }
#endif
}