Skip to content

Add MbedTLS example - #653

Draft
padelsbach wants to merge 1 commit into
wolfSSL:masterfrom
padelsbach:mbedtls-compat
Draft

padelsbach wants to merge 1 commit into
wolfSSL:masterfrom
padelsbach:mbedtls-compat

Conversation

@padelsbach

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI balanced review requested due to automatic review settings November 3, 2026 21:41

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.

🟡 Changes recommended

Non-blocking TLS I/O mishandles retryable results and partial writes, while CI dependency fetching fails for SHA inputs and uses unpinned or potentially mismatched commits.

4 open issues
What changed in this PR

Adds an Mbed TLS 4.x client example using wolfPSA’s compatibility layer over wolfSSL, integrated with the repository’s example build and CI infrastructure.

Changes:

  • Adds a TLS client with certificate verification and a non-blocking socket option.
  • Adds build instructions and checks for TLS 1.2, TLS 1.3, and expected error cases.
  • Registers the example in CI and adds dependency-fetch configuration.
File Description
README.md Introduces and links the compatibility example.
mbedtls-compat/​README.md Documents building, running, testing, and compatibility limitations.
mbedtls-compat/​Makefile Builds the client and test servers and exposes check targets.
mbedtls-compat/​client-tls-mbedtls.c Implements the client using Mbed TLS APIs.
mbedtls-compat/​check.sh Checks protocol versions, socket modes, and error results.
.gitignore Excludes generated example binaries.
.github/​workflows/​examples.yml Passes the wolfSSL ref to dependency-fetch steps.
.github/​examples-manifest.yml Registers the example and its dependency builds.

Review effort: Balanced

profile: default
# wolfPSA master until a release has MBEDTLS_COMPAT, then pin that tag
fetch:
- [sh, -c, "test -d ../../wolfssl || git clone -q --depth 1 --branch \"${WOLFSSL_REF:-master}\" https://github.com/wolfSSL/wolfssl ../../wolfssl"]
# wolfPSA master until a release has MBEDTLS_COMPAT, then pin that tag
fetch:
- [sh, -c, "test -d ../../wolfssl || git clone -q --depth 1 --branch \"${WOLFSSL_REF:-master}\" https://github.com/wolfSSL/wolfssl ../../wolfssl"]
- [sh, -c, "test -d ../../wolfpsa || git clone -q --depth 1 --branch master https://github.com/wolfSSL/wolfpsa ../../wolfpsa"]
Comment on lines +87 to +89
ret = mbedtls_ssl_write(&ssl, (const unsigned char*)req, sizeof(req) - 1);
if (ret <= 0)
goto out;
Comment on lines +92 to +93
} while (ret == MBEDTLS_ERR_SSL_WANT_READ ||
ret == MBEDTLS_ERR_SSL_RECEIVED_NEW_SESSION_TICKET);
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