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

Allow Darwin framework consumers to provide a controller NOC and keypair #18519

Merged
merged 2 commits into from
May 18, 2022

Conversation

bzbarsky-apple
Copy link
Contributor

Specific changes:

  • Rename initWithKeypair API to initWithSigningKeypair, since we can
    now also init with an operational keypair.

  • Fix FabricInfo::SetOperationalKeypair to correcty handle the
    mHasExternallyOwnedOperationalKey case. The old code would try to
    deserialize into the externally owned keypair.

  • Fix FabricInfo::GetOperationalKey to just return the key even it
    it's null, instead of allocating a random key that does not match
    anything. I have checked that consumers all either null-check the
    call or have just called SetOperationalKeypair or
    SetExternallyOwnedOperationalKeypair. SetFabricInfo is updated to
    error out if the incoming fabric info has a null operational key.
    This change was needed for basic API sanity in terms of not
    accidentally switching a fabric from an externally managed
    operational key to an internally managed randomly generated one.

  • Fix backwards boolean check in FabricInfo::Reset that was causing us
    to leak internally managed keys and try to delete externally managed
    ones.

  • Change Darwin CHIPDeviceControllerStartupParams to allow providing
    an operational keypair to be used for the NOC.

  • Change Darwin CHIPDeviceControllerStartupParams To allow providing a
    NOC instead of having one generated inside the framework.

  • Refactor the code for initializing
    CHIPDeviceControllerStartupParamsInternal to better share code and
    support the new functionality.

  • Allow initializing CHIPOperationalCredentialsDelegate without a
    NOC-signing keypair. This is needed because the SDK's controller
    init requires a credentials delegate. When initialized in this way,
    the delegate will just return error when asked to create a NOC.

  • Added tests for the new API (which caught a number of the issues
    listed above).

Fixes #18444

Problem

See above.

Change overview

See above.

Testing

Tests in the PR.

…air.

Specific changes:

* Rename initWithKeypair API to initWithSigningKeypair, since we can
  now also init with an operational keypair.

* Fix FabricInfo::SetOperationalKeypair to correcty handle the
  mHasExternallyOwnedOperationalKey case.  The old code would try to
  deserialize into the externally owned keypair.

* Fix FabricInfo::GetOperationalKey to just return the key even it
  it's null, instead of allocating a random key that does not match
  anything.  I have checked that consumers all either null-check the
  call or have just called SetOperationalKeypair or
  SetExternallyOwnedOperationalKeypair.  SetFabricInfo is updated to
  error out if the incoming fabric info has a null operational key.
  This change was needed for basic API sanity in terms of not
  accidentally switching a fabric from an externally managed
  operational key to an internally managed randomly generated one.

* Fix backwards boolean check in FabricInfo::Reset that was causing us
  to leak internally managed keys and try to delete externally managed
  ones.

* Change Darwin CHIPDeviceControllerStartupParams to allow providing
  an operational keypair to be used for the NOC.

* Change Darwin CHIPDeviceControllerStartupParams To allow providing a
  NOC instead of having one generated inside the framework.

* Refactor the code for initializing
  CHIPDeviceControllerStartupParamsInternal to better share code and
  support the new functionality.

* Allow initializing CHIPOperationalCredentialsDelegate without a
  NOC-signing keypair.  This is needed because the SDK's controller
  init requires a credentials delegate.  When initialized in this way,
  the delegate will just return error when asked to create a NOC.

* Added tests for the new API (which caught a number of the issues
  listed above).

Fixes project-chip#18444
@github-actions
Copy link

github-actions bot commented May 17, 2022

PR #18519: Size comparison from d79a0e3 to bb2e6ef

Increases (5 builds for cc13x2_26x2)
platform target config section d79a0e3 bb2e6ef change % change
cc13x2_26x2 all-clusters-app LP_CC2652R7 (read/write) 159384 159456 72 0.0
lock-ftd LP_CC2652R7 (read/write) 165776 165848 72 0.0
pump-app LP_CC2652R7 (read/write) 183532 183628 96 0.1
pump-controller-app LP_CC2652R7 (read/write) 190172 190276 104 0.1
shell LP_CC2652R7 (read/write) 160820 160908 88 0.1
Decreases (37 builds for cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
platform target config section d79a0e3 bb2e6ef change % change
cc13x2_26x2 all-clusters-app LP_CC2652R7 (read only) 692151 692079 -72 -0.0
.text 587848 587776 -72 -0.0
lock-ftd LP_CC2652R7 (read only) 676863 676791 -72 -0.0
.text 581412 581340 -72 -0.0
lock-mtd LP_CC2652R7 (read only) 625695 625623 -72 -0.0
.text 530348 530276 -72 -0.0
pump-app LP_CC2652R7 (read only) 660387 660291 -96 -0.0
.text 579440 579344 -96 -0.0
pump-controller-app LP_CC2652R7 (read only) 653555 653451 -104 -0.0
.text 569504 569400 -104 -0.0
shell LP_CC2652R7 (read only) 686538 686450 -88 -0.0
.text 584684 584596 -88 -0.0
cyw30739 light cyw930739m2evb_01 (read/write) 624766 624678 -88 -0.0
.app_xip_area 528396 528308 -88 -0.0
lock cyw930739m2evb_01 (read/write) 627826 627730 -96 -0.0
.app_xip_area 532912 532816 -96 -0.0
ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 572266 572178 -88 -0.0
.app_xip_area 467636 467548 -88 -0.0
efr32 lighting-app BRD4161A (read only) 915068 914524 -544 -0.1
.text 915060 914516 -544 -0.1
BRD4161A+rpc (read only) 949304 948728 -576 -0.1
.text 949296 948720 -576 -0.1
BRD4161A+rs911x (read only) 784416 783872 -544 -0.1
.text 784408 783864 -544 -0.1
lock-app BRD4161A+wf200 (read only) 945156 945060 -96 -0.0
.text 945148 945052 -96 -0.0
window-app BRD4161A (read only) 895188 894644 -544 -0.1
.text 895180 894636 -544 -0.1
esp32 all-clusters-app c3devkit (read only) 998376 998278 -98 -0.0
.flash.text 998376 998278 -98 -0.0
m5stack (read only) 1053635 1053567 -68 -0.0
.flash.text 1048251 1048183 -68 -0.0
k32w light k32w061+release (read/write) 682516 682436 -80 -0.0
.text 598596 598516 -80 -0.0
lock k32w061+release (read/write) 729012 728916 -96 -0.0
.text 644700 644604 -96 -0.0
linux all-clusters-app debug (read only) 2738905 2738857 -48 -0.0
.text 2323938 2323890 -48 -0.0
bridge-app debug+rpc (read only) 2021385 2021337 -48 -0.0
.text 1696002 1695954 -48 -0.0
chip-tool debug (read only) 9282453 9282405 -48 -0.0
.text 7474613 7474565 -48 -0.0
chip-tool-no-interactive-ipv6only arm64 (read only) 9058756 9058740 -16 -0.0
.text 7149732 7149716 -16 -0.0
lighting-app debug+rpc (read only) 2315209 2315161 -48 -0.0
.text 1961522 1961474 -48 -0.0
lock-app debug (read only) 2228937 2228905 -32 -0.0
.text 1870994 1870962 -32 -0.0
ota-provider-app debug (read only) 2049873 2049825 -48 -0.0
.text 1714210 1714162 -48 -0.0
ota-requestor-app debug (read only) 2079201 2079153 -48 -0.0
.text 1745874 1745826 -48 -0.0
shell debug (read only) 2555289 2555241 -48 -0.0
.text 2172530 2172482 -48 -0.0
thermostat-no-ble arm64 (read only) 2343780 2343764 -16 -0.0
.text 1966848 1966832 -16 -0.0
tv-app debug (read only) 2841185 2841153 -32 -0.0
.text 2438562 2438530 -32 -0.0
tv-casting-app debug (read only) 5403545 5403513 -32 -0.0
.text 4705314 4705282 -32 -0.0
mbed lock-app CY8CPROTO_062_4343W+release (read/write) 2418784 2418720 -64 -0.0
.text 1381428 1381364 -64 -0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1180243 1180147 -96 -0.0
text 810160 810072 -88 -0.0
p6 all-clusters-app default (read/write) 2532168 2531608 -560 -0.0
.text 1490432 1489872 -560 -0.0
light-app default (read/write) 2418776 2418216 -560 -0.0
.text 1377040 1376480 -560 -0.0
lock-app default (read/write) 2429424 2428880 -544 -0.0
.text 1387688 1387144 -544 -0.0
telink light-switch-app tlsr9518adk80d (read/write) 782116 782020 -96 -0.0
text 553028 552930 -98 -0.0
lighting-app tlsr9518adk80d (read/write) 802208 802104 -104 -0.0
text 569794 569696 -98 -0.0
Full report (37 builds for cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
platform target config section d79a0e3 bb2e6ef change % change
cc13x2_26x2 all-clusters-app LP_CC2652R7 (read only) 692151 692079 -72 -0.0
(read/write) 159384 159456 72 0.0
.bss 74516 74516 0 0.0
.data 3412 3412 0 0.0
.rodata 103823 103823 0 0.0
.text 587848 587776 -72 -0.0
lock-ftd LP_CC2652R7 (read only) 676863 676791 -72 -0.0
(read/write) 165776 165848 72 0.0
.bss 72676 72676 0 0.0
.data 3236 3236 0 0.0
.rodata 94967 94967 0 0.0
.text 581412 581340 -72 -0.0
lock-mtd LP_CC2652R7 (read only) 625695 625623 -72 -0.0
(read/write) 145508 145508 0 0.0
.bss 68412 68412 0 0.0
.data 3236 3236 0 0.0
.rodata 94855 94855 0 0.0
.text 530348 530276 -72 -0.0
pump-app LP_CC2652R7 (read only) 660387 660291 -96 -0.0
(read/write) 183532 183628 96 0.1
.bss 72932 72932 0 0.0
.data 3268 3268 0 0.0
.rodata 80467 80467 0 0.0
.text 579440 579344 -96 -0.0
pump-controller-app LP_CC2652R7 (read only) 653555 653451 -104 -0.0
(read/write) 190172 190276 104 0.1
.bss 72996 72996 0 0.0
.data 3232 3232 0 0.0
.rodata 83571 83571 0 0.0
.text 569504 569400 -104 -0.0
shell LP_CC2652R7 (read only) 686538 686450 -88 -0.0
(read/write) 160820 160908 88 0.1
.bss 77140 77140 0 0.0
.data 3416 3416 0 0.0
.rodata 101370 101370 0 0.0
.text 584684 584596 -88 -0.0
cyw30739 light cyw930739m2evb_01 (read/write) 624766 624678 -88 -0.0
.app_xip_area 528396 528308 -88 -0.0
.bss 79012 79012 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) 627826 627730 -96 -0.0
.app_xip_area 532912 532816 -96 -0.0
.bss 77588 77588 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) 572266 572178 -88 -0.0
.app_xip_area 467636 467548 -88 -0.0
.bss 87008 87008 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) 915068 914524 -544 -0.1
(read/write) 133220 133220 0 0.0
.bss 131160 131160 0 0.0
.data 2060 2060 0 0.0
.text 915060 914516 -544 -0.1
BRD4161A+rpc (read only) 949304 948728 -576 -0.1
(read/write) 149904 149904 0 0.0
.bss 147640 147640 0 0.0
.data 2264 2264 0 0.0
.text 949296 948720 -576 -0.1
BRD4161A+rs911x (read only) 784416 783872 -544 -0.1
(read/write) 128444 128444 0 0.0
.bss 126372 126372 0 0.0
.data 2068 2068 0 0.0
.text 784408 783864 -544 -0.1
lock-app BRD4161A+wf200 (read only) 945156 945060 -96 -0.0
(read/write) 122924 122924 0 0.0
.bss 120900 120900 0 0.0
.data 2024 2024 0 0.0
.text 945148 945052 -96 -0.0
window-app BRD4161A (read only) 895188 894644 -544 -0.1
(read/write) 133280 133280 0 0.0
.bss 131232 131232 0 0.0
.data 2048 2048 0 0.0
.text 895180 894636 -544 -0.1
esp32 all-clusters-app c3devkit (read only) 998376 998278 -98 -0.0
(read/write) 1477026 1477026 0 0.0
.dram0.bss 67128 67128 0 0.0
.dram0.data 14576 14576 0 0.0
.flash.rodata 209888 209888 0 0.0
.flash.text 998376 998278 -98 -0.0
.iram0.text 62954 62954 0 0.0
m5stack (read only) 1053635 1053567 -68 -0.0
(read/write) 479024 479024 0 0.0
.dram0.bss 72656 72656 0 0.0
.dram0.data 34184 34184 0 0.0
.flash.rodata 240188 240188 0 0.0
.flash.text 1048251 1048183 -68 -0.0
.iram0.text 123267 123267 0 0.0
k32w light k32w061+release (read/write) 682516 682436 -80 -0.0
.bss 80200 80200 0 0.0
.data 2016 2016 0 0.0
.text 598596 598516 -80 -0.0
lock k32w061+release (read/write) 729012 728916 -96 -0.0
.bss 80632 80632 0 0.0
.data 1976 1976 0 0.0
.text 644700 644604 -96 -0.0
linux all-clusters-app debug (read only) 2738905 2738857 -48 -0.0
(read/write) 174624 174624 0 0.0
.bss 83904 83904 0 0.0
.data 2064 2064 0 0.0
.data.rel.ro 82488 82488 0 0.0
.dynamic 608 608 0 0.0
.got 4496 4496 0 0.0
.init 27 27 0 0.0
.init_array 1016 1016 0 0.0
.rodata 238877 238877 0 0.0
.text 2323938 2323890 -48 -0.0
bridge-app debug+rpc (read only) 2021385 2021337 -48 -0.0
(read/write) 146552 146552 0 0.0
.bss 71744 71744 0 0.0
.data 3936 3936 0 0.0
.data.rel.ro 65288 65288 0 0.0
.dynamic 592 592 0 0.0
.got 4272 4272 0 0.0
.init 27 27 0 0.0
.init_array 688 688 0 0.0
.rodata 167401 167401 0 0.0
.text 1696002 1695954 -48 -0.0
chip-tool debug (read only) 9282453 9282405 -48 -0.0
(read/write) 578864 578864 0 0.0
.bss 22816 22816 0 0.0
.data 1136 1136 0 0.0
.data.rel.ro 548608 548608 0 0.0
.dynamic 624 624 0 0.0
.got 5000 5000 0 0.0
.init 27 27 0 0.0
.init_array 648 648 0 0.0
.rodata 479061 479061 0 0.0
.text 7474613 7474565 -48 -0.0
chip-tool-no-interactive-ipv6only arm64 (read only) 9058756 9058740 -16 -0.0
(read/write) 644993 644993 0 0.0
.bss 41105 41105 0 0.0
.data 1192 1192 0 0.0
.data.rel.ro 583864 583864 0 0.0
.dynamic 560 560 0 0.0
.got 14992 14992 0 0.0
.init 24 24 0 0.0
.init_array 184 184 0 0.0
.rodata 445124 445124 0 0.0
.text 7149732 7149716 -16 -0.0
lighting-app debug+rpc (read only) 2315209 2315161 -48 -0.0
(read/write) 152000 152000 0 0.0
.bss 73536 73536 0 0.0
.data 2048 2048 0 0.0
.data.rel.ro 70664 70664 0 0.0
.dynamic 608 608 0 0.0
.got 4344 4344 0 0.0
.init 27 27 0 0.0
.init_array 792 792 0 0.0
.rodata 186473 186473 0 0.0
.text 1961522 1961474 -48 -0.0
lock-app debug (read only) 2228937 2228905 -32 -0.0
(read/write) 146680 146680 0 0.0
.bss 72224 72224 0 0.0
.data 1568 1568 0 0.0
.data.rel.ro 67192 67192 0 0.0
.dynamic 592 592 0 0.0
.got 4336 4336 0 0.0
.init 27 27 0 0.0
.init_array 752 752 0 0.0
.rodata 197049 197049 0 0.0
.text 1870994 1870962 -32 -0.0
ota-provider-app debug (read only) 2049873 2049825 -48 -0.0
(read/write) 139728 139728 0 0.0
.bss 71680 71680 0 0.0
.data 1768 1768 0 0.0
.data.rel.ro 60488 60488 0 0.0
.dynamic 608 608 0 0.0
.got 4504 4504 0 0.0
.init 27 27 0 0.0
.init_array 648 648 0 0.0
.rodata 177267 177267 0 0.0
.text 1714210 1714162 -48 -0.0
ota-requestor-app debug (read only) 2079201 2079153 -48 -0.0
(read/write) 142568 142568 0 0.0
.bss 72352 72352 0 0.0
.data 1992 1992 0 0.0
.data.rel.ro 62584 62584 0 0.0
.dynamic 592 592 0 0.0
.got 4344 4344 0 0.0
.init 27 27 0 0.0
.init_array 672 672 0 0.0
.rodata 173468 173468 0 0.0
.text 1745874 1745826 -48 -0.0
shell debug (read only) 2555289 2555241 -48 -0.0
(read/write) 198552 198552 0 0.0
.bss 114632 114632 0 0.0
.data 1376 1376 0 0.0
.data.rel.ro 76776 76776 0 0.0
.dynamic 608 608 0 0.0
.got 4192 4192 0 0.0
.init 27 27 0 0.0
.init_array 936 936 0 0.0
.rodata 220050 220050 0 0.0
.text 2172530 2172482 -48 -0.0
thermostat-no-ble arm64 (read only) 2343780 2343764 -16 -0.0
(read/write) 175121 175121 0 0.0
.bss 86465 86465 0 0.0
.data 1520 1520 0 0.0
.data.rel.ro 79336 79336 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 147108 147108 0 0.0
.text 1966848 1966832 -16 -0.0
tv-app debug (read only) 2841185 2841153 -32 -0.0
(read/write) 277472 277472 0 0.0
.bss 189592 189592 0 0.0
.data 4672 4672 0 0.0
.data.rel.ro 76960 76960 0 0.0
.dynamic 592 592 0 0.0
.got 4720 4720 0 0.0
.init 27 27 0 0.0
.init_array 928 928 0 0.0
.rodata 219345 219345 0 0.0
.text 2438562 2438530 -32 -0.0
tv-casting-app debug (read only) 5403545 5403513 -32 -0.0
(read/write) 223776 223776 0 0.0
.bss 77240 77240 0 0.0
.data 2368 2368 0 0.0
.data.rel.ro 137952 137952 0 0.0
.dynamic 608 608 0 0.0
.got 4728 4728 0 0.0
.init 27 27 0 0.0
.init_array 864 864 0 0.0
.rodata 337921 337921 0 0.0
.text 4705314 4705282 -32 -0.0
mbed lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2418784 2418720 -64 -0.0
.bss 201588 201588 0 0.0
.data 5872 5872 0 0.0
.text 1381428 1381364 -64 -0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1180243 1180147 -96 -0.0
bss 138356 138356 0 0.0
rodata 152956 152956 0 0.0
text 810160 810072 -88 -0.0
p6 all-clusters-app default (read/write) 2532168 2531608 -560 -0.0
.bss 135096 135096 0 0.0
.data 2808 2808 0 0.0
.text 1490432 1489872 -560 -0.0
light-app default (read/write) 2418776 2418216 -560 -0.0
.bss 128416 128416 0 0.0
.data 2608 2608 0 0.0
.text 1377040 1376480 -560 -0.0
lock-app default (read/write) 2429424 2428880 -544 -0.0
.bss 128232 128232 0 0.0
.data 2568 2568 0 0.0
.text 1387688 1387144 -544 -0.0
telink light-switch-app tlsr9518adk80d (read/write) 782116 782020 -96 -0.0
bss 70592 70592 0 0.0
noinit 40416 40416 0 0.0
text 553028 552930 -98 -0.0
lighting-app tlsr9518adk80d (read/write) 802208 802104 -104 -0.0
bss 70848 70848 0 0.0
noinit 40416 40416 0 0.0
text 569794 569696 -98 -0.0

@github-actions
Copy link

github-actions bot commented May 17, 2022

PR #18519: Size comparison from d79a0e3 to 8c8c3c9

Increases (5 builds for cc13x2_26x2)
platform target config section d79a0e3 8c8c3c9 change % change
cc13x2_26x2 all-clusters-app LP_CC2652R7 (read/write) 159384 159456 72 0.0
lock-ftd LP_CC2652R7 (read/write) 165776 165848 72 0.0
pump-app LP_CC2652R7 (read/write) 183532 183628 96 0.1
pump-controller-app LP_CC2652R7 (read/write) 190172 190276 104 0.1
shell LP_CC2652R7 (read/write) 160820 160908 88 0.1
Decreases (37 builds for cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
platform target config section d79a0e3 8c8c3c9 change % change
cc13x2_26x2 all-clusters-app LP_CC2652R7 (read only) 692151 692079 -72 -0.0
.text 587848 587776 -72 -0.0
lock-ftd LP_CC2652R7 (read only) 676863 676791 -72 -0.0
.text 581412 581340 -72 -0.0
lock-mtd LP_CC2652R7 (read only) 625695 625623 -72 -0.0
.text 530348 530276 -72 -0.0
pump-app LP_CC2652R7 (read only) 660387 660291 -96 -0.0
.text 579440 579344 -96 -0.0
pump-controller-app LP_CC2652R7 (read only) 653555 653451 -104 -0.0
.text 569504 569400 -104 -0.0
shell LP_CC2652R7 (read only) 686538 686450 -88 -0.0
.text 584684 584596 -88 -0.0
cyw30739 light cyw930739m2evb_01 (read/write) 624766 624678 -88 -0.0
.app_xip_area 528396 528308 -88 -0.0
lock cyw930739m2evb_01 (read/write) 627826 627730 -96 -0.0
.app_xip_area 532912 532816 -96 -0.0
ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 572266 572178 -88 -0.0
.app_xip_area 467636 467548 -88 -0.0
efr32 lighting-app BRD4161A (read only) 915068 914524 -544 -0.1
.text 915060 914516 -544 -0.1
BRD4161A+rpc (read only) 949304 948728 -576 -0.1
.text 949296 948720 -576 -0.1
BRD4161A+rs911x (read only) 784416 783872 -544 -0.1
.text 784408 783864 -544 -0.1
lock-app BRD4161A+wf200 (read only) 945156 945060 -96 -0.0
.text 945148 945052 -96 -0.0
window-app BRD4161A (read only) 895188 894644 -544 -0.1
.text 895180 894636 -544 -0.1
esp32 all-clusters-app c3devkit (read only) 998376 998278 -98 -0.0
.flash.text 998376 998278 -98 -0.0
m5stack (read only) 1053635 1053567 -68 -0.0
.flash.text 1048251 1048183 -68 -0.0
k32w light k32w061+release (read/write) 682516 682436 -80 -0.0
.text 598596 598516 -80 -0.0
lock k32w061+release (read/write) 729012 728916 -96 -0.0
.text 644700 644604 -96 -0.0
linux all-clusters-app debug (read only) 2738905 2738857 -48 -0.0
.text 2323938 2323890 -48 -0.0
bridge-app debug+rpc (read only) 2021385 2021337 -48 -0.0
.text 1696002 1695954 -48 -0.0
chip-tool debug (read only) 9282453 9282405 -48 -0.0
.text 7474613 7474565 -48 -0.0
chip-tool-no-interactive-ipv6only arm64 (read only) 9058756 9058740 -16 -0.0
.text 7149732 7149716 -16 -0.0
lighting-app debug+rpc (read only) 2315209 2315161 -48 -0.0
.text 1961522 1961474 -48 -0.0
lock-app debug (read only) 2228937 2228905 -32 -0.0
.text 1870994 1870962 -32 -0.0
ota-provider-app debug (read only) 2049873 2049825 -48 -0.0
.text 1714210 1714162 -48 -0.0
ota-requestor-app debug (read only) 2079201 2079153 -48 -0.0
.text 1745874 1745826 -48 -0.0
shell debug (read only) 2555289 2555241 -48 -0.0
.text 2172530 2172482 -48 -0.0
thermostat-no-ble arm64 (read only) 2343780 2343764 -16 -0.0
.text 1966848 1966832 -16 -0.0
tv-app debug (read only) 2841185 2841153 -32 -0.0
.text 2438562 2438530 -32 -0.0
tv-casting-app debug (read only) 5403545 5403513 -32 -0.0
.text 4705314 4705282 -32 -0.0
mbed lock-app CY8CPROTO_062_4343W+release (read/write) 2418784 2418720 -64 -0.0
.text 1381428 1381364 -64 -0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1180243 1180163 -80 -0.0
text 810160 810080 -80 -0.0
p6 all-clusters-app default (read/write) 2532168 2531608 -560 -0.0
.text 1490432 1489872 -560 -0.0
light-app default (read/write) 2418776 2418216 -560 -0.0
.text 1377040 1376480 -560 -0.0
lock-app default (read/write) 2429424 2428880 -544 -0.0
.text 1387688 1387144 -544 -0.0
telink light-switch-app tlsr9518adk80d (read/write) 782116 782028 -88 -0.0
text 553028 552938 -90 -0.0
lighting-app tlsr9518adk80d (read/write) 802208 802112 -96 -0.0
text 569794 569704 -90 -0.0
Full report (37 builds for cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
platform target config section d79a0e3 8c8c3c9 change % change
cc13x2_26x2 all-clusters-app LP_CC2652R7 (read only) 692151 692079 -72 -0.0
(read/write) 159384 159456 72 0.0
.bss 74516 74516 0 0.0
.data 3412 3412 0 0.0
.rodata 103823 103823 0 0.0
.text 587848 587776 -72 -0.0
lock-ftd LP_CC2652R7 (read only) 676863 676791 -72 -0.0
(read/write) 165776 165848 72 0.0
.bss 72676 72676 0 0.0
.data 3236 3236 0 0.0
.rodata 94967 94967 0 0.0
.text 581412 581340 -72 -0.0
lock-mtd LP_CC2652R7 (read only) 625695 625623 -72 -0.0
(read/write) 145508 145508 0 0.0
.bss 68412 68412 0 0.0
.data 3236 3236 0 0.0
.rodata 94855 94855 0 0.0
.text 530348 530276 -72 -0.0
pump-app LP_CC2652R7 (read only) 660387 660291 -96 -0.0
(read/write) 183532 183628 96 0.1
.bss 72932 72932 0 0.0
.data 3268 3268 0 0.0
.rodata 80467 80467 0 0.0
.text 579440 579344 -96 -0.0
pump-controller-app LP_CC2652R7 (read only) 653555 653451 -104 -0.0
(read/write) 190172 190276 104 0.1
.bss 72996 72996 0 0.0
.data 3232 3232 0 0.0
.rodata 83571 83571 0 0.0
.text 569504 569400 -104 -0.0
shell LP_CC2652R7 (read only) 686538 686450 -88 -0.0
(read/write) 160820 160908 88 0.1
.bss 77140 77140 0 0.0
.data 3416 3416 0 0.0
.rodata 101370 101370 0 0.0
.text 584684 584596 -88 -0.0
cyw30739 light cyw930739m2evb_01 (read/write) 624766 624678 -88 -0.0
.app_xip_area 528396 528308 -88 -0.0
.bss 79012 79012 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) 627826 627730 -96 -0.0
.app_xip_area 532912 532816 -96 -0.0
.bss 77588 77588 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) 572266 572178 -88 -0.0
.app_xip_area 467636 467548 -88 -0.0
.bss 87008 87008 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) 915068 914524 -544 -0.1
(read/write) 133220 133220 0 0.0
.bss 131160 131160 0 0.0
.data 2060 2060 0 0.0
.text 915060 914516 -544 -0.1
BRD4161A+rpc (read only) 949304 948728 -576 -0.1
(read/write) 149904 149904 0 0.0
.bss 147640 147640 0 0.0
.data 2264 2264 0 0.0
.text 949296 948720 -576 -0.1
BRD4161A+rs911x (read only) 784416 783872 -544 -0.1
(read/write) 128444 128444 0 0.0
.bss 126372 126372 0 0.0
.data 2068 2068 0 0.0
.text 784408 783864 -544 -0.1
lock-app BRD4161A+wf200 (read only) 945156 945060 -96 -0.0
(read/write) 122924 122924 0 0.0
.bss 120900 120900 0 0.0
.data 2024 2024 0 0.0
.text 945148 945052 -96 -0.0
window-app BRD4161A (read only) 895188 894644 -544 -0.1
(read/write) 133280 133280 0 0.0
.bss 131232 131232 0 0.0
.data 2048 2048 0 0.0
.text 895180 894636 -544 -0.1
esp32 all-clusters-app c3devkit (read only) 998376 998278 -98 -0.0
(read/write) 1477026 1477026 0 0.0
.dram0.bss 67128 67128 0 0.0
.dram0.data 14576 14576 0 0.0
.flash.rodata 209888 209888 0 0.0
.flash.text 998376 998278 -98 -0.0
.iram0.text 62954 62954 0 0.0
m5stack (read only) 1053635 1053567 -68 -0.0
(read/write) 479024 479024 0 0.0
.dram0.bss 72656 72656 0 0.0
.dram0.data 34184 34184 0 0.0
.flash.rodata 240188 240188 0 0.0
.flash.text 1048251 1048183 -68 -0.0
.iram0.text 123267 123267 0 0.0
k32w light k32w061+release (read/write) 682516 682436 -80 -0.0
.bss 80200 80200 0 0.0
.data 2016 2016 0 0.0
.text 598596 598516 -80 -0.0
lock k32w061+release (read/write) 729012 728916 -96 -0.0
.bss 80632 80632 0 0.0
.data 1976 1976 0 0.0
.text 644700 644604 -96 -0.0
linux all-clusters-app debug (read only) 2738905 2738857 -48 -0.0
(read/write) 174624 174624 0 0.0
.bss 83904 83904 0 0.0
.data 2064 2064 0 0.0
.data.rel.ro 82488 82488 0 0.0
.dynamic 608 608 0 0.0
.got 4496 4496 0 0.0
.init 27 27 0 0.0
.init_array 1016 1016 0 0.0
.rodata 238877 238877 0 0.0
.text 2323938 2323890 -48 -0.0
bridge-app debug+rpc (read only) 2021385 2021337 -48 -0.0
(read/write) 146552 146552 0 0.0
.bss 71744 71744 0 0.0
.data 3936 3936 0 0.0
.data.rel.ro 65288 65288 0 0.0
.dynamic 592 592 0 0.0
.got 4272 4272 0 0.0
.init 27 27 0 0.0
.init_array 688 688 0 0.0
.rodata 167401 167401 0 0.0
.text 1696002 1695954 -48 -0.0
chip-tool debug (read only) 9282453 9282405 -48 -0.0
(read/write) 578864 578864 0 0.0
.bss 22816 22816 0 0.0
.data 1136 1136 0 0.0
.data.rel.ro 548608 548608 0 0.0
.dynamic 624 624 0 0.0
.got 5000 5000 0 0.0
.init 27 27 0 0.0
.init_array 648 648 0 0.0
.rodata 479061 479061 0 0.0
.text 7474613 7474565 -48 -0.0
chip-tool-no-interactive-ipv6only arm64 (read only) 9058756 9058740 -16 -0.0
(read/write) 644993 644993 0 0.0
.bss 41105 41105 0 0.0
.data 1192 1192 0 0.0
.data.rel.ro 583864 583864 0 0.0
.dynamic 560 560 0 0.0
.got 14992 14992 0 0.0
.init 24 24 0 0.0
.init_array 184 184 0 0.0
.rodata 445124 445124 0 0.0
.text 7149732 7149716 -16 -0.0
lighting-app debug+rpc (read only) 2315209 2315161 -48 -0.0
(read/write) 152000 152000 0 0.0
.bss 73536 73536 0 0.0
.data 2048 2048 0 0.0
.data.rel.ro 70664 70664 0 0.0
.dynamic 608 608 0 0.0
.got 4344 4344 0 0.0
.init 27 27 0 0.0
.init_array 792 792 0 0.0
.rodata 186473 186473 0 0.0
.text 1961522 1961474 -48 -0.0
lock-app debug (read only) 2228937 2228905 -32 -0.0
(read/write) 146680 146680 0 0.0
.bss 72224 72224 0 0.0
.data 1568 1568 0 0.0
.data.rel.ro 67192 67192 0 0.0
.dynamic 592 592 0 0.0
.got 4336 4336 0 0.0
.init 27 27 0 0.0
.init_array 752 752 0 0.0
.rodata 197049 197049 0 0.0
.text 1870994 1870962 -32 -0.0
ota-provider-app debug (read only) 2049873 2049825 -48 -0.0
(read/write) 139728 139728 0 0.0
.bss 71680 71680 0 0.0
.data 1768 1768 0 0.0
.data.rel.ro 60488 60488 0 0.0
.dynamic 608 608 0 0.0
.got 4504 4504 0 0.0
.init 27 27 0 0.0
.init_array 648 648 0 0.0
.rodata 177267 177267 0 0.0
.text 1714210 1714162 -48 -0.0
ota-requestor-app debug (read only) 2079201 2079153 -48 -0.0
(read/write) 142568 142568 0 0.0
.bss 72352 72352 0 0.0
.data 1992 1992 0 0.0
.data.rel.ro 62584 62584 0 0.0
.dynamic 592 592 0 0.0
.got 4344 4344 0 0.0
.init 27 27 0 0.0
.init_array 672 672 0 0.0
.rodata 173468 173468 0 0.0
.text 1745874 1745826 -48 -0.0
shell debug (read only) 2555289 2555241 -48 -0.0
(read/write) 198552 198552 0 0.0
.bss 114632 114632 0 0.0
.data 1376 1376 0 0.0
.data.rel.ro 76776 76776 0 0.0
.dynamic 608 608 0 0.0
.got 4192 4192 0 0.0
.init 27 27 0 0.0
.init_array 936 936 0 0.0
.rodata 220050 220050 0 0.0
.text 2172530 2172482 -48 -0.0
thermostat-no-ble arm64 (read only) 2343780 2343764 -16 -0.0
(read/write) 175121 175121 0 0.0
.bss 86465 86465 0 0.0
.data 1520 1520 0 0.0
.data.rel.ro 79336 79336 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 147108 147108 0 0.0
.text 1966848 1966832 -16 -0.0
tv-app debug (read only) 2841185 2841153 -32 -0.0
(read/write) 277472 277472 0 0.0
.bss 189592 189592 0 0.0
.data 4672 4672 0 0.0
.data.rel.ro 76960 76960 0 0.0
.dynamic 592 592 0 0.0
.got 4720 4720 0 0.0
.init 27 27 0 0.0
.init_array 928 928 0 0.0
.rodata 219345 219345 0 0.0
.text 2438562 2438530 -32 -0.0
tv-casting-app debug (read only) 5403545 5403513 -32 -0.0
(read/write) 223776 223776 0 0.0
.bss 77240 77240 0 0.0
.data 2368 2368 0 0.0
.data.rel.ro 137952 137952 0 0.0
.dynamic 608 608 0 0.0
.got 4728 4728 0 0.0
.init 27 27 0 0.0
.init_array 864 864 0 0.0
.rodata 337921 337921 0 0.0
.text 4705314 4705282 -32 -0.0
mbed lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2418784 2418720 -64 -0.0
.bss 201588 201588 0 0.0
.data 5872 5872 0 0.0
.text 1381428 1381364 -64 -0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1180243 1180163 -80 -0.0
bss 138356 138356 0 0.0
rodata 152956 152956 0 0.0
text 810160 810080 -80 -0.0
p6 all-clusters-app default (read/write) 2532168 2531608 -560 -0.0
.bss 135096 135096 0 0.0
.data 2808 2808 0 0.0
.text 1490432 1489872 -560 -0.0
light-app default (read/write) 2418776 2418216 -560 -0.0
.bss 128416 128416 0 0.0
.data 2608 2608 0 0.0
.text 1377040 1376480 -560 -0.0
lock-app default (read/write) 2429424 2428880 -544 -0.0
.bss 128232 128232 0 0.0
.data 2568 2568 0 0.0
.text 1387688 1387144 -544 -0.0
telink light-switch-app tlsr9518adk80d (read/write) 782116 782028 -88 -0.0
bss 70592 70592 0 0.0
noinit 40416 40416 0 0.0
text 553028 552938 -90 -0.0
lighting-app tlsr9518adk80d (read/write) 802208 802112 -96 -0.0
bss 70848 70848 0 0.0
noinit 40416 40416 0 0.0
text 569794 569704 -90 -0.0

@andy31415 andy31415 merged commit 5c70127 into project-chip:master May 18, 2022
@bzbarsky-apple bzbarsky-apple deleted the allow-providing-NOC branch May 18, 2022 01:36
tcarmelveilleux pushed a commit to tcarmelveilleux/connectedhomeip that referenced this pull request May 19, 2022
- When a commissioner is backing their key with OS or hardware support,
  the built-in P256Keypair::NewCertificateSigningRequest will not be
  usable since it relies on internal P256Keypair base class access to
  key state, as opposed to just using Pubkey() and ECDSA_sign_message
  primitives. This is OK on some embedded usecases that make use
  of P256Keypair backend directly, but not for many other usecases.
- On iOS/Darwin and on native Android, backing the P256Keypair *
  by derived classes is bridgeable to platform APIs, but those
  platform APIs do not offer easy/direct CSR generation, and on
  Darwin, there are not ASN.1 APIs anymore.
- If trying to make use of Darwin APIs introduced in project-chip#18519, there
  is no easy way to write code interfacing with an external CA to
  provide a CSR for a natively bridged keypair.

This PR adds a first-principle CSR generator, written and audited
by Google personel, using the ASN1Writer API already used in
CHIPCert.h and used by all Commissioner code making use of SDK
today. This is a straightforward implementation that directly
uses a P256Keypair * (or a derived class thereof!) to generate
a CSR against it, without depending on direct key access like
like the native version P256Keypair::NewCerticateSigningRequest
does.

This PR also fixes constness of operations on P256Keypair.

Issue project-chip#18444

Testing done:
- Added unit tests for the new primitive
- Validated generated CSR with OpenSSL
- Validated equivalence to generated CSR from P256Keypair, on
  both mbedTLS and OpenSSL
- Not used by CHIP-tool but usable by Darwin and Android framework
  users.
tcarmelveilleux added a commit to tcarmelveilleux/connectedhomeip that referenced this pull request May 19, 2022
- When a commissioner is backing their key with OS or hardware support,
  the built-in P256Keypair::NewCertificateSigningRequest will not be
  usable since it relies on internal P256Keypair base class access to
  key state, as opposed to just using Pubkey() and ECDSA_sign_message
  primitives. This is OK on some embedded usecases that make use
  of P256Keypair backend directly, but not for many other usecases.
- On iOS/Darwin and on native Android, backing the P256Keypair *
  by derived classes is bridgeable to platform APIs, but those
  platform APIs do not offer easy/direct CSR generation, and on
  Darwin, there are not ASN.1 APIs anymore.
- If trying to make use of Darwin APIs introduced in project-chip#18519, there
  is no easy way to write code interfacing with an external CA to
  provide a CSR for a natively bridged keypair.

This PR adds a first-principle CSR generator, written and audited
by Google personel, using the ASN1Writer API already used in
CHIPCert.h and used by all Commissioner code making use of SDK
today. This is a straightforward implementation that directly
uses a P256Keypair * (or a derived class thereof!) to generate
a CSR against it, without depending on direct key access like
like the native version P256Keypair::NewCerticateSigningRequest
does.

This PR also fixes constness of operations on P256Keypair.

Issue project-chip#18444

Testing done:
- Added unit tests for the new primitive
- Validated generated CSR with OpenSSL
- Validated equivalence to generated CSR from P256Keypair, on
  both mbedTLS and OpenSSL
- Not used by CHIP-tool but usable by Darwin and Android framework
  users.
tcarmelveilleux added a commit that referenced this pull request May 20, 2022
…rs (#18631)

* Implement CSR generation from first principles to support commissioners

- When a commissioner is backing their key with OS or hardware support,
  the built-in P256Keypair::NewCertificateSigningRequest will not be
  usable since it relies on internal P256Keypair base class access to
  key state, as opposed to just using Pubkey() and ECDSA_sign_message
  primitives. This is OK on some embedded usecases that make use
  of P256Keypair backend directly, but not for many other usecases.
- On iOS/Darwin and on native Android, backing the P256Keypair *
  by derived classes is bridgeable to platform APIs, but those
  platform APIs do not offer easy/direct CSR generation, and on
  Darwin, there are not ASN.1 APIs anymore.
- If trying to make use of Darwin APIs introduced in #18519, there
  is no easy way to write code interfacing with an external CA to
  provide a CSR for a natively bridged keypair.

This PR adds a first-principle CSR generator, written and audited
by Google personel, using the ASN1Writer API already used in
CHIPCert.h and used by all Commissioner code making use of SDK
today. This is a straightforward implementation that directly
uses a P256Keypair * (or a derived class thereof!) to generate
a CSR against it, without depending on direct key access like
like the native version P256Keypair::NewCerticateSigningRequest
does.

This PR also fixes constness of operations on P256Keypair.

Issue #18444

Testing done:
- Added unit tests for the new primitive
- Validated generated CSR with OpenSSL
- Validated equivalence to generated CSR from P256Keypair, on
  both mbedTLS and OpenSSL
- Not used by CHIP-tool but usable by Darwin and Android framework
  users.

* Update src/crypto/CHIPCryptoPAL.h

Co-authored-by: Boris Zbarsky <[email protected]>

* Fix CI

* Restyled by clang-format

Co-authored-by: Boris Zbarsky <[email protected]>
Co-authored-by: Restyled.io <[email protected]>
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.

Cannot provide externally obtained NOC and externally managed key pair to Darwin framework on controller init
4 participants