svn commit: r355691 - head/usr.sbin/keyserv

Conrad Meyer cem at FreeBSD.org
Fri Dec 13 04:03:07 UTC 2019


Author: cem
Date: Fri Dec 13 04:03:05 2019
New Revision: 355691
URL: https://svnweb.freebsd.org/changeset/base/355691

Log:
  keyserv(8): unifdef out __FreeBSD__ and KEYSERV_RANDOM
  
  This doesn't appear to have some active upstream (and it's a steaming pile of
  bad 90s crypto design).  Rip out the completely horrible bits and leave the
  only mildly less horrible bits.  The whole thing should probably be deleted; to
  the extent it purports to provide a security feature: it doesn't.

Modified:
  head/usr.sbin/keyserv/Makefile
  head/usr.sbin/keyserv/keyserv.c

Modified: head/usr.sbin/keyserv/Makefile
==============================================================================
--- head/usr.sbin/keyserv/Makefile	Fri Dec 13 04:03:03 2019	(r355690)
+++ head/usr.sbin/keyserv/Makefile	Fri Dec 13 04:03:05 2019	(r355691)
@@ -4,7 +4,7 @@ PROG=	keyserv
 MAN=	keyserv.8
 SRCS=	keyserv.c setkey.c crypt_svc.c crypt_server.c crypt.h
 
-CFLAGS+= -DKEYSERV_RANDOM -DBROKEN_DES -I.
+CFLAGS+= -DBROKEN_DES -I.
 
 LIBADD=	mp rpcsvc
 

Modified: head/usr.sbin/keyserv/keyserv.c
==============================================================================
--- head/usr.sbin/keyserv/keyserv.c	Fri Dec 13 04:03:03 2019	(r355690)
+++ head/usr.sbin/keyserv/keyserv.c	Fri Dec 13 04:03:05 2019	(r355691)
@@ -224,38 +224,8 @@ static void
 randomize(master)
 	des_block *master;
 {
-#ifndef __FreeBSD__
-	int i;
-	int seed;
-	struct timeval tv;
-	int shift;
-
-	seed = 0;
-	for (i = 0; i < 1024; i++) {
-		(void)gettimeofday(&tv, NULL);
-		shift = i % 8 * sizeof (int);
-		seed ^= (tv.tv_usec << shift) | (tv.tv_usec >> (32 - shift));
-	}
-#endif
-#ifdef KEYSERV_RANDOM
-#ifdef __FreeBSD__
 	master->key.low = arc4random();
 	master->key.high = arc4random();
-#else
-	srandom(seed);
-	master->key.low = random();
-	master->key.high = random();
-#endif
-#else
-	/* use stupid dangerous bad rand() */
-#ifdef __FreeBSD__
-	sranddev();
-#else
-	srand(seed);
-#endif
-	master->key.low = rand();
-	master->key.high = rand();
-#endif
 }
 
 /*


More information about the svn-src-all mailing list