Finally(?) fix DES stuff.
authorBen Laurie <ben@openssl.org>
Sat, 13 Feb 1999 21:49:34 +0000 (21:49 +0000)
committerBen Laurie <ben@openssl.org>
Sat, 13 Feb 1999 21:49:34 +0000 (21:49 +0000)
13 files changed:
Configure
apps/ca.c
crypto/asn1/asn1.h
crypto/des/cbc_cksm.c
crypto/des/des.org
crypto/des/des_enc.c
crypto/des/ecb_enc.c
crypto/des/read_pwd.c
crypto/evp/e_cbc_d.c
crypto/evp/e_cfb_3d.c
crypto/evp/e_ofb_3d.c
crypto/evp/e_ofb_d.c
crypto/mdc2/mdc2dgst.c

index e89515b5f502cf90a80641c940dd8c1959408f0d..ff9e21d729e9b467e1d2ba729c95da2b5b95c793 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -77,6 +77,7 @@ my %table=(
 # A few of my development configs
 "purify",      "purify gcc:-g -DPURIFY -Wall:-lsocket -lnsl::::",
 "debug",       "gcc:-DBN_DEBUG -DREF_CHECK -DCRYPTO_MDEBUG -ggdb -g2 -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror:-lefence::::",
+"debug-ben",   "gcc:-DBN_DEBUG -DREF_CHECK -DCRYPTO_MDEBUG -Wformat -Wshadow -Werror:::::",
 "debug-rse","gcc:-DTERMIOS -DL_ENDIAN -O -g -ggdb3 -m486 -Wall::BN_LLONG $x86_gcc_des $x86_gcc_opts:$x86_out_asm",
 "dist",                "cc:-O -DNOPROTO::::",
 
index 25e025d180b08d51bb7de810fc09c7a9fa81be73..08f4146dcac18509594bb6f453466037533f8137 100644 (file)
--- a/apps/ca.c
+++ b/apps/ca.c
@@ -1190,7 +1190,7 @@ err:
        }
 
 static int certify(xret,infile,pkey,x509,dgst,policy,db,serial,startdate,days,
-       batch,ext_sect,conf,verbose)
+                  batch,ext_sect,lconf,verbose)
 X509 **xret;
 char *infile;
 EVP_PKEY *pkey;
@@ -1203,7 +1203,7 @@ char *startdate;
 int days;
 int batch;
 char *ext_sect;
-LHASH *conf;
+LHASH *lconf;
 int verbose;
        {
        X509_REQ *req=NULL;
@@ -1252,7 +1252,7 @@ int verbose;
                BIO_printf(bio_err,"Signature ok\n");
 
        ok=do_body(xret,pkey,x509,dgst,policy,db,serial,startdate,
-               days,batch,verbose,req,ext_sect,conf);
+               days,batch,verbose,req,ext_sect,lconf);
 
 err:
        if (req != NULL) X509_REQ_free(req);
@@ -1261,7 +1261,7 @@ err:
        }
 
 static int certify_cert(xret,infile,pkey,x509,dgst,policy,db,serial,startdate,
-       days, batch,ext_sect,conf,verbose)
+                       days,batch,ext_sect,lconf,verbose)
 X509 **xret;
 char *infile;
 EVP_PKEY *pkey;
@@ -1274,7 +1274,7 @@ char *startdate;
 int days;
 int batch;
 char *ext_sect;
-LHASH *conf;
+LHASH *lconf;
 int verbose;
        {
        X509 *req=NULL;
@@ -1326,7 +1326,7 @@ int verbose;
                goto err;
 
        ok=do_body(xret,pkey,x509,dgst,policy,db,serial,startdate,days,
-               batch,verbose,rreq,ext_sect,conf);
+               batch,verbose,rreq,ext_sect,lconf);
 
 err:
        if (rreq != NULL) X509_REQ_free(rreq);
@@ -1336,7 +1336,7 @@ err:
        }
 
 static int do_body(xret,pkey,x509,dgst,policy,db,serial,startdate,days,
-       batch,verbose,req, ext_sect,conf)
+                  batch,verbose,req,ext_sect,lconf)
 X509 **xret;
 EVP_PKEY *pkey;
 X509 *x509;
