Commit Graph

466 Commits

Author SHA1 Message Date
Mahavir Jain
66b718ac82 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:48 +00:00
Mahavir Jain
f1d060a511 Merge branch 'bugfix/mbedtls_sha_test_fail_when_run_twice_v5.0' into 'release/v5.0'
fix(mbedtls): sha test will fail when run twice (backport v5.0)

See merge request espressif/esp-idf!24828
2023-07-17 20:07:34 +08:00
Mahavir Jain
1315845d75 Merge branch 'fix/mbedtls_internal_shaX_process_api_port_v5.0' into 'release/v5.0'
fix(mbedtls): Fix the port for mbedtls_internal_shaX_process api (v5.0)

See merge request espressif/esp-idf!24810
2023-07-17 17:00:44 +08:00
Jiang Guang Ming
f418a998a9 fix(mbedtls): sha test will fail when run twice 2023-07-17 10:54:32 +08:00
harshal.patil
f1ee3e41aa refactor(mbedtls): refactored the return values check in some esp-aes APIs 2023-07-14 21:00:16 +05:30
harshal.patil
3a73b1bf9b 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:18:10 +05:30
harshal.patil
400e220f06 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 13:41:13 +05:30
Laukik Hase
4da3e20855
fix(mbedtls): Fix incorrect assert for H/W MPI operations
- Closes https://github.com/espressif/esp-idf/issues/11850
2023-07-13 16:24:57 +05:30
harshal.patil
e858c2c1e0 mbedtls: update submodule to include:
fix: mbedtls_ecdsa_can_do was not being defined when ECDSA_SIGN_ALT is defined but ECDSA_VERIFY_ALT is not defined causing mbedtls_ecdsa_verify_restartable to always fail.
feature: initial version of the sbom.yml file
2023-07-07 10:30:33 +05:30
Jiang Jiang Jian
faf54ca1d6 Merge branch 'bugfix/aes_dma_align_issue_v5.0' into 'release/v5.0'
aes: fix DMA descriptor calculation for the alignment case (v5.0)

See merge request espressif/esp-idf!24094
2023-06-13 10:09:16 +08:00
Mahavir Jain
94e139e639
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 09:26:30 +05:30
Christoph Baechler
ebf4abca14
esp_ds: ignore releasing mutex if not called from same task 2023-05-19 08:31:45 +05:30
Mahavir Jain
a1dd8403d6 Merge branch 'feature/update_mbedtls_v5.0' into 'release/v5.0'
mbedtls: Update to release/v3.4.0 (v5.0)

See merge request espressif/esp-idf!23400
2023-05-11 12:06:23 +08:00
Marius Vikhammer
124a43e9ec build-system: replace ADDITIONAL_MAKE_CLEAN_FILES with ADDITIONAL_CLEAN_FILES
ADDITIONAL_MAKE_CLEAN_FILES is deprecated and only worked with make.
Replaced with the new ADDITIONAL_CLEAN_FILES (CMake 3.15) which also works with ninja.
2023-05-10 09:56:15 +08:00
harshal.patil
35d466b814 mbedtls: fix ci failures for update v3.4.0
- While updating to mbedtls release/v3.4.0, building mbedtls/library/psa_crypto.c,
clang produced an unreachable-code warning, so added `-Wno-unreachable-code` compile option for clang.
- In `mbedtls/v3.4.0`, the ECDSA restartable sign and verify functions (`ecdsa.c`) were made public.
- But the `mbedtls_ecdsa_sign_det_restartable` function prototype was declared in the file `ecdsa.h`,
only when `MBEDTLS_ECDSA_SIGN_ALT` was not defined.
- added a patch in mbedtls library to fix it.
2023-04-24 12:07:10 +05:30
harshal.patil
c293708409 mbedtls: replace low-level sha apis with md apis in esp_ssl_tls 2023-04-24 12:03:55 +05:30
harshal.patil
8017e23611 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 12:03:55 +05:30
harshal.patil
911c12b7f0 mbedtls: Update to release/v3.4.0
- Release Notes: https://github.com/Mbed-TLS/mbedtls/releases/tag/v3.4.0
2023-04-24 12:03:55 +05:30
Laukik Hase
d53d4ec930 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-03-06 06:43:17 +00:00
Laukik Hase
db99f311fc mbedtls: Fix build with dynamic buffers feature 2023-02-19 03:53:02 +00:00
Laukik Hase
8b5ab6820f mbedtls: Update config options as per v3.3.0 release 2023-02-19 03:53:02 +00:00
Laukik Hase
88aa45ff17 mbedtls: Update to v3.3.0 2023-02-19 03:53:02 +00:00
Mahavir Jain
dcae357500 Merge branch 'fix/hardware_ecc_port_v5.0' into 'release/v5.0'
mbedtls/ecp: Fix incorrect ECP parameter value

