Write down the expressions for all the NIST primes. I find myself needing to look them up frequently and this is easier than digging through https://www.secg.org/SEC2-Ver-1.0.pdf each time. Change-Id: I4aa7cdf2c8f114a0f2ba8b9bd7ee394d3201d731 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/40984 Reviewed-by: Steven Valdez <svaldez@google.com> Commit-Queue: David Benjamin <davidben@google.com>
diff --git a/crypto/fipsmodule/ec/ec.c b/crypto/fipsmodule/ec/ec.c index 3a7d4d5..186a2fe 100644 --- a/crypto/fipsmodule/ec/ec.c +++ b/crypto/fipsmodule/ec/ec.c
@@ -84,7 +84,7 @@ static void ec_point_free(EC_POINT *point, int free_group); static const uint8_t kP224Params[6 * 28] = { - // p + // p = 2^224 - 2^96 + 1 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, @@ -111,7 +111,7 @@ }; static const uint8_t kP256Params[6 * 32] = { - // p + // p = 2^256 - 2^224 + 2^192 + 2^96 - 1 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, @@ -138,7 +138,7 @@ }; static const uint8_t kP384Params[6 * 48] = { - // p + // p = 2^384 - 2^128 - 2^96 + 2^32 - 1 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, @@ -171,7 +171,7 @@ }; static const uint8_t kP521Params[6 * 66] = { - // p + // p = 2^521 - 1 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,