Commit Graph
1020 Commits
Author SHA1 Message Date
Jiang Jiang Jian a6f24da33e Merge branch 'bugfix/mbedtls_rsa_base_reduction_hw_crt_v6.1' into 'release/v6.1'
fix(mbedlts): Enable hardware CRT for RSA-4096 via base reduction (v6.1)

See merge request espressif/esp-idf!49849
2026-07-03 21:42:10 +08:00
Mahavir Jain 0362f806e1 Merge branch 'feat/psa_its_custom_backend_v6.1' into 'release/v6.1'
Support custom storage backend for persistent PSA keys (v6.1)

See merge request espressif/esp-idf!49151
2026-07-03 11:34:23 +05:30
Mahavir Jain 40974f42a3 Merge branch 'fix/aes_dma_psram_encrypted_mem_s31_v6.1' into 'release/v6.1'
fix(mbedtls/aes): Fix AES-DMA over encrypted PSRAM on ESP32-S31 (v6.1)

See merge request espressif/esp-idf!50252
2026-07-03 08:45:02 +05:30
harshal.patil b5d53b87ef feat(mbedtls/psa_esp_rsa_ds): Expose persistent key buffer format/parse helpers 2026-07-02 16:00:23 +05:30
harshal.patil 6634a0b620 feat(mbedtls): Support custom storage backend for persistent PSA keys 2026-07-02 16:00:23 +05:30
harshal.patil 4e02ec217c test(mbedtls): move AES test vectors to a dedicated header 2026-07-01 16:51:30 +05:30
harshal.patil f5d68c1730 fix(mbedtls/aes): Fix AES-DMA over encrypted PSRAM on ESP32-S31
esp_crypto_shared_gdma_done() polled the AXI RX raw interrupt status
(in_done) but never cleared it, so after the first transfer the set bit
made every subsequent call return immediately without waiting.
2026-07-01 16:51:26 +05:30
Ashish Sharma 33cb603e02 fix(mbedtls/port): add additional hardening for PSA drivers 2026-07-01 17:41:48 +08:00
harshal.patil b5d16d86dc fix(mbedtls/port): align ESP PSA hardware drivers with software references
Audited every esp_* PSA driver against its corresponding software driver in
mbedtls/library (psa_crypto_cipher.c, psa_crypto_aead.c, psa_crypto_mac.c,
psa_crypto_hash.c, psa_crypto_ecp.c, psa_crypto_rsa.c) and fixed gaps in
workflow ownership, error-path cleanup, sensitive-data wiping, and BAD_STATE
gating per the PSA Crypto API spec.

esp_aes (cipher): fix padding oracle in cipher_finish by replacing leaky
branches with mbedtls_ct_* primitives; abort wipes the driver-level ctx,
not just the inner mbedtls_aes_context; setup routes errors through abort.

esp_aes_gcm (AEAD): zeroize the 16-byte full_tag scratch; restore the
*output_length = finish_output_size assignment that the SW reference keeps
for future ciphers; NULL the inner ctx pointer after free in abort; gate
update/finish on a live ctx with PSA_ERROR_BAD_STATE.

esp_ecdsa: keep abort-at-exit in the one-shot wrappers so the stack-copy
of the hash (needed for little-endian byte order on HW) is wiped per
PSA spec 6.3.3, drop the over-defensive public-key qx/qy wipes that the
SW driver does not perform.

esp_cmac / esp_hmac_transparent / esp_hmac_opaque (MAC): make abort
idempotent, route setup errors through abort, gate update/finish/
verify_finish on PSA_ERROR_BAD_STATE, wipe M_last and intermediate hmac[]
buffers on completion or HW failure. HMAC opaque gains alg + computed
fields to mirror the SW psa_crypto_mac.c state machine. HMAC transparent
explicitly aborts the inner SHA context before reusing it for the outer
hash.

esp_sha: switch the per-op live indicator to (sha_ctx != NULL) so the
public esp_sha_operation_type_t enum keeps its original ordinal values;
free + NULL sha_ctx on every error path; gate update/finish/clone on a
live ctx; wipe per-algorithm core/parallel-engine scratch buffers
(W[], A[], state) on HW-engine failure.

esp_md5: replace bare memset in abort with mbedtls_platform_zeroize.

