*** DES.xs Sat May 22 15:30:39 1999 --- ../Crypt-DES-1.01/DES.xs Wed Jul 26 05:54:48 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_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_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'; *** des.c Sat May 22 15:30:39 1999 --- ../Crypt-DES-1.01/des.c Wed Jul 26 05:55:38 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_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_des_expand_key(des_user_key userKey, des_ks ks) { static unsigned long c,d,t,s; static unsigned char * in; *** des.h Sat May 22 15:30:39 1999 --- ../Crypt-DES-1.01/des.h Wed Jul 26 05:54:13 2000 *************** *** 1,7 **** #include 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); --- 1,10 ---- #include + 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 des_crypt(des_cblock in, des_cblock out, des_ks key, int encrypt);