Adds test for odd bit length RSA key size
Also tidy up ChangeLog following review.
This commit is contained in:
parent
10c575be3e
commit
3f5c875654
3 changed files with 13 additions and 3 deletions
library
|
@ -117,11 +117,15 @@ int mbedtls_rsa_gen_key( mbedtls_rsa_context *ctx,
|
|||
f_rng, p_rng ) );
|
||||
|
||||
if( nbits % 2 )
|
||||
{
|
||||
MBEDTLS_MPI_CHK( mbedtls_mpi_gen_prime( &ctx->Q, ( nbits >> 1 ) + 1, 0,
|
||||
f_rng, p_rng ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
MBEDTLS_MPI_CHK( mbedtls_mpi_gen_prime( &ctx->Q, nbits >> 1, 0,
|
||||
f_rng, p_rng ) );
|
||||
}
|
||||
|
||||
if( mbedtls_mpi_cmp_mpi( &ctx->P, &ctx->Q ) == 0 )
|
||||
continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue