From c691e80043d3999719056045ee3c484e1db085c4 Mon Sep 17 00:00:00 2001 From: Amit Sheth Date: Mon, 25 Nov 2024 09:15:24 +0530 Subject: [PATCH] nimble: Copied ble_sm_alg.c from v5.2-rc1 --- nimble/host/src/ble_sm_alg.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nimble/host/src/ble_sm_alg.c b/nimble/host/src/ble_sm_alg.c index 9917bb56c..4e9218dae 100644 --- a/nimble/host/src/ble_sm_alg.c +++ b/nimble/host/src/ble_sm_alg.c @@ -23,6 +23,7 @@ #include "syscfg/syscfg.h" #include "nimble/nimble_opt.h" +#if NIMBLE_BLE_CONNECT #if NIMBLE_BLE_SM #include "nimble/ble.h" @@ -726,7 +727,10 @@ ble_sm_alg_gen_key_pair(uint8_t *pub, uint8_t *priv) return 0; } -#if !(MYNEWT_VAL(BLE_CRYPTO_STACK_MBEDTLS)) +#if MYNEWT_VAL(SELFTEST) +/* Unit tests rely on custom RNG function not being set */ +#define ble_sm_alg_rand NULL +#elif !(MYNEWT_VAL(BLE_CRYPTO_STACK_MBEDTLS)) /* used by uECC to get random data */ static int ble_sm_alg_rand(uint8_t *dst, unsigned int size) @@ -765,3 +769,4 @@ ble_sm_alg_ecc_init(void) #endif #endif +#endif