Merge remote-tracking branch 'upstream-public/pr/1474' into development-proposed

This commit is contained in:
Jaeden Amero 2018-03-28 14:22:29 +01:00
commit 5ec118352e
3 changed files with 24 additions and 6 deletions

View file

@ -37,6 +37,10 @@ Changes
* Do not define global mutexes around readdir() and gmtime() in
configurations where the feature is disabled. Found and fixed by Gergely
Budai.
* Harden mbedtls_ssl_config_free() against misuse, so that it doesn't
leak memory in case the user doesn't use mbedtls_ssl_conf_psk() and
instead incorrectly manipulates conf->psk and/or conf->psk_identity
directly. Found and fix submitted by junyeonLEE in #1220.
= mbed TLS 2.8.0 branch released 2018-03-16

View file

@ -682,10 +682,18 @@ struct mbedtls_ssl_config
#endif
#if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)
unsigned char *psk; /*!< pre-shared key */
size_t psk_len; /*!< length of the pre-shared key */
unsigned char *psk_identity; /*!< identity for PSK negotiation */
size_t psk_identity_len;/*!< length of identity */
unsigned char *psk; /*!< pre-shared key. This field should
only be set via
mbedtls_ssl_conf_psk() */
size_t psk_len; /*!< length of the pre-shared key. This
field should only be set via
mbedtls_ssl_conf_psk() */
unsigned char *psk_identity; /*!< identity for PSK negotiation. This
field should only be set via
mbedtls_ssl_conf_psk() */
size_t psk_identity_len;/*!< length of identity. This field should
only be set via
mbedtls_ssl_conf_psk() */
#endif
#if defined(MBEDTLS_SSL_ALPN)

View file

@ -7741,10 +7741,16 @@ void mbedtls_ssl_config_free( mbedtls_ssl_config *conf )
if( conf->psk != NULL )
{
mbedtls_zeroize( conf->psk, conf->psk_len );
mbedtls_zeroize( conf->psk_identity, conf->psk_identity_len );
mbedtls_free( conf->psk );
mbedtls_free( conf->psk_identity );
conf->psk = NULL;
conf->psk_len = 0;
}
if( conf->psk_identity != NULL )
{
mbedtls_zeroize( conf->psk_identity, conf->psk_identity_len );
mbedtls_free( conf->psk_identity );
conf->psk_identity = NULL;
conf->psk_identity_len = 0;
}
#endif