This is an automated email from the ASF dual-hosted git repository.

sjanc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit 21b332153238b560c9305ccfa21c580cb2475c1d
Author: Szymon Janc <[email protected]>
AuthorDate: Wed May 27 10:37:52 2026 +0200

    nimble/phy/cmac: Use Mbed-TLS for AES
    
    So far TinyCRYPT library was used but it is no longer being
    maintained. This converts code to use Mbed TLS instead.
---
 nimble/drivers/dialog_cmac/pkg.yml      | 2 +-
 nimble/drivers/dialog_cmac/src/ble_hw.c | 9 +++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/nimble/drivers/dialog_cmac/pkg.yml 
b/nimble/drivers/dialog_cmac/pkg.yml
index 9cf63ffcf..d62a483d2 100644
--- a/nimble/drivers/dialog_cmac/pkg.yml
+++ b/nimble/drivers/dialog_cmac/pkg.yml
@@ -26,7 +26,7 @@ pkg.keywords:
     - bluetooth
 pkg.deps:
     - "@apache-mynewt-nimble/nimble/controller"
-    - "@apache-mynewt-core/crypto/tinycrypt"
+    - "@apache-mynewt-core/crypto/mbedtls"
 pkg.apis:
     - ble_driver
 pkg.req_apis:
diff --git a/nimble/drivers/dialog_cmac/src/ble_hw.c 
b/nimble/drivers/dialog_cmac/src/ble_hw.c
index 195dcd35d..daac2cab8 100644
--- a/nimble/drivers/dialog_cmac/src/ble_hw.c
+++ b/nimble/drivers/dialog_cmac/src/ble_hw.c
@@ -24,9 +24,9 @@
 #include "controller/ble_hw.h"
 #include "CMAC.h"
 #include <ipc_cmac/rand.h>
-#include "tinycrypt/aes.h"
+#include <mbedtls/aes.h>
 
-static struct tc_aes_key_sched_struct g_ctx;
+static mbedtls_aes_context g_ctx;
 
 int
 ble_hw_rng_init(ble_rng_isr_cb_t cb, int bias)
@@ -153,8 +153,9 @@ ble_hw_encrypt_block(struct ble_encryption_block *ecb)
      * If so, we use the M0 crypto block. If outside of an ISR, we use the M33
      */
     if (!os_arch_in_isr()) {
-        tc_aes128_set_encrypt_key(&g_ctx, ecb->key);
-        tc_aes_encrypt(ecb->cipher_text, ecb->plain_text, &g_ctx);
+        mbedtls_aes_setkey_enc(&g_ctx, ecb->key, 128);
+        mbedtls_aes_crypt_ecb(&g_ctx, MBEDTLS_AES_ENCRYPT, ecb->plain_text,
+                              ecb->cipher_text);
         return 0;
     }
 

Reply via email to