From 1bc51d028cc843719694232e6f03cc2bce2d0a10 Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Mon, 1 Feb 2021 16:39:02 +0100 Subject: [PATCH] nimble/test: Fix LE SC tests Some LE SC tests depend on known initial values on crypto side. With latest update to TinyCrypt provided prng function is used also for initial seeding and thus tests were failing. To keep things simple just don't initialize random source function when doign unit tests. --- nimble/host/src/ble_sm_alg.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nimble/host/src/ble_sm_alg.c b/nimble/host/src/ble_sm_alg.c index 148995c8b..7f5eda61c 100644 --- a/nimble/host/src/ble_sm_alg.c +++ b/nimble/host/src/ble_sm_alg.c @@ -494,6 +494,10 @@ ble_sm_alg_gen_key_pair(uint8_t *pub, uint8_t *priv) return 0; } +#if MYNEWT_VAL(SELFTEST) +/* Unit tests rely on custom RNG function not being set */ +#define ble_sm_alg_rand NULL +#else /* used by uECC to get random data */ static int ble_sm_alg_rand(uint8_t *dst, unsigned int size) @@ -519,6 +523,7 @@ ble_sm_alg_rand(uint8_t *dst, unsigned int size) return 1; } +#endif void ble_sm_alg_ecc_init(void)