Commit graph

9122 commits

Author SHA1 Message Date
Mahavir Jain 7a2ea9b7f7 esp-tls: add support for using hardware security module 2020-05-20 22:52:37 +05:30
Bryan Hunt 4553f6c95d Add cryptoauthlib as a component with mbedtls integration
* Add options to mbedtls for hardware acceleration
* Disable mbedtls EC curves if hardware acceleration is selected
since the hardware will have to define the curves supported
* Add a hardware ecdsa example
2020-05-20 22:52:37 +05:30
Jiang Jiang Jian 5f08bed88b Merge branch 'feature/optimize_wifi_API_max_tx_power_description' into 'master'
feature: optimize wifi API max tx power description

Closes WIFI-1097

See merge request espressif/esp-idf!8173
2020-05-20 22:43:54 +08:00
lly b1f3843ed6 ble_mesh: Clear two more vars during proxy server deinit 2020-05-20 11:35:26 +00:00
lly d5b126667a ble_mesh: Add missing sdkconfig.h 2020-05-20 11:35:26 +00:00
lly 4e60919a66 ble_mesh: Init device name during proxy server init
Device name will be reset when deinit mesh stack. If not
initializing device name during the next mesh stack init,
it will fail to set the device name when using bluedroid.
2020-05-20 11:35:26 +00:00
lly a0ce8c64b0 ble_mesh: Add init flag for friend init/deinit
Since bt_mesh_friend_init() will only be invoked when
a device is provisioned or Provisioner is enabled, so
we add a flag to indicate if the friend functionality
is initialized in case deinit before initialization.
2020-05-20 11:35:26 +00:00
Angus Gratton 5bd75b134d esptool: Set 80MHz SPI flash speed for ESP32-S2 & future chips
Most ESP32 devices will also work at 80MHz, but third party boards/modules
may not have been tested at this speed so the default is kept at 40MHz for safety.
2020-05-20 06:19:34 +00:00
Mahavir Jain e497bf37c4 Merge branch 'bugfix/httpd_lru_purge' into 'master'
esp_http_server: Fixed a bug which could cause issues with LRU purge

Closes IDFGH-2680

See merge request espressif/esp-idf!8818
2020-05-20 14:08:02 +08:00
Alexander Borsuk fb0fa34ac8 sdmmc: Correctly check function parameters before using them
Closes https://github.com/espressif/esp-idf/pull/5000
2020-05-20 13:09:05 +08:00
David Čermák 7d7f3f8d8f Merge branch 'bugfix/esp_netif_minor_fixes' into 'master'
esp-netif: Minor fixes

Closes IDFGH-3311

See merge request espressif/esp-idf!8799
2020-05-20 12:47:01 +08:00
ronghulin cdaeef70c3 feature: optimize wifi API max tx power description 2020-05-20 11:52:42 +08:00
Jiang Jiang Jian af97a5abc3 Merge branch 'workaround/wps_iot_fixes' into 'master'
wpa_supplicant: WPS Inter operatability Fixes

See merge request espressif/esp-idf!8654
2020-05-20 11:32:34 +08:00
Jiang Jiang Jian b0cbc4f7bb Merge branch 'bugfix/optimize_4way_handshake' into 'master'
ESP-WIFI; Optimize 4way handshake failure time

See merge request espressif/esp-idf!8020
2020-05-20 11:29:56 +08:00
Jiang Jiang Jian 05f4668ad0 Merge branch 'nimble/update_nimble_submodule' into 'master'
NimBLE: Include upstream fixes and use macros for log level filtering

See merge request espressif/esp-idf!8448
2020-05-20 11:23:46 +08:00
Piyush Shah c2ab112590 esp_http_server: Fixed a bug which could cause issues with LRU purge
LRU counter should be started from 1, and not 0, so that all checks
work fine.

Closes https://github.com/espressif/esp-idf/issues/4753
2020-05-19 22:11:02 +05:30
Mahavir Jain 7dbf01afad coap: move mbedTLS config options from component to examples
CoAP component relies on some mbedTLS crypto configuration
options, e.g. DTLS and PSK. These configuration options if
selected, have footprint impact on generic TLS examples like
https_request or https_ota as well.

Footprint of https_request example with/without change is per below:

$ ./tools/idf_size.py new_https_request.map --diff old_https_request.map

<CURRENT> MAP file: new_https_request.map
<REFERENCE> MAP file: old_https_request.map
Difference is counted as <CURRENT> - <REFERENCE>, i.e. a positive number means that <CURRENT> is larger.
Total sizes of <CURRENT>:                                                 <REFERENCE>     Difference
 DRAM .data size:   14796 bytes                                                 14796
 DRAM .bss  size:   23560 bytes                                                 23680           -120
Used static DRAM:   38356 bytes ( 142380 available, 21.2% used)                 38476           -120 (   +120 available,      +0 total)
Used static IRAM:   89045 bytes (  42027 available, 67.9% used)                 89045                (     +0 available,      +0 total)
      Flash code:  554231 bytes                                                563823          -9592
    Flash rodata:  179000 bytes                                                181224          -2224
Total image size:~ 860632 bytes (.bin may be padded larger)                    872568         -11936

This commit moves relevant config options to CoAP specific examples
and also adds some run time warnings if they are kept disabled.

Closes https://github.com/espressif/esp-idf/issues/5262
2020-05-19 17:23:29 +05:30
kapil.gupta fb53a454b9 ESP-WIFI: Optimize 4way handshake failure time
In case of wrong passpharse, AP will keep on sending 1/4 multiple
times which may take around 10 secs to disconnect and detect
wrong password event.

Add changes to reject EAPOL1 after 3 consecutive reception
2020-05-19 16:55:42 +05:30
Jiang Jiang Jian 56c307b356 Merge branch 'mesh/set_type_new' into 'master'
mesh: support set new type (node and sta)

Closes WIFI-1824, WIFI-1725, WIFI-1823, and WIFI-1908

See merge request espressif/esp-idf!7934
2020-05-19 16:53:49 +08:00
Ivan Grokhotkov 948580d1a2 Merge branch 'gdb/bt_on_invalid_pc' into 'master'
gdb: Modify PC in case of invalid PC

See merge request espressif/esp-idf!8391
2020-05-19 16:44:07 +08:00
David Cermak 95b5ef3687 esp-netif: wifi-deinit to clear handlers only in tcpip-adapter mode 2020-05-19 08:34:36 +00:00
David Cermak 1183b95cc4 esp-netif: Fix compilation if ESP_GRATUITOUS_ARP not enabled
Closes https://github.com/espressif/esp-idf/issues/5294
2020-05-19 08:34:36 +00:00
kapil.gupta 76335b2558 wpa_supplicant: WPS Inter operatability Fixes
Add WPS IOT fixes under config option

Current fixes under this flag.
1. Allow NULL-padded WPS attributes.
2. Bypass WPS-Config method validation
2020-05-19 08:05:52 +00:00
Nachiket Kukade c643d0a611 wpa_supplicant: Allow NULL-padded WPS attributes
Some AP's keep NULL-padding at the end of some variable length WPS
Attributes. This is not as par the WPS2.0 specs, but to avoid interop
issues, ignore the padding by reducing the attribute length by 1.
2020-05-19 08:05:52 +00:00
Angus Gratton 183dddd50e Merge branch 'bugfix/wdt_reset_info_unicore' into 'master'
bootloader: Don't print an error message after WDT reset in unicore mode

See merge request espressif/esp-idf!8570
2020-05-19 15:54:06 +08:00
Michael (XIAO Xufeng) fd3e28ef0d Merge branch 'bugfix/esp_flash_write_performance_regression' into 'master'
esp_flash: fix the write performance regression

See merge request espressif/esp-idf!8658
2020-05-19 12:06:42 +08:00
houwenxiang 0bf2906bc9 driver(RMT): Fix the breaking change issue of RMT driver introduced by refactoring.
After RMT driver refactor, two breaking change are introduced:

    1. Users needs to call `rmt_driver_install` before `rmt_config`.

    2. Do not support memory block count > 1,

    fix this two issues

    closes https://github.com/espressif/esp-idf/issues/4664

    closes https://github.com/espressif/esp-idf/issues/4959
2020-05-19 11:39:38 +08:00
Angus Gratton 3e7ba2f389 bootloader: Don't print an error message after WDT reset in unicore mode
Caused some confusion here: https://github.com/espressif/esp-idf/issues/4388
2020-05-19 03:35:53 +00:00
Angus Gratton 4fa8f7d01b Merge branch 'bugfix/parttool_get_info_wo_info_option' into 'master'
partition_table: Fix parttool.py crashes when retrieving partition info

Closes IDFGH-3279

See merge request espressif/esp-idf!8715
2020-05-19 11:30:20 +08:00
chenyudong 040f4be2a7 mesh: support set new type
If the root is specified (FIXED-ROOT) by set type or set parent, change ie.mesh_type to MESH_ROOT before connect to router
Release emesh_recv_toDS when the root becomes non-root
esp_mesh_set_type now supports MESH_IDLE and MESH_STA
2020-05-19 11:17:56 +08:00
Jiang Jiang Jian 37f4e3855f Merge branch 'bugfix/fix_sta_connect_compatibility' into 'master'
esp_wifi: Fix the timeout issue of EAPOL four-way handshake

Closes WIFI-2110 and WIFI-1809

See merge request espressif/esp-idf!8382
2020-05-18 22:26:52 +08:00
houwenxiang b35d9002f3 driver(I2S): Fix i2s_comm_format_t configuration parameter does not match the TRM bug.
When I2S `i2s_comm_format_t` is set to `I2S_COMM_FORMAT_I2S_MSB`, the data should launch at first BCK. But not in fact, this MR fixed this issue.

For compatibility, several nwe parameters have been added, and the old parameters will be removed in the future.

    closes https://github.com/espressif/esp-idf/issues/5065

    closes https://github.com/espressif/esp-idf/issues/4957

    closes https://github.com/espressif/esp-idf/issues/2978

    closes https://github.com/espressif/esp-idf/issues/5136

    Merges https://github.com/espressif/esp-idf/pull/4522
2020-05-18 19:55:30 +08:00
Darian Leung 11d96b39d0 esp_ipc: Move to new component
This commit moves esp_ipc into a separate component.
2020-05-18 16:51:45 +08:00
David Cermak 8a45f074fc esp-netif: Added API to get the underlying interface name
The interface name can be used in socket API, i.e. setsockopt(). The API esp_netif_get_netif_impl_name() shoudl be used to populate standard
interface structure struct ifreq.
2020-05-18 09:26:24 +02:00
David Cermak 06711c7c36 examples: common connect component to use both interfaces at once 2020-05-18 09:26:24 +02:00
xiehang 158602c942 esp_wifi: Fix the timeout issue of EAPOL four-way handshake 2020-05-18 14:53:31 +08:00
weitianhua 8fc05d0665 Fix ASSERT for RXDESC and save the log for debug 2020-05-18 06:51:51 +00:00
weitianhua 8d1032ccac Fix ASSERT in ld_acl at line 302 forclkoff1 and localval 2020-05-18 06:51:51 +00:00
weitianhua 77cc105c72 Fix ld_acl schedule bug to parity shift 2020-05-18 06:51:51 +00:00
weitianhua 55877684a0 Fix ASSERT(64,0) in rwble.c 2020-05-18 06:51:51 +00:00
weitianhua 0811851378 Fix ASSERT in ld_pscan.c at line 1032 2020-05-18 06:51:51 +00:00
weitianhua b20f254483 Free lmp tx buf in EM in the procedure of handling LMP_detach_Req when not received the last acknowledge from peer device and seperate them by ACL State 2020-05-18 06:51:51 +00:00
weitianhua 190ff3ae37 Fix that when slave initiate unsniff procedure and meet transaction collision, no mode change event is repoerted 2020-05-18 06:51:51 +00:00
weitianhua 70fa5b4ac5 Fix int_wdt due to disable interrupt too long time 2020-05-18 06:51:51 +00:00
weitianhua c18ed5cbee Fix Connection fail in loop 2020-05-18 06:51:51 +00:00
weitianhua 7aeb3d329a Set AFH in BTDM Task when WiFi changes channel 2020-05-18 06:51:51 +00:00
weitianhua e0e1154b62 Fix ASSERT(25,0) in lc_task.c 2020-05-18 06:51:51 +00:00
weitianhua 899e49b90e Disable frequent warning log in ld_acl 2020-05-18 06:51:51 +00:00
weitianhua b45f2d3913 Move default log level to WARNING instead ERROR in BT Controller 2020-05-18 06:51:51 +00:00
Mahavir Jain be3b6b7cb8 Merge branch 'feature/mbedtls_dynamic_memory' into 'master'
feat(mbedtls): add dynamic buffer and local resource managment to decrease SSL heap cost

See merge request espressif/esp-idf!8313
2020-05-18 13:55:05 +08:00
Michael (XIAO Xufeng) 3f778a92da spi_flash: add unit test for read/write performance 2020-05-17 22:06:03 +08:00
Michael (XIAO Xufeng) 651eb1a694 esp_flash: fix the write performance regression
Also changed internal delay unit into microsecond.
2020-05-17 22:06:02 +08:00
Michael (XIAO Xufeng) f67044c822 spi: simplify the caps header
The mapping logic from register address to instance number is moved into the LL
2020-05-17 22:06:01 +08:00
Michael (XIAO Xufeng) dae3196157 esp_flash: fix issue that cannot add flash on SPI1 CS1 when SPI_FLASH_SHARE_SPI1_BUS is disabled 2020-05-17 22:06:00 +08:00
Jiang Jiang Jian bb2379b7ab Merge branch 'bugfix/wpa3_mixed_mode_authype' into 'master'
esp_wifi: Add and utilize WPA3/WPA2 Mixed mode Authtype

See merge request espressif/esp-idf!8778
2020-05-17 17:04:18 +08:00
Jiang Jiang Jian bef57a8ddc Merge branch 'bugfix/V3.1.7_ble_bug_mr' into 'master'
component/bt: fix notify malloc failed , fix no BLE_AUTH_CMPL_EVT and fix bluedroid btc deinit crash

See merge request espressif/esp-idf!8729
2020-05-16 19:52:34 +08:00
Island 52e9bcb696 Merge branch 'bugfix/ble_mesh_remove_patch' into 'master'
ble_mesh: Remove patch for the bug of an App

Closes BLEMESH-202

See merge request espressif/esp-idf!8737
2020-05-15 20:17:22 +08:00
Nachiket Kukade d7edd28338 esp_wifi: Update WiFi lib
Add and utilize WPA3/WPA2 Mixed mode Authtype.
2020-05-15 17:24:51 +05:30
Mahavir Jain 5b5a8c276d Merge branch 'feature/mbedtls_add_config_options' into 'master'
Add config options in mbedtls