@@ -1350,7 +1350,7 @@ int batch;
 int verbose;
 X509_REQ *req;
 char *ext_sect;
-LHASH *conf;
+LHASH *lconf;
        {
        X509_NAME *name=NULL,*CAname=NULL,*subject=NULL;
        ASN1_UTCTIME *tm,*tmptm;
@@ -1687,7 +1687,7 @@ again2:
                ctx.crl = NULL;
                ctx.flags = 0;
 
-               if(!X509V3_EXT_add_conf(conf, &ctx, ext_sect, ret)) goto err;
+               if(!X509V3_EXT_add_conf(lconf, &ctx, ext_sect, ret)) goto err;
 
                }
 
@@ -1811,7 +1811,7 @@ int output_der;
        }
 
 static int certify_spkac(xret,infile,pkey,x509,dgst,policy,db,serial,
-       startdate,days,ext_sect,conf,verbose)
+                        startdate,days,ext_sect,lconf,verbose)
 X509 **xret;
 char *infile;
 EVP_PKEY *pkey;
@@ -1823,7 +1823,7 @@ BIGNUM *serial;
 char *startdate;
 int days;
 char *ext_sect;
-LHASH *conf;
+LHASH *lconf;
 int verbose;
        {
        STACK *sk=NULL;
@@ -1969,7 +1969,7 @@ int verbose;
        X509_REQ_set_pubkey(req,pktmp);
        EVP_PKEY_free(pktmp);
        ok=do_body(xret,pkey,x509,dgst,policy,db,serial,startdate,
-               days,1,verbose,req,ext_sect,conf);
+                  days,1,verbose,req,ext_sect,lconf);
 err:
        if (req != NULL) X509_REQ_free(req);
        if (parms != NULL) CONF_free(parms);
index 5054ffd30c9d68b06846df5b4e861f6fbc86a72d..5f0627dbd36bbaf8ce74c1a235c7e60e2f48d6ac 100644 (file)
@@ -471,6 +471,8 @@ ASN1_GENERALIZEDTIME *      d2i_ASN1_GENERALIZEDTIME(ASN1_GENERALIZEDTIME **a,unsigne
 
 int            i2d_ASN1_TIME(ASN1_TIME *a,unsigned char **pp);
 ASN1_TIME *    d2i_ASN1_TIME(ASN1_TIME **a,unsigned char **pp, long length);
+ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s,time_t t);
+
 
   /* for the is_set parameter to i2d_ASN1_SET */
 #define IS_SEQUENCE    0
index c41d51af4bc68b2b585756672d944e6b839455fb..b7048c8a3f693a060906301915453a3e2f7946b6 100644 (file)
@@ -63,7 +63,7 @@ const unsigned char *in;
 des_cblock out;
 long length;
 des_key_schedule schedule;
