|
@@ -23957,16 +23957,18 @@ static int sp_256_calc_vfy_point_4(sp_point_256* p1, sp_point_256* p2,
|
|
|
sp_256_mod_inv_4(s, s, p256_order);
|
|
|
}
|
|
|
#endif /* !WOLFSSL_SP_SMALL */
|
|
|
+ {
|
|
|
#ifdef HAVE_INTEL_AVX2
|
|
|
- if (IS_INTEL_BMI2(cpuid_flags) && IS_INTEL_ADX(cpuid_flags)) {
|
|
|
- sp_256_mul_avx2_4(s, s, p256_norm_order);
|
|
|
- }
|
|
|
- else
|
|
|
+ if (IS_INTEL_BMI2(cpuid_flags) && IS_INTEL_ADX(cpuid_flags)) {
|
|
|
+ sp_256_mul_avx2_4(s, s, p256_norm_order);
|
|
|
+ }
|
|
|
+ else
|
|
|
#endif
|
|
|
- {
|
|
|
- sp_256_mul_4(s, s, p256_norm_order);
|
|
|
+ {
|
|
|
+ sp_256_mul_4(s, s, p256_norm_order);
|
|
|
+ }
|
|
|
+ err = sp_256_mod_4(s, s, p256_order);
|
|
|
}
|
|
|
- err = sp_256_mod_4(s, s, p256_order);
|
|
|
if (err == MP_OKAY) {
|
|
|
sp_256_norm_4(s);
|
|
|
#ifdef WOLFSSL_SP_SMALL
|
|
@@ -23983,7 +23985,6 @@ static int sp_256_calc_vfy_point_4(sp_point_256* p1, sp_point_256* p2,
|
|
|
sp_256_mont_mul_order_4(u1, u1, s);
|
|
|
sp_256_mont_mul_order_4(u2, u2, s);
|
|
|
}
|
|
|
-
|
|
|
#else
|
|
|
#ifdef HAVE_INTEL_AVX2
|
|
|
if (IS_INTEL_BMI2(cpuid_flags) && IS_INTEL_ADX(cpuid_flags)) {
|
|
@@ -23996,14 +23997,16 @@ static int sp_256_calc_vfy_point_4(sp_point_256* p1, sp_point_256* p2,
|
|
|
sp_256_mont_mul_order_4(u1, u1, s);
|
|
|
sp_256_mont_mul_order_4(u2, u2, s);
|
|
|
}
|
|
|
-
|
|
|
#endif /* WOLFSSL_SP_SMALL */
|
|
|
#ifdef HAVE_INTEL_AVX2
|
|
|
- if (IS_INTEL_BMI2(cpuid_flags) && IS_INTEL_ADX(cpuid_flags))
|
|
|
+ if (IS_INTEL_BMI2(cpuid_flags) && IS_INTEL_ADX(cpuid_flags)) {
|
|
|
err = sp_256_ecc_mulmod_base_avx2_4(p1, u1, 0, 0, heap);
|
|
|
+ }
|
|
|
else
|
|
|
#endif
|
|
|
+ {
|
|
|
err = sp_256_ecc_mulmod_base_4(p1, u1, 0, 0, heap);
|
|
|
+ }
|
|
|
}
|
|
|
if ((err == MP_OKAY) && sp_256_iszero_4(p1->z)) {
|
|
|
p1->infinity = 1;
|
|
@@ -48535,20 +48538,21 @@ static int sp_384_calc_vfy_point_6(sp_point_384* p1, sp_point_384* p2,
|
|
|
#endif
|
|
|
|
|
|
#ifndef WOLFSSL_SP_SMALL
|
|
|
- {
|
|
|
- sp_384_mod_inv_6(s, s, p384_order);
|
|
|
- }
|
|
|
+ err = sp_384_mod_inv_6(s, s, p384_order);
|
|
|
+ if (err == MP_OKAY)
|
|
|
#endif /* !WOLFSSL_SP_SMALL */
|
|
|
+ {
|
|
|
#ifdef HAVE_INTEL_AVX2
|
|
|
- if (IS_INTEL_BMI2(cpuid_flags) && IS_INTEL_ADX(cpuid_flags)) {
|
|
|
- sp_384_mul_avx2_6(s, s, p384_norm_order);
|
|
|
- }
|
|
|
- else
|
|
|
+ if (IS_INTEL_BMI2(cpuid_flags) && IS_INTEL_ADX(cpuid_flags)) {
|
|
|
+ sp_384_mul_avx2_6(s, s, p384_norm_order);
|
|
|
+ }
|
|
|
+ else
|
|
|
#endif
|
|
|
- {
|
|
|
- sp_384_mul_6(s, s, p384_norm_order);
|
|
|
+ {
|
|
|
+ sp_384_mul_6(s, s, p384_norm_order);
|
|
|
+ }
|
|
|
+ err = sp_384_mod_6(s, s, p384_order);
|
|
|
}
|
|
|
- err = sp_384_mod_6(s, s, p384_order);
|
|
|
if (err == MP_OKAY) {
|
|
|
sp_384_norm_6(s);
|
|
|
#ifdef WOLFSSL_SP_SMALL
|
|
@@ -48565,7 +48569,6 @@ static int sp_384_calc_vfy_point_6(sp_point_384* p1, sp_point_384* p2,
|
|
|
sp_384_mont_mul_order_6(u1, u1, s);
|
|
|
sp_384_mont_mul_order_6(u2, u2, s);
|
|
|
}
|
|
|
-
|
|
|
#else
|
|
|
#ifdef HAVE_INTEL_AVX2
|
|
|
if (IS_INTEL_BMI2(cpuid_flags) && IS_INTEL_ADX(cpuid_flags)) {
|
|
@@ -48578,14 +48581,16 @@ static int sp_384_calc_vfy_point_6(sp_point_384* p1, sp_point_384* p2,
|
|
|
sp_384_mont_mul_order_6(u1, u1, s);
|
|
|
sp_384_mont_mul_order_6(u2, u2, s);
|
|
|
}
|
|
|
-
|
|
|
#endif /* WOLFSSL_SP_SMALL */
|
|
|
#ifdef HAVE_INTEL_AVX2
|
|
|
- if (IS_INTEL_BMI2(cpuid_flags) && IS_INTEL_ADX(cpuid_flags))
|
|
|
+ if (IS_INTEL_BMI2(cpuid_flags) && IS_INTEL_ADX(cpuid_flags)) {
|
|
|
err = sp_384_ecc_mulmod_base_avx2_6(p1, u1, 0, 0, heap);
|
|
|
+ }
|
|
|
else
|
|
|
#endif
|
|
|
+ {
|
|
|
err = sp_384_ecc_mulmod_base_6(p1, u1, 0, 0, heap);
|
|
|
+ }
|
|
|
}
|
|
|
if ((err == MP_OKAY) && sp_384_iszero_6(p1->z)) {
|
|
|
p1->infinity = 1;
|