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

[Group] Decryption optimization #14974

Conversation

jepenven-silabs
Copy link
Contributor

Problem

For now we decrypt with all possible keys matching the hash provided in the packet header.
We can further decrease the number of iteration by also checking for a match with the groupId provided in the same packet header.

Change overview

Add a check for the groupId prior to decryption attempt.

Testing

Unit test
Test suite

@github-actions
Copy link

github-actions bot commented Feb 9, 2022

PR #14974: Size comparison from 1744422 to d088966

Increases (40 builds for cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
platform target config section 1744422f d088966 change % change
cyw30739 light cyw930739m2evb_01 (read/write) 599434 599570 136 0.0
.app_xip_area 505040 505176 136 0.0
lock cyw930739m2evb_01 (read/write) 556126 556262 136 0.0
.app_xip_area 463292 463428 136 0.0
ota-requestor cyw930739m2evb_01 (read/write) 577026 577162 136 0.0
.app_xip_area 474944 475080 136 0.0
efr32 lighting-app BRD4161A (read only) 903440 903592 152 0.0
.text 903432 903584 152 0.0
BRD4161A+rpc (read only) 890900 891036 136 0.0
.text 890892 891028 136 0.0
window-app BRD4161A (read only) 838840 838992 152 0.0
.text 838832 838984 152 0.0
esp32 all-clusters-app c3devkit (read only) 940682 940722 40 0.0
(read/write) 1397770 1397874 104 0.0
.flash.rodata 198352 198456 104 0.1
.flash.text 940682 940722 40 0.0
m5stack (read only) 988695 988731 36 0.0
(read/write) 462784 462888 104 0.0
.flash.rodata 225240 225344 104 0.0
.flash.text 983311 983347 36 0.0
k32w light k32w061+release (read/write) 678908 679044 136 0.0
.text 594736 594872 136 0.0
lock k32w061+release (read/write) 683788 683924 136 0.0
.text 599172 599308 136 0.0
linux all-clusters-app debug (read only) 2334665 2334905 240 0.0
.rodata 204613 204741 128 0.1
.text 1967778 1967890 112 0.0
bridge-app debug+rpc (read only) 1705557 1705797 240 0.0
.rodata 140332 140460 128 0.1
.text 1448677 1448789 112 0.0
chip-tool debug (read only) 7514509 7514717 208 0.0
.rodata 418901 418997 96 0.0
.text 6695173 6695285 112 0.0
chip-tool-ipv6only arm64 (read only) 7433340 7433516 176 0.0
.rodata 401300 401412 112 0.0
.text 6392836 6392900 64 0.0
door-lock-app debug (read only) 1910265 1910473 208 0.0
.rodata 171858 171954 96 0.1
.text 1589890 1590002 112 0.0
lighting-app debug+rpc (read only) 2032537 2032777 240 0.0
.rodata 164209 164337 128 0.1
.text 1713490 1713602 112 0.0
ota-provider-app debug (read only) 1714249 1714489 240 0.0
.rodata 151910 152038 128 0.1
.text 1443634 1443746 112 0.0
ota-requestor-app debug (read only) 1708873 1709081 208 0.0
.rodata 145495 145591 96 0.1
.text 1446482 1446594 112 0.0
shell debug (read only) 2308121 2308329 208 0.0
.rodata 205330 205426 96 0.0
.text 1946322 1946434 112 0.0
thermostat-no-ble arm64 (read only) 2130812 2130956 144 0.0
.rodata 132108 132204 96 0.1
.text 1780640 1780688 48 0.0
tv-app debug (read only) 2502905 2503113 208 0.0
.rodata 196140 196236 96 0.0
.text 2133826 2133938 112 0.0
mbed all-clusters-app CY8CPROTO_062_4343W+release (read/write) 2391408 2391576 168 0.0
.text 1354008 1354176 168 0.0
lighting-app CY8CPROTO_062_4343W+release (read/write) 2353560 2353728 168 0.0
.text 1316160 1316328 168 0.0
lock-app CY8CPROTO_062_4343W+release (read/write) 2317280 2317448 168 0.0
.text 1279880 1280048 168 0.0
shell CY8CPROTO_062_4343W+release (read/write) 2303212 2303380 168 0.0
.text 1265784 1265952 168 0.0
nrfconnect lighting-app nrf52840dk_nrf52840 (read/write) 1010599 1010735 136 0.0
rodata 118772 118876 104 0.1
text 691600 691628 28 0.0
nrf52840dk_nrf52840+rpc (read/write) 979443 979563 120 0.0
rodata 110160 110264 104 0.1
text 671212 671240 28 0.0
nrf52840dongle_nrf52840 (read/write) 1026507 1026643 136 0.0
rodata 117660 117764 104 0.1
text 696268 696296 28 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 917226 917362 136 0.0
rodata 112028 112132 104 0.1
text 606624 606652 28 0.0
lock-app nrf52840dk_nrf52840 (read/write) 940535 940655 120 0.0
rodata 107540 107644 104 0.1
text 634832 634860 28 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 848026 848162 136 0.0
rodata 100708 100812 104 0.1
text 550632 550660 28 0.0
pump-app nrf52840dk_nrf52840 (read/write) 939955 940091 136 0.0
rodata 106896 107000 104 0.1
text 635092 635120 28 0.0
pump-controller-app nrf52840dk_nrf52840 (read/write) 935295 935415 120 0.0
rodata 106188 106292 104 0.1
text 631124 631152 28 0.0
shell nrf52840dk_nrf52840 (read/write) 803783 803919 136 0.0
rodata 78716 78820 104 0.1
text 536264 536292 28 0.0
p6 all-clusters-app default (read/write) 2478352 2478504 152 0.0
.text 1436616 1436768 152 0.0
light-app default (read/write) 2385312 2385464 152 0.0
.text 1343576 1343728 152 0.0
lock-app default (read/write) 2348912 2349056 144 0.0
.text 1307176 1307320 144 0.0
qpg lighting-app qpg6105+debug (read only) 590052 590180 128 0.0
.text 584732 584860 128 0.0
lock-app qpg6105+debug (read only) 555944 556072 128 0.0
.text 550624 550752 128 0.0
telink lighting-app tlsr9518adk80d (read/write) 869354 869494 140 0.0
text 610562 610598 36 0.0
Full report (43 builds for cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
platform target config section 1744422f d088966 change % change
cyw30739 light cyw930739m2evb_01 (read/write) 599434 599570 136 0.0
.app_xip_area 505040 505176 136 0.0
.bss 77116 77116 0 0.0
.data 624 624 0 0.0
.rodata 0 0 0 0.0
.text 0 0 0 0.0
lock cyw930739m2evb_01 (read/write) 556126 556262 136 0.0
.app_xip_area 463292 463428 136 0.0
.bss 75588 75588 0 0.0
.data 588 588 0 0.0
.rodata 0 0 0 0.0
.text 0 0 0 0.0
ota-requestor cyw930739m2evb_01 (read/write) 577026 577162 136 0.0
.app_xip_area 474944 475080 136 0.0
.bss 84508 84508 0 0.0
.data 532 532 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
efr32 lighting-app BRD4161A (read only) 903440 903592 152 0.0
(read/write) 127200 127200 0 0.0
.bss 125184 125184 0 0.0
.data 2012 2012 0 0.0
.text 903432 903584 152 0.0
BRD4161A+rpc (read only) 890900 891036 136 0.0
(read/write) 143856 143856 0 0.0
.bss 141744 141744 0 0.0
.data 2112 2112 0 0.0
.text 890892 891028 136 0.0
window-app BRD4161A (read only) 838840 838992 152 0.0
(read/write) 125264 125264 0 0.0
.bss 123384 123384 0 0.0
.data 1880 1880 0 0.0
.text 838832 838984 152 0.0
esp32 all-clusters-app c3devkit (read only) 940682 940722 40 0.0
(read/write) 1397770 1397874 104 0.0
.dram0.bss 66248 66248 0 0.0
.dram0.data 14260 14260 0 0.0
.flash.rodata 198352 198456 104 0.1
.flash.text 940682 940722 40 0.0
.iram0.text 62056 62056 0 0.0
m5stack (read only) 988695 988731 36 0.0
(read/write) 462784 462888 104 0.0
.dram0.bss 71392 71392 0 0.0
.dram0.data 34024 34024 0 0.0
.flash.rodata 225240 225344 104 0.0
.flash.text 983311 983347 36 0.0
.iram0.text 123399 123399 0 0.0
k32w light k32w061+release (read/write) 678908 679044 136 0.0
.bss 76488 76488 0 0.0
.data 1884 1884 0 0.0
.text 594736 594872 136 0.0
lock k32w061+release (read/write) 683788 683924 136 0.0
.bss 76888 76888 0 0.0
.data 1928 1928 0 0.0
.text 599172 599308 136 0.0
linux all-clusters-app debug (read only) 2334665 2334905 240 0.0
(read/write) 139968 139968 0 0.0
.bss 54560 54560 0 0.0
.data 1168 1168 0 0.0
.data.rel.ro 78552 78552 0 0.0
.dynamic 592 592 0 0.0
.got 4136 4136 0 0.0
.init 27 27 0 0.0
.init_array 920 920 0 0.0
.rodata 204613 204741 128 0.1
.text 1967778 1967890 112 0.0
bridge-app debug+rpc (read only) 1705557 1705797 240 0.0
(read/write) 84200 84200 0 0.0
.bss 38960 38960 0 0.0
.data 1970 1970 0 0.0
.data.rel.ro 38120 38120 0 0.0
.dynamic 592 592 0 0.0
.got 3976 3976 0 0.0
.init 27 27 0 0.0
.init_array 560 560 0 0.0
.rodata 140332 140460 128 0.1
.text 1448677 1448789 112 0.0
chip-tool debug (read only) 7514509 7514717 208 0.0
(read/write) 197048 197048 0 0.0
.bss 32232 32232 0 0.0
.data 1152 1152 0 0.0
.data.rel.ro 157624 157624 0 0.0
.dynamic 608 608 0 0.0
.got 4784 4784 0 0.0
.init 27 27 0 0.0
.init_array 616 616 0 0.0
.rodata 418901 418997 96 0.0
.text 6695173 6695285 112 0.0
chip-tool-ipv6only arm64 (read only) 7433340 7433516 176 0.0
(read/write) 301825 301825 0 0.0
.bss 50513 50513 0 0.0
.data 1176 1176 0 0.0
.data.rel.ro 199304 199304 0 0.0
.dynamic 560 560 0 0.0
.got 47040 47040 0 0.0
.init 24 24 0 0.0
.init_array 192 192 0 0.0
.rodata 401300 401412 112 0.0
.text 6392836 6392900 64 0.0
door-lock-app debug (read only) 1910265 1910473 208 0.0
(read/write) 110552 110552 0 0.0
.bss 42032 42032 0 0.0
.data 946 946 0 0.0
.data.rel.ro 62160 62160 0 0.0
.dynamic 592 592 0 0.0
.got 4112 4112 0 0.0
.init 27 27 0 0.0
.init_array 672 672 0 0.0
.rodata 171858 171954 96 0.1
.text 1589890 1590002 112 0.0
lighting-app debug+rpc (read only) 2032537 2032777 240 0.0
(read/write) 115800 115800 0 0.0
.bss 43008 43008 0 0.0
.data 1368 1368 0 0.0
.data.rel.ro 65928 65928 0 0.0
.dynamic 608 608 0 0.0
.got 4144 4144 0 0.0
.init 27 27 0 0.0
.init_array 720 720 0 0.0
.rodata 164209 164337 128 0.1
.text 1713490 1713602 112 0.0
ota-provider-app debug (read only) 1714249 1714489 240 0.0
(read/write) 81240 81240 0 0.0
.bss 40992 40992 0 0.0
.data 1160 1160 0 0.0
.data.rel.ro 33560 33560 0 0.0
.dynamic 608 608 0 0.0
.got 4240 4240 0 0.0
.init 27 27 0 0.0
.init_array 624 624 0 0.0
.rodata 151910 152038 128 0.1
.text 1443634 1443746 112 0.0
ota-requestor-app debug (read only) 1708873 1709081 208 0.0
(read/write) 83160 83160 0 0.0
.bss 42112 42112 0 0.0
.data 1128 1128 0 0.0
.data.rel.ro 34616 34616 0 0.0
.dynamic 592 592 0 0.0
.got 4040 4040 0 0.0
.init 27 27 0 0.0
.init_array 624 624 0 0.0
.rodata 145495 145591 96 0.1
.text 1446482 1446594 112 0.0
shell debug (read only) 2308121 2308329 208 0.0
(read/write) 141392 141392 0 0.0
.bss 61824 61824 0 0.0
.data 768 768 0 0.0
.data.rel.ro 73104 73104 0 0.0
.dynamic 592 592 0 0.0
.got 4168 4168 0 0.0
.init 27 27 0 0.0
.init_array 904 904 0 0.0
.rodata 205330 205426 96 0.0
.text 1946322 1946434 112 0.0
thermostat-no-ble arm64 (read only) 2130812 2130956 144 0.0
(read/write) 140545 140545 0 0.0
.bss 57537 57537 0 0.0
.data 984 984 0 0.0
.data.rel.ro 74904 74904 0 0.0
.dynamic 560 560 0 0.0
.got 4152 4152 0 0.0
.init 24 24 0 0.0
.init_array 328 328 0 0.0
.rodata 132108 132204 96 0.1
.text 1780640 1780688 48 0.0
tv-app debug (read only) 2502905 2503113 208 0.0
(read/write) 139384 139384 0 0.0
.bss 57152 57152 0 0.0
.data 3168 3168 0 0.0
.data.rel.ro 73048 73048 0 0.0
.dynamic 592 592 0 0.0
.got 4528 4528 0 0.0
.init 27 27 0 0.0
.init_array 880 880 0 0.0
.rodata 196140 196236 96 0.0
.text 2133826 2133938 112 0.0
mbed all-clusters-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2391408 2391576 168 0.0
.bss 188316 188316 0 0.0
.data 5280 5280 0 0.0
.text 1354008 1354176 168 0.0
lighting-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2353560 2353728 168 0.0
.bss 180928 180928 0 0.0
.data 5608 5608 0 0.0
.text 1316160 1316328 168 0.0
lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2317280 2317448 168 0.0
.bss 180816 180816 0 0.0
.data 5584 5584 0 0.0
.text 1279880 1280048 168 0.0
pigweed-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 1139648 1139648 0 0.0
.bss 11756 11756 0 0.0
.data 4368 4368 0 0.0
.text 103032 103032 0 0.0
shell CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2303212 2303380 168 0.0
.bss 178068 178068 0 0.0
.data 5400 5400 0 0.0
.text 1265784 1265952 168 0.0
nrfconnect lighting-app nrf52840dk_nrf52840 (read/write) 1010599 1010735 136 0.0
bss 121244 121244 0 0.0
rodata 118772 118876 104 0.1
text 691600 691628 28 0.0
nrf52840dk_nrf52840+rpc (read/write) 979443 979563 120 0.0
bss 118432 118432 0 0.0
rodata 110160 110264 104 0.1
text 671212 671240 28 0.0
nrf52840dongle_nrf52840 (read/write) 1026507 1026643 136 0.0
bss 122640 122640 0 0.0
rodata 117660 117764 104 0.1
text 696268 696296 28 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 917226 917362 136 0.0
bss 117808 117808 0 0.0
rodata 112028 112132 104 0.1
text 606624 606652 28 0.0
lock-app nrf52840dk_nrf52840 (read/write) 940535 940655 120 0.0
bss 119624 119624 0 0.0
rodata 107540 107644 104 0.1
text 634832 634860 28 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 848026 848162 136 0.0
bss 116216 116216 0 0.0
rodata 100708 100812 104 0.1
text 550632 550660 28 0.0
pigweed-app nrf52840dk_nrf52840 (read/write) 527595 527595 0 0.0
bss 53632 53632 0 0.0
rodata 49976 49976 0 0.0
text 361016 361016 0 0.0
pump-app nrf52840dk_nrf52840 (read/write) 939955 940091 136 0.0
bss 119344 119344 0 0.0
rodata 106896 107000 104 0.1
text 635092 635120 28 0.0
pump-controller-app nrf52840dk_nrf52840 (read/write) 935295 935415 120 0.0
bss 119348 119348 0 0.0
rodata 106188 106292 104 0.1
text 631124 631152 28 0.0
shell nrf52840dk_nrf52840 (read/write) 803783 803919 136 0.0
bss 111208 111208 0 0.0
rodata 78716 78820 104 0.1
text 536264 536292 28 0.0
p6 all-clusters-app default (read/write) 2478352 2478504 152 0.0
.bss 117576 117576 0 0.0
.data 2632 2632 0 0.0
.text 1436616 1436768 152 0.0
light-app default (read/write) 2385312 2385464 152 0.0
.bss 107224 107224 0 0.0
.data 2504 2504 0 0.0
.text 1343576 1343728 152 0.0
lock-app default (read/write) 2348912 2349056 144 0.0
.bss 106944 106944 0 0.0
.data 2464 2464 0 0.0
.text 1307176 1307320 144 0.0
qpg lighting-app qpg6105+debug (read only) 590052 590180 128 0.0
(read/write) 146940 146940 0 0.0
.bss 88800 88800 0 0.0
.data 1088 1088 0 0.0
.text 584732 584860 128 0.0
lock-app qpg6105+debug (read only) 555944 556072 128 0.0
(read/write) 146940 146940 0 0.0
.bss 88784 88784 0 0.0
.data 1040 1040 0 0.0
.text 550624 550752 128 0.0
persistent-storage-app qpg6105+debug (read only) 99520 99520 0 0.0
(read/write) 146940 146940 0 0.0
.bss 24004 24004 0 0.0
.data 176 176 0 0.0
.text 94200 94200 0 0.0
telink lighting-app tlsr9518adk80d (read/write) 869354 869494 140 0.0
bss 88576 88576 0 0.0
noinit 37160 37160 0 0.0
text 610562 610598 36 0.0

src/transport/SessionManager.cpp Outdated Show resolved Hide resolved
src/transport/SessionManager.cpp Outdated Show resolved Hide resolved
@jepenven-silabs jepenven-silabs merged commit 31b5331 into project-chip:master Feb 10, 2022
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.

5 participants