Commit Graph

634 Commits

Author SHA1 Message Date
harshal.patil
1a1ee1cb77 test(mbedtls): add partial-block PSRAM coverage for AES
Extend the CTR test data length to 6433 bytes so the trailing partial
block is exercised with external RAM buffers (which stalls the ESP32-S2
Crypto DMA on an unfixed driver).
2026-09-04 14:58:34 +05:30
harshal.patil
d88cb2c719 fix(mbedtls/aes): fix ESP32-S2 Crypto DMA stall on PSRAM output with partial blocks
The ESP32-S2 Crypto DMA in-channel stalls silently when a receive
descriptor list transitions from external to internal RAM. The AES
driver hits this when a PSRAM-output operation has a trailing partial
block, as the internal stream descriptor is linked after the external
RAM data descriptors.

- esp_aes_process_dma(): process the block-aligned part and the partial
  block as two separate DMA operations, keeping each descriptor list
  uniform
- crypto_dma_ll_reset(): also reset the in-channel (per the TRM receive
  reset sequence), otherwise stale state from a preceding external-RAM
  operation corrupts the next operation's output

The GCM DMA path is unaffected; it never operates on PSRAM buffers.
2026-09-04 14:58:33 +05:30
Ashish Sharma
d89568682c feat(mbedtls): add option to choose constant-time prime generation 2026-07-21 16:02:00 +08:00
Ashish Sharma
73c2e6840c feat(mbedtls): update to version 3.6.7 2026-07-21 15:51:05 +08:00
harshal.patil
b55865f1a2 ci(mbedtls): Add out-of-bounds test for the ECDSA hardware driver 2026-06-16 15:17:49 +05:30
harshal.patil
046a3bb908 fix(mbedtls): validate ECDSA signature range and harden ECC memory power-down
Co-Authored-By: Ashish Sharma <ashish.sharma@espressif.com>
2026-06-16 15:17:49 +05:30
Ashish Sharma
8ad759efb7 fix(mbedtls): fixes build failure with clang21
Closes https://github.com/espressif/esp-idf/issues/18456
2026-06-09 14:04:39 +08:00
Jiang Guang Ming
1ad1e36e95 fix(mbedtls): fix ROM mbedTLS threading alt issues 2026-05-19 15:52:31 +08:00
Ashish Sharma
56c3e38561 fix(protocomm): fixes potential issues that can lead to crash during device provisioning 2026-04-28 15:05:14 +08:00
Ashish Sharma
06b3c019b6 change(mbedtls): adds CVE-2025-66442 to exclude list.
The CVE is applicable with Clang using LLVM's select-optimize feature. ESP-IDF uses GCC as default compiler and sets -Os as the default optimisation flag
2026-04-27 14:11:56 +08:00
Ashish Sharma
ac0c138eb4 feat(mbedtls): update to version 3.6.6 2026-04-08 11:11:07 +08:00
harshal.patil
85e4de6e38 fix(mbedlts/aes): Ensure cache coherency when DMA writes to cacheable PSRAM buffers 2026-01-08 16:37:13 +05:30
Ashish Sharma
0ae996be45 feat(mbedtls): update to version 3.6.5 2025-11-22 15:02:54 +08:00
nilesh.kale
623bf9b602 feat: enabled ECDSA-P192 support for ESP32H2 2025-07-22 11:26:25 +05:30
Ashish Sharma
936c6495c0 feat(mbedtls): update to version 3.6.4 2025-07-09 17:33:36 +08:00
harshal.patil
207b2322d2 fix(mbedtls/esp_crt_bundle): Suppress non-negative serial number warning
Co-authored-by: Mahavir Jain <mahavir.jain@espressif.com>
2025-05-26 14:04:44 +05:30
Ashish Sharma
e1cec0d941 feat(mbedtls): new config to allow weak cert verification 2025-04-02 08:43:49 +05:30
Ashish Sharma
e6ad551c10 feat(mbedtls): update to version 3.6.3 2025-04-02 08:43:48 +05:30
Ashish Sharma
e7f44138d8 fix(component/mbedtls): Adds github root cert to cmn_crt_authorities.csv 2025-03-18 14:39:42 +08:00
Aditya Patwardhan
4c281f8eee Merge branch 'feature/esp32h2_eco5_ecc_v5.2' into 'release/v5.2'
feat(ecc): enable ECC constant time mode for ESP32-H2 ECO5 (v5.2)

