mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-02-28 09:39:53 +00:00
Check buffer pointers before storing peer's public key in ECHDE-PSK PSA version of ssl_parse_client_key_exchange()
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
This commit is contained in:
parent
e18ff952a7
commit
3cae167e6a
@ -4057,8 +4057,15 @@ static int ssl_parse_client_key_exchange( mbedtls_ssl_context *ssl )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Keep a copy of the peer's public key */
|
/* Keep a copy of the peer's public key */
|
||||||
|
if( p >= end )
|
||||||
|
{
|
||||||
|
psa_destroy_key( handshake->ecdh_psa_privkey );
|
||||||
|
handshake->ecdh_psa_privkey = MBEDTLS_SVC_KEY_ID_INIT;
|
||||||
|
return( MBEDTLS_ERR_SSL_DECODE_ERROR );
|
||||||
|
}
|
||||||
|
|
||||||
ecpoint_len = *(p++);
|
ecpoint_len = *(p++);
|
||||||
if( (size_t)( end - *p ) < ecpoint_len ) {
|
if( (size_t)( end - p ) < ecpoint_len ) {
|
||||||
psa_destroy_key( handshake->ecdh_psa_privkey );
|
psa_destroy_key( handshake->ecdh_psa_privkey );
|
||||||
handshake->ecdh_psa_privkey = MBEDTLS_SVC_KEY_ID_INIT;
|
handshake->ecdh_psa_privkey = MBEDTLS_SVC_KEY_ID_INIT;
|
||||||
return( MBEDTLS_ERR_SSL_DECODE_ERROR );
|
return( MBEDTLS_ERR_SSL_DECODE_ERROR );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user