Checks mbedtls_rsa_export return in fuzz targets

This commit is contained in:
Philippe Antoine 2020-01-22 13:54:56 +01:00
parent dbcb44202c
commit 66070bc19d
2 changed files with 6 additions and 2 deletions

View File

@ -29,7 +29,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
mbedtls_mpi_init( &DQ ); mbedtls_mpi_init( &QP );
rsa = mbedtls_pk_rsa( pk );
mbedtls_rsa_export( rsa, &N, &P, &Q, &D, &E );
if ( mbedtls_rsa_export( rsa, &N, &P, &Q, &D, &E ) != 0 ) {
abort();
}
mbedtls_rsa_export_crt( rsa, &DP, &DQ, &QP );
mbedtls_mpi_free( &N ); mbedtls_mpi_free( &P ); mbedtls_mpi_free( &Q );

View File

@ -20,7 +20,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
mbedtls_mpi_init( &DQ ); mbedtls_mpi_init( &QP );
rsa = mbedtls_pk_rsa( pk );
ret = mbedtls_rsa_export( rsa, &N, &P, &Q, &D, &E );
if ( mbedtls_rsa_export( rsa, &N, &P, &Q, &D, &E ) != 0 ) {
abort();
}
ret = mbedtls_rsa_export_crt( rsa, &DP, &DQ, &QP );
mbedtls_mpi_free( &N ); mbedtls_mpi_free( &P ); mbedtls_mpi_free( &Q );