mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-16 20:08:07 +00:00
fix for *BSD: remove all HAVE_ARC4RANDOM dependencies
This commit is contained in:
@ -524,9 +524,7 @@ typedef struct afl_state {
|
||||
u64 stage_finds[32], /* Patterns found per fuzz stage */
|
||||
stage_cycles[32]; /* Execs per fuzz stage */
|
||||
|
||||
//#ifndef HAVE_ARC4RANDOM
|
||||
u32 rand_cnt; /* Random number counter */
|
||||
//#endif
|
||||
|
||||
u64 rand_seed[4];
|
||||
s64 init_seed;
|
||||
@ -958,13 +956,8 @@ uint64_t rand_next(afl_state_t *afl);
|
||||
|
||||
static inline u32 rand_below(afl_state_t *afl, u32 limit) {
|
||||
|
||||
//#ifdef HAVE_ARC4RANDOM
|
||||
// if (unlikely(afl->fixed_seed)) { return random() % limit; }
|
||||
|
||||
/* The boundary not being necessarily a power of 2,
|
||||
we need to ensure the result uniformity. */
|
||||
// return arc4random_uniform(limit);
|
||||
//#else
|
||||
if (unlikely(!afl->rand_cnt--) && likely(!afl->fixed_seed)) {
|
||||
|
||||
ck_read(afl->fsrv.dev_urandom_fd, &afl->rand_seed, sizeof(afl->rand_seed),
|
||||
@ -974,9 +967,7 @@ static inline u32 rand_below(afl_state_t *afl, u32 limit) {
|
||||
|
||||
}
|
||||
|
||||
// return random() % limit;
|
||||
return rand_next(afl) % limit;
|
||||
//#endif
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user