Commit Graph

48 Commits

Author SHA1 Message Date
isha.pardikar@espressif.com
29ff30b4c7 wifi_prov_mgr: Fixed memory leak after bluetooth stack was stopping. 2023-07-17 06:05:36 +00:00
isha.pardikar@espressif.com
c134171e80 wifi_prov_mgr : Fixed return value of characteristic read operation 2023-03-09 10:44:54 +05:30
Isha Pardikar
eb490dc18e Merge branch 'feature/rainmaker_BT_configurable' into 'release/v4.4'
Doc: Made bluetooth configurable after wifi provisioning is completed

See merge request espressif/esp-idf!19263
2022-07-27 12:24:50 +05:30
Rahul Tank
7a01fe7a71 WifiProv: Extended support for configuring if link encryption is needed
when attempting to read / write characteristic to bluedroid stack
2022-06-23 17:44:38 +05:30
lorenzo.consolaro
c9d5c14451 Fix iOS advertisement response and simplify 2022-05-09 10:09:06 +05:30
Isha Pardikar
916533ef92 Merge branch 'bugfix/wifi_prov_mgr_conn_issue' into 'release/v4.4'
NimBLE: Fixed device disconnection issue of wifi prov mgr

Closes IDF-4655

See merge request espressif/esp-idf!17618
2022-03-28 11:49:09 +05:30
Laukik Hase
c3d2f2361c protocomm: Updated function for constant time buffer comparison
- mbedtls_ssl_safer_memcmp() -> mbedtls_ct_memcmp()
2022-02-02 10:56:48 +05:30
isha pardikar
5ba6ac26c4 Merge branch 'bugfix/protocomm_nimble_allocation' into 'master'
NimBLE: Fixed potential allocation bug in protocomm_nimble.c

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

See merge request espressif/esp-idf!15669
2021-11-18 14:17:35 +05:30
isha pardikar
09800028e1 Wifi_prov_mgr:Fix for ios device needs to do forget device 2021-10-06 17:46:22 +08:00
Switi Mhaiske
99cce49299 ESP32C3: Fix for provisioning failure with ble transport mode and bluedriod stack 2021-07-22 15:37:46 +08:00
Prasad Alatkar
c8f4153d4f Provisioning BLE: Add API to set manufacturer data in scan response
- Add `wifi_prov_scheme_ble_set_mfg_data` API to set custom manufacturer data
  in BLE advertisements.
- Run format.sh script on modified files.
- Fix few typos in `protocomm_nimble.c`.

- Incorporate suggestion to remove extra check on protocomm_ble_mfg_data_len

- Remove few unnecessary comments.
2021-07-14 11:56:04 +05:30
Siarhei Volkau
ba15970abb esp_http_server, protocomm: Consider a connection as closed if recv() returns 0
This check prevents infinite loop on closed sockets

Closes https://github.com/espressif/esp-idf/pull/6541

Signed-off-by: Shubham Kulkarni <shubham.kulkarni@espressif.com>
2021-06-08 05:48:30 +00:00
kewal shah
b8dfb27141 protocomm_console.c: Fix out of bound read in protocomm_console_task and define line_buf size 2021-05-11 04:00:47 +00:00
Rahul Tank
105497f861 Add secure connection for just works in provisioning app for bluedroid
This MR adds support of secure connection, encryption flags to characteristics and bonding with Just Work as association model

[BLE Provisioning] Added secure connection pairing support to unified provisioning framework.
2021-04-01 09:29:03 +00:00
Prasad Alatkar
fbd906e05f BLE provisioning: Add secure connection pairing with just works for NimBLE 2021-04-01 17:26:30 +08:00
Prasad Alatkar
bf6ff41a9e BLE Provisioning: Remove unnecessary strdup/free from protocomm_nimble
Closes IDFGH-4980
2021-03-25 16:55:57 +05:30
Aditya Patwardhan
d36479728c protocomm: Fixed NULL check of allocated memory
Fixes one part of - https://github.com/espressif/esp-idf/issues/6440
2021-02-10 02:07:58 +00:00
zwj
7c1c669799 component/bt: add BLE v5.0 feature for bluedroid host 2021-01-15 17:55:12 +08:00
Piyush Shah
541cf16c9e protocomm security1: Restart security session if SESSION_STATE_CMD0 is received
With the introduction of cookies to track a session, it is possible that the
clients restart the provisioning on the same session, specifically when a user
cancels a current provisioning attempt. This can result in an error as the state
on the device side and client side will go out of sync.

This has now been changed such that if SESSION_STATE_CMD0 is received on
an existing session, the state is reset and flow allowed to continue.
2021-01-13 04:34:10 +00:00
Piyush Shah
72fa8d0750 protocomm_httpd: Use HTTP cookies to track session
Earlier, a "socket connection" was being considered as a protocomm "session".
However, for HTTP, we cannot expect clients to necessarily use the same
socket for all requests of a given transaction. This was indeed causing
some failures for Wi-Fi provisioning from Android phones.

