mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-08 17:42:09 +03:00
Merge pull request #7864 from waleed-elmelegy-arm/enforce-min-RSA-key-size
Enforce minimum key size when generating RSA key size
This commit is contained in:
@@ -545,7 +545,12 @@ int mbedtls_rsa_gen_key(mbedtls_rsa_context *ctx,
|
||||
mbedtls_mpi_init(&G);
|
||||
mbedtls_mpi_init(&L);
|
||||
|
||||
if (nbits < 128 || exponent < 3 || nbits % 2 != 0) {
|
||||
if (exponent < 3 || nbits % 2 != 0) {
|
||||
ret = MBEDTLS_ERR_RSA_BAD_INPUT_DATA;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (nbits < MBEDTLS_RSA_GEN_KEY_MIN_BITS) {
|
||||
ret = MBEDTLS_ERR_RSA_BAD_INPUT_DATA;
|
||||
goto cleanup;
|
||||
}
|
||||
|
Reference in New Issue
Block a user