mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-01-10 23:35:37 +00:00
Bignum: Add test for improved prime generation
This commit is contained in:
parent
f301d23ceb
commit
a3cb7eb8ad
|
@ -708,6 +708,18 @@ Test mbedtls_mpi_gen_prime (Safe)
|
|||
depends_on:MBEDTLS_GENPRIME
|
||||
mbedtls_mpi_gen_prime:128:MBEDTLS_MPI_GEN_PRIME_FLAG_DH:0
|
||||
|
||||
Test mbedtls_mpi_gen_prime (Safe with lower error rate)
|
||||
depends_on:MBEDTLS_GENPRIME
|
||||
mbedtls_mpi_gen_prime:128:MBEDTLS_MPI_GEN_PRIME_FLAG_DH | MBEDTLS_MPI_GEN_PRIME_FLAG_LOW_ERR:0
|
||||
|
||||
Test mbedtls_mpi_gen_prime standard RSA #1 (lower error rate)
|
||||
depends_on:MBEDTLS_GENPRIME
|
||||
mbedtls_mpi_gen_prime:1024:MBEDTLS_MPI_GEN_PRIME_FLAG_LOW_ERR:0
|
||||
|
||||
Test mbedtls_mpi_gen_prime standard RSA #2 (lower error rate)
|
||||
depends_on:MBEDTLS_GENPRIME
|
||||
mbedtls_mpi_gen_prime:1536:MBEDTLS_MPI_GEN_PRIME_FLAG_LOW_ERR:0
|
||||
|
||||
Test bit getting (Value bit 25)
|
||||
mbedtls_mpi_get_bit:10:"49979687":25:1
|
||||
|
||||
|
|
|
@ -809,14 +809,14 @@ exit:
|
|||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_GENPRIME */
|
||||
void mbedtls_mpi_gen_prime( int bits, int safe, int ref_ret )
|
||||
void mbedtls_mpi_gen_prime( int bits, int flags, int ref_ret )
|
||||
{
|
||||
mbedtls_mpi X;
|
||||
int my_ret;
|
||||
|
||||
mbedtls_mpi_init( &X );
|
||||
|
||||
my_ret = mbedtls_mpi_gen_prime( &X, bits, safe, rnd_std_rand, NULL );
|
||||
my_ret = mbedtls_mpi_gen_prime( &X, bits, flags, rnd_std_rand, NULL );
|
||||
TEST_ASSERT( my_ret == ref_ret );
|
||||
|
||||
if( ref_ret == 0 )
|
||||
|
@ -827,7 +827,7 @@ void mbedtls_mpi_gen_prime( int bits, int safe, int ref_ret )
|
|||
TEST_ASSERT( actual_bits <= (size_t) bits + 1 );
|
||||
|
||||
TEST_ASSERT( mbedtls_mpi_is_prime( &X, rnd_std_rand, NULL ) == 0 );
|
||||
if( safe )
|
||||
if( flags & MBEDTLS_MPI_GEN_PRIME_FLAG_DH )
|
||||
{
|
||||
/* X = ( X - 1 ) / 2 */
|
||||
TEST_ASSERT( mbedtls_mpi_shift_r( &X, 1 ) == 0 );
|
||||
|
|
Loading…
Reference in a new issue