So, we have introduced http cookies to track a session even if the socket
connection does not stay intact throughout the transaction.
This change is backward compatible. If the client does not use cookies, the
socket connection will be considered as the session.

Closes: https://github.com/espressif/esp-idf/issues/6316
Reference: https://github.com/espressif/esp-idf/pull/6330
2021-01-13 04:34:10 +00:00
Piyush Shah
85cb1e8ca3 protocomm_httpd: Change an info print to debug print as it isn't really required in the logs 2020-11-18 04:12:47 +00:00
Prasad Alatkar
13433d10fc Protocomm/simple_ble: Make gatt table map size equal to number of handles received
- Fixes memcpy failure observed while adding 2 or more endpoints in
  wifi_provisioning.

 Closes IDF-2250
2020-11-05 08:53:13 +00:00
kewal shah
9a16b551ef protocomm_console.c: Check if memory is allocated to buf and if not then return ESP_ERR_NO_MEM error 2020-10-06 10:13:40 +05:30
Prasad Alatkar
457d4f36a6 BLE provisioning: Add check for valid ble read offset 2020-07-14 13:14:53 +00:00
Piyush Shah
05852bc4aa protocomm_httpd: Restart security session if request is received on a new session
This commit fixes a bug as well as changes a behaviour.

Bugfix: During softap/httpd based provisioning, if a session was closed
midway and a new one started, it would never proceed if the http server
assigns same socket number to the new session (which happens almost always).
Now, if a session is closed, using the http callbacks, the older session
data is cleared so that a new one can be created.

Behavioural change: If a client (mobile app particularly) does not use
persistent http session i.e. all provisioning communication on the same
socket, the provisioning may fail. Earlier, since the session context was
not getting cleared, even if the client closed a session and continued
on a new one, it would go through if the socket number assigned was same
(which happens almost always).

Ideally, from a security perspective, all communication related
to secure provisioning must happen on the same socket, and so, this
change is required.
2020-05-11 13:01:13 +00:00
Hrishikesh Dhayagude
3080cad4da Unified Provisioning - BLE: Fix characteristics read response issue
Fix the issue when number of bytes to be read is an exact multiple of [MTU-1]
2020-02-18 14:42:07 +08:00
Prasad Alatkar
4c7b83defc NimBLE: Fix bug in protocomm_nimble chararcteristic access callback
Fixes bug in `protocomm_nimble` while writing to characteristic with length greater than MTU value.
2019-08-15 10:50:30 +08:00
Anton Maklakov
afbaf74007 tools: Mass fixing of empty prototypes (for -Wstrict-prototypes) 2019-08-01 16:28:56 +07:00
Prasad Alatkar
388b350f0d NimBLE-provisioning: Add NimBLE support to unified provisioning framework
- Adds NimBLE stack support to existing BLE variant of unified provisioning.
- Uses scan response to send device name, 128 bit custom UUIDs based on service
  UUID.
- Minimal changes to `app_prov.c`, component.mk, CMakeLists.txt and
  `protocomm_ble.h` to accomodate NimBLE stack for provisioning.
2019-07-02 14:20:10 +08:00
Anurag Kar
eb5cc203f9 protocomm_ble : Bugfix for unbound memcpy on prepare write buffer
Closes https://github.com/espressif/esp-idf/issues/3633
2019-06-25 19:58:19 +00:00
Angus Gratton
8b890bdaf3 Merge branch 'bugfix/protocomm_sec_mult_inst' into 'master'
Protocomm : Session security now supports multiple instances of the same type

See merge request idf/esp-idf!4756
2019-06-03 11:46:24 +08:00
Anurag Kar
5384338341 Protocomm : Minor fixes
List of changes:
* protocomm_httpd : Reset session_id static variable on start and stop
* security1 : Typo in checking failed dynamic allocation
2019-05-28 14:41:49 +05:30
Roland Dobai
a1bddb923b Rename Kconfig options (components/bt) 2019-05-21 09:09:01 +02:00
Anurag Kar
120bd3a456 protocomm_ble : Fixed custom service UUID support
List of changes:
* Use 128 bit characteristic UUIDs when creating GATT table entries
* Change primary service attribute value to 128 bit custom service UUID
* Use raw advertisement data to convey flags and 128 bit primary service UUID
* Use raw scan response to send device name as complete local name
* Increase maximum device name length in relation to maximum scan response length
* Set Characteristic User Description attributes for each characteristic to convey protocomm endpoint names
2019-05-15 12:27:03 +00:00
Anurag Kar
86e9acc2c9 Protocomm : Added new APIs for opening and closing secure sessions
New APIs:
* protocomm_open_session()
* protocomm_close_session()

