Received: from SOUTH-STATION-ANNEX.MIT.EDU by po7.MIT.EDU (5.61/4.7) id AA27912; Fri, 23 Feb 96 00:44:02 EST
Received: from pain.lcs.mit.edu by MIT.EDU with SMTP
	id AA13948; Fri, 23 Feb 96 00:43:39 EST
Received: (from daemon@localhost) by pain.lcs.mit.edu (8.6.12/8.6.12) id AAA18466; Fri, 23 Feb 1996 00:20:19 -0500
Received: from jekyll.piermont.com by pain.lcs.mit.edu (8.6.12/8.6.12) with ESMTP id AAA18356; Fri, 23 Feb 1996 00:01:32 -0500
Received: from localhost (perry@localhost) by jekyll.piermont.com (8.7.3/8.6.12) with SMTP id AAA00733; Fri, 23 Feb 1996 00:00:11 -0500 (EST)
Message-Id: <199602230500.AAA00733@jekyll.piermont.com>
X-Authentication-Warning: jekyll.piermont.com: Host perry@localhost didn't use HELO protocol
To: John Kohl <jtk@kolvir.arlington.ma.us>
Cc: tls@NetBSD.ORG, netbsd-developers@NetBSD.ORG
Subject: Re: domestic versions of encrypting telnet, plus updated int'l telnet 
In-Reply-To: Your message of "Thu, 22 Feb 1996 23:10:31 EST."
             <199602230410.XAA26212@pattern.arlington.ma.us> 
Reply-To: perry@piermont.com
X-Reposting-Policy: redistribute only with permission
Date: Fri, 23 Feb 1996 00:00:10 -0500
From: "Perry E. Metzger" <perry@piermont.com>
Sender: owner-netbsd-developers@NetBSD.ORG
Precedence: first-class
X-Loop: netbsd-developers@NetBSD.ORG


John Kohl writes:
> I've whacked on telnet-95.05.31 and got it into shape to overlay our
> existing 1993 vintage telnet/telnetd/libtelnet.

Sigh.

1) Thats not the newest version, telnet.95.10.23 is the latest.
2) I whacked the newest version into shape last night, irony of
   ironies! The code from net-dist.mit.edu compiled straight out of
   the box once I altered a few prototypes in libtelnet. You might
   want to check my work, but the code is now in production. All I had
   to do was use the Makefile.4.4 makefiles, do the following, and all
   was fine:

*** enc-proto.h.~1~	Mon Oct 23 10:47:08 1995
--- enc-proto.h	Wed Feb 21 21:40:11 1996
***************
*** 117,125 ****
  int ofb64_keyid P((int, unsigned char *, int *));
  void ofb64_printsub P((unsigned char *, int, unsigned char *, int));
  
! int  des_new_random_key P((Block));
! void des_set_random_generator_seed P((Block));
! void des_key_sched P((Block, Schedule));
! void des_ecb_encrypt P((Block, Block, Schedule, int));
! int  des_string_to_key P((char *, Block));
  #endif	/* ENCRYPTION */
--- 117,125 ----
  int ofb64_keyid P((int, unsigned char *, int *));
  void ofb64_printsub P((unsigned char *, int, unsigned char *, int));
  
! /*int  des_new_random_key P((Block));*/
! /*void des_set_random_generator_seed P((Block));*/
! /*void des_key_sched P((Block, Schedule));*/
! /*void des_ecb_encrypt P((Block, Block, Schedule, int));*/
! /*int  des_string_to_key P((char *, Block));*/
  #endif	/* ENCRYPTION */
*** encrypt.h.~1~	Mon Oct 23 10:47:08 1995
--- encrypt.h	Wed Feb 21 21:38:45 1996
***************
*** 62,68 ****
  
  typedef	unsigned char Block[8];
  typedef unsigned char *BlockT;
! typedef struct { Block _; } Schedule[16];
  
  #define	VALIDKEY(key)	( key[0] | key[1] | key[2] | key[3] | \
  			  key[4] | key[5] | key[6] | key[7])
--- 62,68 ----
  
  typedef	unsigned char Block[8];
  typedef unsigned char *BlockT;
! typedef struct { Block Z; } Schedule[16];
  
  #define	VALIDKEY(key)	( key[0] | key[1] | key[2] | key[3] | \
  			  key[4] | key[5] | key[6] | key[7])
*** kerberos.c.~1~	Mon Oct 23 10:47:09 1995
--- kerberos.c	Wed Feb 21 21:52:57 1996
***************
*** 75,82 ****
  #include "misc.h"
  
  int kerberos4_cksum P((unsigned char *, int));
! int krb_mk_req P((KTEXT, char *, char *, char *, u_long));
! int krb_rd_req P((KTEXT, char *, char *, u_long, AUTH_DAT *, char *));
  int krb_kntoln P((AUTH_DAT *, char *));
  int krb_get_cred P((char *, char *, char *, CREDENTIALS *));
  int krb_get_lrealm P((char *, int));
--- 75,82 ----
  #include "misc.h"
  
  int kerberos4_cksum P((unsigned char *, int));
! /*int krb_mk_req P((KTEXT, char *, char *, char *, u_long));*/
! /*int krb_rd_req P((KTEXT, char *, char *, u_long, AUTH_DAT *, char *));*/
  int krb_kntoln P((AUTH_DAT *, char *));
  int krb_get_cred P((char *, char *, char *, CREDENTIALS *));
  int krb_get_lrealm P((char *, int));
