Skip to content

Add Mbed TLS 3.6 ctr_drbg, entropy and ssl_conf_rng - #80

Merged
Frauschi merged 2 commits into
wolfSSL:masterfrom
padelsbach:rng
Nov 26, 2026
Merged

Frauschi merged 2 commits into
wolfSSL:masterfrom
padelsbach:rng

Conversation

@padelsbach

Copy link
Copy Markdown
Contributor

Adds entropy source and drbg API on top of wolfCrypt

Copilot AI balanced review requested due to automatic review settings November 24, 2026 21:20

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

The entropy capability guard can enable MBEDTLS_ENTROPY_C without the required hash wrapper or SHA-256/SHA-512 accumulator, causing compilation failures or every entropy request to fail.

1 open issue
What changed in this PR

Adds Mbed TLS 3.6 entropy and DRBG compatibility APIs backed by wolfCrypt, plus an SSL RNG configuration compatibility entry point.

Changes:

  • Adds entropy-source management, DRBG seeding, reseeding, and random generation.
  • Exports the new APIs and adjusts feature detection.
  • Adds compatibility tests and documents differences from Mbed TLS behavior.
File Description
wolfpsa/​mbedtls_compat/​mbedtls/​ssl.h Declares mbedtls_ssl_conf_rng for Mbed TLS 3 compatibility.
wolfpsa/​mbedtls_compat/​mbedtls/​entropy.h Defines entropy contexts, constants, and APIs.
wolfpsa/​mbedtls_compat/​mbedtls/​ctr_drbg.h Defines DRBG contexts, constants, and APIs.
wolfpsa.map Exports entropy and DRBG symbols.
tools/​psa_want_probe.c Separates entropy and DRBG feature detection.
test/​mbedtls_compat/​mbedtls3_test.c Tests entropy sources, DRBG behavior, errors, and SSL setup.
src/​mbedtls/​mbedtls3.c Implements wolfCrypt-backed entropy and DRBG APIs and the no-op SSL RNG setter.
docs/​mbedtls-compatibility.md Documents API support, configuration restrictions, and behavioral differences.

Review effort: Balanced

Comment thread tools/psa_want_probe.c Resolved

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

7 comments inline, nothing blocking.

Comment thread test/mbedtls_compat/mbedtls3_test.c Resolved
Comment thread src/mbedtls/mbedtls3.c Resolved
Comment thread src/mbedtls/mbedtls3.c Resolved
Comment thread src/mbedtls/mbedtls3.c Resolved
Comment thread src/mbedtls/mbedtls3.c Resolved
Comment thread src/mbedtls/error.c Resolved
@padelsbach padelsbach removed their assignment Nov 25, 2026
@padelsbach
padelsbach requested a review from Frauschi November 25, 2026 21:17
- `mbedtls_ctr_drbg_*` use wolfCrypt's RNG, a hash DRBG, not an AES
CTR_DRBG. wolfCrypt seeds and reseeds it from its own seed source and
adds the entropy function's output and the custom or additional data,
without crediting them as entropy. So the same entropy, for example a

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.

On wolfSSL without WC_RNG_HAVE_RESEED_NOW (5.9.4, FIPS modules), reseed still goes through wc_RNG_DRBG_Reseed, which credits the input; note that here or scope "without crediting" to newer wolfSSL.

@Frauschi
Frauschi merged commit 1e8fde0 into wolfSSL:master Nov 26, 2026
109 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