Improve the usage of uECC_RNG_Function
Since the mbed TLS implementation of rng wrapper returns the size of random
data generated upon success - check for it explicitly.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
diff --git a/tinycrypt/ecc.c b/tinycrypt/ecc.c
index b3e3ed3..57b3228 100644
--- a/tinycrypt/ecc.c
+++ b/tinycrypt/ecc.c
@@ -1169,7 +1169,7 @@
}
for (tries = 0; tries < uECC_RNG_MAX_TRIES; ++tries) {
- if (!g_rng_function((uint8_t *)random, num_words * uECC_WORD_SIZE)) {
+ if (g_rng_function((uint8_t *)random, num_words * uECC_WORD_SIZE) != num_words * uECC_WORD_SIZE) {
return 0;
}
random[num_words - 1] &=