nimble/ll: Use Mbed-TLS in LL crypto

So far TinyCRYPT library was used in LL crypto but it is no longer
being maintained. This converts code to use Mbed TLS instead.
This commit is contained in:
Szymon Janc
2026-08-12 14:52:20 +05:30
committed by Rahul Tank
parent ea00a45789
commit 24e81e1627
3 changed files with 7 additions and 22 deletions
+1 -8
View File
@@ -38,18 +38,11 @@ pkg.req_apis.BLE_FEM_ANTENNA:
pkg.deps:
- "@apache-mynewt-core/kernel/os"
- "@apache-mynewt-core/crypto/tinycrypt"
- "@apache-mynewt-core/crypto/mbedtls"
- nimble
- nimble/transport
pkg.deps.TEST:
- "@apache-mynewt-core/crypto/mbedtls"
pkg.init:
ble_ll_init:
- $before:ble_transport_hs_init
- $before:ble_transport_ll_init
pkg.cflags.TEST:
- -Irepos/mbedtls/include
- -Irepos/include/mbedtls
+3 -14
View File
@@ -21,25 +21,14 @@
#include <nimble/ble.h>
#include <controller/ble_ll_crypto.h>
#include <controller/ble_hw.h>
#include <tinycrypt/constants.h>
#include <tinycrypt/cmac_mode.h>
#include <mbedtls/cmac.h>
int
ble_ll_crypto_cmac(const uint8_t *key, const uint8_t *in, int len,
uint8_t *out)
{
struct tc_aes_key_sched_struct sched;
struct tc_cmac_struct state;
if (tc_cmac_setup(&state, key, &sched) == TC_CRYPTO_FAIL) {
return -1;
}
if (tc_cmac_update(&state, in, len) == TC_CRYPTO_FAIL) {
return -1;
}
if (tc_cmac_final(out, &state) == TC_CRYPTO_FAIL) {
if (mbedtls_cipher_cmac(mbedtls_cipher_info_from_type(MBEDTLS_CIPHER_AES_128_ECB),
key, 128, in, len, out)) {
return -1;
}
+3
View File
@@ -685,6 +685,9 @@ syscfg.vals.BLE_LL_ISO_BROADCASTER:
syscfg.vals.'!BLE_HOST && !BABBLESIM':
BLE_LL_HCI_VS_EVENT_ON_ASSERT: 1
syscfg.vals:
MBEDTLS_CMAC_C: 1
syscfg.restrictions:
- BLE_TRANSPORT_LL == "native"
- BLE_LL_PUBLIC_DEV_ADDR <= 0xffffffffffff