Make telnet(1) buildable.

This commit is contained in:
jkim 2018-09-19 07:01:22 +00:00
parent 9e8c94197a
commit d847c947e3
5 changed files with 30 additions and 30 deletions

View File

@ -207,9 +207,9 @@ fb64_start(struct fb *fbp, int dir, int server __unused)
/*
* Create a random feed and send it over.
*/
des_random_key((Block *)fbp->temp_feed);
des_ecb_encrypt((Block *)fbp->temp_feed, (Block *)fbp->temp_feed,
fbp->krbdes_sched, 1);
DES_random_key((Block *)fbp->temp_feed);
DES_ecb_encrypt((Block *)fbp->temp_feed, (Block *)fbp->temp_feed,
&fbp->krbdes_sched, 1);
p = fbp->fb_feed + 3;
*p++ = ENCRYPT_IS;
p++;
@ -393,7 +393,7 @@ fb64_session(Session_Key *key, int server, struct fb *fbp)
fb64_stream_key(fbp->krbdes_key, &fbp->streams[DIR_ENCRYPT-1]);
fb64_stream_key(fbp->krbdes_key, &fbp->streams[DIR_DECRYPT-1]);
des_key_sched((Block *)fbp->krbdes_key, fbp->krbdes_sched);
DES_key_sched((Block *)fbp->krbdes_key, &fbp->krbdes_sched);
/*
* Now look to see if krbdes_start() was was waiting for
* the key to show up. If so, go ahead an call it now
@ -499,7 +499,7 @@ fb64_stream_iv(Block seed, struct stinfo *stp)
memmove((void *)stp->str_iv, (void *)seed, sizeof(Block));
memmove((void *)stp->str_output, (void *)seed, sizeof(Block));
des_key_sched((Block *)stp->str_ikey, stp->str_sched);
DES_key_sched((Block *)stp->str_ikey, &stp->str_sched);
stp->str_index = sizeof(Block);
}
@ -508,7 +508,7 @@ void
fb64_stream_key(Block key, struct stinfo *stp)
{
memmove((void *)stp->str_ikey, (void *)key, sizeof(Block));
des_key_sched((Block *)key, stp->str_sched);
DES_key_sched((Block *)key, &stp->str_sched);
memmove((void *)stp->str_output, (void *)stp->str_iv, sizeof(Block));
@ -547,7 +547,7 @@ cfb64_encrypt(unsigned char *s, int c)
while (c-- > 0) {
if (idx == sizeof(Block)) {
Block b;
des_ecb_encrypt((Block *)stp->str_output, (Block *)b, stp->str_sched, 1);
DES_ecb_encrypt((Block *)stp->str_output, (Block *)b, &stp->str_sched, 1);
memmove((void *)stp->str_feed, (void *)b, sizeof(Block));
idx = 0;
}
@ -580,7 +580,7 @@ cfb64_decrypt(int data)
idx = stp->str_index++;
if (idx == sizeof(Block)) {
Block b;
des_ecb_encrypt((Block *)stp->str_output, (Block *)b, stp->str_sched, 1);
DES_ecb_encrypt((Block *)stp->str_output, (Block *)b, &stp->str_sched, 1);
memmove((void *)stp->str_feed, (void *)b, sizeof(Block));
stp->str_index = 1; /* Next time will be 1 */
idx = 0; /* But now use 0 */
@ -620,7 +620,7 @@ ofb64_encrypt(unsigned char *s, int c)
while (c-- > 0) {
if (idx == sizeof(Block)) {
Block b;
des_ecb_encrypt((Block *)stp->str_feed, (Block *)b, stp->str_sched, 1);
DES_ecb_encrypt((Block *)stp->str_feed, (Block *)b, &stp->str_sched, 1);
memmove((void *)stp->str_feed, (void *)b, sizeof(Block));
idx = 0;
}
@ -650,7 +650,7 @@ ofb64_decrypt(int data)
idx = stp->str_index++;
if (idx == sizeof(Block)) {
Block b;
des_ecb_encrypt((Block *)stp->str_feed, (Block *)b, stp->str_sched, 1);
DES_ecb_encrypt((Block *)stp->str_feed, (Block *)b, &stp->str_sched, 1);
memmove((void *)stp->str_feed, (void *)b, sizeof(Block));
stp->str_index = 1; /* Next time will be 1 */
idx = 0; /* But now use 0 */

View File

@ -67,7 +67,7 @@ typedef unsigned char *BlockT;
#if 0
typedef struct { Block __; } Schedule[16];
#else
#define Schedule des_key_schedule
#define Schedule DES_key_schedule
#endif
#define VALIDKEY(key) ( key[0] | key[1] | key[2] | key[3] | \

View File

@ -91,7 +91,7 @@ static char name[ANAME_SZ];
static AUTH_DAT adat = { 0, "", "", "", 0, {}, 0, 0, 0, { 0, "", 0 } };
#ifdef ENCRYPTION
static Block session_key = { 0 };
static des_key_schedule sched;
static DES_key_schedule sched;
static Block challenge = { 0 };
#endif /* ENCRYPTION */
@ -206,10 +206,10 @@ kerberos4_send(Authenticator *ap)
if ((ap->way & AUTH_HOW_MASK) == AUTH_HOW_MUTUAL) {
register int i;
des_key_sched(&cred.session, sched);
des_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_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.
@ -221,7 +221,7 @@ kerberos4_send(Authenticator *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 */
@ -298,14 +298,14 @@ kerberos4_is(Authenticator *ap, unsigned char *data, int cnt)
break;
}
des_key_sched(&session_key, sched);
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;
@ -314,7 +314,7 @@ kerberos4_is(Authenticator *ap, unsigned char *data, int 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;
@ -322,7 +322,7 @@ kerberos4_is(Authenticator *ap, unsigned char *data, int 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, challenge, sizeof(challenge));
#endif /* ENCRYPTION */
break;
@ -364,7 +364,7 @@ kerberos4_reply(Authenticator *ap, unsigned char *data, int cnt)
#else /* ENCRYPTION */
Data(ap, KRB_CHALLENGE, 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;

View File

@ -129,7 +129,7 @@ common_key(char *xsecret, char *xpublic, IdeaData *ideakey, DesData *deskey)
mp_pow(public, secret, modulus, common);
extractdeskey(common, deskey);
extractideakey(common, ideakey);
des_set_odd_parity(deskey);
DES_set_odd_parity(deskey);
mp_mfree(common);
mp_mfree(secret);
mp_mfree(public);
@ -221,14 +221,14 @@ pk_encode(char *in, char *out, DesData *key)
{
char buf[256];
DesData i;
des_key_schedule k;
DES_key_schedule k;
int l,op,deslen;
memset(&i,0,sizeof(i));
memset(buf,0,sizeof(buf));
deslen = ((strlen(in) + 7)/8)*8;
des_key_sched(key, k);
des_cbc_encrypt(in,buf,deslen, k,&i,DES_ENCRYPT);
DES_key_sched(key, &k);
DES_cbc_encrypt(in, buf, deslen, &k, &i, DES_ENCRYPT);
for (l=0,op=0;l<deslen;l++) {
out[op++] = hextab[(buf[l] & 0xf0) >> 4];
out[op++] = hextab[(buf[l] & 0x0f)];
@ -242,7 +242,7 @@ pk_decode(char *in, char *out, DesData *key)
{
char buf[256];
DesData i;
des_key_schedule k;
DES_key_schedule k;
int n1,n2,op;
size_t l;
@ -259,7 +259,7 @@ pk_decode(char *in, char *out, DesData *key)
n2 = in[op+1] - '0';
buf[l] = n1*16 +n2;
}
des_key_sched(key, k);
des_cbc_encrypt(buf,out,strlen(in)/2, k,&i,DES_DECRYPT);
DES_key_sched(key, &k);
DES_cbc_encrypt(buf, out, strlen(in) / 2, &k, &i, DES_DECRYPT);
out[strlen(in)/2] = '\0';
}

View File

@ -32,7 +32,7 @@
/* header for the des routines that we will use */
typedef unsigned char byte, DesData[ 8], IdeaData[16];
#define DesKeys des_key_schedule
#define DesKeys DES_key_schedule
#define DES_DECRYPT 0
#define DES_ENCRYPT 1