diff options
author | Richard Levitte <levitte@openssl.org> | 2001-10-24 21:21:12 +0000 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2001-10-24 21:21:12 +0000 |
commit | c2e4f17c1a0d4d5115c6ede9492de1615fe392ac (patch) | |
tree | 14dda5edeaebac01b4baa3aa026c40a784a44266 /crypto/des | |
parent | 979689aa5cfa100ccbc1f25064e9398be4b7b05c (diff) |
Due to an increasing number of clashes between modern OpenSSL and
libdes (which is still used out there) or other des implementations,
the OpenSSL DES functions are renamed to begin with DES_ instead of
des_. Compatibility routines are provided and declared by including
openssl/des_old.h. Those declarations are the same as were in des.h
when the OpenSSL project started, which is exactly how libdes looked
at that time, and hopefully still looks today.
The compatibility functions will be removed in some future release, at
the latest in version 1.0.
Diffstat (limited to 'crypto/des')
38 files changed, 1059 insertions, 610 deletions
diff --git a/crypto/des/Makefile.ssl b/crypto/des/Makefile.ssl index 68fd3c4cbc..60d4d1b45b 100644 --- a/crypto/des/Makefile.ssl +++ b/crypto/des/Makefile.ssl @@ -34,7 +34,7 @@ LIBSRC= cbc_cksm.c cbc_enc.c cfb64enc.c cfb_enc.c \ qud_cksm.c rand_key.c rpc_enc.c set_key.c \ des_enc.c fcrypt_b.c \ xcbc_enc.c \ - str2key.c cfb64ede.c ofb64ede.c ede_cbcm_enc.c + str2key.c cfb64ede.c ofb64ede.c ede_cbcm_enc.c des_old.o LIBOBJ= set_key.o ecb_enc.o cbc_enc.o \ ecb3_enc.o cfb64enc.o cfb64ede.o cfb_enc.o ofb64ede.o \ @@ -42,11 +42,11 @@ LIBOBJ= set_key.o ecb_enc.o cbc_enc.o \ ofb_enc.o str2key.o pcbc_enc.o qud_cksm.o rand_key.o \ ${DES_ENC} \ fcrypt.o xcbc_enc.o rpc_enc.o cbc_cksm.o \ - ede_cbcm_enc.o + ede_cbcm_enc.o des_old.o SRC= $(LIBSRC) -EXHEADER= des.h +EXHEADER= des.h des_old.h HEADER= des_locl.h rpc_des.h spr.h des_ver.h $(EXHEADER) ALL= $(GENERAL) $(SRC) $(HEADER) diff --git a/crypto/des/asm/des-586.pl b/crypto/des/asm/des-586.pl index c890766bc9..28b877a167 100644 --- a/crypto/des/asm/des-586.pl +++ b/crypto/des/asm/des-586.pl @@ -20,16 +20,16 @@ $L="edi"; $R="esi"; &external_label("des_SPtrans"); -&des_encrypt("des_encrypt1",1); -&des_encrypt("des_encrypt2",0); -&des_encrypt3("des_encrypt3",1); -&des_encrypt3("des_decrypt3",0); -&cbc("des_ncbc_encrypt","des_encrypt1","des_encrypt1",0,4,5,3,5,-1); -&cbc("des_ede3_cbc_encrypt","des_encrypt3","des_decrypt3",0,6,7,3,4,5); +&DES_encrypt("DES_encrypt1",1); +&DES_encrypt("DES_encrypt2",0); +&DES_encrypt3("DES_encrypt3",1); +&DES_encrypt3("DES_decrypt3",0); +&cbc("DES_ncbc_encrypt","DES_encrypt1","DES_encrypt1",0,4,5,3,5,-1); +&cbc("DES_ede3_cbc_encrypt","DES_encrypt3","DES_decrypt3",0,6,7,3,4,5); &asm_finish(); -sub des_encrypt +sub DES_encrypt { local($name,$do_ip)=@_; diff --git a/crypto/des/asm/des686.pl b/crypto/des/asm/des686.pl index 84c3e85438..f6dbab3315 100644 --- a/crypto/des/asm/des686.pl +++ b/crypto/des/asm/des686.pl @@ -46,15 +46,15 @@ EOF $L="edi"; $R="esi"; -&des_encrypt("des_encrypt1",1); -&des_encrypt("des_encrypt2",0); +&DES_encrypt("DES_encrypt1",1); +&DES_encrypt("DES_encrypt2",0); -&des_encrypt3("des_encrypt3",1); -&des_encrypt3("des_decrypt3",0); +&DES_encrypt3("DES_encrypt3",1); +&DES_encrypt3("DES_decrypt3",0); &file_end(); -sub des_encrypt +sub DES_encrypt { local($name,$do_ip)=@_; diff --git a/crypto/des/asm/desboth.pl b/crypto/des/asm/desboth.pl index d5106414db..eec00886e4 100644 --- a/crypto/des/asm/desboth.pl +++ b/crypto/des/asm/desboth.pl @@ -3,7 +3,7 @@ $L="edi"; $R="esi"; -sub des_encrypt3 +sub DES_encrypt3 { local($name,$enc)=@_; @@ -47,15 +47,15 @@ sub des_encrypt3 &mov(&swtmp(2), (DWC(($enc)?"1":"0"))); &mov(&swtmp(1), "eax"); &mov(&swtmp(0), "ebx"); - &call("des_encrypt2"); + &call("DES_encrypt2"); &mov(&swtmp(2), (DWC(($enc)?"0":"1"))); &mov(&swtmp(1), "edi"); &mov(&swtmp(0), "ebx"); - &call("des_encrypt2"); + &call("DES_encrypt2"); &mov(&swtmp(2), (DWC(($enc)?"1":"0"))); &mov(&swtmp(1), "esi"); &mov(&swtmp(0), "ebx"); - &call("des_encrypt2"); + &call("DES_encrypt2"); &stack_pop(3); &mov($L,&DWP(0,"ebx","",0)); diff --git a/crypto/des/cbc3_enc.c b/crypto/des/cbc3_enc.c index c7cc7c1706..b5db4e14f7 100644 --- a/crypto/des/cbc3_enc.c +++ b/crypto/des/cbc3_enc.c @@ -59,41 +59,41 @@ #include "des_locl.h" /* HAS BUGS! DON'T USE - this is only present for use in des.c */ -void des_3cbc_encrypt(des_cblock *input, des_cblock *output, long length, - des_key_schedule ks1, des_key_schedule ks2, des_cblock *iv1, - des_cblock *iv2, int enc) +void DES_3cbc_encrypt(DES_cblock *input, DES_cblock *output, long length, + DES_key_schedule ks1, DES_key_schedule ks2, DES_cblock *iv1, + DES_cblock *iv2, int enc) { int off=((int)length-1)/8; long l8=((length+7)/8)*8; - des_cblock niv1,niv2; + DES_cblock niv1,niv2; if (enc == DES_ENCRYPT) { - des_cbc_encrypt((unsigned char*)input, + DES_cbc_encrypt((unsigned char*)input, (unsigned char*)output,length,&ks1,iv1,enc); - if (length >= sizeof(des_cblock)) - memcpy(niv1,output[off],sizeof(des_cblock)); - des_cbc_encrypt((unsigned char*)output, + if (length >= sizeof(DES_cblock)) + memcpy(niv1,output[off],sizeof(DES_cblock)); + DES_cbc_encrypt((unsigned char*)output, (unsigned char*)output,l8,&ks2,iv1,!enc); - des_cbc_encrypt((unsigned char*)output, + DES_cbc_encrypt((unsigned char*)output, (unsigned char*)output,l8,&ks1,iv2,enc); - if (length >= sizeof(des_cblock)) - memcpy(niv2,output[off],sizeof(des_cblock)); + if (length >= sizeof(DES_cblock)) + memcpy(niv2,output[off],sizeof(DES_cblock)); } else { - if (length >= sizeof(des_cblock)) - memcpy(niv2,input[off],sizeof(des_cblock)); - des_cbc_encrypt((unsigned char*)input, + if (length >= sizeof(DES_cblock)) + memcpy(niv2,input[off],sizeof(DES_cblock)); + DES_cbc_encrypt((unsigned char*)input, (unsigned char*)output,l8,&ks1,iv2,enc); - des_cbc_encrypt((unsigned char*)output, + DES_cbc_encrypt((unsigned char*)output, (unsigned char*)output,l8,&ks2,iv1,!enc); - if (length >= sizeof(des_cblock)) - memcpy(niv1,output[off],sizeof(des_cblock)); - des_cbc_encrypt((unsigned char*)output, + if (length >= sizeof(DES_cblock)) + memcpy(niv1,output[off],sizeof(DES_cblock)); + DES_cbc_encrypt((unsigned char*)output, (unsigned char*)output,length,&ks1,iv1,enc); } - memcpy(*iv1,niv1,sizeof(des_cblock)); - memcpy(*iv2,niv2,sizeof(des_cblock)); + memcpy(*iv1,niv1,sizeof(DES_cblock)); + memcpy(*iv2,niv2,sizeof(DES_cblock)); } diff --git a/crypto/des/cbc_cksm.c b/crypto/des/cbc_cksm.c index 69efc56b16..6c5305b99d 100644 --- a/crypto/des/cbc_cksm.c +++ b/crypto/des/cbc_cksm.c @@ -58,9 +58,9 @@ #include "des_locl.h" -DES_LONG des_cbc_cksum(const unsigned char *in, des_cblock *output, - long length, des_key_schedule *schedule, - const_des_cblock *ivec) +DES_LONG DES_cbc_cksum(const unsigned char *in, DES_cblock *output, + long length, DES_key_schedule *schedule, + const_DES_cblock *ivec) { register DES_LONG tout0,tout1,tin0,tin1; register long l=length; @@ -82,7 +82,7 @@ DES_LONG des_cbc_cksum(const unsigned char *in, des_cblock *output, tin0^=tout0; tin[0]=tin0; tin1^=tout1; tin[1]=tin1; - des_encrypt1((DES_LONG *)tin,schedule,DES_ENCRYPT); + DES_encrypt1((DES_LONG *)tin,schedule,DES_ENCRYPT); /* fix 15/10/91 eay - thanks to keithr@sco.COM */ tout0=tin[0]; tout1=tin[1]; diff --git a/crypto/des/cfb64ede.c b/crypto/des/cfb64ede.c index f9d13ef90a..60c1aa08db 100644 --- a/crypto/des/cfb64ede.c +++ b/crypto/des/cfb64ede.c @@ -63,10 +63,10 @@ * 64bit block we have used is contained in *num; */ -void des_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, des_key_schedule *ks1, - des_key_schedule *ks2, des_key_schedule *ks3, - des_cblock *ivec, int *num, int enc) +void DES_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out, + long length, DES_key_schedule *ks1, + DES_key_schedule *ks2, DES_key_schedule *ks3, + DES_cblock *ivec, int *num, int enc) { register DES_LONG v0,v1; register long l=length; @@ -86,7 +86,7 @@ void des_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out, ti[0]=v0; ti[1]=v1; - des_encrypt3(ti,ks1,ks2,ks3); + DES_encrypt3(ti,ks1,ks2,ks3); v0=ti[0]; v1=ti[1]; @@ -112,7 +112,7 @@ void des_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out, ti[0]=v0; ti[1]=v1; - des_encrypt3(ti,ks1,ks2,ks3); + DES_encrypt3(ti,ks1,ks2,ks3); v0=ti[0]; v1=ti[1]; @@ -133,10 +133,10 @@ void des_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out, } #ifdef undef /* MACRO */ -void des_ede2_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, - des_key_schedule ks1, des_key_schedule ks2, des_cblock (*ivec), +void DES_ede2_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, + DES_key_schedule ks1, DES_key_schedule ks2, DES_cblock (*ivec), int *num, int enc) { - des_ede3_cfb64_encrypt(in,out,length,ks1,ks2,ks1,ivec,num,enc); + DES_ede3_cfb64_encrypt(in,out,length,ks1,ks2,ks1,ivec,num,enc); } #endif diff --git a/crypto/des/cfb64enc.c b/crypto/des/cfb64enc.c index 6061fb2e11..5ec8683e40 100644 --- a/crypto/des/cfb64enc.c +++ b/crypto/des/cfb64enc.c @@ -63,9 +63,9 @@ * 64bit block we have used is contained in *num; */ -void des_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, des_key_schedule *schedule, - des_cblock *ivec, int *num, int enc) +void DES_cfb64_encrypt(const unsigned char *in, unsigned char *out, + long length, DES_key_schedule *schedule, + DES_cblock *ivec, int *num, int enc) { register DES_LONG v0,v1; register long l=length; @@ -82,7 +82,7 @@ void des_cfb64_encrypt(const unsigned char *in, unsigned char *out, { c2l(iv,v0); ti[0]=v0; c2l(iv,v1); ti[1]=v1; - des_encrypt1(ti,schedule,DES_ENCRYPT); + DES_encrypt1(ti,schedule,DES_ENCRYPT); iv = &(*ivec)[0]; v0=ti[0]; l2c(v0,iv); v0=ti[1]; l2c(v0,iv); @@ -102,7 +102,7 @@ void des_cfb64_encrypt(const unsigned char *in, unsigned char *out, { c2l(iv,v0); ti[0]=v0; c2l(iv,v1); ti[1]=v1; - des_encrypt1(ti,schedule,DES_ENCRYPT); + DES_encrypt1(ti,schedule,DES_ENCRYPT); iv = &(*ivec)[0]; v0=ti[0]; l2c(v0,iv); v0=ti[1]; l2c(v0,iv); diff --git a/crypto/des/cfb_enc.c b/crypto/des/cfb_enc.c index 4af6f7fbf8..17bf77ca9e 100644 --- a/crypto/des/cfb_enc.c +++ b/crypto/des/cfb_enc.c @@ -64,8 +64,8 @@ * the second. The second 12 bits will come from the 3rd and half the 4th * byte. */ -void des_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, - long length, des_key_schedule *schedule, des_cblock *ivec, int enc) +void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, + long length, DES_key_schedule *schedule, DES_cblock *ivec, int enc) { register DES_LONG d0,d1,v0,v1,n=(numbits+7)/8; register DES_LONG mask0,mask1; @@ -100,7 +100,7 @@ void des_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, l-=n; ti[0]=v0; ti[1]=v1; - des_encrypt1((DES_LONG *)ti,schedule,DES_ENCRYPT); + DES_encrypt1((DES_LONG *)ti,schedule,DES_ENCRYPT); c2ln(in,d0,d1,n); in+=n; d0=(d0^ti[0])&mask0; @@ -132,7 +132,7 @@ void des_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, l-=n; ti[0]=v0; ti[1]=v1; - des_encrypt1((DES_LONG *)ti,schedule,DES_ENCRYPT); + DES_encrypt1((DES_LONG *)ti,schedule,DES_ENCRYPT); c2ln(in,d0,d1,n); in+=n; /* 30-08-94 - eay - changed because l>>32 and diff --git a/crypto/des/des.c b/crypto/des/des.c index 16e5ab9eb2..a03ce161af 100644 --- a/crypto/des/des.c +++ b/crypto/des/des.c @@ -97,9 +97,9 @@ void uufwriteEnd(FILE *fp); int uufread(unsigned char *out,int size,unsigned int num,FILE *fp); int uuencode(unsigned char *in,int num,unsigned char *out); int uudecode(unsigned char *in,int num,unsigned char *out); -void des_3cbc_encrypt(des_cblock *input,des_cblock *output,long length, - des_key_schedule sk1,des_key_schedule sk2, - des_cblock *ivec1,des_cblock *ivec2,int enc); +void DES_3cbc_encrypt(DES_cblock *input,DES_cblock *output,long length, + DES_key_schedule sk1,DES_key_schedule sk2, + DES_cblock *ivec1,DES_cblock *ivec2,int enc); #ifdef OPENSSL_SYS_VMS #define EXIT(a) exit(a&0x10000000L) #else @@ -120,7 +120,7 @@ int uubufnum=0; #define OUTUUBUF (65*100) unsigned char b[OUTUUBUF]; unsigned char bb[300]; -des_cblock cksum={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; +DES_cblock cksum={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; char cksumname[200]=""; int vflag,cflag,eflag,dflag,kflag,bflag,fflag,sflag,uflag,flag3,hflag,error; @@ -361,11 +361,11 @@ void doencryption(void) #endif register int i; - des_key_schedule ks,ks2; - des_cblock iv,iv2; + DES_key_schedule ks,ks2; + DES_cblock iv,iv2; char *p; int num=0,j,k,l,rem,ll,len,last,ex=0; - des_cblock kk,k2; + DES_cblock kk,k2; FILE *O; int Exit=0; #ifndef OPENSSL_SYS_MSDOS @@ -423,19 +423,19 @@ void doencryption(void) else k2[i-8]=k; } - des_set_key_unchecked(&k2,&ks2); + DES_set_key_unchecked(&k2,&ks2); memset(k2,0,sizeof(k2)); } else if (longk || flag3) { if (flag3) { - des_string_to_2keys(key,&kk,&k2); - des_set_key_unchecked(&k2,&ks2); + DES_string_to_2keys(key,&kk,&k2); + DES_set_key_unchecked(&k2,&ks2); memset(k2,0,sizeof(k2)); } else - des_string_to_key(key,&kk); + DES_string_to_key(key,&kk); } else for (i=0; i<KEYSIZ; i++) @@ -453,7 +453,7 @@ void doencryption(void) kk[i]=key[i]|0x80; } - des_set_key_unchecked(&kk,&ks); + DES_set_key_unchecked(&kk,&ks); memset(key,0,sizeof(key)); memset(kk,0,sizeof(kk)); /* woops - A bug that does not showup under unix :-( */ @@ -492,7 +492,7 @@ void doencryption(void) if (cflag) { - des_cbc_cksum(buf,&cksum, + DES_cbc_cksum(buf,&cksum, (long)len,&ks,&cksum); if (!eflag) { @@ -503,15 +503,15 @@ void doencryption(void) if (bflag && !flag3) for (i=0; i<l; i+=8) - des_ecb_encrypt( - (des_cblock *)&(buf[i]), - (des_cblock *)&(obuf[i]), + DES_ecb_encrypt( + (DES_cblock *)&(buf[i]), + (DES_cblock *)&(obuf[i]), &ks,do_encrypt); else if (flag3 && bflag) for (i=0; i<l; i+=8) - des_ecb2_encrypt( - (des_cblock *)&(buf[i]), - (des_cblock *)&(obuf[i]), + DES_ecb2_encrypt( + (DES_cblock *)&(buf[i]), + (DES_cblock *)&(obuf[i]), &ks,&ks2,do_encrypt); else if (flag3 && !bflag) { @@ -519,8 +519,8 @@ void doencryption(void) if (rem) memcpy(tmpbuf,&(buf[l]), (unsigned int)rem); - des_3cbc_encrypt( - (des_cblock *)buf,(des_cblock *)obuf, + DES_3cbc_encrypt( + (DES_cblock *)buf,(DES_cblock *)obuf, (long)l,ks,ks2,&iv, &iv2,do_encrypt); if (rem) memcpy(&(buf[l]),tmpbuf, @@ -528,7 +528,7 @@ void doencryption(void) } else { - des_cbc_encrypt( + DES_cbc_encrypt( buf,obuf, (long)l,&ks,&iv,do_encrypt); if (l >= 8) memcpy(iv,&(obuf[l-8]),8); @@ -582,26 +582,26 @@ void doencryption(void) if (bflag && !flag3) for (i=0; i<l; i+=8) - des_ecb_encrypt( - (des_cblock *)&(buf[i]), - (des_cblock *)&(obuf[i]), + DES_ecb_encrypt( + (DES_cblock *)&(buf[i]), + (DES_cblock *)&(obuf[i]), &ks,do_encrypt); else if (flag3 && bflag) for (i=0; i<l; i+=8) - des_ecb2_encrypt( - (des_cblock *)&(buf[i]), - (des_cblock *)&(obuf[i]), + DES_ecb2_encrypt( + (DES_cblock *)&(buf[i]), + (DES_cblock *)&(obuf[i]), &ks,&ks2,do_encrypt); else if (flag3 && !bflag) { - des_3cbc_encrypt( - (des_cblock *)buf,(des_cblock *)obuf, + DES_3cbc_encrypt( + (DES_cblock *)buf,(DES_cblock *)obuf, (long)l,ks,ks2,&iv, &iv2,do_encrypt); } else { - des_cbc_encrypt( + DES_cbc_encrypt( buf,obuf, (long)l,&ks,&iv,do_encrypt); if (l >= 8) memcpy(iv,&(buf[l-8]),8); @@ -628,9 +628,9 @@ void doencryption(void) l=l-8+last; } i=0; - if (cflag) des_cbc_cksum(obuf, - (des_cblock *)cksum,(long)l/8*8,&ks, - (des_cblock *)cksum); + if (cflag) DES_cbc_cksum(obuf, + (DES_cblock *)cksum,(long)l/8*8,&ks, + (DES_cblock *)cksum); while (i != l) { j=fwrite(obuf,1,(unsigned int)l-i,DES_OUT); diff --git a/crypto/des/des.h b/crypto/des/des.h index d1ad912b1a..68fd355c79 100644 --- a/crypto/des/des.h +++ b/crypto/des/des.h @@ -63,10 +63,6 @@ #error DES is disabled. #endif -#ifdef _KERBEROS_DES_H -#error <openssl/des.h> replaces <kerberos/des.h>. -#endif - #include <openssl/opensslconf.h> /* DES_LONG */ #include <openssl/e_os2.h> /* OPENSSL_EXTERN */ @@ -79,24 +75,24 @@ extern "C" { #endif -typedef unsigned char des_cblock[8]; -typedef /* const */ unsigned char const_des_cblock[8]; -/* With "const", gcc 2.8.1 on Solaris thinks that des_cblock * - * and const_des_cblock * are incompatible pointer types. */ +typedef unsigned char DES_cblock[8]; +typedef /* const */ unsigned char const_DES_cblock[8]; +/* With "const", gcc 2.8.1 on Solaris thinks that DES_cblock * + * and const_DES_cblock * are incompatible pointer types. */ -typedef struct des_ks +typedef struct DES_ks { union { - des_cblock cblock; + DES_cblock cblock; /* make sure things are correct size on machines with * 8 byte longs */ DES_LONG deslong[2]; } ks[16]; - } des_key_schedule; + } DES_key_schedule; -#define DES_KEY_SZ (sizeof(des_cblock)) -#define DES_SCHEDULE_SZ (sizeof(des_key_schedule)) +#define DES_KEY_SZ (sizeof(DES_cblock)) +#define DES_SCHEDULE_SZ (sizeof(DES_key_schedule)) #define DES_ENCRYPT 1 #define DES_DECRYPT 0 @@ -104,45 +100,45 @@ typedef struct des_ks #define DES_CBC_MODE 0 #define DES_PCBC_MODE 1 -#define des_ecb2_encrypt(i,o,k1,k2,e) \ - des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e)) - -#define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \ - des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e)) - -#define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \ - des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e)) - -#define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \ - des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n)) - -OPENSSL_DECLARE_GLOBAL(int,des_check_key); /* defaults to false */ -#define des_check_key OPENSSL_GLOBAL_REF(des_check_key) -OPENSSL_DECLARE_GLOBAL(int,des_rw_mode); /* defaults to DES_PCBC_MODE */ -#define des_rw_mode OPENSSL_GLOBAL_REF(des_rw_mode) - -const char *des_options(void); -void des_ecb3_encrypt(const_des_cblock *input, des_cblock *output, - des_key_schedule *ks1,des_key_schedule *ks2, - des_key_schedule *ks3, int enc); -DES_LONG des_cbc_cksum(const unsigned char *input,des_cblock *output, - long length,des_key_schedule *schedule, - const_des_cblock *ivec); -/* des_cbc_encrypt does not update the IV! Use des_ncbc_encrypt instead. */ -void des_cbc_encrypt(const unsigned char *input,unsigned char *output, - long length,des_key_schedule *schedule,des_cblock *ivec, +#define DES_ecb2_encrypt(i,o,k1,k2,e) \ + DES_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e)) + +#define DES_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \ + DES_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e)) + +#define DES_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \ + DES_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e)) + +#define DES_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \ + DES_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n)) + +OPENSSL_DECLARE_GLOBAL(int,DES_check_key); /* defaults to false */ +#define DES_check_key OPENSSL_GLOBAL_REF(DES_check_key) +OPENSSL_DECLARE_GLOBAL(int,DES_rw_mode); /* defaults to DES_PCBC_MODE */ +#define DES_rw_mode OPENSSL_GLOBAL_REF(DES_rw_mode) + +const char *DES_options(void); +void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output, + DES_key_schedule *ks1,DES_key_schedule *ks2, + DES_key_schedule *ks3, int enc); +DES_LONG DES_cbc_cksum(const unsigned char *input,DES_cblock *output, + long length,DES_key_schedule *schedule, + const_DES_cblock *ivec); +/* DES_cbc_encrypt does not update the IV! Use DES_ncbc_encrypt instead. */ +void DES_cbc_encrypt(const unsigned char *input,unsigned char *output, + long length,DES_key_schedule *schedule,DES_cblock *ivec, int enc); -void des_ncbc_encrypt(const unsigned char *input,unsigned char *output, - long length,des_key_schedule *schedule,des_cblock *ivec, +void DES_ncbc_encrypt(const unsigned char *input,unsigned char *output, + long length,DES_key_schedule *schedule,DES_cblock *ivec, int enc); -void des_xcbc_encrypt(const unsigned char *input,unsigned char *output, - long length,des_key_schedule *schedule,des_cblock *ivec, - const_des_cblock *inw,const_des_cblock *outw,int enc); -void des_cfb_encrypt(const unsigned char *in,unsigned char *out,int numbits, - long length,des_key_schedule *schedule,des_cblock *ivec, +void DES_xcbc_encrypt(const unsigned char *input,unsigned char *output, + long length,DES_key_schedule *schedule,DES_cblock *ivec, + const_DES_cblock *inw,const_DES_cblock *outw,int enc); +void DES_cfb_encrypt(const unsigned char *in,unsigned char *out,int numbits, + long length,DES_key_schedule *schedule,DES_cblock *ivec, int enc); -void des_ecb_encrypt(const_des_cblock *input,des_cblock *output, - des_key_schedule *ks,int enc); +void DES_ecb_encrypt(const_DES_cblock *input,DES_cblock *output, + DES_key_schedule *ks,int enc); /* This is the DES encryption function that gets called by just about every other DES routine in the library. You should not use this @@ -151,112 +147,78 @@ void des_ecb_encrypt(const_des_cblock *input,des_cblock *output, long, and this needs to be done to make sure 'non-aligned' memory access do not occur. The characters are loaded 'little endian'. Data is a pointer to 2 unsigned long's and ks is the - des_key_schedule to use. enc, is non zero specifies encryption, + DES_key_schedule to use. enc, is non zero specifies encryption, zero if decryption. */ -void des_encrypt1(DES_LONG *data,des_key_schedule *ks, int enc); +void DES_encrypt1(DES_LONG *data,DES_key_schedule *ks, int enc); -/* This functions is the same as des_encrypt1() except that the DES +/* This functions is the same as DES_encrypt1() except that the DES initial permutation (IP) and final permutation (FP) have been left - out. As for des_encrypt1(), you should not use this function. + out. As for DES_encrypt1(), you should not use this function. It is used by the routines in the library that implement triple DES. - IP() des_encrypt2() des_encrypt2() des_encrypt2() FP() is the same - as des_encrypt1() des_encrypt1() des_encrypt1() except faster :-). */ -void des_encrypt2(DES_LONG *data,des_key_schedule *ks, int enc); - -void des_encrypt3(DES_LONG *data, des_key_schedule *ks1, - des_key_schedule *ks2, des_key_schedule *ks3); -void des_decrypt3(DES_LONG *data, des_key_schedule *ks1, - des_key_schedule *ks2, des_key_schedule *ks3); -void des_ede3_cbc_encrypt(const unsigned char *input,unsigned char *output, + IP() DES_encrypt2() DES_encrypt2() DES_encrypt2() FP() is the same + as DES_encrypt1() DES_encrypt1() DES_encrypt1() except faster :-). */ +void DES_encrypt2(DES_LONG *data,DES_key_schedule *ks, int enc); + +void DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1, + DES_key_schedule *ks2, DES_key_schedule *ks3); +void DES_decrypt3(DES_LONG *data, DES_key_schedule *ks1 |