Enable kerberosIV authentication/encryption conditionalized on MAKE_EBONES.
Fix up some of the des calls to be compatible with eBones.
This commit is contained in:
parent
075a578e23
commit
9d6965ac06
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=10740
@ -1,9 +1,5 @@
|
||||
# From: @(#)Makefile 8.2 (Berkeley) 12/15/93
|
||||
# $Id: Makefile,v 1.8 1995/07/24 22:55:35 ache Exp $
|
||||
|
||||
# This stuff need original libdes to run (new_rnd_key.c module),
|
||||
# current eBones/des lib don't have it
|
||||
# Kerberos4 stuff ifdefed by MAKE_KERBEROS (make.conf) because of it
|
||||
# $Id: Makefile,v 1.9 1995/08/05 19:10:17 ache Exp $
|
||||
|
||||
LIB= telnet
|
||||
SRCS= auth.c encrypt.c genget.c getent.c misc.c
|
||||
@ -15,7 +11,7 @@ CFLAGS+= -DHAS_CGETENT
|
||||
|
||||
CFLAGS+= -DENCRYPTION -DAUTHENTICATION
|
||||
|
||||
.ifdef MAKE_KERBEROS
|
||||
.ifdef MAKE_EBONES
|
||||
.if exists(/usr/lib/libkrb.a)
|
||||
CFLAGS+= -DKRB4 -I/usr/include/kerberosIV -DDES_ENCRYPTION
|
||||
# KRB4_ENCPWD not yet defined
|
||||
|
@ -117,9 +117,4 @@ void ofb64_session P((Session_Key *, int));
|
||||
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 */
|
||||
|
@ -75,11 +75,6 @@ static char sccsid[] = "@(#)kerberos.c 8.3 (Berkeley) 5/30/95";
|
||||
#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));
|
||||
int kuserok P((AUTH_DAT *, char *));
|
||||
|
||||
extern auth_debug_mode;
|
||||
@ -102,7 +97,7 @@ static char name[ANAME_SZ];
|
||||
static AUTH_DAT adat = { 0 };
|
||||
#ifdef ENCRYPTION
|
||||
static Block session_key = { 0 };
|
||||
static Schedule sched;
|
||||
static des_key_schedule sched;
|
||||
static Block challenge = { 0 };
|
||||
#endif /* ENCRYPTION */
|
||||
|
||||
@ -226,11 +221,11 @@ kerberos4_send(ap)
|
||||
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);
|
||||
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,7 +237,7 @@ kerberos4_send(ap)
|
||||
if (x < 256) /* if no overflow, all done */
|
||||
break;
|
||||
}
|
||||
des_ecb_encrypt(challenge, challenge, sched, 1);
|
||||
des_ecb_encrypt(&challenge, &challenge, sched, 1);
|
||||
}
|
||||
#endif /* ENCRYPTION */
|
||||
|
||||
@ -327,15 +322,15 @@ kerberos4_is(ap, data, cnt)
|
||||
* 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);
|
||||
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);
|
||||
des_ecb_encrypt(&datablock, &session_key, sched, 1);
|
||||
skey.type = SK_DES;
|
||||
skey.length = 8;
|
||||
skey.data = session_key;
|
||||
@ -344,7 +339,7 @@ kerberos4_is(ap, data, cnt)
|
||||
* Now decrypt the received encrypted challenge,
|
||||
* increment by one, re-encrypt it and send it back.
|
||||
*/
|
||||
des_ecb_encrypt(datablock, challenge, sched, 0);
|
||||
des_ecb_encrypt(&datablock, &challenge, sched, 0);
|
||||
for (r = 7; r >= 0; r--) {
|
||||
register int t;
|
||||
t = (unsigned int)challenge[r] + 1;
|
||||
@ -352,7 +347,7 @@ kerberos4_is(ap, data, cnt)
|
||||
if (t < 256) /* if no overflow, all done */
|
||||
break;
|
||||
}
|
||||
des_ecb_encrypt(challenge, challenge, sched, 1);
|
||||
des_ecb_encrypt(&challenge, &challenge, sched, 1);
|
||||
Data(ap, KRB_RESPONSE, (void *)challenge, sizeof(challenge));
|
||||
#endif /* ENCRYPTION */
|
||||
break;
|
||||
@ -397,7 +392,7 @@ kerberos4_reply(ap, data, cnt)
|
||||
#else /* ENCRYPTION */
|
||||
Data(ap, KRB_CHALLENGE, (void *)session_key,
|
||||
sizeof(session_key));
|
||||
des_ecb_encrypt(session_key, session_key, sched, 1);
|
||||
des_ecb_encrypt(&session_key, &session_key, sched, 1);
|
||||
skey.type = SK_DES;
|
||||
skey.length = 8;
|
||||
skey.data = session_key;
|
||||
|
@ -1,9 +1,5 @@
|
||||
# From: @(#)Makefile 8.2 (Berkeley) 12/15/93
|
||||
# $Id: Makefile,v 1.8 1995/07/24 22:55:35 ache Exp $
|
||||
|
||||
# This stuff need original libdes to run (new_rnd_key.c module),
|
||||
# current eBones/des lib don't have it
|
||||
# Kerberos4 stuff ifdefed by MAKE_KERBEROS (make.conf) because of it
|
||||
# $Id: Makefile,v 1.9 1995/08/05 19:10:17 ache Exp $
|
||||
|
||||
LIB= telnet
|
||||
SRCS= auth.c encrypt.c genget.c getent.c misc.c
|
||||
@ -15,7 +11,7 @@ CFLAGS+= -DHAS_CGETENT
|
||||
|
||||
CFLAGS+= -DENCRYPTION -DAUTHENTICATION
|
||||
|
||||
.ifdef MAKE_KERBEROS
|
||||
.ifdef MAKE_EBONES
|
||||
.if exists(/usr/lib/libkrb.a)
|
||||
CFLAGS+= -DKRB4 -I/usr/include/kerberosIV -DDES_ENCRYPTION
|
||||
# KRB4_ENCPWD not yet defined
|
||||
|
@ -117,9 +117,4 @@ void ofb64_session P((Session_Key *, int));
|
||||
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 */
|
||||
|
@ -75,11 +75,6 @@ static char sccsid[] = "@(#)kerberos.c 8.3 (Berkeley) 5/30/95";
|
||||
#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));
|
||||
int kuserok P((AUTH_DAT *, char *));
|
||||
|
||||
extern auth_debug_mode;
|
||||
@ -102,7 +97,7 @@ static char name[ANAME_SZ];
|
||||
static AUTH_DAT adat = { 0 };
|
||||
#ifdef ENCRYPTION
|
||||
static Block session_key = { 0 };
|
||||
static Schedule sched;
|
||||
static des_key_schedule sched;
|
||||
static Block challenge = { 0 };
|
||||
#endif /* ENCRYPTION */
|
||||
|
||||
@ -226,11 +221,11 @@ kerberos4_send(ap)
|
||||
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);
|
||||
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,7 +237,7 @@ kerberos4_send(ap)
|
||||
if (x < 256) /* if no overflow, all done */
|
||||
break;
|
||||
}
|
||||
des_ecb_encrypt(challenge, challenge, sched, 1);
|
||||
des_ecb_encrypt(&challenge, &challenge, sched, 1);
|
||||
}
|
||||
#endif /* ENCRYPTION */
|
||||
|
||||
@ -327,15 +322,15 @@ kerberos4_is(ap, data, cnt)
|
||||
* 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);
|
||||
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);
|
||||
des_ecb_encrypt(&datablock, &session_key, sched, 1);
|
||||
skey.type = SK_DES;
|
||||
skey.length = 8;
|
||||
skey.data = session_key;
|
||||
@ -344,7 +339,7 @@ kerberos4_is(ap, data, cnt)
|
||||
* Now decrypt the received encrypted challenge,
|
||||
* increment by one, re-encrypt it and send it back.
|
||||
*/
|
||||
des_ecb_encrypt(datablock, challenge, sched, 0);
|
||||
des_ecb_encrypt(&datablock, &challenge, sched, 0);
|
||||
for (r = 7; r >= 0; r--) {
|
||||
register int t;
|
||||
t = (unsigned int)challenge[r] + 1;
|
||||
@ -352,7 +347,7 @@ kerberos4_is(ap, data, cnt)
|
||||
if (t < 256) /* if no overflow, all done */
|
||||
break;
|
||||
}
|
||||
des_ecb_encrypt(challenge, challenge, sched, 1);
|
||||
des_ecb_encrypt(&challenge, &challenge, sched, 1);
|
||||
Data(ap, KRB_RESPONSE, (void *)challenge, sizeof(challenge));
|
||||
#endif /* ENCRYPTION */
|
||||
break;
|
||||
@ -397,7 +392,7 @@ kerberos4_reply(ap, data, cnt)
|
||||
#else /* ENCRYPTION */
|
||||
Data(ap, KRB_CHALLENGE, (void *)session_key,
|
||||
sizeof(session_key));
|
||||
des_ecb_encrypt(session_key, session_key, sched, 1);
|
||||
des_ecb_encrypt(&session_key, &session_key, sched, 1);
|
||||
skey.type = SK_DES;
|
||||
skey.length = 8;
|
||||
skey.data = session_key;
|
||||
|
Loading…
Reference in New Issue
Block a user