Skip to content

Commit 093d777

Browse files
committed
early_data: avoid resetting ssl->earlyData after WANT_WRITE retry
1 parent a1c8790 commit 093d777

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

src/tls13.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15066,7 +15066,10 @@ int wolfSSL_read_early_data(WOLFSSL* ssl, void* data, int sz, int* outSz)
1506615066
return SIDE_ERROR;
1506715067

1506815068
if (ssl->options.handShakeState == NULL_STATE) {
15069-
if (ssl->error != WC_NO_ERR_TRACE(WC_PENDING_E))
15069+
/* the server flight can return WANT_WRITE and we re-enter here after
15070+
* setting ssl->earlyData = process_early_data, set earlyData to
15071+
* expecting_early_data just once */
15072+
if (ssl->earlyData < expecting_early_data)
1507015073
ssl->earlyData = expecting_early_data;
1507115074
/* this used to be: ret = wolfSSL_accept_TLSv13(ssl);
1507215075
* However, wolfSSL_accept_TLSv13() expects a certificate to
@@ -15098,6 +15101,20 @@ int wolfSSL_read_early_data(WOLFSSL* ssl, void* data, int sz, int* outSz)
1509815101
#endif /* WOLFSSL_DTLS13 */
1509915102
}
1510015103
}
15104+
#ifdef WOLFSSL_DTLS13
15105+
else if (ssl->buffers.outputBuffer.length > 0 &&
15106+
ssl->options.dtls && ssl->dtls13SendingAckOrRtx) {
15107+
ret = SendBuffered(ssl);
15108+
if (ret == 0) {
15109+
ssl->dtls13SendingAckOrRtx = 0;
15110+
}
15111+
else {
15112+
ssl->error = ret;
15113+
WOLFSSL_ERROR(ssl->error);
15114+
return WOLFSSL_FATAL_ERROR;
15115+
}
15116+
}
15117+
#endif /* WOLFSSL_DTLS13 */
1510115118
else
1510215119
ret = 0;
1510315120
#else

0 commit comments

Comments
 (0)