Commit Graph

282 Commits

Author SHA1 Message Date
Mahavir Jain
5605189398
fix(aes): correct the linking of the DMA descriptors
For certain data lengths, the last input descriptor was not getting appended
correctly and hence the EOF flag in the DMA descriptor link list was
set at incorrect location. This was resulting in the peripheral being
stalled expecting more data and eventually the code used to timeout
waiting for the AES completion interrupt.

Required configs for this issue:

CONFIG_MBEDTLS_HARDWARE_AES
CONFIG_SOC_AES_SUPPORT_DMA

This observation is similar to the issue reported in:
https://github.com/espressif/esp-idf/issues/10647

To recreate this issue, start the AES-GCM DMA operation with data length
12280 bytes and this should stall the operation forever.

In this fix, we are tracing the entire descriptor list and then appending the
extra bytes descriptor at correct position (as the last node).
2023-09-06 08:28:43 +05:30
Mahavir Jain
2fbe919e4c
fix(aes-gcm): correct the DMA completion wait condition for hardware GCM case
DMA operation completion must wait until the last DMA descriptor
ownership has been changed to hardware, that is hardware is completed
the write operation for entire data. Earlier for the hardware GCM case,
the first DMA descriptor was checked and it could have resulted in some
race condition for non interrupt (MBEDTLS_AES_USE_INTERRUPT disabled) case.
2023-09-06 08:28:43 +05:30
Mahavir Jain
75692c96e2 Merge branch 'feature/support_mbedtls_ecp_fixed_point_configurable_v5.1' into 'release/v5.1'
feat(mbedtls): support ecp fixed-point multiplication configurable (backport v5.1)

See merge request espressif/esp-idf!25286
2023-08-23 18:16:20 +08:00
Jiang Guang Ming
e9a1a7add5 feat(mbedtls): support ecp fixed-point multiplication configurable 2023-08-11 16:40:38 +08:00
Mahavir Jain
b966103800 fix(sha): DMA mode iteration calculation issue for certain data lengths
SHA hardware DMA mode calculation had off-by-one error for specific
input lengths. This was causing last chunk of the input data not being
fed to the hardware accelerator and hence resulting in an incorrect
final result.

Closes: https://github.com/espressif/esp-idf/issues/11915
2023-08-02 04:48:40 +00:00
Jiang Jiang Jian
b530d768e6 Merge branch 'fix/esp_aes_return_values_v5.1' into 'release/v5.1'
fix(mbedtls): fix return values of esp-aes APIs (v5.1)

See merge request espressif/esp-idf!24804
2023-07-15 12:24:25 +08:00
harshal.patil
34dccf840e refactor(mbedtls): refactored the return values check in some esp-aes APIs 2023-07-14 20:51:47 +05:30
harshal.patil
895d86621b fix(mbedtls): Fixed the transmission of return values of the esp-aes APIs
- Earlier, some intermediate return values were not stored and returned,
thus incorrect return values used to get transmitted to the upper layer of APIs.

- Also, zeroised the output buffer in case of error condition.
2023-07-14 14:20:47 +05:30
harshal.patil
8692da51a0 fix(mbedtls): Fix the port for the mbedtls_internal_shaX_process API
- Also added the fix to update intermediate SHA state in the mbedtls_shaX_update API
2023-07-14 14:20:20 +05:30
Laukik Hase
8e25eb1e08
fix(mbedtls): Fix incorrect assert for H/W MPI operations
- Closes https://github.com/espressif/esp-idf/issues/11850
2023-07-13 16:24:44 +05:30
Aditya Patwardhan
bcef59f33c Merge branch 'bugfix/mbedtls_dyanmic_buffer_with_dhm_build_v5.1' into 'release/v5.1'
fix(mbedtls): Build issue in dynamic buffer feature (v5.1)

See merge request espressif/esp-idf!24537
2023-07-05 12:04:00 +08:00
Mahavir Jain
ec8268d863 fix(mbedtls): Build issue in dynamic buffer feature
Fix build issue in mbedTLS dynamic buffer feature with
`CONFIG_MBEDTLS_DHM_C` enabled case.

