391 Commits

Author SHA1 Message Date
Aditya Patwardhan
3bcafe77d8 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-20 21:03:10 +08:00
Mahavir Jain
748d29b5ad feat(ecc): enable ECC constant time mode for ESP32-H2 ECO5 2025-02-20 21:03:10 +08:00
harshal.patil
7d803e661e
feat(hal/aes): Enable pseudo rounds function during AES operations 2025-01-21 12:28:23 +05:30
harshal.patil
e0312feddb
fix(mbedtls/aes): Fix external memory corruption caused due to unaligned length cache sync
Fixes the memory corruption issue that arises due to external memory cache sync of unaligned
length bytes when L2 cache line size is greater than the L1 cache line size
2024-11-21 12:15:57 +05:30
harshal.patil
4cdfdac18c
fix(mbedtls): Fix the increase in build size of mbedtls when upgrading to v3.x 2024-10-24 14:45:57 +05:30
harshal.patil
3957e59f1a
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:21:28 +05:30
Aditya Patwardhan
1b770c3931
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-09-30 13:43:29 +05:30
Mahavir Jain
bfd4085bea Merge branch 'feat/support_ecc_constant_time_mul_operations' into 'master'
feat(mbedtls/ecc): Support ECC hardware constant-time point multiplication operations

Closes IDF-10327

See merge request espressif/esp-idf!31888
2024-09-25 12:53:45 +08:00
Aditya Patwardhan
11128b73f5 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 18:55:43 +08:00
harshal.patil
46cbaa7d4d
fix(mbedtls/ecc): Enable hardware ECC mult operations only for SOC_ECC_CONSTANT_TIME_MUL
Co-authored-by: aditya.patwardhan <aditya.patwardhane@espressif.com>
2024-09-20 18:46:55 +05:30
Mahavir Jain
a71e0fc028 Merge branch 'feature/enable_sha_support_for_esp32c61' into 'master'
feat: enable support for sha peripheral in esp32c61

Closes IDF-9234

See merge request espressif/esp-idf!32830
2024-09-20 13:22:14 +08:00
Mahavir Jain
f5b55b2967 Merge branch 'fix/ecdsa_verify_check_hash_len' into 'master'
Wrap some mbedtls' ECDSA verification related APIs

See merge request espressif/esp-idf!33349
2024-09-20 12:38:10 +08:00
nilesh.kale
12fc7a677e feat: enable support for sha peripheral in esp32c61 2024-09-11 14:49:01 +05:30
Jiang Guang Ming
5bb93061a3 feat(mbedtls): support rom mbedtls threading layer 2024-09-06 19:27:57 +08:00
Jiang Guang Ming
d74ff5224c feat(mbedtls): support ROM mbedtls v3.6.0 on C2 rev2.0(ECO4) 2024-09-06 09:55:27 +08:00
harshal.patil
c4f60d91f1
feat(mbedtls): Wrap mbedtls_ecdsa_read_signature to use ECDSA hardware when possible 2024-09-05 16:27:58 +05:30
harshal.patil
331fd7f79f
fix(mbedtls/port): Check signature hash length before using ECDSA hardware 2024-09-05 16:27:58 +05:30
harshal.patil
c94986d793
fix(mbedtls): Fix https_request example build failure for mbedtls_config
- This was caused due to some mbedtls confisg being defined but their all prerequisites were not
2024-08-27 14:09:21 +05:30
Richard Allen
0b51c24238 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-20 16:44:56 +08:00
Mahavir Jain
0aeb9653e7 Merge branch 'fix/avoid_extra_c2m_msync_in_aes_driver' into 'master'
fix(mbedtls/aes): Avoid extra C2M sync of memory

See merge request espressif/esp-idf!32599
2024-08-08 17:04:14 +08:00
harshal.patil
b9dc847ee2
fix(mbedtls/aes): Avoid extra C2M sync of memory 2024-08-08 09:12:31 +05:30
Richard Allen
bc56b4fc2e fix(mbedtls/port): fix codespell issues
Fix a few comments codespell identified.
2024-08-08 11:29:53 +08:00
Laukik Hase
e8477fb894
feat(mbedtls): Extend the esp_sha API to support SHA224 operations 2024-08-07 10:03:11 +05:30
nilesh.kale
5cc0110958 feat: enabled support for ecdsa in esp32c61
This commit add ECDSA peripheral support in ESP32C61.
2024-08-05 09:29:31 +05:30
hrushikesh.bhosale
83afbfd4d7 fix(mbedtls): Check return values of md functions during ssl handshake
Added checks for mbedtls_md_setup and mbedtls_md_start
functioms in esp_ssl_tls.c
2024-07-24 11:16:20 +05:30
Armando
38bdfe195e fix(aes): fixed aes wrong dma desc alignment 2024-07-16 17:44:48 +08:00
Mahavir Jain
e1499ddde3
fix(hal): correct the power up sequence for MPI/ECC peripherals in ESP32-C5 2024-06-21 09:42:57 +08:00
morris
65710f70e3
change(aes): refactor DMA buffer allocation 2024-06-17 11:28:07 +08:00
nilesh.kale
46c0902fd6 feat: enabled hmac and ds peripheral support for c5
This commit add support for HMAC and DS peripheral support for ESP32-C5.
2024-05-28 10:44:54 +05:30
morris
e659675965 Merge branch 'feat/gdma_set_burst_size' into 'master'
feat(gdma): return alignment constraints required by the GDMA channel

