mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-02-06 03:40:04 +00:00
Introduce zlen size variable in ECHDE-PSK part of ssl_parse_client_key_exchange()
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
This commit is contained in:
parent
d6e2759afb
commit
2d63da9269
@ -4083,6 +4083,8 @@ static int ssl_parse_client_key_exchange( mbedtls_ssl_context *ssl )
|
||||
unsigned char *psm = ssl->handshake->premaster;
|
||||
const unsigned char* const psm_end =
|
||||
psm + sizeof( ssl->handshake->premaster );
|
||||
/* uint16 to store length (in octets) of the ECDH computation */
|
||||
const size_t zlen_size = 2;
|
||||
size_t zlen = 0;
|
||||
|
||||
/* Compute ECDH shared secret. */
|
||||
@ -4090,8 +4092,8 @@ static int ssl_parse_client_key_exchange( mbedtls_ssl_context *ssl )
|
||||
handshake->ecdh_psa_privkey,
|
||||
handshake->ecdh_psa_peerkey,
|
||||
handshake->ecdh_psa_peerkey_len,
|
||||
psm + 2,
|
||||
psm_end - ( psm + 2 ),
|
||||
psm + zlen_size,
|
||||
psm_end - ( psm + zlen_size ),
|
||||
&zlen );
|
||||
|
||||
destruction_status = psa_destroy_key( handshake->ecdh_psa_privkey );
|
||||
@ -4104,7 +4106,7 @@ static int ssl_parse_client_key_exchange( mbedtls_ssl_context *ssl )
|
||||
|
||||
/* Write the ECDH computation length before the ECDH computation */
|
||||
MBEDTLS_PUT_UINT16_BE( zlen, psm, 0 );
|
||||
psm += 2 + zlen;
|
||||
psm += zlen_size + zlen;
|
||||
|
||||
/* opaque psk<0..2^16-1>; */
|
||||
if( psm_end - psm < 2 )
|
||||
|
Loading…
x
Reference in New Issue
Block a user