This allows external applications using protocomm to manually create and close sessions.

These internally call the new_transport_session() and close_transport_session() APIs implemented by the security scheme in use.

Updated unit tests with usage of new APIs
2019-04-16 13:50:01 +05:30
Anurag Kar
cccf829366 Protocomm : Session security now supports multiple instances of the same type
List of changes:
* Security APIs accept handle to instance created during initialization
* Protocomm internally stores the security instance handle and calls security APIs with this handle as first parameter
2019-04-16 13:47:13 +05:30
Hrishikesh Dhayagude
a717825b7e Unified Provisioning: Miscellaneous fixes in BLE
1. Pass the correct conn_id to protocomm_req_handle
In transport_simple_ble_write(), passing param->exec_write.conn_id would
be invalid. Instead param->write.conn_id should be passed
Similar change in transport_simple_ble_exec_write() to use
param->exec_write.conn_id

2. simple_ble_start() assumes that the mode is BLE only and enables
Bluetooth controller accordingly. For, cases having BT + BLE like Alexa
(Provisioning over BLE + Audio over classic BT), this assumption should
be removed.
2019-04-05 14:27:24 +05:30
morris
c159984264 separate rom from esp32 component to esp_rom
1. separate rom include files and linkscript to esp_rom
2. modefiy "include rom/xxx.h" to "include esp32/rom/xxx.h"
3. Forward compatible
4. update mqtt
2019-03-21 18:51:45 +08:00
Hrishikesh Dhayagude
ce065f1a4f Protocomm BLE: Make changes in handling BLE read/write requests
1. Remove unwanted malloc during BLE send response
2. Populate the missing parameters in the response - handle, offset, auth_req
2019-03-11 19:39:26 +05:30
Anurag Kar
f3a6c63920 protocomm : typos fixed and descriptions corrected 2019-02-15 10:45:34 +00:00
Anurag Kar
f4cba0c295 protocomm security : memory leaks fixed
List of changes:
* Corner case exceptions are properly handled to ensure release of memory occupied by security infrastructure
* fixed erroneous cleanup of security instance by protocomm_console
2019-02-15 10:45:34 +00:00
Anurag Kar
a1d37c833c protocomm : version endpoint behavior simplified
List of changes:
* Version endpoint now sends the set version string instead of verifying the incoming version string. This simplifies fetching version info from the provisioning application.
* esp_prov script updated to expect version string as response.
2019-02-15 10:45:34 +00:00
Anurag Kar
776c23da4a provisioning framework : 'extern C' directives added for C++ support 2019-02-15 10:45:34 +00:00
Piyush Shah
759b90a5e1 protocomm_httpd: Allow applications to pass HTTPD handle
This will be useful if a webserver is already running and the application
does not want protocomm to start a new instance.

Signed-off-by: Piyush Shah <piyush@espressif.com>
2019-02-04 18:22:05 +05:30
Anurag Kar
e2b1ae259d Protocomm : Use esp_http_server instead of http_server 2018-10-24 17:32:43 +05:30
Anurag Kar
84f094453b Examples : Added provisioning examples, tests and client tool.
* BLE and softAP provisioning examples added along with tests.
* An application specific example added for demonstrating custom provisioning scheme.
* tools/esp_prov/esp_prov.py can be used as a provisioning client for SoftAP, BLE and CLI based transports.

Co-Authored-By: Amey Inamdar <amey@espressif.com>
Co-Authored-By: Anurag Kar <anurag.kar@espressif.com>
2018-10-02 19:07:28 +05:30
Amey Inamdar
9428375368 Protocomm : Added support for choice of transport - WiFi (SoftAP+HTTPD), BLE, Console (development friendly transport)
Co-Authored-By: Amey Inamdar <amey@espressif.com>
Co-Authored-By: Anurag Kar <anurag.kar@espressif.com>
2018-10-02 19:07:28 +05:30
Amey Inamdar
d0c777b2e1 Protocomm : Added component core for protocol communication
* This manages secure sessions and provides framework for multiple transports.
* The application can use protocomm layer directly to have application specific extensions for provisioning (or non-provisioning) use cases.
* Following features are available for provisioning :

  * Security - Security0 (no security), Security1 (curve25519 key exchange + AES-CTR encryption)
  * Proof-of-possession support for Security1

* Protocomm requires specific protocol buffer modules for compilation which can be generated from the `.proto` files in the `proto` directory using make.

Co-Authored-By: Amey Inamdar <amey@espressif.com>
Co-Authored-By: Anurag Kar <anurag.kar@espressif.com>
2018-10-02 19:07:28 +05:30