From f017b749ea9f1586d2308504553d40bf4cc5439d Mon Sep 17 00:00:00 2001
From: wolfbeast <mcwerewolf@gmail.com>
Date: Tue, 6 Feb 2018 11:46:26 +0100
Subject: Update NSS to 3.32.1-RTM

---
 security/nss/cmd/fbectest/fbectest.c | 27 ++++++++++-----------------
 1 file changed, 10 insertions(+), 17 deletions(-)

(limited to 'security/nss/cmd/fbectest')

diff --git a/security/nss/cmd/fbectest/fbectest.c b/security/nss/cmd/fbectest/fbectest.c
index 2336d3fa8..1c8f4c039 100644
--- a/security/nss/cmd/fbectest/fbectest.c
+++ b/security/nss/cmd/fbectest/fbectest.c
@@ -9,7 +9,6 @@
 #include "basicutil.h"
 #include "secder.h"
 #include "secitem.h"
-#include "secutil.h"
 #include "nspr.h"
 #include <stdio.h>
 
@@ -89,26 +88,19 @@ ectest_ecdh_kat(ECDH_KAT *kat)
     SECItem answer = { siBuffer, NULL, 0 };
     SECItem answer2 = { siBuffer, NULL, 0 };
     SECItem derived = { siBuffer, NULL, 0 };
-    char genenc[3 + 2 * 2 * MAX_ECKEY_LEN];
+    SECItem ecEncodedParams = { siBuffer, NULL, 0 };
     int i;
 
-    rv = init_params(&ecParams, curve, &arena, kat->fieldType);
-    if (rv != SECSuccess) {
-        return rv;
+    arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
+    if (!arena) {
+        return SECFailure;
     }
 
-    SECU_HexString2SECItem(arena, &ecParams.fieldID.u.prime, ecCurve_map[curve]->irr);
-    SECU_HexString2SECItem(arena, &ecParams.curve.a, ecCurve_map[curve]->curvea);
-    SECU_HexString2SECItem(arena, &ecParams.curve.b, ecCurve_map[curve]->curveb);
-    genenc[0] = '0';
-    genenc[1] = '4';
-    genenc[2] = '\0';
-    PORT_Assert(PR_ARRAY_SIZE(genenc) >= PORT_Strlen(ecCurve_map[curve]->genx));
-    PORT_Assert(PR_ARRAY_SIZE(genenc) >= PORT_Strlen(ecCurve_map[curve]->geny));
-    strcat(genenc, ecCurve_map[curve]->genx);
-    strcat(genenc, ecCurve_map[curve]->geny);
-    SECU_HexString2SECItem(arena, &ecParams.base, genenc);
-    SECU_HexString2SECItem(arena, &ecParams.order, ecCurve_map[curve]->order);
+    rv = SECU_ecName2params(curve, &ecEncodedParams);
+    if (rv != SECSuccess) {
+        goto cleanup;
+    }
+    EC_FillParams(arena, &ecEncodedParams, &ecParams);
 
     if (kat->our_pubhex) {
         SECU_HexString2SECItem(arena, &answer, kat->our_pubhex);
@@ -162,6 +154,7 @@ ectest_ecdh_kat(ECDH_KAT *kat)
     }
 
 cleanup:
+    SECITEM_FreeItem(&ecEncodedParams, PR_FALSE);
     PORT_FreeArena(arena, PR_FALSE);
     if (ecPriv) {
         PORT_FreeArena(ecPriv->ecParams.arena, PR_FALSE);
-- 
cgit v1.2.3