Simply let teken_stress use arc4random.
This makes it run quite a bit faster, since it makes system calls less often.
This commit is contained in:
parent
d8554e5c77
commit
073e2d2c93
@ -99,24 +99,14 @@ int
|
|||||||
main(int argc __unused, char *argv[] __unused)
|
main(int argc __unused, char *argv[] __unused)
|
||||||
{
|
{
|
||||||
teken_t t;
|
teken_t t;
|
||||||
int rnd;
|
|
||||||
unsigned int i, iteration = 0;
|
unsigned int i, iteration = 0;
|
||||||
unsigned char buf[2048];
|
unsigned char buf[2048];
|
||||||
|
|
||||||
rnd = open("/dev/urandom", O_RDONLY);
|
|
||||||
if (rnd < 0) {
|
|
||||||
perror("/dev/urandom");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
teken_init(&t, &tf, NULL);
|
teken_init(&t, &tf, NULL);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (read(rnd, buf, sizeof buf) != sizeof buf) {
|
arc4random_buf(buf, sizeof buf);
|
||||||
perror("read");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < sizeof buf; i++) {
|
for (i = 0; i < sizeof buf; i++) {
|
||||||
if (buf[i] >= 0x80)
|
if (buf[i] >= 0x80)
|
||||||
buf[i] =
|
buf[i] =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user