diff --git a/library/rsa.c b/library/rsa.c index b0ba1eb2c..408ceb122 100644 --- a/library/rsa.c +++ b/library/rsa.c @@ -325,7 +325,8 @@ int mbedtls_rsa_validate_crt( const mbedtls_mpi *P, const mbedtls_mpi *Q, if( mbedtls_mpi_cmp_int( &L, 0 ) != 0 ) { - return( MBEDTLS_ERR_RSA_KEY_CHECK_FAILED ); + ret = MBEDTLS_ERR_RSA_KEY_CHECK_FAILED; + goto cleanup; } } @@ -344,7 +345,8 @@ int mbedtls_rsa_validate_crt( const mbedtls_mpi *P, const mbedtls_mpi *Q, if( mbedtls_mpi_cmp_int( &L, 0 ) != 0 ) { - return( MBEDTLS_ERR_RSA_KEY_CHECK_FAILED ); + ret = MBEDTLS_ERR_RSA_KEY_CHECK_FAILED; + goto cleanup; } } @@ -362,7 +364,8 @@ int mbedtls_rsa_validate_crt( const mbedtls_mpi *P, const mbedtls_mpi *Q, MBEDTLS_MPI_CHK( mbedtls_mpi_mod_mpi( &K, &K, P ) ); if( mbedtls_mpi_cmp_int( &K, 0 ) != 0 ) { - return( MBEDTLS_ERR_RSA_KEY_CHECK_FAILED ); + ret = MBEDTLS_ERR_RSA_KEY_CHECK_FAILED; + goto cleanup; } }