Commit Graph
320 Commits
Author SHA1 Message Date
Ashish Sharma a04d78a7e7 fix(esp-tls): correct return codes and harden TLS 1.3 ticket handling 2026-08-19 11:45:42 +08:00
Jiang Jiang Jian bd994cb0f3 Merge branch 'bugfix/memory-safety-and-validation_v6.0' into 'release/v6.0'
fix(security): findings from project Vanessa (v6.0)

See merge request espressif/esp-idf!50391
2026-07-22 10:28:14 +08:00
Ashish Sharma d710be28f3 fix(esp-tls): reject NULL host/url in plain-TCP and async HTTP connect 2026-07-16 18:24:47 +08:00
Aditya Patwardhan d79940bd3b fix(esp-tls): Keep deprecated use_secure_element field for compatibility
Restore the use_secure_element field in esp_tls_cfg_t, esp_tls_cfg_server_t
and httpd_ssl_config_t, and esp_transport_ssl_use_secure_element(), as
deprecated no-ops so that existing code keeps compiling. Setting them now
fails at runtime with ESP_ERR_NOT_SUPPORTED, as the feature is accessed
via the esp_key_config_t interface. To be removed in the next major release.

No compile-time deprecation attribute on this release branch; the field and
function stay warning-free here and carry only documentation notes.
2026-07-15 15:35:28 +05:30
Aditya Patwardhan 2188d7b855 docs(esp-tls): clarify caller owns the PSA key in esp_key_config_t
(cherry picked from commit ed6f697ea8)
2026-07-09 11:17:03 +05:30
Aditya Patwardhan aa70f6de09 fix(esp-tls): update secure element build hint for PSA integration
(cherry picked from commit 5f1074045f)
2026-07-09 11:17:03 +05:30
Aditya Patwardhan 5285c70499 fix(esp-tls): track opaque PSA key ownership and cover the secure-element path
Replace the key-lifetime check with explicit ownership tracking so a
caller-supplied volatile PSA key is also preserved on cleanup, and drop the
DS/HARDWARE_ECDSA compile guard so the ESP_KEY_SOURCE_PSA path is released on
pure secure-element builds.

(cherry picked from commit 7cdd0b5960)
2026-07-09 11:17:03 +05:30
Mike Szczys 2627f6e941 fix(esp-tls): only destroy volatile keys in DS/ECDSA cleanup
The DS/ECDSA cleanup added in 8cb64703 is intended for volatile PSA keys
created internally by the DS and ECDSA peripheral paths. Ensure that
during the cleanup, PSA_KEY_LIFETIME_IS_VOLATILE() is checked to avoid
destroying keys the user has added persistently to PSA.

This resolves an issue in the next commit (adding support for
clientkey_psa_id) where a user passes a PSA key id that is then silently
destroyed if CONFIG_ESP_TLS_USE_DS_PERIPHERAL or
CONFIG_MBEDTLS_HARDWARE_ECDSA_SIGN happen to be defined.

Signed-off-by: Mike Szczys <michael.szczys@canonical.com>
(cherry picked from commit da51d69013)
(cherry picked from commit f68cfbf8d4)
2026-07-09 11:17:03 +05:30
Aditya Patwardhan d06dc9f607 fix(esp-tls): correct test_apps README to match manifest target restriction
.build-test-rules.yml restricts esp-tls test_apps to esp32c3 only.
Commit 19a544203b9 accidentally expanded the README to all targets.

(cherry picked from commit b7f53c3868)
2026-07-09 11:17:03 +05:30
Aditya Patwardhan a7e7a1f6d8 fix(esp-tls): call mbedtls_pk_init before mbedtls_pk_wrap_psa in PSA key paths
Per mbedTLS API contract, mbedtls_pk_context must be explicitly initialized
with mbedtls_pk_init() before calling mbedtls_pk_wrap_psa(). Add the missing
init calls for both the server_key and client_key PSA-backed key code paths.

(cherry picked from commit 005072c87e)
2026-07-09 11:17:02 +05:30
Aditya Patwardhan 9c1dcca1af fix(esp-tls): address MR review comments for SE PSA driver
- esp_tls_mbedtls: require cert when PSA-backed server/client key is set
- esp_tls_mbedtls: drop redundant pk_init/x509_crt_init (calloc handles it)
- psa SE driver: copy callbacks/opaque_key by value (no lifetime coupling)
- psa SE driver: replace atomic CAS with simple null check on register
- psa SE driver: use sig_len from sign callback with bounds validation
- psa SE driver: validate pubkey_len returned by export_pubkey callback
- psa SE driver: check hash sub-alg in RSA PKCS1V15 branch of validate_request
- psa SE driver: align secure_element_register_callbacks doc with value-copy impl
- esp_https_server: initialize server_key in HTTPD_SSL_CONFIG_DEFAULT
- mbedtls: move SECURE_ELEMENT_DRIVER_ENABLED to esp_config.h for parity
  with ESP_ECDSA_DRIVER_ENABLED; drop target_compile_definitions
- docs: fix esp_tls_cfg_t -> esp_http_client_config_t cross-reference
- docs: check psa_import_key() status in ESP-TLS PSA example
- hints/error_output: point at CONFIG_MBEDTLS_SECURE_ELEMENT_DRIVER_ENABLED

(cherry picked from commit 08b567ef3b)
2026-07-09 11:17:02 +05:30
Aditya Patwardhan d93ab71681 feat(esp-tls): Add unified private key interface via esp_key_config_t
Add ESP_KEY_SOURCE_BUFFER and ESP_KEY_SOURCE_PSA key sources so all
hardware backends (DS, ECDSA, secure element) are accessed via PSA
key IDs through a single esp_tls_cfg_t.client_key field.

(cherry picked from commit 36090b7161)
2026-07-09 11:14:11 +05:30
Ashish Sharma e268dbef61 fix(esp-tls): guard against NULL PSK hint to prevent crash 2026-07-03 11:36:22 +08:00
Ashish Sharma 006922e6c7 fix(esp-tls): fixes DS peripheral use case with tf-psa-crypto 1.1 2026-06-25 10:41:00 +08:00
Aditya Patwardhan 0004544536 fix(esp-tls): clarify skip_common_name and warn when SNI is disabled
The skip_common_name flag was named for the legacy CN field but actually
suppresses the entire mbedtls_ssl_set_hostname() call -- disabling
hostname matching against CN/SAN AND Server Name Indication. Update the
doxygen to describe the real effect, and emit a per-call WARN inside the
SNI-disable branch so debug-only use does not slip into production
unnoticed.
2026-05-26 19:12:27 +05:30
Aditya Patwardhan 15ac4697f3 fix(esp-tls): close CA-verification bypass during session resumption
The session-resumption else-if in set_client_config() short-circuited
the CA verification chain when only client_session was supplied. Remove
the branch so session-only configs fall through to the normal error /
skip-verify path; resumption no longer silently disables CA validation.
2026-05-26 19:12:27 +05:30
Jiang Jiang Jian db1f4a40a2 Merge branch 'fix/esp_tls_check_tls_conn_before_read_write_v6.0' into 'release/v6.0'
Fix/esp tls check tls conn before read write (v6.0)

See merge request espressif/esp-idf!47523
2026-05-12 17:59:41 +08:00
Ashish Sharma d50798c185 fix(esp-tls): replace deprecated pk_ctx with PSA equivalent 2026-05-10 19:16:12 +08:00
Guillaume Souchere ed9eefd94b fix(mbedtls): compile esp_mem.c in IDF component lib instead of builtin target
esp_mem.c in the builtin target via
target_sources(builtin PRIVATE ...) called from the parent CMakeLists.
This cross-directory source injection causes CMake's Ninja generator on
Windows to produce unstable TARGET_PDB/RSP_FILE paths across
reconfigures, changing the ninja command hash and forcing a re-archive
of libmbed-builtin.a on every cmake run — even when no source changed.
This broke test_rebuild_source_files.

Fix by adding esp_mem.c to the IDF mbedtls component library
(mbedtls_srcs) instead. The final ELF link uses --start-group, so
builtin's platform.o resolves esp_mbedtls_mem_calloc/free from the
component library regardless of archive order. esp_mem.c is IDF-specific
code (heap_caps_calloc, sdkconfig.h) and belongs in the port layer, not
in any submodule target.
2026-05-04 09:02:53 +02:00
Ashish Sharma 289c78f273 feat(esp_tls): extends esp-tls test apps 2026-04-13 16:41:43 +08:00
Ashish Sharma 35624d3eaf fix(esp_tls): check tls connection finished before read/write operation 2026-04-13 16:40:01 +08:00
Sudeep Mohanty f91c08b183 fix(esp-tls): Fixed linux build for Build System v2
For Build System v2 on linux target, lwip dependency and ESP_TLS_WITH_LWIP
definition must be conditional on CONFIG_LWIP_ENABLE rather than checking
BUILD_COMPONENTS. v2 uses configuration-driven dependencies.
2026-03-20 08:13:26 +01:00
Fu Hanxi beaaa115f3 Merge branch 'ci/missing_config_pre_commit_hook_v6.0' into 'release/v6.0'
ci: add pre-commit hook to detect missing configs (v6.0)

See merge request espressif/esp-idf!46205
2026-03-20 01:10:09 +01:00
Aditya Patwardhan 931888f3c3 Merge branch 'fix/fix_dynamic_buffer_with_tls1_3_v6.0' into 'release/v6.0'
fix: fixes failing dynamic buffer tests (v6.0)

See merge request espressif/esp-idf!46430
2026-03-19 20:21:58 +05:30
Aditya Patwardhan 891ddca56e Merge branch 'feat/introduce_esp_rsa_ds_opaque_key_context_v6.0' into 'release/v6.0'
Extend opaque driver context to add Key recovery info (v6.0)

See merge request espressif/esp-idf!46074
2026-03-19 19:45:02 +05:30
harshal.patil e0b444281c change(mbedtls): Change the ESP-DS-RSA key lifetime name to include the VOLATILE keyword 2026-03-18 16:38:24 +05:30
harshal.patil ca0daf01c6 fix(esp-tls): Remove the legacy use_km_key option 2026-03-18 16:38:24 +05:30
harshal.patil 96f5317806 feat(mbedtls/esp_rsa_ds): Introduce ESP-RSA DS opaque key context 2026-03-18 16:38:23 +05:30
Ashish Sharma 6131f55136 feat(esp-tls): adds per ssl context state management 2026-03-17 10:45:32 +08:00
Evgeny Torbin 0070b687b5 ci: remove unused test cases 2026-03-12 12:34:23 +01:00
Marek Fiala dfabcbb822 change: Moved esp-tls hint to component specific hints.yml file 2026-02-18 13:54:59 +01:00
Mahavir Jain e114d459af Merge branch 'refactor/remove_esp_wolfssl_from_esp_tls_v6.0' into 'release/v6.0'
feat(esp-tls): Added support to register custom tls stack (v6.0)

See merge request espressif/esp-idf!45709
2026-02-12 11:30:28 +05:30
Ashish Sharma 762c4e9e65 fix(mbedtls): revert struct member name change esp_rsa_ds_data to esp_ds_data 2026-02-06 17:37:42 +08:00
Ashish Sharma 7418a91d3e feat: adds DS Sign capabilities for ESP32S2 2026-02-06 16:09:41 +08:00
Ashish Sharma b1f14d19d0 feat: adds new Kconfig variable for DS peripheral 2026-02-06 16:09:41 +08:00
Ashish Sharma 93349d05b2 feat: adds PSA DS driver support 2026-02-06 16:09:41 +08:00
Aditya Patwardhan 8d4dd1bc99 feat(esp-tls): Add crypto callbacks to custom TLS stack interface
Added crypto_sha1 and crypto_base64_encode callbacks to esp_tls_stack_ops_t
to allow custom TLS stacks to provide implementations for esp_crypto_* APIs.
2026-02-06 11:47:00 +05:30
Aditya Patwardhan a4eeacab06 feat(esp-tls): Added build test for the custom stack registration 2026-02-06 11:47:00 +05:30
Aditya Patwardhan b0844ddfdd feat(esp-tls): Added support to register custom tls stack
* Removed the esp_tls_wolfssl layer from esp-tls
    * Migrated Error codes
2026-02-06 11:46:55 +05:30
harshal.patil 5c55790f54 feat(mbedtls/ecdsa): Introduce PSA ECDSA driver 2026-01-31 10:59:11 +05:30
Ashish Sharma b02538834c fix: resolves MR comments 2025-12-20 23:02:25 +08:00
Ashish Sharma 5d5ba9d008 fix: migrate PSA SHA driver to be similar to parallel engine port 2025-12-19 11:06:41 +08:00
Ashish Sharma 76287081ea feat: code cleanup 2025-12-19 07:29:43 +08:00
Ashish Sharma aa88c81dfb fix(wpa_supplicant): revert changes to dpp_crypto 2025-12-19 07:29:08 +08:00
Ashish SharmaandMahavir Jain 06d03e1a12 feat: add NVS based secure storage layer for PSA
(cherry picked from commit 31c7bad7f74ce8e54ea0563b670df37a58215600)

Co-authored-by: Mahavir Jain <mahavir@espressif.com>
2025-12-19 07:29:00 +08:00
Ashish Sharma f306dbea84 feat(mbedtls): migrates ESP-TEE with PSA APIs 2025-12-19 07:28:33 +08:00
Ashish Sharma c47caf4f0a feat(mbedtls): adds mbedtls alt drivers with PSA 2025-12-19 07:28:33 +08:00
Ashish Sharma 7d17e8a024 feat(mbedtls): adds AES drivers with PSA 2025-12-19 07:28:28 +08:00
Ashish Sharma a088d2ccdc feat(mbedtls): fix build errors with PSA migration 2025-12-18 21:18:58 +08:00
Ashish Sharma b0da66f7e1 feat(bt): migrate mbedtls to PSA APIs 2025-12-18 21:18:58 +08:00