Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1440)

Unified Diff: mozilla/security/nss/lib/freebl/ecl/ecl.c

Issue 12042100: Add an optimized 32-bit implementation of the NIST P-256 elliptic curve. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/nss/
Patch Set: Don't use ecp_256.c Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mozilla/security/nss/lib/freebl/ecl/ecl.c
===================================================================
--- mozilla/security/nss/lib/freebl/ecl/ecl.c (revision 177437)
+++ mozilla/security/nss/lib/freebl/ecl/ecl.c (working copy)
@@ -215,8 +215,8 @@
/* determine which optimizations (if any) to use */
if (params->field == ECField_GFp) {
+ switch (name) {
#ifdef NSS_ECC_MORE_THAN_SUITE_B
- switch (name) {
#ifdef ECL_USE_FP
case ECCurve_SECG_PRIME_160R1:
group =
@@ -256,29 +256,32 @@
MP_CHECKOK(ec_group_set_gfp224(group, name));
#endif
break;
- case ECCurve_SECG_PRIME_256R1:
+ case ECCurve_SECG_PRIME_521R1:
group =
ECGroup_consGFp(&irr, &curvea, &curveb, &genx, &geny,
&order, params->cofactor);
if (group == NULL) { res = MP_UNDEF; goto CLEANUP; }
- MP_CHECKOK(ec_group_set_gfp256(group, name));
+ MP_CHECKOK(ec_group_set_gfp521(group, name));
break;
- case ECCurve_SECG_PRIME_521R1:
+#endif /* NSS_ECC_MORE_THAN_SUITE_B */
+ case ECCurve_SECG_PRIME_256R1:
group =
ECGroup_consGFp(&irr, &curvea, &curveb, &genx, &geny,
&order, params->cofactor);
if (group == NULL) { res = MP_UNDEF; goto CLEANUP; }
- MP_CHECKOK(ec_group_set_gfp521(group, name));
+#ifdef NSS_ECC_MORE_THAN_SUITE_B
+ MP_CHECKOK(ec_group_set_gfp256(group, name));
+#endif
+ MP_CHECKOK(ec_group_set_gfp256_32(group, name));
break;
default:
/* use generic arithmetic */
-#endif
group =
ECGroup_consGFp_mont(&irr, &curvea, &curveb, &genx, &geny,
&order, params->cofactor);
if (group == NULL) { res = MP_UNDEF; goto CLEANUP; }
+ }
#ifdef NSS_ECC_MORE_THAN_SUITE_B
- }
} else if (params->field == ECField_GF2m) {
group = ECGroup_consGF2m(&irr, NULL, &curvea, &curveb, &genx, &geny, &order, params->cofactor);
if (group == NULL) { res = MP_UNDEF; goto CLEANUP; }

Powered by Google App Engine
This is Rietveld 408576698