esp_rsa_ds: complete() no longer frees sig_buffer (abort owns that);
start() routes failures through abort; asymmetric_decrypt funnels all
cleanup through a single exit: label. RSA-DS utilities wipe the
decrypted-plaintext scratch on v15 / OAEP unpad failure.
2026-07-01 17:41:48 +08:00
Kapil Gupta 473dd5df7a fix(mbedtls): Fix cached Rinv size mismatch under private exponent blinding
Prevent signature verification failures on targets that do not round hardware words
to 16-word boundaries (e.g. ESP32-S3, ESP32-C6, and ESP32-P4), where exponent blinding
can cause `num_words` to vary between calls, leading to reuse of an incorrectly sized
cached `Rinv`.
2026-06-30 14:17:12 +08:00
Kapil Gupta 758dde1457 fix(mbedtls): Enable hardware CRT for RSA-4096 via base reduction
Perform modulo reduction on the base before size checks to allow RSA-4096
CRT (2048-bit exponentiations) to use the hardware accelerator instead of
falling back to software. Fix input validation, negative zero sign issues,
and early memory cleanup paths in esp_mpi_exp_mod()
2026-06-30 14:17:12 +08:00
Ashish Sharma 41b09acfe8 fix(rsa_ds): make RSA-OAEP unpadding constant-time 2026-06-25 10:40:37 +08:00
Ashish Sharma 9a703650cd fix(rsa_ds): make PKCS#1 v1.5 unpadding constant-time 2026-06-25 10:40:37 +08:00
Jiang Jiang Jian 497fb492b0 Merge branch 'fix/buildv2_bootloader_extra_components_v6.1' into 'release/v6.1'
fix(cmakev2/bootloader): link components from EXTRA_COMPONENT_DIRS (v6.1)

See merge request espressif/esp-idf!49422
2026-06-14 00:04:56 +08:00
harshal.patil beb13babca fix(mbedtls): validate ECDSA signature range and harden ECC memory power-down 2026-06-09 14:58:59 +05:30
Sudeep Mohanty c5033262e3 fix(mbedtls): initialize SRCS variables in mbedtls/CMakeLists.txt BOOTLOADER_BUILD branch 2026-06-09 10:29:15 +02:00
harshal.patil 8b7e1f1787 test(mbedtls): Add out-of-bounds test for the ECDSA hardware driver 2026-05-27 11:37:53 +05:30
Ashish Sharma b2a614569d fix(mbedtls): fixes missing check before ecdsa verify 2026-05-27 11:37:48 +05:30
Jiang Jiang Jian b6a2af2fe1 Merge branch 'fix/mbedtls-threading-impl-kconfig' into 'master'
fix(mbedtls): make threading implementation exclusive

See merge request espressif/esp-idf!48846
2026-05-25 18:08:30 +08:00
Jiang Guang Ming cdfbee61a9 fix(mbedtls): make threading implementation exclusive
Ensure the pthread and alternate threading implementations cannot be enabled at the same time.
2026-05-25 11:13:51 +08:00
Jiang Guang Ming 1ac137860c feat(mbedtls): enable PSA threading alt with ROM mbedTLS 2026-05-20 14:15:23 +08:00
Jiang Guang Ming 42674c2f95 fix(mbedtls): support ROM mbedTLS crypto in bootloader 2026-05-20 14:15:22 +08:00
Jiang Guang Ming d5a712f1f8 feat(mbedtls): enable ROM mbedTLS pytest with esp32c2 rev2.0 2026-05-20 14:15:19 +08:00
Jiang Guang Ming 5d5b8200dc feat(mbedtls): enable ESP32-C2(Rev2.0) ROM crypto for PSA 2026-05-20 14:10:14 +08:00
Aditya Patwardhan 138ebe2d85 fix(mbedtls): use constant-time compare and zeroize key material
Replace memcmp with mbedtls_ct_memcmp in PSA MAC verify_finish entries
(CMAC, HMAC-transparent, HMAC-opaque) to prevent timing side-channel
MAC forgery, and unconditionally zeroize the locally-computed MAC on
the stack before return so a later stack-disclosure primitive cannot
recover the valid MAC.

Replace bzero with mbedtls_platform_zeroize in AES context free paths.
2026-05-19 12:15:28 +05:30
harshal.patil 83ebd475c3 test(mbedtls/persistent_storage_format): Add ESP ITS NVS format-stability test app 2026-05-15 09:12:20 +05:30
harshal.patil 4821f331fe refactor(mbedtls/test): Move the mbedtls test app to support multiple test apps 2026-05-15 09:09:15 +05:30
harshal.patil d7c9c3bc10 feat(mbedtls/psa_esp_rsa_ds): Support persistent ESP-RSA DS driver 2026-05-15 09:09:15 +05:30
Mahavir Jain cc532288e8 Merge branch 'fix/bring_back_ecjpake_config' into 'master'
fix(mbedtls): bring back deprecated config MBEDTLS_ECJPAKE_C

See merge request espressif/esp-idf!48462
2026-05-14 11:11:24 +05:30
Alexey Gerenkov edb75262a1 Merge branch 'feature/update-esp-clang-to-esp-21.1.3_20260304' into 'master'
feat(tools): update esp-clang version to esp-21.1.3_20260408

Closes IDF-14965, LLVM-501, and LLVM-531

