-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
TinyCrypt deprecation - library's usage removal part 2 (bluetooth) #79931
base: main
Are you sure you want to change the base?
TinyCrypt deprecation - library's usage removal part 2 (bluetooth) #79931
Conversation
9f3f671
to
98b97ea
Compare
946f924
to
c9cf39d
Compare
Any chance this will be ready for Zephyr 4.0? |
As far as I know codefreeze is today for 4.0 and I still need to resolve some failures in this PR + it also depends on 2 other PRs which should be merged before this one. I'm sorry but I think the answer is "no" |
cf8d840
to
91c5e79
Compare
@valeriosetti , do we need both Part 1 and Part 2 to be merged into 4.0. |
The challenge as I see it is this part from https://docs.zephyrproject.org/latest/develop/api/api_lifecycle.html#deprecated
Which means that we can't make a release and still have code in the upstream tree using a deprecated API. |
While part 1 is ready to be merged, part 2 absolutely not:
That's what I thought at the beginning of this activity as well, but then I've been asked to keep the following support for TinyCrypt in the codebase for at least the next 2 releases:
I'm not an expert of BT, but based on the number of changes I've done so far in this PR to make the CI happy, it seems that BT is way more affected by TinyCrypt removal than other subsystems. So I agree with @alxelax that giving the user some time to deal with TinyCrypt deprecation wouldn't be that bad. But this is my feeling, of course, so I'll be glad to hear what's reviewers opinion about this :) |
As part of the deprecation process of TinyCrypt in Zephyr codebase (zephyrproject-rtos#79566) this commit sets PSA Crypto API as the default library to perform ECC-DH in HCI, replacing TinyCrypt. Therefore the symbol BT_TINYCRYPT_ECC is renamed as BT_SEND_ECC_EMULATION. Rreference in samples/tests are also fixed. Signed-off-by: Valerio Setti <[email protected]>
As part of the deprecation process of TinyCrypt in Zephyr codebase (zephyrproject-rtos#79566) this commit removes TinyCrypt usage from BT mesh and also the related CONFIG_BT_MESH_USES_TINYCRYPT symbol and it sets PSA Crypto APIs as the default library for crypto operations. Tests are also updated in this commit. Signed-off-by: Valerio Setti <[email protected]>
As part of the deprecation process of TinyCrypt in Zephyr codebase (zephyrproject-rtos#79566) this commit modified the dependencies of BT_RPA. Instead of selecting TinyCrypt, it relies on BT_HOST_CRYPTO or BT_CTLR_CRYPTO. This helps both in the deprecation process of TinyCrypt, but also this is more correct dependency since these 2 symbols are extensively used in the rpa.c source code. Signed-off-by: Valerio Setti <[email protected]>
1df8c41
to
245504d
Compare
No objection from me. I'll review this and the other needed PRs today. |
As part of the work of deprecating TinyCrypt in favor of PSA crypto API, this commit fixes some kconfigs in order to reduce the RAM footprint. In all involved samples RAM usage was extremely high even with TinyCrypt (usually > 98%) and of course it got overflowed once TinyCrypt got replaced by Mbed TLS's PSA Crypto API. Signed-off-by: Valerio Setti <[email protected]>
Replace all references to TinyCrypt with PSA Crypto API in BT unit tests. Signed-off-by: Valerio Setti <[email protected]>
Comment out "Execute_AC_14 32_2_1" in "cap_broadcast_ac_14.sh" because it's failing. The reason seems to be related to some timing issue, but it has not be correctly identified yet. We comment it out for the sake of not delaying upcoming PRs. It will be re-enabled once the proper solution is found. Signed-off-by: Valerio Setti <[email protected]>
Include Mbed TLS headers to the build system. This is required because these tests do not follow the "standard build pattern" of Mbed TLS in Zephyr, otherwise include files would be already available after the library has been linked. In these examples some BT source files and Kconfigs are manually added to the CmakeLists.txt file bypassing the standard library build pattern, so Mbed TLS headers must also be added manually. Signed-off-by: Valerio Setti <[email protected]>
select BT_HOST_CCM | ||
help | ||
Use TinyCrypt library to perform crypto operations. | ||
|
||
config BT_MESH_USES_MBEDTLS_PSA |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix help
description. This is not relevant anymore.
config BT_MESH_USES_MBEDTLS_PSA | ||
bool "mbed TLS PSA [EXPERIMENTAL]" | ||
select EXPERIMENTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did anybody run mesh with mbedtls on real devices?
Also, to remove experimental tag bsim should use pure mbedtls without its emulation.
It looks to me like, nobody run mesh with mbedtls PSA without technological stubs, but EXPERIMENTAL tag is removed.
Kind of disagree with this.
help | ||
Crypto library selection for mesh security. | ||
|
||
config BT_MESH_USES_TINYCRYPT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this should be moved back and marked as [DEPRECATED]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, and a release notes should be added that this option is deprecated.
245504d
to
b77eb6d
Compare
b77eb6d
to
629d951
Compare
Increase the number of key slots in the PSA Crypto core for some tests using more keys than the default (16). Signed-off-by: Valerio Setti <[email protected]>
d58375b
to
41cf00c
Compare
Moving from TinyCrypt to PSA Crypto API caused an entropy source to be always required, so this commit adds it in tests where necessary. Signed-off-by: Valerio Setti <[email protected]>
41cf00c
to
3933503
Compare
This reverts commit 5e225e0. Based on zephyrproject-rtos#79931 and TSC discussions, it was decided that TinyCrypt will be deprecated *AFTER* 4.0. Signed-off-by: Flavio Ceolin <[email protected]>
This is the second step toward the removal of TinyCrypt library usage from the Zephyr's codebase. This is the continuation of #79566 and #79653.
In particular this PR takes care of removing TinyCrypt usage from the bluetooth subsystem.
Important note
Some commits are taken from the following PRs (i.e. this PR depends on):
CONFIG_MBEDTLS_PSA_KEY_SLOT_COUNT
to limit the number of key slots in PSA core and therefore reduce RAM footprintTo be done
tests/bsim/bluetooth/audio/test_scripts/cap_broadcast_ac_14.sh