-des_cblock iv;
+const des_cblock iv;
        {
        register DES_LONG tout0,tout1,tin0,tin1;
        register long l=length;
index e7310b2783d14a493366e1bb4b45942c9a4b185c..6b550e51f3ee57dfca6364405e9b5324e8fe366d 100644 (file)
@@ -80,6 +80,8 @@ extern "C" {
 #endif
 
 typedef unsigned char des_cblock[8];
+typedef unsigned char *des_cblocks; /* Unfortunately there's no way to say that
+                                      we want a multiple of 8 */
 typedef struct des_ks_struct
        {
        union   {
@@ -151,45 +153,58 @@ extern int des_set_weak_key_flag; /* set the weak key flag */
 #endif
 #ifndef NOPROTO
 char *des_options(void);
-void des_ecb3_encrypt(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(des_cblock *input,des_cblock *output,
-       long length,des_key_schedule schedule,des_cblock *ivec);
-void des_cbc_encrypt(des_cblock *input,des_cblock *output,long length,
-       des_key_schedule schedule,des_cblock *ivec,int enc);
-void des_ncbc_encrypt(des_cblock *input,des_cblock *output,long length,
-       des_key_schedule schedule,des_cblock *ivec,int enc);
-void des_xcbc_encrypt(des_cblock *input,des_cblock *output,long length,
-       des_key_schedule schedule,des_cblock *ivec,
-       des_cblock *inw,des_cblock *outw,int enc);
-void des_cfb_encrypt(unsigned char *in,unsigned char *out,int numbits,
-       long length,des_key_schedule schedule,des_cblock *ivec,int enc);
-void des_ecb_encrypt(des_cblock *input,des_cblock *output,
-       des_key_schedule ks,int enc);
+void des_ecb3_encrypt(const unsigned char *input,unsigned char *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);
+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,
+                     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,
+                    int enc);
+void des_ecb_encrypt(const des_cblock input,des_cblock output,
+                    des_key_schedule ks,int enc);
 void des_encrypt(DES_LONG *data,des_key_schedule ks, int enc);
 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(des_cblock *input, des_cblock *output, 
-       long length, des_key_schedule ks1, des_key_schedule ks2, 
-       des_key_schedule ks3, des_cblock *ivec, int enc);
-void des_ede3_cfb64_encrypt(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_ofb64_encrypt(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);
+void des_ede3_cbc_encrypt(const unsigned char *input,unsigned char *output, 
+                         long length,
+                         des_key_schedule ks1,des_key_schedule ks2,
+                         des_key_schedule ks3,des_cblock ivec,int enc);
+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,
+                          des_cblock ivec1,des_cblock ivec2,
+                          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);
+void des_ede3_ofb64_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);
 
-void des_xwhite_in2out(des_cblock (*des_key), des_cblock (*in_white),
-       des_cblock (*out_white));
+void des_xwhite_in2out(const des_cblock des_key,const des_cblock in_white,
+                      des_cblock out_white);
 
 int des_enc_read(int fd,char *buf,int len,des_key_schedule sched,
-       des_cblock *iv);
-int des_enc_write(int fd,char *buf,int len,des_key_schedule sched,
-       des_cblock *iv);
+                des_cblock iv);
+int des_enc_write(int fd,const char *buf,int len,des_key_schedule sched,
+                 des_cblock iv);
 char *des_fcrypt(const char *buf,const char *salt, char *ret);
 #if defined(PERL5) || defined(__FreeBSD__)
 char *des_crypt(const char *buf,const char *salt);
@@ -202,32 +217,34 @@ char *crypt(const char *buf,const char *salt);
 char *crypt();
 #endif
 #endif
-void des_ofb_encrypt(unsigned char *in,unsigned char *out,
-       int numbits,long length,des_key_schedule schedule,des_cblock *ivec);
-void des_pcbc_encrypt(des_cblock *input,des_cblock *output,long length,
-       des_key_schedule schedule,des_cblock *ivec,int enc);
-DES_LONG des_quad_cksum(des_cblock *input,des_cblock *output,
-       long length,int out_count,des_cblock *seed);
+void des_ofb_encrypt(const unsigned char *in,unsigned char *out,int numbits,
+                    long length,des_key_schedule schedule,des_cblock ivec);
+void des_pcbc_encrypt(const unsigned char *input,unsigned char *output,
+                     long length,des_key_schedule schedule,des_cblock ivec,
+                     int enc);
+DES_LONG des_quad_cksum(const unsigned char *input,des_cblocks output,
+                       long length,int out_count,des_cblock seed);
 void des_random_seed(des_cblock key);
 void des_random_key(des_cblock ret);
-int des_read_password(des_cblock *key,char *prompt,int verify);
-int des_read_2passwords(des_cblock *key1,des_cblock *key2,
-       char *prompt,int verify);
-int des_read_pw_string(char *buf,int length,char *prompt,int verify);
-void des_set_odd_parity(des_cblock *key);
-int des_is_weak_key(des_cblock *key);
-int des_set_key(des_cblock *key,des_key_schedule schedule);
-int des_key_sched(des_cblock *key,des_key_schedule schedule);
-void des_string_to_key(char *str,des_cblock *key);
-void des_string_to_2keys(char *str,des_cblock *key1,des_cblock *key2);
-void des_cfb64_encrypt(unsigned char *in, unsigned char *out, long length,
-       des_key_schedule schedule, des_cblock *ivec, int *num, int enc);
-void des_ofb64_encrypt(unsigned char *in, unsigned char *out, long length,
-       des_key_schedule schedule, des_cblock *ivec, int *num);
-int des_read_pw(char *buf, char *buff, int size, char *prompt, int verify);
+int des_read_password(des_cblock key,const char *prompt,int verify);
+int des_read_2passwords(des_cblock key1,des_cblock key2,
+                       const char *prompt,int verify);
+int des_read_pw_string(char *buf,int length,const char *prompt,int verify);
+void des_set_odd_parity(des_cblock key);
+int des_is_weak_key(const des_cblock key);
+int des_set_key(const des_cblock key,des_key_schedule schedule);
+int des_key_sched(const des_cblock key,des_key_schedule schedule);
+void des_string_to_key(const char *str,des_cblock key);
+void des_string_to_2keys(const char *str,des_cblock key1,des_cblock key2);
+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_ofb64_encrypt(const unsigned char *in,unsigned char *out,long length,
+                      des_key_schedule schedule,des_cblock ivec,int *num);
+int des_read_pw(char *buf,char *buff,int size,const char *prompt,int verify);
 
 /* Extra functions from Mark Murray <mark@grondar.za> */
-void des_cblock_print_file(des_cblock *cb, FILE *fp);
+void des_cblock_print_file(const des_cblock cb, FILE *fp);
 /* The following functions are not in the normal unix build or the
  * SSLeay build.  When using the SSLeay build, use RAND_seed()
  * and RAND_bytes() instead. */
index e4db09299ec2d86132a302a8fbe03c9b03842a00..40df30261e945beaa054bc4c23aeb85c90ce9d4b 100644 (file)
@@ -301,24 +301,21 @@ des_key_schedule ks3;
 
 #ifndef DES_DEFAULT_OPTIONS
 
-void des_ncbc_encrypt(input, output, length, schedule, ivec, enc)
-des_cblock (*input);
-des_cblock (*output);
+void des_ncbc_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)
                {
@@ -343,7 +340,7 @@ int enc;
                        tout0=tin[0]; l2c(tout0,out);
                        tout1=tin[1]; l2c(tout1,out);
                        }
-               iv=(unsigned char *)ivec;
+               iv=ivec;
                l2c(tout0,iv);
                l2c(tout1,iv);
                }
