aboutsummaryrefslogtreecommitdiff
path: root/lib/ssluse.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ssluse.c')
-rw-r--r--lib/ssluse.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/lib/ssluse.c b/lib/ssluse.c
index 5bdc536a3..d65fd98b9 100644
--- a/lib/ssluse.c
+++ b/lib/ssluse.c
@@ -32,9 +32,6 @@
#include "setup.h"
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
@@ -123,7 +120,7 @@
/* 0.9.6 didn't have X509_STORE_set_flags() */
#define HAVE_X509_STORE_SET_FLAGS 1
#else
-#define X509_STORE_set_flags(x,y)
+#define X509_STORE_set_flags(x,y) Curl_nop_stmt
#endif
/*
@@ -169,14 +166,14 @@ static int passwd_callback(char *buf, int num, int verify
#define seed_enough(x) rand_enough()
static bool rand_enough(void)
{
- return (bool)(0 != RAND_status());
+ return (0 != RAND_status()) ? TRUE : FALSE;
}
#else
#define seed_enough(x) rand_enough(x)
static bool rand_enough(int nread)
{
/* this is a very silly decision to make */
- return (bool)(nread > 500);
+ return (nread > 500) ? TRUE : FALSE;
}
#endif
@@ -813,18 +810,16 @@ struct curl_slist *Curl_ossl_engines_list(struct SessionHandle *data)
{
struct curl_slist *list = NULL;
#if defined(USE_SSLEAY) && defined(HAVE_OPENSSL_ENGINE_H)
- struct curl_slist *beg = NULL;
+ struct curl_slist *beg;
ENGINE *e;
for(e = ENGINE_get_first(); e; e = ENGINE_get_next(e)) {
- list = curl_slist_append(list, ENGINE_get_id(e));
- if(list == NULL) {
- curl_slist_free_all(beg);
+ beg = curl_slist_append(list, ENGINE_get_id(e));
+ if(!beg) {
+ curl_slist_free_all(list);
return NULL;
}
- else if(beg == NULL) {
- beg = list;
- }
+ list = beg;
}
#endif
(void) data;
@@ -1410,7 +1405,7 @@ static void ssl_tls_trace(int direction, int ssl_ver, int content_type,
#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
# define use_sni(x) sni = (x)
#else
-# define use_sni(x) do { } while (0)
+# define use_sni(x) Curl_nop_stmt
#endif
static CURLcode
@@ -1492,6 +1487,10 @@ ossl_connect_step1(struct connectdata *conn,
return CURLE_OUT_OF_MEMORY;
}
+#ifdef SSL_MODE_RELEASE_BUFFERS
+ SSL_CTX_set_mode(connssl->ctx, SSL_MODE_RELEASE_BUFFERS);
+#endif
+
#ifdef SSL_CTRL_SET_MSG_CALLBACK
if(data->set.fdebug && data->set.verbose) {
/* the SSL trace callback is only used for verbose logging so we only
@@ -1856,15 +1855,15 @@ static CURLcode push_certinfo_len(struct SessionHandle *data,
equivalent of curl_slist_append but doesn't strdup() the given data as
like in this place the extra malloc/free is totally pointless */
nl = curl_slist_append(ci->certinfo[certnum], output);
+ free(output);
if(!nl) {
curl_slist_free_all(ci->certinfo[certnum]);
+ ci->certinfo[certnum] = NULL;
res = CURLE_OUT_OF_MEMORY;
}
else
ci->certinfo[certnum] = nl;
- free(output);
-
return res;
}
@@ -1918,7 +1917,7 @@ do { \
pubkey_show(data, _num, #_type, #_name, (unsigned char*)bufp, len); \
} \
} \
-} while(0)
+} WHILE_FALSE
static int X509V3_ext(struct SessionHandle *data,
int certnum,
@@ -2563,7 +2562,7 @@ bool Curl_ossl_data_pending(const struct connectdata *conn,
{
if(conn->ssl[connindex].handle)
/* SSL is in use */
- return (bool)(0 != SSL_pending(conn->ssl[connindex].handle));
+ return (0 != SSL_pending(conn->ssl[connindex].handle)) ? TRUE : FALSE;
else
return FALSE;
}