Fix ghastly DES declarations, and all consequential warnings.
authorBen Laurie <ben@openssl.org>
Sat, 13 Feb 1999 18:52:38 +0000 (18:52 +0000)
committerBen Laurie <ben@openssl.org>
Sat, 13 Feb 1999 18:52:38 +0000 (18:52 +0000)
34 files changed:
CHANGES
apps/speed.c
crypto/des/cbc_cksm.c
crypto/des/cbc_enc.c
crypto/des/cfb64ede.c
crypto/des/cfb64enc.c
crypto/des/cfb_enc.c
crypto/des/destest.c
crypto/des/ecb3_enc.c
crypto/des/ecb_enc.c
crypto/des/ede_cbcm_enc.c
crypto/des/enc_read.c
crypto/des/enc_writ.c
crypto/des/fcrypt.c
crypto/des/ofb64ede.c
crypto/des/ofb64enc.c
crypto/des/ofb_enc.c
crypto/des/pcbc_enc.c
crypto/des/qud_cksm.c
crypto/des/rand_key.c
crypto/des/read2pwd.c
crypto/des/read_pwd.c
crypto/des/rpc_enc.c
crypto/des/set_key.c
crypto/des/str2key.c
crypto/des/supp.c
crypto/des/xcbc_enc.c
crypto/evp/e_cbc_3d.c
crypto/evp/e_cfb_d.c
crypto/evp/e_ecb_3d.c
crypto/evp/e_ecb_d.c
crypto/evp/e_xcbc_d.c
crypto/mdc2/mdc2dgst.c
crypto/objects/obj_dat.h

diff --git a/CHANGES b/CHANGES
index 229351b119a7dea64b9e885ceb16d7e9f63c1268..f8b587975f1cc546f72985cb6181af3dc5b26636 100644 (file)
--- 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
index 1a1ae72c26f16565c18d84c6b2a89eff995a2909..35f8398b53b002de7fe35415183fee32eb7805da 100644 (file)
@@ -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);
index edfdec8a0f89464dc79b7e4d35e0c07d8cf698b7..c41d51af4bc68b2b585756672d944e6b839455fb 100644 (file)
 
 #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);
index a84a53633cd52c25279f6159ec3eaf8ec37ff980..96939f34dfeafc961c097dce736499cc080b04fd 100644 (file)
 
 #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)
                {
index 80b8a9eaaaf33b670bb2ca1ed2ba5929303a74d6..f19a55ef520ae8d089ba1219a9a00ff117f03a3e 100644 (file)
  */
 
 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];
index 403da479dfcaf28154b9db8f1cfff13d2f8652df..9434ddad9e5c033c61a3de510c69c3428ba0c50d 100644 (file)
  */
 
 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];
index 342e7856912a735cad42c77d42da2677488fa9de..df0c65ee82221e8a20609af2ac8717ecbf5021db 100644 (file)
  * 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;
