Merge pull request #2326 from SparkiDev/sp_update_1
Changes to other SP implementations based on recent changes
This commit is contained in:
commit
c9f18bfe3b
@ -39,10 +39,6 @@
|
||||
defined(WOLFSSL_HAVE_SP_ECC)
|
||||
|
||||
#ifdef RSA_LOW_MEM
|
||||
#ifndef SP_RSA_PRIVATE_EXP_D
|
||||
#define SP_RSA_PRIVATE_EXP_D
|
||||
#endif
|
||||
|
||||
#ifndef WOLFSSL_SP_SMALL
|
||||
#define WOLFSSL_SP_SMALL
|
||||
#endif
|
||||
@ -4963,7 +4959,7 @@ static int sp_2048_mod_exp_32(sp_digit* r, sp_digit* a, sp_digit* e,
|
||||
|
||||
#endif /* (WOLFSSL_HAVE_SP_RSA || WOLFSSL_HAVE_SP_DH) && !WOLFSSL_RSA_PUBLIC_ONLY */
|
||||
|
||||
#ifdef WOLFSSL_HAVE_SP_DH
|
||||
#if defined(WOLFSSL_HAVE_SP_RSA) || defined(WOLFSSL_HAVE_SP_DH)
|
||||
/* r = 2^n mod m where n is the number of bits to reduce by.
|
||||
* Given m must be 2048 bits, just need to subtract.
|
||||
*
|
||||
@ -4978,7 +4974,7 @@ static void sp_2048_mont_norm_64(sp_digit* r, sp_digit* m)
|
||||
sp_2048_sub_in_place_64(r, m);
|
||||
}
|
||||
|
||||
#endif /* WOLFSSL_HAVE_SP_DH */
|
||||
#endif /* WOLFSSL_HAVE_SP_RSA || WOLFSSL_HAVE_SP_DH */
|
||||
/* Conditionally subtract b from a using the mask m.
|
||||
* m is -1 to subtract and 0 when not copying.
|
||||
*
|
||||
@ -6735,7 +6731,7 @@ static WC_INLINE int sp_2048_mod_64_cond(sp_digit* r, sp_digit* a, sp_digit* m)
|
||||
return sp_2048_div_64_cond(a, m, NULL, r);
|
||||
}
|
||||
|
||||
#if (defined(SP_RSA_PRIVATE_EXP_D) && !defined(WOLFSSL_RSA_PUBLIC_ONLY)) || \
|
||||
#if (defined(WOLFSSL_HAVE_SP_RSA) && !defined(WOLFSSL_RSA_PUBLIC_ONLY)) || \
|
||||
defined(WOLFSSL_HAVE_SP_DH)
|
||||
#ifdef WOLFSSL_SP_SMALL
|
||||
/* Modular exponentiate a to the e mod m. (r = a^e mod m)
|
||||
@ -7009,7 +7005,7 @@ static int sp_2048_mod_exp_64(sp_digit* r, sp_digit* a, sp_digit* e,
|
||||
return err;
|
||||
}
|
||||
#endif /* WOLFSSL_SP_SMALL */
|
||||
#endif /* (SP_RSA_PRIVATE_EXP_D && !WOLFSSL_RSA_PUBLIC_ONLY) || WOLFSSL_HAVE_SP_DH */
|
||||
#endif /* (WOLFSSL_HAVE_SP_RSA && !WOLFSSL_RSA_PUBLIC_ONLY) || WOLFSSL_HAVE_SP_DH */
|
||||
|
||||
#ifdef WOLFSSL_HAVE_SP_RSA
|
||||
/* RSA public key operation.
|
||||
@ -13792,7 +13788,7 @@ static int sp_3072_mod_exp_48(sp_digit* r, sp_digit* a, sp_digit* e,
|
||||
|
||||
#endif /* (WOLFSSL_HAVE_SP_RSA || WOLFSSL_HAVE_SP_DH) && !WOLFSSL_RSA_PUBLIC_ONLY */
|
||||
|
||||
#ifdef WOLFSSL_HAVE_SP_DH
|
||||
#if defined(WOLFSSL_HAVE_SP_RSA) || defined(WOLFSSL_HAVE_SP_DH)
|
||||
/* r = 2^n mod m where n is the number of bits to reduce by.
|
||||
* Given m must be 3072 bits, just need to subtract.
|
||||
*
|
||||
@ -13807,7 +13803,7 @@ static void sp_3072_mont_norm_96(sp_digit* r, sp_digit* m)
|
||||
sp_3072_sub_in_place_96(r, m);
|
||||
}
|
||||
|
||||
#endif /* WOLFSSL_HAVE_SP_DH */
|
||||
#endif /* WOLFSSL_HAVE_SP_RSA || WOLFSSL_HAVE_SP_DH */
|
||||
/* Conditionally subtract b from a using the mask m.
|
||||
* m is -1 to subtract and 0 when not copying.
|
||||
*
|
||||
@ -16268,7 +16264,7 @@ static WC_INLINE int sp_3072_mod_96_cond(sp_digit* r, sp_digit* a, sp_digit* m)
|
||||
return sp_3072_div_96_cond(a, m, NULL, r);
|
||||
}
|
||||
|
||||
#if (defined(SP_RSA_PRIVATE_EXP_D) && !defined(WOLFSSL_RSA_PUBLIC_ONLY)) || \
|
||||
#if (defined(WOLFSSL_HAVE_SP_RSA) && !defined(WOLFSSL_RSA_PUBLIC_ONLY)) || \
|
||||
defined(WOLFSSL_HAVE_SP_DH)
|
||||
#ifdef WOLFSSL_SP_SMALL
|
||||
/* Modular exponentiate a to the e mod m. (r = a^e mod m)
|
||||
@ -16542,7 +16538,7 @@ static int sp_3072_mod_exp_96(sp_digit* r, sp_digit* a, sp_digit* e,
|
||||
return err;
|
||||
}
|
||||
#endif /* WOLFSSL_SP_SMALL */
|
||||
#endif /* (SP_RSA_PRIVATE_EXP_D && !WOLFSSL_RSA_PUBLIC_ONLY) || WOLFSSL_HAVE_SP_DH */
|
||||
#endif /* (WOLFSSL_HAVE_SP_RSA && !WOLFSSL_RSA_PUBLIC_ONLY) || WOLFSSL_HAVE_SP_DH */
|
||||
|
||||
#ifdef WOLFSSL_HAVE_SP_RSA
|
||||
/* RSA public key operation.
|
||||
|
@ -39,10 +39,6 @@
|
||||
defined(WOLFSSL_HAVE_SP_ECC)
|
||||
|
||||
#ifdef RSA_LOW_MEM
|
||||
#ifndef SP_RSA_PRIVATE_EXP_D
|
||||
#define SP_RSA_PRIVATE_EXP_D
|
||||
#endif
|
||||
|
||||
#ifndef WOLFSSL_SP_SMALL
|
||||
#define WOLFSSL_SP_SMALL
|
||||
#endif
|
||||
@ -3304,7 +3300,7 @@ static int sp_2048_mod_exp_16(sp_digit* r, sp_digit* a, sp_digit* e,
|
||||
|
||||
#endif /* (WOLFSSL_HAVE_SP_RSA || WOLFSSL_HAVE_SP_DH) && !WOLFSSL_RSA_PUBLIC_ONLY */
|
||||
|
||||
#ifdef WOLFSSL_HAVE_SP_DH
|
||||
#if defined(WOLFSSL_HAVE_SP_RSA) || defined(WOLFSSL_HAVE_SP_DH)
|
||||
/* r = 2^n mod m where n is the number of bits to reduce by.
|
||||
* Given m must be 2048 bits, just need to subtract.
|
||||
*
|
||||
@ -3319,7 +3315,7 @@ static void sp_2048_mont_norm_32(sp_digit* r, sp_digit* m)
|
||||
sp_2048_sub_in_place_32(r, m);
|
||||
}
|
||||
|
||||
#endif /* WOLFSSL_HAVE_SP_DH */
|
||||
#endif /* WOLFSSL_HAVE_SP_RSA || WOLFSSL_HAVE_SP_DH */
|
||||
/* Conditionally subtract b from a using the mask m.
|
||||
* m is -1 to subtract and 0 when not copying.
|
||||
*
|
||||
@ -4393,7 +4389,7 @@ static WC_INLINE int sp_2048_mod_32_cond(sp_digit* r, sp_digit* a, sp_digit* m)
|
||||
return sp_2048_div_32_cond(a, m, NULL, r);
|
||||
}
|
||||
|
||||
#if (defined(SP_RSA_PRIVATE_EXP_D) && !defined(WOLFSSL_RSA_PUBLIC_ONLY)) || \
|
||||
#if (defined(WOLFSSL_HAVE_SP_RSA) && !defined(WOLFSSL_RSA_PUBLIC_ONLY)) || \
|
||||
defined(WOLFSSL_HAVE_SP_DH)
|
||||
#ifdef WOLFSSL_SP_SMALL
|
||||
/* Modular exponentiate a to the e mod m. (r = a^e mod m)
|
||||
@ -4667,7 +4663,7 @@ static int sp_2048_mod_exp_32(sp_digit* r, sp_digit* a, sp_digit* e,
|
||||
return err;
|
||||
}
|
||||
#endif /* WOLFSSL_SP_SMALL */
|
||||
#endif /* (SP_RSA_PRIVATE_EXP_D && !WOLFSSL_RSA_PUBLIC_ONLY) || WOLFSSL_HAVE_SP_DH */
|
||||
#endif /* (WOLFSSL_HAVE_SP_RSA && !WOLFSSL_RSA_PUBLIC_ONLY) || WOLFSSL_HAVE_SP_DH */
|
||||
|
||||
#ifdef WOLFSSL_HAVE_SP_RSA
|
||||
/* RSA public key operation.
|
||||
@ -9972,7 +9968,7 @@ static int sp_3072_mod_exp_24(sp_digit* r, sp_digit* a, sp_digit* e,
|
||||
|
||||
#endif /* (WOLFSSL_HAVE_SP_RSA || WOLFSSL_HAVE_SP_DH) && !WOLFSSL_RSA_PUBLIC_ONLY */
|
||||
|
||||
#ifdef WOLFSSL_HAVE_SP_DH
|
||||
#if defined(WOLFSSL_HAVE_SP_RSA) || defined(WOLFSSL_HAVE_SP_DH)
|
||||
/* r = 2^n mod m where n is the number of bits to reduce by.
|
||||
* Given m must be 3072 bits, just need to subtract.
|
||||
*
|
||||
@ -9987,7 +9983,7 @@ static void sp_3072_mont_norm_48(sp_digit* r, sp_digit* m)
|
||||
sp_3072_sub_in_place_48(r, m);
|
||||
}
|
||||
|
||||
#endif /* WOLFSSL_HAVE_SP_DH */
|
||||
#endif /* WOLFSSL_HAVE_SP_RSA || WOLFSSL_HAVE_SP_DH */
|
||||
/* Conditionally subtract b from a using the mask m.
|
||||
* m is -1 to subtract and 0 when not copying.
|
||||
*
|
||||
@ -11429,7 +11425,7 @@ static WC_INLINE int sp_3072_mod_48_cond(sp_digit* r, sp_digit* a, sp_digit* m)
|
||||
return sp_3072_div_48_cond(a, m, NULL, r);
|
||||
}
|
||||
|
||||
#if (defined(SP_RSA_PRIVATE_EXP_D) && !defined(WOLFSSL_RSA_PUBLIC_ONLY)) || \
|
||||
#if (defined(WOLFSSL_HAVE_SP_RSA) && !defined(WOLFSSL_RSA_PUBLIC_ONLY)) || \
|
||||
defined(WOLFSSL_HAVE_SP_DH)
|
||||
#ifdef WOLFSSL_SP_SMALL
|
||||
/* Modular exponentiate a to the e mod m. (r = a^e mod m)
|
||||
@ -11703,7 +11699,7 @@ static int sp_3072_mod_exp_48(sp_digit* r, sp_digit* a, sp_digit* e,
|
||||
return err;
|
||||
}
|
||||
#endif /* WOLFSSL_SP_SMALL */
|
||||
#endif /* (SP_RSA_PRIVATE_EXP_D && !WOLFSSL_RSA_PUBLIC_ONLY) || WOLFSSL_HAVE_SP_DH */
|
||||
#endif /* (WOLFSSL_HAVE_SP_RSA && !WOLFSSL_RSA_PUBLIC_ONLY) || WOLFSSL_HAVE_SP_DH */
|
||||
|
||||
#ifdef WOLFSSL_HAVE_SP_RSA
|
||||
/* RSA public key operation.
|
||||
|
@ -39,10 +39,6 @@
|
||||
defined(WOLFSSL_HAVE_SP_ECC)
|
||||
|
||||
#ifdef RSA_LOW_MEM
|
||||
#ifndef SP_RSA_PRIVATE_EXP_D
|
||||
#define SP_RSA_PRIVATE_EXP_D
|
||||
#endif
|
||||
|
||||
#ifndef WOLFSSL_SP_SMALL
|
||||
#define WOLFSSL_SP_SMALL
|
||||
#endif
|
||||
@ -3365,7 +3361,7 @@ static int sp_2048_mod_exp_32(sp_digit* r, sp_digit* a, sp_digit* e,
|
||||
|
||||
#endif /* (WOLFSSL_HAVE_SP_RSA || WOLFSSL_HAVE_SP_DH) && !WOLFSSL_RSA_PUBLIC_ONLY */
|
||||
|
||||
#ifdef WOLFSSL_HAVE_SP_DH
|
||||
#if defined(WOLFSSL_HAVE_SP_RSA) || defined(WOLFSSL_HAVE_SP_DH)
|
||||
/* r = 2^n mod m where n is the number of bits to reduce by.
|
||||
* Given m must be 2048 bits, just need to subtract.
|
||||
*
|
||||
@ -3380,7 +3376,7 @@ static void sp_2048_mont_norm_64(sp_digit* r, sp_digit* m)
|
||||
sp_2048_sub_in_place_64(r, m);
|
||||
}
|
||||
|
||||
#endif /* WOLFSSL_HAVE_SP_DH */
|
||||
#endif /* WOLFSSL_HAVE_SP_RSA || WOLFSSL_HAVE_SP_DH */
|
||||
/* Conditionally subtract b from a using the mask m.
|
||||
* m is -1 to subtract and 0 when not copying.
|
||||
*
|
||||
@ -3909,7 +3905,7 @@ static WC_INLINE int sp_2048_mod_64_cond(sp_digit* r, sp_digit* a, sp_digit* m)
|
||||
return sp_2048_div_64_cond(a, m, NULL, r);
|
||||
}
|
||||
|
||||
#if (defined(SP_RSA_PRIVATE_EXP_D) && !defined(WOLFSSL_RSA_PUBLIC_ONLY)) || \
|
||||
#if (defined(WOLFSSL_HAVE_SP_RSA) && !defined(WOLFSSL_RSA_PUBLIC_ONLY)) || \
|
||||
defined(WOLFSSL_HAVE_SP_DH)
|
||||
#ifdef WOLFSSL_SP_SMALL
|
||||
/* Modular exponentiate a to the e mod m. (r = a^e mod m)
|
||||
@ -4183,7 +4179,7 @@ static int sp_2048_mod_exp_64(sp_digit* r, sp_digit* a, sp_digit* e,
|
||||
return err;
|
||||
}
|
||||
#endif /* WOLFSSL_SP_SMALL */
|
||||
#endif /* (SP_RSA_PRIVATE_EXP_D && !WOLFSSL_RSA_PUBLIC_ONLY) || WOLFSSL_HAVE_SP_DH */
|
||||
#endif /* (WOLFSSL_HAVE_SP_RSA && !WOLFSSL_RSA_PUBLIC_ONLY) || WOLFSSL_HAVE_SP_DH */
|
||||
|
||||
#ifdef WOLFSSL_HAVE_SP_RSA
|
||||
/* RSA public key operation.
|
||||
@ -8671,7 +8667,7 @@ static int sp_3072_mod_exp_48(sp_digit* r, sp_digit* a, sp_digit* e,
|
||||
|
||||
#endif /* (WOLFSSL_HAVE_SP_RSA || WOLFSSL_HAVE_SP_DH) && !WOLFSSL_RSA_PUBLIC_ONLY */
|
||||
|
||||
#ifdef WOLFSSL_HAVE_SP_DH
|
||||
#if defined(WOLFSSL_HAVE_SP_RSA) || defined(WOLFSSL_HAVE_SP_DH)
|
||||
/* r = 2^n mod m where n is the number of bits to reduce by.
|
||||
* Given m must be 3072 bits, just need to subtract.
|
||||
*
|
||||
@ -8686,7 +8682,7 @@ static void sp_3072_mont_norm_96(sp_digit* r, sp_digit* m)
|
||||
sp_3072_sub_in_place_96(r, m);
|
||||
}
|
||||
|
||||
#endif /* WOLFSSL_HAVE_SP_DH */
|
||||
#endif /* WOLFSSL_HAVE_SP_RSA || WOLFSSL_HAVE_SP_DH */
|
||||
/* Conditionally subtract b from a using the mask m.
|
||||
* m is -1 to subtract and 0 when not copying.
|
||||
*
|
||||
@ -9221,7 +9217,7 @@ static WC_INLINE int sp_3072_mod_96_cond(sp_digit* r, sp_digit* a, sp_digit* m)
|
||||
return sp_3072_div_96_cond(a, m, NULL, r);
|
||||
}
|
||||
|
||||
#if (defined(SP_RSA_PRIVATE_EXP_D) && !defined(WOLFSSL_RSA_PUBLIC_ONLY)) || \
|
||||
#if (defined(WOLFSSL_HAVE_SP_RSA) && !defined(WOLFSSL_RSA_PUBLIC_ONLY)) || \
|
||||
defined(WOLFSSL_HAVE_SP_DH)
|
||||
#ifdef WOLFSSL_SP_SMALL
|
||||
/* Modular exponentiate a to the e mod m. (r = a^e mod m)
|
||||
@ -9495,7 +9491,7 @@ static int sp_3072_mod_exp_96(sp_digit* r, sp_digit* a, sp_digit* e,
|
||||
return err;
|
||||
}
|
||||
#endif /* WOLFSSL_SP_SMALL */
|
||||
#endif /* (SP_RSA_PRIVATE_EXP_D && !WOLFSSL_RSA_PUBLIC_ONLY) || WOLFSSL_HAVE_SP_DH */
|
||||
#endif /* (WOLFSSL_HAVE_SP_RSA && !WOLFSSL_RSA_PUBLIC_ONLY) || WOLFSSL_HAVE_SP_DH */
|
||||
|
||||
#ifdef WOLFSSL_HAVE_SP_RSA
|
||||
/* RSA public key operation.
|
||||
|
@ -3682,7 +3682,6 @@ static void sp_2048_mont_norm_64(sp_digit* r, sp_digit* m)
|
||||
}
|
||||
|
||||
#endif /* WOLFSSL_HAVE_SP_RSA || WOLFSSL_HAVE_SP_DH */
|
||||
|
||||
/* Conditionally subtract b from a using the mask m.
|
||||
* m is -1 to subtract and 0 when not copying.
|
||||
*
|
||||
@ -4070,7 +4069,7 @@ static WC_INLINE int sp_2048_mod_64_cond(sp_digit* r, sp_digit* a, sp_digit* m)
|
||||
}
|
||||
|
||||
#if (defined(WOLFSSL_HAVE_SP_RSA) && !defined(WOLFSSL_RSA_PUBLIC_ONLY)) || \
|
||||
defined(WOLFSSL_HAVE_SP_DH)
|
||||
defined(WOLFSSL_HAVE_SP_DH)
|
||||
#ifdef WOLFSSL_SP_SMALL
|
||||
/* Modular exponentiate a to the e mod m. (r = a^e mod m)
|
||||
*
|
||||
@ -9131,8 +9130,7 @@ static int sp_3072_mod_exp_48(sp_digit* r, sp_digit* a, sp_digit* e,
|
||||
|
||||
#endif /* (WOLFSSL_HAVE_SP_RSA || WOLFSSL_HAVE_SP_DH) && !WOLFSSL_RSA_PUBLIC_ONLY */
|
||||
|
||||
#if (defined(WOLFSSL_HAVE_SP_RSA) && !defined(WOLFSSL_RSA_PUBLIC_ONLY)) || \
|
||||
defined(WOLFSSL_HAVE_SP_DH)
|
||||
#if defined(WOLFSSL_HAVE_SP_RSA) || defined(WOLFSSL_HAVE_SP_DH)
|
||||
/* r = 2^n mod m where n is the number of bits to reduce by.
|
||||
* Given m must be 3072 bits, just need to subtract.
|
||||
*
|
||||
@ -9147,9 +9145,7 @@ static void sp_3072_mont_norm_96(sp_digit* r, sp_digit* m)
|
||||
sp_3072_sub_in_place_96(r, m);
|
||||
}
|
||||
|
||||
#endif /* (WOLFSSL_HAVE_SP_RSA && !WOLFSSL_RSA_PUBLIC_ONLY) || WOLFSSL_HAVE_SP_DH */
|
||||
|
||||
|
||||
#endif /* WOLFSSL_HAVE_SP_RSA || WOLFSSL_HAVE_SP_DH */
|
||||
/* Conditionally subtract b from a using the mask m.
|
||||
* m is -1 to subtract and 0 when not copying.
|
||||
*
|
||||
|
@ -39,10 +39,6 @@
|
||||
defined(WOLFSSL_HAVE_SP_ECC)
|
||||
|
||||
#ifdef RSA_LOW_MEM
|
||||
#ifndef SP_RSA_PRIVATE_EXP_D
|
||||
#define SP_RSA_PRIVATE_EXP_D
|
||||
#endif
|
||||
|
||||
#ifndef WOLFSSL_SP_SMALL
|
||||
#define WOLFSSL_SP_SMALL
|
||||
#endif
|
||||
@ -820,7 +816,7 @@ static int sp_2048_mod_exp_avx2_16(sp_digit* r, sp_digit* a, sp_digit* e,
|
||||
|
||||
#endif /* (WOLFSSL_HAVE_SP_RSA || WOLFSSL_HAVE_SP_DH) && !WOLFSSL_RSA_PUBLIC_ONLY */
|
||||
|
||||
#ifdef WOLFSSL_HAVE_SP_DH
|
||||
#if defined(WOLFSSL_HAVE_SP_RSA) || defined(WOLFSSL_HAVE_SP_DH)
|
||||
/* r = 2^n mod m where n is the number of bits to reduce by.
|
||||
* Given m must be 2048 bits, just need to subtract.
|
||||
*
|
||||
@ -835,7 +831,7 @@ static void sp_2048_mont_norm_32(sp_digit* r, sp_digit* m)
|
||||
sp_2048_sub_in_place_32(r, m);
|
||||
}
|
||||
|
||||
#endif /* WOLFSSL_HAVE_SP_DH */
|
||||
#endif /* WOLFSSL_HAVE_SP_RSA || WOLFSSL_HAVE_SP_DH */
|
||||
extern sp_digit sp_2048_cond_sub_32(sp_digit* r, sp_digit* a, sp_digit* b, sp_digit m);
|
||||
extern void sp_2048_mont_reduce_32(sp_digit* a, sp_digit* m, sp_digit mp);
|
||||
/* Multiply two Montogmery form numbers mod the modulus (prime).
|
||||
@ -1037,7 +1033,7 @@ static WC_INLINE int sp_2048_mod_32_cond(sp_digit* r, sp_digit* a, sp_digit* m)
|
||||
return sp_2048_div_32_cond(a, m, NULL, r);
|
||||
}
|
||||
|
||||
#if (defined(SP_RSA_PRIVATE_EXP_D) && !defined(WOLFSSL_RSA_PUBLIC_ONLY)) || defined(WOLFSSL_HAVE_SP_DH)
|
||||
#if (defined(WOLFSSL_HAVE_SP_RSA) && !defined(WOLFSSL_RSA_PUBLIC_ONLY)) || defined(WOLFSSL_HAVE_SP_DH)
|
||||
/* Modular exponentiate a to the e mod m. (r = a^e mod m)
|
||||
*
|
||||
* r A single precision number that is the result of the operation.
|
||||
@ -1181,7 +1177,7 @@ static int sp_2048_mod_exp_32(sp_digit* r, sp_digit* a, sp_digit* e,
|
||||
|
||||
return err;
|
||||
}
|
||||
#endif /* (SP_RSA_PRIVATE_EXP_D && !WOLFSSL_RSA_PUBLIC_ONLY) || WOLFSSL_HAVE_SP_DH */
|
||||
#endif /* (WOLFSSL_HAVE_SP_RSA && !WOLFSSL_RSA_PUBLIC_ONLY) || WOLFSSL_HAVE_SP_DH */
|
||||
|
||||
extern void sp_2048_mont_reduce_avx2_32(sp_digit* a, sp_digit* m, sp_digit mp);
|
||||
#ifdef HAVE_INTEL_AVX2
|
||||
@ -1218,7 +1214,7 @@ static void sp_2048_mont_sqr_avx2_32(sp_digit* r, sp_digit* a, sp_digit* m,
|
||||
}
|
||||
|
||||
#endif /* HAVE_INTEL_AVX2 */
|
||||
#if (defined(SP_RSA_PRIVATE_EXP_D) && !defined(WOLFSSL_RSA_PUBLIC_ONLY)) || defined(WOLFSSL_HAVE_SP_DH)
|
||||
#if (defined(WOLFSSL_HAVE_SP_RSA) && !defined(WOLFSSL_RSA_PUBLIC_ONLY)) || defined(WOLFSSL_HAVE_SP_DH)
|
||||
#ifdef HAVE_INTEL_AVX2
|
||||
/* Modular exponentiate a to the e mod m. (r = a^e mod m)
|
||||
*
|
||||
@ -1364,7 +1360,7 @@ static int sp_2048_mod_exp_avx2_32(sp_digit* r, sp_digit* a, sp_digit* e,
|
||||
return err;
|
||||
}
|
||||
#endif /* HAVE_INTEL_AVX2 */
|
||||
#endif /* (SP_RSA_PRIVATE_EXP_D && !WOLFSSL_RSA_PUBLIC_ONLY) || WOLFSSL_HAVE_SP_DH */
|
||||
#endif /* (WOLFSSL_HAVE_SP_RSA && !WOLFSSL_RSA_PUBLIC_ONLY) || WOLFSSL_HAVE_SP_DH */
|
||||
|
||||
#ifdef WOLFSSL_HAVE_SP_RSA
|
||||
/* RSA public key operation.
|
||||
@ -2652,7 +2648,7 @@ static int sp_3072_mod_exp_avx2_24(sp_digit* r, sp_digit* a, sp_digit* e,
|
||||
|
||||
#endif /* (WOLFSSL_HAVE_SP_RSA || WOLFSSL_HAVE_SP_DH) && !WOLFSSL_RSA_PUBLIC_ONLY */
|
||||
|
||||
#ifdef WOLFSSL_HAVE_SP_DH
|
||||
#if defined(WOLFSSL_HAVE_SP_RSA) || defined(WOLFSSL_HAVE_SP_DH)
|
||||
/* r = 2^n mod m where n is the number of bits to reduce by.
|
||||
* Given m must be 3072 bits, just need to subtract.
|
||||
*
|
||||
@ -2667,7 +2663,7 @@ static void sp_3072_mont_norm_48(sp_digit* r, sp_digit* m)
|
||||
sp_3072_sub_in_place_48(r, m);
|
||||
}
|
||||
|
||||
#endif /* WOLFSSL_HAVE_SP_DH */
|
||||
#endif /* WOLFSSL_HAVE_SP_RSA || WOLFSSL_HAVE_SP_DH */
|
||||
extern sp_digit sp_3072_cond_sub_48(sp_digit* r, sp_digit* a, sp_digit* b, sp_digit m);
|
||||
extern void sp_3072_mont_reduce_48(sp_digit* a, sp_digit* m, sp_digit mp);
|
||||
/* Multiply two Montogmery form numbers mod the modulus (prime).
|
||||
@ -2869,7 +2865,7 @@ static WC_INLINE int sp_3072_mod_48_cond(sp_digit* r, sp_digit* a, sp_digit* m)
|
||||
return sp_3072_div_48_cond(a, m, NULL, r);
|
||||
}
|
||||
|
||||
#if (defined(SP_RSA_PRIVATE_EXP_D) && !defined(WOLFSSL_RSA_PUBLIC_ONLY)) || defined(WOLFSSL_HAVE_SP_DH)
|
||||
#if (defined(WOLFSSL_HAVE_SP_RSA) && !defined(WOLFSSL_RSA_PUBLIC_ONLY)) || defined(WOLFSSL_HAVE_SP_DH)
|
||||
/* Modular exponentiate a to the e mod m. (r = a^e mod m)
|
||||
*
|
||||
* r A single precision number that is the result of the operation.
|
||||
@ -3013,7 +3009,7 @@ static int sp_3072_mod_exp_48(sp_digit* r, sp_digit* a, sp_digit* e,
|
||||
|
||||
return err;
|
||||
}
|
||||
#endif /* (SP_RSA_PRIVATE_EXP_D && !WOLFSSL_RSA_PUBLIC_ONLY) || WOLFSSL_HAVE_SP_DH */
|
||||
#endif /* (WOLFSSL_HAVE_SP_RSA && !WOLFSSL_RSA_PUBLIC_ONLY) || WOLFSSL_HAVE_SP_DH */
|
||||
|
||||
extern void sp_3072_mont_reduce_avx2_48(sp_digit* a, sp_digit* m, sp_digit mp);
|
||||
#ifdef HAVE_INTEL_AVX2
|
||||
@ -3050,7 +3046,7 @@ static void sp_3072_mont_sqr_avx2_48(sp_digit* r, sp_digit* a, sp_digit* m,
|
||||
}
|
||||
|
||||
#endif /* HAVE_INTEL_AVX2 */
|
||||
#if (defined(SP_RSA_PRIVATE_EXP_D) && !defined(WOLFSSL_RSA_PUBLIC_ONLY)) || defined(WOLFSSL_HAVE_SP_DH)
|
||||
#if (defined(WOLFSSL_HAVE_SP_RSA) && !defined(WOLFSSL_RSA_PUBLIC_ONLY)) || defined(WOLFSSL_HAVE_SP_DH)
|
||||
#ifdef HAVE_INTEL_AVX2
|
||||
/* Modular exponentiate a to the e mod m. (r = a^e mod m)
|
||||
*
|
||||
@ -3196,7 +3192,7 @@ static int sp_3072_mod_exp_avx2_48(sp_digit* r, sp_digit* a, sp_digit* e,
|
||||
return err;
|
||||
}
|
||||
#endif /* HAVE_INTEL_AVX2 */
|
||||
#endif /* (SP_RSA_PRIVATE_EXP_D && !WOLFSSL_RSA_PUBLIC_ONLY) || WOLFSSL_HAVE_SP_DH */
|
||||
#endif /* (WOLFSSL_HAVE_SP_RSA && !WOLFSSL_RSA_PUBLIC_ONLY) || WOLFSSL_HAVE_SP_DH */
|
||||
|
||||
#ifdef WOLFSSL_HAVE_SP_RSA
|
||||
/* RSA public key operation.
|
||||
|
Loading…
x
Reference in New Issue
Block a user