Closes IDF-9848

See merge request espressif/esp-idf!30748
2024-05-27 15:33:57 +08:00
Mahavir Jain
eca073df3c Merge branch 'bugfix/ecc_coverity_warning' into 'master'
fix(ecc_alt): adjust null pointer check to fix coverity warning

Closes IDF-9872

See merge request espressif/esp-idf!30946
2024-05-27 13:43:00 +08:00
morris
dc6989796a feat(gdma): set burst size and return alignment constraint
burst size can affect the buffer alignment
2024-05-24 22:43:55 +08:00
Mahavir Jain
bc2ae212cf fix(ecc_alt): adjust null pointer check to fix coverity warning 2024-05-23 13:01:32 +08:00
harshal.patil
7c7c33ecbd
fix(mbedtls/port): Fix some divide-by-zero and deadcode coverity checks 2024-05-23 09:45:44 +05:30
harshal.patil
141cdac87e fix(mbedtls/aes): Check location of the buffer only for SOC_AXI_DMA_EXT_MEM_ENC_ALIGNMENT
When buffer_needs_realloc in the AES driver, check the location of the buffer only in case
of SOC_AXI_DMA_EXT_MEM_ENC_ALIGNMENT for allocating the newer buffer, otherwise use generic
DMA capable memory (as was done earlier)
2024-05-16 13:36:30 +08:00
harshal.patil
5dfbc47192
fix(mbedtls/crypto_shared_gdma): Enable AXI-DMA enable external memory AES-ECC access
- When external memory encryption is enabled, set the aes_ecc bit of AXI-DMA to enable memory access
2024-05-13 16:54:45 +05:30
nilesh.kale
3e6d62781f 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-04-18 14:11:02 +05:30
Armando
d341540a5e change(drivers): other driver changes for cache malloc 2024-04-15 15:34:51 +08:00
Mahavir Jain
64fd14e787
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-04 09:20:28 +05:30
harshal.patil
e383616503 fix(mbedtls/aes): Fix incorrect dma alignment size 2024-04-02 14:30:14 +08:00
gaoxu
40f38bea6f feat(dma): refactor dma calloc function 2024-04-02 14:30:14 +08:00
Aditya Patwardhan
d0a23799e8
feat(mbedtls): Added support for using ECDSA key through key manager 2024-04-01 14:37:12 +05:30
harshal.patil
272633bde1
fix(mbedtls/ecdsa): Fix dependant peripheral's enable and reset 2024-03-29 12:40:13 +05:30
harshal.patil
84b6940ce4
feat(mbedtls/ecdsa): Wrapped ecdsa_write_signature to support deterministic ECDSA signatures 2024-03-29 12:14:11 +05:30
harshal.patil
70ef80d974
feat(mbedtls/ecdsa): Add support for deterministic ECDSA signature generation 2024-03-29 12:14:11 +05:30
harshal.patil
95fac15698
feat(hal/ecdsa): Add HAL API for operation successful check 2024-03-29 12:14:11 +05:30
harshal.patil
9cd10e196b
feat(hal/sha): use RCC atomic block to enable/reset the SHA peripheral 2024-03-27 11:23:30 +05:30
harshal.patil
211a2a5477
feat(mbedtls/sha): Support SHA-DMA operations by satisfying L1 cache alignment requirements
- Use block mode as default SHA operation mode instead of DMA
2024-03-27 11:23:29 +05:30
harshal.patil
d737625215
feat(mbedtls/sha): Support in AXI-DMA SHA driver layer 2024-03-27 11:23:29 +05:30
harshal.patil
853bff88c5
change(mbedtls/sha): replace Cache ROM APIs usage with APIs from esp_cache.h 2024-03-27 11:23:29 +05:30