Skip to content

Run Mbed TLS's TLS unit test against the compat layer - #55

Merged
Frauschi merged 10 commits into
wolfSSL:masterfrom
padelsbach:mbedtls-ssl-suite
Nov 17, 2026
Merged

Frauschi merged 10 commits into
wolfSSL:masterfrom
padelsbach:mbedtls-ssl-suite

Conversation

@padelsbach

@padelsbach padelsbach commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Follow up to #54. Merge that first.

Isolate the MbedTLS unit tests which run with the public API, and enable them to run on wolfPSA's MbedTLS compat layer.

make MBEDTLS_COMPAT=1 mbedtls-compat-suite runs the tests on wolfPSA
make MBEDTLS_COMPAT=1 mbedtls-compat-suite-ref runs the tests on MbedTLS

New cases.txt file contains the list of expected pass/fail results per test.

Copilot AI balanced review requested due to automatic review settings November 13, 2026 20:07

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

Custom wolfSSL settings can bypass the configured TLS 1.2 minimum, while the test runner suppresses sanitizer and wrapper failures.

2 open issues
What changed in this PR

Building on #54’s compatibility APIs, this PR enables selected Mbed TLS public-API TLS tests to run against wolfPSA and against Mbed TLS as a reference.

Changes:

  • Adds test selection, public-API helper replacements, and expected outcomes in cases.txt.
  • Integrates TLS, networking, and PEM compatibility support with builds and lifecycle management.
  • Expands compatibility tests, CI coverage, and usage documentation.
File Description
wolfpsa/​tf-psa-crypto/​build_info.h Adds version and signature capability macros.
wolfpsa/​mbedtls/​threading.h Includes private-access compatibility macros.
wolfpsa/​mbedtls/​private_access.h Adds private-member annotation support.
wolfpsa/​mbedtls/​platform_util.h Adds deprecation and return-value annotations.
wolfpsa/​mbedtls_compat/​mbedtls/​version.h Exposes compatibility version macros.
wolfpsa/​mbedtls_compat/​mbedtls/​timing.h Adds a timing header placeholder.
wolfpsa/​mbedtls_compat/​mbedtls/​ssl.h Declares TLS compatibility types and APIs.
wolfpsa/​mbedtls_compat/​mbedtls/​ssl_ciphersuites.h Defines cipher-suite identifiers and capabilities.
wolfpsa/​mbedtls_compat/​mbedtls/​psa_util.h Provides a PSA utility header placeholder.
wolfpsa/​mbedtls_compat/​mbedtls/​pem.h Declares PEM decoding APIs.
wolfpsa/​mbedtls_compat/​mbedtls/​net_sockets.h Declares networking compatibility APIs.
wolfpsa/​mbedtls_compat/​mbedtls/​error.h Defines shared compatibility error codes.
wolfpsa/​mbedtls_compat/​mbedtls/​debug.h Provides the debug compatibility header.
wolfpsa/​mbedtls_compat/​mbedtls/​build_info.h Derives X.509 and TLS capability macros.
wolfpsa.map Exports networking, PEM, and TLS symbols.
user_settings.h Enables wolfSSL TLS for compatibility builds.
tools/​psa_want_probe.c Detects compatibility feature availability.
test/​psa_server/​psa_track_memory_test.c Checks PEM/TLS allocation and library cleanup.
test/​mbedtls_compat/​ssl_suite/​ssl_helpers_port.h Declares the helper-port interface.
test/​mbedtls_compat/​ssl_suite/​ssl_helpers_port.c Replaces internal helpers with public-API calls.
test/​mbedtls_compat/​ssl_suite/​shim/​threading_internal.h Supplies a threading header shim.
test/​mbedtls_compat/​ssl_suite/​shim/​psa_crypto_helpers.c Stubs the internal key-slot leak check.
test/​mbedtls_compat/​ssl_suite/​shim/​mbedtls/​private/​pk_private.h Supplies test key-type constants.
test/​mbedtls_compat/​ssl_suite/​shim/​mbedtls/​private/​error_common.h Redirects tests to compatibility errors.
test/​mbedtls_compat/​ssl_suite/​shim/​mbedtls/​private/​entropy.h Maps the entropy failure code.
test/​mbedtls_compat/​ssl_suite/​shim/​mbedtls/​private/​ctr_drbg.h Supplies an unused-header placeholder.
test/​mbedtls_compat/​ssl_suite/​select.py Selects cases and checks upstream consistency.
test/​mbedtls_compat/​ssl_suite/​mbedtls.patch Adapts upstream tests and helpers.
test/​mbedtls_compat/​ssl_suite/​CMakeLists.txt Builds the Mbed TLS reference suite.
test/​mbedtls_compat/​ssl_suite/​check.py Compares outcomes with expected results.
test/​mbedtls_compat/​ssl_suite/​cases.txt Records cases, expectations, and exclusions.
test/​mbedtls_compat/​ssl_suite/​cases.py Parses and validates the case list.
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 and runs compatibility test targets.
test/​mbedtls_compat/​client-tls-mbedtls.c Adds a migration-guide TLS test client.
test/​Makefile Configures compatibility memory-tracking builds.
src/​psa_crypto.c Manages wolfSSL initialization and cleanup.
src/​mbedtls/​ssl.c Implements TLS compatibility over wolfSSL.
src/​mbedtls/​pem.c Implements PEM decoding over wolfCrypt.
src/​mbedtls/​net.c Implements socket compatibility functions.
src/​mbedtls/​mbedtls_compat_internal.h Shares internal I/O conversion helpers.
README.md Documents APIs, limitations, and test workflows.
Makefile Integrates TLS sources and compatibility targets.
.github/​workflows/​test-psa-api.yml Disables compatibility for stable wolfSSL testing.
.github/​workflows/​mbedtls-compat.yml Expands compatibility and reference-suite CI.

Review effort: Balanced

Comment thread src/mbedtls/ssl.c Resolved
Comment thread test/mbedtls_compat/Makefile Resolved
@padelsbach
padelsbach requested a review from Frauschi November 13, 2026 22:02
@padelsbach padelsbach changed the title Run Mbed TLS's TLS unit test against the compat layer" Run Mbed TLS's TLS unit test against the compat layer Nov 13, 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.

8 comments inline, nothing blocking.

Comment thread test/mbedtls_compat/Makefile Resolved
Comment thread test/mbedtls_compat/Makefile Resolved
Comment thread test/mbedtls_compat/Makefile Resolved
Comment thread test/mbedtls_compat/Makefile Resolved
Comment thread .github/workflows/mbedtls-compat.yml Resolved
Comment thread test/mbedtls_compat/Makefile Resolved
Comment thread test/mbedtls_compat/ssl_suite/select.py Resolved
@padelsbach padelsbach removed their assignment Nov 16, 2026
@padelsbach
padelsbach requested a review from Frauschi November 16, 2026 23:26

@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.

Follow-up nit: TF_PSA_CRYPTO_VERSION_* in wolfpsa/tf-psa-crypto/build_info.h are the TF-PSA-Crypto release macros, separate from PSA_CRYPTO_API_VERSION (1.4), but psa/crypto.h now exports them to every wolfPSA user, so consider gating them on MBEDTLS_COMPAT and saying "release" rather than "API version" in the comment.

@Frauschi
Frauschi merged commit 7ce3597 into wolfSSL:master Nov 17, 2026
103 checks passed
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