Commit Graph

189 Commits

Author SHA1 Message Date
Rahul Tank
d645a68bde fix(protocomm): harden nimble transport size handling 2026-06-29 18:18:49 +08:00
Mahavir Jain
ac752849fc Merge branch 'bugfix/fix_protocomm_sec2_double_free_decrypt_v6.0' into 'release/v6.0'
fix(protocomm): null output buffer pointer on crypto failure (v6.0)

See merge request espressif/esp-idf!49701
2026-06-29 11:20:32 +05:30
Ashish Sharma
beed5fe81f fix(protocomm): null output buffer pointer on crypto failure 2026-06-16 14:47:17 +08:00
Andrii Anoshyn
980de66b85 fix(protocomm): prevent out-of-bounds write in console line buffer
The console transport read loop passed &linebuf[i] to uart_read_bytes()
before checking i < LINE_BUF_SIZE, so a line of LINE_BUF_SIZE or more
bytes without a terminator wrote one byte past the 256-byte linebuf
stack array.

Gate the read on the bounds check and reserve the final byte for the NUL
terminator (LINE_BUF_SIZE - 1), so the buffer handed to esp_console_run()
stays terminated even when an overlong line is truncated.

Closes https://github.com/espressif/esp-idf/issues/18638

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-05 17:33:28 +08:00
Aditya Patwardhan
f7399e0069 fix(protocomm): pass current session id when closing existing session
sec1_new_session()/sec2_new_session() were calling sec*_close_session()
with the *new* session_id parameter instead of the existing
cur_session->id. The close handler validates `cur_session->id ==
session_id` before performing teardown, so the call always failed with
ESP_ERR_INVALID_STATE.

Effect: when a peer started a new provisioning session while another was
already active, the previous session's PSA keys, AES context, SRP handle
and username buffer were leaked instead of being destroyed. The cleared
session struct was overwritten by the new session, leaking the previous
key handles inside PSA Crypto and (for security2) leaking heap memory
for the username and SRP context.

Fix: pass cur_session->id so the close path actually executes the
teardown (psa_destroy_key/psa_cipher_abort/esp_srp_free/free) before the
new session takes over.
2026-05-20 12:37:18 +05:30
Jim
3edb108920 fix(protocomm): Add GATT service initialization that when gatt service changed, the peer can refresh gatt service 2026-05-11 10:11:51 +08:00
Mahavir Jain
a7be1ba98c Merge branch 'fix/fix_esp_srp_sec2_auth_bypass_a_mod_n_v6.0' into 'release/v6.0'
fix(esp_srp): reject SRP client public key when A mod N is zero (v6.0)

See merge request espressif/esp-idf!47703
2026-04-27 19:25:01 +05:30
Mahavir Jain
dc41452462 fix(protocomm): null srp_hd after free in sec2 command0 error paths
handle_session_command0() freed cur_session->srp_hd on every error path
without clearing the pointer. A subsequent sec2_close_session() call
(e.g. on BLE disconnect, or via sec2_new_session evicting the old
session) checks `if (cur_session->srp_hd)` and frees it again,
double-freeing a dangling pointer.
2026-04-27 10:09:17 +05:30
Ashish Sharma
cde2fd4718 fix(esp_srp): reject SRP client public key when A mod N is zero 2026-04-17 15:21:21 +08:00
Ashish Sharma
9b4cacf9cb fix(protocomm): fixes potential issues that can lead to crash during device provisioning 2026-04-07 11:09:37 +08:00
Jiang Jiang Jian
82cded2700 Merge branch 'fix/components_for_static_analyzer_v6.0' into 'release/v6.0'
fix(ci): check all components using static analyzer (v6.0)

See merge request espressif/esp-idf!45939
2026-03-24 14:11:08 +08:00
Alexey Lapshin
95eee6a145 fix(protocomm): fix error handling for esp_srp_exchange_proofs() 2026-03-20 13:14:48 +07:00
Rahul Tank
3813ee6502 fix(nimble): Bugfixes for various issues 2026-03-20 11:00:21 +05:30
Mahavir Jain
439026e5ea docs(protocomm): recommend using security2 scheme for production purpose 2026-02-17 11:46:11 +05:30
harshal.patil
5c55790f54 feat(mbedtls/ecdsa): Introduce PSA ECDSA driver 2026-01-31 10:59:11 +05:30
Rahul Tank
1ff264abf2 fix(protocomm): Add security checks for buffer overflow and incorrect length handling 2025-12-23 18:21:55 +08:00
Mahavir Jain
7da79a653c Merge branch 'feature/mbedtls_psa_migration_v6.0' into 'release/v6.0'
feat(mbedtls): PSA Migration to release v6.0

See merge request espressif/esp-idf!43323
2025-12-21 13:52:48 +05:30
Aditya Patwardhan
084d1f03f6 Merge branch 'bugfix/protocomm_sec1_validation_v6.0' into 'release/v6.0'
fix(protocomm): add validation for Security1 client verifier data (v6.0)