Closes https://github.com/espressif/esp-idf/issues/11770
2023-07-03 04:01:19 +00:00
Mahavir Jain
69bcbe97f4 aes: fix DMA descriptor calculation for the alignment case
The number of the DMA descriptors allocated for certain length (e.g.,
8176) were not sufficient (off by 1 error). This used to result in the
dynamic memory corruption as the region was modified beyond the
allocated range.

This change fixes the DMA descriptor calculation part and allocates
sufficient DMA descriptors based on the data length alignment considerations.

Test has also been added to cover the specific scenario in the CI.

Closes https://github.com/espressif/esp-idf/issues/11310
2023-06-07 04:29:32 +00:00
Christoph Baechler
501c7d1101
esp_ds: ignore releasing mutex if not called from same task 2023-05-19 08:31:34 +05:30
Sachin Parekh
abc099ce9f ecdsa: Support multiple ECDSA keys
Add provision to choose which efuse block should be used as ECDSA
private key
2023-04-30 11:47:35 +05:30
laokaiyao
954a6a2cff esp32h4: removed esp32h4 related codes 2023-04-26 18:53:12 +08:00
laokaiyao
cae47ce37e esp32h4: removed esp32h4 related files 2023-04-26 18:53:12 +08:00
harshal.patil
0116dcb578 mbedtls: replace low-level sha apis with md apis in esp_ssl_tls 2023-04-24 11:56:56 +05:30
harshal.patil
3152dea192 mbedtls: Update config options as per release/v3.4.0
- Added a Kconfig option for the newly added mbedtls option MBEDTLS_PKCS7_C
2023-04-24 11:56:56 +05:30
Sachin Parekh
d2940c5ff3 mbedtls: Add port layer for ECDSA peripheral 2023-03-24 10:43:40 +05:30
Mahavir Jain
e364e1c102 Merge branch 'feature/esp32h2_enable_rsa_support' into 'master'
mbedtls: enable RSA support for esp32h2

Closes IDF-6284 and IDF-6415

See merge request espressif/esp-idf!22498
2023-03-02 15:06:24 +08:00
David Čermák
956e62c461 Merge branch 'feature/lwip_ipv6_only' into 'master'
lwip: Support IPv6 only mode

Closes IDF-6023

See merge request espressif/esp-idf!20468
2023-03-01 21:38:10 +08:00
harshal.patil
04cc562180 mbedtls: enable RSA support for esp32h2 2023-03-01 14:18:57 +05:30
Armando
4c0d6b6835 mbedtls: updated to use default gdma psram alignment
When accessing the PSRAM, the GDMA buffer alignment should be larger or
equal to the data cache line size
2023-02-28 10:42:22 +08:00
David Cermak
5f6cb31105 lwip: Support IPv6 only mode 2023-02-27 08:53:34 +01:00
Laukik Hase
45df5b56d5
esp32/mpi: Added alternate workaround for MPI data corruption issue
- Use DPORT_WRITE_REG (volatile writes) wrappers to write to the
  MPI peripheral
- Updated the previous workaround added for the same issue as it
  was failing in some long runs and with `COMPILER_OPTIMIZATION_PERF`
  enabled.
- The test performance numbers had to be updated due to the
  performance penalty introduced by this fix.

Closes https://github.com/espressif/esp-idf/issues/10403
2023-02-21 18:43:54 +05:30
Mahavir Jain
a9e7ccb166 Merge branch 'contrib/github_pr_10648' into 'master'
[AES] Timeout: return error dont abort (GitHub PR)

Closes IDFGH-9265

See merge request espressif/esp-idf!22266
2023-02-21 01:14:05 +08:00
Marius Vikhammer
ca0f982420 aes: fix minor formatting issues 2023-02-15 12:45:29 +08:00
Mahavir Jain
e4e4ffa3f4
esp32h2: enable DS peripheral support in driver and test application 2023-02-13 10:27:15 +05:30
harshal.patil
6206c1e213 mbedtls: enable RSA support for esp32c6 2023-02-03 11:46:42 +05:30
Chip Weinberger
91ab4b5513 [AES] Timeout: return error dont abort 2023-01-30 01:37:00 -08:00
harshal.patil
75899755b7 mbedtls: fix null pointer dereference of variable iv_off
iv_off gets dereferenced before being check for NULL
2023-01-24 12:20:00 +05:30
Mahavir Jain
e7ca2f2622 Merge branch 'feature/esp32c6_enable_hmac_and_ds_support' into 'master'
Feature/esp32c6 enable hmac and ds support

Closes IDF-5355 and IDF-5360

See merge request espressif/esp-idf!21761
2023-01-20 20:30:54 +08:00
Aditya Patwardhan
4831edc624
esp32c6/hal: Added support for HMAC and DS on esp32c6
* Update DS test_apps for esp32c6 SoC
2023-01-19 09:53:34 +05:30
Sachin Parekh
b060179400 mbedtls/ecp: Fix incorrect ECP parameter value
- Add sanity checks in mbedtls port
- Add ECP test cases covering shorter scalar values
2023-01-18 14:24:57 +05:30
harshal.patil
270ff95022 mbedtls/port: refactor sanity checks and their return values
Refactored and returned correct error codes for sanity checks
present in port layer esp_aes.c and esp_aes_gcm.c
2023-01-16 15:04:08 +05:30
harshal.patil
9a47f8a066 mbedtls/port: added stream_block parameter sanity check 2023-01-16 15:04:08 +05:30
Laukik Hase
1e4493e592
mbedtls: Fix build with dynamic buffers feature 2023-01-09 15:41:36 +05:30
Laukik Hase
59de3948dc
mbedtls: Update config options as per v3.3.0 release 2023-01-09 15:41:36 +05:30
Harshit Malpani
e215ede439
mbedtls: Add support to build for linux target 2023-01-04 11:17:29 +05:30
LiPeng
5c93fe47cb mbedtls: GCM implementation is replaced with CTR-based calculation
- GCM operation in mbedtls used ECB, which calculated only 16 bytes of data each time.
	- Therefore, when processing a large amount of data, it is necessary to frequently set hardware acceleration calculations,
	- which could not make good use of the AES DMA function to improve efficiency.
	- Hence, GCM implementation is replaced with CTR-based calculation which utilizes AES DMA to improve efficiency.
2022-12-28 12:14:29 +05:30
harshal.patil
f9f10c2590 mbedtls: fix esp_aes_gcm_update_ad() API implementation 2022-12-28 11:33:09 +05:30
harshal.patil
48840d04f0 mbedtls: fix esp_aes_crypt_ctr writing to null stream block 2022-12-28 11:33:09 +05:30
harshal.patil
06bb0ee077 mbedtls: added SOC_AES_SUPPORT_AES_192 check in esp_aes_gcm_setkey() 2022-12-28 11:33:09 +05:30
harshal.patil
c15b36b9c4 mbedtls: populate mbedtls_gcm_update() output_length paramater 2022-12-28 11:33:09 +05:30
David Cermak
678d7aadd9 esp-netif/lwip: Introduce TCP/IP stack has BSD API
* This variable is automatically selected when lwip stack is chosen
* This commit also fixes lwip loopback configuration
2022-12-14 14:12:50 +00:00
Nathan Phillips
260fd5c5a5 Explicitly log an invalid digest in DS data 2022-12-08 10:33:59 +00:00
Alexey Gerenkov
47c2c13de5 build: Adds support for universal Clang toolchain 2022-11-23 13:25:16 +03:00
laokaiyao
8677216576 esp32h2: renaming esp32h2 to esp32h4 2022-11-08 17:05:33 +08:00
Jiang Jiang Jian
9d7facf284 Merge branch 'remove_deprecated_rc4' into 'master'
Removed some occurences of the RC4 cipher suite

Closes IDF-4983

See merge request espressif/esp-idf!19856
2022-11-07 13:57:51 +08:00