Commit Graph

188 Commits

Author SHA1 Message Date
Rahul Tank
f6fcd6470c fix(nimble): update sbom file with cve details 2026-07-28 21:25:14 +05:30
Rahul Tank
16f9e082dd feat(protocomm): Add support for BLE 5 for bluedroid 2026-07-28 16:20:15 +05:30
Rahul Tank
e08609e451 fix(nimble): Migrate to NimBLE 1.9.0 2026-07-27 14:14:35 +05:30
Shreeyash Bhakare
c368c13d55 fix(nimble): Added security related fixes 2026-07-25 08:54:16 +05:30
Ashish Sharma
aebc7fa691 fix(protocomm): fix response leaks and stale key IDs on error paths 2026-07-15 15:46:58 +08:00
yi chen
1fa38c2f25 Avoid re-destroying a released Security1 key
The second cipher-update failure destroys the volatile symmetric key but left its identifier cached in session state. Clear it immediately so sec1_close_session() cannot try to destroy the same key again.

Constraint: Follow-up to maintainer review on espressif/esp-idf#18813

Confidence: high

Scope-risk: narrow

Tested: security1.c cross-compiled for ESP32 with Xtensa GCC 14.2.0; test_security1.c compiled with the test app flags; git diff --check

Not-tested: Full master test-app link or on-target execution; local IDF 5.4.3 differs from the PR's master baseline in PSA ABI and Mbed TLS headers
2026-07-14 16:08:42 +08:00
yi chen
641c2f7c53 fix(protocomm): free response buffers on 2nd psa_cipher_update failure
In handle_session_command1(), if the second psa_cipher_update()
call (encrypting the device verify data to send back to the client)
fails, the error path only frees the outbuf ciphertext buffer. The
out (Sec1Payload) and out_resp (SessionResp1) structures allocated
just before it are never freed, and neither the cipher operation
(cur_session->ctx_aes) nor the imported key (key_id) are released.

The caller (sec1_req_handler(), via sec1_session_setup()) returns
immediately on a non-ESP_OK result without doing any cleanup of its
own here - sec1_session_setup_cleanup() only runs on the success
path, once resp->sec1 has actually been assigned - so nothing else
ever frees these on this path.

Add psa_cipher_abort()/psa_destroy_key() and free() for out/out_resp,
matching the cleanup already done for every other failure branch
earlier in this same function.

Fixes #18804

Signed-off-by: yi chen <94xhn1@gmail.com>
2026-07-10 06:53:44 +08:00
Ashish Sharma
fae2038058 fix(protocomm): null output buffer pointer on crypto failure 2026-06-09 11:48:46 +08:00
Rahul Tank
3f33d345cf fix(protocomm): harden nimble transport size handling 2026-06-02 15:03:52 +05:30
Andrii Anoshyn
3fcc127672 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-05-22 22:18:59 +03:00
Chen Jichang
3c3b9a6a4e ci(esp32h4): disable tests which cannot pass 2026-05-11 16:48:58 +08:00
Jim
688eef5dff fix(protocomm): Add GATT service initialization that when gatt service changed, the peer can refresh gatt service 2026-05-09 10:24:08 +08:00
Mahavir Jain
35fe22582a Merge branch 'fix/protocomm-security2-srp-hd-double-free' into 'master'
fix(protocomm): null srp_hd after free in sec2 command0 error paths

Closes IDF-15579

See merge request espressif/esp-idf!47888
2026-04-27 08:50:20 +05:30
Mahavir Jain
322eabd390 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-23 13:43:09 +05:30
Aditya Patwardhan
bf56fad62d Merge branch 'fix/protocomm-close-session-id-mismatch' into 'master'
fix(protocomm): pass current session id when closing existing session

See merge request espressif/esp-idf!47562
2026-04-21 19:55:01 +05:30
Aditya Patwardhan
9dc64a7402 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-04-14 11:05:51 +05:30
Ashish Sharma
14731c19f0 fix(esp_srp): reject SRP client public key when A mod N is zero 2026-04-10 17:12:53 +08:00
Ashish Sharma
a2f4554f10 fix(protocomm): fixes potential issues that can lead to crash during device provisioning 2026-04-01 10:08:00 +08:00
Rahul Tank
9e581d7d68 fix(nimble): Bugfixes for various issues 2026-02-16 10:53:34 +05:30
Mahavir Jain
ecc8fda914 Merge branch 'bugfix/esp_local_ctrl_arg_check' into 'master'
fix(esp_local_ctrl): validate payload_case matches msg_type in command dispatcher

See merge request espressif/esp-idf!45817
2026-02-13 09:13:16 +05:30
Mahavir Jain
4631b4a5d9 docs(protocomm): recommend using security2 scheme for production purpose 2026-02-11 13:55:44 +05:30
Alexey Lapshin
72a3697c6c fix(protocomm): fix error handling for esp_srp_exchange_proofs() 2026-02-06 14:21:25 +07:00
harshal.patil
e9ea55bea2 feat(mbedtls/ecdsa): Introduce PSA ECDSA driver 2026-01-19 09:14:37 +05:30
Ashish Sharma
773411a9b0 feat: migrates protocomm to PSA APIs 2025-12-30 09:31:49 +05:30
Rahul Tank
47552ff4fd fix(protocomm): Add security checks for buffer overflow and incorrect length handling 2025-12-16 10:16:05 +05:30
C.S.M
f405e51784 ci(esp32s31): Add ci build test for esp32s31 2025-12-11 15:17:15 +08:00
Mahavir Jain
9c6f6c7470 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).
2025-11-20 14:22:40 +05:30
Rahul Tank
2738c5ac76 fix(nimble): Address compilation issues in nimble examples 2025-10-30 10:54:36 +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
Rahul Tank
928117e999 fix(wifi_prov): Added API to set random address 2024-07-21 15:37:37 +05:30