Skip to content

crypto/mbedtls: upgrade Mbed TLS to 3.6.5 - #4130

Open
ThePassionate wants to merge 1 commit into
apache:masterfrom
ThePassionate:crypto-mbedtls-365
Open

ThePassionate wants to merge 1 commit into
apache:masterfrom
ThePassionate:crypto-mbedtls-365

Conversation

@ThePassionate

Copy link
Copy Markdown
Contributor

Summary

Bump the fetched Mbed TLS version from 3.6.2 to 3.6.5 (the CONFIG_MBEDTLS_VERSION default and the controlse dependency), and carry the two Kconfig entries the version brings: MBEDTLS_SSL_KEYING_MATERIAL_EXPORT (new API in 3.6.4) and MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED (the mapping existed but was unreachable).

3.6.3 to 3.6.5 are bugfix releases with no API break on the side NuttX consumes: the alternate layer headers are byte-identical between 3.6.2 and 3.6.5, and the wrapper's MBEDTLS_PRIVATE sites are unaffected (the cipher padding rework of CVE-2025-59438 keeps the mbedtls_cipher_finish() semantics). Notable behavior change recorded in the commit message: since 3.6.3, a TLS client without a hostname plus VERIFY_REQUIRED fails the handshake (follow-up to CVE-2025-27809); the recovery macro exists upstream and is left off, matching Vela.

Impact

Default version bump only; boards that pin the version explicitly (e.g. esp32s3-devkit:mbedtls at 3.6.4) are unaffected. The three carry-in patches under crypto/mbedtls/ apply to 3.6.5 unchanged (0003 with a 36-line offset, handled automatically).

Testing

Built from a fresh checkout state (distclean + refetch) with sim:nsh + CONFIG_CRYPTO_MBEDTLS + CONFIG_OPENSSL_MBEDTLS_WRAPPER + the cmocka test config: 0 warnings, 0 errors. The sim crypto regression (aescbc, des3cbc, aesctr, aesxts, chacha20, chachapoly, hmac) and the PKCS12 test (2/2) produce output byte-identical to the 3.6.2 baseline. Note for local verification: re-extracting the archive over an old build keeps the zip's internal timestamps, which hides the header change from make - a distclean is needed to see the new version actually rebuild.

Bump the build-time fetched Mbed TLS version from 3.6.2 to 3.6.5, a
patch-level update on the 3.6 LTS branch.  The public headers the alt
layer implements (aes.h, cmac.h, sha*.h, ...) are unchanged between
the two releases, and the three carry-in patches still apply on 3.6.5
(0003 with a 36-line offset).

Along the bump:

- crypto/controlse: track the new version in the MBEDTLS_VERSION
  dependency, in lockstep with the 3.4.0 -> 3.6.2 upgrade.

- Expose MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED in Kconfig: the
  mbedtls_config.h mapping already existed but there was no way to
  enable it.

- Expose MBEDTLS_SSL_KEYING_MATERIAL_EXPORT, new in 3.6.4, giving
  access to mbedtls_ssl_export_keying_material() (RFC 5705 / RFC 8446
  section 7.5), and map it in mbedtls_config.h.

Note for TLS client users: since 3.6.3 a client with
MBEDTLS_SSL_VERIFY_REQUIRED that never calls mbedtls_ssl_set_hostname()
fails the handshake with
MBEDTLS_ERR_SSL_CERTIFICATE_VERIFICATION_WITHOUT_HOSTNAME (follow-up
to CVE-2025-27809).  Set the hostname, or define
MBEDTLS_SSL_CLI_ALLOW_WEAK_CERTIFICATE_VERIFICATION_WITHOUT_HOSTNAME
to restore the previous behavior.

Notable fixes carried by 3.6.3 -> 3.6.5: CBC-PKCS7 padding timing
side channels (CVE-2025-49087, CVE-2025-59438), modular inversion
timing (CVE-2025-54764), LMS import/verify (CVE-2025-49600,
CVE-2025-49601), x509 name parsing use-after-free (CVE-2025-47917),
PEM integer underflow (CVE-2025-52497), reassembly of fragmented TLS
handshake messages, and mbedtls_mpi_gcd() now always returns a
non-negative result.

Signed-off-by: makejian <makejian@xiaomi.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant