mirror of
https://github.com/cuberite/libevent.git
synced 2025-08-05 10:16:08 -04:00
Remove needless check for arc4_seeded_ok
(cherry picked from commit 16a151df5c59c0539d06465172742cc50751ea77)
This commit is contained in:
parent
5e39750de8
commit
6602a97d7d
@ -89,7 +89,6 @@ static int rs_initialized;
|
|||||||
static struct arc4_stream rs;
|
static struct arc4_stream rs;
|
||||||
static pid_t arc4_stir_pid;
|
static pid_t arc4_stir_pid;
|
||||||
static int arc4_count;
|
static int arc4_count;
|
||||||
static int arc4_seeded_ok;
|
|
||||||
|
|
||||||
static inline unsigned char arc4_getbyte(void);
|
static inline unsigned char arc4_getbyte(void);
|
||||||
|
|
||||||
@ -163,7 +162,6 @@ arc4_seed_win32(void)
|
|||||||
return -1;
|
return -1;
|
||||||
arc4_addrandom(buf, sizeof(buf));
|
arc4_addrandom(buf, sizeof(buf));
|
||||||
evutil_memclear_(buf, sizeof(buf));
|
evutil_memclear_(buf, sizeof(buf));
|
||||||
arc4_seeded_ok = 1;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -201,7 +199,6 @@ arc4_seed_sysctl_linux(void)
|
|||||||
|
|
||||||
arc4_addrandom(buf, sizeof(buf));
|
arc4_addrandom(buf, sizeof(buf));
|
||||||
evutil_memclear_(buf, sizeof(buf));
|
evutil_memclear_(buf, sizeof(buf));
|
||||||
arc4_seeded_ok = 1;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -241,7 +238,6 @@ arc4_seed_sysctl_bsd(void)
|
|||||||
|
|
||||||
arc4_addrandom(buf, sizeof(buf));
|
arc4_addrandom(buf, sizeof(buf));
|
||||||
evutil_memclear_(buf, sizeof(buf));
|
evutil_memclear_(buf, sizeof(buf));
|
||||||
arc4_seeded_ok = 1;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -287,7 +283,6 @@ arc4_seed_proc_sys_kernel_random_uuid(void)
|
|||||||
}
|
}
|
||||||
evutil_memclear_(entropy, sizeof(entropy));
|
evutil_memclear_(entropy, sizeof(entropy));
|
||||||
evutil_memclear_(buf, sizeof(buf));
|
evutil_memclear_(buf, sizeof(buf));
|
||||||
arc4_seeded_ok = 1;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -311,7 +306,6 @@ static int arc4_seed_urandom_helper_(const char *fname)
|
|||||||
return -1;
|
return -1;
|
||||||
arc4_addrandom(buf, sizeof(buf));
|
arc4_addrandom(buf, sizeof(buf));
|
||||||
evutil_memclear_(buf, sizeof(buf));
|
evutil_memclear_(buf, sizeof(buf));
|
||||||
arc4_seeded_ok = 1;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -382,9 +376,6 @@ arc4_stir(void)
|
|||||||
if (0 != arc4_seed())
|
if (0 != arc4_seed())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!arc4_seeded_ok)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Discard early keystream, as per recommendations in
|
* Discard early keystream, as per recommendations in
|
||||||
* "Weaknesses in the Key Scheduling Algorithm of RC4" by
|
* "Weaknesses in the Key Scheduling Algorithm of RC4" by
|
||||||
|
@ -171,9 +171,7 @@ evutil_secure_rng_init(void)
|
|||||||
int val;
|
int val;
|
||||||
|
|
||||||
ARC4_LOCK_();
|
ARC4_LOCK_();
|
||||||
if (!arc4_seeded_ok)
|
val = (!arc4_stir()) ? 0 : -1;
|
||||||
arc4_stir();
|
|
||||||
val = arc4_seeded_ok ? 0 : -1;
|
|
||||||
ARC4_UNLOCK_();
|
ARC4_UNLOCK_();
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user