Properly initialise psk and psk_len

Signed-off-by: Guilhem Bryant <Guilhem.Bryant@arm.com>
This commit is contained in:
Guilhem Bryant 2020-04-01 11:23:58 +01:00
parent 8a69ddd7ad
commit b5f04e4d84
2 changed files with 3 additions and 1 deletions

View file

@ -945,6 +945,8 @@ static inline int mbedtls_ssl_get_psk( const mbedtls_ssl_context *ssl,
else
{
*psk = NULL;
*psk_len = 0;
return( MBEDTLS_ERR_SSL_PRIVATE_KEY_REQUIRED );
}

View file

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