@@ -375,7 +372,7 @@ int enc;
                        xor1=tin1;
                        }
 
-               iv=(unsigned char *)ivec;
+               iv=ivec;
                l2c(xor0,iv);
                l2c(xor1,iv);
                }
@@ -384,13 +381,13 @@ int enc;
        }
 
 void des_ede3_cbc_encrypt(input, output, length, ks1, ks2, ks3, ivec, enc)
-des_cblock (*input);
-des_cblock (*output);
+const unsigned char *input;
+unsigned char *output;
 long length;
 des_key_schedule ks1;
 des_key_schedule ks2;
 des_key_schedule ks3;
-des_cblock (*ivec);
+des_cblock ivec;
 int enc;
        {
        register DES_LONG tin0,tin1;
index 78e1f2d64e96b13a5e81ab9232486de18115f056..a5c2c1e77c050bf9fed3b6033a79a3b48939c804 100644 (file)
@@ -103,8 +103,8 @@ char *des_options()
                
 
 void des_ecb_encrypt(in, out, ks, enc)
-const unsigned char *in;
-unsigned char *out;
+const des_cblock in;
+des_cblock out;
 des_key_schedule ks;
 int enc;
        {
index dfc61cf0d9cd8176ba5b9f3506f7bd3201232e86..f2a4f4d5183e1e8646ed541675fb2cb9184f3b59 100644 (file)
@@ -179,7 +179,7 @@ static jmp_buf save;
 int des_read_pw_string(buf, length, prompt, verify)
 char *buf;
 int length;
-char *prompt;
+const char *prompt;
 int verify;
        {
        char buff[BUFSIZ];
index c67706e3a093ff7fac3514b8c89bee5aa44b07e8..f18c8c7e0745e78a01ac398ab449a66d8daaa847 100644 (file)
@@ -99,7 +99,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_cbc_cipher(ctx,out,in,inl)
@@ -108,9 +108,5 @@ unsigned char *out;
 unsigned char *in;
 unsigned int inl;
        {
-       des_ncbc_encrypt(
-               (des_cblock *)in,(des_cblock *)out,
-               (long)inl, ctx->c.des_ks,
-               (des_cblock *)&(ctx->iv[0]),
-               ctx->encrypt);
+       des_ncbc_encrypt(in,out,inl,ctx->c.des_ks,&(ctx->iv[0]),ctx->encrypt);
        }
index e7e3419411dcc043896f54b8e31282b033e96d04..88ace5c54383c23c1c2c78c525e31f40e598d6c8 100644 (file)
@@ -123,8 +123,8 @@ int enc;
        memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8);
        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));
@@ -144,9 +144,9 @@ int enc;
        memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8);
        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);
                }
        }
 
@@ -156,11 +156,9 @@ unsigned char *out;
 unsigned char *in;
 unsigned int inl;
        {
-       des_ede3_cfb64_encrypt(
-               in,out,(long)inl,
-               ctx->c.des_ede.ks1,
-               ctx->c.des_ede.ks2,
-               ctx->c.des_ede.ks3,
-               (des_cblock *)&(ctx->iv[0]),
-               &ctx->num,ctx->encrypt);
+       des_ede3_cfb64_encrypt(in,out,(long)inl,
+                              ctx->c.des_ede.ks1,
+                              ctx->c.des_ede.ks2,
+                              ctx->c.des_ede.ks3,
+                              &(ctx->iv[0]),&ctx->num,ctx->encrypt);
        }
index c3add18e936ce04cfb7cbc83249a854f83ae82d2..a3981288f1ce05d4db736c1b9eee453c7d56c356 100644 (file)
@@ -123,8 +123,8 @@ int enc;
        memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8);
        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));
@@ -144,9 +144,9 @@ int enc;
        memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8);
        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);
                }
        }
 
@@ -156,10 +156,7 @@ unsigned char *out;
 unsigned char *in;
 unsigned int inl;
        {
-       des_ede3_ofb64_encrypt(
-               in,out,
-               (long)inl,
-               ctx->c.des_ede.ks1, ctx->c.des_ede.ks2, ctx->c.des_ede.ks3,
-               (des_cblock *)&(ctx->iv[0]),
-               &ctx->num);
+       des_ede3_ofb64_encrypt(in,out,inl,ctx->c.des_ede.ks1,
+                              ctx->c.des_ede.ks2, ctx->c.des_ede.ks3,
+                              &(ctx->iv[0]),&ctx->num);
        }
index 09d4b4139d407a8a14f76242b5be6d1b4e37dccc..30f6e0451c7ddccf1de5d8d2b8aad2f184a607b3 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_ofb_cipher(ctx,out,in,inl)
@@ -110,9 +110,5 @@ unsigned char *out;
 unsigned char *in;
 unsigned int inl;
        {
-       des_ofb64_encrypt(
-               in,out,
-               (long)inl, ctx->c.des_ks,
-               (des_cblock *)&(ctx->iv[0]),
-               &ctx->num);
+       des_ofb64_encrypt(in,out,inl,ctx->c.des_ks,&(ctx->iv[0]),&ctx->num);
        }
index 72a0c763248c17b8c7ad52c9a0394e3a0833d1da..f2803fb58c106ab8d4d226d60a3e59617039f353 100644 (file)
@@ -135,27 +135,23 @@ unsigned int len;
        register DES_LONG tin0,tin1;
        register DES_LONG ttin0,ttin1;
        DES_LONG d[2],dd[2];
-       unsigned char *h,*hh;
        des_key_schedule k;
        unsigned char *p;
        unsigned int i;
 
-       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;
+               c->h[0]=(c->h[0]&0x9f)|0x40;
+               c->hh[0]=(c->hh[0]&0x9f)|0x20;
 
-               des_set_odd_parity(h);
-               des_set_key(h,k);
+               des_set_odd_parity(c->h);
+               des_set_key(c->h,k);
                des_encrypt(d,k,1);
 
-               des_set_odd_parity(hh);
-               des_set_key(hh,k);
+               des_set_odd_parity(c->hh);
+               des_set_key(c->hh,k);
                des_encrypt(dd,k,1);
 
                ttin0=tin0^dd[0];
@@ -163,10 +159,10 @@ unsigned int len;
                tin0^=d[0];
                tin1^=d[1];
 
-               p=h;
+               p=c->h;
                l2c(tin0,p);
                l2c(ttin1,p);
-               p=(unsigned char *)hh;
+               p=c->hh;
                l2c(ttin0,p);
                l2c(tin1,p);
                }