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.
This commit is contained in:
parent
deeac584a1
commit
df05e4f2ba
@ -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
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user