***************
*** 101,109 ****
  static	char name[ANAME_SZ];
  static	AUTH_DAT adat = { 0 };
  #ifdef	ENCRYPTION
! static Block	session_key	= { 0 };
! static Schedule sched;
! static Block	challenge	= { 0 };
  #endif	/* ENCRYPTION */
  
  	static int
--- 101,109 ----
  static	char name[ANAME_SZ];
  static	AUTH_DAT adat = { 0 };
  #ifdef	ENCRYPTION
! static des_cblock session_key	= { 0 };
! static des_key_schedule sched;
! static des_cblock challenge	= { 0 };
  #endif	/* ENCRYPTION */
  
  	static int
***************
*** 226,236 ****
  	if ((ap->way & AUTH_HOW_MASK) == AUTH_HOW_MUTUAL) {
  		register int i;
  
! 		des_key_sched(cred.session, sched);
! 		des_init_random_number_generator(cred.session);
! 		des_new_random_key(session_key);
! 		des_ecb_encrypt(session_key, session_key, sched, 0);
! 		des_ecb_encrypt(session_key, challenge, sched, 0);
  		/*
  		 * Increment the challenge by 1, and encrypt it for
  		 * later comparison.
--- 226,236 ----
  	if ((ap->way & AUTH_HOW_MASK) == AUTH_HOW_MUTUAL) {
  		register int i;
  
! 		des_key_sched(&cred.session, sched);
! 		des_init_random_number_generator(&cred.session);
! 		des_new_random_key(&session_key);
! 		des_ecb_encrypt(&session_key, &session_key, sched, 0);
! 		des_ecb_encrypt(&session_key, &challenge, sched, 0);
  		/*
  		 * Increment the challenge by 1, and encrypt it for
  		 * later comparison.
***************
*** 242,248 ****
  			if (x < 256)		/* if no overflow, all done */
  				break;
  		}
! 		des_ecb_encrypt(challenge, challenge, sched, 1);
  	}
  #endif	/* ENCRYPTION */
  
--- 242,248 ----
  			if (x < 256)		/* if no overflow, all done */
  				break;
  		}
! 		des_ecb_encrypt(&challenge, &challenge, sched, 1);
  	}
  #endif	/* ENCRYPTION */
  
***************
*** 327,341 ****
  		 * Initialize the random number generator since it's
  		 * used later on by the encryption routine.
  		 */
! 		des_init_random_number_generator(session_key);
! 		des_key_sched(session_key, sched);
  		memmove((void *)datablock, (void *)data, sizeof(Block));
  		/*
  		 * Take the received encrypted challenge, and encrypt
  		 * it again to get a unique session_key for the
  		 * ENCRYPT option.
  		 */
! 		des_ecb_encrypt(datablock, session_key, sched, 1);
  		skey.type = SK_DES;
  		skey.length = 8;
  		skey.data = session_key;
--- 327,341 ----
  		 * Initialize the random number generator since it's
  		 * used later on by the encryption routine.
  		 */
! 		des_init_random_number_generator(&session_key);
! 		des_key_sched(&session_key, sched);
  		memmove((void *)datablock, (void *)data, sizeof(Block));
  		/*
  		 * Take the received encrypted challenge, and encrypt
  		 * it again to get a unique session_key for the
  		 * ENCRYPT option.
  		 */
! 		des_ecb_encrypt(&datablock, &session_key, sched, 1);
  		skey.type = SK_DES;
  		skey.length = 8;
  		skey.data = session_key;
***************
*** 344,350 ****
  		 * Now decrypt the received encrypted challenge,
  		 * increment by one, re-encrypt it and send it back.
  		 */
! 		des_ecb_encrypt(datablock, challenge, sched, 0);
  		for (r = 7; r >= 0; r--) {
  			register int t;
  			t = (unsigned int)challenge[r] + 1;
--- 344,350 ----
  		 * Now decrypt the received encrypted challenge,
  		 * increment by one, re-encrypt it and send it back.
  		 */
! 		des_ecb_encrypt(&datablock, &challenge, sched, 0);
  		for (r = 7; r >= 0; r--) {
  			register int t;
  			t = (unsigned int)challenge[r] + 1;
***************
*** 352,358 ****
  			if (t < 256)		/* if no overflow, all done */
  				break;
  		}
! 		des_ecb_encrypt(challenge, challenge, sched, 1);
  		Data(ap, KRB_RESPONSE, (void *)challenge, sizeof(challenge));
  #endif	/* ENCRYPTION */
  		break;
--- 352,358 ----
  			if (t < 256)		/* if no overflow, all done */
  				break;
  		}
! 		des_ecb_encrypt(&challenge, &challenge, sched, 1);
  		Data(ap, KRB_RESPONSE, (void *)challenge, sizeof(challenge));
  #endif	/* ENCRYPTION */
  		break;
***************
*** 397,403 ****
  #else	/* ENCRYPTION */
  			Data(ap, KRB_CHALLENGE, (void *)session_key,
  						sizeof(session_key));
! 			des_ecb_encrypt(session_key, session_key, sched, 1);
  			skey.type = SK_DES;
  			skey.length = 8;
  			skey.data = session_key;
--- 397,403 ----
  #else	/* ENCRYPTION */
  			Data(ap, KRB_CHALLENGE, (void *)session_key,
  						sizeof(session_key));
! 			des_ecb_encrypt(&session_key, &session_key, sched, 1);
  			skey.type = SK_DES;
  			skey.length = 8;
  			skey.data = session_key;
