From 0745a9c96556cda2f9f2329ba03faa09eb6b87b1 Mon Sep 17 00:00:00 2001 From: "Pedro F. Giffuni" Date: Sat, 21 May 2016 00:45:42 +0000 Subject: [PATCH] ed(1): simplify by using arc4random_buf(). Suggested by: ed --- bin/ed/cbc.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/bin/ed/cbc.c b/bin/ed/cbc.c index 7869e96864e5..b59778be6723 100644 --- a/bin/ed/cbc.c +++ b/bin/ed/cbc.c @@ -90,16 +90,13 @@ void init_des_cipher(void) { #ifdef DES - int i; - des_ct = des_n = 0; /* initialize the initialization vector */ MEMZERO(ivec, 8); /* initialize the padding vector */ - for (i = 0; i < 8; i++) - pvec[i] = (char)arc4random_uniform(256); + arc4random_buf(pvec, sizeof(pvec)); #endif }