Repository navigation
Run Mbed TLS's TLS unit test against the compat layer - #55
Conversation
There was a problem hiding this comment.
🟡 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
5836478 to
ff7fba1
Compare
ff7fba1 to
fa62260
Compare
Frauschi
left a comment
There was a problem hiding this comment.
8 comments inline, nothing blocking.
fa62260 to
a08f3de
Compare
Frauschi
left a comment
There was a problem hiding this comment.
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.


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-suiteruns the tests on wolfPSAmake MBEDTLS_COMPAT=1 mbedtls-compat-suite-refruns the tests on MbedTLSNew
cases.txtfile contains the list of expected pass/fail results per test.