diff --git a/src/rand/relic_rand_call.c b/src/rand/relic_rand_call.c index a7e6e0491..f59236be6 100644 --- a/src/rand/relic_rand_call.c +++ b/src/rand/relic_rand_call.c @@ -77,7 +77,9 @@ void rand_bytes(uint8_t *buf, int size) { ctx_t *ctx = core_get(); ctx->rand_call(buf, size, ctx->rand_args); - rand_check(buf, size); + if (rand_check(buf, size) == RLC_ERR) { + RLC_THROW(ERR_NO_RAND); + } } void rand_seed(void (*callback)(uint8_t *, int, void *), void *args) { diff --git a/src/rand/relic_rand_core.c b/src/rand/relic_rand_core.c index fc025b940..10f8929f8 100644 --- a/src/rand/relic_rand_core.c +++ b/src/rand/relic_rand_core.c @@ -195,7 +195,6 @@ int rand_check(uint8_t *buf, int size) { } if (count > RAND_REP) { - RLC_THROW(ERR_NO_RAND); return RLC_ERR; } return RLC_OK;