You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ja...@apache.org on 2021/02/04 11:07:15 UTC

[mynewt-nimble] branch master updated: nimble/test: Fix LE SC tests

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 1bc51d0  nimble/test: Fix LE SC tests
1bc51d0 is described below

commit 1bc51d028cc843719694232e6f03cc2bce2d0a10
Author: Szymon Janc <sz...@codecoup.pl>
AuthorDate: Mon Feb 1 16:39:02 2021 +0100

    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 148995c..7f5eda6 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)