diff options
author | Aditya Deshpande <aditya.deshpande@arm.com> | 2022-11-22 17:55:53 +0000 |
---|---|---|
committer | Aditya Deshpande <aditya.deshpande@arm.com> | 2022-11-22 17:55:53 +0000 |
commit | 8cc1470c18cf37bafa78464191e0fd5f4ebcfc0c (patch) | |
tree | 2186b3dbea40d7116c351c3442f8e9035e93600b /tests/src | |
parent | 2f7fd76d9167cabb8d3adf349cfce19025ed6ed6 (diff) | |
parent | fd7aa13671c76dc9134eadd49b27e0e417fcd252 (diff) | |
download | mbedtls-8cc1470c18cf37bafa78464191e0fd5f4ebcfc0c.zip mbedtls-8cc1470c18cf37bafa78464191e0fd5f4ebcfc0c.tar.gz mbedtls-8cc1470c18cf37bafa78464191e0fd5f4ebcfc0c.tar.bz2 |
Merge branch 'development' into driver-wrapper-key-agreement
Diffstat (limited to 'tests/src')
-rw-r--r-- | tests/src/helpers.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/src/helpers.c b/tests/src/helpers.c index b7c8364..cc23fd7 100644 --- a/tests/src/helpers.c +++ b/tests/src/helpers.c @@ -357,8 +357,12 @@ int mbedtls_test_read_mpi_core( mbedtls_mpi_uint **pX, size_t *plimbs, size_t hex_len = strlen( input ); size_t byte_len = ( hex_len + 1 ) / 2; *plimbs = CHARS_TO_LIMBS( byte_len ); + + /* A core bignum is not allowed to be empty. Forbid it as test data, + * this way static analyzers have a chance of knowing we don't expect + * the bignum functions to support empty inputs. */ if( *plimbs == 0 ) - return( 0 ); + return( MBEDTLS_ERR_MPI_BAD_INPUT_DATA ); *pX = mbedtls_calloc( *plimbs, sizeof( **pX ) ); if( *pX == NULL ) |