mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-18 05:42:35 +00:00
tls13: Fix wrong usage of MBEDTLS_SSL_CHK_BUF(_READ)_PTR macros
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
parent
c80835943c
commit
154d1b68d6
@ -1437,12 +1437,12 @@ int mbedtls_ssl_tls13_read_public_ecdhe_share( mbedtls_ssl_context *ssl,
|
|||||||
mbedtls_ssl_handshake_params *handshake = ssl->handshake;
|
mbedtls_ssl_handshake_params *handshake = ssl->handshake;
|
||||||
|
|
||||||
/* Get size of the TLS opaque key_exchange field of the KeyShareEntry struct. */
|
/* Get size of the TLS opaque key_exchange field of the KeyShareEntry struct. */
|
||||||
MBEDTLS_SSL_CHK_BUF_PTR( p, end, 2 );
|
MBEDTLS_SSL_CHK_BUF_READ_PTR( p, end, 2 );
|
||||||
uint16_t peerkey_len = MBEDTLS_GET_UINT16_BE( p, 0 );
|
uint16_t peerkey_len = MBEDTLS_GET_UINT16_BE( p, 0 );
|
||||||
p += 2;
|
p += 2;
|
||||||
|
|
||||||
/* Check if key size is consistent with given buffer length. */
|
/* Check if key size is consistent with given buffer length. */
|
||||||
MBEDTLS_SSL_CHK_BUF_PTR( p, end, peerkey_len );
|
MBEDTLS_SSL_CHK_BUF_READ_PTR( p, end, peerkey_len );
|
||||||
|
|
||||||
/* Store peer's ECDH public key. */
|
/* Store peer's ECDH public key. */
|
||||||
memcpy( handshake->ecdh_psa_peerkey, p, peerkey_len );
|
memcpy( handshake->ecdh_psa_peerkey, p, peerkey_len );
|
||||||
|
@ -1095,7 +1095,7 @@ static int ssl_tls13_write_hrr_key_share_ext( mbedtls_ssl_context *ssl,
|
|||||||
* - extension_data_length (2 bytes)
|
* - extension_data_length (2 bytes)
|
||||||
* - selected_group (2 bytes)
|
* - selected_group (2 bytes)
|
||||||
*/
|
*/
|
||||||
MBEDTLS_SSL_CHK_BUF_READ_PTR( buf, end, 6 );
|
MBEDTLS_SSL_CHK_BUF_PTR( buf, end, 6 );
|
||||||
|
|
||||||
MBEDTLS_PUT_UINT16_BE( MBEDTLS_TLS_EXT_KEY_SHARE, buf, 0 );
|
MBEDTLS_PUT_UINT16_BE( MBEDTLS_TLS_EXT_KEY_SHARE, buf, 0 );
|
||||||
MBEDTLS_PUT_UINT16_BE( 2, buf, 2 );
|
MBEDTLS_PUT_UINT16_BE( 2, buf, 2 );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user