index d915c7a22f260a3abf0fe2e97ba89810de3d5470..0e7801d1e51d7103b02a3d5c9ae6729fefa91946 100644 (file)
@@ -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_TESTS; i++)
                {
-               if ((j=des_key_sched((C_Block *)(key_data[i]),ks)) != 0)
+               if ((j=des_key_sched(key_data[i],ks)) != 0)
                        {
                        printf("Key error %2d:%d\n",i+1,j);
                        err=1;
@@ -391,8 +391,8 @@ char *argv[];
                memcpy(in,plain_data[i],8);
                memset(out,0,8);
                memset(outin,0,8);
-               des_ecb_encrypt((C_Block *)in,(C_Block *)out,ks,DES_ENCRYPT);
-               des_ecb_encrypt((C_Block *)out,(C_Block *)outin,ks,DES_DECRYPT);
+               des_ecb_encrypt(in,out,ks,DES_ENCRYPT);
+               des_ecb_encrypt(out,outin,ks,DES_DECRYPT);
 
                if (memcmp(out,cipher_data[i],8) != 0)
                        {
@@ -413,17 +413,17 @@ char *argv[];
        printf("Doing ede ecb\n");
        for (i=0; i<(NUM_TESTS-1); i++)
                {
-               if ((j=des_key_sched((C_Block *)(key_data[i]),ks)) != 0)
+               if ((j=des_key_sched(key_data[i],ks)) != 0)
                        {
                        err=1;
                        printf("Key error %2d:%d\n",i+1,j);
                        }
-               if ((j=des_key_sched((C_Block *)(key_data[i+1]),ks2)) != 0)
+               if ((j=des_key_sched(key_data[i+1],ks2)) != 0)
                        {
                        printf("Key error %2d:%d\n",i+2,j);
                        err=1;
                        }
-               if ((j=des_key_sched((C_Block *)(key_data[i+2]),ks3)) != 0)
+               if ((j=des_key_sched(key_data[i+2],ks3)) != 0)
                        {
                        printf("Key error %2d:%d\n",i+3,j);
                        err=1;
@@ -431,10 +431,8 @@ char *argv[];
                memcpy(in,plain_data[i],8);
                memset(out,0,8);
                memset(outin,0,8);
-               des_ecb2_encrypt((C_Block *)in,(C_Block *)out,ks,ks2,
-                       DES_ENCRYPT);
-               des_ecb2_encrypt((C_Block *)out,(C_Block *)outin,ks,ks2,
-                       DES_DECRYPT);
+               des_ecb2_encrypt(in,out,ks,ks2,DES_ENCRYPT);
+               des_ecb2_encrypt(out,outin,ks,ks2,DES_DECRYPT);
 
                if (memcmp(out,cipher_ecb2[i],8) != 0)
                        {
@@ -453,7 +451,7 @@ char *argv[];
 #endif
 
        printf("Doing cbc\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;
@@ -461,16 +459,14 @@ char *argv[];
        memset(cbc_out,0,40);
        memset(cbc_in,0,40);
        memcpy(iv3,cbc_iv,sizeof(cbc_iv));
-       des_ncbc_encrypt((C_Block *)cbc_data,(C_Block *)cbc_out,
-               (long)strlen((char *)cbc_data)+1,ks,
-               (C_Block *)iv3,DES_ENCRYPT);
+       des_ncbc_encrypt(cbc_data,cbc_out,strlen((char *)cbc_data)+1,ks,
+                        iv3,DES_ENCRYPT);
        if (memcmp(cbc_out,cbc_ok,32) != 0)
                printf("cbc_encrypt encrypt error\n");
 
        memcpy(iv3,cbc_iv,sizeof(cbc_iv));
-       des_ncbc_encrypt((C_Block *)cbc_out,(C_Block *)cbc_in,
-               (long)strlen((char *)cbc_data)+1,ks,
-               (C_Block *)iv3,DES_DECRYPT);
+       des_ncbc_encrypt(cbc_out,cbc_in,strlen((char *)cbc_data)+1,ks,
+                        iv3,DES_DECRYPT);
        if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)) != 0)
                {
                printf("cbc_encrypt decrypt error\n");
@@ -479,7 +475,7 @@ char *argv[];
 
 #ifndef LIBDES_LIT
        printf("Doing desx cbc\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;
@@ -487,19 +483,15 @@ char *argv[];
        memset(cbc_out,0,40);
        memset(cbc_in,0,40);
        memcpy(iv3,cbc_iv,sizeof(cbc_iv));
-       des_xcbc_encrypt((C_Block *)cbc_data,(C_Block *)cbc_out,
-               (long)strlen((char *)cbc_data)+1,ks,
-               (C_Block *)iv3,
-               (C_Block *)cbc2_key, (C_Block *)cbc3_key, DES_ENCRYPT);
+       des_xcbc_encrypt(cbc_data,cbc_out,strlen((char *)cbc_data)+1,ks,
+                        iv3,cbc2_key,cbc3_key, DES_ENCRYPT);
        if (memcmp(cbc_out,xcbc_ok,32) != 0)
                {
                printf("des_xcbc_encrypt encrypt error\n");
                }
        memcpy(iv3,cbc_iv,sizeof(cbc_iv));
-       des_xcbc_encrypt((C_Block *)cbc_out,(C_Block *)cbc_in,
-               (long)strlen((char *)cbc_data)+1,ks,
-               (C_Block *)iv3,
-               (C_Block *)cbc2_key, (C_Block *)cbc3_key, DES_DECRYPT);
+       des_xcbc_encrypt(cbc_out,cbc_in,strlen((char *)cbc_data)+1,ks,
+                        iv3,cbc2_key,cbc3_key, DES_DECRYPT);
        if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)+1) != 0)
                {
                printf("des_xcbc_encrypt decrypt error\n");
@@ -508,17 +500,17 @@ char *argv[];
 #endif
 
        printf("Doing ede cbc\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;
@@ -529,11 +521,9 @@ char *argv[];
        /* i=((i+7)/8)*8; */
        memcpy(iv3,cbc_iv,sizeof(cbc_iv));
 
-       des_ede3_cbc_encrypt((C_Block *)cbc_data,(C_Block *)cbc_out,
-               16L,ks,ks2,ks3,(C_Block *)iv3,DES_ENCRYPT);
-       des_ede3_cbc_encrypt((C_Block *)&(cbc_data[16]),
-               (C_Block *)&(cbc_out[16]),
-               (long)i-16,ks,ks2,ks3,(C_Block *)iv3,DES_ENCRYPT);
+       des_ede3_cbc_encrypt(cbc_data,cbc_out,16L,ks,ks2,ks3,iv3,DES_ENCRYPT);
+       des_ede3_cbc_encrypt(&(cbc_data[16]),&(cbc_out[16]),i-16,ks,ks2,ks3,
+                            iv3,DES_ENCRYPT);
        if (memcmp(cbc_out,cbc3_ok,
                (unsigned int)(strlen((char *)cbc_data)+1+7)/8*8) != 0)
                {
@@ -542,8 +532,7 @@ char *argv[];
                }
 
        memcpy(iv3,cbc_iv,sizeof(cbc_iv));
-       des_ede3_cbc_encrypt((C_Block *)cbc_out,(C_Block *)cbc_in,
-               (long)i,ks,ks2,ks3,(C_Block *)iv3,DES_DECRYPT);
+       des_ede3_cbc_encrypt(cbc_out,cbc_in,i,ks,ks2,ks3,iv3,DES_DECRYPT);
        if (memcmp(cbc_in,cbc_data,strlen(cbc_data)+1) != 0)
                {
                printf("des_ede3_cbc_encrypt decrypt error\n");
@@ -552,22 +541,22 @@ char *argv[];
 
 #ifndef LIBDES_LIT
        printf("Doing pcbc\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;
                }
        memset(cbc_out,0,40);
        memset(cbc_in,0,40);
-       des_pcbc_encrypt((C_Block *)cbc_data,(C_Block *)cbc_out,
-               (long)strlen(cbc_data)+1,ks,(C_Block *)cbc_iv,DES_ENCRYPT);
+       des_pcbc_encrypt(cbc_data,cbc_out,strlen(cbc_data)+1,ks,cbc_iv,
+                        DES_ENCRYPT);
        if (memcmp(cbc_out,pcbc_ok,32) != 0)
                {
                printf("pcbc_encrypt encrypt error\n");
                err=1;
                }
-       des_pcbc_encrypt((C_Block *)cbc_out,(C_Block *)cbc_in,
-               (long)strlen(cbc_data)+1,ks,(C_Block *)cbc_iv,DES_DECRYPT);
+       des_pcbc_encrypt(cbc_out,cbc_in,strlen(cbc_data)+1,ks,cbc_iv,
+                        DES_DECRYPT);
        if (memcmp(cbc_in,cbc_data,strlen(cbc_data)+1) != 0)
                {
                printf("pcbc_encrypt decrypt error\n");
@@ -592,7 +581,7 @@ char *argv[];
        memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv));
        for (i=0; i<sizeof(plain); i++)
                des_cfb_encrypt(&(plain[i]),&(cfb_buf1[i]),
-                       8,(long)1,ks,(C_Block *)cfb_tmp,DES_ENCRYPT);
+                       8,1,ks,cfb_tmp,DES_ENCRYPT);
        if (memcmp(cfb_cipher8,cfb_buf1,sizeof(plain)) != 0)
                {
                printf("cfb_encrypt small encrypt error\n");
@@ -602,7 +591,7 @@ char *argv[];
        memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv));
        for (i=0; i<sizeof(plain); i++)
                des_cfb_encrypt(&(cfb_buf1[i]),&(cfb_buf2[i]),
-                       8,(long)1,ks,(C_Block *)cfb_tmp,DES_DECRYPT);
+                       8,1,ks,cfb_tmp,DES_DECRYPT);
        if (memcmp(plain,cfb_buf2,sizeof(plain)) != 0)
                {
                printf("cfb_encrypt small decrypt error\n");
@@ -615,10 +604,9 @@ char *argv[];
        printf("done\n");
 
        printf("Doing ofb\n");
-       des_key_sched((C_Block *)ofb_key,ks);
+       des_key_sched(ofb_key,ks);
        memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv));
-       des_ofb_encrypt(plain,ofb_buf1,64,(long)sizeof(plain)/8,ks,
-               (C_Block *)ofb_tmp);
+       des_ofb_encrypt(plain,ofb_buf1,64,sizeof(plain)/8,ks,ofb_tmp);
        if (memcmp(ofb_cipher,ofb_buf1,sizeof(ofb_buf1)) != 0)
                {
                printf("ofb_encrypt encrypt error\n");
@@ -631,8 +619,7 @@ ofb_buf1[8+4], ofb_cipher[8+5], ofb_cipher[8+6], ofb_cipher[8+7]);
                err=1;
                }
        memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv));
