Modified for BG96
Fork of mbed-dev by
Diff: targets/TARGET_STM/trng_api.c
- Revision:
- 187:0387e8f68319
- Parent:
- 177:d650f5d4c87a
diff -r 707f6e361f3e -r 0387e8f68319 targets/TARGET_STM/trng_api.c --- a/targets/TARGET_STM/trng_api.c Fri Jun 22 16:45:37 2018 +0100 +++ b/targets/TARGET_STM/trng_api.c Thu Sep 06 13:40:20 2018 +0100 @@ -33,7 +33,7 @@ uint32_t dummy; /* We're only supporting a single user of RNG */ - if (core_util_atomic_incr_u8(&users, 1) > 1 ) { + if (core_util_atomic_incr_u8(&users, 1) > 1) { error("Only 1 RNG instance supported\r\n"); } @@ -77,11 +77,11 @@ *output_length = 0; /* Get Random byte */ - while ((*output_length < length) && (ret ==0)) { - if ( HAL_RNG_GenerateRandomNumber(&obj->handle, (uint32_t *)random ) != HAL_OK) { - ret = -1; + while ((*output_length < length) && (ret == 0)) { + if (HAL_RNG_GenerateRandomNumber(&obj->handle, (uint32_t *)random) != HAL_OK) { + ret = -1; } else { - for (uint8_t i =0; (i < 4) && (*output_length < length) ; i++) { + for (uint8_t i = 0; (i < 4) && (*output_length < length) ; i++) { *output++ = random[i]; *output_length += 1; random[i] = 0; @@ -90,11 +90,11 @@ } /* Just be extra sure that we didn't do it wrong */ - if( ( __HAL_RNG_GET_FLAG(&obj->handle, (RNG_FLAG_CECS | RNG_FLAG_SECS)) ) != 0 ) { + if ((__HAL_RNG_GET_FLAG(&obj->handle, (RNG_FLAG_CECS | RNG_FLAG_SECS))) != 0) { ret = -1; } - return( ret ); + return (ret); } #endif