From: Gurusamy Sarathy Date: Tue, 4 Aug 1998 23:03:23 +0000 (+0000) Subject: correct prototype for des_fcrypt(), explain how to add it in more X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2d77217b57f0b274e843a804355ed3f48edfb327;p=p5sagit%2Fp5-mst-13.2.git correct prototype for des_fcrypt(), explain how to add it in more detail, and supply a patch for libdes-3.06 p4raw-id: //depot/maint-5.005/perl@1729 --- diff --git a/MANIFEST b/MANIFEST index 1bf477c..1d6b3a8 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1038,6 +1038,7 @@ win32/config_H.gc Win32 config header (GNU build)? win32/config_H.vc Win32 config header (Visual C++ build) win32/config_h.PL Perl code to convert Win32 config.sh to config.h win32/config_sh.PL Perl code to update Win32 config.sh from Makefile +win32/des_fcrypt.patch Win32 port win32/dl_win32.xs Win32 port win32/genxsdef.pl Win32 port win32/include/arpa/inet.h Win32 port diff --git a/README.win32 b/README.win32 index 6ac163a..85bab90 100644 --- a/README.win32 +++ b/README.win32 @@ -171,7 +171,12 @@ available worldwide, usually along with SSLeay (for example: "ftp://fractal.mta.ca/pub/crypto/SSLeay/DES/"). Set CRYPT_SRC to the name of the file that implements des_fcrypt(). Alternatively, if you have built a library that contains des_fcrypt(), you can set -CRYPT_LIB to point to the library name. +CRYPT_LIB to point to the library name. The location above contains +many versions of the "libdes" library, all with slightly different +implementations of des_fcrypt(). Older versions have a single, +self-contained file (fcrypt.c) that implements crypt(), so they may be +easier to use. A patch against the fcrypt.c found in libdes-3.06 is +in des_fcrypt.patch. Perl will also build without des_fcrypt(), but the crypt() builtin will fail at run time. diff --git a/win32/Makefile b/win32/Makefile index 82e8f62..f23828c 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -70,14 +70,14 @@ INST_VER = \5.00502 # file exists (see README.win32). File should be located in the same # directory as this file. # -#CRYPT_SRC = des_fcrypt.c +#CRYPT_SRC = fcrypt.c # # if you didn't set CRYPT_SRC and if you have des_fcrypt() available in a # library, uncomment this, and make sure the library exists (see README.win32) # Specify the full pathname of the library. # -#CRYPT_LIB = des_fcrypt.lib +#CRYPT_LIB = fcrypt.lib # # set this if you wish to use perl's malloc diff --git a/win32/des_fcrypt.patch b/win32/des_fcrypt.patch new file mode 100644 index 0000000..7088e94 --- /dev/null +++ b/win32/des_fcrypt.patch @@ -0,0 +1,75 @@ +You need the GNU `patch' utility to apply this patch. Get: + + ftp://fractal.mta.ca/pub/crypto/SSLeay/DES/libdes-3.06.tar.gz + +Uncompress it somewhere, and use the command line: + + patch -p1 -N < this_file + +to apply the patch. Move the fcrypt.c file to the win32 subdirectory +of the Perl source distribution. + +--- libdes-3.06/fcrypt.c.dist Tue Aug 4 18:41:49 1998 ++++ libdes-3.06/fcrypt.c Tue Aug 4 18:42:03 1998 +@@ -325,12 +325,15 @@ + + static char shifts2[16]={0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0}; + +-static int body(); +-static int des_set_key(); ++static int body( ++ unsigned long *out0, ++ unsigned long *out1, ++ des_key_schedule ks, ++ unsigned long Eswap0, ++ unsigned long Eswap1); + +-static int des_set_key(key,schedule) +-des_cblock *key; +-des_key_schedule schedule; ++static int ++des_set_key(des_cblock *key, des_key_schedule schedule) + { + register unsigned long c,d,t,s; + register unsigned char *in; +@@ -460,16 +463,14 @@ + 0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A + }; + +-char *crypt(buf,salt) +-char *buf; +-char *salt; ++char * ++des_fcrypt(const char *buf, const char *salt, char *buff) + { + unsigned int i,j,x,y; + unsigned long Eswap0=0,Eswap1=0; + unsigned long out[2],ll; + des_cblock key; + des_key_schedule ks; +- static unsigned char buff[20]; + unsigned char bb[9]; + unsigned char *b=bb; + unsigned char c,u; +@@ -521,13 +522,15 @@ + buff[i]=cov_2char[c]; + } + buff[13]='\0'; +- return((char *)buff); ++ return buff; + } + +-static int body(out0,out1,ks,Eswap0,Eswap1) +-unsigned long *out0,*out1; +-des_key_schedule *ks; +-unsigned long Eswap0,Eswap1; ++static int ++body( unsigned long *out0, ++ unsigned long *out1, ++ des_key_schedule ks, ++ unsigned long Eswap0, ++ unsigned long Eswap1) + { + register unsigned long l,r,t,u,v; + #ifdef ALT_ECB +End of Patch. diff --git a/win32/makefile.mk b/win32/makefile.mk index 450786d..17c7afc 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -78,14 +78,14 @@ CCTYPE *= BORLAND # file exists (see README.win32). File should be located in the same # directory as this file. # -#CRYPT_SRC *= des_fcrypt.c +#CRYPT_SRC *= fcrypt.c # # if you didn't set CRYPT_SRC and if you have des_fcrypt() available in a # library, uncomment this, and make sure the library exists (see README.win32) # Specify the full pathname of the library. # -#CRYPT_LIB *= des_fcrypt.lib +#CRYPT_LIB *= fcrypt.lib # # set this if you wish to use perl's malloc diff --git a/win32/win32.c b/win32/win32.c index 721b62a..3f1c215 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -1164,7 +1164,7 @@ win32_alarm(unsigned int sec) #if defined(HAVE_DES_FCRYPT) || defined(PERL_OBJECT) #ifdef HAVE_DES_FCRYPT -extern char * des_fcrypt(char *cbuf, const char *txt, const char *salt); +extern char * des_fcrypt(const char *txt, const char *salt, char *cbuf); #endif DllExport char * @@ -1172,7 +1172,7 @@ win32_crypt(const char *txt, const char *salt) { #ifdef HAVE_DES_FCRYPT dTHR; - return des_fcrypt(crypt_buffer, txt, salt); + return des_fcrypt(txt, salt, crypt_buffer); #else die("The crypt() function is unimplemented due to excessive paranoia."); return Nullch;