forked from wolfSSL/wolfssl
Fixes for using async with HAVE_MAX_FRAGMENT
or --enable-maxfragment
which affected TLS 1.2/1.3. Added TLS 1.2 test for using max fragment.
This commit is contained in:
@ -9428,12 +9428,11 @@ static int DoHandShakeMsg(WOLFSSL* ssl, byte* input, word32* inOutIdx,
|
||||
|
||||
return BUFFER_ERROR;
|
||||
}
|
||||
else {
|
||||
XMEMCPY(ssl->arrays->pendingMsg + ssl->arrays->pendingMsgOffset,
|
||||
input + *inOutIdx, inputLength);
|
||||
ssl->arrays->pendingMsgOffset += inputLength;
|
||||
*inOutIdx += inputLength;
|
||||
}
|
||||
|
||||
XMEMCPY(ssl->arrays->pendingMsg + ssl->arrays->pendingMsgOffset,
|
||||
input + *inOutIdx, inputLength);
|
||||
ssl->arrays->pendingMsgOffset += inputLength;
|
||||
*inOutIdx += inputLength;
|
||||
|
||||
if (ssl->arrays->pendingMsgOffset == ssl->arrays->pendingMsgSz)
|
||||
{
|
||||
@ -9445,9 +9444,19 @@ static int DoHandShakeMsg(WOLFSSL* ssl, byte* input, word32* inOutIdx,
|
||||
ssl->arrays->pendingMsgSz
|
||||
- HANDSHAKE_HEADER_SZ,
|
||||
ssl->arrays->pendingMsgSz);
|
||||
XFREE(ssl->arrays->pendingMsg, ssl->heap, DYNAMIC_TYPE_ARRAYS);
|
||||
ssl->arrays->pendingMsg = NULL;
|
||||
ssl->arrays->pendingMsgSz = 0;
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (ret == WC_PENDING_E) {
|
||||
/* setup to process fragment again */
|
||||
ssl->arrays->pendingMsgOffset -= inputLength;
|
||||
*inOutIdx -= inputLength;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
XFREE(ssl->arrays->pendingMsg, ssl->heap, DYNAMIC_TYPE_ARRAYS);
|
||||
ssl->arrays->pendingMsg = NULL;
|
||||
ssl->arrays->pendingMsgSz = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
18
src/tls13.c
18
src/tls13.c
@ -6237,7 +6237,7 @@ int DoTls13HandShakeMsgType(WOLFSSL* ssl, byte* input, word32* inOutIdx,
|
||||
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
/* if async, offset index so this msg will be processed again */
|
||||
if (ret == WC_PENDING_E) {
|
||||
if (ret == WC_PENDING_E && *inOutIdx > 0) {
|
||||
*inOutIdx -= HANDSHAKE_HEADER_SZ;
|
||||
}
|
||||
#endif
|
||||
@ -6333,9 +6333,19 @@ int DoTls13HandShakeMsg(WOLFSSL* ssl, byte* input, word32* inOutIdx,
|
||||
&idx, ssl->arrays->pendingMsgType,
|
||||
ssl->arrays->pendingMsgSz - HANDSHAKE_HEADER_SZ,
|
||||
ssl->arrays->pendingMsgSz);
|
||||
XFREE(ssl->arrays->pendingMsg, ssl->heap, DYNAMIC_TYPE_ARRAYS);
|
||||
ssl->arrays->pendingMsg = NULL;
|
||||
ssl->arrays->pendingMsgSz = 0;
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (ret == WC_PENDING_E) {
|
||||
/* setup to process fragment again */
|
||||
ssl->arrays->pendingMsgOffset -= inputLength;
|
||||
*inOutIdx -= inputLength + ssl->keys.padSz;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
XFREE(ssl->arrays->pendingMsg, ssl->heap, DYNAMIC_TYPE_ARRAYS);
|
||||
ssl->arrays->pendingMsg = NULL;
|
||||
ssl->arrays->pendingMsgSz = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2199,3 +2199,10 @@
|
||||
-v 3
|
||||
-d
|
||||
|
||||
# server TLSv1.2 with fragment
|
||||
-v 3
|
||||
|
||||
# client TLSv1.2 with fragment
|
||||
-v 3
|
||||
-F 1
|
||||
|
||||
|
Reference in New Issue
Block a user