View | Details | Raw Unified | Return to bug 207743
Collapse All | Expand All

(-)b/contrib/telnet/libtelnet/enc_des.c (-10 / +10 lines)
Lines 207-215 fb64_start(struct fb *fbp, int dir, int server __unused) Link Here
207
		/*
207
		/*
208
		 * Create a random feed and send it over.
208
		 * Create a random feed and send it over.
209
		 */
209
		 */
210
		des_random_key((Block *)fbp->temp_feed);
210
		DES_random_key((Block *)fbp->temp_feed);
211
		des_ecb_encrypt((Block *)fbp->temp_feed, (Block *)fbp->temp_feed,
211
		DES_ecb_encrypt((Block *)fbp->temp_feed, (Block *)fbp->temp_feed,
212
				fbp->krbdes_sched, 1);
212
				&fbp->krbdes_sched, 1);
213
		p = fbp->fb_feed + 3;
213
		p = fbp->fb_feed + 3;
214
		*p++ = ENCRYPT_IS;
214
		*p++ = ENCRYPT_IS;
215
		p++;
215
		p++;
Lines 393-399 fb64_session(Session_Key *key, int server, struct fb *fbp) Link Here
393
	fb64_stream_key(fbp->krbdes_key, &fbp->streams[DIR_ENCRYPT-1]);
393
	fb64_stream_key(fbp->krbdes_key, &fbp->streams[DIR_ENCRYPT-1]);
394
	fb64_stream_key(fbp->krbdes_key, &fbp->streams[DIR_DECRYPT-1]);
394
	fb64_stream_key(fbp->krbdes_key, &fbp->streams[DIR_DECRYPT-1]);
395
395
396
	des_key_sched((Block *)fbp->krbdes_key, fbp->krbdes_sched);
396
	DES_key_sched((Block *)fbp->krbdes_key, &fbp->krbdes_sched);
397
	/*
397
	/*
398
	 * Now look to see if krbdes_start() was was waiting for
398
	 * Now look to see if krbdes_start() was was waiting for
399
	 * the key to show up.  If so, go ahead an call it now
399
	 * the key to show up.  If so, go ahead an call it now
Lines 499-505 fb64_stream_iv(Block seed, struct stinfo *stp) Link Here
499
	memmove((void *)stp->str_iv, (void *)seed, sizeof(Block));
499
	memmove((void *)stp->str_iv, (void *)seed, sizeof(Block));
500
	memmove((void *)stp->str_output, (void *)seed, sizeof(Block));
500
	memmove((void *)stp->str_output, (void *)seed, sizeof(Block));
501
501
502
	des_key_sched((Block *)stp->str_ikey, stp->str_sched);
502
	DES_key_sched((Block *)stp->str_ikey, &stp->str_sched);
503
503
504
	stp->str_index = sizeof(Block);
504
	stp->str_index = sizeof(Block);
505
}
505
}
Lines 508-514 void Link Here
508
fb64_stream_key(Block key, struct stinfo *stp)
508
fb64_stream_key(Block key, struct stinfo *stp)
509
{
509
{
510
	memmove((void *)stp->str_ikey, (void *)key, sizeof(Block));
510
	memmove((void *)stp->str_ikey, (void *)key, sizeof(Block));
511
	des_key_sched((Block *)key, stp->str_sched);
511
	DES_key_sched((Block *)key, &stp->str_sched);
512
512
513
	memmove((void *)stp->str_output, (void *)stp->str_iv, sizeof(Block));
513
	memmove((void *)stp->str_output, (void *)stp->str_iv, sizeof(Block));
514
514
Lines 547-553 cfb64_encrypt(unsigned char *s, int c) Link Here
547
	while (c-- > 0) {
547
	while (c-- > 0) {
548
		if (idx == sizeof(Block)) {
548
		if (idx == sizeof(Block)) {
549
			Block b;
549
			Block b;
550
			des_ecb_encrypt((Block *)stp->str_output, (Block *)b, stp->str_sched, 1);
550
			DES_ecb_encrypt((Block *)stp->str_output, (Block *)b, &stp->str_sched, 1);
551
			memmove((void *)stp->str_feed, (void *)b, sizeof(Block));
551
			memmove((void *)stp->str_feed, (void *)b, sizeof(Block));
552
			idx = 0;
552
			idx = 0;
553
		}
553
		}
Lines 580-586 cfb64_decrypt(int data) Link Here
580
	idx = stp->str_index++;
580
	idx = stp->str_index++;
581
	if (idx == sizeof(Block)) {
581
	if (idx == sizeof(Block)) {
582
		Block b;
582
		Block b;
583
		des_ecb_encrypt((Block *)stp->str_output, (Block *)b, stp->str_sched, 1);
583
		DES_ecb_encrypt((Block *)stp->str_output, (Block *)b, &stp->str_sched, 1);
584
		memmove((void *)stp->str_feed, (void *)b, sizeof(Block));
584
		memmove((void *)stp->str_feed, (void *)b, sizeof(Block));
585
		stp->str_index = 1;	/* Next time will be 1 */
585
		stp->str_index = 1;	/* Next time will be 1 */
586
		idx = 0;		/* But now use 0 */
586
		idx = 0;		/* But now use 0 */
