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: Controller: Deprecate tinycrypt part2 (testing) #81221

Draft
wants to merge 28 commits into
base: main
Choose a base branch
from

Conversation

cvinayak
Copy link
Contributor

Deprecate tinycrypt part2

@zephyrbot
Copy link
Collaborator

The following west manifest projects have been modified in this Pull Request:

Name Old Revision New Revision Diff
mbedtls zephyrproject-rtos/mbedtls@a78176c (zephyr) zephyrproject-rtos/mbedtls#64 zephyrproject-rtos/mbedtls#64/files

Note: This message is automatically posted and updated by the Manifest GitHub Action.

@zephyrbot zephyrbot added manifest manifest-mbedtls DNM This PR should not be merged (Do Not Merge) labels Nov 11, 2024
cvinayak and others added 26 commits November 14, 2024 08:21
Fix to reschedule before overlap and be collision resolved
in the next periodic interval for tickers using slot window
yield.

Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
Introduce ticker reschedule with drift so that role like
AUX_ADV_IND can start after overlapping states and roles
using time reservations.

Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
Add implementation for Extended Advertising Auxiliary PDUs
to use ticks slot window feature.

This will allow the periodic scheduling of AUX_ADV_IND PDUs
to drift upto 10 ms advertising delay minus the ticks_slot
time reservation of the AUX_ADV_IND PDU when overlapping
with other states/roles that cannot be moved around, to
avoid skipping them.

Having an active Extended Advertising simultaneously with
an ISO Synchronized Receiver or Connected ISO connection
will now have less ISO SDU loss when using 10 ms ISO
intervals.

Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
Fix ISO Sync Receiver implementation to correctly reflect
the payload number and timestamp.

Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
Fix ISO Sync Receiver time reservation calculation to use
peer broadcasted bis_spacing and sub_interval, instead of
incorrectly calculating using local implementation used
tMSS value.

Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
Fix ISO Sync Receiver implementation to correctly prevent
subevent from pre-empted in the unreserve time space.

Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
Several tests were using K_FOREVER when allocating the
buffer for TX in the system workqueue, which is illegal behavior.

The solution chosen was to create a TX thread to handle TX,
similar to the solution used in the audio shell and some
sample applications.

This way we can continue to use K_FOREVER when allocting buffers
and it will always be done in a round-robin fashion while
TXing as much as possible, by always enqueuing all the buffers
with mock data.

Since this works for all streams (both broadcast and unicast),
it was obvious to use the same implementation for all tests,
and thus cleaning up the tests a bit and more them more similar.

Signed-off-by: Emil Gydesen <[email protected]>
Remove a duplicated advertising set in the CAP acceptor babblesim
test. The advertising set is configured in test_start_adv.

Signed-off-by: Emil Gydesen <[email protected]>
The BSIM test for the CAP acceptor used legacy instead
of extended advertising.

This also adds the required advertising data and validation
on the CAP initiator and CAP commander.

Signed-off-by: Emil Gydesen <[email protected]>
Align audio test Controller Kconfig value same as used with
nRF53bsim.

Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
Enable some high reliability CAP tests by increasing ISO Tx
buffer counts in the Controller to sufficiently generate
number of complete when multiple SDUs are transmitted in
single ISO interval with use of pre-transmissions.

Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
Squash of commits from PR 80136

Signed-off-by: Valerio Setti <[email protected]>
Squash of commits from PR 80368

Signed-off-by: Valerio Setti <[email protected]>
Increase timeout between procedures in access_tx_transmitt test to avoid
packet loss.

Signed-off-by: Pavel Vasilyev <[email protected]>
As part of the deprecation process of TinyCrypt in Zephyr codebase
(zephyrproject-rtos#79566) this commit removes CONFIG_BT_USE_PSA_API symbol. This
was used in BT crypto/host modules to select PSA crypto API over
TinyCrypt (which was the default until now). Since TinyCrypt is
removed and PSA crypto API is the new standard library for crypto
operations, CONFIG_BT_USE_PSA_API is no more needed.

Signed-off-by: Valerio Setti <[email protected]>
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]>
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]>
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]>
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]>
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]>
BT uses PSA Crypto API to perform crypto operations and, on this
platform, these APIs are implemented through Mbed TLS. In order
to properly initialize this library, a random number generator
is required. Since this platform does not have a true random
number generator, we enable the test one. This holds only
when BT is enabled, of course.

Signed-off-by: Valerio Setti <[email protected]>
The tests were using the default of 1 which is very low,
especially when we might have multiple RX streams.

Signed-off-by: Emil Gydesen <[email protected]>
On platforms like nrf5340 there are 2 CPUs:
- one is the cpu_net which takes care of the radio stuff and
  owns the HW random generator
- one is the cpu_app which holds application data and polls
  cpu_net through HCI commands when it needs some random data.

The PSA core implemented in Mbed TLS needs random data at initialization
time, which happens early in the boot process. If we wait for BT to
be ready before issuing the HCI command, then PSA core intialization
will fail. In facts there is no need for the BT to be completely
initialized just to ask for some random data from the cpu_app to
the cpu_net since the HW random generator will likely be already
functional in the cpu_net.
So let's just try the HCI command and, if something is not right,
it will fail anyway. There's no need to anticipate the failure.

Signed-off-by: Valerio Setti <[email protected]>
On the native_sim platform, BT relies on Mbed TLS to implement
PSA Crypto API. This library requires a valid entropy source
to initialize properly. Therefore we enable ENTROPY_GENERATOR
at board level instead of editing _all_ the samples/tests
configuration files to make a more compact change.

Signed-off-by: Valerio Setti <[email protected]>
Increase test and main stack sizes for the qemu_cortex_m3 platform
in order to be able to successfully run the test.

Signed-off-by: Valerio Setti <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DNM This PR should not be merged (Do Not Merge) manifest manifest-mbedtls
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants