This is an automated email from the ASF dual-hosted git repository. hauke 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 80b6f20f controller: use OS specific PRNG for RIOT builds 80b6f20f is described below commit 80b6f20f988e3cd0a076031fafc456724d62904b Author: Hauke Petersen <hauke.peter...@fu-berlin.de> AuthorDate: Tue Jun 7 15:03:28 2022 +0200 controller: use OS specific PRNG for RIOT builds Currently the controller is using jrand48() to generate pseudo random numbers. For RIOT builds this commit switches to the RIOT build-in PRNG API, as this has two benefits: i) it saves 500bytes of flash and ii) jrand48() internally uses malloc, which has been source to runtime failures in the past. --- nimble/controller/src/ble_ll_rand.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nimble/controller/src/ble_ll_rand.c b/nimble/controller/src/ble_ll_rand.c index 06e5d12b..fc7febcf 100644 --- a/nimble/controller/src/ble_ll_rand.c +++ b/nimble/controller/src/ble_ll_rand.c @@ -33,6 +33,10 @@ #include "trng/trng.h" #endif +#ifdef RIOT_VERSION +#include "random.h" +#endif + #if BABBLESIM extern void tm_tick(void); #endif @@ -134,6 +138,7 @@ ble_ll_rand_data_get(uint8_t *buf, uint8_t len) uint32_t ble_ll_rand(void) { +#ifndef RIOT_VERSION static unsigned short xsubi[3]; static bool init = true; @@ -143,6 +148,9 @@ ble_ll_rand(void) } return (uint32_t) jrand48(xsubi); +#else + return random_uint32(); +#endif } /**