Patch for Crypt::DES for Solaris 7 x86

From: Bryan Wann (bwann@staff.cwis.net)
Date: Wed Feb 02 2000 - 18:44:58 EST


        For anyone that is having problems with Crypt::DES on Solaris 7
x86 while building their stuff for OpenSRS, these are the patches I used.
Everything compile without errors, and 'make test' passed all 4 tests.
As far as I know, they work according to 'make test', but I have not run
any additional data through the module to make sure it really really
works.

(this is essentially the same patch that was in my previous post, just in
a 'diff -c' format)

*** DES.xs-dist Wed Feb 2 17:22:38 2000
--- DES.xs Wed Feb 2 17:28:33 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-dist Wed Feb 2 17:17:16 2000
--- des.c Wed Feb 2 17:22:28 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
***************
*** 510,516 ****
  }
  
  void
! des_expand_key(des_user_key userKey, des_ks ks)
  {
        static unsigned long c,d,t,s;
    static unsigned char * in;
--- 510,516 ----
  }
  
  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-dist Wed Feb 2 17:17:12 2000
--- des.h Wed Feb 2 17:20:04 2000
***************
*** 1,5 ****
--- 1,8 ----
  #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_int32_t des_cblock[2];
  typedef u_int32_t des_ks[32];

---
Bryan Wann
CWIS Internet Services  http://www.cwis.net/

"No, I'm not lost, Sir. I run a little Internet start-up downstairs, and I just bought the building"



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