See merge request espressif/esp-idf!46361
2026-05-13 22:54:10 +08:00
Laukik Hase a8c30b7d6f Merge branch 'feat/tee_post_srv_stack_cleanup' into 'master'
feat(esp_tee): Clear out all sensitive buffers explicitly after TEE cryptographic operations

Closes IDF-15671

See merge request espressif/esp-idf!48004
2026-05-13 11:57:26 +05:30
Ashish Sharma 881dc4193a fix(mbedtls): bring back deprecated config MBEDTLS_ECJPAKE_C 2026-05-13 14:25:28 +08:00
Ashish Sharma a2ba1bc18c fix(mbedtls): keep psa crypto storage enabled with ITS backend
Closes https://github.com/espressif/esp-idf/issues/18555
2026-05-12 17:00:14 +08:00
Laukik Hase 281d219fac feat(esp_tee): Clear out all sensitive buffers explicitly after TEE crypto operations 2026-05-12 13:56:28 +05:30
Mahavir Jain 0419f8b991 Merge branch 'fix/memory_leak_cross_signed_cert_verify' into 'master'
fix(esp_crt_bundle): fixes verification failures with cross signed certificates

Closes IDFGH-17582 and IDFGH-17627

See merge request espressif/esp-idf!47966
2026-05-12 11:03:52 +05:30
Ashish Sharma 0e03327f69 fix(esp_crt_bundle): fixes verification with cross signed cert 2026-05-11 17:44:16 +08:00
Ashish Sharma 737e97340b fix(esp_crt_bundle): fixes a potential memory leak with cross signed certificates
Closes https://github.com/espressif/esp-idf/issues/18512
Closes https://github.com/espressif/esp-idf/issues/18550
2026-05-11 17:41:45 +08:00
Chen Jichang 3c3b9a6a4e ci(esp32h4): disable tests which cannot pass 2026-05-11 16:48:58 +08:00
Alexey Gerenkov f16bb34ff7 fix(build): fix Clang 21 build warnings/errors 2026-05-07 17:42:38 +03:00
Ashish Sharma cd38d68bd1 feat(bootloader_support): remove P192 curve support 2026-04-30 18:04:00 +08:00
Ashish Sharma bd27c398e8 fix(esp_tee): optimise build size by removing unused configs 2026-04-30 18:02:07 +08:00
Ashish Sharma 3b3372df18 fix(mbedtls): remove deprecated configs and migrate to PSA 2026-04-30 18:02:06 +08:00
Ashish Sharma 7a1ba8f4ca feat(mbedtls): update to version 4.1.1 2026-04-30 18:02:06 +08:00
Harshal Patil a860d18878 Merge branch 'change/add_tee_key_len_validation_psa_ecdsa_driver' into 'master'
Add tee key id length validation in the ESP-ECDSA PSA driver

See merge request espressif/esp-idf!48054
2026-04-29 23:57:22 +05:30
Mahavir Jain 6112320eae Merge branch 'fix/fix_https_server_linux_build' into 'master'
fix(https_server): fixes failing example build for linux target

See merge request espressif/esp-idf!47824
2026-04-29 12:57:17 +05:30
harshal.patil 63992372fb change(mbedtls): Add tee key id length validation in the ESP-ECDSA PSA driver 2026-04-28 22:17:25 +05:30
Guillaume Souchere 44fafd42df fix(mbedtls): compile esp_mem.c in IDF component lib instead of builtin target
esp_mem.c in the builtin target via
target_sources(builtin PRIVATE ...) called from the parent CMakeLists.
This cross-directory source injection causes CMake's Ninja generator on
Windows to produce unstable TARGET_PDB/RSP_FILE paths across
reconfigures, changing the ninja command hash and forcing a re-archive
of libmbed-builtin.a on every cmake run — even when no source changed.
This broke test_rebuild_source_files.

Fix by adding esp_mem.c to the IDF mbedtls component library
(mbedtls_srcs) instead. The final ELF link uses --start-group, so
builtin's platform.o resolves esp_mbedtls_mem_calloc/free from the
component library regardless of archive order. esp_mem.c is IDF-specific
code (heap_caps_calloc, sdkconfig.h) and belongs in the port layer, not
in any submodule target.
2026-04-28 08:51:44 +02:00
harshal.patil 7eb44576be test(mbedtls): Add a test for opaque HMAC driver verification 2026-04-22 10:11:27 +05:30
harshal.patil f195d183be fix(mbedtls): Flash compatibility across multiple key sources (ECDSA, HMAC) 2026-04-22 10:11:12 +05:30
Mahavir Jain a572df21d3 Merge branch 'fix/remove_mbedtls_tls_disabled_config' into 'master'
fix(mbedtls): remove not required MBEDTLS_TLS_DISABLED config

See merge request espressif/esp-idf!47818
2026-04-22 08:51:14 +05:30