Initialise psk_len in mbedtls_ssl_psk_derive_premaster()

Signed-off-by: Guilhem Bryant <Guilhem.Bryant@arm.com>
This commit is contained in:
Guilhem Bryant 2020-03-27 11:12:12 +00:00
parent 82194c888d
commit 61b0fe617e

View file

@ -1849,7 +1849,7 @@ int mbedtls_ssl_psk_derive_premaster( mbedtls_ssl_context *ssl, mbedtls_key_exch
unsigned char *p = ssl->handshake->premaster; unsigned char *p = ssl->handshake->premaster;
unsigned char *end = p + sizeof( ssl->handshake->premaster ); unsigned char *end = p + sizeof( ssl->handshake->premaster );
const unsigned char *psk; const unsigned char *psk;
size_t psk_len; size_t psk_len = 0;
if( mbedtls_ssl_get_psk( ssl, &psk, &psk_len ) if( mbedtls_ssl_get_psk( ssl, &psk, &psk_len )
== MBEDTLS_ERR_SSL_PRIVATE_KEY_REQUIRED ) == MBEDTLS_ERR_SSL_PRIVATE_KEY_REQUIRED )