Skip to content
Closed
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
4 changes: 2 additions & 2 deletions src/tls13.c
Original file line number Diff line number Diff line change
Expand Up @@ -13448,8 +13448,8 @@ int DoTls13HandShakeMsg(WOLFSSL* ssl, byte* input, word32* inOutIdx,
&idx, ssl->arrays->pendingMsgType,
ssl->arrays->pendingMsgSz - HANDSHAKE_HEADER_SZ,
ssl->arrays->pendingMsgSz);
#ifdef WOLFSSL_ASYNC_CRYPT
if (ret == WC_NO_ERR_TRACE(WC_PENDING_E)) {
#if defined(WOLFSSL_ASYNC_CRYPT) || defined(WOLFSSL_NONBLOCK_OCSP)
if (ret == WC_NO_ERR_TRACE(WC_PENDING_E) || ret == WC_NO_ERR_TRACE(OCSP_WANT_READ)) {
Comment on lines +13451 to +13452
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rollback for OCSP_WANT_READ is currently compiled only when WOLFSSL_NONBLOCK_OCSP or WOLFSSL_ASYNC_CRYPT is defined. OCSP_WANT_READ can also be returned from CRL I/O paths (HAVE_CRL_IO) during cert verification, and this fragment-buffer code would still free pendingMsg and advance *inOutIdx in that case, reintroducing the same “skip pendingMsg” behavior. Consider keying this block off WOLFSSL_ASYNC_IO (or additionally HAVE_CRL_IO) to ensure any nonblocking I/O path returning OCSP_WANT_READ preserves pendingMsg for retry.

Suggested change
#if defined(WOLFSSL_ASYNC_CRYPT) || defined(WOLFSSL_NONBLOCK_OCSP)
if (ret == WC_NO_ERR_TRACE(WC_PENDING_E) || ret == WC_NO_ERR_TRACE(OCSP_WANT_READ)) {
#if defined(WOLFSSL_ASYNC_IO) || defined(HAVE_CRL_IO) || \
defined(WOLFSSL_ASYNC_CRYPT) || defined(WOLFSSL_NONBLOCK_OCSP)
if (ret == WC_NO_ERR_TRACE(WC_PENDING_E) ||
ret == WC_NO_ERR_TRACE(OCSP_WANT_READ)) {

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The combined condition ret == ...WC_PENDING_E || ret == ...OCSP_WANT_READ is written on a single long line, whereas nearby code in this file typically wraps multi-term conditions across lines for readability/consistency. Please reformat this if to match the surrounding style (e.g., split across lines like other WC_PENDING_E/OCSP_WANT_READ checks).

Suggested change
if (ret == WC_NO_ERR_TRACE(WC_PENDING_E) || ret == WC_NO_ERR_TRACE(OCSP_WANT_READ)) {
if (ret == WC_NO_ERR_TRACE(WC_PENDING_E) ||
ret == WC_NO_ERR_TRACE(OCSP_WANT_READ)) {

Copilot uses AI. Check for mistakes.
/* setup to process fragment again */
ssl->arrays->pendingMsgOffset -= inputLength;
*inOutIdx -= inputLength + ssl->keys.padSz;
Comment on lines +13451 to 13455
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change adds special handling for OCSP_WANT_READ when completing a fragmented TLS 1.3 handshake message. There doesn’t appear to be an automated regression test exercising TLS 1.3 fragmentation together with a nonblocking OCSP callback that returns WANT_READ (e.g., similar to the existing TLS1.3 fragment test in tests/test-tls13.conf, but with WOLFSSL_NONBLOCK_OCSP/OCSP callback configured). Adding such a test would help prevent regressions in this retry/rewind logic.

Copilot uses AI. Check for mistakes.
Expand Down
Loading