Lines 620-626 ofb64_encrypt(unsigned char *s, int c) Link Here
620
	while (c-- > 0) {
620
	while (c-- > 0) {
621
		if (idx == sizeof(Block)) {
621
		if (idx == sizeof(Block)) {
622
			Block b;
622
			Block b;
623
			des_ecb_encrypt((Block *)stp->str_feed, (Block *)b, stp->str_sched, 1);
623
			DES_ecb_encrypt((Block *)stp->str_feed, (Block *)b, &stp->str_sched, 1);
624
			memmove((void *)stp->str_feed, (void *)b, sizeof(Block));
624
			memmove((void *)stp->str_feed, (void *)b, sizeof(Block));
625
			idx = 0;
625
			idx = 0;
626
		}
626
		}
Lines 650-656 ofb64_decrypt(int data) Link Here
650
	idx = stp->str_index++;
650
	idx = stp->str_index++;
651
	if (idx == sizeof(Block)) {
651
	if (idx == sizeof(Block)) {
652
		Block b;
652
		Block b;
653
		des_ecb_encrypt((Block *)stp->str_feed, (Block *)b, stp->str_sched, 1);
653
		DES_ecb_encrypt((Block *)stp->str_feed, (Block *)b, &stp->str_sched, 1);
654
		memmove((void *)stp->str_feed, (void *)b, sizeof(Block));
654
		memmove((void *)stp->str_feed, (void *)b, sizeof(Block));
655
		stp->str_index = 1;	/* Next time will be 1 */
655
		stp->str_index = 1;	/* Next time will be 1 */
656
		idx = 0;		/* But now use 0 */
656
		idx = 0;		/* But now use 0 */
(-)b/contrib/telnet/libtelnet/encrypt.h (-1 / +1 lines)
Lines 67-73 typedef unsigned char *BlockT; Link Here
67
#if 0
67
#if 0
68
typedef struct { Block __; } Schedule[16];
68
typedef struct { Block __; } Schedule[16];
69
#else
69
#else
70
#define Schedule des_key_schedule
70
#define Schedule DES_key_schedule
71
#endif
71
#endif
72
72
73
#define	VALIDKEY(key)	( key[0] | key[1] | key[2] | key[3] | \
73
#define	VALIDKEY(key)	( key[0] | key[1] | key[2] | key[3] | \
(-)b/contrib/telnet/libtelnet/pk.c (-7 / +7 lines)
Lines 129-135 common_key(char *xsecret, char *xpublic, IdeaData *ideakey, DesData *deskey) Link Here
129
        mp_pow(public, secret, modulus, common);
129
        mp_pow(public, secret, modulus, common);
130
        extractdeskey(common, deskey);
130
        extractdeskey(common, deskey);
131
        extractideakey(common, ideakey);
131
        extractideakey(common, ideakey);
132
	des_set_odd_parity(deskey);
132
	DES_set_odd_parity(deskey);
133
        mp_mfree(common);
133
        mp_mfree(common);
134
        mp_mfree(secret);
134
        mp_mfree(secret);
135
        mp_mfree(public);
135
        mp_mfree(public);
Lines 221-234 pk_encode(char *in, char *out, DesData *key) Link Here
221
{
221
{
222
	char buf[256];
222
	char buf[256];
223
	DesData i;
223
	DesData i;
224
	des_key_schedule k;
224
	DES_key_schedule k;
225
	int l,op,deslen;
225
	int l,op,deslen;
226
226
227
	memset(&i,0,sizeof(i));
227
	memset(&i,0,sizeof(i));
228
	memset(buf,0,sizeof(buf));
228
	memset(buf,0,sizeof(buf));
229
	deslen = ((strlen(in) + 7)/8)*8;
229
	deslen = ((strlen(in) + 7)/8)*8;
230
	des_key_sched(key, k);
230
	DES_key_sched(key, &k);
231
	des_cbc_encrypt(in,buf,deslen, k,&i,DES_ENCRYPT);
231
	DES_cbc_encrypt(in,buf,deslen, &k,&i,DES_ENCRYPT);
232
	for (l=0,op=0;l<deslen;l++) {
232
	for (l=0,op=0;l<deslen;l++) {
233
		out[op++] = hextab[(buf[l] & 0xf0) >> 4];
233
		out[op++] = hextab[(buf[l] & 0xf0) >> 4];
234
		out[op++] = hextab[(buf[l] & 0x0f)];
234
		out[op++] = hextab[(buf[l] & 0x0f)];
Lines 242-248 pk_decode(char *in, char *out, DesData *key) Link Here
242
{
242
{
243
	char buf[256];
243
	char buf[256];
244
	DesData i;
244
	DesData i;
245
	des_key_schedule k;
245
	DES_key_schedule k;
246
	int n1,n2,op;
246
	int n1,n2,op;
247
	size_t l;
247
	size_t l;
248
248
Lines 259-265 pk_decode(char *in, char *out, DesData *key) Link Here
259
			n2 = in[op+1] - '0';
259
			n2 = in[op+1] - '0';
260
		buf[l] = n1*16 +n2;
260
		buf[l] = n1*16 +n2;
261
	}
261
	}
262
	des_key_sched(key, k);
262
	DES_key_sched(key, &k);
263
	des_cbc_encrypt(buf,out,strlen(in)/2, k,&i,DES_DECRYPT);
263
	DES_cbc_encrypt(buf,out,strlen(in)/2, &k,&i,DES_DECRYPT);
264
	out[strlen(in)/2] = '\0';
264
	out[strlen(in)/2] = '\0';
265
}
265
}
(-)b/contrib/telnet/libtelnet/pk.h (-1 / +1 lines)
Lines 32-38 Link Here
32
/* header for the des routines that we will use */
32
/* header for the des routines that we will use */
33
33
34
typedef unsigned char byte, DesData[ 8], IdeaData[16];
34
typedef unsigned char byte, DesData[ 8], IdeaData[16];
35
#define DesKeys des_key_schedule
35
#define DesKeys DES_key_schedule
36
36
37
#define DES_DECRYPT 0
37
#define DES_DECRYPT 0
38
#define DES_ENCRYPT 1
38
#define DES_ENCRYPT 1

Return to bug 207743