See merge request espressif/esp-idf!22112
2023-02-19 11:49:14 +08:00
Sachin Parekh
131faba944 mbedtls/ecp: Fix incorrect ECP parameter value
- Add sanity checks in mbedtls port
- Add ECP test cases covering shorter scalar values
2023-02-08 21:35:49 +05:30
harshal.patil
3ca447956c mbedtls: fix null pointer dereference of variable iv_off
iv_off gets dereferenced before being check for NULL
2023-01-25 15:32:56 +05:30
harshal.patil
79fb21952e 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-25 15:30:20 +05:30
harshal.patil
7e00b1f356 mbedtls/port: added stream_block parameter sanity check 2023-01-25 15:30:20 +05:30
LiPeng
3c1ac62969 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.
2023-01-09 18:37:07 +05:30
harshal.patil
f111ed2d9a mbedtls: fix esp_aes_gcm_update_ad() API implementation
Closes IDFGH-10467
2023-01-09 18:35:25 +05:30
harshal.patil
40f2caa950 mbedtls: fix esp_aes_crypt_ctr writing to null stream block 2023-01-02 12:02:47 +05:30
harshal.patil
ea07ce9367 mbedtls: added SOC_AES_SUPPORT_AES_192 check in esp_aes_gcm_setkey() 2023-01-02 12:02:47 +05:30
harshal.patil
d1d273bece test_aes_gcm: fix output_size paramter in mbedtls_get_update()
mbedtls_get_update() returned MBEDTLS_ERR_GCM_BUFFER_TOO_SMALL,
as 0 used to get passed in the output_size paramter.
2023-01-02 12:02:47 +05:30
harshal.patil
1c0e11efc0 mbedtls: populate mbedtls_gcm_update() output_length paramater 2023-01-02 12:02:47 +05:30
Zim Kalinowski
759f7ec13d Merge branch 'feature/add_int_task_wdt_esp32c2_v5.0' into 'release/v5.0'
WDT: implement interrupt wdt and task wdt for ESP32-C2 (backport v5.0)

See merge request espressif/esp-idf!20980
2022-12-05 16:38:35 +08:00
Omar Chebib
6b4e1619d8 TWDT: the Kconfig option ESP_TASK_WDT_EN is now used to enable Task Watchdog 2022-12-01 10:45:35 +00:00
Omar Chebib
b675bb2a4d WDT: implement interrupt wdt and task wdt for ESP32-C2
ESP32-C2 has a single group timer, thus it will use it for the interrupt watchdog,
which is more critical than the task watchdog. The latter is implement in
software thanks to the `esp_timer`component.
2022-12-01 10:45:35 +00:00
jgujarathi
2d0ef53e94 Removed some occurences of the RC4 cipher suite(deprecated now) 2022-11-25 10:07:56 +05:30
Martin Vychodil
af81bd1b0a Storage: Partition APIs moved to the new component 'esp_partition'
All the partition handling API functions and data-types were moved from the 'spi_flash' component to the new one named 'esp_partition'. See Storage 5.x migration guide for more details
2022-11-02 21:49:08 +01:00
Mahavir Jain
84b0254fbf
esp32: mpi: add workaround for data corruption issue observed with IDF 5.x toolchain
This fix adds a workaround to disable compiler optimization flag "-ftree-loop-distribute-patterns"
for `mpi_to_mem_block` routine. It was observed that compiler with release configuration was falling
back to `memset` call from ROM library causing an issue in correctly zero initializing MPI peripheral
block.

Please see following linked issue for more discussion and context on this issue.

Closes https://github.com/espressif/esp-idf/issues/8710
Closes https://github.com/espressif/esp-idf/issues/9371
Closes https://github.com/espressif/esp-idf/issues/9256
Closes IDFGH-7102
Closes IDFGH-7842
Closes IDFGH-7714
Closes IDFCI-1452
Closes IDF-6029
2022-10-27 09:54:26 +05:30
Sachin Parekh
44d626a596
mbedtls: Override ecp_mul_restartable_internal
ECDSA verification uses ecp_mul_restartable_internal instead
of the public API mbedtls_ecp_mul_restartable
2022-08-26 11:46:55 +05:30
Laukik Hase
0c60328953
mbedtls/port: Fix dynamic buffers feature for v3.2.1
Co-authored-by: Li Jingyi <lijingyi@espressif.com>
2022-08-26 11:46:55 +05:30
Laukik Hase
aecc46df64
mbedtls: Update to v3.2.1
- Changelog: https://github.com/Mbed-TLS/mbedtls/releases/tag/v3.2.1
- Closes https://github.com/espressif/esp-idf/issues/8787
2022-08-26 11:46:54 +05:30
Aditya Patwardhan
0dd55387ea esp_rsa_sign_alt: Fix esp_init_ds_data_ctx API to not modify user defined data when it is given directory from flash 2022-08-23 11:50:47 +05:30
Mahavir Jain
d34a91cace
esp-cryptoautlib: remove submodule and use from IDF component manager 2022-08-18 20:15:18 +05:30
Roland Dobai
1ae3768321 Tools: Fix flake8 version 5 warnings 2022-08-12 15:36:11 +02:00
Ivan Grokhotkov
401c10ecfb build system: re-add -Wno-format as private flag for some components 2022-08-03 16:42:47 +04:00
Darian Leung
781d06af73 esp_hw_support: Remove compare_set.h API
This function removes the following legacy atomic CAS functions:

From compare_set.h (file removed):
- compare_and_set_native()
- compare_and_set_extram()

From portmacro.h
- uxPortCompareSet()
- uxPortCompareSetExtram()

Users should call esp_cpu_compare_and_set() instead as this function hides the details
of atomic CAS on internal and external RAM addresses.

Due to the removal of compare_set.h, some missing header includes are also fixed in this commit.
2022-07-22 00:06:06 +08:00
Mahavir Jain
15039f367d Merge branch 'update/update_certs_bundle' into 'master'
Update esp_crt_bundle certificates

See merge request espressif/esp-idf!19132
2022-07-21 06:14:41 +08:00
Espressif BOT
72fe927e85 Update esp_crt_bundle certificates 2022-07-20 10:00:11 +08:00
Mahavir Jain
a94c74c26b
mbedtls: remove dependency on driver component
- keep `esp_pm` dependency conditional in mbedtls
- refactor `bt` cmakelist to keep dependencies as private

Related: IDF-1265
2022-07-18 21:10:51 +05:30