-       des_ofb_encrypt(ofb_buf1,ofb_buf2,64,(long)sizeof(ofb_buf1)/8,ks,
-               (C_Block *)ofb_tmp);
+       des_ofb_encrypt(ofb_buf1,ofb_buf2,64,sizeof(ofb_buf1)/8,ks,ofb_tmp);
        if (memcmp(plain,ofb_buf2,sizeof(ofb_buf2)) != 0)
                {
                printf("ofb_encrypt decrypt error\n");
@@ -646,15 +633,15 @@ plain[8+4], plain[8+5], plain[8+6], plain[8+7]);
                }
 
        printf("Doing ofb64\n");
-       des_key_sched((C_Block *)ofb_key,ks);
+       des_key_sched(ofb_key,ks);
        memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv));
        memset(ofb_buf1,0,sizeof(ofb_buf1));
        memset(ofb_buf2,0,sizeof(ofb_buf1));
        num=0;
        for (i=0; i<sizeof(plain); i++)
                {
-               des_ofb64_encrypt(&(plain[i]),&(ofb_buf1[i]),1,ks,
-                       (C_Block *)ofb_tmp,&num);
+               des_ofb64_encrypt(&(plain[i]),&(ofb_buf1[i]),1,ks,ofb_tmp,
+                                 &num);
                }
        if (memcmp(ofb_cipher,ofb_buf1,sizeof(ofb_buf1)) != 0)
                {
@@ -663,8 +650,7 @@ plain[8+4], plain[8+5], plain[8+6], plain[8+7]);
                }
        memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv));
        num=0;
-       des_ofb64_encrypt(ofb_buf1,ofb_buf2,(long)sizeof(ofb_buf1),ks,
-               (C_Block *)ofb_tmp,&num);
+       des_ofb64_encrypt(ofb_buf1,ofb_buf2,sizeof(ofb_buf1),ks,ofb_tmp,&num);
        if (memcmp(plain,ofb_buf2,sizeof(ofb_buf2)) != 0)
                {
                printf("ofb64_encrypt decrypt error\n");
@@ -672,7 +658,7 @@ plain[8+4], plain[8+5], plain[8+6], plain[8+7]);
                }
 
        printf("Doing ede_ofb64\n");
-       des_key_sched((C_Block *)ofb_key,ks);
+       des_key_sched(ofb_key,ks);
        memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv));
        memset(ofb_buf1,0,sizeof(ofb_buf1));
        memset(ofb_buf2,0,sizeof(ofb_buf1));
@@ -680,7 +666,7 @@ plain[8+4], plain[8+5], plain[8+6], plain[8+7]);
        for (i=0; i<sizeof(plain); i++)
                {
                des_ede3_ofb64_encrypt(&(plain[i]),&(ofb_buf1[i]),1,ks,ks,ks,
-                       (C_Block *)ofb_tmp,&num);
+                                      ofb_tmp,&num);
                }
        if (memcmp(ofb_cipher,ofb_buf1,sizeof(ofb_buf1)) != 0)
                {
@@ -689,8 +675,8 @@ plain[8+4], plain[8+5], plain[8+6], plain[8+7]);
                }
        memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv));
        num=0;
-       des_ede3_ofb64_encrypt(ofb_buf1,ofb_buf2,(long)sizeof(ofb_buf1),ks,
-               ks,ks,(C_Block *)ofb_tmp,&num);
+       des_ede3_ofb64_encrypt(ofb_buf1,ofb_buf2,sizeof(ofb_buf1),ks,
+                              ks,ks,ofb_tmp,&num);
        if (memcmp(plain,ofb_buf2,sizeof(ofb_buf2)) != 0)
                {
                printf("ede_ofb64_encrypt decrypt error\n");
@@ -698,9 +684,8 @@ plain[8+4], plain[8+5], plain[8+6], plain[8+7]);
                }
 
        printf("Doing cbc_cksum\n");
-       des_key_sched((C_Block *)cbc_key,ks);
-       cs=des_cbc_cksum((C_Block *)cbc_data,(C_Block *)cret,
-               (long)strlen(cbc_data),ks,(C_Block *)cbc_iv);
+       des_key_sched(cbc_key,ks);
+       cs=des_cbc_cksum(cbc_data,cret,strlen(cbc_data),ks,cbc_iv);
        if (cs != cbc_cksum_ret)
                {
                printf("bad return value (%08lX), should be %08lX\n",
@@ -714,8 +699,11 @@ plain[8+4], plain[8+5], plain[8+6], plain[8+7]);
                }
 
        printf("Doing quad_cksum\n");
