forked from wolfSSL/wolfssl
Merge pull request #5783 from SparkiDev/sp_small_p521_fix
SP P521 small HAVE_COMP_KEY: sp_521_mont_sqr_n*
This commit is contained in:
@ -18,6 +18,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
#ifdef WOLFSSL_USER_SETTINGS
|
||||
#ifdef WOLFSSL_USER_SETTINGS_ASM
|
||||
/*
|
||||
|
@ -69386,7 +69386,7 @@ static void sp_256_mont_sqr_n_8(sp_digit* r, const sp_digit* a, int n,
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !WOLFSSL_SP_SMALL | HAVE_COMP_KEY */
|
||||
#endif /* !WOLFSSL_SP_SMALL || HAVE_COMP_KEY */
|
||||
#ifdef WOLFSSL_SP_SMALL
|
||||
/* Mod-2 for the P256 curve. */
|
||||
static const uint32_t p256_mod_minus_2[8] = {
|
||||
@ -87597,7 +87597,7 @@ static void sp_384_mont_sqr_n_12(sp_digit* r, const sp_digit* a, int n,
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !WOLFSSL_SP_SMALL | HAVE_COMP_KEY */
|
||||
#endif /* !WOLFSSL_SP_SMALL || HAVE_COMP_KEY */
|
||||
#ifdef WOLFSSL_SP_SMALL
|
||||
/* Mod-2 for the P384 curve. */
|
||||
static const uint32_t p384_mod_minus_2[12] = {
|
||||
@ -114145,7 +114145,7 @@ SP_NOINLINE static void sp_521_mont_sqr_17(sp_digit* r, const sp_digit* a,
|
||||
sp_521_mont_reduce_17(r, m, mp);
|
||||
}
|
||||
|
||||
#if !defined(WOLFSSL_SP_SMALL) || defined(HAVE_COMP_KEY)
|
||||
#ifndef WOLFSSL_SP_SMALL
|
||||
/* Square the Montgomery form number a number of times. (r = a ^ n mod m)
|
||||
*
|
||||
* r Result of squaring.
|
||||
@ -114163,7 +114163,7 @@ static void sp_521_mont_sqr_n_17(sp_digit* r, const sp_digit* a, int n,
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !WOLFSSL_SP_SMALL | HAVE_COMP_KEY */
|
||||
#endif /* !WOLFSSL_SP_SMALL */
|
||||
#ifdef WOLFSSL_SP_SMALL
|
||||
/* Mod-2 for the P521 curve. */
|
||||
static const uint32_t p521_mod_minus_2[17] = {
|
||||
|
@ -22645,7 +22645,7 @@ static void sp_256_mont_sqr_n_4(sp_digit* r, const sp_digit* a, int n,
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !WOLFSSL_SP_SMALL | HAVE_COMP_KEY */
|
||||
#endif /* !WOLFSSL_SP_SMALL || HAVE_COMP_KEY */
|
||||
#ifdef WOLFSSL_SP_SMALL
|
||||
/* Mod-2 for the P256 curve. */
|
||||
static const uint64_t p256_mod_minus_2[4] = {
|
||||
@ -43102,7 +43102,7 @@ static void sp_384_mont_sqr_n_6(sp_digit* r, const sp_digit* a, int n,
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !WOLFSSL_SP_SMALL | HAVE_COMP_KEY */
|
||||
#endif /* !WOLFSSL_SP_SMALL || HAVE_COMP_KEY */
|
||||
#ifdef WOLFSSL_SP_SMALL
|
||||
/* Mod-2 for the P384 curve. */
|
||||
static const uint64_t p384_mod_minus_2[6] = {
|
||||
@ -71148,7 +71148,7 @@ SP_NOINLINE static void sp_521_mont_sqr_9(sp_digit* r, const sp_digit* a, const
|
||||
);
|
||||
}
|
||||
|
||||
#if !defined(WOLFSSL_SP_SMALL) || defined(HAVE_COMP_KEY)
|
||||
#ifndef WOLFSSL_SP_SMALL
|
||||
/* Square the Montgomery form number a number of times. (r = a ^ n mod m)
|
||||
*
|
||||
* r Result of squaring.
|
||||
@ -71166,7 +71166,7 @@ static void sp_521_mont_sqr_n_9(sp_digit* r, const sp_digit* a, int n,
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !WOLFSSL_SP_SMALL | HAVE_COMP_KEY */
|
||||
#endif /* !WOLFSSL_SP_SMALL */
|
||||
#ifdef WOLFSSL_SP_SMALL
|
||||
/* Mod-2 for the P521 curve. */
|
||||
static const uint64_t p521_mod_minus_2[9] = {
|
||||
|
@ -99062,7 +99062,7 @@ static void sp_256_mont_sqr_n_8(sp_digit* r, const sp_digit* a, int n,
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !WOLFSSL_SP_SMALL | HAVE_COMP_KEY */
|
||||
#endif /* !WOLFSSL_SP_SMALL || HAVE_COMP_KEY */
|
||||
#ifdef WOLFSSL_SP_SMALL
|
||||
/* Mod-2 for the P256 curve. */
|
||||
static const uint32_t p256_mod_minus_2[8] = {
|
||||
@ -110447,7 +110447,7 @@ static void sp_384_mont_sqr_n_12(sp_digit* r, const sp_digit* a, int n,
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !WOLFSSL_SP_SMALL | HAVE_COMP_KEY */
|
||||
#endif /* !WOLFSSL_SP_SMALL || HAVE_COMP_KEY */
|
||||
#ifdef WOLFSSL_SP_SMALL
|
||||
/* Mod-2 for the P384 curve. */
|
||||
static const uint32_t p384_mod_minus_2[12] = {
|
||||
@ -122727,7 +122727,7 @@ SP_NOINLINE static void sp_521_mont_sqr_17(sp_digit* r, const sp_digit* a,
|
||||
sp_521_mont_reduce_17(r, m, mp);
|
||||
}
|
||||
|
||||
#if !defined(WOLFSSL_SP_SMALL) || defined(HAVE_COMP_KEY)
|
||||
#ifndef WOLFSSL_SP_SMALL
|
||||
/* Square the Montgomery form number a number of times. (r = a ^ n mod m)
|
||||
*
|
||||
* r Result of squaring.
|
||||
@ -122745,7 +122745,7 @@ static void sp_521_mont_sqr_n_17(sp_digit* r, const sp_digit* a, int n,
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !WOLFSSL_SP_SMALL | HAVE_COMP_KEY */
|
||||
#endif /* !WOLFSSL_SP_SMALL */
|
||||
#ifdef WOLFSSL_SP_SMALL
|
||||
/* Mod-2 for the P521 curve. */
|
||||
static const uint32_t p521_mod_minus_2[17] = {
|
||||
|
@ -20946,7 +20946,7 @@ static void sp_256_mont_sqr_n_9(sp_digit* r, const sp_digit* a, int n,
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !WOLFSSL_SP_SMALL | HAVE_COMP_KEY */
|
||||
#endif /* !WOLFSSL_SP_SMALL || HAVE_COMP_KEY */
|
||||
#ifdef WOLFSSL_SP_SMALL
|
||||
/* Mod-2 for the P256 curve. */
|
||||
static const uint32_t p256_mod_minus_2[8] = {
|
||||
@ -28328,7 +28328,7 @@ static void sp_384_mont_sqr_n_15(sp_digit* r, const sp_digit* a, int n,
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !WOLFSSL_SP_SMALL | HAVE_COMP_KEY */
|
||||
#endif /* !WOLFSSL_SP_SMALL || HAVE_COMP_KEY */
|
||||
#ifdef WOLFSSL_SP_SMALL
|
||||
/* Mod-2 for the P384 curve. */
|
||||
static const uint32_t p384_mod_minus_2[12] = {
|
||||
@ -35969,7 +35969,7 @@ SP_NOINLINE static void sp_521_mont_sqr_21(sp_digit* r, const sp_digit* a,
|
||||
sp_521_mont_reduce_21(r, m, mp);
|
||||
}
|
||||
|
||||
#if !defined(WOLFSSL_SP_SMALL) || defined(HAVE_COMP_KEY)
|
||||
#ifndef WOLFSSL_SP_SMALL
|
||||
/* Square the Montgomery form number a number of times. (r = a ^ n mod m)
|
||||
*
|
||||
* r Result of squaring.
|
||||
@ -35987,7 +35987,7 @@ static void sp_521_mont_sqr_n_21(sp_digit* r, const sp_digit* a, int n,
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !WOLFSSL_SP_SMALL | HAVE_COMP_KEY */
|
||||
#endif /* !WOLFSSL_SP_SMALL */
|
||||
#ifdef WOLFSSL_SP_SMALL
|
||||
/* Mod-2 for the P521 curve. */
|
||||
static const uint32_t p521_mod_minus_2[17] = {
|
||||
|
@ -21934,7 +21934,7 @@ static void sp_256_mont_sqr_n_5(sp_digit* r, const sp_digit* a, int n,
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !WOLFSSL_SP_SMALL | HAVE_COMP_KEY */
|
||||
#endif /* !WOLFSSL_SP_SMALL || HAVE_COMP_KEY */
|
||||
#ifdef WOLFSSL_SP_SMALL
|
||||
/* Mod-2 for the P256 curve. */
|
||||
static const uint64_t p256_mod_minus_2[4] = {
|
||||
@ -28820,7 +28820,7 @@ static void sp_384_mont_sqr_n_7(sp_digit* r, const sp_digit* a, int n,
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !WOLFSSL_SP_SMALL | HAVE_COMP_KEY */
|
||||
#endif /* !WOLFSSL_SP_SMALL || HAVE_COMP_KEY */
|
||||
#ifdef WOLFSSL_SP_SMALL
|
||||
/* Mod-2 for the P384 curve. */
|
||||
static const uint64_t p384_mod_minus_2[6] = {
|
||||
@ -36318,7 +36318,7 @@ SP_NOINLINE static void sp_521_mont_sqr_9(sp_digit* r, const sp_digit* a,
|
||||
sp_521_mont_reduce_9(r, m, mp);
|
||||
}
|
||||
|
||||
#if !defined(WOLFSSL_SP_SMALL) || defined(HAVE_COMP_KEY)
|
||||
#ifndef WOLFSSL_SP_SMALL
|
||||
/* Square the Montgomery form number a number of times. (r = a ^ n mod m)
|
||||
*
|
||||
* r Result of squaring.
|
||||
@ -36336,7 +36336,7 @@ static void sp_521_mont_sqr_n_9(sp_digit* r, const sp_digit* a, int n,
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !WOLFSSL_SP_SMALL | HAVE_COMP_KEY */
|
||||
#endif /* !WOLFSSL_SP_SMALL */
|
||||
#ifdef WOLFSSL_SP_SMALL
|
||||
/* Mod-2 for the P521 curve. */
|
||||
static const uint64_t p521_mod_minus_2[9] = {
|
||||
|
@ -18359,7 +18359,7 @@ static void sp_256_mont_sqr_n_8(sp_digit* r, const sp_digit* a, int n,
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !WOLFSSL_SP_SMALL | HAVE_COMP_KEY */
|
||||
#endif /* !WOLFSSL_SP_SMALL || HAVE_COMP_KEY */
|
||||
#ifdef WOLFSSL_SP_SMALL
|
||||
/* Mod-2 for the P256 curve. */
|
||||
static const uint32_t p256_mod_minus_2[8] = {
|
||||
@ -26040,7 +26040,7 @@ static void sp_384_mont_sqr_n_12(sp_digit* r, const sp_digit* a, int n,
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !WOLFSSL_SP_SMALL | HAVE_COMP_KEY */
|
||||
#endif /* !WOLFSSL_SP_SMALL || HAVE_COMP_KEY */
|
||||
#ifdef WOLFSSL_SP_SMALL
|
||||
/* Mod-2 for the P384 curve. */
|
||||
static const uint32_t p384_mod_minus_2[12] = {
|
||||
@ -33528,7 +33528,7 @@ SP_NOINLINE static void sp_521_mont_sqr_17(sp_digit* r, const sp_digit* a,
|
||||
sp_521_mont_reduce_17(r, m, mp);
|
||||
}
|
||||
|
||||
#if !defined(WOLFSSL_SP_SMALL) || defined(HAVE_COMP_KEY)
|
||||
#ifndef WOLFSSL_SP_SMALL
|
||||
/* Square the Montgomery form number a number of times. (r = a ^ n mod m)
|
||||
*
|
||||
* r Result of squaring.
|
||||
@ -33546,7 +33546,7 @@ static void sp_521_mont_sqr_n_17(sp_digit* r, const sp_digit* a, int n,
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !WOLFSSL_SP_SMALL | HAVE_COMP_KEY */
|
||||
#endif /* !WOLFSSL_SP_SMALL */
|
||||
#ifdef WOLFSSL_SP_SMALL
|
||||
/* Mod-2 for the P521 curve. */
|
||||
static const uint32_t p521_mod_minus_2[17] = {
|
||||
|
@ -8351,7 +8351,7 @@ static void sp_256_mont_sqr_n_4(sp_digit* r, const sp_digit* a, int n,
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !WOLFSSL_SP_SMALL | HAVE_COMP_KEY */
|
||||
#endif /* !WOLFSSL_SP_SMALL || HAVE_COMP_KEY */
|
||||
#ifdef WOLFSSL_SP_SMALL
|
||||
/* Mod-2 for the P256 curve. */
|
||||
static const uint64_t p256_mod_minus_2[4] = {
|
||||
@ -9589,7 +9589,7 @@ static void sp_256_mont_sqr_n_avx2_4(sp_digit* r, const sp_digit* a, int n,
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !WOLFSSL_SP_SMALL | HAVE_COMP_KEY */
|
||||
#endif /* !WOLFSSL_SP_SMALL || HAVE_COMP_KEY */
|
||||
|
||||
/* Invert the number, in Montgomery form, modulo the modulus (prime) of the
|
||||
* P256 curve. (r = 1 / a mod m)
|
||||
@ -27497,7 +27497,7 @@ static void sp_384_mont_sqr_n_6(sp_digit* r, const sp_digit* a, int n,
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !WOLFSSL_SP_SMALL | HAVE_COMP_KEY */
|
||||
#endif /* !WOLFSSL_SP_SMALL || HAVE_COMP_KEY */
|
||||
#ifdef WOLFSSL_SP_SMALL
|
||||
/* Mod-2 for the P384 curve. */
|
||||
static const uint64_t p384_mod_minus_2[6] = {
|
||||
@ -28760,7 +28760,7 @@ static void sp_384_mont_sqr_n_avx2_6(sp_digit* r, const sp_digit* a, int n,
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !WOLFSSL_SP_SMALL | HAVE_COMP_KEY */
|
||||
#endif /* !WOLFSSL_SP_SMALL || HAVE_COMP_KEY */
|
||||
|
||||
/* Invert the number, in Montgomery form, modulo the modulus (prime) of the
|
||||
* P384 curve. (r = 1 / a mod m)
|
||||
@ -52358,7 +52358,7 @@ extern void sp_521_mont_sqr_9(sp_digit* r, const sp_digit* a, const sp_digit* m,
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#if !defined(WOLFSSL_SP_SMALL) || defined(HAVE_COMP_KEY)
|
||||
#ifndef WOLFSSL_SP_SMALL
|
||||
/* Square the Montgomery form number a number of times. (r = a ^ n mod m)
|
||||
*
|
||||
* r Result of squaring.
|
||||
@ -52376,7 +52376,7 @@ static void sp_521_mont_sqr_n_9(sp_digit* r, const sp_digit* a, int n,
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !WOLFSSL_SP_SMALL | HAVE_COMP_KEY */
|
||||
#endif /* !WOLFSSL_SP_SMALL */
|
||||
#ifdef WOLFSSL_SP_SMALL
|
||||
/* Mod-2 for the P521 curve. */
|
||||
static const uint64_t p521_mod_minus_2[9] = {
|
||||
@ -53595,7 +53595,7 @@ extern void sp_521_mont_sqr_avx2_9(sp_digit* r, const sp_digit* a, const sp_digi
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#if !defined(WOLFSSL_SP_SMALL) || defined(HAVE_COMP_KEY)
|
||||
#ifndef WOLFSSL_SP_SMALL
|
||||
/* Square the Montgomery form number a number of times. (r = a ^ n mod m)
|
||||
*
|
||||
* r Result of squaring.
|
||||
@ -53613,7 +53613,7 @@ static void sp_521_mont_sqr_n_avx2_9(sp_digit* r, const sp_digit* a, int n,
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !WOLFSSL_SP_SMALL | HAVE_COMP_KEY */
|
||||
#endif /* !WOLFSSL_SP_SMALL */
|
||||
|
||||
/* Invert the number, in Montgomery form, modulo the modulus (prime) of the
|
||||
* P521 curve. (r = 1 / a mod m)
|
||||
|
Reference in New Issue
Block a user