mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-28 19:21:08 +00:00
Replace ssl->handshake with handshake in write_cookie_ext()
Signed-off-by: XiaokangQian <xiaokang.qian@arm.com>
This commit is contained in:
parent
9b93c0dd8d
commit
c02768a399
@ -694,32 +694,32 @@ static int ssl_tls13_write_cookie_ext( mbedtls_ssl_context *ssl,
|
||||
size_t *out_len )
|
||||
{
|
||||
unsigned char *p = buf;
|
||||
|
||||
*out_len = 0;
|
||||
mbedtls_ssl_handshake_params *handshake = ssl->handshake;
|
||||
|
||||
if( ssl->handshake->cookie == NULL )
|
||||
if( handshake->cookie == NULL )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "no cookie to send; skip extension" ) );
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
MBEDTLS_SSL_DEBUG_BUF( 3, "client hello, cookie",
|
||||
ssl->handshake->cookie,
|
||||
ssl->handshake->hrr_cookie_len );
|
||||
handshake->cookie,
|
||||
handshake->hrr_cookie_len );
|
||||
|
||||
MBEDTLS_SSL_CHK_BUF_PTR( p, end, ssl->handshake->hrr_cookie_len + 6 );
|
||||
MBEDTLS_SSL_CHK_BUF_PTR( p, end, handshake->hrr_cookie_len + 6 );
|
||||
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, adding cookie extension" ) );
|
||||
|
||||
MBEDTLS_PUT_UINT16_BE( MBEDTLS_TLS_EXT_COOKIE, p, 0 );
|
||||
MBEDTLS_PUT_UINT16_BE( ssl->handshake->hrr_cookie_len + 2, p, 2 );
|
||||
MBEDTLS_PUT_UINT16_BE( ssl->handshake->hrr_cookie_len, p, 4 );
|
||||
MBEDTLS_PUT_UINT16_BE( handshake->hrr_cookie_len + 2, p, 2 );
|
||||
MBEDTLS_PUT_UINT16_BE( handshake->hrr_cookie_len, p, 4 );
|
||||
p += 6;
|
||||
|
||||
/* Cookie */
|
||||
memcpy( p, ssl->handshake->cookie, ssl->handshake->hrr_cookie_len );
|
||||
memcpy( p, handshake->cookie, handshake->hrr_cookie_len );
|
||||
|
||||
*out_len = ssl->handshake->hrr_cookie_len + 6;
|
||||
*out_len = handshake->hrr_cookie_len + 6;
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user