Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DTLS decryption threaded #8284

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions src/dtls13.c
Original file line number Diff line number Diff line change
Expand Up @@ -956,8 +956,18 @@ static int Dtls13SendOneFragmentRtx(WOLFSSL* ssl,
handshakeType, hashOutput, Dtls13SendNow(ssl, handshakeType));

if (rtxRecord != NULL) {
if (ret == 0 || ret == WC_NO_ERR_TRACE(WANT_WRITE))
if (ret == 0 || ret == WC_NO_ERR_TRACE(WANT_WRITE)) {
#ifdef WOLFSSL_RW_THREADED
int lockRet = wc_LockMutex(&ssl->dtls13Rtx.mutex);
if (lockRet < 0) {
return lockRet;
}
#endif
Dtls13RtxAddRecord(&ssl->dtls13Rtx, rtxRecord);
#ifdef WOLFSSL_RW_THREADED
wc_UnLockMutex(&ssl->dtls13Rtx.mutex);
#endif
}
else
Dtls13FreeRtxBufferRecord(ssl, rtxRecord);
}
Expand Down Expand Up @@ -1534,8 +1544,15 @@ static void Dtls13RtxMoveToEndOfList(WOLFSSL* ssl, Dtls13RtxRecord** prevNext,
return;

Dtls13RtxRecordUnlink(ssl, prevNext, r);
#ifdef WOLFSSL_RW_THREADED
if (wc_LockMutex(&ssl->dtls13Rtx.mutex) != 0)
return;
#endif
/* add to the end */
Dtls13RtxAddRecord(&ssl->dtls13Rtx, r);
#ifdef WOLFSSL_RW_THREADED
wc_UnLockMutex(&ssl->dtls13Rtx.mutex);
#endif
}

static int Dtls13RtxSendBuffered(WOLFSSL* ssl)
Expand Down Expand Up @@ -2666,9 +2683,6 @@ int DoDtls13Ack(WOLFSSL* ssl, const byte* input, word32 inputSize,
const byte* ackMessage;
w64wrapper epoch, seq;
word16 length;
#ifndef WOLFSSL_RW_THREADED
int ret;
#endif
int i;

if (inputSize < OPAQUE16_LEN)
Expand Down Expand Up @@ -2702,7 +2716,7 @@ int DoDtls13Ack(WOLFSSL* ssl, const byte* input, word32 inputSize,

#ifndef WOLFSSL_RW_THREADED
if (ssl->dtls13WaitKeyUpdateAck) {
ret = DoDtls13KeyUpdateAck(ssl);
int ret = DoDtls13KeyUpdateAck(ssl);
if (ret != 0)
return ret;
}
Expand Down
Loading
Loading