Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ESP32] Handle NVS key with length > 15 #18604

Merged
merged 3 commits into from
May 23, 2022

Conversation

shubhamdp
Copy link
Contributor

Problem

  • ESP-IDF can not handle NVS key with length > 15 bytes (not including null terminator)

Change overview

  • Hash the key using SHA1 algorithm and convert the first 8 bytes to hex string and use it as key.

Testing

  • Made sure that the case resumption was working

@shubhamdp
Copy link
Contributor Author

@github-actions
Copy link

github-actions bot commented May 19, 2022

PR #18604: Size comparison from 70e259c to 2a8689a

Increases (2 builds for esp32)
platform target config section 70e259c 2a8689a change % change
esp32 all-clusters-app c3devkit (read only) 1000894 1001090 196 0.0
(read/write) 1478218 1478250 32 0.0
.flash.rodata 209960 209992 32 0.0
.flash.text 1000894 1001090 196 0.0
m5stack (read only) 1056019 1056203 184 0.0
(read/write) 480212 480244 32 0.0
.flash.rodata 240288 240320 32 0.0
.flash.text 1050635 1050819 184 0.0
Full report (21 builds for cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
platform target config section 70e259c 2a8689a change % change
cyw30739 light cyw930739m2evb_01 (read/write) 625570 625570 0 0.0
.app_xip_area 529184 529184 0 0.0
.bss 79028 79028 0 0.0
.data 708 708 0 0.0
.rodata 0 0 0 0.0
.text 0 0 0 0.0
lock cyw930739m2evb_01 (read/write) 628542 628542 0 0.0
.app_xip_area 533612 533612 0 0.0
.bss 77604 77604 0 0.0
.data 672 672 0 0.0
.rodata 0 0 0 0.0
.text 0 0 0 0.0
ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 570998 570998 0 0.0
.app_xip_area 466352 466352 0 0.0
.bss 87024 87024 0 0.0
.data 584 584 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
efr32 lighting-app BRD4161A (read only) 917676 917676 0 0.0
(read/write) 133244 133244 0 0.0
.bss 131184 131184 0 0.0
.data 2060 2060 0 0.0
.text 917668 917668 0 0.0
BRD4161A+rpc (read only) 951848 951848 0 0.0
(read/write) 149928 149928 0 0.0
.bss 147664 147664 0 0.0
.data 2264 2264 0 0.0
.text 951840 951840 0 0.0
BRD4161A+rs911x (read only) 791140 791140 0 0.0
(read/write) 129512 129512 0 0.0
.bss 127444 127444 0 0.0
.data 2068 2068 0 0.0
.text 791132 791132 0 0.0
lock-app BRD4161A+wf200 (read only) 947140 947140 0 0.0
(read/write) 123996 123996 0 0.0
.bss 121972 121972 0 0.0
.data 2024 2024 0 0.0
.text 947132 947132 0 0.0
window-app BRD4161A (read only) 897796 897796 0 0.0
(read/write) 133304 133304 0 0.0
.bss 131256 131256 0 0.0
.data 2048 2048 0 0.0
.text 897788 897788 0 0.0
esp32 all-clusters-app c3devkit (read only) 1000894 1001090 196 0.0
(read/write) 1478218 1478250 32 0.0
.dram0.bss 68208 68208 0 0.0
.dram0.data 14624 14624 0 0.0
.flash.rodata 209960 209992 32 0.0
.flash.text 1000894 1001090 196 0.0
.iram0.text 62954 62954 0 0.0
m5stack (read only) 1056019 1056203 184 0.0
(read/write) 480212 480244 32 0.0
.dram0.bss 73728 73728 0 0.0
.dram0.data 34200 34200 0 0.0
.flash.rodata 240288 240320 32 0.0
.flash.text 1050635 1050819 184 0.0
.iram0.text 123267 123267 0 0.0
k32w light k32w061+release (read/write) 683032 683032 0 0.0
.bss 80224 80224 0 0.0
.data 2016 2016 0 0.0
.text 599088 599088 0 0.0
lock k32w061+release (read/write) 729608 729608 0 0.0
.bss 80656 80656 0 0.0
.data 1976 1976 0 0.0
.text 645272 645272 0 0.0
linux chip-tool-no-interactive-ipv6only arm64 (read only) 9078228 9078228 0 0.0
(read/write) 646209 646209 0 0.0
.bss 42209 42209 0 0.0
.data 1192 1192 0 0.0
.data.rel.ro 583944 583944 0 0.0
.dynamic 560 560 0 0.0
.got 15016 15016 0 0.0
.init 24 24 0 0.0
.init_array 184 184 0 0.0
.rodata 444948 444948 0 0.0
.text 7169076 7169076 0 0.0
thermostat-no-ble arm64 (read only) 2353036 2353036 0 0.0
(read/write) 176289 176289 0 0.0
.bss 87585 87585 0 0.0
.data 1520 1520 0 0.0
.data.rel.ro 79376 79376 0 0.0
.dynamic 560 560 0 0.0
.got 4768 4768 0 0.0
.init 24 24 0 0.0
.init_array 376 376 0 0.0
.rodata 147244 147244 0 0.0
.text 1975808 1975808 0 0.0
mbed lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2420736 2420736 0 0.0
.bss 202668 202668 0 0.0
.data 5872 5872 0 0.0
.text 1383380 1383380 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1181151 1181151 0 0.0
bss 138380 138380 0 0.0
rodata 153176 153176 0 0.0
text 810720 810720 0 0.0
p6 all-clusters-app default (read/write) 2539096 2539096 0 0.0
.bss 136176 136176 0 0.0
.data 2808 2808 0 0.0
.text 1497360 1497360 0 0.0
light-app default (read/write) 2425512 2425512 0 0.0
.bss 129488 129488 0 0.0
.data 2608 2608 0 0.0
.text 1383776 1383776 0 0.0
lock-app default (read/write) 2436224 2436224 0 0.0
.bss 129304 129304 0 0.0
.data 2568 2568 0 0.0
.text 1394488 1394488 0 0.0
telink light-switch-app tlsr9518adk80d (read/write) 782752 782752 0 0.0
bss 70608 70608 0 0.0
noinit 40416 40416 0 0.0
text 553478 553478 0 0.0
lighting-app tlsr9518adk80d (read/write) 802844 802844 0 0.0
bss 70864 70864 0 0.0
noinit 40416 40416 0 0.0
text 570244 570244 0 0.0

src/platform/ESP32/KeyValueStoreManagerImpl.cpp Outdated Show resolved Hide resolved
src/platform/ESP32/KeyValueStoreManagerImpl.cpp Outdated Show resolved Hide resolved
src/platform/ESP32/KeyValueStoreManagerImpl.cpp Outdated Show resolved Hide resolved
@Damian-Nordic Damian-Nordic merged commit 6018c33 into project-chip:master May 23, 2022
@shubhamdp shubhamdp deleted the esp32_nvs_key_size branch May 23, 2022 17:52
@msandstedt
Copy link
Contributor

Note that session resumption on ESP32 is broken without this fix. Related to #16410.

CC @kghost

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants