Skip to content

Commit

Permalink
libmedtls: mpi_miller_rabin: increase count limit
Browse files Browse the repository at this point in the history
Increase the count limit when generating the witness in the Rabin-Miller
primality test. The previous number 30 was too low to reliably detect
000000022770A7DC599BC90B2FF981CCB5CF05703344C8F350418AAD as a prime
number.

Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
[jf: rebased onto mbedtls-2.22.0]
[jf: rebased onto mbedtls-2.27.0]
Signed-off-by: Jerome Forissier <jerome@forissier.org>
  • Loading branch information
jenswi-linaro authored and jforissier committed Aug 9, 2022
1 parent 37284e2 commit 8acd202
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/libmbedtls/mbedtls/library/bignum.c
Expand Up @@ -2747,7 +2747,7 @@ static int mpi_miller_rabin( const mbedtls_mpi *X, size_t rounds,
A.p[A.n - 1] &= ( (mbedtls_mpi_uint) 1 << ( k - ( A.n - 1 ) * biL - 1 ) ) - 1;
}

if (count++ > 30) {
if (count++ > 300) {
ret = MBEDTLS_ERR_MPI_NOT_ACCEPTABLE;
goto cleanup;
}
Expand Down

0 comments on commit 8acd202

Please sign in to comment.