summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorkris <kris@FreeBSD.org>2001-03-05 02:15:38 +0000
committerkris <kris@FreeBSD.org>2001-03-05 02:15:38 +0000
commit1854a6d14106223a0c8d065a51f8bfbbd20dcae5 (patch)
tree98d48afd0b291961c0bdf0ab100aedfb8e032d9e /bin
parent7c6e2c6a5b2280eba5d810524967ee7dc6b5798e (diff)
downloadFreeBSD-src-1854a6d14106223a0c8d065a51f8bfbbd20dcae5.zip
FreeBSD-src-1854a6d14106223a0c8d065a51f8bfbbd20dcae5.tar.gz
Switch from using rand() or random() to a stronger, more appropriate PRNG
(random() or arc4random()) Reviewed by: bde
Diffstat (limited to 'bin')
-rw-r--r--bin/ed/cbc.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/bin/ed/cbc.c b/bin/ed/cbc.c
index f77ce0d..8ac0cd2 100644
--- a/bin/ed/cbc.c
+++ b/bin/ed/cbc.c
@@ -57,12 +57,6 @@ static char * const rcsid =
/*
- * Define a divisor for rand() that yields a uniform distribution in the
- * range 0-255.
- */
-#define RAND_DIV (((unsigned) RAND_MAX + 1) >> 8)
-
-/*
* BSD and System V systems offer special library calls that do
* block move_liness and fills, so if possible we take advantage of them
*/
@@ -125,9 +119,8 @@ init_des_cipher()
MEMZERO(ivec, 8);
/* initialize the padding vector */
- srand((unsigned) time((time_t *) 0));
for (i = 0; i < 8; i++)
- CHAR(pvec, i) = (char) (rand()/RAND_DIV);
+ CHAR(pvec, i) = (char) (arc4random() % 256);
#endif
}
OpenPOWER on IntegriCloud