See merge request espressif/esp-idf!8760
2020-05-15 15:53:21 +08:00
zhiweijian ec6c7558ef add congest direct callback and fix malloc failed when multi_connection notify performance test 2020-05-15 15:35:39 +08:00
Angus Gratton 62754ff90a Merge branch 'docs/fix_static_sem_api_desc' into 'master'
Fix usage example in xSemaphoreCreateBinaryStatic

Closes IDFGH-3280

See merge request espressif/esp-idf!8750
2020-05-15 15:04:36 +08:00
Shubham Kulkarni ca3daa50de mbedtls: Add configuration options 2020-05-15 11:27:44 +05:30
Jiang Jiang Jian 26ab1c54ec Merge branch 'bugfix/esp32s2_wifi_skip_light_sleep' into 'master'
esp_wifi: When WiFi TSF is active, skip light sleep

Closes WIFI-2305 and WIFI-2306

See merge request espressif/esp-idf!8639
2020-05-15 11:41:45 +08:00
David Čermák 5e436be77f Merge branch 'bugfix/stop_mac_can_be_controlled_by_user' into 'master'
ethernet: esp_eth_stop API should stop emac hardware

Closes WIFI-2247 and WIFI-2337

See merge request espressif/esp-idf!8664
2020-05-15 04:40:55 +08:00
Mahavir Jain 0d208aabab mbedtls: esp32s2: check and reallocate output buffer if its from non-DMA range
Earlier check was for only input buffer but it is quite likely to have
output buffer also from non-DMA memory range and hence requirement to
reallocate and then copy data from AES engine.
2020-05-14 13:12:26 +00:00
Mahavir Jain 18c1838587 esp32s2: add config option to place RTC data in fast RAM 2020-05-14 13:12:26 +00:00
Mahavir Jain 1aac284dda heap: add rtc fast memory region to dynamic pool
- for ESP32 only enabled in case of unicore config
- capability wise this region (8K) is same as DRAM, except non-DMA capable
- also fixed small issue in reserved memory region processing when (start == end)
2020-05-14 13:12:26 +00:00
Dong Heng 3d57bf30a2 feat(mbedtls): add dynamic buffer and local resource managment to decrease SSL heap cost 2020-05-14 11:45:09 +00:00
Dmytro ecbfe0f406 Fix usage example in xSemaphoreCreateBinaryStatic 2020-05-14 18:57:48 +08:00
Krzysztof 9b5acea160 Add missing link to ulp header files and link to example following https://esp32.com/viewtopic.php?f=2&t=15562 2020-05-14 17:31:05 +08:00
Michael (XIAO Xufeng) 437a8fa9d2 Merge branch 'test/sdio_ut_performance_time' into 'master'
sdio: fix random unit test performance failure

See merge request espressif/esp-idf!8665
2020-05-14 16:19:45 +08:00
Jiang Jiang Jian a0288c1e8d Merge branch 'bugfix/wpa3_pmf_memleak_fix' into 'master'
WPA3 / PMF memory leak fixes

Closes WIFI-2324 and WIFI-2326

See merge request espressif/esp-idf!8676
2020-05-14 14:21:21 +08:00
Angus Gratton 8928cbb593 Merge branch 'bugfix/add_requirements_for_espefuse' into 'master'
esp-idf: Update esptool and add reedsolo and bitstring into requirements.txt

See merge request espressif/esp-idf!8641
2020-05-14 12:37:22 +08:00
Michael (XIAO Xufeng) 94ce4836ae Merge branch 'bugfix/fix_gpio_wakeup_light_sleep' into 'master'
driver(gpio): fix gpio can't wakeup light sleep

Closes IDF-1361

See merge request espressif/esp-idf!8522
2020-05-14 11:45:40 +08:00
KonstantinKondrashov 86a73de9b3 esp-idf: Update esptool and add reedsolo and bitstring into requirements.txt
They are necessary for espefuse.py from esptool v3.0.
2020-05-14 13:29:21 +10:00
lly 25a6ea9600 ble_mesh: Remove patch for the bug of an App 2020-05-14 10:24:15 +08:00
Angus Gratton 6ccd7dbc59 Merge branch 'nimble/config_option_sdkconfig_rename' into 'master'
Add NimBLE config options in sdkconfig.rename

Closes IDF-1650

See merge request espressif/esp-idf!8653
2020-05-14 09:30:16 +08:00
Nachiket Kukade b302b4bb43 wpa_supplicant: Fix memory leaks in WPA3 connection
1. Buffers for SAE messages are not freed after the handshake.
   This causes memory leak, free buffers after SAE handshake.
2. SAE global data is not freed until the next WPA3 connection
   takes place, holding up heap space without reason. Free this
   data after SAE handshake is complete or event fails.
3. Update wifi lib which includes memory leak fix during BIP
   encryption/decryption operations.
2020-05-13 22:54:03 +05:30
Nachiket Kukade f36455052d wpa_supplicant: Fix formatting of file esp_wpa3.c
Replace tabs with spaces in esp_wpa3.c.
2020-05-13 22:54:03 +05:30
Jiang Jiang Jian 1d5ef75c7d Merge branch 'bugfix/espnow_fetch_peer_crash' into 'master'
wifi: fix the crash issue when fetch peer after delete cur_peer

Closes WIFI-2307

See merge request espressif/esp-idf!8626
2020-05-13 23:21:21 +08:00
wangcheng 418b32e71b master missing BLE_AUTH_CMPL_EVT after restart 2020-05-13 20:33:24 +08:00
wangcheng a5ac789725 fix bta_dm_deinit_cb crash 2020-05-13 20:18:27 +08:00
Xia Xiaotian 526a3e49ed esp_wifi: When WiFi TSF is active, skip light sleep
* Add an API for peripherals to set callbacks to skip light sleep

* Make WiFi power save example work
2020-05-13 19:31:36 +08:00
Wang Jia Lin cf32e4fc22 Merge branch 'bugfix/fix_adc_io_init_bug' into 'master'
driver(adc): fix adc io init bug

Closes IDF-1541

See merge request espressif/esp-idf!8301
2020-05-13 16:35:58 +08:00
KonstantinKondrashov e3ea943088 partition_table: Fix parttool.py crashes when retrieving partition info
Closes: IDFGH-3279
Closes: https://github.com/espressif/esp-idf/issues/5271
2020-05-13 16:10:48 +08:00
morris d8a9ce14d7 ethernet: fix potential task watch dog timeout 2020-05-13 16:03:00 +08:00
morris 4454b198bb ethernet: better control start/stop/uninstall/install 2020-05-13 15:58:42 +08:00
morris 6020d6a5d4 ethernet: esp_eth_stop API should stop emac hardware 2020-05-13 15:58:42 +08:00
David Cermak f13f8927b1 esp-timer: fix (ignore) false positive memory alloc/free issue found by static analyser 2020-05-13 07:30:26 +02:00
David Cermak 6a47dc9275 esp-netif: fix memory allocation issues found by static analyser 2020-05-13 07:16:45 +02:00
David Cermak 49e8c09ec2 local-ctrl: fix memory allocation issues found by static analyser 2020-05-13 07:16:45 +02:00
David Cermak 917192725a http-client: fix memory allocation issues found by static analyser 2020-05-13 07:16:45 +02:00
Ivan Grokhotkov 695f075a13 Merge branch 'bugfix/core_dump_data_struct_ovf' into 'master'
Fixes core dump data overwriting

See merge request espressif/esp-idf!8611
2020-05-13 04:03:29 +08:00
zhangyanjiao 4dc7a36eca wifi: fix the crash issue when fetch peer after delete cur_peer 2020-05-12 21:05:50 +08:00
Island c946ca8b45 Merge branch 'bugfix/ble_mesh_node_old_version_to_new' into 'master'
ble_mesh: Fix mesh node device role restore

Closes BLEMESH-188

See merge request espressif/esp-idf!8314
2020-05-12 20:36:55 +08:00
Island 1d22f17da3 Merge branch 'bugfix/ble_mesh_not_ignore_msg_in_fast_prov' into 'master'
ble_mesh: Not ignore msg when fast prov is enabled

Closes BLEMESH-196

See merge request espressif/esp-idf!8698
2020-05-12 20:36:41 +08:00
Island b0a096495a Merge branch 'bugfix/ble_mesh_fix_typos' into 'master'
ble_mesh: Fix typos

Closes BLEMESH-199

See merge request espressif/esp-idf!8703
2020-05-12 20:36:30 +08:00
Jiang Jiang Jian 84a410dc4c Merge branch 'bugfix/fix_switch_channel_without_discon_issue' into 'master'
esp_wifi: Fix AP switch to adjacent channel without disconnect

Closes WIFI-2192 and WIFI-2277

See merge request espressif/esp-idf!8657
2020-05-12 20:21:12 +08:00
lly f7ef701856 ble_mesh: Fix mesh node device role restore
Old version of BLE Mesh has no device role storage, because
previously we only support storing mesh node info.
If the binary of the node is upgraded from old version to a
new version (support storing provisioner info), the mesh info
of the node will not be restored because mesh role does not
exist in the flash.
2020-05-12 19:25:57 +08:00
lly 6b9c0dda08 ble_mesh: Fix typos 2020-05-12 16:23:13 +08:00
fuzhibo d91e64cea4 driver(gpio): fix gpio can't wakeup light sleep 2020-05-12 07:15:13 +00:00
fuzhibo 8256b5f32b driver(adc): fix adc io init bug; add unit test to check; 2020-05-12 06:52:26 +00:00
Mahavir Jain bd920d22b0 Merge branch 'bugfix/softap_prov_session' into 'master'
protocomm_httpd: Restart security session if request is received on a new session

See merge request espressif/esp-idf!8633
2020-05-12 13:16:20 +08:00
Michael (XIAO Xufeng) f10a721d88 sdio: fix the unit of performance test 2020-05-12 12:25:46 +08:00
Michael (XIAO Xufeng) 69d9e0eadc sdio: fix random unit test performance failure
The tests used to measure the throughput by FreeRTOS
`xTaskGetTickCount()`. The rounding error can be quite big, compared to
total measurement time (1350 ms for 4-bit mode).

This commit use `esp_timer_get_time()` instead to measure typical time,
which is in microseconds. Moreover, to get rid of the time error from
cache miss, `ccomp_timer_*` are used to get the cache compensated time
to measure the throughput used for unit test performance assertion.
2020-05-12 12:25:45 +08:00
lly d937b415e3 ble_mesh: Not ignore msg when fast prov is enabled
When fast provisioning is enabled, Provisioner shall not
ignore messages from the nodes whose addresses are not in
the provisioning database. Because other nodes which are
not provisioned by the Primary Provisioner will send node
address messages to the Primary Provisioner.
2020-05-12 11:22:07 +08:00
Jiang Jiang Jian 5f2be35525 Merge branch 'bugfix/supplicant_general_fixes' into 'master'
wpa_supplicant: Fix some memleaks and invalid memory access

Closes IDF-1335

See merge request espressif/esp-idf!8201
2020-05-12 11:03:14 +08: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
Mahavir Jain 012b111d6d Merge branch 'feature/mbedtls_hkdf' into 'master'
mbedtls_hkdf: Add a config option to enable HKDF

See merge request espressif/esp-idf!8680
2020-05-11 15:29:54 +08:00
Piyush Shah 43b3def711 mbedtls_hkdf: Add a config option to enable HKDF 2020-05-11 11:49:14 +05:30
Prasad Alatkar 2ef489005b NimBLE: Include upstream fixes and use macros for log level filtering
Change list:
- Reduces the size of the compiled binary, PR: https://github.com/espressif/esp-nimble/pull/6
- Null pointer check, PR: https://github.com/apache/mynewt-nimble/pull/701
- Pairing procedure abort on unexpected req: https://github.com/apache/mynewt-nimble/pull/710
- Fix conn flags after pairing: https://github.com/apache/mynewt-nimble/pull/730
- Remove notification for update process timeout (Vol 6, Part B, section 5.2 ):
  https://github.com/apache/mynewt-nimble/pull/782
- CCCD fix : https://github.com/apache/mynewt-nimble/pull/790 and
  https://github.com/apache/mynewt-nimble/pull/804
- Host based Privacy (RPA) fix: https://github.com/espressif/esp-nimble/pull/7

 Closes https://github.com/espressif/esp-nimble/issues/10

 Closes https://github.com/espressif/esp-idf/issues/4413
2020-05-11 05:36:50 +00:00
Marius Vikhammer 27fa1dc0dd doc: add peripheral_types.h as API reference for peripheral docs
Closes DOC-136
Closes IDF-1673
2020-05-11 11:20:39 +08:00
lly c2fd80b8f4 ble_mesh: Fix not update prov addr in fast prov
When using fast provisioning, the Provisioner functionality
will be enabled. Unicast addresses within the pre-allocated
range will be used for provisioning nodes. And during the
address assignment, the allocated unicast address will be
checked that if it's duplicated with other nodes addresses
and the Provisioner's own addresses.
So before starting using fast provisioning, we need to update
the Provisioner address.
2020-05-11 02:29:18 +00:00
lly 97f11600e3 ble_mesh: net_key_status only pull one key idx [Zephyr]
Fixes bug where the config client's net_key_status handler would attempt
to pull two key indexes from a message which only holds one.
2020-05-11 02:29:18 +00:00
lly 9d7adc3e1b ble_mesh: Update client message timeout calculation
Since the behavior of sending segmented messages has been
changed properly, the calculation of timeout value which
will be used when sending an acknowledged message by a
client model also needs to be updated.
2020-05-11 02:29:18 +00:00
lly 5e59233cc0 ble_mesh: Add lock for segmented msg operations
Add mutex to protect some variables of the mesh segmented
messages.
Currently the timeout handler of mesh will be executed in
the btc task, while the received mesh messages will be
handled in the btu task. In case some variables are set to
NULL when handled in the btu task, meanwhile these variables
are also accessed in the timeout handler, so we add mutex to
protect these variables and related operations.
2020-05-11 02:29:18 +00:00
lly 9e5fec73f8 ble_mesh: Fix dereferencing pointer before checking for NULL [Zephyr]
The publication context is checked for NULL in bt_mesh_model_publish()
however it was dereferenced before that. Move the assignment to
ctx.send_rel to the same place where other ctx members are set.
2020-05-11 02:29:18 +00:00
lly d7a671ab7a ble_mesh: Optimize some mesh log output 2020-05-11 02:29:18 +00:00
lly 52493a1644 ble_mesh: Fix restore when revoke keys [Zephyr]
Store keys (NetKey and AppKey) again after revoking.
2020-05-11 02:29:18 +00:00
lly 8ea6714a96 ble_mesh: Spit mesh_util.h into different header files
Split mesh_util.h into mesh_byteorder.h, mesh_compiler.h,
mesh_ffs.h and mesh_util.h based on the classification of
Zephyr, which will make further porting more clear.
2020-05-11 02:29:18 +00:00
lly 52a30c8f4a ble_mesh: Split mesh os related into a separate file 2020-05-11 02:29:18 +00:00
lly 01a8a6c150 ble_mesh: Split mesh mutex into a separate file 2020-05-11 02:29:18 +00:00
lly c493be489f ble_mesh: Rename mesh_kernel.* to mesh_timer.* 2020-05-11 02:29:18 +00:00
lly 25dfee4bdd ble_mesh: Add and use transport macro definitions [Zephyr] 2020-05-11 02:29:18 +00:00
lly df525bf0b3 ble_mesh: Friend SeqAuth cleanup [Zephyr]
The Friend queue uses the message SeqAuth to determine whether the
message is already in the queue. To facilitate this, the SeqAuth is
passed around as a pointer throughout the transport modules. In the
bt_mesh_ctl_send functions, this parameter is also exposed in the API,
but the internal usage is inconsistent and buggy. Also, no one actually
uses this parameter.

- Removes seq_auth param from bt_mesh_ctl_send, instead passing NULL
  directly to the friend module, to enforce its addition to the queue.
- Makes the seq_auth pointer const throughout the friend module.
2020-05-11 02:29:18 +00:00
lly cd58874a9b ble_mesh: Rework msg_cache [Zephyr]
Changes the behavior of the message cache to optimize for cache
capacity. Previously, the message cache's primary function was to avoid
decrypting messages multiple times, although the cache's main function
in the spec is to avoid message rebroadcasting. Optimizing for minimal
decryption causes us to fill the network cache faster, which in turn
causes more cache misses, potentially outweighing the advantage.

Now stores src + seq in message cache instead of field hash value. This
cuts cache size in two, while including more of the sequence number than
before.

Adds messages to the cache only after the packet is successfully
decrypted. This reduces noise in the cache, and ensures that no
invalid deobfuscations are added.

Additionally, this fixes a bug where multiple calls to net_decrypt with
the same packet failed, as the message cache found its own entry from
the previous call.
2020-05-11 02:29:18 +00:00
lly ef8206cdc6 ble_mesh: Segmented TX to groups [Zephyr]
Implements several changes to the transport layer segmented tx to
improve group message performance:
- Moves retransmit counter to tx context instead of per packet. As every
  unacked packet is sent every retransmit, the retransmit counters would
  be the same in each segment. This makes it easier to control progress.
- Delays the scheduling of the retransmit until the completion of the
  last segment by adding a seg_pending counter. This is essentially the
  same as the old behavior, except that the old behavior might retrigger
  the sending before all segments are finished if the advertising is
  slow.
- Allows the group transmits to stop as soon as all retransmits have
  been exhausted, instead of timing out waiting for acks that won't
  come. This allows group tx to finish without error.
- Fixes a bug where a failed TX would block IV update.
- Cancels any pending transmissions of acked segments.
- Reduces log level for several common group tx scenarios that aren't
  erronous.
2020-05-11 02:29:18 +00:00
lly fd9a16805a ble_mesh: Add comment explaining use of byte order [Zephyr]
Add comment that explains why a different byte order is used for the
3-byte opcode on the CID part of the opcode.
2020-05-11 02:29:18 +00:00
lly 4d1d5261cc ble_mesh: Use 24-bit functions [Zephyr]
Use 24-bit functions for byteorder and net_buf in order to make the
byteorder used more readable.
2020-05-11 02:29:18 +00:00
lly da99734ba8 ble_mesh: Optimize net_buf_simple routines [Zephyr]
Use sys_put_xyz() helpers instead of memcpy() whenever possible. This
brings in straight-line inline code for pushes and adds of known,
small sizes.
2020-05-11 02:29:18 +00:00
lly 4fd1b2db0e ble_mesh: Add PRIu64 & PRIx64 in mesh_types.h 2020-05-11 02:29:18 +00:00
lly fb84166cbd ble_mesh: Add push functions for supported bit-variants [Zephyr]
Add push functions for bit-widths supported by add and pull functions.
2020-05-11 02:29:18 +00:00
lly ee1eb994b7 ble_mesh: Add support for 64 bit data type [Zephyr]
This enables pulling and pushing values in 64 bit format.
2020-05-11 02:29:18 +00:00
lly b186be52f0 ble_mesh: Add support for 48 bit data type [Zephyr]
This enables pulling and pushing values in 48 bit format.
2020-05-11 02:29:18 +00:00
lly 23c8bbcbf5 ble_mesh: Add 48 bit variants [Zephyr]
This adds sys_*_*48 functions that operation on a 48 bits values.
2020-05-11 02:29:18 +00:00
lly 4e1d3974fb ble_mesh: Add support for 24 bit data type [Zephyr]
This enables pulling and pushing values in 24 bit format.
2020-05-11 02:29:18 +00:00
lly 26dbfdcb9d ble_mesh: Add 24 bit variants [Zephyr]
This adds sys_*_*24 functions that operation on a 24 bits values.
2020-05-11 02:29:18 +00:00
lly 95440c4d28 ble_mesh: Group resends in proxy nodes [Zephyr]
Resend transport segments for groups on the advertiser interface, even
if a connected proxy node holds the group.
2020-05-11 02:29:18 +00:00
lly 1f47cfff7f ble_mesh: Typo in condition in comp_add_elem of cfg_srv [Zephyr]
Vendor model IDs take up four (not two) bytes in the composition
2020-05-11 02:29:18 +00:00
lly 31b175e372 ble_mesh: GATT Proxy Spec 1.0.1 changes [Zephyr]
Backport of https://github.com/apache/mynewt-nimble/pull/724