See merge request espressif/esp-idf!43776
2025-12-21 13:08:04 +05:30
Ashish Sharma
76287081ea feat: code cleanup 2025-12-19 07:29:43 +08:00
Ashish Sharma
3dea3aae1d fix: fixes coverity reported warnings 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 Sharma
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
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
Ashish Sharma
b4fea9cccc feat(lwip): migrate to to PSA API interface 2025-12-18 21:18:58 +08:00
Aditya Patwardhan
574a60289d feat(protocomm): Migrate to PSA api interface 2025-12-18 21:18:58 +08:00
Mahavir Jain
917bc34383 fix(protocomm): add validation for Security1 client verifier data
Add checks to validate client_verify_data pointer and length before
processing in handle_session_command1. Prevents NULL pointer dereference
when client omits verifier data in Session_Command1, which could cause
device crash during provisioning (remote DoS attack).

We would like to thank Pavel Kohout from Aisle Research for reporting
this vulnerability along with a mitigation strategy.
2025-11-27 09:59:40 +05:30
Rahul Tank
8f8be6cb18 fix(nimble): Address compilation issues in nimble examples 2025-11-26 14:35:51 +05:30
WanqQixiang
6b503d0db5 component: Remove wifi_provisioning component and esp_prov tool 2025-09-26 09:48:50 +08:00
Mahavir Jain
c91dc3f049 Merge branch 'cleanup/remove_deprecated_apis' into 'master'
feat: remove some deprecated APIs from 6.0 release

Closes IDF-13093

See merge request espressif/esp-idf!41211
2025-08-21 10:05:37 +05:30
Wang Meng Yang
7cac735da0 Merge branch 'feat/remove_the_deprecated_api_and_parameter' into 'master'
feat(bt): remove the deprecated functions and parameters

Closes BT-4042

See merge request espressif/esp-idf!40435
2025-08-20 19:36:37 +08:00
Mahavir Jain
42914e01ee feat: remove some deprecated APIs from 6.0 release 2025-08-20 14:20:37 +05:30
Marek Fiala
9d35d63651 feat(cmake): Update minimum cmake version to 3.22 (whole repository) 2025-08-19 14:44:32 +02:00
gongyantao
179a730a03 feat(bt): remove the deprecated functions and parametes 2025-08-19 16:07:05 +08:00
Mahavir Jain
f9e2ebaea5 feat(protocomm): disable security version 0 and 1 by default
Change default values for protocomm security configuration options to improve
security:
- CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_0 now defaults to 'n'
- CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_1 now defaults to 'n'

This reduces code size by default and encourages use of more secure protocomm
implementations.
Projects using these security versions must explicitly enable them in their
configuration.
2025-08-12 11:43:12 +05:30
Marius Vikhammer
bf84ab652a change(test_utils): moved test_utils component to tools/test_apps/components/ 2025-07-21 14:05:50 +08:00
Shen Meng Jing
62d4115e08 docs: Fix some typos 2025-04-30 18:35:39 +08:00
Chen Jichang
c34b4eb882 feat(esp32h4): enable ESP32H4 ci build 2025-03-28 14:41:28 +08:00
Mahavir Jain
2fcceb01a7 feat(protocomm): add (hidden) config option to indicate security patch feature 2025-03-17 10:20:01 +05:30
Mahavir Jain
3bd5a22f5a fix(provisioning): fix incorrect AES-GCM IV usage in security2 scheme
Using same IV in AES-GCM across multiple invocation of
encryption/decryption operations can pose a security risk. It can help
to reveal co-relation between different plaintexts.

This commit introduces a change to use part of IV as a monotonic
counter, which must be incremented after every AES-GCM invocation
on both the client and the device side.

Concept of patch version for a security scheme has been introduced here
which can help to differentiate a protocol behavior for the provisioning
entity. The security patch version will be available in the JSON
response for `proto-ver` endpoint request with the field
`sec_patch_ver`.

Please refer to documentation for more details on the changes required
on the provisioning entity side (e.g., PhoneApps).
2025-03-07 13:49:10 +05:30
Mahavir Jain
641f461346 fix(protocomm): memory leak issue for session command0 failure case 2025-03-07 13:49:09 +05:30
igor.udot
daf2d31008 test: format all test scripts 2025-03-05 12:08:48 +08:00
gaoxu
5ef4f20778 feat(esp32h21): disable unsupported build test 2025-02-06 15:47:51 +08:00
hrushikesh.bhosale
e9844bd613 fix(protocomm): Added check for cur_cookie_session_id
Added check to check whether the value of cur_cookie_session_id
is -1 or not, if yes the return with error log message
2024-12-03 14:48:46 +05:30
Ivan Grokhotkov
68e9bcbf1e fix(build): clean up dependencies on driver component 2024-11-07 13:09:23 +01:00
Rahul Tank
fb55646270 fix(nimble): Add notify characteristic flag support 2024-09-05 16:16:08 +05:30
Rahul Tank
338d9f40d9 fix(wifi_prov): Add support for ESP IP controller chips in bluedroid 2024-08-29 14:56:46 +05:30
shreeyash
6e6fd2f6a3 fix(wifi_prov_mgr): Api to keep BLE on after provisioning 2024-08-13 12:42:35 +05:30
Rahul Tank
35e88684db fix(wifi_prov): Use calloc instead of malloc to zero initialize variable 2024-08-02 10:33:28 +05:30