Skip to content

Commit d834ca4

Browse files
committed
Better place for exception throwing.
1 parent 6d28711 commit d834ca4

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/rand/relic_rand_call.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ void rand_bytes(uint8_t *buf, int size) {
7777
ctx_t *ctx = core_get();
7878

7979
ctx->rand_call(buf, size, ctx->rand_args);
80-
rand_check(buf, size);
80+
if (rand_check(buf, size) == RLC_ERR) {
81+
RLC_THROW(ERR_NO_RAND);
82+
}
8183
}
8284

8385
void rand_seed(void (*callback)(uint8_t *, int, void *), void *args) {

src/rand/relic_rand_core.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ int rand_check(uint8_t *buf, int size) {
195195
}
196196

197197
if (count > RAND_REP) {
198-
RLC_THROW(ERR_NO_RAND);
199198
return RLC_ERR;
200199
}
201200
return RLC_OK;

0 commit comments

Comments
 (0)