Mesh spec 1.0.1 changes proxy disabling behavior to only affect the
relaying from proxy nodes. Previously, disabling proxy would shut down
all proxy and node activity.

Tweaks from the original commit:
- Removed redundant call to bt_mesh_adv_update() in gatt_proxy_set()
- Removed invalid ref to 4.2.11.1 in node_identity_set()

---

According to Mesh Profile Spec 1.0.1, Section 4.2.11:
"If the Proxy feature is disabled, a GATT client device can connect
over GATT to that node for configuration and control. Messages from
the GATT bearer are not relayed to the advertising bearer."

Moreover some notes have been removed from the spec compared to
version 1.0:

Mesh Profile Spec 1.0, Section 4.2.11:

"Upon transition from GATT Proxy state 0x01 to GATT Proxy state 0x00
the GATT Bearer Server shall disconnect all GATT Bearer Clients."

"The Configuration Client should turn off the Proxy state as the last
step in the configuration process."

Mesh Profile Spec 1.0, Section 4.2.11.1:

"When the GATT Proxy state is set to 0x00, the Node Identity state
for all subnets shall be set to 0x00 and shall not be changed."
2020-05-11 02:29:18 +00:00
lly e385197c27 ble_mesh: Support reliable sending when publishing [Zephyr]
Until now the choice of reliable sending (segmented messages with
acks) was implicitly dependent on the size of the payload. Add a new
member to the bt_mesh_model_pub to force using segment acks even when
the payload would fit a single unsegmented message.
2020-05-11 02:29:18 +00:00
lly cc549897d5 ble_mesh: Check device uuid when init provisioning 2020-05-11 02:29:18 +00:00
lly ca3d1637ca ble_mesh: Fix provisioning buffer initialization [Zephyr]
When PB-GATT support has been enabled the provisioning code "borrows"
the buffer from the proxy code. However, the way that initialization
was happening the proxy buffers were initialized only after
provisioning initialization, resulting in a corrupted buffer with
buf->data pointing to NULL. Reorder the initialization calls so that
proxy is done first and provisioning only after it.
2020-05-11 02:29:18 +00:00
lly 6c868a070b ble_mesh: Skip publish if update fails [Zephyr]
Allow models to skip a periodic publish interval by returning an error
from the publish update callback.

Previously, an error return from publish update would cancel periodic
publishing. This can't be recovered from, and as such, no valid model
implementation could return an error from this callback, and there was
no way to skip a periodic publish.
2020-05-11 02:29:18 +00:00
lly aad8908d9c ble_mesh: Enable Segmented Control Messages [Zephyr]
The function bt_mesh_ctl_send() used to support maximum length of
11 bytes. The segmentation complies with the BLE Mesh Standard.
The ack is disabled in case of non unicast address.
2020-05-11 02:29:18 +00:00
Michael (XIAO Xufeng) f7ec57b615 Merge branch 'feature/usb_wrap_headers' into 'master'
usb: add usb_wrap headers, move some code from LL to HAL

See merge request espressif/esp-idf!8395
2020-05-10 19:19:14 +08:00
David Čermák e86f530e42 Merge branch 'bugfix/mdns_config_stacksize' into 'master'
mdns: Allow config mDNS task stack size (GitHub PR)

Closes IDFGH-3219

See merge request espressif/esp-idf!8635
2020-05-09 19:49:15 +08:00
xiehang 0c7cac6ee3 esp_wifi: Fix AP switch to adjacent channel without disconnect 2020-05-09 17:26:51 +08:00
Jiang Jiang Jian 27d0ca52b2 Merge branch 'bugfix/fix_memleak_in_wpa3_feature' into 'master'
fix(wpa_supplicant): fix memleak in wpa3 feature

See merge request espressif/esp-idf!8643
2020-05-08 22:34:01 +08:00
Mahavir Jain 5425ef85ce Merge branch 'bugfix/pthread_tcb_cleanup_wrapper' into 'master'
Fix linking for vPortCleanUpTCB wrapper

See merge request espressif/esp-idf!8652
2020-05-08 21:31:35 +08:00