-       cs=quad_cksum((C_Block *)cbc_data,(C_Block *)qret,
-               (long)strlen(cbc_data),2,(C_Block *)cbc_iv);
+       /* This is obviously done this way especially to puzzle me. Although
+          quad_cksum returns up to 4 groups of 8 bytes, this test gets it to
+          produce 2 groupos then treats them as 4 groups of 4 bytes.
+          Ben 13 Feb 1999 */
+       cs=quad_cksum(cbc_data,(des_cblocks)qret,strlen(cbc_data),2,cbc_iv);
 
        { /* Big-endian fix */
        static DES_LONG l=1;
@@ -777,17 +765,15 @@ plain[8+4], plain[8+5], plain[8+6], plain[8+7]);
        for (i=0; i<4; i++)
                {
                printf(" %d",i);
-               des_ncbc_encrypt((C_Block *)&(cbc_out[i]),(C_Block *)cbc_in,
-                       (long)strlen(cbc_data)+1,ks,(C_Block *)cbc_iv,
-                       DES_ENCRYPT);
+               des_ncbc_encrypt(&(cbc_out[i]),cbc_in,strlen(cbc_data)+1,ks,
+                                cbc_iv,DES_ENCRYPT);
                }
        printf("\noutput word alignment test");
        for (i=0; i<4; i++)
                {
                printf(" %d",i);
-               des_ncbc_encrypt((C_Block *)cbc_out,(C_Block *)&(cbc_in[i]),
-                       (long)strlen(cbc_data)+1,ks,(C_Block *)cbc_iv,
-                       DES_ENCRYPT);
+               des_ncbc_encrypt(cbc_out,&(cbc_in[i]),strlen(cbc_data)+1,ks,
+                                cbc_iv,DES_ENCRYPT);
                }
        printf("\n");
        printf("fast crypt test ");
@@ -837,10 +823,10 @@ unsigned char *cfb_cipher;
        des_key_schedule ks;
        int i,err=0;
 
-       des_key_sched((C_Block *)cfb_key,ks);
+       des_key_sched(cfb_key,ks);
        memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv));
-       des_cfb_encrypt(plain,cfb_buf1,bits,(long)sizeof(plain),ks,
-               (C_Block *)cfb_tmp,DES_ENCRYPT);
+       des_cfb_encrypt(plain,cfb_buf1,bits,sizeof(plain),ks,cfb_tmp,
+                       DES_ENCRYPT);
        if (memcmp(cfb_cipher,cfb_buf1,sizeof(plain)) != 0)
                {
                err=1;
@@ -849,8 +835,8 @@ unsigned char *cfb_cipher;
                        printf("%s\n",pt(&(cfb_buf1[i])));
                }
        memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv));
-       des_cfb_encrypt(cfb_buf1,cfb_buf2,bits,(long)sizeof(plain),ks,
-               (C_Block *)cfb_tmp,DES_DECRYPT);
+       des_cfb_encrypt(cfb_buf1,cfb_buf2,bits,sizeof(plain),ks,cfb_tmp,
+                       DES_DECRYPT);
        if (memcmp(plain,cfb_buf2,sizeof(plain)) != 0)
                {
                err=1;
@@ -867,14 +853,12 @@ unsigned char *cfb_cipher;
        des_key_schedule ks;
        int err=0,i,n;
 
-       des_key_sched((C_Block *)cfb_key,ks);
+       des_key_sched(cfb_key,ks);
        memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv));
        n=0;
-       des_cfb64_encrypt(plain,cfb_buf1,(long)12,ks,
-               (C_Block *)cfb_tmp,&n,DES_ENCRYPT);
-       des_cfb64_encrypt(&(plain[12]),&(cfb_buf1[12]),
-               (long)sizeof(plain)-12,ks,
-               (C_Block *)cfb_tmp,&n,DES_ENCRYPT);
+       des_cfb64_encrypt(plain,cfb_buf1,12,ks,cfb_tmp,&n,DES_ENCRYPT);
+       des_cfb64_encrypt(&(plain[12]),&(cfb_buf1[12]),sizeof(plain)-12,ks,
+                         cfb_tmp,&n,DES_ENCRYPT);
        if (memcmp(cfb_cipher,cfb_buf1,sizeof(plain)) != 0)
                {
                err=1;
@@ -884,11 +868,9 @@ unsigned char *cfb_cipher;
                }
        memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv));
        n=0;
-       des_cfb64_encrypt(cfb_buf1,cfb_buf2,(long)17,ks,
-               (C_Block *)cfb_tmp,&n,DES_DECRYPT);
+       des_cfb64_encrypt(cfb_buf1,cfb_buf2,17,ks,cfb_tmp,&n,DES_DECRYPT);
        des_cfb64_encrypt(&(cfb_buf1[17]),&(cfb_buf2[17]),
-               (long)sizeof(plain)-17,ks,
-               (C_Block *)cfb_tmp,&n,DES_DECRYPT);
+                         sizeof(plain)-17,ks,cfb_tmp,&n,DES_DECRYPT);
        if (memcmp(plain,cfb_buf2,sizeof(plain)) != 0)
                {
                err=1;
@@ -905,14 +887,14 @@ unsigned char *cfb_cipher;
        des_key_schedule ks;
        int err=0,i,n;
 
-       des_key_sched((C_Block *)cfb_key,ks);
+       des_key_sched(cfb_key,ks);
        memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv));
        n=0;
