Source code cleanups: Use void * rather than char * in lhash,
authorUlf Möller <ulf@openssl.org>
Sun, 30 Jan 2000 22:20:28 +0000 (22:20 +0000)
committerUlf Möller <ulf@openssl.org>
Sun, 30 Jan 2000 22:20:28 +0000 (22:20 +0000)
eliminate some of the -Wcast-qual warnings (debug-ben-strict target)

36 files changed:
Makefile.org
apps/openssl.c
crypto/asn1/a_type.c
crypto/asn1/p7_lib.c
crypto/asn1/x_pkey.c
crypto/bio/b_dump.c
crypto/bio/b_sock.c
crypto/cast/c_ecb.c
crypto/conf/conf.c
crypto/crypto.h
crypto/des/enc_writ.c
crypto/des/str2key.c
crypto/err/err.c
crypto/evp/bio_ok.c
crypto/lhash/lhash.c
crypto/lhash/lhash.h
crypto/md5/md5_dgst.c
crypto/mem.c
crypto/mem_dbg.c
crypto/objects/o_names.c
crypto/objects/obj_dat.c
crypto/rand/rand.h
crypto/rand/randfile.c
crypto/ripemd/rmd_dgst.c
crypto/sha/sha1dgst.c
crypto/sha/sha_dgst.c
crypto/txt_db/txt_db.c
crypto/x509/by_dir.c
crypto/x509/x509_lu.c
crypto/x509/x509_vfy.c
ssl/s23_lib.c
ssl/s3_srvr.c
ssl/ssl.h
ssl/ssl_lib.c
ssl/ssl_sess.c
ssl/t1_lib.c

index 0f370d2ea558186a640ca0601f8c50e747ee9ddd..245b6b55f4a2727a82a9a8952e2e611e5a8d0285 100644 (file)
@@ -355,8 +355,8 @@ install: all
                chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i ); \
        done
        @echo installing man 1
-       @for i in doc/apps/*.pod; do (cd `dirname $$i`; fn=`basename $$i .pod`; sec=`[ "$$fn" = "config" ] && echo 5 || echo 1`; ../../util/pod2man.pl --section=$$sec --date=`date +%Y-%m-%d` --center=OpenSSL --release=$(VERSION) `basename $$i` >  $(INSTALL_PREFIX)$(INSTALLTOP)/man/man$$sec/`basename $$i .pod`.$$sec); done
+       @for i in doc/apps/*.pod; do (cd `dirname $$i`; fn=`basename $$i .pod`; sec=`[ "$$fn" = "config" ] && echo 5 || echo 1`; ../../util/pod2man.pl --section=$$sec --center=OpenSSL --release=$(VERSION) `basename $$i` >  $(INSTALL_PREFIX)$(INSTALLTOP)/man/man$$sec/`basename $$i .pod`.$$sec); done
        @echo installing man 3
-       @for i in doc/crypto/*.pod doc/ssl/*.pod; do (cd `dirname $$i`; ../../util/pod2man.pl --section=3 --date=`date +%Y-%m-%d` --center=OpenSSL --release=$(VERSION) `basename $$i` >  $(INSTALL_PREFIX)$(INSTALLTOP)/man/man3/`basename $$i .pod`.3); done
+       @for i in doc/crypto/*.pod doc/ssl/*.pod; do (cd `dirname $$i`; ../../util/pod2man.pl --section=3 --center=OpenSSL --release=$(VERSION) `basename $$i` >  $(INSTALL_PREFIX)$(INSTALLTOP)/man/man3/`basename $$i .pod`.3); done
 
 # DO NOT DELETE THIS LINE -- make depend depends on it.
index 71f5ba7f6704020d82eb491edcc5ae52a9c4b99c..17f9fe6ba769f27fd415bfaa49fd2c5c95788f24 100644 (file)
@@ -164,7 +164,7 @@ int main(int Argc, char *Argv[])
        program_name(Argv[0],pname,PROG_NAME_SIZE);
 
        f.name=pname;
-       fp=(FUNCTION *)lh_retrieve(prog,(char *)&f);
+       fp=(FUNCTION *)lh_retrieve(prog,&f);
        if (fp != NULL)
                {
                Argv[0]=pname;
@@ -262,7 +262,7 @@ static int do_cmd(LHASH *prog, int argc, char *argv[])
        if ((argc <= 0) || (argv[0] == NULL))
                { ret=0; goto end; }
        f.name=argv[0];
-       fp=(FUNCTION *)lh_retrieve(prog,(char *)&f);
+       fp=(FUNCTION *)lh_retrieve(prog,&f);
        if (fp != NULL)
                {
                ret=fp->func(argc,argv);
@@ -361,7 +361,7 @@ static LHASH *prog_init(void)
        if ((ret=lh_new(hash,cmp)) == NULL) return(NULL);
 
        for (f=functions; f->name != NULL; f++)
-               lh_insert(ret,(char *)f);
+               lh_insert(ret,f);
        return(ret);
        }
 
index 3f2ecee5c2f58c8ad87ee2505a3d37aaea75b353..92efb0ba0265c8029ad3a32ddd1fd1e8a1c1962e 100644 (file)
@@ -282,7 +282,7 @@ void ASN1_TYPE_free(ASN1_TYPE *a)
        {
        if (a == NULL) return;
        ASN1_TYPE_component_free(a);
-       Free((char *)(char *)a);
+       Free((char *)a);
        }
 
 int ASN1_TYPE_get(ASN1_TYPE *a)
index d3e596dab3ee325a63c76e6b7a257561f85c3df1..638a04c966b96d48612950dc061c815898a21b77 100644 (file)
@@ -251,7 +251,7 @@ void PKCS7_free(PKCS7 *a)
                {
                ASN1_OBJECT_free(a->type);
                }
-       Free((char *)(char *)a);
+       Free((char *)a);
        }
 
 void PKCS7_content_free(PKCS7 *a)
index 0c81558dc4b2263fbf284b5a43479afb7340bd26..b8c30b3cd5cb15c6463bb811b80b6247f707a1b0 100644 (file)
@@ -147,5 +147,5 @@ void X509_PKEY_free(X509_PKEY *x)
        if (x->enc_pkey != NULL) M_ASN1_OCTET_STRING_free(x->enc_pkey);
        if (x->dec_pkey != NULL)EVP_PKEY_free(x->dec_pkey);
        if ((x->key_data != NULL) && (x->key_free)) Free((char *)x->key_data);
-       Free((char *)(char *)x);
+       Free((char *)x);
        }
index a7cd828978505ca1607cca7f84eb28a15466276f..f5aeb237f502bf2bf5cbec36422f4dbb32ec93ee 100644 (file)
@@ -92,7 +92,7 @@ int BIO_dump(BIO *bio, const char *s, int len)
       if (((i*DUMP_WIDTH)+j)>=len) {
        strcat(buf,"   ");
       } else {
-        ch=((unsigned char)*((char *)(s)+i*DUMP_WIDTH+j)) & 0xff;
+        ch=((unsigned char)*(s+i*DUMP_WIDTH+j)) & 0xff;
        sprintf(tmp,"%02x%c",ch,j==7?'-':' ');
         strcat(buf,tmp);
       }
@@ -101,7 +101,7 @@ int BIO_dump(BIO *bio, const char *s, int len)
     for(j=0;j<DUMP_WIDTH;j++) {
       if (((i*DUMP_WIDTH)+j)>=len)
        break;
-      ch=((unsigned char)*((char *)(s)+i*DUMP_WIDTH+j)) & 0xff;
+      ch=((unsigned char)*(s+i*DUMP_WIDTH+j)) & 0xff;
 #ifndef CHARSET_EBCDIC
       sprintf(tmp,"%c",((ch>=' ')&&(ch<='~'))?ch:'.');
 #else
index dce0c0390bba3e34e8e37e4d64807c13685bda43..a8610f2021d2f89748e875177f3dc6e5890436c5 100644 (file)
@@ -166,7 +166,11 @@ int BIO_get_port(const char *str, unsigned short *port_ptr)
                /* Note: under VMS with SOCKETSHR, it seems like the first
                 * parameter is 'char *', instead of 'const char *'
                 */
-               s=getservbyname((char *)str,"tcp");
+               s=getservbyname(
+#ifndef CONST_STRICT
+                   (char *)
+#endif
+                   str,"tcp");
                if(s != NULL)
                        *port_ptr=ntohs((unsigned short)s->s_port);
                CRYPTO_w_unlock(CRYPTO_LOCK_GETSERVBYNAME);
@@ -374,7 +378,11 @@ struct hostent *BIO_gethostbyname(const char *name)
                /* Note: under VMS with SOCKETSHR, it seems like the first
                 * parameter is 'char *', instead of 'const char *'
                 */
-               ret=gethostbyname((char *)name);
+               ret=gethostbyname(
+#ifndef CONST_STRICT
+                   (char *)
+#endif
+                   name);
 
                if (ret == NULL)
                        goto end;
index 33182f2b7126191836dc84a852e98d233602b7c2..0b3da9ad871784d0504396fdee3cc4aef19e9579 100644 (file)
@@ -60,7 +60,7 @@
 #include "cast_lcl.h"
 #include <openssl/opensslv.h>
 
-char *CAST_version="CAST" OPENSSL_VERSION_PTEXT;
+const char *CAST_version="CAST" OPENSSL_VERSION_PTEXT;
 
 void CAST_ecb_encrypt(const unsigned char *in, unsigned char *out,
                      CAST_KEY *ks, int enc)
index 13db218a29efe9542d1b20bb84af29ebcfb64f26..3031fa3b44902f6089788a07260f9a307e889085 100644 (file)
@@ -336,7 +336,7 @@ again:
                                                        ERR_R_MALLOC_FAILURE);
                                goto err;
                                }
-                       vv=(CONF_VALUE *)lh_insert(ret,(char *)v);
+                       vv=(CONF_VALUE *)lh_insert(ret,v);
                        if (vv != NULL)
                                {
                                sk_CONF_VALUE_delete_ptr(ts,vv);
@@ -378,7 +378,7 @@ char *CONF_get_string(LHASH *conf, char *section, char *name)
                        {
                        vv.name=name;
                        vv.section=section;
-                       v=(CONF_VALUE *)lh_retrieve(conf,(char *)&vv);
+                       v=(CONF_VALUE *)lh_retrieve(conf,&vv);
                        if (v != NULL) return(v->value);
                        if (strcmp(section,"ENV") == 0)
                                {
@@ -388,7 +388,7 @@ char *CONF_get_string(LHASH *conf, char *section, char *name)
                        }
                vv.section="default";
                vv.name=name;
-               v=(CONF_VALUE *)lh_retrieve(conf,(char *)&vv);
+               v=(CONF_VALUE *)lh_retrieve(conf,&vv);
                if (v != NULL)
                        return(v->value);
                else
@@ -405,7 +405,7 @@ static CONF_VALUE *get_section(LHASH *conf, char *section)
        if ((conf == NULL) || (section == NULL)) return(NULL);
        vv.name=NULL;
        vv.section=section;
-       v=(CONF_VALUE *)lh_retrieve(conf,(char *)&vv);
+       v=(CONF_VALUE *)lh_retrieve(conf,&vv);
        return(v);
        }
 
@@ -443,12 +443,12 @@ void CONF_free(LHASH *conf)
 
        conf->down_load=0;      /* evil thing to make sure the 'Free()'
                                 * works as expected */
-       lh_doall_arg(conf,(void (*)())value_free_hash,(char *)conf);
+       lh_doall_arg(conf,(void (*)())value_free_hash,conf);
 
        /* We now have only 'section' entries in the hash table.
         * Due to problems with */
 
-       lh_doall_arg(conf,(void (*)())value_free_stack,(char *)conf);
+       lh_doall_arg(conf,(void (*)())value_free_stack,conf);
        lh_free(conf);
        }
 
@@ -456,7 +456,7 @@ static void value_free_hash(CONF_VALUE *a, LHASH *conf)
        {
        if (a->name != NULL)
                {
-               a=(CONF_VALUE *)lh_delete(conf,(char *)a);
+               a=(CONF_VALUE *)lh_delete(conf,a);
                }
        }
 
@@ -708,7 +708,7 @@ static CONF_VALUE *new_section(LHASH *conf, char *section)
        v->name=NULL;
        v->value=(char *)sk;
        
-       vv=(CONF_VALUE *)lh_insert(conf,(char *)v);
+       vv=(CONF_VALUE *)lh_insert(conf,v);
        if (vv != NULL)
                {
 #if !defined(NO_STDIO) && !defined(WIN16)
index 6334eab23875bbd04c70ea76cd713421aa7fc38c..f58ebc4a73091836f033b5282d5eede03bef4fbb 100644 (file)
@@ -302,12 +302,12 @@ void CRYPTO_get_mem_functions(void *(**m)(size_t),void *(**r)(void *, size_t), v
 void CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void *));
 void CRYPTO_get_mem_debug_functions(void (**m)(),void (**r)(),void (**f)(),void (**so)(),long (**go)());
 
-void *CRYPTO_malloc_locked(int num, char *file, int line);
+void *CRYPTO_malloc_locked(int num, const char *file, int line);
 void CRYPTO_free_locked(void *);
-void *CRYPTO_malloc(int num, char *file, int line);
+void *CRYPTO_malloc(int num, const char *file, int line);
 void CRYPTO_free(void *);
-void *CRYPTO_realloc(void *addr,int num, char *file, int line);
-void *CRYPTO_remalloc(void *addr,int num, char *file, int line);
+void *CRYPTO_realloc(void *addr,int num, const char *file, int line);
+void *CRYPTO_remalloc(void *addr,int num, const char *file, int line);
 
 void CRYPTO_set_mem_debug_options(long bits);
 long CRYPTO_get_mem_debug_options();
index 892f15e2d709706a08fe4492af868986e9f532ac..917ec725ea7b9fc04bf4dbbe776bf0774aa07e74 100644 (file)
@@ -135,7 +135,7 @@ int des_enc_write(int fd, const void *_buf, int len,
                }
        else
                {
-               cp=(unsigned char*)buf;
+               cp=buf;
                rnum=((len+7)/8*8); /* round up to nearest eight */
                }
 
index 55228249526bf199262e4783ecfc3f8db9e2e3b1..c6abb872012f4cf2087d46fb5f40e6c7fe92714d 100644 (file)
@@ -87,7 +87,7 @@ void des_string_to_key(const char *str, des_cblock *key)
 #endif
        des_set_odd_parity(key);
        des_set_key_unchecked(key,ks);
-       des_cbc_cksum((unsigned char*)str,key,length,ks,key);
+       des_cbc_cksum((const unsigned char*)str,key,length,ks,key);
        memset(ks,0,sizeof(ks));
        des_set_odd_parity(key);
        }
@@ -146,9 +146,9 @@ void des_string_to_2keys(const char *str, des_cblock *key1, des_cblock *key2)
        des_set_odd_parity(key1);
        des_set_odd_parity(key2);
        des_set_key_unchecked(key1,ks);
-       des_cbc_cksum((unsigned char*)str,key1,length,ks,key1);
+       des_cbc_cksum((const unsigned char*)str,key1,length,ks,key1);
        des_set_key_unchecked(key2,ks);
-       des_cbc_cksum((unsigned char*)str,key2,length,ks,key2);
+       des_cbc_cksum((const unsigned char*)str,key2,length,ks,key2);
        memset(ks,0,sizeof(ks));
        des_set_odd_parity(key1);
        des_set_odd_parity(key2);
index 8baa53c40d26ccf7cca50681fbb04331671cc3c8..9b4eb612ed88a2868417e6d509c3ead3619b9c07 100644 (file)
@@ -222,7 +222,7 @@ void ERR_load_strings(int lib, ERR_STRING_DATA *str)
        while (str->error)
                {
                str->error|=ERR_PACK(lib,0,0);
-               lh_insert(error_hash,(char *)str);
+               lh_insert(error_hash,str);
                str++;
                }
        CRYPTO_w_unlock(CRYPTO_LOCK_ERR_HASH);
@@ -428,7 +428,7 @@ const char *ERR_lib_error_string(unsigned long e)
        if (error_hash != NULL)
                {
                d.error=ERR_PACK(l,0,0);
-               p=(ERR_STRING_DATA *)lh_retrieve(error_hash,(char *)&d);
+               p=(ERR_STRING_DATA *)lh_retrieve(error_hash,&d);
                }
 
        CRYPTO_r_unlock(CRYPTO_LOCK_ERR_HASH);
@@ -449,7 +449,7 @@ const char *ERR_func_error_string(unsigned long e)
        if (error_hash != NULL)
                {
                d.error=ERR_PACK(l,f,0);
-               p=(ERR_STRING_DATA *)lh_retrieve(error_hash,(char *)&d);
+               p=(ERR_STRING_DATA *)lh_retrieve(error_hash,&d);
                }
 
        CRYPTO_r_unlock(CRYPTO_LOCK_ERR_HASH);
@@ -470,12 +470,11 @@ const char *ERR_reason_error_string(unsigned long e)
        if (error_hash != NULL)
                {
                d.error=ERR_PACK(l,0,r);
-               p=(ERR_STRING_DATA *)lh_retrieve(error_hash,(char *)&d);
+               p=(ERR_STRING_DATA *)lh_retrieve(error_hash,&d);
                if (p == NULL)
                        {
                        d.error=ERR_PACK(0,0,r);
-                       p=(ERR_STRING_DATA *)lh_retrieve(error_hash,
-                               (char *)&d);
+                       p=(ERR_STRING_DATA *)lh_retrieve(error_hash,&d);
                        }
                }
 
