Skip to content

Echo HRR Cookie by default on client. Fix a few sniffer issues. Document DES function size requirements. - #11163

Open
kareem-wolfssl wants to merge 6 commits into
wolfSSL:masterfrom
kareem-wolfssl:vanessa
Open

Echo HRR Cookie by default on client. Fix a few sniffer issues. Document DES function size requirements.#11163
kareem-wolfssl wants to merge 6 commits into
wolfSSL:masterfrom
kareem-wolfssl:vanessa

Conversation

@kareem-wolfssl

Copy link
Copy Markdown
Contributor

Description

Fixes zd#21992, #11010, F-2246

Testing

Built in tests, provided reproducers

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR makes TLS 1.3 clients RFC 8446-compliant by enabling HelloRetryRequest (HRR) cookie echoing by default (with an opt-out for size-constrained clients), while also hardening the packet sniffer’s TCP sequence/FIN handling and documenting DES buffer sizing requirements.

Changes:

  • Enable HAVE_TLSX_COOKIE by default for TLS 1.3 clients (opt-out via WOLFSSL_NO_CLIENT_HRR_COOKIE) and switch HRR-cookie logic to use that feature macro.
  • Fix sniffer edge cases: negative-length handling, FIN capture when relative sequence is 0, and 32-bit wrap-safe sequence comparisons.
  • Document DES-CBC function behavior requiring buffers sized to round_up(len, DES_BLOCK_SIZE).

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
wolfssl/wolfcrypt/settings.h Defines HAVE_TLSX_COOKIE by default for TLS 1.3 clients (with opt-out) to ensure HRR cookie echo support is compiled in.
wolfssl/internal.h Gates hrrSentCookie option bit on HAVE_TLSX_COOKIE instead of WOLFSSL_SEND_HRR_COOKIE.
src/tls13.c Uses HAVE_TLSX_COOKIE to include HRR cookie presence in client-side HRR validation.
src/tls.c Compiles TLSX Cookie extension support under HAVE_TLSX_COOKIE and refines cookie parsing behavior when server-side cookie generation is disabled.
src/ssl_crypto.c Adds Doxygen notes clarifying DES-CBC rounding/padding behavior and buffer size requirements.
src/sniffer.c Improves robustness around negative lengths, sequence wrap comparisons, and FIN capture semantics.
.wolfssl_known_macro_extras Registers HAVE_TLSX_COOKIE and WOLFSSL_NO_CLIENT_HRR_COOKIE as known macros.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread wolfssl/internal.h
Comment thread src/ssl_crypto.c Outdated
@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown

MemBrowse Memory Report

gcc-arm-cortex-m4-openssl-compat

  • FLASH: .rodata +40 B, .text +320 B (+0.0%, 775,972 B / 1,048,576 B, total: 74% used)

gcc-arm-cortex-m4-pq

  • FLASH: .text +320 B (+0.1%, 297,948 B / 1,048,576 B, total: 28% used)

gcc-arm-cortex-m4-rsa-only

  • FLASH: .text +320 B (+0.1%, 328,432 B / 1,048,576 B, total: 31% used)

gcc-arm-cortex-m4-tls13

  • FLASH: .text +320 B (+0.1%, 238,689 B / 262,144 B, total: 91% used)

gcc-arm-cortex-m7-pq

  • FLASH: .text +320 B (+0.1%, 298,844 B / 1,048,576 B, total: 28% used)

gcc-arm-cortex-m7-tls13

@kareem-wolfssl

Copy link
Copy Markdown
Contributor Author

Jenkins retest this please

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #11163

Scan targets checked: wolfcrypt-bugs, wolfcrypt-rs-bugs, wolfcrypt-src, wolfssl-bugs, wolfssl-src
Findings: 3
2 finding(s) posted as inline comments (see file-level comments below)

Medium (1)

AdjustSequence mixes signed and unsigned relative-sequence comparisons

File: src/sniffer.c:5913
Function: AdjustSequence
Category: Logic errors

The branch selection at lines 5864/5871 now uses signed (wrap-safe) arithmetic, but the nested *seqLast comparisons at lines 5913 and 5943 remain unsigned. A retransmit whose real + *sslBytes - 1 crosses the 2^32 relative-sequence wrap enters the overlap branch and then skips the *sslBytes -= overlap trim, feeding already-consumed bytes into the TLS stream instead of dropping the segment as before.

Recommendation: Compare with (sword32)(real + (word32)*sslBytes - 1 - *seqLast) at lines 5913 and 5943 to match the new signed convention.

Referenced code: src/sniffer.c:5913-5915 (3 lines)


This review was generated automatically by Fenrir. Findings are non-blocking.

Comment thread src/sniffer.c Outdated
Comment thread src/sniffer.c
@JacobBarthelmeh

Copy link
Copy Markdown
Contributor

Retest this please Jenkins

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants