Commit Graph

294 Commits

Author SHA1 Message Date
Daniel Mangum
f9569bde37
mbedtls: define MBEDTLS_SSL_CID_TLS1_3_PAD_GRANULARITY for CID padding
Updates config to define the new MBEDTLS_SSL_CID_TLS1_3_PAD_GRANULARITY
option, which replaced the previously used
MBEDTLS_SSL_CID_PADDING_GRANULARITY. The old option is continuing to be
used as the new one exceeds the maximum length for an option name in
esp-idf.

See https://github.com/Mbed-TLS/mbedtls/pull/4490 for more information.

Signed-off-by: Daniel Mangum <georgedanielmangum@gmail.com>
2024-01-02 11:22:10 +05:30
harshal.patil
e8a5d9ef98 fix(mbedtls/aes): fix AES interrupt allocation for AES-GCM operations 2023-12-11 06:46:24 +00:00
harshal.patil
4c30f2a4a0 fix(mbedtls): move interrupt allocation during initialization phase 2023-12-11 06:46:24 +00:00
Mahavir Jain
bb1376ff5d
fix(api-docs): include in the ECDSA APIs for doxygen build 2023-11-20 16:17:11 +05:30
Mahavir Jain
2cd1635b86
fix(ecdsa): remove unused k_mode from the ECDSA HAL/LL API
For ESP32-H2 case, the hardware k mode is always enforced through
efuse settings (done in startup code).

For ESP32-P4 case, the software k mode is not supported in the peripheral
itself and code was redundant.
2023-11-20 16:05:15 +05:30
Harshit Malpani
37836b3c62
feat: ECDSA peripheral while performing http connection with mutual auth 2023-11-17 16:24:10 +05:30
Jiang Guang Ming
92b9474a71 feat(mbedtls): support C2 mbedtls can use crypto algorithm in ROM 2023-10-26 20:25:53 +08:00
Mahavir Jain
82d2cdcf5a fix(mbedtls): remove deprecated MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION
This config has been removed in the upstream mbedTLS starting 3.0
release. Please see mbedTLS changelog for more details.
2023-10-17 10:03:39 +00:00
Mahavir Jain
bf59005fe1 fix(mbedtls): dynamic buffer feature issue with mbedtls 3.5.0
Set max TLS version in the SSL context during setup phase. Dynamic
buffer feature overrides the `mbedtls_ssl_setup` API and hence
this change is required per upstream 3.5.0 codebase change.
2023-10-17 10:03:39 +00:00
Mahavir Jain
e813bbc680 feat(mbedtls): update to 3.5.0 release
Changelog:
https://github.com/Mbed-TLS/mbedtls/releases/tag/mbedtls-3.5.0
2023-10-17 10:03:39 +00:00
harshal.patil
f6b589e275
feat(esp_hw_support): Added locking mechanism for the ECDSA and ECC peripheral 2023-09-25 14:33:04 +05:30
Kapil Gupta
4756c22ffa change(esp_wifi): Port fast_pbkdf2 implementation for mbedlts
Add changes to use fast_pbkdf2 as default for PMK calculations.
fast_pbkdf2 is significantly faster than current implementations
for esp chips.

Also removes unnecessary code for pbkdf-sha256 and pbkdf-sha512.
2023-09-13 16:33:19 +08:00
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