Re: des/md5 problems?

From: Todd Clark (tvcoslist@denalitek.com)
Date: Mon Jan 17 2000 - 21:16:07 EST


Thank you for the patch info,

I guess I should have specified that I'm one of those trying to get it to
work on NT. Are the patches below for NT or some other platform?

Thanks!

Todd Clark
Denalitek, Inc.

----- Original Message -----
From: "Yul Shelton" <yul@catalog.com>
To: "Todd Clark" <tvclark@denalitek.com>
Sent: Monday, January 17, 2000 1:16 PM
Subject: Re: des/md5 problems?

> diff -cr Crypt-DES-1.01-orig//DES.xs Crypt-DES-1.01/DES.xs
> *** Crypt-DES-1.01-orig//DES.xs Sat May 22 15:30:39 1999
> --- Crypt-DES-1.01/DES.xs Tue Jan 11 18:02:25 2000
> ***************
> *** 23,29 ****
> if (key_len != sizeof(des_user_key))
> croak("Invalid key");
>
> ! des_expand_key((u_int8_t *)key, ks);
>
> ST(0) = sv_2mortal(newSVpv((char *)ks, sizeof(ks)));
> }
> --- 23,29 ----
> if (key_len != sizeof(des_user_key))
> croak("Invalid key");
>
> ! perl_crypt_des_expand_key((u_int8_t *)key, ks);
>
> ST(0) = sv_2mortal(newSVpv((char *)ks, sizeof(ks)));
> }
> ***************
> *** 54,60 ****
> if (!SvUPGRADE(output, SVt_PV))
> croak("cannot use output argument as lvalue");
>
> ! des_crypt((u_int32_t *)input, (u_int32_t *)SvGROW(output,
> output_len), (u_int32_t *)ks, enc_flag);
>
> SvCUR_set(output, output_len);
> *SvEND(output) = '\0';
> --- 54,60 ----
> if (!SvUPGRADE(output, SVt_PV))
> croak("cannot use output argument as lvalue");
>
> ! perl_crypt_des_crypt((u_int32_t *)input, (u_int32_t
> *)SvGROW(output, output_len), (u_int32_t *)ks, enc_flag);
>
> SvCUR_set(output, output_len);
> *SvEND(output) = '\0';
> diff -cr Crypt-DES-1.01-orig//des.c Crypt-DES-1.01/des.c
> *** Crypt-DES-1.01-orig//des.c Sat May 22 15:30:39 1999
> --- Crypt-DES-1.01/des.c Tue Jan 11 18:04:49 2000
> ***************
> *** 434,440 ****
>
>
> void
> ! des_crypt(des_cblock input, des_cblock output, des_ks ks, int encrypt)
> {
> static unsigned long l,r,t,u;
> #ifdef ALT_ECB
> --- 434,440 ----
>
>
> void
> ! perl_crypt_des_crypt(des_cblock input, des_cblock output, des_ks ks, int
> encrypt)
> {
> static unsigned long l,r,t,u;
> #ifdef ALT_ECB
> ***************
> *** 443,450 ****
> static int i;
> static unsigned long * s;
>
> ! l=input[0];
> ! r=input[1];
>
> /* do IP */
> PERM_OP(r,l,t, 4,0x0f0f0f0f);
> --- 443,450 ----
> static int i;
> static unsigned long * s;
>
> ! c2l( input, l );
> ! c2l( input, r );
>
> /* do IP */
> PERM_OP(r,l,t, 4,0x0f0f0f0f);
> ***************
> *** 505,516 ****
> PERM_OP(l,r,t,16,0x0000ffff);
> PERM_OP(r,l,t, 4,0x0f0f0f0f);
>
> ! output[0]=l;
> ! output[1]=r;
> }
>
> void
> ! des_expand_key(des_user_key userKey, des_ks ks)
> {
> static unsigned long c,d,t,s;
> static unsigned char * in;
> --- 505,516 ----
> PERM_OP(l,r,t,16,0x0000ffff);
> PERM_OP(r,l,t, 4,0x0f0f0f0f);
>
> ! l2c( l, output );
> ! l2c( r, output );
> }
>
> void
> ! perl_crypt_des_expand_key(des_user_key userKey, des_ks ks)
> {
> static unsigned long c,d,t,s;
> static unsigned char * in;
> diff -cr Crypt-DES-1.01-orig//des.h Crypt-DES-1.01/des.h
> *** Crypt-DES-1.01-orig//des.h Sat May 22 15:30:39 1999
> --- Crypt-DES-1.01/des.h Tue Jan 11 18:02:52 2000
> ***************
> *** 1,8 ****
> #include <sys/types.h>
>
> typedef u_int8_t des_user_key[8];
> ! typedef u_int32_t des_cblock[2];
> typedef u_int32_t des_ks[32];
>
> ! void des_crypt(des_cblock in, des_cblock out, des_ks key, int encrypt);
> ! void des_expand_key(des_user_key userKey, des_ks key);
> --- 1,11 ----
> #include <sys/types.h>
>
> + typedef unsigned char u_int8_t;
> + typedef unsigned long u_int32_t;
> +
> typedef u_int8_t des_user_key[8];
> ! typedef u_int8_t des_cblock[8];
> typedef u_int32_t des_ks[32];
>
> ! void perl_crypt_des_crypt(des_cblock in, des_cblock out, des_ks key, int
> encrypt);
> ! void perl_crypt_des_expand_key(des_user_key userKey, des_ks key);
>



This archive was generated by hypermail 2.1.3 : Tue Oct 19 2004 - 23:35:14 EDT