mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2025-12-21 21:36:21 +01:00
Add early detection of bad parameters in mbedtls_deduce_primes
This commit is contained in:
parent
a565f54c4c
commit
14a00c0578
1 changed files with 5 additions and 0 deletions
|
|
@ -169,6 +169,11 @@ int mbedtls_rsa_deduce_primes( mbedtls_mpi const *N,
|
||||||
MBEDTLS_MPI_CHK( mbedtls_mpi_mul_mpi( &K, &K, &K ) );
|
MBEDTLS_MPI_CHK( mbedtls_mpi_mul_mpi( &K, &K, &K ) );
|
||||||
MBEDTLS_MPI_CHK( mbedtls_mpi_mod_mpi( &K, &K, N ) );
|
MBEDTLS_MPI_CHK( mbedtls_mpi_mod_mpi( &K, &K, N ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( mbedtls_mpi_cmp_int( &K, 1 ) != 0 )
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = MBEDTLS_ERR_MPI_BAD_INPUT_DATA;
|
ret = MBEDTLS_ERR_MPI_BAD_INPUT_DATA;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue