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

[crypto] Introduce PSAKeyAllocator #37332

Merged
merged 2 commits into from
Feb 21, 2025

Conversation

ArekBalysNordic
Copy link
Contributor

@ArekBalysNordic ArekBalysNordic commented Jan 31, 2025

The PSAKeyAllocator introduces a new possibility to manage PSA keys depending on the platform.
Now we can still use common PSA API in the Matter stack, but we can inject the platform-specific implementation for storing the persistent keys. Thanks to that we can use PSA ITS as well as custom a crypto driver which is available on vendor-specific platform

  • Allowed setting session keystore by platform. If any keystore is not set, assign the default one.

  • Moved the PSA key definitions from the CHIPCryptoPALPSA.h file to
    the newly created PSAKeyAllocator.

  • The new PSAKeyAllocator class allows for the allocation of keys
    in secure storage. Users can create their own PSAKeyAllocator
    implementation and set it to be used by the Matter stack.

  • If the custom implementation is not provided the default one is
    used and it works as the legacy solution the mechanism is
    about stored keys in the PSA ITS storage.

Testing

Added a new unit test for the PSAKeyAllocator under the TestPSAOpKeyStore test suite (Separate commit in this PR).
The solution is tested within the examples-nrfconnect workflow where the unit tests of the TestPSAOpKeyStore suite are run on the Posix platform.

Copy link

Review changes with  SemanticDiff

Copy link

github-actions bot commented Jan 31, 2025

PR #37332: Size comparison from 3044eeb to 08dc578

Full report (14 builds for cc13x4_26x4, cc32xx, nrfconnect, qpg, stm32, tizen)
platform target config section 3044eeb 08dc578 change % change
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 838000 838016 16 0.0
RAM 123464 123464 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 823420 823420 0 0.0
RAM 125344 125344 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 770644 770660 16 0.0
RAM 113804 113804 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 754888 754904 16 0.0
RAM 114012 114012 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 538445 538445 0 0.0
RAM 205192 205192 0 0.0
lock CC3235SF_LAUNCHXL FLASH 572309 572309 0 0.0
RAM 205344 205344 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 906972 907280 308 0.0
RAM 142395 142403 8 0.0
nrf7002dk_nrf5340_cpuapp FLASH 901532 901544 12 0.0
RAM 124739 124739 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 FLASH 845696 846004 308 0.0
RAM 141323 141331 8 0.0
qpg lighting-app qpg6105+debug FLASH 661984 662000 16 0.0
RAM 105204 105204 0 0.0
lock-app qpg6105+debug FLASH 619788 619788 0 0.0
RAM 99648 99648 0 0.0
stm32 light STM32WB5MM-DK FLASH 482600 482600 0 0.0
RAM 144672 144672 0 0.0
tizen all-clusters-app arm unknown 5116 5116 0 0.0
FLASH 1751892 1751900 8 0.0
RAM 93524 93524 0 0.0
chip-tool-ubsan arm unknown 11408 11408 0 0.0
FLASH 18696094 18696094 0 0.0
RAM 8183744 8183744 0 0.0

Copy link

github-actions bot commented Jan 31, 2025

PR #37332: Size comparison from 3044eeb to efcd0cc

Full report (71 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
platform target config section 3044eeb efcd0cc change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1093546 1093546 0 0.0
RAM 103298 103298 0 0.0
bl702 lighting-app bl702+eth FLASH 650158 650158 0 0.0
RAM 25265 25265 0 0.0
bl702+wifi FLASH 828066 828066 0 0.0
RAM 13981 13981 0 0.0
bl706+mfd+rpc+littlefs FLASH 1056626 1056626 0 0.0
RAM 23861 23861 0 0.0
bl702l contact-sensor-app bl702l+mfd+littlefs FLASH 888060 888060 0 0.0
RAM 18504 18504 0 0.0
lighting-app bl702l+mfd+littlefs FLASH 971046 971046 0 0.0
RAM 16368 16368 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 838000 838016 16 0.0
RAM 123464 123464 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 823420 823420 0 0.0
RAM 125344 125344 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 770644 770660 16 0.0
RAM 113804 113804 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 754888 754904 16 0.0
RAM 114012 114012 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 538445 538445 0 0.0
RAM 205192 205192 0 0.0
lock CC3235SF_LAUNCHXL FLASH 572309 572309 0 0.0
RAM 205344 205344 0 0.0
cyw30739 light CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 679409 679417 8 0.0
RAM 78532 78532 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 699261 699261 0 0.0
RAM 81172 81172 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 699261 699261 0 0.0
RAM 81172 81172 0 0.0
CYW930739M2EVB-02 unknown 2040 2040 0 0.0
FLASH 656189 656197 8 0.0
RAM 73600 73600 0 0.0
light-switch CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 615793 615793 0 0.0
RAM 71516 71516 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 635421 635421 0 0.0
RAM 74060 74060 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 635421 635421 0 0.0
RAM 74060 74060 0 0.0
lock CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 635273 635273 0 0.0
RAM 74524 74524 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 654981 654989 8 0.0
RAM 77068 77068 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 654981 654989 8 0.0
RAM 77068 77068 0 0.0
thermostat CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 611709 611717 8 0.0
RAM 68612 68612 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 631569 631577 8 0.0
RAM 71252 71252 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 631569 631577 8 0.0
RAM 71252 71252 0 0.0
efr32 lock-app BRD4187C FLASH 936232 936488 256 0.0
RAM 159904 159940 36 0.0
BRD4338a FLASH 729900 729892 -8 -0.0
RAM 234764 234764 0 0.0
window-app BRD4187C FLASH 1029256 1029600 344 0.0
RAM 128040 128044 4 0.0
esp32 all-clusters-app c3devkit DRAM 97296 97296 0 0.0
FLASH 1577036 1577040 4 0.0
IRAM 83820 83820 0 0.0
m5stack DRAM 116092 116092 0 0.0
FLASH 1544978 1544982 4 0.0
IRAM 117039 117039 0 0.0
linux air-purifier-app debug unknown 4760 4760 0 0.0
FLASH 2708921 2708935 14 0.0
RAM 132816 132816 0 0.0
all-clusters-app debug unknown 5568 5568 0 0.0
FLASH 5974944 5974958 14 0.0
RAM 531632 531632 0 0.0
all-clusters-minimal-app debug unknown 5464 5464 0 0.0
FLASH 5323630 5323644 14 0.0
RAM 242744 242744 0 0.0
bridge-app debug unknown 5480 5480 0 0.0
FLASH 4681818 4681832 14 0.0
RAM 221480 221480 0 0.0
chip-tool debug unknown 6120 6120 0 0.0
FLASH 13096130 13096130 0 0.0
RAM 596770 596770 0 0.0
chip-tool-ipv6only arm64 unknown 21848 21848 0 0.0
FLASH 1116208 1116208 0 0.0
RAM 648496 648496 0 0.0
fabric-admin debug unknown 5808 5808 0 0.0
FLASH 11388177 11388177 0 0.0
RAM 596554 596554 0 0.0
fabric-bridge-app debug unknown 4736 4736 0 0.0
FLASH 4506416 4506428 12 0.0
RAM 208664 208664 0 0.0
fabric-sync debug unknown 4976 4976 0 0.0
FLASH 5612789 5612805 16 0.0
RAM 483536 483536 0 0.0
lighting-app debug+rpc+ui unknown 6144 6144 0 0.0
FLASH 5624577 5624593 16 0.0
RAM 231760 231760 0 0.0
lock-app debug unknown 5416 5416 0 0.0
FLASH 4730932 4730946 14 0.0
RAM 207728 207728 0 0.0
ota-provider-app debug unknown 4776 4776 0 0.0
FLASH 4359476 4359490 14 0.0
RAM 201368 201368 0 0.0
ota-requestor-app debug unknown 4728 4728 0 0.0
FLASH 4496948 4496962 14 0.0
RAM 205952 205952 0 0.0
shell debug unknown 4256 4256 0 0.0
FLASH 3004845 3004861 16 0.0
RAM 160504 160504 0 0.0
thermostat-no-ble arm64 unknown 9536 9536 0 0.0
FLASH 4098704 4098720 16 0.0
RAM 246144 246144 0 0.0
tv-app debug unknown 5744 5744 0 0.0
FLASH 5952389 5952405 16 0.0
RAM 606936 606936 0 0.0
tv-casting-app debug unknown 5320 5320 0 0.0
FLASH 11269741 11269757 16 0.0
RAM 710896 710896 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 906972 907280 308 0.0
RAM 142395 142403 8 0.0
nrf7002dk_nrf5340_cpuapp FLASH 901532 901544 12 0.0
RAM 124739 124739 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 FLASH 845696 846004 308 0.0
RAM 141323 141331 8 0.0
nxp contact k32w0+release FLASH 584288 584288 0 0.0
RAM 70860 70860 0 0.0
mcxw71+release FLASH 599632 599648 16 0.0
RAM 63080 63080 0 0.0
light k32w0+release FLASH 610732 610732 0 0.0
RAM 70252 70252 0 0.0
k32w1+release FLASH 685192 685192 0 0.0
RAM 48664 48664 0 0.0
lock mcxw71+release FLASH 748664 748664 0 0.0
RAM 67476 67476 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1646372 1646372 0 0.0
RAM 211560 211560 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1553148 1553164 16 0.0
RAM 208376 208376 0 0.0
light cy8ckit_062s2_43012 FLASH 1468828 1468828 0 0.0
RAM 200352 200352 0 0.0
lock cy8ckit_062s2_43012 FLASH 1466860 1466860 0 0.0
RAM 224688 224688 0 0.0
qpg lighting-app qpg6105+debug FLASH 661984 662000 16 0.0
RAM 105204 105204 0 0.0
lock-app qpg6105+debug FLASH 619788 619788 0 0.0
RAM 99648 99648 0 0.0
stm32 light STM32WB5MM-DK FLASH 482600 482600 0 0.0
RAM 144672 144672 0 0.0
telink bridge-app tlsr9258a FLASH 681290 681294 4 0.0
RAM 91084 91084 0 0.0
contact-sensor-app tlsr9528a_retention FLASH 621322 621326 4 0.0
RAM 31484 31484 0 0.0
light-app-ota-compress-lzma-shell-factory-data tl3218x FLASH 770160 770164 4 0.0
RAM 49344 49344 0 0.0
light-app-ota-shell-factory-data tl7218x FLASH 774590 774594 4 0.0
RAM 99648 99648 0 0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 708494 708498 4 0.0
RAM 73376 73376 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 625592 625596 4 0.0
RAM 142016 142016 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 812972 812976 4 0.0
RAM 99560 99560 0 0.0
tizen all-clusters-app arm unknown 5116 5116 0 0.0
FLASH 1751892 1751900 8 0.0
RAM 93524 93524 0 0.0
chip-tool-ubsan arm unknown 11408 11408 0 0.0
FLASH 18696094 18696094 0 0.0
RAM 8183744 8183744 0 0.0

Copy link

github-actions bot commented Feb 3, 2025

PR #37332: Size comparison from 11a4c4a to 47dcf0c

Full report (72 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
platform target config section 11a4c4a 47dcf0c change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1093546 1093546 0 0.0
RAM 103298 103298 0 0.0
bl702 lighting-app bl702+eth FLASH 650158 650158 0 0.0
RAM 25265 25265 0 0.0
bl702+wifi FLASH 828066 828066 0 0.0
RAM 13981 13981 0 0.0
bl706+mfd+rpc+littlefs FLASH 1056626 1056626 0 0.0
RAM 23861 23861 0 0.0
bl702l contact-sensor-app bl702l+mfd+littlefs FLASH 888060 888060 0 0.0
RAM 18504 18504 0 0.0
lighting-app bl702l+mfd+littlefs FLASH 971046 971046 0 0.0
RAM 16368 16368 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 838032 838032 0 0.0
RAM 123464 123464 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 823436 823436 0 0.0
RAM 125344 125344 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 770676 770676 0 0.0
RAM 113804 113804 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 754920 754920 0 0.0
RAM 114012 114012 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 538461 538461 0 0.0
RAM 205192 205192 0 0.0
lock CC3235SF_LAUNCHXL FLASH 572325 572325 0 0.0
RAM 205344 205344 0 0.0
cyw30739 light CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 679433 679433 0 0.0
RAM 78532 78532 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 699285 699285 0 0.0
RAM 81172 81172 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 699285 699285 0 0.0
RAM 81172 81172 0 0.0
CYW930739M2EVB-02 unknown 2040 2040 0 0.0
FLASH 656213 656213 0 0.0
RAM 73600 73600 0 0.0
light-switch CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 615817 615817 0 0.0
RAM 71516 71516 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 635445 635445 0 0.0
RAM 74060 74060 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 635445 635445 0 0.0
RAM 74060 74060 0 0.0
lock CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 635289 635289 0 0.0
RAM 74524 74524 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 654997 654997 0 0.0
RAM 77068 77068 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 654997 654997 0 0.0
RAM 77068 77068 0 0.0
thermostat CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 611725 611725 0 0.0
RAM 68612 68612 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 631585 631585 0 0.0
RAM 71252 71252 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 631585 631585 0 0.0
RAM 71252 71252 0 0.0
efr32 lock-app BRD4187C FLASH 936232 936488 256 0.0
RAM 159872 159876 4 0.0
BRD4338a FLASH 729884 729876 -8 -0.0
RAM 234700 234700 0 0.0
window-app BRD4187C FLASH 1029256 1029568 312 0.0
RAM 127976 127980 4 0.0
esp32 all-clusters-app c3devkit DRAM 97296 97296 0 0.0
FLASH 1577062 1577062 0 0.0
IRAM 83820 83820 0 0.0
m5stack DRAM 116092 116092 0 0.0
FLASH 1544978 1544978 0 0.0
IRAM 117039 117039 0 0.0
linux air-purifier-app debug unknown 4760 4760 0 0.0
FLASH 2708945 2708945 0 0.0
RAM 132816 132816 0 0.0
all-clusters-app debug unknown 5568 5568 0 0.0
FLASH 5974968 5974968 0 0.0
RAM 531632 531632 0 0.0
all-clusters-minimal-app debug unknown 5464 5464 0 0.0
FLASH 5323654 5323654 0 0.0
RAM 242744 242744 0 0.0
bridge-app debug unknown 5480 5480 0 0.0
FLASH 4681842 4681842 0 0.0
RAM 221480 221480 0 0.0
chip-tool debug unknown 6120 6120 0 0.0
FLASH 13098730 13098730 0 0.0
RAM 596770 596770 0 0.0
chip-tool-ipv6only arm64 unknown 21848 21848 0 0.0
FLASH 11164208 11164208 0 0.0
RAM 648496 648496 0 0.0
fabric-admin debug unknown 5808 5808 0 0.0
FLASH 11388203 11388203 0 0.0
RAM 596554 596554 0 0.0
fabric-bridge-app debug unknown 4736 4736 0 0.0
FLASH 4506440 4506440 0 0.0
RAM 208664 208664 0 0.0
fabric-sync debug unknown 4976 4976 0 0.0
FLASH 5612821 5612821 0 0.0
RAM 483536 483536 0 0.0
lighting-app debug+rpc+ui unknown 6144 6144 0 0.0
FLASH 5624593 5624593 0 0.0
RAM 231760 231760 0 0.0
lock-app debug unknown 5416 5416 0 0.0
FLASH 4730956 4730956 0 0.0
RAM 207728 207728 0 0.0
ota-provider-app debug unknown 4776 4776 0 0.0
FLASH 4359500 4359500 0 0.0
RAM 201368 201368 0 0.0
ota-requestor-app debug unknown 4728 4728 0 0.0
FLASH 4496972 4496972 0 0.0
RAM 205952 205952 0 0.0
shell debug unknown 4256 4256 0 0.0
FLASH 3004877 3004877 0 0.0
RAM 160504 160504 0 0.0
thermostat-no-ble arm64 unknown 9536 9536 0 0.0
FLASH 4098768 4098768 0 0.0
RAM 246144 246144 0 0.0
tv-app debug unknown 5744 5744 0 0.0
FLASH 5952421 5952421 0 0.0
RAM 606936 606936 0 0.0
tv-casting-app debug unknown 5320 5320 0 0.0
FLASH 11272333 11272333 0 0.0
RAM 710896 710896 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 906992 907296 304 0.0
RAM 142395 142403 8 0.0
nrf7002dk_nrf5340_cpuapp FLASH 901532 901532 0 0.0
RAM 124739 124739 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 FLASH 845716 846020 304 0.0
RAM 141323 141331 8 0.0
nxp contact k32w0+release FLASH 584304 584304 0 0.0
RAM 70860 70860 0 0.0
mcxw71+release FLASH 599664 599664 0 0.0
RAM 63080 63080 0 0.0
light k32w0+release FLASH 610748 610748 0 0.0
RAM 70252 70252 0 0.0
k32w1+release FLASH 685208 685208 0 0.0
RAM 48664 48664 0 0.0
lock mcxw71+release FLASH 748680 748680 0 0.0
RAM 67476 67476 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1646356 1646356 0 0.0
RAM 211560 211560 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1553148 1553148 0 0.0
RAM 208376 208376 0 0.0
light cy8ckit_062s2_43012 FLASH 1468828 1468828 0 0.0
RAM 200352 200352 0 0.0
lock cy8ckit_062s2_43012 FLASH 1466860 1466860 0 0.0
RAM 224688 224688 0 0.0
qpg lighting-app qpg6105+debug FLASH 662016 662016 0 0.0
RAM 105204 105204 0 0.0
lock-app qpg6105+debug FLASH 619804 619804 0 0.0
RAM 99648 99648 0 0.0
stm32 light STM32WB5MM-DK FLASH 482624 482624 0 0.0
RAM 144672 144672 0 0.0
telink bridge-app tl7218x FLASH 664774 664774 0 0.0
RAM 90812 90812 0 0.0
contact-sensor-app tlsr9528a_retention FLASH 621532 621532 0 0.0
RAM 31484 31484 0 0.0
light-app-ota-shell-factory-data tl3218x FLASH 770284 770284 0 0.0
RAM 43552 43552 0 0.0
tl7218x FLASH 778816 778816 0 0.0
RAM 98688 98688 0 0.0
light-switch-app-ota-compress-lzma-factory-data tl7218x_retention FLASH 680150 680150 0 0.0
RAM 52176 52176 0 0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 708704 708704 0 0.0
RAM 73384 73384 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 625618 625618 0 0.0
RAM 142016 142016 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 813000 813000 0 0.0
RAM 99560 99560 0 0.0
tizen all-clusters-app arm unknown 5116 5116 0 0.0
FLASH 1751916 1751916 0 0.0
RAM 93524 93524 0 0.0
chip-tool-ubsan arm unknown 11408 11408 0 0.0
FLASH 18698198 18698198 0 0.0
RAM 8183840 8183840 0 0.0

Copy link
Contributor

@LuDuda LuDuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

- Moved the PSA key definitions from CHIPCryptoPALPSA.h file to
the newly created PSAKeyAllocator.

- The new PSAKeyAllocator class allows for the allocation of keys
in secure storage. Users can create their own PSAKeyAllocator
implementation and set it to be used by the Matter stack.

- If the custom implementation is not provided the default one is
used and it works as the legacy solution and the mechanism is
about stored keys in the PSA ITS storage.

Signed-off-by: Arkadiusz Balys <arkadiusz.balys@nordicsemi.no>
The unit test:
- Verifies the defaultKeyAllocator instance, key allocation and
if attributes are ont changed.
- Creates a new testing key allocator and verifies if it works
as expected and differently than the default ones.
- Switches back to the defaultKeyAllocator instance and checks
if code works properly.

Signed-off-by: Arkadiusz Balys <arkadiusz.balys@nordicsemi.no>
Copy link

github-actions bot commented Feb 20, 2025

PR #37332: Size comparison from 5398152 to c09d133

Full report (73 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
platform target config section 5398152 c09d133 change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1095124 1095124 0 0.0
RAM 94802 94802 0 0.0
bl702 lighting-app bl702+eth FLASH 651570 651570 0 0.0
RAM 33509 33509 0 0.0
bl702+wifi FLASH 827734 827734 0 0.0
RAM 22233 22233 0 0.0
bl706+mfd+rpc+littlefs FLASH 1060896 1060896 0 0.0
RAM 32157 32157 0 0.0
bl702l contact-sensor-app bl702l+mfd+littlefs FLASH 892082 892082 0 0.0
RAM 26896 26896 0 0.0
lighting-app bl702l+mfd+littlefs FLASH 974978 974978 0 0.0
RAM 24644 24644 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 815252 815252 0 0.0
RAM 120256 120256 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 824164 824164 0 0.0
RAM 125352 125352 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 771032 771032 0 0.0
RAM 113724 113724 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 755308 755308 0 0.0
RAM 113932 113932 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 538802 538802 0 0.0
RAM 205112 205112 0 0.0
lock CC3235SF_LAUNCHXL FLASH 572950 572950 0 0.0
RAM 205360 205360 0 0.0
cyw30739 light CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 656381 656381 0 0.0
RAM 75324 75324 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 676241 676241 0 0.0
RAM 77964 77964 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 676241 676241 0 0.0
RAM 77964 77964 0 0.0
CYW930739M2EVB-02 unknown 2040 2040 0 0.0
FLASH 633165 633165 0 0.0
RAM 70392 70392 0 0.0
light-switch CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 616245 616245 0 0.0
RAM 71532 71532 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 635881 635881 0 0.0
RAM 74076 74076 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 635881 635881 0 0.0
RAM 74076 74076 0 0.0
lock CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 635741 635741 0 0.0
RAM 74540 74540 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 655457 655457 0 0.0
RAM 77084 77084 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 655457 655457 0 0.0
RAM 77084 77084 0 0.0
thermostat CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 612089 612089 0 0.0
RAM 68628 68628 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 631949 631949 0 0.0
RAM 71268 71268 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 631949 631949 0 0.0
RAM 71268 71268 0 0.0
efr32 lock-app BRD4187C FLASH 937712 937968 256 0.0
RAM 159916 159920 4 0.0
BRD4338a FLASH 731760 731760 0 0.0
RAM 234772 234772 0 0.0
window-app BRD4187C FLASH 1030368 1030688 320 0.0
RAM 128020 128024 4 0.0
esp32 all-clusters-app c3devkit DRAM 97312 97312 0 0.0
FLASH 1581916 1581916 0 0.0
IRAM 83820 83820 0 0.0
m5stack DRAM 116100 116100 0 0.0
FLASH 1549914 1549914 0 0.0
IRAM 117039 117039 0 0.0
linux air-purifier-app debug unknown 4720 4720 0 0.0
FLASH 2649535 2649535 0 0.0
RAM 111088 111088 0 0.0
all-clusters-app debug unknown 5528 5528 0 0.0
FLASH 5921072 5921072 0 0.0
RAM 513712 513712 0 0.0
all-clusters-minimal-app debug unknown 5424 5424 0 0.0
FLASH 5266042 5266042 0 0.0
RAM 221112 221112 0 0.0
bridge-app debug unknown 5440 5440 0 0.0
FLASH 4624718 4624718 0 0.0
RAM 199816 199816 0 0.0
camera-app debug unknown 5424 5424 0 0.0
FLASH 4671498 4671498 0 0.0
RAM 194592 194592 0 0.0
chip-tool debug unknown 6096 6096 0 0.0
FLASH 13300341 13300341 0 0.0
RAM 603392 603392 0 0.0
chip-tool-ipv6only arm64 unknown 21976 21976 0 0.0
FLASH 11321680 11321680 0 0.0
RAM 655184 655184 0 0.0
fabric-admin debug unknown 5784 5784 0 0.0
FLASH 11564903 11564903 0 0.0
RAM 603176 603176 0 0.0
fabric-bridge-app debug unknown 4688 4688 0 0.0
FLASH 4450040 4450040 0 0.0
RAM 187016 187016 0 0.0
fabric-sync debug unknown 4944 4944 0 0.0
FLASH 5568885 5568885 0 0.0
RAM 470400 470400 0 0.0
lighting-app debug+rpc+ui unknown 6152 6152 0 0.0
FLASH 5514129 5514129 0 0.0
RAM 203952 203952 0 0.0
lock-app debug unknown 5392 5392 0 0.0
FLASH 4688154 4688154 0 0.0
RAM 191144 191144 0 0.0
ota-provider-app debug unknown 4728 4728 0 0.0
FLASH 4310334 4310334 0 0.0
RAM 179832 179832 0 0.0
ota-requestor-app debug unknown 4680 4680 0 0.0
FLASH 4440492 4440492 0 0.0
RAM 184320 184320 0 0.0
shell debug unknown 4216 4216 0 0.0
FLASH 2948844 2948844 0 0.0
RAM 143672 143672 0 0.0
thermostat-no-ble arm64 unknown 9448 9448 0 0.0
FLASH 4041864 4041864 0 0.0
RAM 228096 228096 0 0.0
tv-app debug unknown 5720 5720 0 0.0
FLASH 5907797 5907797 0 0.0
RAM 593832 593832 0 0.0
tv-casting-app debug unknown 5296 5296 0 0.0
FLASH 11471181 11471181 0 0.0
RAM 718656 718656 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 907352 907656 304 0.0
RAM 142315 142323 8 0.0
nrf7002dk_nrf5340_cpuapp FLASH 901716 901716 0 0.0
RAM 124663 124663 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 FLASH 845956 846260 304 0.0
RAM 141243 141251 8 0.0
nxp contact k32w0+release FLASH 585168 585168 0 0.0
RAM 70876 70876 0 0.0
mcxw71+release FLASH 600632 600632 0 0.0
RAM 63096 63096 0 0.0
light k32w0+release FLASH 611156 611156 0 0.0
RAM 70164 70164 0 0.0
k32w1+release FLASH 685624 685624 0 0.0
RAM 48584 48584 0 0.0
lock mcxw71+release FLASH 749464 749464 0 0.0
RAM 67500 67500 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1646156 1646156 0 0.0
RAM 211472 211472 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1552908 1552908 0 0.0
RAM 208288 208288 0 0.0
light cy8ckit_062s2_43012 FLASH 1438596 1438596 0 0.0
RAM 197040 197040 0 0.0
lock cy8ckit_062s2_43012 FLASH 1467484 1467484 0 0.0
RAM 224704 224704 0 0.0
qpg lighting-app qpg6105+debug FLASH 662140 662140 0 0.0
RAM 105116 105116 0 0.0
lock-app qpg6105+debug FLASH 620248 620248 0 0.0
RAM 99664 99664 0 0.0
stm32 light STM32WB5MM-DK FLASH 459784 459784 0 0.0
RAM 141472 141472 0 0.0
telink bridge-app tl7218x FLASH 664988 664988 0 0.0
RAM 90728 90728 0 0.0
contact-sensor-app tlsr9528a_retention FLASH 622032 622032 0 0.0
RAM 31488 31488 0 0.0
light-app-ota-shell-factory-data tl3218x FLASH 745172 745172 0 0.0
RAM 40396 40396 0 0.0
tl7218x FLASH 753734 753734 0 0.0
RAM 97540 97540 0 0.0
light-switch-app-ota-compress-lzma-factory-data tl7218x_retention FLASH 680804 680804 0 0.0
RAM 52192 52192 0 0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 709366 709366 0 0.0
RAM 73400 73400 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 600546 600546 0 0.0
RAM 138812 138812 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 788688 788688 0 0.0
RAM 96388 96388 0 0.0
tizen all-clusters-app arm unknown 5076 5076 0 0.0
FLASH 1750632 1750632 0 0.0
RAM 93260 93260 0 0.0
chip-tool-ubsan arm unknown 11492 11492 0 0.0
FLASH 18980782 18980782 0 0.0
RAM 8305600 8305600 0 0.0

@mergify mergify bot merged commit 06edeee into project-chip:master Feb 21, 2025
71 checks passed
* Base of the PSA key identifier range used by Matter.
*
* Cryptographic keys stored in the PSA Internal Trusted Storage must have
* a user-assigned identifer from the range PSA_KEY_ID_USER_MIN to
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

identifer -> identifier

popovdg pushed a commit to popovdg/connectedhomeip that referenced this pull request Feb 25, 2025
* [crypto] Introduce PSAKeyAllocator

- Moved the PSA key definitions from CHIPCryptoPALPSA.h file to
the newly created PSAKeyAllocator.

- The new PSAKeyAllocator class allows for the allocation of keys
in secure storage. Users can create their own PSAKeyAllocator
implementation and set it to be used by the Matter stack.

- If the custom implementation is not provided the default one is
used and it works as the legacy solution and the mechanism is
about stored keys in the PSA ITS storage.

Signed-off-by: Arkadiusz Balys <arkadiusz.balys@nordicsemi.no>

* [crypto] Added a unit test for PSAKeyAllocator

The unit test:
- Verifies the defaultKeyAllocator instance, key allocation and
if attributes are ont changed.
- Creates a new testing key allocator and verifies if it works
as expected and differently than the default ones.
- Switches back to the defaultKeyAllocator instance and checks
if code works properly.

Signed-off-by: Arkadiusz Balys <arkadiusz.balys@nordicsemi.no>

---------

Signed-off-by: Arkadiusz Balys <arkadiusz.balys@nordicsemi.no>
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