Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 May 2016 00:45:42 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r300340 - head/bin/ed
Message-ID:  <201605210045.u4L0jgJC018119@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Sat May 21 00:45:42 2016
New Revision: 300340
URL: https://svnweb.freebsd.org/changeset/base/300340

Log:
  ed(1): simplify by using arc4random_buf().
  
  Suggested by:	ed

Modified:
  head/bin/ed/cbc.c

Modified: head/bin/ed/cbc.c
==============================================================================
--- head/bin/ed/cbc.c	Sat May 21 00:43:10 2016	(r300339)
+++ head/bin/ed/cbc.c	Sat May 21 00:45:42 2016	(r300340)
@@ -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
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605210045.u4L0jgJC018119>