See merge request espressif/esp-idf!36586
2025-02-11 09:54:03 +08:00
Aditya Patwardhan
e2086d518e feat(docs): Update minimizing binary size
The ESP32-H2 software countermeasure may not be necessary
        for ESP32-H2 v1.2 and above, this commit updates
        the relevant documentation
2025-02-10 21:25:07 +05:30
Aditya Patwardhan
9b8a21d128 fix(soc): Fixed ECDSA register compatibility 2025-02-10 21:25:06 +05:30
Aditya Patwardhan
1c9146f0c2 fix(hal): Make the ECDSA countermeasure dynamically applicable
This commit makes the ECDSA countermeasure dynamically applicable
    across different revisions of the ESP32H2 SoC.
2025-02-10 21:24:58 +05:30
Mahavir Jain
84d2a8818c feat(ecc): enable ECC constant time mode for ESP32-H2 ECO5 2025-02-06 08:14:50 +05:30
harshal.patil
e8a0496d36 feat(hal/aes): Enable pseudo rounds function during AES operations 2025-01-17 14:00:14 +05:30
Harshit Malpani
5a0324ad89 fix: Fixed build errors with TLS 1.3 only configuration 2024-11-28 09:49:03 +05:30
Mahavir Jain
2ea33342b9 Merge branch 'feat/mbedtls_size_optimization_v5.2' into 'release/v5.2'
Fix the increase in build size of mbedtls while upgrading to v3.x (v5.2)

See merge request espressif/esp-idf!34253
2024-10-28 11:17:10 +08:00
Mahavir Jain
e8058df59f Merge branch 'fix/mbedtls_fs_io_dependency_on_vfs_v5.2' into 'release/v5.2'
fix(mbedtls): Fix the MBEDTLS_FS_IO dependency on vfs (v5.2)

See merge request espressif/esp-idf!34270
2024-10-23 17:34:51 +08:00
Aditya Patwardhan
60a825e154 fix(mbedtls): Fix the MBEDTLS_FS_IO dependency on vfs
By default MBEDTLS_FS_IO option in mbedtls uses the filesystem supported
added by vfs component.
If the vfs support is disabled by user then mbedtls raises a warning
that the filesystem realted operation shall always fail
This commit fixes the behaviour by enabling respective depedency check for the
MBEDTLS_FS_IO option

Closes https://github.com/espressif/esp-idf/issues/14409
2024-10-23 11:04:13 +08:00
nilesh.kale
52a694abb9 feat(mbedtls): update mbedtls version to 3.6.2 2024-10-22 13:23:59 +05:30
harshal.patil
db38b93c8d fix(mbedtls): Fix the increase in build size of mbedtls when upgrading to v3.x 2024-10-17 14:53:55 +05:30
harshal.patil
b5d25bd0b8 feat(mbedtls/esp_crt_bundle): Move dummy cert to .rodata to save 408B from dram
Co-authored-by: Hanno <h.binder@web.de>
2024-10-16 16:39:37 +05:30
nilesh.kale
2bc43825eb feat(mbedtls): updated mbedtls version to 3.6.1 2024-09-29 22:37:58 +05:30
Jiang Jiang Jian
3f72cc5410 Merge branch 'feat/bringup_esp32c2_rom_mbedtls_to_formal_feature_v5.2' into 'release/v5.2'
feat(mbedtls): bringup rom mbedtls feature to formal (v5.2)

See merge request espressif/esp-idf!33801
2024-09-27 12:15:51 +08:00
Aditya Patwardhan
2aad80cd92 Merge branch 'fix/ecdsa_verify_check_hash_len_v5.2' into 'release/v5.2'
Wrap some mbedtls' ECDSA verification related APIs (v5.2)

