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
+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.
AC_DEFINE(SETPGRP_TWOARG))
dnl
ADD_DEF(-DKERBEROS)
-AC_HAVE_FUNCS(srand48 srand srandom)
V5_AC_OUTPUT_MAKEFILE
int len;
{
long net_len;
- static int seeded = 0;
static char garbage_buf[8];
- long garbage;
if (!encrypt_flag)
return(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);
}
#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;
int len;
{
long net_len;
- static int seeded = 0;
static char garbage_buf[8];
- long garbage;
if (!do_encrypt)
return(write(fd, buf, 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);
}