From 4e31df2cd73dbb659fd8a6eca6270fac661c072d Mon Sep 17 00:00:00 2001 From: Ben Laurie Date: Sat, 13 Feb 1999 18:52:38 +0000 Subject: [PATCH] Fix ghastly DES declarations, and all consequential warnings. --- CHANGES | 6 ++ apps/speed.c | 19 ++--- crypto/des/cbc_cksm.c | 13 +-- crypto/des/cbc_enc.c | 15 ++-- crypto/des/cfb64ede.c | 18 ++-- crypto/des/cfb64enc.c | 20 ++--- crypto/des/cfb_enc.c | 8 +- crypto/des/destest.c | 170 +++++++++++++++++--------------------- crypto/des/ecb3_enc.c | 9 +- crypto/des/ecb_enc.c | 9 +- crypto/des/ede_cbcm_enc.c | 17 ++-- crypto/des/enc_read.c | 28 +++---- crypto/des/enc_writ.c | 19 ++--- crypto/des/fcrypt.c | 2 +- crypto/des/ofb64ede.c | 10 +-- crypto/des/ofb64enc.c | 16 ++-- crypto/des/ofb_enc.c | 8 +- crypto/des/pcbc_enc.c | 6 +- crypto/des/qud_cksm.c | 14 ++-- crypto/des/rand_key.c | 14 ++-- crypto/des/read2pwd.c | 10 +-- crypto/des/read_pwd.c | 2 +- crypto/des/rpc_enc.c | 12 ++- crypto/des/set_key.c | 16 ++-- crypto/des/str2key.c | 53 ++++++------ crypto/des/supp.c | 4 +- crypto/des/xcbc_enc.c | 55 ++++++------ crypto/evp/e_cbc_3d.c | 16 ++-- crypto/evp/e_cfb_d.c | 4 +- crypto/evp/e_ecb_3d.c | 13 ++- crypto/evp/e_ecb_d.c | 6 +- crypto/evp/e_xcbc_d.c | 12 ++- crypto/mdc2/mdc2dgst.c | 16 ++-- crypto/objects/obj_dat.h | 2 +- 34 files changed, 291 insertions(+), 351 deletions(-) diff --git a/CHANGES b/CHANGES index 229351b119..f8b587975f 100644 --- a/CHANGES +++ b/CHANGES @@ -5,6 +5,12 @@ Changes between 0.9.1c and 0.9.2 + *) Major rework of DES function declarations, in the pursuit of correctness + and purity. As a result, many evil casts evaporated, and some weirdness, + too. You may find this causes warnings in your code. Zapping your evil + casts will probably fix them. Mostly. + [Ben Laurie] + *) Fix for a typo in asn1.h. Bug fix to object creation script obj_dat.pl. It considered a zero in an object definition to mean "end of object": none of the objects in objects.h have any zeros diff --git a/apps/speed.c b/apps/speed.c index 1a1ae72c26..35f8398b53 100644 --- a/apps/speed.c +++ b/apps/speed.c @@ -601,9 +601,9 @@ char **argv; #endif #ifndef NO_DES - des_set_key((C_Block *)key,sch); - des_set_key((C_Block *)key2,sch2); - des_set_key((C_Block *)key3,sch3); + des_set_key(key,sch); + des_set_key(key2,sch2); + des_set_key(key3,sch3); #endif #ifndef NO_IDEA idea_set_encrypt_key(key16,&idea_ks); @@ -851,10 +851,8 @@ char **argv; print_message(names[D_CBC_DES],c[D_CBC_DES][j],lengths[j]); Time_F(START); for (count=0,run=1; COND(c[D_CBC_DES][j]); count++) - des_ncbc_encrypt((C_Block *)buf, - (C_Block *)buf, - (long)lengths[j],sch, - (C_Block *)&(iv[0]),DES_ENCRYPT); + des_ncbc_encrypt(buf,buf,lengths[j],sch, + &(iv[0]),DES_ENCRYPT); d=Time_F(STOP); BIO_printf(bio_err,"%ld %s's in %.2fs\n", count,names[D_CBC_DES],d); @@ -869,10 +867,9 @@ char **argv; print_message(names[D_EDE3_DES],c[D_EDE3_DES][j],lengths[j]); Time_F(START); for (count=0,run=1; COND(c[D_EDE3_DES][j]); count++) - des_ede3_cbc_encrypt((C_Block *)buf, - (C_Block *)buf, - (long)lengths[j],sch,sch2,sch3, - (C_Block *)&(iv[0]),DES_ENCRYPT); + des_ede3_cbc_encrypt(buf,buf,lengths[j], + sch,sch2,sch3, + &(iv[0]),DES_ENCRYPT); d=Time_F(STOP); BIO_printf(bio_err,"%ld %s's in %.2fs\n", count,names[D_EDE3_DES],d); diff --git a/crypto/des/cbc_cksm.c b/crypto/des/cbc_cksm.c index edfdec8a0f..c41d51af4b 100644 --- a/crypto/des/cbc_cksm.c +++ b/crypto/des/cbc_cksm.c @@ -58,21 +58,16 @@ #include "des_locl.h" -DES_LONG des_cbc_cksum(input, output, length, schedule, ivec) -des_cblock (*input); -des_cblock (*output); +DES_LONG des_cbc_cksum(in, out, length, schedule, iv) +const unsigned char *in; +des_cblock out; long length; des_key_schedule schedule; -des_cblock (*ivec); +des_cblock iv; { register DES_LONG tout0,tout1,tin0,tin1; register long l=length; DES_LONG tin[2]; - unsigned char *in,*out,*iv; - - in=(unsigned char *)input; - out=(unsigned char *)output; - iv=(unsigned char *)ivec; c2l(iv,tout0); c2l(iv,tout1); diff --git a/crypto/des/cbc_enc.c b/crypto/des/cbc_enc.c index a84a53633c..96939f34df 100644 --- a/crypto/des/cbc_enc.c +++ b/crypto/des/cbc_enc.c @@ -58,24 +58,23 @@ #include "des_locl.h" -void des_cbc_encrypt(input, output, length, schedule, ivec, enc) -des_cblock (*input); -des_cblock (*output); +/* Note that this is inconsistent with other DES functions, in that it doesn't + update ivec */ +void des_cbc_encrypt(in, out, length, schedule, ivec, enc) +const unsigned char *in; +unsigned char *out; long length; des_key_schedule schedule; -des_cblock (*ivec); +des_cblock ivec; int enc; { register DES_LONG tin0,tin1; register DES_LONG tout0,tout1,xor0,xor1; - register unsigned char *in,*out; register long l=length; DES_LONG tin[2]; unsigned char *iv; - in=(unsigned char *)input; - out=(unsigned char *)output; - iv=(unsigned char *)ivec; + iv=ivec; if (enc) { diff --git a/crypto/des/cfb64ede.c b/crypto/des/cfb64ede.c index 80b8a9eaaa..f19a55ef52 100644 --- a/crypto/des/cfb64ede.c +++ b/crypto/des/cfb64ede.c @@ -64,11 +64,11 @@ */ void des_ede3_cfb64_encrypt(in, out, length, ks1,ks2,ks3, ivec, num, enc) -unsigned char *in; +const unsigned char *in; unsigned char *out; long length; des_key_schedule ks1,ks2,ks3; -des_cblock (*ivec); +des_cblock ivec; int *num; int enc; { @@ -78,7 +78,7 @@ int enc; DES_LONG ti[2]; unsigned char *iv,c,cc; - iv=(unsigned char *)ivec; + iv=ivec; if (enc) { while (l--) @@ -90,14 +90,14 @@ int enc; ti[0]=v0; ti[1]=v1; - des_encrypt3((DES_LONG *)ti,ks1,ks2,ks3); + des_encrypt3(ti,ks1,ks2,ks3); v0=ti[0]; v1=ti[1]; - iv=(unsigned char *)ivec; + iv=ivec; l2c(v0,iv); l2c(v1,iv); - iv=(unsigned char *)ivec; + iv=ivec; } c= *(in++)^iv[n]; *(out++)=c; @@ -116,14 +116,14 @@ int enc; ti[0]=v0; ti[1]=v1; - des_encrypt3((DES_LONG *)ti,ks1,ks2,ks3); + des_encrypt3(ti,ks1,ks2,ks3); v0=ti[0]; v1=ti[1]; - iv=(unsigned char *)ivec; + iv=ivec; l2c(v0,iv); l2c(v1,iv); - iv=(unsigned char *)ivec; + iv=ivec; } cc= *(in++); c=iv[n]; diff --git a/crypto/des/cfb64enc.c b/crypto/des/cfb64enc.c index 403da479df..9434ddad9e 100644 --- a/crypto/des/cfb64enc.c +++ b/crypto/des/cfb64enc.c @@ -64,11 +64,11 @@ */ void des_cfb64_encrypt(in, out, length, schedule, ivec, num, enc) -unsigned char *in; +const unsigned char *in; unsigned char *out; long length; des_key_schedule schedule; -des_cblock (*ivec); +des_cblock ivec; int *num; int enc; { @@ -78,7 +78,7 @@ int enc; DES_LONG ti[2]; unsigned char *iv,c,cc; - iv=(unsigned char *)ivec; + iv=ivec; if (enc) { while (l--) @@ -87,12 +87,11 @@ int enc; { c2l(iv,v0); ti[0]=v0; c2l(iv,v1); ti[1]=v1; - des_encrypt((DES_LONG *)ti, - schedule,DES_ENCRYPT); - iv=(unsigned char *)ivec; + des_encrypt(ti,schedule,DES_ENCRYPT); + iv=ivec; v0=ti[0]; l2c(v0,iv); v0=ti[1]; l2c(v0,iv); - iv=(unsigned char *)ivec; + iv=ivec; } c= *(in++)^iv[n]; *(out++)=c; @@ -108,12 +107,11 @@ int enc; { c2l(iv,v0); ti[0]=v0; c2l(iv,v1); ti[1]=v1; - des_encrypt((DES_LONG *)ti, - schedule,DES_ENCRYPT); - iv=(unsigned char *)ivec; + des_encrypt(ti,schedule,DES_ENCRYPT); + iv=ivec; v0=ti[0]; l2c(v0,iv); v0=ti[1]; l2c(v0,iv); - iv=(unsigned char *)ivec; + iv=ivec; } cc= *(in++); c=iv[n]; diff --git a/crypto/des/cfb_enc.c b/crypto/des/cfb_enc.c index 342e785691..df0c65ee82 100644 --- a/crypto/des/cfb_enc.c +++ b/crypto/des/cfb_enc.c @@ -65,12 +65,12 @@ * byte. */ void des_cfb_encrypt(in, out, numbits, length, schedule, ivec, enc) -unsigned char *in; +const unsigned char *in; unsigned char *out; int numbits; long length; des_key_schedule schedule; -des_cblock (*ivec); +des_cblock ivec; int enc; { register DES_LONG d0,d1,v0,v1,n=(numbits+7)/8; @@ -96,7 +96,7 @@ int enc; mask1=0x00000000L; } - iv=(unsigned char *)ivec; + iv=ivec; c2l(iv,v0); c2l(iv,v1); if (enc) @@ -163,7 +163,7 @@ int enc; out+=n; } } - iv=(unsigned char *)ivec; + iv=ivec; l2c(v0,iv); l2c(v1,iv); v0=v1=d0=d1=ti[0]=ti[1]=0; diff --git a/crypto/des/destest.c b/crypto/des/destest.c index d915c7a22f..0e7801d1e5 100644 --- a/crypto/des/destest.c +++ b/crypto/des/destest.c @@ -329,17 +329,17 @@ char *argv[]; char *str; printf("Doing cbcm\n"); - if ((j=des_key_sched((C_Block *)cbc_key,ks)) != 0) + if ((j=des_key_sched(cbc_key,ks)) != 0) { printf("Key error %d\n",j); err=1; } - if ((j=des_key_sched((C_Block *)cbc2_key,ks2)) != 0) + if ((j=des_key_sched(cbc2_key,ks2)) != 0) { printf("Key error %d\n",j); err=1; } - if ((j=des_key_sched((C_Block *)cbc3_key,ks3)) != 0) + if ((j=des_key_sched(cbc3_key,ks3)) != 0) { printf("Key error %d\n",j); err=1; @@ -383,7 +383,7 @@ char *argv[]; printf("Doing ecb\n"); for (i=0; i>num)|(vv0<<(32-num)))&0xffffffffL; } } - iv=(unsigned char *)ivec; + iv=ivec; l2c(v0,iv); l2c(v1,iv); v0=v1=d0=d1=ti[0]=ti[1]=vv0=vv1=0; diff --git a/crypto/des/pcbc_enc.c b/crypto/des/pcbc_enc.c index 4513207d90..850717cc57 100644 --- a/crypto/des/pcbc_enc.c +++ b/crypto/des/pcbc_enc.c @@ -59,11 +59,11 @@ #include "des_locl.h" void des_pcbc_encrypt(input, output, length, schedule, ivec, enc) -des_cblock (*input); -des_cblock (*output); +const unsigned char *input; +unsigned char *output; long length; des_key_schedule schedule; -des_cblock (*ivec); +des_cblock ivec; int enc; { register DES_LONG sin0,sin1,xor0,xor1,tout0,tout1; diff --git a/crypto/des/qud_cksm.c b/crypto/des/qud_cksm.c index 8526abf334..4d5301c241 100644 --- a/crypto/des/qud_cksm.c +++ b/crypto/des/qud_cksm.c @@ -74,11 +74,11 @@ #define NOISE ((DES_LONG)83653421L) DES_LONG des_quad_cksum(input, output, length, out_count, seed) -des_cblock (*input); -des_cblock (*output); +const unsigned char *input; +des_cblocks output; long length; int out_count; -des_cblock (*seed); +des_cblock seed; { DES_LONG z0,z1,t0,t1; int i; @@ -87,10 +87,10 @@ des_cblock (*seed); unsigned char *lp; if (out_count < 1) out_count=1; - lp=(unsigned char *)output; + lp=output; - z0=Q_B0((*seed)[0])|Q_B1((*seed)[1])|Q_B2((*seed)[2])|Q_B3((*seed)[3]); - z1=Q_B0((*seed)[4])|Q_B1((*seed)[5])|Q_B2((*seed)[6])|Q_B3((*seed)[7]); + z0=Q_B0(seed[0])|Q_B1(seed[1])|Q_B2(seed[2])|Q_B3(seed[3]); + z1=Q_B0(seed[4])|Q_B1(seed[5])|Q_B2(seed[6])|Q_B3(seed[7]); for (i=0; ((i<4)&&(ides_key,ks); + des_set_key(desp->des_key,ks); enc=(desp->des_dir == ENCRYPT)?DES_ENCRYPT:DES_DECRYPT; if (desp->des_mode == CBC) - des_ecb_encrypt((des_cblock *)desp->UDES.UDES_buf, - (des_cblock *)desp->UDES.UDES_buf,ks,enc); + des_ecb_encrypt(desp->UDES.UDES_buf,desp->UDES.UDES_buf,ks, + enc); else { - des_ncbc_encrypt((des_cblock *)desp->UDES.UDES_buf, - (des_cblock *)desp->UDES.UDES_buf, - (long)len,ks, - (des_cblock *)desp->des_ivec,enc); + des_ncbc_encrypt(desp->UDES.UDES_buf,desp->UDES.UDES_buf, + len,ks,desp->des_ivec,enc); #ifdef undef /* len will always be %8 if called from common_crypt * in secure_rpc. diff --git a/crypto/des/set_key.c b/crypto/des/set_key.c index fe966fd255..fef8d277fd 100644 --- a/crypto/des/set_key.c +++ b/crypto/des/set_key.c @@ -68,7 +68,7 @@ #include "sk.h" #ifndef NOPROTO -static int check_parity(des_cblock (*key)); +static int check_parity(const des_cblock key); #else static int check_parity(); #endif @@ -76,22 +76,22 @@ static int check_parity(); int des_check_key=0; void des_set_odd_parity(key) -des_cblock (*key); +des_cblock key; { int i; for (i=0; i>4)&0x0f); j=((j<<2)&0xcc)|((j>>2)&0x33); j=((j<<1)&0xaa)|((j>>1)&0x55); - (*key)[7-(i%8)]^=j; + key[7-(i%8)]^=j; } } #endif - des_set_odd_parity((des_cblock *)key); + des_set_odd_parity(key); i=des_check_key; des_check_key=0; - des_set_key((des_cblock *)key,ks); + des_set_key(key,ks); des_check_key=i; - des_cbc_cksum((des_cblock *)str,(des_cblock *)key,(long)length,ks, - (des_cblock *)key); + des_cbc_cksum(str,key,length,ks,key); memset(ks,0,sizeof(ks)); - des_set_odd_parity((des_cblock *)key); + des_set_odd_parity(key); } void des_string_to_2keys(str, key1, key2) -char *str; -des_cblock (*key1); -des_cblock (*key2); +const char *str; +des_cblock key1; +des_cblock key2; { des_key_schedule ks; int i,length; @@ -117,7 +116,7 @@ des_cblock (*key2); { for (i=0; i>2)&0x33); j=((j<<1)&0xaa)|((j>>1)&0x55); if ((i%16) < 8) - (*key1)[7-(i%8)]^=j; + key1[7-(i%8)]^=j; else - (*key2)[7-(i%8)]^=j; + key2[7-(i%8)]^=j; } } if (length <= 8) memcpy(key2,key1,8); #endif - des_set_odd_parity((des_cblock *)key1); - des_set_odd_parity((des_cblock *)key2); + des_set_odd_parity(key1); + des_set_odd_parity(key2); i=des_check_key; des_check_key=0; - des_set_key((des_cblock *)key1,ks); - des_cbc_cksum((des_cblock *)str,(des_cblock *)key1,(long)length,ks, - (des_cblock *)key1); - des_set_key((des_cblock *)key2,ks); - des_cbc_cksum((des_cblock *)str,(des_cblock *)key2,(long)length,ks, - (des_cblock *)key2); + des_set_key(key1,ks); + des_cbc_cksum(str,key1,length,ks,key1); + des_set_key(key2,ks); + des_cbc_cksum(str,key2,length,ks,key2); des_check_key=i; memset(ks,0,sizeof(ks)); des_set_odd_parity(key1); diff --git a/crypto/des/supp.c b/crypto/des/supp.c index 75c1015252..ff13e073da 100644 --- a/crypto/des/supp.c +++ b/crypto/des/supp.c @@ -87,14 +87,14 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: supp.c,v 1.1.1.2 1998/12/21 10:55:04 rse Exp $ + * $Id: supp.c,v 1.2 1999/02/13 18:52:21 ben Exp $ */ #include #include "des_locl.h" void des_cblock_print_file(cb, fp) - des_cblock *cb; + const des_cblock cb; FILE *fp; { int i; diff --git a/crypto/des/xcbc_enc.c b/crypto/des/xcbc_enc.c index 031589bf50..9a9480ec3a 100644 --- a/crypto/des/xcbc_enc.c +++ b/crypto/des/xcbc_enc.c @@ -79,19 +79,14 @@ static unsigned char desx_white_in2out[256]={ 0xA7,0x1C,0xC9,0x09,0x69,0x9A,0x83,0xCF,0x29,0x39,0xB9,0xE9,0x4C,0xFF,0x43,0xAB, }; -void des_xwhite_in2out(des_key,in_white,out_white) -des_cblock (*des_key); -des_cblock (*in_white); -des_cblock (*out_white); +void des_xwhite_in2out(key,in,out) +const des_cblock key; +const des_cblock in; +des_cblock out; { - unsigned char *key,*in,*out; int out0,out1; int i; - key=(unsigned char *)des_key; - in=(unsigned char *)in_white; - out=(unsigned char *)out_white; - out[0]=out[1]=out[2]=out[3]=out[4]=out[5]=out[6]=out[7]=0; out0=out1=0; for (i=0; i<8; i++) @@ -111,34 +106,32 @@ des_cblock (*out_white); } } -void des_xcbc_encrypt(input, output, length, schedule, ivec, inw,outw,enc) -des_cblock (*input); -des_cblock (*output); +void des_xcbc_encrypt(in, out, length, schedule, ivec, inw,outw,enc) +const unsigned char *in; +unsigned char *out; long length; des_key_schedule schedule; -des_cblock (*ivec); -des_cblock (*inw); -des_cblock (*outw); +des_cblock ivec; +const des_cblock inw; +const des_cblock outw; int enc; { register DES_LONG tin0,tin1; register DES_LONG tout0,tout1,xor0,xor1; register DES_LONG inW0,inW1,outW0,outW1; - register unsigned char *in,*out; + register const unsigned char *in2; register long l=length; DES_LONG tin[2]; unsigned char *iv; - in=(unsigned char *)inw; - c2l(in,inW0); - c2l(in,inW1); - in=(unsigned char *)outw; - c2l(in,outW0); - c2l(in,outW1); + in2=inw; + c2l(in2,inW0); + c2l(in2,inW1); + in2=outw; + c2l(in2,outW0); + c2l(in2,outW1); - in=(unsigned char *)input; - out=(unsigned char *)output; - iv=(unsigned char *)ivec; + iv=ivec; if (enc) { @@ -150,7 +143,7 @@ int enc; c2l(in,tin1); tin0^=tout0^inW0; tin[0]=tin0; tin1^=tout1^inW1; tin[1]=tin1; - des_encrypt((DES_LONG *)tin,schedule,DES_ENCRYPT); + des_encrypt(tin,schedule,DES_ENCRYPT); tout0=tin[0]^outW0; l2c(tout0,out); tout1=tin[1]^outW1; l2c(tout1,out); } @@ -159,11 +152,11 @@ int enc; c2ln(in,tin0,tin1,l+8); tin0^=tout0^inW0; tin[0]=tin0; tin1^=tout1^inW1; tin[1]=tin1; - des_encrypt((DES_LONG *)tin,schedule,DES_ENCRYPT); + des_encrypt(tin,schedule,DES_ENCRYPT); tout0=tin[0]^outW0; l2c(tout0,out); tout1=tin[1]^outW1; l2c(tout1,out); } - iv=(unsigned char *)ivec; + iv=ivec; l2c(tout0,iv); l2c(tout1,iv); } @@ -175,7 +168,7 @@ int enc; { c2l(in,tin0); tin[0]=tin0^outW0; c2l(in,tin1); tin[1]=tin1^outW1; - des_encrypt((DES_LONG *)tin,schedule,DES_DECRYPT); + des_encrypt(tin,schedule,DES_DECRYPT); tout0=tin[0]^xor0^inW0; tout1=tin[1]^xor1^inW1; l2c(tout0,out); @@ -187,7 +180,7 @@ int enc; { c2l(in,tin0); tin[0]=tin0^outW0; c2l(in,tin1); tin[1]=tin1^outW1; - des_encrypt((DES_LONG *)tin,schedule,DES_DECRYPT); + des_encrypt(tin,schedule,DES_DECRYPT); tout0=tin[0]^xor0^inW0; tout1=tin[1]^xor1^inW1; l2cn(tout0,tout1,out,l+8); @@ -195,7 +188,7 @@ int enc; xor1=tin1; } - iv=(unsigned char *)ivec; + iv=ivec; l2c(xor0,iv); l2c(xor1,iv); } diff --git a/crypto/evp/e_cbc_3d.c b/crypto/evp/e_cbc_3d.c index 5761bf186a..907e2e94b0 100644 --- a/crypto/evp/e_cbc_3d.c +++ b/crypto/evp/e_cbc_3d.c @@ -122,8 +122,8 @@ int enc; if (key != NULL) { - des_set_key((des_cblock *)key,ctx->c.des_ede.ks1); - des_set_key((des_cblock *)&(key[8]),ctx->c.des_ede.ks2); + des_set_key(key,ctx->c.des_ede.ks1); + des_set_key(&(key[8]),ctx->c.des_ede.ks2); memcpy( (char *)ctx->c.des_ede.ks3, (char *)ctx->c.des_ede.ks1, sizeof(ctx->c.des_ede.ks1)); @@ -142,9 +142,9 @@ int enc; if (key != NULL) { - des_set_key((des_cblock *)key,ctx->c.des_ede.ks1); - des_set_key((des_cblock *)&(key[8]),ctx->c.des_ede.ks2); - des_set_key((des_cblock *)&(key[16]),ctx->c.des_ede.ks3); + des_set_key(key,ctx->c.des_ede.ks1); + des_set_key(&(key[8]),ctx->c.des_ede.ks2); + des_set_key(&(key[16]),ctx->c.des_ede.ks3); } } @@ -154,10 +154,8 @@ unsigned char *out; unsigned char *in; unsigned int inl; { - des_ede3_cbc_encrypt( - (des_cblock *)in,(des_cblock *)out, - (long)inl, ctx->c.des_ede.ks1, + des_ede3_cbc_encrypt(in,out,inl, ctx->c.des_ede.ks1, ctx->c.des_ede.ks2,ctx->c.des_ede.ks3, - (des_cblock *)&(ctx->iv[0]), + &(ctx->iv[0]), ctx->encrypt); } diff --git a/crypto/evp/e_cfb_d.c b/crypto/evp/e_cfb_d.c index 9ae4558f51..554815ec8a 100644 --- a/crypto/evp/e_cfb_d.c +++ b/crypto/evp/e_cfb_d.c @@ -101,7 +101,7 @@ int enc; memcpy(&(ctx->oiv[0]),iv,8); memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); if (key != NULL) - des_set_key((des_cblock *)key,ctx->c.des_ks); + des_set_key(key,ctx->c.des_ks); } static void des_cfb_cipher(ctx,out,in,inl) @@ -113,6 +113,6 @@ unsigned int inl; des_cfb64_encrypt( in,out, (long)inl, ctx->c.des_ks, - (des_cblock *)&(ctx->iv[0]), + &(ctx->iv[0]), &ctx->num,ctx->encrypt); } diff --git a/crypto/evp/e_ecb_3d.c b/crypto/evp/e_ecb_3d.c index 908fc0760a..13d7611bb3 100644 --- a/crypto/evp/e_ecb_3d.c +++ b/crypto/evp/e_ecb_3d.c @@ -117,8 +117,8 @@ int enc; { if (key != NULL) { - des_set_key((des_cblock *)key,ctx->c.des_ede.ks1); - des_set_key((des_cblock *)&(key[8]),ctx->c.des_ede.ks2); + des_set_key(key,ctx->c.des_ede.ks1); + des_set_key(&(key[8]),ctx->c.des_ede.ks2); memcpy( (char *)ctx->c.des_ede.ks3, (char *)ctx->c.des_ede.ks1, sizeof(ctx->c.des_ede.ks1)); @@ -133,9 +133,9 @@ int enc; { if (key != NULL) { - des_set_key((des_cblock *)key,ctx->c.des_ede.ks1); - des_set_key((des_cblock *)&(key[8]),ctx->c.des_ede.ks2); - des_set_key((des_cblock *)&(key[16]),ctx->c.des_ede.ks3); + des_set_key(key,ctx->c.des_ede.ks1); + des_set_key(&(key[8]),ctx->c.des_ede.ks2); + des_set_key(&(key[16]),ctx->c.des_ede.ks3); } } @@ -151,8 +151,7 @@ unsigned int inl; inl-=8; for (i=0; i<=inl; i+=8) { - des_ecb3_encrypt( - (des_cblock *)&(in[i]),(des_cblock *)&(out[i]), + des_ecb3_encrypt(&(in[i]),&(out[i]), ctx->c.des_ede.ks1, ctx->c.des_ede.ks2, ctx->c.des_ede.ks3, diff --git a/crypto/evp/e_ecb_d.c b/crypto/evp/e_ecb_d.c index 7a409d6459..de3aff5ce2 100644 --- a/crypto/evp/e_ecb_d.c +++ b/crypto/evp/e_ecb_d.c @@ -96,7 +96,7 @@ unsigned char *iv; int enc; { if (key != NULL) - des_set_key((des_cblock *)key,ctx->c.des_ks); + des_set_key(key,ctx->c.des_ks); } static void des_ecb_cipher(ctx,out,in,inl) @@ -111,8 +111,6 @@ unsigned int inl; inl-=8; for (i=0; i<=inl; i+=8) { - des_ecb_encrypt( - (des_cblock *)&(in[i]),(des_cblock *)&(out[i]), - ctx->c.des_ks,ctx->encrypt); + des_ecb_encrypt(&(in[i]),&(out[i]),ctx->c.des_ks,ctx->encrypt); } } diff --git a/crypto/evp/e_xcbc_d.c b/crypto/evp/e_xcbc_d.c index 0d7fda0c47..b0bae80970 100644 --- a/crypto/evp/e_xcbc_d.c +++ b/crypto/evp/e_xcbc_d.c @@ -100,7 +100,7 @@ int enc; memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); if (key != NULL) { - des_set_key((des_cblock *)key,ctx->c.desx_cbc.ks); + des_set_key(key,ctx->c.desx_cbc.ks); memcpy(&(ctx->c.desx_cbc.inw[0]),&(key[8]),8); memcpy(&(ctx->c.desx_cbc.outw[0]),&(key[16]),8); } @@ -112,11 +112,9 @@ unsigned char *out; unsigned char *in; unsigned int inl; { - des_xcbc_encrypt( - (des_cblock *)in,(des_cblock *)out, - (long)inl, ctx->c.desx_cbc.ks, - (des_cblock *)&(ctx->iv[0]), - (des_cblock *)&(ctx->c.desx_cbc.inw[0]), - (des_cblock *)&(ctx->c.desx_cbc.outw[0]), + des_xcbc_encrypt(in,out,inl,ctx->c.desx_cbc.ks, + &(ctx->iv[0]), + &(ctx->c.desx_cbc.inw[0]), + &(ctx->c.desx_cbc.outw[0]), ctx->encrypt); } diff --git a/crypto/mdc2/mdc2dgst.c b/crypto/mdc2/mdc2dgst.c index 2a086c0612..72a0c76324 100644 --- a/crypto/mdc2/mdc2dgst.c +++ b/crypto/mdc2/mdc2dgst.c @@ -135,35 +135,35 @@ unsigned int len; register DES_LONG tin0,tin1; register DES_LONG ttin0,ttin1; DES_LONG d[2],dd[2]; - des_cblock *h,*hh; + unsigned char *h,*hh; des_key_schedule k; unsigned char *p; unsigned int i; - h= (des_cblock *)&(c->h[0]); - hh= (des_cblock *)&(c->hh[0]); + h= c->h; + hh= c->hh; for (i=0; i