aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKamil Dudka <kdudka@redhat.com>2015-02-24 15:18:45 +0100
committerKamil Dudka <kdudka@redhat.com>2015-02-25 10:23:07 +0100
commit4909f7c795a4490dbb29e89b8b1564af86ee5999 (patch)
tree242e05ebbca4e9dd623ed90bc179b27fcfd1d8dd /lib
parent7a1538d9cc0736e0a9ab13cf115db40a0bfbb152 (diff)
nss: do not skip Curl_nss_seed() if data is NULL
In that case, we only skip writing the error message for failed NSS initialization (while still returning the correct error code).
Diffstat (limited to 'lib')
-rw-r--r--lib/vtls/nss.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/vtls/nss.c b/lib/vtls/nss.c
index 1dd56badb..e201decce 100644
--- a/lib/vtls/nss.c
+++ b/lib/vtls/nss.c
@@ -1034,6 +1034,7 @@ static PRStatus nspr_io_close(PRFileDesc *fd)
return close_fn(fd);
}
+/* data might be NULL */
static CURLcode nss_init_core(struct SessionHandle *data, const char *cert_dir)
{
NSSInitParameters initparams;
@@ -1071,6 +1072,7 @@ static CURLcode nss_init_core(struct SessionHandle *data, const char *cert_dir)
return CURLE_SSL_CACERT_BADFILE;
}
+/* data might be NULL */
static CURLcode nss_init(struct SessionHandle *data)
{
char *cert_dir;
@@ -1149,12 +1151,14 @@ int Curl_nss_init(void)
return 1;
}
+/* data might be NULL */
CURLcode Curl_nss_force_init(struct SessionHandle *data)
{
CURLcode result;
if(!nss_initlock) {
- failf(data, "unable to initialize NSS, curl_global_init() should have "
- "been called with CURL_GLOBAL_SSL or CURL_GLOBAL_ALL");
+ if(data)
+ failf(data, "unable to initialize NSS, curl_global_init() should have "
+ "been called with CURL_GLOBAL_SSL or CURL_GLOBAL_ALL");
return CURLE_FAILED_INIT;
}
@@ -1904,6 +1908,7 @@ size_t Curl_nss_version(char *buffer, size_t size)
return snprintf(buffer, size, "NSS/%s", NSS_VERSION);
}
+/* data might be NULL */
int Curl_nss_seed(struct SessionHandle *data)
{
/* make sure that NSS is initialized */
@@ -1915,8 +1920,7 @@ int Curl_nss_random(struct SessionHandle *data,
unsigned char *entropy,
size_t length)
{
- if(data)
- Curl_nss_seed(data); /* Initiate the seed if not already done */
+ Curl_nss_seed(data); /* Initiate the seed if not already done */
if(SECSuccess != PK11_GenerateRandom(entropy, curlx_uztosi(length)))
/* signal a failure */