SP: fix when mont_mul_order is defined

Customer configuration that failed:
./configure --enable-cryptonly --enable-ecc --enable-sp=yes,asm
--disable-rsa --disable-dh --disable-sha3 --disable-sha224 --disable-md5
--disable-sha --disable-pkcs12 --disable-memory --disable-chacha
--disable-poly1305 --disable-sha512 --disable-sha384 --disable-aesgcm
--disable-aescbc --disable-aes --disable-rng CFLAGS="-DNO_SIG_WRAPPER
-DWOLFSSL_PUBLIC_MP -DECC_USER_CURVES -DNO_ECC_SIGN -DNO_ECC_DHE
-DNO_ECC_KEY_EXPORT"
This commit is contained in:
Sean Parkinson
2021-11-09 13:11:08 +10:00
parent dd833807d8
commit ff3179012d
8 changed files with 203 additions and 170 deletions

View File

@ -37440,6 +37440,19 @@ static WC_INLINE int sp_256_mod_8(sp_digit* r, const sp_digit* a, const sp_digit
#endif
#if defined(HAVE_ECC_SIGN) || defined(HAVE_ECC_VERIFY)
/* Multiply two number mod the order of P256 curve. (r = a * b mod order)
*
* r Result of the multiplication.
* a First operand of the multiplication.
* b Second operand of the multiplication.
*/
static void sp_256_mont_mul_order_8(sp_digit* r, const sp_digit* a, const sp_digit* b)
{
sp_256_mul_8(r, a, b);
sp_256_mont_reduce_order_8(r, p256_order, p256_mp_order);
}
#if defined(HAVE_ECC_SIGN) || (defined(HAVE_ECC_VERIFY) && defined(WOLFSSL_SP_SMALL))
#ifdef WOLFSSL_SP_SMALL
/* Order-2 for the P256 curve. */
static const uint32_t p256_order_minus_2[8] = {
@ -37453,18 +37466,6 @@ static const sp_int_digit p256_order_low[4] = {
};
#endif /* WOLFSSL_SP_SMALL */
/* Multiply two number mod the order of P256 curve. (r = a * b mod order)
*
* r Result of the multiplication.
* a First operand of the multiplication.
* b Second operand of the multiplication.
*/
static void sp_256_mont_mul_order_8(sp_digit* r, const sp_digit* a, const sp_digit* b)
{
sp_256_mul_8(r, a, b);
sp_256_mont_reduce_order_8(r, p256_order, p256_mp_order);
}
/* Square number mod the order of P256 curve. (r = a * a mod order)
*
* r Result of the squaring.
@ -37635,6 +37636,7 @@ static void sp_256_mont_inv_order_8(sp_digit* r, const sp_digit* a,
#endif /* WOLFSSL_SP_SMALL */
}
#endif /* HAVE_ECC_SIGN || (HAVE_ECC_VERIFY && WOLFSSL_SP_SMALL) */
#endif /* HAVE_ECC_SIGN | HAVE_ECC_VERIFY */
#ifdef HAVE_ECC_SIGN
#ifndef SP_ECC_MAX_SIG_GEN
@ -46706,6 +46708,19 @@ static WC_INLINE int sp_384_mod_12(sp_digit* r, const sp_digit* a, const sp_digi
#endif
#if defined(HAVE_ECC_SIGN) || defined(HAVE_ECC_VERIFY)
/* Multiply two number mod the order of P384 curve. (r = a * b mod order)
*
* r Result of the multiplication.
* a First operand of the multiplication.
* b Second operand of the multiplication.
*/
static void sp_384_mont_mul_order_12(sp_digit* r, const sp_digit* a, const sp_digit* b)
{
sp_384_mul_12(r, a, b);
sp_384_mont_reduce_order_12(r, p384_order, p384_mp_order);
}
#if defined(HAVE_ECC_SIGN) || (defined(HAVE_ECC_VERIFY) && defined(WOLFSSL_SP_SMALL))
#ifdef WOLFSSL_SP_SMALL
/* Order-2 for the P384 curve. */
static const uint32_t p384_order_minus_2[12] = {
@ -46719,18 +46734,6 @@ static const uint32_t p384_order_low[6] = {
};
#endif /* WOLFSSL_SP_SMALL */
/* Multiply two number mod the order of P384 curve. (r = a * b mod order)
*
* r Result of the multiplication.
* a First operand of the multiplication.
* b Second operand of the multiplication.
*/
static void sp_384_mont_mul_order_12(sp_digit* r, const sp_digit* a, const sp_digit* b)
{
sp_384_mul_12(r, a, b);
sp_384_mont_reduce_order_12(r, p384_order, p384_mp_order);
}
/* Square number mod the order of P384 curve. (r = a * a mod order)
*
* r Result of the squaring.
@ -46872,6 +46875,7 @@ static void sp_384_mont_inv_order_12(sp_digit* r, const sp_digit* a,
#endif /* WOLFSSL_SP_SMALL */
}
#endif /* HAVE_ECC_SIGN || (HAVE_ECC_VERIFY && WOLFSSL_SP_SMALL) */
#endif /* HAVE_ECC_SIGN | HAVE_ECC_VERIFY */
#ifdef HAVE_ECC_SIGN
#ifndef SP_ECC_MAX_SIG_GEN

View File

@ -37625,6 +37625,19 @@ static WC_INLINE int sp_256_mod_4(sp_digit* r, const sp_digit* a, const sp_digit
#endif
#if defined(HAVE_ECC_SIGN) || defined(HAVE_ECC_VERIFY)
/* Multiply two number mod the order of P256 curve. (r = a * b mod order)
*
* r Result of the multiplication.
* a First operand of the multiplication.
* b Second operand of the multiplication.
*/
static void sp_256_mont_mul_order_4(sp_digit* r, const sp_digit* a, const sp_digit* b)
{
sp_256_mul_4(r, a, b);
sp_256_mont_reduce_order_4(r, p256_order, p256_mp_order);
}
#if defined(HAVE_ECC_SIGN) || (defined(HAVE_ECC_VERIFY) && defined(WOLFSSL_SP_SMALL))
#ifdef WOLFSSL_SP_SMALL
/* Order-2 for the P256 curve. */
static const uint64_t p256_order_minus_2[4] = {
@ -37638,18 +37651,6 @@ static const sp_int_digit p256_order_low[2] = {
};
#endif /* WOLFSSL_SP_SMALL */
/* Multiply two number mod the order of P256 curve. (r = a * b mod order)
*
* r Result of the multiplication.
* a First operand of the multiplication.
* b Second operand of the multiplication.
*/
static void sp_256_mont_mul_order_4(sp_digit* r, const sp_digit* a, const sp_digit* b)
{
sp_256_mul_4(r, a, b);
sp_256_mont_reduce_order_4(r, p256_order, p256_mp_order);
}
/* Square number mod the order of P256 curve. (r = a * a mod order)
*
* r Result of the squaring.
@ -37820,6 +37821,7 @@ static void sp_256_mont_inv_order_4(sp_digit* r, const sp_digit* a,
#endif /* WOLFSSL_SP_SMALL */
}
#endif /* HAVE_ECC_SIGN || (HAVE_ECC_VERIFY && WOLFSSL_SP_SMALL) */
#endif /* HAVE_ECC_SIGN | HAVE_ECC_VERIFY */
#ifdef HAVE_ECC_SIGN
#ifndef SP_ECC_MAX_SIG_GEN
@ -63412,6 +63414,19 @@ static WC_INLINE int sp_384_mod_6(sp_digit* r, const sp_digit* a, const sp_digit
#endif
#if defined(HAVE_ECC_SIGN) || defined(HAVE_ECC_VERIFY)
/* Multiply two number mod the order of P384 curve. (r = a * b mod order)
*
* r Result of the multiplication.
* a First operand of the multiplication.
* b Second operand of the multiplication.
*/
static void sp_384_mont_mul_order_6(sp_digit* r, const sp_digit* a, const sp_digit* b)
{
sp_384_mul_6(r, a, b);
sp_384_mont_reduce_order_6(r, p384_order, p384_mp_order);
}
#if defined(HAVE_ECC_SIGN) || (defined(HAVE_ECC_VERIFY) && defined(WOLFSSL_SP_SMALL))
#ifdef WOLFSSL_SP_SMALL
/* Order-2 for the P384 curve. */
static const uint64_t p384_order_minus_2[6] = {
@ -63425,18 +63440,6 @@ static const uint64_t p384_order_low[3] = {
};
#endif /* WOLFSSL_SP_SMALL */
/* Multiply two number mod the order of P384 curve. (r = a * b mod order)
*
* r Result of the multiplication.
* a First operand of the multiplication.
* b Second operand of the multiplication.
*/
static void sp_384_mont_mul_order_6(sp_digit* r, const sp_digit* a, const sp_digit* b)
{
sp_384_mul_6(r, a, b);
sp_384_mont_reduce_order_6(r, p384_order, p384_mp_order);
}
/* Square number mod the order of P384 curve. (r = a * a mod order)
*
* r Result of the squaring.
@ -63578,6 +63581,7 @@ static void sp_384_mont_inv_order_6(sp_digit* r, const sp_digit* a,
#endif /* WOLFSSL_SP_SMALL */
}
#endif /* HAVE_ECC_SIGN || (HAVE_ECC_VERIFY && WOLFSSL_SP_SMALL) */
#endif /* HAVE_ECC_SIGN | HAVE_ECC_VERIFY */
#ifdef HAVE_ECC_SIGN
#ifndef SP_ECC_MAX_SIG_GEN

View File

@ -104088,6 +104088,19 @@ static WC_INLINE int sp_256_mod_8(sp_digit* r, const sp_digit* a, const sp_digit
#endif
#if defined(HAVE_ECC_SIGN) || defined(HAVE_ECC_VERIFY)
/* Multiply two number mod the order of P256 curve. (r = a * b mod order)
*
* r Result of the multiplication.
* a First operand of the multiplication.
* b Second operand of the multiplication.
*/
static void sp_256_mont_mul_order_8(sp_digit* r, const sp_digit* a, const sp_digit* b)
{
sp_256_mul_8(r, a, b);
sp_256_mont_reduce_order_8(r, p256_order, p256_mp_order);
}
#if defined(HAVE_ECC_SIGN) || (defined(HAVE_ECC_VERIFY) && defined(WOLFSSL_SP_SMALL))
#ifdef WOLFSSL_SP_SMALL
/* Order-2 for the P256 curve. */
static const uint32_t p256_order_minus_2[8] = {
@ -104101,18 +104114,6 @@ static const sp_int_digit p256_order_low[4] = {
};
#endif /* WOLFSSL_SP_SMALL */
/* Multiply two number mod the order of P256 curve. (r = a * b mod order)
*
* r Result of the multiplication.
* a First operand of the multiplication.
* b Second operand of the multiplication.
*/
static void sp_256_mont_mul_order_8(sp_digit* r, const sp_digit* a, const sp_digit* b)
{
sp_256_mul_8(r, a, b);
sp_256_mont_reduce_order_8(r, p256_order, p256_mp_order);
}
/* Square number mod the order of P256 curve. (r = a * a mod order)
*
* r Result of the squaring.
@ -104283,6 +104284,7 @@ static void sp_256_mont_inv_order_8(sp_digit* r, const sp_digit* a,
#endif /* WOLFSSL_SP_SMALL */
}
#endif /* HAVE_ECC_SIGN || (HAVE_ECC_VERIFY && WOLFSSL_SP_SMALL) */
#endif /* HAVE_ECC_SIGN | HAVE_ECC_VERIFY */
#ifdef HAVE_ECC_SIGN
#ifndef SP_ECC_MAX_SIG_GEN
@ -114608,6 +114610,19 @@ static WC_INLINE int sp_384_mod_12(sp_digit* r, const sp_digit* a, const sp_digi
#endif
#if defined(HAVE_ECC_SIGN) || defined(HAVE_ECC_VERIFY)
/* Multiply two number mod the order of P384 curve. (r = a * b mod order)
*
* r Result of the multiplication.
* a First operand of the multiplication.
* b Second operand of the multiplication.
*/
static void sp_384_mont_mul_order_12(sp_digit* r, const sp_digit* a, const sp_digit* b)
{
sp_384_mul_12(r, a, b);
sp_384_mont_reduce_order_12(r, p384_order, p384_mp_order);
}
#if defined(HAVE_ECC_SIGN) || (defined(HAVE_ECC_VERIFY) && defined(WOLFSSL_SP_SMALL))
#ifdef WOLFSSL_SP_SMALL
/* Order-2 for the P384 curve. */
static const uint32_t p384_order_minus_2[12] = {
@ -114621,18 +114636,6 @@ static const uint32_t p384_order_low[6] = {
};
#endif /* WOLFSSL_SP_SMALL */
/* Multiply two number mod the order of P384 curve. (r = a * b mod order)
*
* r Result of the multiplication.
* a First operand of the multiplication.
* b Second operand of the multiplication.
*/
static void sp_384_mont_mul_order_12(sp_digit* r, const sp_digit* a, const sp_digit* b)
{
sp_384_mul_12(r, a, b);
sp_384_mont_reduce_order_12(r, p384_order, p384_mp_order);
}
/* Square number mod the order of P384 curve. (r = a * a mod order)
*
* r Result of the squaring.
@ -114774,6 +114777,7 @@ static void sp_384_mont_inv_order_12(sp_digit* r, const sp_digit* a,
#endif /* WOLFSSL_SP_SMALL */
}
#endif /* HAVE_ECC_SIGN || (HAVE_ECC_VERIFY && WOLFSSL_SP_SMALL) */
#endif /* HAVE_ECC_SIGN | HAVE_ECC_VERIFY */
#ifdef HAVE_ECC_SIGN
#ifndef SP_ECC_MAX_SIG_GEN

View File

@ -25219,6 +25219,19 @@ static int sp_256_mod_9(sp_digit* r, const sp_digit* a, const sp_digit* m)
#endif
#if defined(HAVE_ECC_SIGN) || defined(HAVE_ECC_VERIFY)
/* Multiply two number mod the order of P256 curve. (r = a * b mod order)
*
* r Result of the multiplication.
* a First operand of the multiplication.
* b Second operand of the multiplication.
*/
static void sp_256_mont_mul_order_9(sp_digit* r, const sp_digit* a, const sp_digit* b)
{
sp_256_mul_9(r, a, b);
sp_256_mont_reduce_order_9(r, p256_order, p256_mp_order);
}
#if defined(HAVE_ECC_SIGN) || (defined(HAVE_ECC_VERIFY) && defined(WOLFSSL_SP_SMALL))
#ifdef WOLFSSL_SP_SMALL
/* Order-2 for the P256 curve. */
static const uint32_t p256_order_minus_2[8] = {
@ -25232,18 +25245,6 @@ static const sp_int_digit p256_order_low[4] = {
};
#endif /* WOLFSSL_SP_SMALL */
/* Multiply two number mod the order of P256 curve. (r = a * b mod order)
*
* r Result of the multiplication.
* a First operand of the multiplication.
* b Second operand of the multiplication.
*/
static void sp_256_mont_mul_order_9(sp_digit* r, const sp_digit* a, const sp_digit* b)
{
sp_256_mul_9(r, a, b);
sp_256_mont_reduce_order_9(r, p256_order, p256_mp_order);
}
/* Square number mod the order of P256 curve. (r = a * a mod order)
*
* r Result of the squaring.
@ -25414,6 +25415,7 @@ static void sp_256_mont_inv_order_9(sp_digit* r, const sp_digit* a,
#endif /* WOLFSSL_SP_SMALL */
}
#endif /* HAVE_ECC_SIGN || (HAVE_ECC_VERIFY && WOLFSSL_SP_SMALL) */
#endif /* HAVE_ECC_SIGN | HAVE_ECC_VERIFY */
#ifdef HAVE_ECC_SIGN
#ifndef SP_ECC_MAX_SIG_GEN
@ -33032,6 +33034,19 @@ static int sp_384_mod_15(sp_digit* r, const sp_digit* a, const sp_digit* m)
#endif
#if defined(HAVE_ECC_SIGN) || defined(HAVE_ECC_VERIFY)
/* Multiply two number mod the order of P384 curve. (r = a * b mod order)
*
* r Result of the multiplication.
* a First operand of the multiplication.
* b Second operand of the multiplication.
*/
static void sp_384_mont_mul_order_15(sp_digit* r, const sp_digit* a, const sp_digit* b)
{
sp_384_mul_15(r, a, b);
sp_384_mont_reduce_order_15(r, p384_order, p384_mp_order);
}
#if defined(HAVE_ECC_SIGN) || (defined(HAVE_ECC_VERIFY) && defined(WOLFSSL_SP_SMALL))
#ifdef WOLFSSL_SP_SMALL
/* Order-2 for the P384 curve. */
static const uint32_t p384_order_minus_2[12] = {
@ -33045,18 +33060,6 @@ static const uint32_t p384_order_low[6] = {
};
#endif /* WOLFSSL_SP_SMALL */
/* Multiply two number mod the order of P384 curve. (r = a * b mod order)
*
* r Result of the multiplication.
* a First operand of the multiplication.
* b Second operand of the multiplication.
*/
static void sp_384_mont_mul_order_15(sp_digit* r, const sp_digit* a, const sp_digit* b)
{
sp_384_mul_15(r, a, b);
sp_384_mont_reduce_order_15(r, p384_order, p384_mp_order);
}
/* Square number mod the order of P384 curve. (r = a * a mod order)
*
* r Result of the squaring.
@ -33198,6 +33201,7 @@ static void sp_384_mont_inv_order_15(sp_digit* r, const sp_digit* a,
#endif /* WOLFSSL_SP_SMALL */
}
#endif /* HAVE_ECC_SIGN || (HAVE_ECC_VERIFY && WOLFSSL_SP_SMALL) */
#endif /* HAVE_ECC_SIGN | HAVE_ECC_VERIFY */
#ifdef HAVE_ECC_SIGN
#ifndef SP_ECC_MAX_SIG_GEN

View File

@ -26414,6 +26414,19 @@ static int sp_256_mod_5(sp_digit* r, const sp_digit* a, const sp_digit* m)
#endif
#if defined(HAVE_ECC_SIGN) || defined(HAVE_ECC_VERIFY)
/* Multiply two number mod the order of P256 curve. (r = a * b mod order)
*
* r Result of the multiplication.
* a First operand of the multiplication.
* b Second operand of the multiplication.
*/
static void sp_256_mont_mul_order_5(sp_digit* r, const sp_digit* a, const sp_digit* b)
{
sp_256_mul_5(r, a, b);
sp_256_mont_reduce_order_5(r, p256_order, p256_mp_order);
}
#if defined(HAVE_ECC_SIGN) || (defined(HAVE_ECC_VERIFY) && defined(WOLFSSL_SP_SMALL))
#ifdef WOLFSSL_SP_SMALL
/* Order-2 for the P256 curve. */
static const uint64_t p256_order_minus_2[4] = {
@ -26427,18 +26440,6 @@ static const sp_int_digit p256_order_low[2] = {
};
#endif /* WOLFSSL_SP_SMALL */
/* Multiply two number mod the order of P256 curve. (r = a * b mod order)
*
* r Result of the multiplication.
* a First operand of the multiplication.
* b Second operand of the multiplication.
*/
static void sp_256_mont_mul_order_5(sp_digit* r, const sp_digit* a, const sp_digit* b)
{
sp_256_mul_5(r, a, b);
sp_256_mont_reduce_order_5(r, p256_order, p256_mp_order);
}
/* Square number mod the order of P256 curve. (r = a * a mod order)
*
* r Result of the squaring.
@ -26609,6 +26610,7 @@ static void sp_256_mont_inv_order_5(sp_digit* r, const sp_digit* a,
#endif /* WOLFSSL_SP_SMALL */
}
#endif /* HAVE_ECC_SIGN || (HAVE_ECC_VERIFY && WOLFSSL_SP_SMALL) */
#endif /* HAVE_ECC_SIGN | HAVE_ECC_VERIFY */
#ifdef HAVE_ECC_SIGN
#ifndef SP_ECC_MAX_SIG_GEN
@ -33662,6 +33664,19 @@ static int sp_384_mod_7(sp_digit* r, const sp_digit* a, const sp_digit* m)
#endif
#if defined(HAVE_ECC_SIGN) || defined(HAVE_ECC_VERIFY)
/* Multiply two number mod the order of P384 curve. (r = a * b mod order)
*
* r Result of the multiplication.
* a First operand of the multiplication.
* b Second operand of the multiplication.
*/
static void sp_384_mont_mul_order_7(sp_digit* r, const sp_digit* a, const sp_digit* b)
{
sp_384_mul_7(r, a, b);
sp_384_mont_reduce_order_7(r, p384_order, p384_mp_order);
}
#if defined(HAVE_ECC_SIGN) || (defined(HAVE_ECC_VERIFY) && defined(WOLFSSL_SP_SMALL))
#ifdef WOLFSSL_SP_SMALL
/* Order-2 for the P384 curve. */
static const uint64_t p384_order_minus_2[6] = {
@ -33675,18 +33690,6 @@ static const uint64_t p384_order_low[3] = {
};
#endif /* WOLFSSL_SP_SMALL */
/* Multiply two number mod the order of P384 curve. (r = a * b mod order)
*
* r Result of the multiplication.
* a First operand of the multiplication.
* b Second operand of the multiplication.
*/
static void sp_384_mont_mul_order_7(sp_digit* r, const sp_digit* a, const sp_digit* b)
{
sp_384_mul_7(r, a, b);
sp_384_mont_reduce_order_7(r, p384_order, p384_mp_order);
}
/* Square number mod the order of P384 curve. (r = a * a mod order)
*
* r Result of the squaring.
@ -33828,6 +33831,7 @@ static void sp_384_mont_inv_order_7(sp_digit* r, const sp_digit* a,
#endif /* WOLFSSL_SP_SMALL */
}
#endif /* HAVE_ECC_SIGN || (HAVE_ECC_VERIFY && WOLFSSL_SP_SMALL) */
#endif /* HAVE_ECC_SIGN | HAVE_ECC_VERIFY */
#ifdef HAVE_ECC_SIGN
#ifndef SP_ECC_MAX_SIG_GEN

View File

@ -22820,6 +22820,19 @@ static WC_INLINE int sp_256_mod_8(sp_digit* r, const sp_digit* a, const sp_digit
#endif
#if defined(HAVE_ECC_SIGN) || defined(HAVE_ECC_VERIFY)
/* Multiply two number mod the order of P256 curve. (r = a * b mod order)
*
* r Result of the multiplication.
* a First operand of the multiplication.
* b Second operand of the multiplication.
*/
static void sp_256_mont_mul_order_8(sp_digit* r, const sp_digit* a, const sp_digit* b)
{
sp_256_mul_8(r, a, b);
sp_256_mont_reduce_order_8(r, p256_order, p256_mp_order);
}
#if defined(HAVE_ECC_SIGN) || (defined(HAVE_ECC_VERIFY) && defined(WOLFSSL_SP_SMALL))
#ifdef WOLFSSL_SP_SMALL
/* Order-2 for the P256 curve. */
static const uint32_t p256_order_minus_2[8] = {
@ -22833,18 +22846,6 @@ static const sp_int_digit p256_order_low[4] = {
};
#endif /* WOLFSSL_SP_SMALL */
/* Multiply two number mod the order of P256 curve. (r = a * b mod order)
*
* r Result of the multiplication.
* a First operand of the multiplication.
* b Second operand of the multiplication.
*/
static void sp_256_mont_mul_order_8(sp_digit* r, const sp_digit* a, const sp_digit* b)
{
sp_256_mul_8(r, a, b);
sp_256_mont_reduce_order_8(r, p256_order, p256_mp_order);
}
/* Square number mod the order of P256 curve. (r = a * a mod order)
*
* r Result of the squaring.
@ -23015,6 +23016,7 @@ static void sp_256_mont_inv_order_8(sp_digit* r, const sp_digit* a,
#endif /* WOLFSSL_SP_SMALL */
}
#endif /* HAVE_ECC_SIGN || (HAVE_ECC_VERIFY && WOLFSSL_SP_SMALL) */
#endif /* HAVE_ECC_SIGN | HAVE_ECC_VERIFY */
#ifdef HAVE_ECC_SIGN
#ifndef SP_ECC_MAX_SIG_GEN
@ -30031,6 +30033,19 @@ static WC_INLINE int sp_384_mod_12(sp_digit* r, const sp_digit* a, const sp_digi
#endif
#if defined(HAVE_ECC_SIGN) || defined(HAVE_ECC_VERIFY)
/* Multiply two number mod the order of P384 curve. (r = a * b mod order)
*
* r Result of the multiplication.
* a First operand of the multiplication.
* b Second operand of the multiplication.
*/
static void sp_384_mont_mul_order_12(sp_digit* r, const sp_digit* a, const sp_digit* b)
{
sp_384_mul_12(r, a, b);
sp_384_mont_reduce_order_12(r, p384_order, p384_mp_order);
}
#if defined(HAVE_ECC_SIGN) || (defined(HAVE_ECC_VERIFY) && defined(WOLFSSL_SP_SMALL))
#ifdef WOLFSSL_SP_SMALL
/* Order-2 for the P384 curve. */
static const uint32_t p384_order_minus_2[12] = {
@ -30044,18 +30059,6 @@ static const uint32_t p384_order_low[6] = {
};
#endif /* WOLFSSL_SP_SMALL */
/* Multiply two number mod the order of P384 curve. (r = a * b mod order)
*
* r Result of the multiplication.
* a First operand of the multiplication.
* b Second operand of the multiplication.
*/
static void sp_384_mont_mul_order_12(sp_digit* r, const sp_digit* a, const sp_digit* b)
{
sp_384_mul_12(r, a, b);
sp_384_mont_reduce_order_12(r, p384_order, p384_mp_order);
}
/* Square number mod the order of P384 curve. (r = a * a mod order)
*
* r Result of the squaring.
@ -30197,6 +30200,7 @@ static void sp_384_mont_inv_order_12(sp_digit* r, const sp_digit* a,
#endif /* WOLFSSL_SP_SMALL */
}
#endif /* HAVE_ECC_SIGN || (HAVE_ECC_VERIFY && WOLFSSL_SP_SMALL) */
#endif /* HAVE_ECC_SIGN | HAVE_ECC_VERIFY */
#ifdef HAVE_ECC_SIGN
#ifndef SP_ECC_MAX_SIG_GEN

View File

@ -23483,19 +23483,6 @@ static WC_INLINE int sp_256_mod_4(sp_digit* r, const sp_digit* a,
#endif
#if defined(HAVE_ECC_SIGN) || defined(HAVE_ECC_VERIFY)
#ifdef WOLFSSL_SP_SMALL
/* Order-2 for the P256 curve. */
static const uint64_t p256_order_minus_2[4] = {
0xf3b9cac2fc63254fU,0xbce6faada7179e84U,0xffffffffffffffffU,
0xffffffff00000000U
};
#else
/* The low half of the order-2 of the P256 curve. */
static const uint64_t p256_order_low[2] = {
0xf3b9cac2fc63254fU,0xbce6faada7179e84U
};
#endif /* WOLFSSL_SP_SMALL */
/* Multiply two number mod the order of P256 curve. (r = a * b mod order)
*
* r Result of the multiplication.
@ -23509,6 +23496,20 @@ static void sp_256_mont_mul_order_4(sp_digit* r, const sp_digit* a, const sp_dig
sp_256_mont_reduce_order_4(r, p256_order, p256_mp_order);
}
#if defined(HAVE_ECC_SIGN) || (defined(HAVE_ECC_VERIFY) && defined(WOLFSSL_SP_SMALL))
#ifdef WOLFSSL_SP_SMALL
/* Order-2 for the P256 curve. */
static const uint64_t p256_order_minus_2[4] = {
0xf3b9cac2fc63254fU,0xbce6faada7179e84U,0xffffffffffffffffU,
0xffffffff00000000U
};
#else
/* The low half of the order-2 of the P256 curve. */
static const uint64_t p256_order_low[2] = {
0xf3b9cac2fc63254fU,0xbce6faada7179e84U
};
#endif /* WOLFSSL_SP_SMALL */
/* Square number mod the order of P256 curve. (r = a * a mod order)
*
* r Result of the squaring.
@ -23695,8 +23696,10 @@ static void sp_256_mont_inv_order_4(sp_digit* r, const sp_digit* a,
#endif /* WOLFSSL_SP_SMALL */
}
#endif /* HAVE_ECC_SIGN || (HAVE_ECC_VERIFY && WOLFSSL_SP_SMALL) */
#ifdef HAVE_INTEL_AVX2
extern void sp_256_mont_mul_order_avx2_4(sp_digit* r, const sp_digit* a, const sp_digit* b);
#if defined(HAVE_ECC_SIGN) || (defined(HAVE_ECC_VERIFY) && defined(WOLFSSL_SP_SMALL))
extern void sp_256_mont_sqr_order_avx2_4(sp_digit* r, const sp_digit* a);
#ifndef WOLFSSL_SP_SMALL
@ -23873,6 +23876,7 @@ static void sp_256_mont_inv_order_avx2_4(sp_digit* r, const sp_digit* a,
#endif /* WOLFSSL_SP_SMALL */
}
#endif /* HAVE_ECC_SIGN || (HAVE_ECC_VERIFY && WOLFSSL_SP_SMALL) */
#endif /* HAVE_INTEL_AVX2 */
#endif /* HAVE_ECC_SIGN | HAVE_ECC_VERIFY */
#ifdef HAVE_ECC_SIGN
@ -48074,6 +48078,19 @@ static WC_INLINE int sp_384_mod_6(sp_digit* r, const sp_digit* a,
#endif
#if defined(HAVE_ECC_SIGN) || defined(HAVE_ECC_VERIFY)
/* Multiply two number mod the order of P384 curve. (r = a * b mod order)
*
* r Result of the multiplication.
* a First operand of the multiplication.
* b Second operand of the multiplication.
*/
static void sp_384_mont_mul_order_6(sp_digit* r, const sp_digit* a, const sp_digit* b)
{
sp_384_mul_6(r, a, b);
sp_384_mont_reduce_order_6(r, p384_order, p384_mp_order);
}
#if defined(HAVE_ECC_SIGN) || (defined(HAVE_ECC_VERIFY) && defined(WOLFSSL_SP_SMALL))
#ifdef WOLFSSL_SP_SMALL
/* Order-2 for the P384 curve. */
static const uint64_t p384_order_minus_2[6] = {
@ -48087,18 +48104,6 @@ static const uint64_t p384_order_low[3] = {
};
#endif /* WOLFSSL_SP_SMALL */
/* Multiply two number mod the order of P384 curve. (r = a * b mod order)
*
* r Result of the multiplication.
* a First operand of the multiplication.
* b Second operand of the multiplication.
*/
static void sp_384_mont_mul_order_6(sp_digit* r, const sp_digit* a, const sp_digit* b)
{
sp_384_mul_6(r, a, b);
sp_384_mont_reduce_order_6(r, p384_order, p384_mp_order);
}
/* Square number mod the order of P384 curve. (r = a * a mod order)
*
* r Result of the squaring.
@ -48240,6 +48245,7 @@ static void sp_384_mont_inv_order_6(sp_digit* r, const sp_digit* a,
#endif /* WOLFSSL_SP_SMALL */
}
#endif /* HAVE_ECC_SIGN || (HAVE_ECC_VERIFY && WOLFSSL_SP_SMALL) */
#ifdef HAVE_INTEL_AVX2
/* Multiply two number mod the order of P384 curve. (r = a * b mod order)
*
@ -48253,6 +48259,7 @@ static void sp_384_mont_mul_order_avx2_6(sp_digit* r, const sp_digit* a, const s
sp_384_mont_reduce_order_avx2_6(r, p384_order, p384_mp_order);
}
#if defined(HAVE_ECC_SIGN) || (defined(HAVE_ECC_VERIFY) && defined(WOLFSSL_SP_SMALL))
/* Square number mod the order of P384 curve. (r = a * a mod order)
*
* r Result of the squaring.
@ -48394,6 +48401,7 @@ static void sp_384_mont_inv_order_avx2_6(sp_digit* r, const sp_digit* a,
#endif /* WOLFSSL_SP_SMALL */
}
#endif /* HAVE_ECC_SIGN || (HAVE_ECC_VERIFY && WOLFSSL_SP_SMALL) */
#endif /* HAVE_INTEL_AVX2 */
#endif /* HAVE_ECC_SIGN | HAVE_ECC_VERIFY */
#ifdef HAVE_ECC_SIGN

View File

@ -22940,7 +22940,8 @@ static int ecc_def_curve_test(WC_RNG *rng)
#else
ecc_key key[1];
#endif
#if defined(HAVE_ECC_KEY_IMPORT) && defined(HAVE_ECC_KEY_EXPORT)
#if (defined(HAVE_ECC_KEY_IMPORT) && defined(HAVE_ECC_KEY_EXPORT)) || \
(defined(HAVE_ECC_KEY_IMPORT) && !defined(WOLFSSL_VALIDATE_ECC_IMPORT))
word32 idx = 0;
#endif