43 lines
1.3 KiB
Diff
43 lines
1.3 KiB
Diff
|
From 204126a5f1218b7ba02c0abbd9703ee79d0d0776 Mon Sep 17 00:00:00 2001
|
||
|
From: Kamil Dudka <kdudka@redhat.com>
|
||
|
Date: Mon, 12 Aug 2013 15:14:35 +0200
|
||
|
Subject: [PATCH] nss: make sure that NSS is initialized
|
||
|
|
||
|
... prior to calling PK11_GenerateRandom()
|
||
|
---
|
||
|
lib/nss.c | 11 +++++++----
|
||
|
1 files changed, 7 insertions(+), 4 deletions(-)
|
||
|
|
||
|
diff --git a/lib/nss.c b/lib/nss.c
|
||
|
index cc3d9c9..2d4bf9e 100644
|
||
|
--- a/lib/nss.c
|
||
|
+++ b/lib/nss.c
|
||
|
@@ -1543,9 +1543,8 @@ size_t Curl_nss_version(char *buffer, size_t size)
|
||
|
|
||
|
int Curl_nss_seed(struct SessionHandle *data)
|
||
|
{
|
||
|
- /* TODO: implement? */
|
||
|
- (void) data;
|
||
|
- return 0;
|
||
|
+ /* make sure that NSS is initialized */
|
||
|
+ return !!Curl_nss_force_init(data);
|
||
|
}
|
||
|
|
||
|
void Curl_nss_random(struct SessionHandle *data,
|
||
|
@@ -1553,7 +1552,11 @@ void Curl_nss_random(struct SessionHandle *data,
|
||
|
size_t length)
|
||
|
{
|
||
|
Curl_nss_seed(data); /* Initiate the seed if not already done */
|
||
|
- PK11_GenerateRandom(entropy, curlx_uztosi(length));
|
||
|
+ if(SECSuccess != PK11_GenerateRandom(entropy, curlx_uztosi(length))) {
|
||
|
+ /* no way to signal a failure from here, we have to abort */
|
||
|
+ failf(data, "PK11_GenerateRandom() failed, calling abort()...");
|
||
|
+ abort();
|
||
|
+ }
|
||
|
}
|
||
|
|
||
|
void Curl_nss_md5sum(unsigned char *tmp, /* input */
|
||
|
--
|
||
|
1.7.1
|
||
|
|