feat(tls): add mbedTLS backend for DoT and DNSSEC#552
Open
Oppen wants to merge 1 commit into
Open
Conversation
Adds src/mbedtls/ implementing the tls.h transport interface against mbedTLS 3.x/4.x's PSA API, and a new HAVE_MBEDTLS branch in src/tls/val_secalgo.c so DNSSEC verification no longer pulls in OpenSSL or Nettle when USE_MBEDTLS is selected. DNSSEC support covers RSA and ECDSA only: mbedTLS has no DSA or GOST implementation, and no EdDSA (Ed25519/Ed448) implementation despite declaring PSA_ALG_PURE_EDDSA and the twisted-Edwards curve family in its public headers. SPKI pinning is checked by hand post-handshake (mbedTLS has no DANE-alike API), and session-resumption status always reports fresh since mbedTLS 4.x has no public API to query it. On dynamic linking builds, user is responsible for matching versions correctly.
This was referenced Jul 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds src/mbedtls/ implementing the tls.h transport interface against
mbedTLS 3.x/4.x's PSA API, and a new HAVE_MBEDTLS branch in
src/tls/val_secalgo.c so DNSSEC verification no longer pulls in
OpenSSL or Nettle when USE_MBEDTLS is selected.
DNSSEC support covers RSA and ECDSA only: mbedTLS has no DSA or GOST
implementation, and no EdDSA (Ed25519/Ed448) implementation despite
declaring PSA_ALG_PURE_EDDSA and the twisted-Edwards curve family in
its public headers.
SPKI pinning is checked by hand post-handshake (mbedTLS has no
DANE-alike API), and session-resumption status always reports fresh
since mbedTLS 4.x has no public API to query it.
On dynamic linking builds, user is responsible for matching versions
correctly.
Tested on MacOS by running the regression tests with the following matrix:
(mbedtls 3.6, mbedtls 4.2)x(static link, dynamic link)x(runtime version, no runtime version)
Tested on OpenWRT 25.12.4 with dynamic link 3.6.6, no runtime version
(default deploy, no new mbedtls build), running manual queries with
getdns_queryand by setting upstubbyas forward fordnsmasq(which is my actual use case, my router can't fit OpenSSL and I wanted
to use uBlockDNS, which requires DoT or DoH).
DISCLAIMER: this is mostly vibe-coded, I tested and reviewed the code
an am responsible for it and guided the development through the hallucinations,
but it was machine generated. I couldn't find any policy about LLM
generated code, but I understand if it is considered in bad taste.
Fixes #454
Sorta fixes getdnsapi/stubby#311