Skip to content

Add mbedtls compat layer - #42

Draft
padelsbach wants to merge 24 commits into
wolfSSL:masterfrom
padelsbach:mbedtls-compat
Draft

padelsbach wants to merge 24 commits into
wolfSSL:masterfrom
padelsbach:mbedtls-compat

Conversation

@padelsbach

@padelsbach padelsbach commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Merge #39 #40 and #41 first

Copilot AI balanced review requested due to automatic review settings November 2, 2026 01:14

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

Client certificate verification can falsely report success for unauthenticated peers, and unconditional filesystem APIs break NO_FILESYSTEM builds.

8 open issues
What changed in this PR

Adds an Mbed TLS 4.x compatibility layer over wolfPSA and wolfSSL, alongside TF-PSA-Crypto extensions and generated feature configuration from the prerequisite work.

Changes:

  • Adds TLS, certificate, networking, private-key parsing, and optional threading compatibility APIs.
  • Updates builds, exported symbols, and generated capability headers.
  • Adds compatibility and regression tests, plus usage documentation.
File Description
zephyr/​CMakeLists.txt Uses the relocated configuration-generation tools.
wolfpsa/​tf-psa-crypto/​build_info.h Defines TF-PSA-Crypto feature macros.
wolfpsa/​psa/​crypto.h Includes compatibility features and extensions.
wolfpsa/​psa/​crypto_extra.h Declares service-key helpers and cleanup API.
wolfpsa/​psa/​crypto_config.h Uses generated standalone capabilities.
wolfpsa/​psa_engine.h Declares internal crypto cleanup.
wolfpsa/​mbedtls/​x509.h Defines certificate types and error constants.
wolfpsa/​mbedtls/​x509_crt.h Declares certificate-chain parsing APIs.
wolfpsa/​mbedtls/​timing.h Adds a placeholder timing header.
wolfpsa/​mbedtls/​threading.h Declares pthread-backed threading APIs.
wolfpsa/​mbedtls/​ssl.h Defines TLS contexts and compatibility APIs.
wolfpsa/​mbedtls/​platform.h Maps platform functions to the C library.
wolfpsa/​mbedtls/​platform_util.h Declares secure buffer zeroization.
wolfpsa/​mbedtls/​pk.h Declares private-key parsing APIs.
wolfpsa/​mbedtls/​net_sockets.h Declares socket compatibility APIs.
wolfpsa/​mbedtls/​error.h Adds a placeholder error header.
wolfpsa/​mbedtls/​debug.h Exposes the TLS debug configuration declaration.
wolfpsa/​mbedtls/​build_info.h Defines compatibility-layer feature macros.
wolfpsa/​mbedtls/​asn1.h Defines the ASN.1 buffer type.
wolfpsa.map Exports compatibility symbols.
user_settings.h Adds TLS and threading build settings.
tools/​psa_want_probe.c Extends standalone capability probing.
tools/​gen-crypto-config.py Supports both builds and avoids unchanged rewrites.
test/​psa_server/​psa_want_surface_test.c Tests advertised capabilities and buffer sizes.
test/​psa_server/​psa_tf_psa_extra_test.c Tests cleanup, service-key helpers, and zeroization.
test/​psa_server/​psa_devid_cryptocb_test.c Tests callback behavior after cleanup and reinitialization.
test/​mbedtls_compat/​x509_crt_test.c Tests certificate parsing and chain handling.
test/​mbedtls_compat/​threading_test.c Tests threading primitives and concurrent key operations.
test/​mbedtls_compat/​programs.sh Runs compatibility and interoperability scenarios.
test/​mbedtls_compat/​pk_test.c Tests private-key parsing.
test/​mbedtls_compat/​Makefile Builds compatibility tests and external sample programs.
test/​mbedtls_compat/​client-tls-mbedtls.c Adds a migration-guide TLS client.
test/​Makefile Registers new PSA regression tests.
src/​psa_tf_psa.c Implements TF-PSA-Crypto compatibility functions.
src/​psa_crypto.c Implements crypto-state cleanup.
src/​mbedtls_compat.c Implements TLS, certificate, and networking wrappers.
README.md Documents configuration, API coverage, limitations, and tests.
Makefile Integrates compatibility builds and capability generation.
.gitignore Ignores generated configuration and test binaries.

Review effort: Balanced

Comment thread src/mbedtls_compat.c Resolved
Comment thread wolfpsa/psa/crypto_config.h Resolved
Comment thread src/mbedtls_compat.c Resolved
Comment thread src/mbedtls_compat.c Resolved
Comment thread src/mbedtls_compat.c Resolved
Comment thread src/mbedtls_compat.c Resolved
Comment thread src/mbedtls_compat.c Resolved
Comment thread test/mbedtls_compat/Makefile Resolved
@padelsbach
padelsbach force-pushed the mbedtls-compat branch 6 times, most recently from bf78904 to e0959bd Compare November 4, 2026 21:34
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.

2 participants