See merge request espressif/esp-idf!33784
2024-09-26 15:13:28 +08:00
Mahavir Jain
b20225d06a Merge branch 'feat/support_esp32c2_eco4_rom_mbedtls_v3.6.0_lts_v5.2' into 'release/v5.2'
feat(mbedtls): support esp32c2 eco4 rom mbedtls v3.6.0 lts v5.2 (backport v5.2)

See merge request espressif/esp-idf!33421
2024-09-26 11:02:28 +08:00
JiangGuangMing
3bfe43fb68 feat(mbedtls): bringup rom mbedtls feature to formal 2024-09-25 11:52:35 +08:00
harshal.patil
52cf97ebd5 feat(mbedtls): Wrap mbedtls_ecdsa_read_signature to use ECDSA hardware when possible 2024-09-24 16:50:38 +05:30
harshal.patil
a14ed03c11 fix(mbedtls/port): Check signature hash length before using ECDSA hardware 2024-09-24 16:50:28 +05:30
Aditya Patwardhan
5b6d8812d1 feat(hal): Add countermeasure for ECDSA generate signature
The ECDSA peripheral before ECO5 of esp32h2 does not perform the ECDSA
    sign operation in constant time. This allows an attacker to read the
    power signature of the ECDSA sign operation and then calculate the
    ECDSA key stored inside the eFuse. The commit adds a countermeasure
    for this attack. In this case the real ECDSA sign operation is
    masked under dummy ECDSA sign operations to hide its real power
    signature
2024-09-23 19:28:12 +05:30
Jiang Guang Ming
3340050eae feat(mbedtls): support rom mbedtls threading layer 2024-09-10 10:20:29 +08:00
Jiang Guang Ming
d4dea72f24 feat(mbedtls): select MBEDTLS_CMAC_C when MBEDTLS_USE_CRYPTO_ROM_IMPL enabled 2024-09-10 10:20:23 +08:00
Jiang Guang Ming
4c567bd203 feat(mbedtls): support ROM mbedtls v3.6.0 on C2 rev2.0(ECO4) 2024-09-10 10:20:14 +08:00
Richard Allen
cda82f8ee8 change(mbedtls/port): optimize gcm_mult()
1) pre-shift GCM last4 to use 32-bit shift

On 32-bit architectures like Aarch32, RV32, Xtensa,
shifting a 64-bit variable by 32-bits is free,
since it changes the register representing half of the 64-bit var.
Pre-shift the last4 array to take advantage of this.

2) unroll first GCM iteration

The first loop of gcm_mult() is different from
the others. By unrolling it separately from the
others, the other iterations may take advantage
of the zero-overhead loop construct, in addition
to saving a conditional branch in the loop.
2024-08-21 18:26:08 +05:30
Mahavir Jain
adea6829b3 fix(hal): correct the power up sequence for MPI/ECC peripherals in ESP32-C5 2024-07-02 13:36:54 +05:30
nilesh.kale
5d5113c5f9 feat(mbedtls): updated mbedtls version from 3.5.2 to 3.6.0
This MR updated MbedTLS version to latest version 3.6.0.
2024-05-07 14:16:37 +05:30
harshal.patil
bd826801ba fix(mbedtls/ecdsa): Fix dependant peripheral's enable and reset 2024-04-11 13:46:59 +05:30
harshal.patil
85186042c3 feat(hal/ecdsa): Add HAL API for operation successful check 2024-04-11 12:33:06 +05:30
Aditya Patwardhan
b359cd85f1 Merge branch 'feature/mbedtls_error_str_config_v5.2' into 'release/v5.2'
feat(mbedtls): add kconfig option for MBEDTLS_ERROR_C (v5.2)

See merge request espressif/esp-idf!30104
2024-04-11 11:53:24 +08:00
Mahavir Jain
b6f5573e0f feat(mbedtls): add kconfig option for MBEDTLS_ERROR_C
Disabling this config can reduce footprint for the cases where
mbedtls_strerror() is used and hence the debug strings are getting
pulled into the application image.
2024-04-08 16:02:21 +05:30