Merge pull request #7857 from minosgalanakis/bugifx/address_curve_bits

[BigNum] test_suite_ecp: Fixed curve bit-length.
This commit is contained in:
Paul Elliott 2023-08-31 13:14:11 +00:00 committed by GitHub
commit b5d97156e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1324,8 +1324,8 @@ void ecp_mod_p_generic_raw(int curve_id,
#endif
#if defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED) && defined(MBEDTLS_ECP_NIST_OPTIM)
case MBEDTLS_ECP_DP_SECP521R1:
limbs = BITS_TO_LIMBS(522) * 2;
curve_bits = 522;
limbs = BITS_TO_LIMBS(521) * 2;
curve_bits = 521;
curve_func = &mbedtls_ecp_mod_p521_raw;
break;
#endif
@ -1377,8 +1377,8 @@ void ecp_mod_p_generic_raw(int curve_id,
TEST_EQUAL((*curve_func)(X, limbs_X), 0);
TEST_LE_U(mbedtls_mpi_core_bitlen(X, limbs_X), curve_bits);
mbedtls_mpi_mod_raw_fix_quasi_reduction(X, &m);
TEST_LE_U(mbedtls_mpi_core_bitlen(X, limbs_X), curve_bits);
TEST_MEMORY_COMPARE(X, bytes, res, bytes);
exit: