-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
19992: sys/psa_crypto: Fix build problems r=MrKevinWeiss a=Einhornhool ### Contribution description This fixes several problems: #### 1. Empty union in cipher context when `MODULE_PSA_CIPHER` is not selected. PSA operations are now separated into modules. Functions and contexts are only built when the corresponding module is selected. This way there won't be problems with missing or unitialized structures in unused modules anymore. #### 2. Zero-size array when using secure elements and `PSA_MAX_KEY_DATA_SIZE == 0` I added a condition to the `psa_key_slot_t` structure in `psa_key_slot_management.h`. Also the existence of key slot management functions and key slot structures now depends on the number of allocated key slots instead of selected modules. This way key structures will not exist unless they are used. ### Testing procedure Add the following to `examples/hello_world/Makefile` and call make : ``` USEMODULE += psa_crypto USEMODULE += psa_hash USEMODULE += psa_hash_sha_256 USEMODULE += psa_secure_element ``` Output on Master: ``` "make" -C /home/lena/work/RIOT/boards/common/init "make" -C /home/lena/work/RIOT/boards/native "make" -C /home/lena/work/RIOT/boards/native/drivers "make" -C /home/lena/work/RIOT/core "make" -C /home/lena/work/RIOT/core/lib "make" -C /home/lena/work/RIOT/cpu/native "make" -C /home/lena/work/RIOT/cpu/native/periph "make" -C /home/lena/work/RIOT/cpu/native/stdio_native "make" -C /home/lena/work/RIOT/drivers "make" -C /home/lena/work/RIOT/drivers/periph_common "make" -C /home/lena/work/RIOT/sys "make" -C /home/lena/work/RIOT/sys/auto_init "make" -C /home/lena/work/RIOT/sys/libc "make" -C /home/lena/work/RIOT/sys/luid "make" -C /home/lena/work/RIOT/sys/preprocessor "make" -C /home/lena/work/RIOT/sys/psa_crypto In file included from /home/lena/work/RIOT/sys/include/psa_crypto/psa/crypto.h:39, from /home/lena/work/RIOT/sys/psa_crypto/psa_crypto_algorithm_dispatch.c:23: /home/lena/work/RIOT/sys/include/psa_crypto/psa/crypto_struct.h:137:11: error: union has no members [-Werror=pedantic] 137 | union cipher_context { | ^~~~~~~~~~~~~~ In file included from /home/lena/work/RIOT/sys/psa_crypto/include/psa_crypto_operation_encoder.h:32, from /home/lena/work/RIOT/sys/psa_crypto/psa_crypto_algorithm_dispatch.c:28: /home/lena/work/RIOT/sys/psa_crypto/include/psa_crypto_slot_management.h:82:17: error: ISO C forbids zero-size array ‘data’ [-Werror=pedantic] 82 | uint8_t data[PSA_MAX_KEY_DATA_SIZE]; /**< Key data buffer */ | ^~~~ cc1: all warnings being treated as errors make[3]: *** [/home/lena/work/RIOT/Makefile.base:146: /home/lena/work/RIOT/examples/hello-world/bin/native/psa_crypto/psa_crypto_algorithm_dispatch.o] Error 1 make[2]: *** [/home/lena/work/RIOT/Makefile.base:31: ALL--/home/lena/work/RIOT/sys/psa_crypto] Error 2 make[1]: *** [/home/lena/work/RIOT/Makefile.base:31: ALL--/home/lena/work/RIOT/sys] Error 2 make: *** [/home/lena/work/RIOT/examples/hello-world/../../Makefile.include:761: application_hello-world.module] Error 2 ``` Output with fixes: ``` "make" -C /home/lena/work/RIOT/boards/common/init "make" -C /home/lena/work/RIOT/boards/native "make" -C /home/lena/work/RIOT/boards/native/drivers "make" -C /home/lena/work/RIOT/core "make" -C /home/lena/work/RIOT/core/lib "make" -C /home/lena/work/RIOT/cpu/native "make" -C /home/lena/work/RIOT/cpu/native/periph "make" -C /home/lena/work/RIOT/cpu/native/stdio_native "make" -C /home/lena/work/RIOT/drivers "make" -C /home/lena/work/RIOT/drivers/periph_common "make" -C /home/lena/work/RIOT/sys "make" -C /home/lena/work/RIOT/sys/auto_init "make" -C /home/lena/work/RIOT/sys/libc "make" -C /home/lena/work/RIOT/sys/luid "make" -C /home/lena/work/RIOT/sys/preprocessor "make" -C /home/lena/work/RIOT/sys/psa_crypto "make" -C /home/lena/work/RIOT/sys/psa_crypto/psa_key_slot_mgmt "make" -C /home/lena/work/RIOT/sys/psa_crypto/psa_se_mgmt "make" -C /home/lena/work/RIOT/sys/random /usr/bin/ld: warning: /home/lena/work/RIOT/examples/hello-world/bin/native/hello-world.elf has a LOAD segment with RWX permissions text data bss dec hex filename 29764 584 47856 78204 1317c /home/lena/work/RIOT/examples/hello-world/bin/native/hello-world.elf ``` 20042: dist/tools/uf2: add target to also copy families.json file r=MrKevinWeiss a=MichelRottleuthner ### Contribution description The updated UF2 pkg (#20035) stores the family ID in an external .json file. I overlooked that and flashing fails if this file is not present. This PR fixes it by also copying the json into the tool folder. ### Testing procedure Check if the `feather-nrf52840-sense` can be flashed when the new UF2 pkg is cloned freshly. ### Issues/PRs references Fixes a regression introduced with #20035 Co-authored-by: Lena Boeckmann <lena.boeckmann@haw-hamburg.de> Co-authored-by: Michel Rottleuthner <michel.rottleuthner@haw-hamburg.de>
- Loading branch information
Showing
90 changed files
with
809 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
CONFIG_MODULE_PSA_SECURE_ELEMENT=y | ||
CONFIG_MODULE_PSA_SECURE_ELEMENT_ATECCX08A=y | ||
CONFIG_MODULE_PSA_SECURE_ELEMENT_ATECCX08A_ECC_P256=y | ||
CONFIG_MODULE_PSA_SECURE_ELEMENT_ATECCX08A_CIPHER_AES_128=y | ||
CONFIG_MODULE_PSA_SECURE_ELEMENT_ATECCX08A_HMAC_SHA256=y | ||
|
||
CONFIG_PSA_PROTECTED_KEY_COUNT=4 | ||
CONFIG_PSA_SINGLE_KEY_COUNT=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.