From: Mark Eichin Date: Thu, 27 Oct 1994 20:15:00 +0000 (+0000) Subject: * krlogin.c (des_write): get rid of srandom, since seeding is done X-Git-Tag: krb5-1.0-beta5~1056 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a35604612e49cd3a38b3407e433b654aa280e373;p=krb5.git * krlogin.c (des_write): get rid of srandom, since seeding is done directly in krb5_random_confounder. get rid of unused variables. * krlogind.c (v4_des_write): use krb5_random_confounder directly. get rid of unused variables. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@4592 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/appl/bsd/ChangeLog b/src/appl/bsd/ChangeLog index 752f8c478..3599634e3 100644 --- a/src/appl/bsd/ChangeLog +++ b/src/appl/bsd/ChangeLog @@ -1,3 +1,10 @@ +Thu Oct 27 16:12:19 1994 Mark Eichin (eichin@cygnus.com) + + * krlogin.c (des_write): get rid of srandom, since seeding is done + directly in krb5_random_confounder. get rid of unused variables. + * krlogind.c (v4_des_write): use krb5_random_confounder + directly. get rid of unused variables. + Thu Oct 27 14:50:40 1994 Mark Eichin (eichin@cygnus.com) * login.c (main): if CDISCARD is missing, use CFLUSH instead. diff --git a/src/appl/bsd/configure.in b/src/appl/bsd/configure.in index 4d46dac8b..6fb739541 100644 --- a/src/appl/bsd/configure.in +++ b/src/appl/bsd/configure.in @@ -93,5 +93,4 @@ AC_COMPILE_CHECK([number of arguments to setpgrp], AC_DEFINE(SETPGRP_TWOARG)) dnl ADD_DEF(-DKERBEROS) -AC_HAVE_FUNCS(srand48 srand srandom) V5_AC_OUTPUT_MAKEFILE diff --git a/src/appl/bsd/krlogin.c b/src/appl/bsd/krlogin.c index 322064aa5..b9a69efad 100644 --- a/src/appl/bsd/krlogin.c +++ b/src/appl/bsd/krlogin.c @@ -1742,9 +1742,7 @@ int des_write(fd, buf, len) int len; { long net_len; - static int seeded = 0; static char garbage_buf[8]; - long garbage; if (!encrypt_flag) return(write(fd, buf, len)); @@ -1752,18 +1750,7 @@ int des_write(fd, buf, len) #define min(a,b) ((a < b) ? a : b) if (len < 8) { - if (!seeded) { - seeded = 1; - srandom((int) time((long *)0)); - } -#if 0 - garbage = random(); - /* insert random garbage */ - (void) memcpy(garbage_buf, &garbage, min(sizeof(long),8)); -#else - krb5_random_confounder(8, &garbage_buf); -#endif - + krb5_random_confounder(8 - len, &garbage_buf); /* this "right-justifies" the data in the buffer */ (void) memcpy(garbage_buf + 8 - len, buf, len); } diff --git a/src/appl/bsd/krlogind.c b/src/appl/bsd/krlogind.c index b50fffccc..867945801 100644 --- a/src/appl/bsd/krlogind.c +++ b/src/appl/bsd/krlogind.c @@ -1595,29 +1595,6 @@ recvauth() #ifdef KRB5_KRB4_COMPAT -/* Random number support only needed for v4_des_write */ -#ifdef HAVE_SRAND48 -#define SRAND srand48 -#define RAND lrand48 -#define RAND_TYPE long -#endif - -#if !defined(RAND_TYPE) && defined(HAVE_SRAND) -#define SRAND srand -#define RAND rand -#define RAND_TYPE int -#endif - -#if !defined(RAND_TYPE) && defined(HAVE_SRANDOM) -#define SRAND srandom -#define RAND random -#define RAND_TYPE long -#endif - -#if !defined(RAND_TYPE) -You need a random number generator! -#endif - int v4_des_read(fd, buf, len) int fd; @@ -1699,9 +1676,7 @@ char *buf; int len; { long net_len; - static int seeded = 0; static char garbage_buf[8]; - long garbage; if (!do_encrypt) return(write(fd, buf, len)); @@ -1724,15 +1699,7 @@ int len; #define min(a,b) ((a < b) ? a : b) if (len < 8) { - if (!seeded) { - RAND_TYPE rval = time((long *) 0); - seeded = 1; - SRAND(rval); - } - garbage = RAND(); - /* insert random garbage */ - (void) memcpy(garbage_buf, &garbage, min(sizeof(long),8)); - + krb5_random_confounder(8 - len, &garbage_buf); /* this "right-justifies" the data in the buffer */ (void) memcpy(garbage_buf + 8 - len, buf, len); }