NSS¶
Primitives¶
ECDH, ECDSA (only standard curves P-256, P-384, P-521), also x25519.
- Two ECMethods:
- Curve25519
32-bit -> own impl
64-bit -> HACL*
P-256 from HACL*
- Several ECGroups:
generic
ECGroup_consGFpMontgomery arithmetic
ECGroup_consGFp_montP-256
P-384 from ECCkiila
P-521 from ECCkiila
- The ECMethods override the scalarmult of the ECGroups in:
ec_NewKeyviaec_get_method_from_nameand then calling themethod.mul.EC_ValidatePublicKeyviaec_get_method_from_nameand then calling themethod.validate.ECDH_Deriveviaec_get_method_from_nameand then calling themethod.mul.ECDSA_SignDigestandECDSA_SignDigestWithSeedviaec_SignDigestWithSeed, thenec_get_method_from_nameand then calling themethod.mul.
P-256 from HACL*¶
- KeyGen:
Short-Weierstrass
Fixed Window (width = 4)? points to https://eprint.iacr.org/2013/816.pdf? via
ec_secp256r1_pt_mul -> (Hacl*) Hacl_P256_dh_initiator -> point_mul_gprojective-3 coords.
add-2015-rcb, dbl-2015-rcb-3
- Derive:
Same as KeyGen.
- Sign:
Same as Keygen.
- Verify:
Short-Weierstrass
Multi-scalar simultaneous Fixed Window
Same coords and formulas as KeyGen.
P-384¶
- KeyGen:
Short-Weierstrass
Comb from ecckiila:
EC_NewKeyFromSeed -> ec_NewKey -> ec_points_mul -> ECPoints_mul -> ecgroup.points_mul -> point_mul_two_secp384r1_wrap -> point_mul_g_secp384r1_wrap -> point_mul_g_secp384r1 -> fixed_smul_cmb.projective-3 coords.
dbl-2015-rcb-3, madd-2015-rcb-3 also add-2015-rcb in point_add_proj.
- Derive:
Short-Weierstrass
Regular Window NAF (width = 5) from ecckiila:
ECDH_Derive -> ec_points_mul -> ECPoints_mul -> ecgroup.points_mul -> point_mul_secp384r1_wrap -> point_mul_secp384r1 -> var_smul_rwnaf.projective-3 coords.
dbl-2015-rcb-3, add-2015-rcb.
- Sign:
Same as KeyGen.
- Verify:
Short-Weierstrass
Interleaved multi-scalar window NAF (width = 5) with Shamir’s trick from ecckiila:
ECDSA_SignDigest -> ECDSA_SignDigestWithSeed -> ec_SignDigestWithSeed -> ec_points_mul -> ECPoints_mul -> ecgroup.points_mul -> point_mul_two_secp384r1_wrap -> point_mul_two_secp384r1 -> var_smul_wnaf_twoprojective-3 coords.
dbl-2015-rcb-3, madd-2015-rcb-3 also add-2015-rcb in point_add_proj.
P-521¶
Same as P-384.
x25519¶
- KeyGen:
Montgomery
Montgomery ladder via
-> ec_Curve25519_pt_mul -> ec_Curve25519_mul.xz coords
Unknown formulas: ladd-hacl-x25519, dbl-hacl-x25519
- Derive:
Same as KeyGen.