diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-02-06 11:46:26 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-02-06 11:46:26 +0100 |
commit | f017b749ea9f1586d2308504553d40bf4cc5439d (patch) | |
tree | c6033924a0de9be1ab140596e305898c651bf57e /security/nss/cmd/fbectest/fbectest.c | |
parent | 7c728b3c7680662fc4e92b5d03697b8339560b08 (diff) | |
download | UXP-f017b749ea9f1586d2308504553d40bf4cc5439d.tar UXP-f017b749ea9f1586d2308504553d40bf4cc5439d.tar.gz UXP-f017b749ea9f1586d2308504553d40bf4cc5439d.tar.lz UXP-f017b749ea9f1586d2308504553d40bf4cc5439d.tar.xz UXP-f017b749ea9f1586d2308504553d40bf4cc5439d.zip |
Update NSS to 3.32.1-RTM
Diffstat (limited to 'security/nss/cmd/fbectest/fbectest.c')
-rw-r--r-- | security/nss/cmd/fbectest/fbectest.c | 27 |
1 files changed, 10 insertions, 17 deletions
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); |