@@ -62834,11 +62834,13 @@ static const sp_digit p256_order[8] = {
6283462834 0x00000000,0xffffffff
6283562835};
6283662836#endif
62837+ #ifndef WC_NO_RNG
6283762838/* The order of the curve P256 minus 2. */
6283862839static const sp_digit p256_order2[8] = {
6283962840 0xfc63254f,0xf3b9cac2,0xa7179e84,0xbce6faad,0xffffffff,0xffffffff,
6284062841 0x00000000,0xffffffff
6284162842};
62843+ #endif
6284262844#if defined(HAVE_ECC_SIGN) || defined(HAVE_ECC_VERIFY)
6284362845/* The Montgomery normalizer for order of the curve P256. */
6284462846static const sp_digit p256_norm_order[8] = {
@@ -62876,7 +62878,8 @@ static const sp_point_256 p256_base = {
6287662878 /* infinity */
6287762879 0
6287862880};
62879- #if defined(HAVE_ECC_CHECK_KEY) || defined(HAVE_COMP_KEY)
62881+ #if defined(HAVE_ECC_CHECK_KEY) || !defined(NO_ECC_CHECK_PUBKEY_ORDER) || \
62882+ defined(HAVE_COMP_KEY)
6288062883static const sp_digit p256_b[8] = {
6288162884 0x27d2604b,0x3bce3c3e,0xcc53b0f6,0x651d06b0,0x769886bc,0xb3ebbd55,
6288262885 0xaa3a93e7,0x5ac635d8
@@ -78249,6 +78252,7 @@ int sp_ecc_mulmod_base_add_256(const mp_int* km, const ecc_point* am,
7824978252#if defined(WOLFSSL_VALIDATE_ECC_KEYGEN) || defined(HAVE_ECC_SIGN) || \
7825078253 defined(HAVE_ECC_VERIFY)
7825178254#endif /* WOLFSSL_VALIDATE_ECC_KEYGEN | HAVE_ECC_SIGN | HAVE_ECC_VERIFY */
78255+ #ifndef WC_NO_RNG
7825278256/* Add 1 to a. (a = a + 1)
7825378257 *
7825478258 * a A single precision integer.
@@ -78287,6 +78291,7 @@ static void sp_256_add_one_8(sp_digit* a)
7828778291 );
7828878292}
7828978293
78294+ #endif
7829078295/* Read big endian unsigned byte array into r.
7829178296 *
7829278297 * r A single precision integer.
@@ -81217,7 +81222,7 @@ int sp_ecc_verify_256_nb(sp_ecc_ctx_t* sp_ctx, const byte* hash,
8121781222#endif /* WOLFSSL_SP_NONBLOCK */
8121881223#endif /* HAVE_ECC_VERIFY */
8121981224
81220- #ifdef HAVE_ECC_CHECK_KEY
81225+ #if defined( HAVE_ECC_CHECK_KEY) || !defined(NO_ECC_CHECK_PUBKEY_ORDER)
8122181226/* Check that the x and y ordinates are a valid point on the curve.
8122281227 *
8122381228 * point EC point.
@@ -81786,7 +81791,7 @@ static const sp_digit p384_norm_mod[12] = {
8178681791 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000
8178781792};
8178881793/* The Montgomery multiplier for modulus of the curve P384. */
81789- static sp_digit p384_mp_mod = 0x00000001;
81794+ static const sp_digit p384_mp_mod = 0x00000001;
8179081795#if defined(WOLFSSL_VALIDATE_ECC_KEYGEN) || defined(HAVE_ECC_SIGN) || \
8179181796 defined(HAVE_ECC_VERIFY)
8179281797/* The order of the curve P384. */
@@ -81795,11 +81800,13 @@ static const sp_digit p384_order[12] = {
8179581800 0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff
8179681801};
8179781802#endif
81803+ #ifndef WC_NO_RNG
8179881804/* The order of the curve P384 minus 2. */
8179981805static const sp_digit p384_order2[12] = {
8180081806 0xccc52971,0xecec196a,0x48b0a77a,0x581a0db2,0xf4372ddf,0xc7634d81,
8180181807 0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff
8180281808};
81809+ #endif
8180381810#if defined(HAVE_ECC_SIGN) || defined(HAVE_ECC_VERIFY)
8180481811/* The Montgomery normalizer for order of the curve P384. */
8180581812static const sp_digit p384_norm_order[12] = {
@@ -81809,7 +81816,7 @@ static const sp_digit p384_norm_order[12] = {
8180981816#endif
8181081817#if defined(HAVE_ECC_SIGN) || defined(HAVE_ECC_VERIFY)
8181181818/* The Montgomery multiplier for order of the curve P384. */
81812- static sp_digit p384_mp_order = 0xe88fdc45;
81819+ static const sp_digit p384_mp_order = 0xe88fdc45;
8181381820#endif
8181481821/* The base point of curve P384. */
8181581822static const sp_point_384 p384_base = {
@@ -81840,7 +81847,8 @@ static const sp_point_384 p384_base = {
8184081847 /* infinity */
8184181848 0
8184281849};
81843- #if defined(HAVE_ECC_CHECK_KEY) || defined(HAVE_COMP_KEY)
81850+ #if defined(HAVE_ECC_CHECK_KEY) || !defined(NO_ECC_CHECK_PUBKEY_ORDER) || \
81851+ defined(HAVE_COMP_KEY)
8184481852static const sp_digit p384_b[12] = {
8184581853 0xd3ec2aef,0x2a85c8ed,0x8a2ed19d,0xc656398d,0x5013875a,0x0314088f,
8184681854 0xfe814112,0x181d9c6e,0xe3f82d19,0x988e056b,0xe23ee7e4,0xb3312fa7
@@ -96412,6 +96420,7 @@ int sp_ecc_mulmod_base_add_384(const mp_int* km, const ecc_point* am,
9641296420#if defined(WOLFSSL_VALIDATE_ECC_KEYGEN) || defined(HAVE_ECC_SIGN) || \
9641396421 defined(HAVE_ECC_VERIFY)
9641496422#endif /* WOLFSSL_VALIDATE_ECC_KEYGEN | HAVE_ECC_SIGN | HAVE_ECC_VERIFY */
96423+ #ifndef WC_NO_RNG
9641596424/* Add 1 to a. (a = a + 1)
9641696425 *
9641796426 * a A single precision integer.
@@ -96456,6 +96465,7 @@ static void sp_384_add_one_12(sp_digit* a)
9645696465 );
9645796466}
9645896467
96468+ #endif
9645996469/* Read big endian unsigned byte array into r.
9646096470 *
9646196471 * r A single precision integer.
@@ -99619,7 +99629,7 @@ int sp_ecc_verify_384_nb(sp_ecc_ctx_t* sp_ctx, const byte* hash,
9961999629#endif /* WOLFSSL_SP_NONBLOCK */
9962099630#endif /* HAVE_ECC_VERIFY */
9962199631
99622- #ifdef HAVE_ECC_CHECK_KEY
99632+ #if defined( HAVE_ECC_CHECK_KEY) || !defined(NO_ECC_CHECK_PUBKEY_ORDER)
9962399633/* Check that the x and y ordinates are a valid point on the curve.
9962499634 *
9962599635 * point EC point.
@@ -100220,7 +100230,7 @@ static const sp_digit p521_norm_mod[17] = {
100220100230 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000
100221100231};
100222100232/* The Montgomery multiplier for modulus of the curve P521. */
100223- static sp_digit p521_mp_mod = 0x00000001;
100233+ static const sp_digit p521_mp_mod = 0x00000001;
100224100234#if defined(WOLFSSL_VALIDATE_ECC_KEYGEN) || defined(HAVE_ECC_SIGN) || \
100225100235 defined(HAVE_ECC_VERIFY)
100226100236/* The order of the curve P521. */
@@ -100230,12 +100240,14 @@ static const sp_digit p521_order[17] = {
100230100240 0xffffffff,0xffffffff,0xffffffff,0xffffffff,0x000001ff
100231100241};
100232100242#endif
100243+ #ifndef WC_NO_RNG
100233100244/* The order of the curve P521 minus 2. */
100234100245static const sp_digit p521_order2[17] = {
100235100246 0x91386407,0xbb6fb71e,0x899c47ae,0x3bb5c9b8,0xf709a5d0,0x7fcc0148,
100236100247 0xbf2f966b,0x51868783,0xfffffffa,0xffffffff,0xffffffff,0xffffffff,
100237100248 0xffffffff,0xffffffff,0xffffffff,0xffffffff,0x000001ff
100238100249};
100250+ #endif
100239100251#if defined(HAVE_ECC_SIGN) || defined(HAVE_ECC_VERIFY)
100240100252/* The Montgomery normalizer for order of the curve P521. */
100241100253static const sp_digit p521_norm_order[17] = {
@@ -100246,7 +100258,7 @@ static const sp_digit p521_norm_order[17] = {
100246100258#endif
100247100259#if defined(HAVE_ECC_SIGN) || defined(HAVE_ECC_VERIFY)
100248100260/* The Montgomery multiplier for order of the curve P521. */
100249- static sp_digit p521_mp_order = 0x79a995c7;
100261+ static const sp_digit p521_mp_order = 0x79a995c7;
100250100262#endif
100251100263/* The base point of curve P521. */
100252100264static const sp_point_521 p521_base = {
@@ -100283,7 +100295,8 @@ static const sp_point_521 p521_base = {
100283100295 /* infinity */
100284100296 0
100285100297};
100286- #if defined(HAVE_ECC_CHECK_KEY) || defined(HAVE_COMP_KEY)
100298+ #if defined(HAVE_ECC_CHECK_KEY) || !defined(NO_ECC_CHECK_PUBKEY_ORDER) || \
100299+ defined(HAVE_COMP_KEY)
100287100300static const sp_digit p521_b[17] = {
100288100301 0x6b503f00,0xef451fd4,0x3d2c34f1,0x3573df88,0x3bb1bf07,0x1652c0bd,
100289100302 0xec7e937b,0x56193951,0x8ef109e1,0xb8b48991,0x99b315f3,0xa2da725b,
@@ -124501,6 +124514,7 @@ int sp_ecc_mulmod_base_add_521(const mp_int* km, const ecc_point* am,
124501124514#if defined(WOLFSSL_VALIDATE_ECC_KEYGEN) || defined(HAVE_ECC_SIGN) || \
124502124515 defined(HAVE_ECC_VERIFY)
124503124516#endif /* WOLFSSL_VALIDATE_ECC_KEYGEN | HAVE_ECC_SIGN | HAVE_ECC_VERIFY */
124517+ #ifndef WC_NO_RNG
124504124518/* Add 1 to a. (a = a + 1)
124505124519 *
124506124520 * a A single precision integer.
@@ -124554,6 +124568,7 @@ static void sp_521_add_one_17(sp_digit* a)
124554124568 );
124555124569}
124556124570
124571+ #endif
124557124572/* Read big endian unsigned byte array into r.
124558124573 *
124559124574 * r A single precision integer.
@@ -128921,7 +128936,7 @@ int sp_ecc_verify_521_nb(sp_ecc_ctx_t* sp_ctx, const byte* hash,
128921128936#endif /* WOLFSSL_SP_NONBLOCK */
128922128937#endif /* HAVE_ECC_VERIFY */
128923128938
128924- #ifdef HAVE_ECC_CHECK_KEY
128939+ #if defined( HAVE_ECC_CHECK_KEY) || !defined(NO_ECC_CHECK_PUBKEY_ORDER)
128925128940/* Check that the x and y ordinates are a valid point on the curve.
128926128941 *
128927128942 * point EC point.
@@ -159628,7 +159643,7 @@ int sp_Pairing_precomp_1024(const ecc_point* pm, const ecc_point* qm,
159628159643}
159629159644
159630159645#endif /* WOLFSSL_SP_SMALL */
159631- #ifdef HAVE_ECC_CHECK_KEY
159646+ #if defined( HAVE_ECC_CHECK_KEY) || !defined(NO_ECC_CHECK_PUBKEY_ORDER)
159632159647/* Read big endian unsigned byte array into r.
159633159648 *
159634159649 * r A single precision integer.
0 commit comments