Skip to content

Commit 1bc51d0

Browse files
committed
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.
1 parent 82153e7 commit 1bc51d0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

nimble/host/src/ble_sm_alg.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,10 @@ ble_sm_alg_gen_key_pair(uint8_t *pub, uint8_t *priv)
494494
return 0;
495495
}
496496

497+
#if MYNEWT_VAL(SELFTEST)
498+
/* Unit tests rely on custom RNG function not being set */
499+
#define ble_sm_alg_rand NULL
500+
#else
497501
/* used by uECC to get random data */
498502
static int
499503
ble_sm_alg_rand(uint8_t *dst, unsigned int size)
@@ -519,6 +523,7 @@ ble_sm_alg_rand(uint8_t *dst, unsigned int size)
519523

520524
return 1;
521525
}
526+
#endif
522527

523528
void
524529
ble_sm_alg_ecc_init(void)

0 commit comments

Comments
 (0)