fix: wrong size using DTLSv1.3 in RestartHandshakeHashWithCookie

HRR_MAX_HS_HEADER_SZ does not consider DTLS handshake extra fields.
This commit is contained in:
Marco Oliverio
2022-10-07 16:15:52 +02:00
parent 4fa0deadda
commit 2fa2f8e88d
2 changed files with 22 additions and 2 deletions

View File

@ -3197,7 +3197,11 @@ static int CreateCookie(WOLFSSL* ssl, byte* hash, byte hashSz)
} }
#endif #endif
#ifdef WOLFSSL_DTLS13
#define HRR_MAX_HS_HEADER_SZ DTLS_HANDSHAKE_HEADER_SZ
#else
#define HRR_MAX_HS_HEADER_SZ HANDSHAKE_HEADER_SZ #define HRR_MAX_HS_HEADER_SZ HANDSHAKE_HEADER_SZ
#endif /* WOLFSSL_DTLS13 */
/* Restart the handshake hash with a hash of the previous messages. /* Restart the handshake hash with a hash of the previous messages.
* *
@ -3208,7 +3212,7 @@ int RestartHandshakeHash(WOLFSSL* ssl)
{ {
int ret; int ret;
Hashes hashes; Hashes hashes;
byte header[HRR_MAX_HS_HEADER_SZ] = {0}; byte header[HANDSHAKE_HEADER_SZ] = {0};
byte* hash = NULL; byte* hash = NULL;
byte hashSz = 0; byte hashSz = 0;
@ -5396,7 +5400,7 @@ static int CheckCookie(WOLFSSL* ssl, byte* cookie, byte cookieSz)
*/ */
static int RestartHandshakeHashWithCookie(WOLFSSL* ssl, Cookie* cookie) static int RestartHandshakeHashWithCookie(WOLFSSL* ssl, Cookie* cookie)
{ {
byte header[HRR_MAX_HS_HEADER_SZ] = {0}; byte header[HANDSHAKE_HEADER_SZ] = {0};
byte hrr[MAX_HRR_SZ] = {0}; byte hrr[MAX_HRR_SZ] = {0};
int hrrIdx; int hrrIdx;
word32 idx; word32 idx;

View File

@ -52,3 +52,19 @@
-u -u
-s -s
-l TLS13-AES256-GCM-SHA384 -l TLS13-AES256-GCM-SHA384
# server TLSv1.3 PSK and resumption
# AES256-GCM and SHA384
-v 4
-u
-s
-l TLS13-AES256-GCM-SHA384
-r
# client TLSv1.3 PSK
# AES256-GCM and SHA384
-v 4
-u
-s
-l TLS13-AES256-GCM-SHA384
-r