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

Bluetooth: Mesh: no more tinycrypt in ble mesh tfm images #64696

Merged

Conversation

alxelax
Copy link
Collaborator

@alxelax alxelax commented Nov 1, 2023

PR allows to get rid of tinycrypt objects from
the final binary of the ble mesh apps based on
PSA TFM crypto.

Final size of mesh app for nrf5340dk_nrf5340_cpuapp_ns (that is build with TFM PSA crypto)

Memory region         Used Size  Region Size  %age Used
           FLASH:      120936 B       192 KB     61.51%
             RAM:       35350 B       192 KB     17.98%
        IDT_LIST:          0 GB         2 KB      0.00%

without these changes tinycrypt sneaks into it

Memory region         Used Size  Region Size  %age Used
           FLASH:      126120 B       192 KB     64.15%
             RAM:       37294 B       192 KB     18.97%
        IDT_LIST:          0 GB         2 KB      0.00%

some bsim tests fixes due to collisions after timing changes.

subsys/bluetooth/host/Kconfig Outdated Show resolved Hide resolved
@alxelax alxelax force-pushed the no_more_tinycrypt_in_tfm_image branch from 1020f28 to 27c1fc0 Compare November 2, 2023 10:11
akredalen
akredalen previously approved these changes Nov 2, 2023
# The option adds TinyCrypt based bt_rand.
CONFIG_BT_HOST_CRYPTO=n
# The option adds GATT caching feature that is based on TinyCrypt.
CONFIG_BT_GATT_CACHING=n
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we create an issue to host to support GATT Caching without using Tinycrypt? Not sure how much customers need this feature, but if so, they will get Tinycrypt back in their firmwares if they enable this option.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I guess this is not sufficient. Host also supports ecc, aes ccm and randomization with tinycrypt. Host requires significant refactoring to get rid of tinycrypt. This is quite huge work that we've already done for mesh.

help
The option adds the AES encryption support using TinyCrypt
library if this is not provided by the controller implementation.
The option is not required if BLE Mesh is enabled and
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure if mesh should be mentioned here. What about bt_encrypt_le and bt_encrypt_be functions? They aren't replaced when mesh is enabled with PSA support. This options still needs to be enabled if a customer wants to enable SMP (Security Manager Protocol, not SMP from MCUmgr).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Mesh doesn't use them. Yes, if customer adds anything that uses them, tinycrypt will appear again. I guess there is no common strategy to get rid tinycrypt in Zephyr in general.

PR allows to get rid of tinycrypt objects from
the final binary of the ble mesh apps based on
PSA TFM crypto.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
The current main stack size is not enough for any platform.
This commit stack size was checked for nrf52840 and nrf5340.
Everything works.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
@fabiobaltieri fabiobaltieri merged commit 7a32e1d into zephyrproject-rtos:main Nov 8, 2023
21 checks passed
@alxelax alxelax deleted the no_more_tinycrypt_in_tfm_image branch November 8, 2023 15:11
alxelax added a commit to alxelax/sdk-zephyr that referenced this pull request Nov 9, 2023
PR allows to get rid of tinycrypt objects from
the final binary of the ble mesh apps based on
PSA TFM crypto.

Upstream PR: zephyrproject-rtos/zephyr#64696
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
(cherry picked from commit c5ee143)
nordicjm pushed a commit to nrfconnect/sdk-zephyr that referenced this pull request Nov 13, 2023
PR allows to get rid of tinycrypt objects from
the final binary of the ble mesh apps based on
PSA TFM crypto.

Upstream PR: zephyrproject-rtos/zephyr#64696
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
(cherry picked from commit c5ee143)
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