Skip to content

Add Mbed TLS 4.x verify callbacks and VERIFY_OPTIONAL - #56

Open
padelsbach wants to merge 4 commits into
wolfSSL:masterfrom
padelsbach:mbedtls-verify
Open

padelsbach wants to merge 4 commits into
wolfSSL:masterfrom
padelsbach:mbedtls-verify

Conversation

@padelsbach

@padelsbach padelsbach commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Follow up to #54 and should be merged after it. Also requires wolfSSL/wolfssl#11110.

Adds mbedtls_ssl_conf_verify and mbedtls_ssl_set_verify. The verify callback is called for each cert in the chain, top down (CA to leaf), with the flags of every failed check, before the handshake's result is decided.

CI points to PR 11110 until it merges.

Copilot AI balanced review requested due to automatic review settings November 13, 2026 22:15

Copilot AI 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.

🟡 Changes recommended

The default TLS bounds request protocols without checking whether they are compiled in, causing mbedtls_ssl_setup() to fail when TLS 1.3 is disabled.

1 open issue
What changed in this PR

This PR expands wolfPSA’s Mbed TLS 4.x compatibility layer with wolfSSL-backed TLS and networking APIs, PEM decoding, verification callbacks, and VERIFY_OPTIONAL.

Changes:

  • Adds TLS configuration, connections, sessions, and certificate-verification handling.
  • Integrates TLS sources, initialization, feature detection, and shared-library exports.
  • Adds compatibility tests, sample-program interoperability checks, CI updates, and documentation.
File Description
wolfpsa/​mbedtls_compat/​mbedtls/​version.h Exposes existing version macros through a compatibility header.
wolfpsa/​mbedtls_compat/​mbedtls/​timing.h Adds a placeholder header for unsupported timing APIs.
wolfpsa/​mbedtls_compat/​mbedtls/​ssl.h Declares TLS types, constants, and APIs.
wolfpsa/​mbedtls_compat/​mbedtls/​ssl_ciphersuites.h Defines cipher-suite identifiers.
wolfpsa/​mbedtls_compat/​mbedtls/​psa_util.h Adds a PSA utility compatibility header.
wolfpsa/​mbedtls_compat/​mbedtls/​pem.h Declares PEM decoding APIs.
wolfpsa/​mbedtls_compat/​mbedtls/​net_sockets.h Declares socket APIs and error codes.
wolfpsa/​mbedtls_compat/​mbedtls/​error.h Adds a placeholder error header.
wolfpsa/​mbedtls_compat/​mbedtls/​debug.h Exposes the TLS debug configuration declaration.
wolfpsa.map Exports TLS, networking, and PEM symbols.
user_settings.h Enables wolfSSL TLS and verification callback settings.
tools/​psa_want_probe.c Detects available compatibility features and TLS versions.
test/​psa_server/​psa_track_memory_test.c Tests PEM/TLS allocation and initialization cleanup.
test/​mbedtls_compat/​ssl_test.c Tests TLS behavior, verification callbacks, and sessions.
test/​mbedtls_compat/​programs.sh Runs sample-program interoperability checks.
test/​mbedtls_compat/​pem_test.c Tests PEM decoding and error handling.
test/​mbedtls_compat/​Makefile Builds compatibility tests and interoperability peers.
test/​mbedtls_compat/​client-tls-mbedtls.c Adds a migration-guide client with nonblocking retries.
test/​Makefile Makes tracker-build compatibility support configurable.
src/​psa_crypto.c Shares PSA initialization and cleanup with wolfSSL TLS.
src/​mbedtls/​x509.c Makes certificate decoding available internally to TLS.
src/​mbedtls/​ssl.c Implements TLS APIs and verification callback handling.
src/​mbedtls/​pem.c Implements unencrypted PEM decoding.
src/​mbedtls/​net.c Implements socket operations and error translation.
src/​mbedtls/​mbedtls_compat_internal.h Declares shared certificate and I/O helpers.
README.md Documents supported APIs, limitations, and tests.
Makefile Builds bundled TLS sources and adds test targets.
.github/​workflows/​test-psa-api.yml Disables compatibility in the stable wolfSSL test variant.
.github/​workflows/​mbedtls-compat.yml Updates dependencies, upstream reference, and build coverage.

Review effort: Balanced

Comment thread src/mbedtls/ssl.c Resolved

@Frauschi Frauschi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A few notes; the get_session and net_accept ones are #54 code I missed there.

Comment thread src/mbedtls/ssl.c Resolved
Comment thread src/mbedtls/net.c Resolved
Comment thread src/mbedtls/ssl.c Resolved
Comment thread src/mbedtls/ssl.c Resolved
Comment thread src/mbedtls/ssl.c Resolved
Comment thread test/mbedtls_compat/ssl_test.c Resolved
Comment thread src/mbedtls/ssl.c Resolved
Comment thread src/mbedtls/ssl.c Resolved
@padelsbach
padelsbach requested a review from Frauschi November 16, 2026 23:53
@padelsbach padelsbach removed their assignment Nov 16, 2026

@Frauschi Frauschi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, I would wait with merging until wolfSSL/wolfssl#11110 has been merged.

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.

4 participants