Mbed TLS is now part of TrustedFirmware.org.

Uninitialized value in mbedtls_mpi_read_binary implementation


Sep 11, 2017 08:54
Nikolay

Hello!

Here: https://github.com/ARMmbed/mbedtls/blob/development/library/bignum.c

in function mbedtls_mpi_read_binary

the variable "int ret" must be initialized as non-zero value, and before cleanup it should be set to zero.

 
Sep 11, 2017 10:35
Ron Eldor

HI Nikolay,
Thank you for your interest in Mbed TLS!
If you expand the MACRO MBEDTLS_MPI_CHK you would notice the following:

#define MBEDTLS_MPI_CHK(f) do { if( ( ret = f ) != 0 ) goto cleanup; } while( 0 )

This means, that ret will always be assigned a value before it is returned to the caller.
Regards,
Mbed TLS Team member
Ron

 
Sep 11, 2017 13:50
Nikolay

Oh, yes, sorry. Thanks.