-       des_ede3_cfb64_encrypt(plain,cfb_buf1,(long)12,ks,ks,ks,
-               (C_Block *)cfb_tmp,&n,DES_ENCRYPT);
+       des_ede3_cfb64_encrypt(plain,cfb_buf1,12,ks,ks,ks,cfb_tmp,&n,
+                              DES_ENCRYPT);
        des_ede3_cfb64_encrypt(&(plain[12]),&(cfb_buf1[12]),
-               (long)sizeof(plain)-12,ks,ks,ks,
-               (C_Block *)cfb_tmp,&n,DES_ENCRYPT);
+                              sizeof(plain)-12,ks,ks,ks,
+                              cfb_tmp,&n,DES_ENCRYPT);
        if (memcmp(cfb_cipher,cfb_buf1,sizeof(plain)) != 0)
                {
                err=1;
@@ -923,10 +905,10 @@ unsigned char *cfb_cipher;
        memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv));
        n=0;
        des_ede3_cfb64_encrypt(cfb_buf1,cfb_buf2,(long)17,ks,ks,ks,
-               (C_Block *)cfb_tmp,&n,DES_DECRYPT);
+                              cfb_tmp,&n,DES_DECRYPT);
        des_ede3_cfb64_encrypt(&(cfb_buf1[17]),&(cfb_buf2[17]),
-               (long)sizeof(plain)-17,ks,ks,ks,
-               (C_Block *)cfb_tmp,&n,DES_DECRYPT);
+                              sizeof(plain)-17,ks,ks,ks,
+                              cfb_tmp,&n,DES_DECRYPT);
        if (memcmp(plain,cfb_buf2,sizeof(plain)) != 0)
                {
                err=1;
index 140f6b5285edbeb166f00aa35b99cf9efeab2894..0353d946857ddab14fad0740a18798ce75b7bf4e 100644 (file)
 
 #include "des_locl.h"
 
-void des_ecb3_encrypt(input, output, ks1, ks2, ks3, enc)
-des_cblock (*input);
-des_cblock (*output);
+void des_ecb3_encrypt(in, out, ks1, ks2, ks3, enc)
+const des_cblock in;
+des_cblock out;
 des_key_schedule ks1;
 des_key_schedule ks2;
 des_key_schedule ks3;
 int enc;
        {
        register DES_LONG l0,l1;
-       register unsigned char *in,*out;
        DES_LONG ll[2];
 
-       in=(unsigned char *)input;
-       out=(unsigned char *)output;
        c2l(in,l0);
        c2l(in,l1);
        ll[0]=l0;
index 6c79d57561ed69c8f8d624b56fb9e0d503f74661..78e1f2d64e96b13a5e81ab9232486de18115f056 100644 (file)
@@ -102,18 +102,15 @@ char *des_options()
        }
                
 
-void des_ecb_encrypt(input, output, ks, enc)
-des_cblock (*input);
-des_cblock (*output);
+void des_ecb_encrypt(in, out, ks, enc)
+const unsigned char *in;
+unsigned char *out;
 des_key_schedule ks;
 int enc;
        {
        register DES_LONG l;
-       register unsigned char *in,*out;
        DES_LONG ll[2];
 
-       in=(unsigned char *)input;
-       out=(unsigned char *)output;
        c2l(in,l); ll[0]=l;
        c2l(in,l); ll[1]=l;
        des_encrypt(ll,ks,enc);
index a40b1d60732957af96b66d80d929b70a3fcb341e..10ffcbc72963661139caef754c433c1a262f1cee 100644 (file)
@@ -65,7 +65,7 @@ Feedback Masking, by Coppersmith, Johnson and Matyas, (IBM and Certicom).
 
 #include "des_locl.h"
 
-void des_ede3_cbcm_encrypt(const unsigned char *input,unsigned char *output,
+void des_ede3_cbcm_encrypt(const unsigned char *in,unsigned char *out,
                           long length,
                           des_key_schedule ks1,des_key_schedule ks2,
                           des_key_schedule ks3,
@@ -74,15 +74,12 @@ void des_ede3_cbcm_encrypt(const unsigned char *input,unsigned char *output,
     {
     register DES_LONG tin0,tin1;
     register DES_LONG tout0,tout1,xor0,xor1,m0,m1;
-    register unsigned char *in,*out;
     register long l=length;
     DES_LONG tin[2];
     unsigned char *iv1,*iv2;
 
-    in=(unsigned char *)input;
-    out=(unsigned char *)output;
-    iv1=(unsigned char *)ivec1;
-    iv2=(unsigned char *)ivec2;
+    iv1=ivec1;
+    iv2=ivec2;
 
     if (enc)
        {
@@ -125,11 +122,11 @@ void des_ede3_cbcm_encrypt(const unsigned char *input,unsigned char *output,
            l2c(tout0,out);
            l2c(tout1,out);
            }
-       iv1=(unsigned char *)ivec1;
+       iv1=ivec1;
        l2c(m0,iv1);
        l2c(m1,iv1);
 
-       iv2=(unsigned char *)ivec2;
+       iv2=ivec2;
        l2c(tout0,iv2);
        l2c(tout1,iv2);
        }
@@ -182,11 +179,11 @@ void des_ede3_cbcm_encrypt(const unsigned char *input,unsigned char *output,
            xor1=t1;
            }
 
-       iv1=(unsigned char *)ivec1;
+       iv1=ivec1;
        l2c(m0,iv1);
        l2c(m1,iv1);
 
-       iv2=(unsigned char *)ivec2;
+       iv2=ivec2;
        l2c(xor0,iv2);
        l2c(xor1,iv2);
        }
index e08a904d75907dbfd1dfeed7f18c9fabd2ec5b09..9fac3b24c17dbc4b15315fe1d60b8dc9c9d058a0 100644 (file)
@@ -69,7 +69,7 @@ int fd;
 char *buf;
 int len;
 des_key_schedule sched;
-des_cblock (*iv);
+des_cblock iv;
        {
        /* data to be unencrypted */
        int net_num=0;
@@ -165,11 +165,9 @@ des_cblock (*iv);
        if (len < num)
                {
                if (des_rw_mode & DES_PCBC_MODE)
-                       des_pcbc_encrypt((des_cblock *)net,(des_cblock *)unnet,
-                               num,sched,iv,DES_DECRYPT);
+                       des_pcbc_encrypt(net,unnet,num,sched,iv,DES_DECRYPT);
                else
-                       des_cbc_encrypt((des_cblock *)net,(des_cblock *)unnet,
-                               num,sched,iv,DES_DECRYPT);
+                       des_cbc_encrypt(net,unnet,num,sched,iv,DES_DECRYPT);
                memcpy(buf,unnet,(unsigned int)len);
                unnet_start=len;
                unnet_left=(int)num-len;
@@ -189,13 +187,11 @@ des_cblock (*iv);
                        {
 
                        if (des_rw_mode & DES_PCBC_MODE)
-                               des_pcbc_encrypt((des_cblock *)net,
-                                       (des_cblock *)tmpbuf,
-                                       num,sched,iv,DES_DECRYPT);
+                               des_pcbc_encrypt(net,tmpbuf,num,sched,iv,
+                                                DES_DECRYPT);
                        else
-                               des_cbc_encrypt((des_cblock *)net,
-                                       (des_cblock *)tmpbuf,
-                                       num,sched,iv,DES_DECRYPT);
+                               des_cbc_encrypt(net,tmpbuf,num,sched,iv,
+                                               DES_DECRYPT);
 
                        /* eay 26/08/92 fix a bug that returned more
                         * bytes than you asked for (returned len bytes :-( */
@@ -204,13 +200,11 @@ des_cblock (*iv);
                else
                        {
                        if (des_rw_mode & DES_PCBC_MODE)
-                               des_pcbc_encrypt((des_cblock *)net,
-                                       (des_cblock *)buf,num,sched,iv,
-                                       DES_DECRYPT);
+                               des_pcbc_encrypt(net,buf,num,sched,iv,
+                                                DES_DECRYPT);
                        else
-                               des_cbc_encrypt((des_cblock *)net,
-                                       (des_cblock *)buf,num,sched,iv,
-                                       DES_DECRYPT);
+                               des_cbc_encrypt(net,buf,num,sched,iv,
+                                               DES_DECRYPT);
                        }
                }
        return((int)num);
index 29a7330fb0f69a948a622c297e737d896ebf8cbd..33ca700d71aa502488f298a8f7c405396d915c7f 100644 (file)
 
 int des_enc_write(fd, buf, len, sched, iv)
 int fd;
-char *buf;
+const char *buf;
 int len;
 des_key_schedule sched;
-des_cblock (*iv);
+des_cblock iv;
        {
 #ifdef _LIBC
        extern int srandom();
@@ -79,6 +79,7 @@ des_cblock (*iv);
        static char *outbuf=NULL;
        char shortbuf[8];
        char *p;
+       const char *cp;
        static int start=1;
 
        if (outbuf == NULL)
@@ -117,7 +118,7 @@ des_cblock (*iv);
        /* pad short strings */
        if (len < 8)
                {
-               p=shortbuf;
+               cp=shortbuf;
                memcpy(shortbuf,buf,(unsigned int)len);
                for (i=len; i<8; i++)
                        shortbuf[i]=random();
@@ -125,18 +126,16 @@ des_cblock (*iv);
                }
        else
                {
-               p=buf;
+               cp=buf;
                rnum=((len+7)/8*8); /* round up to nearest eight */
                }
 
        if (des_rw_mode & DES_PCBC_MODE)
-               des_pcbc_encrypt((des_cblock *)p,
-                       (des_cblock *)&(outbuf[HDRSIZE]),
-                       (long)((len<8)?8:len),sched,iv,DES_ENCRYPT); 
+               des_pcbc_encrypt(cp,&(outbuf[HDRSIZE]),(len<8)?8:len,sched,iv,
+                                DES_ENCRYPT); 
        else
-               des_cbc_encrypt((des_cblock *)p,
-                       (des_cblock *)&(outbuf[HDRSIZE]),
-                       (long)((len<8)?8:len),sched,iv,DES_ENCRYPT); 
+               des_cbc_encrypt(cp,&(outbuf[HDRSIZE]),(len<8)?8:len,sched,iv,
+                               DES_ENCRYPT); 
 
        /* output */
        outnum=(int)rnum+HDRSIZE;
index 645e66a9aea8d017015928e6248c21c0d72acdfd..e276a08653d048eb5926da86c4061e596be2c9dd 100644 (file)
@@ -123,7 +123,7 @@ r=(r+7)/8;
        for (; i<8; i++)
                key[i]=0;
 
-       des_set_key((des_cblock *)(key),ks);
+       des_set_key(key,ks);
        fcrypt_body(&(out[0]),ks,Eswap0,Eswap1);
 
        ll=out[0]; l2c(ll,b);
index 4b1b0199f12ca764cdf44465900868dbfb0f1b4b..1fa20e6acf7888635885950acbf5f5890004bb19 100644 (file)
  * 64bit block we have used is contained in *num;
  */
 void des_ede3_ofb64_encrypt(in, out, length, k1,k2,k3, ivec, num)
-register unsigned char *in;
+register const unsigned char *in;
 register unsigned char *out;
 long length;
 des_key_schedule k1,k2,k3;
-des_cblock (*ivec);
+des_cblock ivec;
 int *num;
        {
        register DES_LONG v0,v1;
@@ -79,7 +79,7 @@ int *num;
        unsigned char *iv;
        int save=0;
 
-       iv=(unsigned char *)ivec;
+       iv=ivec;
        c2l(iv,v0);
        c2l(iv,v1);
        ti[0]=v0;
@@ -93,7 +93,7 @@ int *num;
                        {
                        /* ti[0]=v0; */
                        /* ti[1]=v1; */
-                       des_encrypt3((DES_LONG *)ti,k1,k2,k3);
+                       des_encrypt3(ti,k1,k2,k3);
                        v0=ti[0];
                        v1=ti[1];
 
@@ -109,7 +109,7 @@ int *num;
                {
 /*             v0=ti[0];
                v1=ti[1];*/
-               iv=(unsigned char *)ivec;
+               iv=ivec;
                l2c(v0,iv);
                l2c(v1,iv);
                }
index ea7e6126972588818b5a26b93937fa72dfd6b1da..b6a2f639eb81c250fad3bae1309cf80175782c38 100644 (file)
  * 64bit block we have used is contained in *num;
  */
 void des_ofb64_encrypt(in, out, length, schedule, ivec, num)
-register unsigned char *in;
+register const unsigned char *in;
 register unsigned char *out;
 long length;
 des_key_schedule schedule;
-des_cblock (*ivec);
+des_cblock ivec;
 int *num;
        {
        register DES_LONG v0,v1,t;
        register int n= *num;
        register long l=length;
        des_cblock d;
-       register char *dp;
+       register unsigned char *dp;
        DES_LONG ti[2];
        unsigned char *iv;
        int save=0;
 
-       iv=(unsigned char *)ivec;
+       iv=ivec;
        c2l(iv,v0);
        c2l(iv,v1);
        ti[0]=v0;
        ti[1]=v1;
-       dp=(char *)d;
+       dp=d;
        l2c(v0,dp);
        l2c(v1,dp);
        while (l--)
                {
                if (n == 0)
                        {
-                       des_encrypt((DES_LONG *)ti,schedule,DES_ENCRYPT);
-                       dp=(char *)d;
+                       des_encrypt(ti,schedule,DES_ENCRYPT);
+                       dp=d;
                        t=ti[0]; l2c(t,dp);
                        t=ti[1]; l2c(t,dp);
                        save++;
@@ -104,7 +104,7 @@ int *num;
                {
                v0=ti[0];
                v1=ti[1];
-               iv=(unsigned char *)ivec;
+               iv=ivec;
                l2c(v0,iv);
                l2c(v1,iv);
                }
index 4db0cdbd600c80e8e78bd0fb5543db6c27570d78..75b32f06da5f3baed6ad5c85fe13bacef3831905 100644 (file)
  * byte.
  */
 void des_ofb_encrypt(in, out, numbits, length, schedule, ivec)
-unsigned char *in;
+const unsigned char *in;
 unsigned char *out;
 int numbits;
 long length;
 des_key_schedule schedule;
-des_cblock (*ivec);
+des_cblock ivec;
        {
        register DES_LONG d0,d1,vv0,vv1,v0,v1,n=(numbits+7)/8;
        register DES_LONG mask0,mask1;
@@ -97,7 +97,7 @@ des_cblock (*ivec);
                mask1=0x00000000L;
                }
 
-       iv=(unsigned char *)ivec;
+       iv=ivec;
        c2l(iv,v0);
        c2l(iv,v1);
        ti[0]=v0;
@@ -131,7 +131,7 @@ des_cblock (*ivec);
                        v1=((v1>>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;
index 4513207d908f294596fc502947ca3161b32a2466..850717cc5718fc8266b6e13b449f955bdfa34775 100644 (file)
 #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;
index 8526abf334a05a18648e4c71d00c2590a5aaa29e..4d5301c241f57228ca7b20654fdcbf71af60c1e5 100644 (file)
 #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)&&(i<out_count)); i++)
                {
@@ -133,7 +133,7 @@ des_cblock (*seed);
                                }
                        else
                                {
-                               lp=output[out_count-i-1];
+                               lp=&output[out_count-i-1];
                                l2n(z1,lp);
                                l2n(z0,lp);
                                }
index 8c30bd029a2725fd020c8b9917d73f5dbc5061a2..8259f1a84905b4a8949add82da96210bd6a100e7 100644 (file)
@@ -101,15 +101,13 @@ unsigned char *ret;
        t=(DES_LONG)((pid)|((c++)<<16));
        l2c(t,p);
 
-       des_set_odd_parity((des_cblock *)data);
-       des_set_key((des_cblock *)data,ks);
-       des_cbc_cksum((des_cblock *)key,(des_cblock *)key,
-               (long)sizeof(key),ks,(des_cblock *)data);
+       des_set_odd_parity(data);
+       des_set_key(data,ks);
+       des_cbc_cksum(key,key,sizeof(key),ks,data);
 
-       des_set_odd_parity((des_cblock *)key);
-       des_set_key((des_cblock *)key,ks);
-       des_cbc_cksum((des_cblock *)key,(des_cblock *)data,
-               (long)sizeof(key),ks,(des_cblock *)key);
+       des_set_odd_parity(key);
+       des_set_key(key,ks);
+       des_cbc_cksum(key,data,sizeof(key),ks,key);
 
        memcpy(ret,data,sizeof(key));
        memset(key,0,sizeof(key));
index a0d53793e42db96245ab970ffa74f817f5a5fcbd..440173afdc037dce0f433b50dbc325f69500af4c 100644 (file)
@@ -59,8 +59,8 @@
 #include "des_locl.h"
 
 int des_read_password(key, prompt, verify)
-des_cblock (*key);
-char *prompt;
+des_cblock key;
+const char *prompt;
 int verify;
        {
        int ok;
@@ -74,9 +74,9 @@ int verify;
        }
 
 int des_read_2passwords(key1, key2, prompt, verify)
-des_cblock (*key1);
-des_cblock (*key2);
-char *prompt;
+des_cblock key1;
+des_cblock key2;
+const char *prompt;
 int verify;
        {
        int ok;
index 99920f2f86df722bf18947de16e1993d86f381cb..dfc61cf0d9cd8176ba5b9f3506f7bd3201232e86 100644 (file)
@@ -209,7 +209,7 @@ int des_read_pw(buf, buff, size, prompt, verify)
 char *buf;
 char *buff;
 int size;
-char *prompt;
+const char *prompt;
 int verify;
        {
 #ifdef VMS
index 7c1da1f538420458708e5d2ef17060f42e5a2479..9c1dbb29f29a1732aeb6bf50dab65fb31931f50f 100644 (file)
@@ -74,18 +74,16 @@ struct desparams *desp;
        des_key_schedule ks;
        int enc;
 
-       des_set_key((des_cblock *)desp->des_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.
index fe966fd25570c1c4e3c255b02f4eaa027caa9bec..fef8d277fd1a11e31e1a9841e5057e896d5a3a9a 100644 (file)
@@ -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<DES_KEY_SZ; i++)
-               (*key)[i]=odd_parity[(*key)[i]];
+               key[i]=odd_parity[key[i]];
        }
 
 static int check_parity(key)
-des_cblock (*key);
+const des_cblock key;
        {
        int i;
 
        for (i=0; i<DES_KEY_SZ; i++)
                {
-               if ((*key)[i] != odd_parity[(*key)[i]])
+               if (key[i] != odd_parity[key[i]])
                        return(0);
                }
        return(1);
@@ -128,7 +128,7 @@ static des_cblock weak_keys[NUM_WEAK_KEY]={
        {0xFE,0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1}};
 
 int des_is_weak_key(key)
-des_cblock (*key);
+const des_cblock key;
        {
        int i;
 
@@ -158,7 +158,7 @@ des_cblock (*key);
  * return -2 if illegal weak key.
  */
 int des_set_key(key, schedule)
-des_cblock (*key);
+const des_cblock key;
 des_key_schedule schedule;
        {
        static int shifts2[16]={0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0};
@@ -239,7 +239,7 @@ des_key_schedule schedule;
        }
 
 int des_key_sched(key, schedule)
-des_cblock (*key);
+const des_cblock key;
 des_key_schedule schedule;
        {
        return(des_set_key(key,schedule));
index 3365c1bcf3019765dc5a1e85904ed168463389bd..7701580a8d7e148cdfa7848e21dd6e98a9107914 100644 (file)
@@ -61,8 +61,8 @@
 extern int des_check_key;
 
 void des_string_to_key(str, key)
-char *str;
-des_cblock (*key);
+const char *str;
+des_cblock key;
        {
        des_key_schedule ks;
        int i,length;
@@ -72,38 +72,37 @@ des_cblock (*key);
        length=strlen(str);
 #ifdef OLD_STR_TO_KEY
        for (i=0; i<length; i++)
-               (*key)[i%8]^=(str[i]<<1);
+               key[i%8]^=(str[i]<<1);
 #else /* MIT COMPATIBLE */
        for (i=0; i<length; i++)
                {
                j=str[i];
                if ((i%16) < 8)
-                       (*key)[i%8]^=(j<<1);
+                       key[i%8]^=(j<<1);
                else
                        {
                        /* Reverse the bit order 05/05/92 eay */
                        j=((j<<4)&0xf0)|((j>>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<length; i++)
                        {
-                       (*key2)[i]=(*key1)[i]=(str[i]<<1);
+                       key2[i]=key1[i]=(str[i]<<1);
                        }
                }
        else
@@ -125,9 +124,9 @@ des_cblock (*key2);
                for (i=0; i<length; i++)
                        {
                        if ((i/8)&1)
-                               (*key2)[i%8]^=(str[i]<<1);
+                               key2[i%8]^=(str[i]<<1);
                        else
-                               (*key1)[i%8]^=(str[i]<<1);
+                               key1[i%8]^=(str[i]<<1);
                        }
                }
 #else /* MIT COMPATIBLE */
@@ -137,9 +136,9 @@ des_cblock (*key2);
                if ((i%32) < 16)
                        {
                        if ((i%16) < 8)
-                               (*key1)[i%8]^=(j<<1);
+                               key1[i%8]^=(j<<1);
                        else
-                               (*key2)[i%8]^=(j<<1);
+                               key2[i%8]^=(j<<1);
                        }
                else
                        {
@@ -147,23 +146,21 @@ des_cblock (*key2);
                        j=((j<<2)&0xcc)|((j>>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);
index 75c10152529b1e7e6a2066639fd9f007b50cbc23..ff13e073da75af9ac60deaddd39da2077bf628f4 100644 (file)
  * 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 <stdio.h>
 #include "des_locl.h"
 
 void des_cblock_print_file(cb, fp)
-       des_cblock *cb;
+       const des_cblock cb;
        FILE *fp;
 {
        int i;
index 031589bf50d98f3bb17b2e8d17c8906918c041bd..9a9480ec3af0d6bb37498dc1e581b90b570cff58 100644 (file)
@@ -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);
                }
index 5761bf186a1bda2bcf7a544dfe9977ccea0895d4..907e2e94b0760ef3e48aa3cb84a7f2b25f5c13c6 100644 (file)
@@ -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);
        }
index 9ae4558f51a82b16d776a3efb65573aa5a413352..554815ec8abcd9549e3bd7395b8ea2c0f5450fad 100644 (file)
@@ -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);
        }
index 908fc0760a79802e56a498f7254ae1de164ba22c..13d7611bb3f244025fe00fa470da1a2d6bd818d3 100644 (file)
@@ -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,
index 7a409d64595b9cf4c0f89faa929646b99ab89fd6..de3aff5ce219ca43a2c7909a522fba2310a5f11a 100644 (file)
@@ -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);
                }
        }
index 0d7fda0c47f883c1d14e1bb9f5020e6839a7f75c..b0bae80970afee9316d137fa61774ae1de96bff8 100644 (file)
@@ -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);
        }
index 2a086c061248d8d333a693d075b1bae1a6c86a93..72a0c763248c17b8c7ad52c9a0394e3a0833d1da 100644 (file)
@@ -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<len; i+=8)
                {
                c2l(in,tin0); d[0]=dd[0]=tin0;
                c2l(in,tin1); d[1]=dd[1]=tin1;
-               (*h)[0]=((*h)[0]&0x9f)|0x40;
-               (*hh)[0]=((*hh)[0]&0x9f)|0x20;
+               h[0]=(h[0]&0x9f)|0x40;
+               hh[0]=(hh[0]&0x9f)|0x20;
 
                des_set_odd_parity(h);
                des_set_key(h,k);
-               des_encrypt((DES_LONG *)d,k,1);
+               des_encrypt(d,k,1);
 
                des_set_odd_parity(hh);
                des_set_key(hh,k);
-               des_encrypt((DES_LONG *)dd,k,1);
+               des_encrypt(dd,k,1);
 
                ttin0=tin0^dd[0];
                ttin1=tin1^dd[1];
                tin0^=d[0];
                tin1^=d[1];
 
-               p=(unsigned char *)h;
+               p=h;
                l2c(tin0,p);
                l2c(ttin1,p);
                p=(unsigned char *)hh;
index eab80dc7b2b85a4688ff06c458115797b669c8e8..07c0e545f5069814aef1c5b3ca458dc2dc5a1705 100644 (file)
@@ -659,8 +659,8 @@ static ASN1_OBJECT *obj_objs[NUM_OBJ]={
 &(nid_objs[19]),/* OBJ_rsa                          2 5 8 1 1 */
 &(nid_objs[96]),/* OBJ_mdc2WithRSA                  2 5 8 3 100 */
 &(nid_objs[95]),/* OBJ_mdc2                         2 5 8 3 101 */
-&(nid_objs[124]),/* OBJ_rle_compression              1 1 1 1 666.1 */
 &(nid_objs[125]),/* OBJ_zlib_compression             1 1 1 1 666.2 */
+&(nid_objs[124]),/* OBJ_rle_compression              1 1 1 1 666.1 */
 &(nid_objs[104]),/* OBJ_md5WithRSA                   1 3 14 3 2 3 */
 &(nid_objs[29]),/* OBJ_des_ecb                      1 3 14 3 2 6 */
 &(nid_objs[31]),/* OBJ_des_cbc                      1 3 14 3 2 7 */