Skip to content

Add SSL_set_tlsext_debug_callback compat API - #11256

Open
julek-wolfssl wants to merge 1 commit into
wolfSSL:masterfrom
julek-wolfssl:x509-auth-level-ssl-tlsext-debug-cb
Open

Add SSL_set_tlsext_debug_callback compat API#11256
julek-wolfssl wants to merge 1 commit into
wolfSSL:masterfrom
julek-wolfssl:x509-auth-level-ssl-tlsext-debug-cb

Conversation

@julek-wolfssl

Copy link
Copy Markdown
Member

Adds wolfSSL_set_tlsext_debug_callback() and the WOLFSSL_TLSEXT_DEBUG_CB callback type, mirroring OpenSSL's SSL_set_tlsext_debug_callback().

  • Invoked once per TLS extension received during the handshake, in wire order, before processing, passing connection side, extension type, raw extension content, and the arg set via wolfSSL_set_tlsext_debug_arg().
  • Covers client hello, server hello, hello retry request, encrypted extensions, certificate, certificate request and session ticket messages for TLS 1.2/1.3 and DTLS, mirroring OpenSSL's tls1_handle_extensions() receive path.
  • Unlike OpenSSL 3.x, unknown (unregistered) extension types are also reported.
  • Callback stored in the WOLFSSL object, guarded by OPENSSL_EXTRA && HAVE_PK_CALLBACKS, matching the existing wolfSSL_set_tlsext_debug_arg(); the argument reuses ssl->loggingCtx.
  • Documents the new API in doc/dox_comments/header_files/ssl.h.
  • Adds API tests, including a loopback handshake test asserting both sides observe the expected extensions (TLSX_SUPPORTED_VERSIONS for TLS 1.3, TLSX_EXTENDED_MASTER_SECRET for TLS 1.2 with EMS).

Copilot AI lite review requested due to automatic review settings August 25, 2026 15:29
@julek-wolfssl julek-wolfssl self-assigned this Aug 25, 2026
@wolfSSL-Bot

Copy link
Copy Markdown

Can one of the admins verify this patch?

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

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Adds an OpenSSL-compatible TLS extension debug callback API to wolfSSL, enabling inspection of received handshake extensions before they’re processed.

Changes:

  • Introduces wolfSSL_set_tlsext_debug_callback() and WOLFSSL_TLSEXT_DEBUG_CB in the public API and OpenSSL-compat header.
  • Stores and invokes the callback during extension parsing (TLSX_Parse) for each received extension.
  • Adds API and handshake loopback tests validating callback installation and observed extension presence.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
wolfssl/ssl.h Declares the new callback typedef and public setter API.
wolfssl/openssl/ssl.h Adds OpenSSL-compat macro mapping for SSL_set_tlsext_debug_callback.
wolfssl/internal.h Adds callback storage to WOLFSSL object (behind feature guards).
src/tls.c Invokes the callback once per received extension during parsing.
src/ssl_api_ext.c Implements wolfSSL_set_tlsext_debug_callback().
doc/dox_comments/header_files/ssl.h Documents the new callback type and setter.
tests/api/test_ssl_ext.h Registers new API tests.
tests/api/test_ssl_ext.c Adds installation and handshake callback behavior tests.

💡 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
#ifdef OPENSSL_EXTRA
#ifdef HAVE_PK_CALLBACKS
void* loggingCtx; /* logging callback argument */
WOLFSSL_TLSEXT_DEBUG_CB tlsextDebugCb; /* TLS ext debug callback */
Comment thread wolfssl/openssl/ssl.h
#define SSL_renegotiate wolfSSL_Rehandshake
#define SSL_get_secure_renegotiation_support wolfSSL_SSL_get_secure_renegotiation_support
#define SSL_renegotiate_pending wolfSSL_SSL_renegotiate_pending
#define SSL_set_tlsext_debug_arg wolfSSL_set_tlsext_debug_arg
Comment on lines +6384 to +6385
\return SSL_SUCCESS On successful setting of the callback.
\return SSL_FAILURE If a NULL ssl is passed in.
Add wolfSSL_set_tlsext_debug_callback() with the WOLFSSL_TLSEXT_DEBUG_CB
callback type, mirroring OpenSSL's SSL_set_tlsext_debug_callback(). The
callback is invoked once for every TLS extension received during the
handshake, in wire order, before the extension is processed, with the
connection side, extension type, raw extension content and the argument
set via wolfSSL_set_tlsext_debug_arg(). This covers client hello,
server hello, hello retry request, encrypted extensions, certificate,
certificate request and session ticket messages for TLS 1.2/1.3 and
DTLS, mirroring OpenSSL's tls1_handle_extensions() receive path.

Unlike OpenSSL 3.x, unknown (unregistered) extension types are also
reported.

The callback is stored in the WOLFSSL object and guarded by
OPENSSL_EXTRA && HAVE_PK_CALLBACKS, matching the existing
wolfSSL_set_tlsext_debug_arg(). The argument reuses ssl->loggingCtx.

Document the new API in doc/dox_comments/header_files/ssl.h and add
API tests, including a loopback handshake test asserting that both
sides observe the expected extensions (TLSX_SUPPORTED_VERSIONS for
TLS 1.3, TLSX_EXTENDED_MASTER_SECRET for TLS 1.2 with EMS).
@julek-wolfssl
julek-wolfssl force-pushed the x509-auth-level-ssl-tlsext-debug-cb branch from 7857f80 to e09385e Compare August 26, 2026 11:15
@julek-wolfssl

Copy link
Copy Markdown
Member Author

retest this please

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.

3 participants