@@ -518,7 +517,7 @@ void ERR_remove_state(unsigned long pid)
                pid=(unsigned long)CRYPTO_thread_id();
        tmp.pid=pid;
        CRYPTO_w_lock(CRYPTO_LOCK_ERR);
-       p=(ERR_STATE *)lh_delete(thread_hash,(char *)&tmp);
+       p=(ERR_STATE *)lh_delete(thread_hash,&tmp);
        CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
 
        if (p != NULL) ERR_STATE_free(p);
@@ -552,7 +551,7 @@ ERR_STATE *ERR_get_state(void)
        else
                {
                tmp.pid=pid;
-               ret=(ERR_STATE *)lh_retrieve(thread_hash,(char *)&tmp);
+               ret=(ERR_STATE *)lh_retrieve(thread_hash,&tmp);
                CRYPTO_r_unlock(CRYPTO_LOCK_ERR);
                }
 
@@ -570,7 +569,7 @@ ERR_STATE *ERR_get_state(void)
                        ret->err_data_flags[i]=0;
                        }
                CRYPTO_w_lock(CRYPTO_LOCK_ERR);
-               tmpp=(ERR_STATE *)lh_insert(thread_hash,(char *)ret);
+               tmpp=(ERR_STATE *)lh_insert(thread_hash,ret);
                CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
                if (tmpp != NULL) /* old entry - should not happen */
                        {
index a54384a71c8bf1e370b0adce1d0664a2a4198514..16f6e60ad8c3639b56483ce40b25b91db7412488 100644 (file)
@@ -456,7 +456,7 @@ static void sig_out(BIO* b)
        longswap(&(ctx->buf[ctx->buf_len]), md->digest->md_size);
        ctx->buf_len+= md->digest->md_size;
 
-       EVP_DigestUpdate(md, (unsigned char*)WELLKNOWN, strlen(WELLKNOWN));
+       EVP_DigestUpdate(md, WELLKNOWN, strlen(WELLKNOWN));
        md->digest->final(&(ctx->buf[ctx->buf_len]), &(md->md.base[0]));
        ctx->buf_len+= md->digest->md_size;
        ctx->blockout= 1;
@@ -480,7 +480,7 @@ static void sig_in(BIO* b)
        longswap(&(md->md.base[0]), md->digest->md_size);
        ctx->buf_off+= md->digest->md_size;
 
-       EVP_DigestUpdate(md, (unsigned char*)WELLKNOWN, strlen(WELLKNOWN));
+       EVP_DigestUpdate(md, WELLKNOWN, strlen(WELLKNOWN));
        md->digest->final(tmp, &(md->md.base[0]));
        ret= memcmp(&(ctx->buf[ctx->buf_off]), tmp, md->digest->md_size) == 0;
        ctx->buf_off+= md->digest->md_size;
index 801322beb640fd858887bb988147f19c8993ac6e..4d025d7ee737910683125a3b16d55a0663d9dc8a 100644 (file)
@@ -107,12 +107,9 @@ const char *lh_version="lhash" OPENSSL_VERSION_PTEXT;
 #define UP_LOAD                (2*LH_LOAD_MULT) /* load times 256  (default 2) */
 #define DOWN_LOAD      (LH_LOAD_MULT)   /* load times 256  (default 1) */
 
-
-#define P_CP   char *
-#define P_CPP  char *,char *
 static void expand(LHASH *lh);
 static void contract(LHASH *lh);
-static LHASH_NODE **getrn(LHASH *lh, char *data, unsigned long *rhash);
+static LHASH_NODE **getrn(LHASH *lh, void *data, unsigned long *rhash);
 
 LHASH *lh_new(unsigned long (*h)(), int (*c)())
        {
@@ -179,11 +176,11 @@ void lh_free(LHASH *lh)
        Free((char *)lh);
        }
 
-char *lh_insert(LHASH *lh, char *data)
+void *lh_insert(LHASH *lh, void *data)
        {
        unsigned long hash;
        LHASH_NODE *nn,**rn;
-       char *ret;
+       void *ret;
 
        lh->error=0;
        if (lh->up_load <= (lh->num_items*LH_LOAD_MULT/lh->num_nodes))
@@ -217,11 +214,11 @@ char *lh_insert(LHASH *lh, char *data)
        return(ret);
        }
 
-char *lh_delete(LHASH *lh, char *data)
+void *lh_delete(LHASH *lh, void *data)
        {
        unsigned long hash;
        LHASH_NODE *nn,**rn;
-       char *ret;
+       void *ret;
 
        lh->error=0;
        rn=getrn(lh,data,&hash);
@@ -248,11 +245,11 @@ char *lh_delete(LHASH *lh, char *data)
        return(ret);
        }
 
-char *lh_retrieve(LHASH *lh, char *data)
+void *lh_retrieve(LHASH *lh, void *data)
        {
        unsigned long hash;
        LHASH_NODE **rn;
-       char *ret;
+       void *ret;
 
        lh->error=0;
        rn=getrn(lh,data,&hash);
@@ -275,7 +272,7 @@ void lh_doall(LHASH *lh, void (*func)())
        lh_doall_arg(lh,func,NULL);
        }
 
-void lh_doall_arg(LHASH *lh, void (*func)(), char *arg)
+void lh_doall_arg(LHASH *lh, void (*func)(), void *arg)
        {
        int i;
        LHASH_NODE *a,*n;
@@ -332,7 +329,7 @@ static void expand(LHASH *lh)
        if ((lh->p) >= lh->pmax)
                {
                j=(int)lh->num_alloc_nodes*2;
-               n=(LHASH_NODE **)Realloc((char *)lh->b,
+               n=(LHASH_NODE **)Realloc(lh->b,
                        (unsigned int)sizeof(LHASH_NODE *)*j);
                if (n == NULL)
                        {
@@ -360,7 +357,7 @@ static void contract(LHASH *lh)
        lh->b[lh->p+lh->pmax-1]=NULL; /* 24/07-92 - eay - weird but :-( */
        if (lh->p == 0)
                {
-               n=(LHASH_NODE **)Realloc((char *)lh->b,
+               n=(LHASH_NODE **)Realloc(lh->b,
                        (unsigned int)(sizeof(LHASH_NODE *)*lh->pmax));
                if (n == NULL)
                        {
@@ -391,7 +388,7 @@ static void contract(LHASH *lh)
                }
        }
 
-static LHASH_NODE **getrn(LHASH *lh, char *data, unsigned long *rhash)
+static LHASH_NODE **getrn(LHASH *lh, void *data, unsigned long *rhash)
        {
        LHASH_NODE **ret,*n1;
        unsigned long hash,nn;
@@ -426,8 +423,7 @@ static LHASH_NODE **getrn(LHASH *lh, char *data, unsigned long *rhash)
        }
 
 /*
-static unsigned long lh_strhash(str)
-char *str;
+unsigned long lh_strhash(char *str)
        {
        int i,l;
        unsigned long ret=0;
index 6e5a1fe708526b9b1a7805f80b438cd94c5e9c38..6f6eeb2698a65af74b49a54ea706468a15ca5c3f 100644 (file)
@@ -73,7 +73,7 @@ extern "C" {
 
 typedef struct lhash_node_st
        {
-       char *data;
+       void *data;
        struct lhash_node_st *next;
 #ifndef NO_HASH_COMP
        unsigned long hash;
@@ -116,13 +116,13 @@ typedef struct lhash_st
  * in lh_insert(). */
 #define lh_error(lh)   ((lh)->error)
 
-LHASH *lh_new(unsigned long (*h)(), int (*c)());
+LHASH *lh_new(unsigned long (*h)(/* void *a */), int (*c)(/* void *a,void *b */));
 void lh_free(LHASH *lh);
-char *lh_insert(LHASH *lh, char *data);
-char *lh_delete(LHASH *lh, char *data);
-char *lh_retrieve(LHASH *lh, char *data);
-void lh_doall(LHASH *lh, void (*func)(/* char *b */));
-void lh_doall_arg(LHASH *lh, void (*func)(/*char *a,char *b*/),char *arg);
+void *lh_insert(LHASH *lh, void *data);
+void *lh_delete(LHASH *lh, void *data);
+void *lh_retrieve(LHASH *lh, void *data);
+    void lh_doall(LHASH *lh, void (*func)(/*void *b*/));
+void lh_doall_arg(LHASH *lh, void (*func)(/*void *a,void *b*/),void *arg);
 unsigned long lh_strhash(const char *c);
 
 #ifndef NO_FP_API
index ba0115ae793991c7c560090997db184aac81478a..9ff9f938ccf8fe6cecef68e14215597c81f2765e 100644 (file)
@@ -60,7 +60,7 @@
 #include "md5_locl.h"
 #include <openssl/opensslv.h>
 
-char *MD5_version="MD5" OPENSSL_VERSION_PTEXT;
+const char *MD5_version="MD5" OPENSSL_VERSION_PTEXT;
 
 /* Implemented from RFC1321 The MD5 Message-Digest Algorithm
  */
index 67f8d12cc027fa04ab5a5ef15c09cd3aa0f65d03..dac3d2685ca07ed8b124676269c31aa444abd06a 100644 (file)
@@ -159,7 +159,7 @@ void CRYPTO_get_mem_debug_functions(void (**m)(), void (**r)(), void (**f)(),voi
        }
 
 
-void *CRYPTO_malloc_locked(int num, char *file, int line)
+void *CRYPTO_malloc_locked(int num, const char *file, int line)
        {
        char *ret = NULL;
 
@@ -191,7 +191,7 @@ void CRYPTO_free_locked(void *str)
                free_debug_func(NULL, 1);
        }
 
-void *CRYPTO_malloc(int num, char *file, int line)
+void *CRYPTO_malloc(int num, const char *file, int line)
        {
        char *ret = NULL;
 
@@ -211,7 +211,7 @@ void *CRYPTO_malloc(int num, char *file, int line)
        return ret;
        }
 
-void *CRYPTO_realloc(void *str, int num, char *file, int line)
+void *CRYPTO_realloc(void *str, int num, const char *file, int line)
        {
        char *ret = NULL;
 
@@ -239,7 +239,7 @@ void CRYPTO_free(void *str)
                free_debug_func(NULL, 1);
        }
 
-void *CRYPTO_remalloc(void *a, int num, char *file, int line)
+void *CRYPTO_remalloc(void *a, int num, const char *file, int line)
        {
        if (a != NULL) Free(a);
        a=(char *)Malloc(num);
index f3ad5ff235feccf249b400b5887f713191fdc371..ad5297bc014cdddccfe30033c258d66c4941a112 100644 (file)
@@ -257,7 +257,7 @@ static APP_INFO *pop_info()
        if (amih != NULL)
                {
                tmp.thread=CRYPTO_thread_id();
-               if ((ret=(APP_INFO *)lh_delete(amih,(char *)&tmp)) != NULL)
+               if ((ret=(APP_INFO *)lh_delete(amih,&tmp)) != NULL)
                        {
                        APP_INFO *next=ret->next;
 
index e8aa7dace1f67a31fc4e1adeac1a3368e76ca074..3086b15161775f0bb610aac518db5d31e2dcd237 100644 (file)
@@ -132,7 +132,7 @@ const char *OBJ_NAME_get(const char *name, int type)
 
        for (;;)
                {
-               ret=(OBJ_NAME *)lh_retrieve(names_lh,(char *)&on);
+               ret=(OBJ_NAME *)lh_retrieve(names_lh,&on);
                if (ret == NULL) return(NULL);
                if ((ret->alias) && !alias)
                        {
@@ -168,7 +168,7 @@ int OBJ_NAME_add(const char *name, int type, const char *data)
        onp->type=type;
        onp->data=data;
 
-       ret=(OBJ_NAME *)lh_insert(names_lh,(char *)onp);
+       ret=(OBJ_NAME *)lh_insert(names_lh,onp);
        if (ret != NULL)
                {
                /* free things */
@@ -203,7 +203,7 @@ int OBJ_NAME_remove(const char *name, int type)
        type&= ~OBJ_NAME_ALIAS;
        on.name=name;
        on.type=type;
-       ret=(OBJ_NAME *)lh_delete(names_lh,(char *)&on);
+       ret=(OBJ_NAME *)lh_delete(names_lh,&on);
        if (ret != NULL)
                {
                /* free things */
index aa5c50e5cca2d9ba83d811ae92634522ff5ce958..6eeb530802c23b77bb9a9483cd8ff4260e6c8742 100644 (file)
@@ -234,7 +234,7 @@ int OBJ_add_object(ASN1_OBJECT *obj)
                        {
                        ao[i]->type=i;
                        ao[i]->obj=o;
-                       aop=(ADDED_OBJ *)lh_insert(added,(char *)ao[i]);
+                       aop=(ADDED_OBJ *)lh_insert(added,ao[i]);
                        /* memory leak, buit should not normally matter */
                        if (aop != NULL)
                                Free(aop);
@@ -272,7 +272,7 @@ ASN1_OBJECT *OBJ_nid2obj(int n)
                ad.type=ADDED_NID;
                ad.obj= &ob;
                ob.nid=n;
-               adp=(ADDED_OBJ *)lh_retrieve(added,(char *)&ad);
+               adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
                if (adp != NULL)
                        return(adp->obj);
                else
@@ -304,7 +304,7 @@ const char *OBJ_nid2sn(int n)
                ad.type=ADDED_NID;
                ad.obj= &ob;
                ob.nid=n;
-               adp=(ADDED_OBJ *)lh_retrieve(added,(char *)&ad);
+               adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
                if (adp != NULL)
                        return(adp->obj->sn);
                else
@@ -336,7 +336,7 @@ const char *OBJ_nid2ln(int n)
                ad.type=ADDED_NID;
                ad.obj= &ob;
                ob.nid=n;
-               adp=(ADDED_OBJ *)lh_retrieve(added,(char *)&ad);
+               adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
                if (adp != NULL)
                        return(adp->obj->ln);
                else
@@ -361,7 +361,7 @@ int OBJ_obj2nid(ASN1_OBJECT *a)
                {
                ad.type=ADDED_DATA;
                ad.obj=a;
-               adp=(ADDED_OBJ *)lh_retrieve(added,(char *)&ad);
+               adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
                if (adp != NULL) return (adp->obj->nid);
                }
        op=(ASN1_OBJECT **)OBJ_bsearch((char *)&a,(char *)obj_objs,NUM_OBJ,
@@ -500,7 +500,7 @@ int OBJ_ln2nid(const char *s)
                {
                ad.type=ADDED_LNAME;
                ad.obj= &o;
-               adp=(ADDED_OBJ *)lh_retrieve(added,(char *)&ad);
+               adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
                if (adp != NULL) return (adp->obj->nid);
                }
        op=(ASN1_OBJECT **)OBJ_bsearch((char *)&oo,(char *)ln_objs,NUM_LN,
@@ -519,7 +519,7 @@ int OBJ_sn2nid(const char *s)
                {
                ad.type=ADDED_SNAME;
                ad.obj= &o;
-               adp=(ADDED_OBJ *)lh_retrieve(added,(char *)&ad);
+               adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
                if (adp != NULL) return (adp->obj->nid);
                }
        op=(ASN1_OBJECT **)OBJ_bsearch((char *)&oo,(char *)sn_objs,NUM_SN,
index 5ab94a779b5ba722e93c84a851175724ad35f232..b5d2166b060e68d5c12e0b8cb8c7bd8f7f0e6d25 100644 (file)
@@ -82,7 +82,7 @@ void RAND_seed(const void *buf,int num);
 void RAND_add(const void *buf,int num,int entropy);
 int  RAND_load_file(const char *file,long max_bytes);
 int  RAND_write_file(const char *file);
-char *RAND_file_name(char *file,int num);
+const char *RAND_file_name(char *file,int num);
 #ifdef WINDOWS
 void RAND_screen(void);
 #endif
index cea9f54e731388f1e4209ca60649fb2ee0d18835..7ff06adcccb15ef2b2766a734cb862395199414b 100644 (file)
@@ -184,7 +184,7 @@ err:
        return(err ? -1 : ret);
        }
 
-char *RAND_file_name(char *buf, int size)
+const char *RAND_file_name(char *buf, int size)
        {
        char *s;
        char *ret=NULL;
index f3a5017199b776e186585b8813b20c3a16b3625e..be3eb2204a1e751065b53c0c94f20affa4de20fe 100644 (file)
@@ -60,7 +60,7 @@
 #include "rmd_locl.h"
 #include <openssl/opensslv.h>
 
-char *RMD160_version="RIPE-MD160" OPENSSL_VERSION_PTEXT;
+const char *RMD160_version="RIPE-MD160" OPENSSL_VERSION_PTEXT;
 
 #  ifdef RMD160_ASM
      void ripemd160_block_x86(RIPEMD160_CTX *c, unsigned long *p,int num);
index dc008124e2d5f981b6dbd6557e2e47f1ebf01c43..c09edb4cd7c0d15d6f127aad32b01b018ad95985 100644 (file)
@@ -63,7 +63,7 @@
 
 #include <openssl/opensslv.h>
 
-char *SHA1_version="SHA1" OPENSSL_VERSION_PTEXT;
+const char *SHA1_version="SHA1" OPENSSL_VERSION_PTEXT;
 
 /* The implementation is in ../md32_common.h */
 
index 1aade357d10104e8a10069455ea5c5cbd0b4f222..894a96274afc3a64145ed50df27860682c362c7f 100644 (file)
@@ -63,7 +63,7 @@
 
 #include <openssl/opensslv.h>
 
-char *SHA_version="SHA" OPENSSL_VERSION_PTEXT;
+const char *SHA_version="SHA" OPENSSL_VERSION_PTEXT;
 
 /* The implementation is in ../md32_common.h */
 
index 9a9fa5ce557a5da5b3cd0270b3fcdb5836ec89b4..ad3527df53b917a195562e4a2ad4c3a3269d2808 100644 (file)
@@ -205,7 +205,7 @@ char **TXT_DB_get_by_index(TXT_DB *db, int idx, char **value)
                db->error=DB_ERROR_NO_INDEX;
                return(NULL);
                }
-       ret=(char **)lh_retrieve(lh,(char *)value);
+       ret=(char **)lh_retrieve(lh,value);
        db->error=DB_ERROR_OK;
        return(ret);
        }
@@ -306,7 +306,7 @@ int TXT_DB_insert(TXT_DB *db, char **row)
                        {
                        if ((db->qual[i] != NULL) &&
                                (db->qual[i](row) == 0)) continue;
-                       r=(char **)lh_retrieve(db->index[i],(char *)row);
+                       r=(char **)lh_retrieve(db->index[i],row);
                        if (r != NULL)
                                {
                                db->error=DB_ERROR_INDEX_CLASH;
@@ -329,7 +329,7 @@ int TXT_DB_insert(TXT_DB *db, char **row)
                        {
                        if ((db->qual[i] != NULL) &&
                                (db->qual[i](row) == 0)) continue;
-                       lh_insert(db->index[i],(char *)row);
+                       lh_insert(db->index[i],row);
                        }
                }
        return(1);
index 3e1565ea5be084a51e64f9402c4297d3cb733444..a81b1900d1e4ad1060b7d21b9b04327faca6d8ae 100644 (file)
@@ -326,8 +326,7 @@ static int get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name,
                /* we have added it to the cache so now pull
                 * it out again */
                CRYPTO_r_lock(CRYPTO_LOCK_X509_STORE);
-               tmp=(X509_OBJECT *)lh_retrieve(xl->store_ctx->certs,
-                       (char *)&stmp);
+               tmp=(X509_OBJECT *)lh_retrieve(xl->store_ctx->certs,&stmp);
                CRYPTO_r_unlock(CRYPTO_LOCK_X509_STORE);
 
                if (tmp != NULL)
index b3a4ebdd46547abc67c62774827e16667b2df8a7..a20006d67e2b3c2eedb205f7149d5d65eae6a74c 100644 (file)
@@ -377,7 +377,7 @@ X509_OBJECT *X509_OBJECT_retrieve_by_subject(LHASH *h, int type,
                abort();
                }
 
-       tmp=(X509_OBJECT *)lh_retrieve(h,(char *)&stmp);
+       tmp=(X509_OBJECT *)lh_retrieve(h,&stmp);
        return(tmp);
        }
 
index e5038fee12126c1e9e3711a78a596a73b14af09b..c779dab376534f2efd23a5e094ecf3db04d64636 100644 (file)
@@ -622,13 +622,13 @@ int X509_STORE_add_cert(X509_STORE *ctx, X509 *x)
 
        X509_OBJECT_up_ref_count(obj);
 
-       r=(X509_OBJECT *)lh_insert(ctx->certs,(char *)obj);
+       r=(X509_OBJECT *)lh_insert(ctx->certs,obj);
        if (r != NULL)
                { /* oops, put it back */
-               lh_delete(ctx->certs,(char *)obj);
+               lh_delete(ctx->certs,obj);
                X509_OBJECT_free_contents(obj);
                Free(obj);
-               lh_insert(ctx->certs,(char *)r);
+               lh_insert(ctx->certs,r);
                X509err(X509_F_X509_STORE_ADD_CERT,X509_R_CERT_ALREADY_IN_HASH_TABLE);
                ret=0;
                }
@@ -657,13 +657,13 @@ int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x)
 
        X509_OBJECT_up_ref_count(obj);
 
-       r=(X509_OBJECT *)lh_insert(ctx->certs,(char *)obj);
+       r=(X509_OBJECT *)lh_insert(ctx->certs,obj);
        if (r != NULL)
                { /* oops, put it back */
-               lh_delete(ctx->certs,(char *)obj);
+               lh_delete(ctx->certs,obj);
                X509_OBJECT_free_contents(obj);
                Free(obj);
-               lh_insert(ctx->certs,(char *)r);
+               lh_insert(ctx->certs,r);
                X509err(X509_F_X509_STORE_ADD_CRL,X509_R_CERT_ALREADY_IN_HASH_TABLE);
                ret=0;
                }
index e2c3bb47daf0fc5217f61d8b289ecc4348b08f8a..41843dfea21fde8af5c931ad701b61af4d641eaf 100644 (file)
@@ -67,7 +67,7 @@ static int ssl23_write(SSL *s, const void *buf, int len);
 static long ssl23_default_timeout(void );
 static int ssl23_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p);
 static SSL_CIPHER *ssl23_get_cipher_by_char(const unsigned char *p);
-char *SSL23_version_str="SSLv2/3 compatibility" OPENSSL_VERSION_PTEXT;
+const char *SSL23_version_str="SSLv2/3 compatibility" OPENSSL_VERSION_PTEXT;
 
 static SSL_METHOD SSLv23_data= {
        TLS1_VERSION,
index ce68732e60db37119b123743098d4c870eaa0ddc..b500b2315ff4b60b184f299e76a6d449ef7ff745 100644 (file)
@@ -903,7 +903,7 @@ static int ssl3_send_server_key_exchange(SSL *s)
        unsigned int u;
 #endif
 #ifndef NO_DH
-       DH *dh,*dhp;
+       DH *dh=NULL,*dhp;
 #endif
        EVP_PKEY *pkey;
        unsigned char *p,*d;
index 3ada66d9ab99e3914c4f024ec843af44052e9829..79033329f0bd09150b57eae4ad6aa2a675f7c7dd 100644 (file)
--- a/ssl/ssl.h
+++ b/ssl/ssl.h
@@ -1042,7 +1042,7 @@ long      SSL_ctrl(SSL *ssl,int cmd, long larg, char *parg);
 long   SSL_CTX_ctrl(SSL_CTX *ctx,int cmd, long larg, char *parg);
 
 int    SSL_get_error(SSL *s,int ret_code);
-char * SSL_get_version(SSL *s);
+const char *SSL_get_version(SSL *s);
 
 /* This sets the 'default' SSL version that SSL_new() will create */
 int SSL_CTX_set_ssl_version(SSL_CTX *ctx,SSL_METHOD *meth);
index 1c58dec45fce7d9799156cb78501143e7585d4b4..4eabc612ef21590550e86a4cfa182f7e122fae47 100644 (file)
@@ -64,7 +64,7 @@
 #include <openssl/x509v3.h>
 #include "ssl_locl.h"
 
-char *SSL_version_str=OPENSSL_VERSION_TEXT;
+const char *SSL_version_str=OPENSSL_VERSION_TEXT;
 
 static STACK_OF(CRYPTO_EX_DATA_FUNCS) *ssl_meth=NULL;
 static STACK_OF(CRYPTO_EX_DATA_FUNCS) *ssl_ctx_meth=NULL;
@@ -1615,7 +1615,7 @@ SSL_METHOD *ssl_bad_method(int ver)
        return(NULL);
        }
 
-char *SSL_get_version(SSL *s)
+const char *SSL_get_version(SSL *s)
        {
        if (s->version == TLS1_VERSION)
                return("TLSv1");
index cab50d107fd8b8a832301beff4d12e905413b974..9e01f7275321326ac7e2e7e637beb88d901bec7b 100644 (file)
@@ -180,8 +180,7 @@ int ssl_get_new_session(SSL *s, int session)
 
                        RAND_pseudo_bytes(ss->session_id,ss->session_id_length);
                        CRYPTO_r_lock(CRYPTO_LOCK_SSL_CTX);
-                       r=(SSL_SESSION *)lh_retrieve(s->ctx->sessions,
-                               (char *)ss);
+                       r=(SSL_SESSION *)lh_retrieve(s->ctx->sessions, ss);
                        CRYPTO_r_unlock(CRYPTO_LOCK_SSL_CTX);
                        if (r == NULL) break;
                        /* else - woops a session_id match */
@@ -225,7 +224,7 @@ int ssl_get_prev_session(SSL *s, unsigned char *session_id, int len)
        if (!(s->ctx->session_cache_mode & SSL_SESS_CACHE_NO_INTERNAL_LOOKUP))
                {
                CRYPTO_r_lock(CRYPTO_LOCK_SSL_CTX);
-               ret=(SSL_SESSION *)lh_retrieve(s->ctx->sessions,(char *)&data);
+               ret=(SSL_SESSION *)lh_retrieve(s->ctx->sessions,&data);
                if (ret != NULL)
                    /* don't allow other threads to steal it: */
                    CRYPTO_add(&ret->references,1,CRYPTO_LOCK_SSL_SESSION);
@@ -358,7 +357,7 @@ int SSL_CTX_add_session(SSL_CTX *ctx, SSL_SESSION *c)
        /* if session c is in already in cache, we take back the increment later */
 
        CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX);
-       s=(SSL_SESSION *)lh_insert(ctx->sessions,(char *)c);
+       s=(SSL_SESSION *)lh_insert(ctx->sessions,c);
        
        /* s != NULL iff we already had a session with the given PID.
         * In this case, s == c should hold (then we did not really modify
@@ -424,7 +423,7 @@ static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
        if ((c != NULL) && (c->session_id_length != 0))
                {
                if(lck) CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX);
-               r=(SSL_SESSION *)lh_delete(ctx->sessions,(char *)c);
+               r=(SSL_SESSION *)lh_delete(ctx->sessions,c);
                if (r != NULL)
                        {
                        ret=1;
@@ -585,7 +584,7 @@ static void timeout(SSL_SESSION *s, TIMEOUT_PARAM *p)
                {
                /* The reason we don't call SSL_CTX_remove_session() is to
                 * save on locking overhead */
-               lh_delete(p->cache,(char *)s);
+               lh_delete(p->cache,s);
                SSL_SESSION_list_remove(p->ctx,s);
                s->not_resumable=1;
                if (p->ctx->remove_session_cb != NULL)
@@ -606,7 +605,7 @@ void SSL_CTX_flush_sessions(SSL_CTX *s, long t)
        CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX);
        i=tp.cache->down_load;
        tp.cache->down_load=0;
-       lh_doall_arg(tp.cache,(void (*)())timeout,(char *)&tp);
+       lh_doall_arg(tp.cache,(void (*)())timeout,&tp);
        tp.cache->down_load=i;
        CRYPTO_w_unlock(CRYPTO_LOCK_SSL_CTX);
        }
index b734528da0426905c0fa467c9126cd12034ed20b..531969b4219cdff5e08fe7926da0e2db4695a6cf 100644 (file)
@@ -60,7 +60,7 @@
 #include <openssl/objects.h>
 #include "ssl_locl.h"
 
-char *tls1_version_str="TLSv1" OPENSSL_VERSION_PTEXT;
+const char *tls1_version_str="TLSv1" OPENSSL_VERSION_PTEXT;
 
 static long tls1_default_timeout(void);