Give everything prototypes (well, everything that's actually used).
authorBen Laurie <ben@openssl.org>
Thu, 31 Mar 2005 09:26:39 +0000 (09:26 +0000)
committerBen Laurie <ben@openssl.org>
Thu, 31 Mar 2005 09:26:39 +0000 (09:26 +0000)
65 files changed:
CHANGES
apps/progs.h
apps/s_apps.h
apps/s_socket.c
apps/sess_id.c
apps/x509.c
crypto/asn1/a_d2i_fp.c
crypto/asn1/a_digest.c
crypto/asn1/a_dup.c
crypto/asn1/a_hdr.c
crypto/asn1/a_i2d_fp.c
crypto/asn1/a_meth.c
crypto/asn1/a_set.c
crypto/asn1/a_sign.c
crypto/asn1/a_verify.c
crypto/asn1/asn1.h
crypto/asn1/asn1_gen.c
crypto/asn1/asn1_mac.h
crypto/asn1/asn_pack.c
crypto/asn1/n_pkey.c
crypto/asn1/p5_pbe.c
crypto/asn1/p5_pbev2.c
crypto/asn1/x_pkey.c
crypto/asn1/x_x509.c
crypto/bio/bss_conn.c
crypto/dh/dh.h
crypto/dsa/dsa.h
crypto/ec/ec.h
crypto/engine/eng_ctrl.c
crypto/engine/enginetest.c
crypto/err/err.c
crypto/evp/evp.h
crypto/evp/evp_pkey.c
crypto/lhash/lhash.c
crypto/ocsp/ocsp.h
crypto/ocsp/ocsp_ext.c
crypto/pem/pem.h
crypto/pem/pem_all.c
crypto/pem/pem_info.c
crypto/pem/pem_lib.c
crypto/pem/pem_oth.c
crypto/pkcs7/pk7_mime.c
crypto/rsa/rsa.h
crypto/rsa/rsa_asn1.c
crypto/stack/safestack.h
crypto/txt_db/txt_db.c
crypto/txt_db/txt_db.h
crypto/ui/ui.h
crypto/ui/ui_lib.c
crypto/x509/x509.h
crypto/x509/x509_vfy.c
crypto/x509/x_all.c
engines/vendor_defns/aep.h
engines/vendor_defns/sureware.h
ssl/bio_ssl.c
ssl/s23_lib.c
ssl/s2_lib.c
ssl/s3_lib.c
ssl/ssl.h
ssl/ssl_asn1.c
ssl/ssl_err.c
ssl/ssl_lib.c
ssl/ssl_locl.h
ssl/t1_lib.c
test/Makefile

diff --git a/CHANGES b/CHANGES
index 20a8b54..942279d 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,11 @@
 
  Changes between 0.9.7e and 0.9.8  [xx XXX xxxx]
 
+  *) Compile clean with "-Wall -Wmissing-prototypes
+     -Wstrict-prototypes -Wmissing-declarations -Werror". Currently
+     DEBUG_SAFESTACK must also be set.
+     [Ben Laurie]
+
   *) Change ./Configure so that certain algorithms can be disabled by default.
      The new counterpiece to "no-xxx" is "enable-xxx".
 
index 131a721..d3ddf82 100644 (file)
@@ -49,7 +49,7 @@ extern int ocsp_main(int argc,char *argv[]);
 typedef struct {
        int type;
        char *name;
-       int (*func)();
+       int (*func)(int argc,char *argv[]);
        } FUNCTION;
 
 FUNCTION functions[] = {
index 4e989b8..ca5caac 100644 (file)
@@ -148,7 +148,7 @@ typedef fd_mask fd_set;
 #define PORT_STR        "4433"
 #define PROTOCOL        "tcp"
 
-int do_server(int port, int *ret, int (*cb) (), char *context);
+int do_server(int port, int *ret, int (*cb) (char *hostname, int s, unsigned char *context), char *context);
 #ifdef HEADER_X509_H
 int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx);
 #endif
index 45014fa..7274257 100644 (file)
@@ -270,7 +270,7 @@ static int init_client_ip(int *sock, unsigned char ip[4], int port)
        return(1);
        }
 
-int do_server(int port, int *ret, int (*cb)(), char *context)
+int do_server(int port, int *ret, int (*cb)(char *hostname, int s, unsigned char *context), char *context)
        {
        int sock;
        char *name;
index d91d84d..c379b0e 100644 (file)
@@ -241,7 +241,7 @@ bad:
        if (!noout && !cert)
                {
                if      (outformat == FORMAT_ASN1)
-                       i=(int)i2d_SSL_SESSION_bio(out,x);
+                       i=i2d_SSL_SESSION_bio(out,x);
                else if (outformat == FORMAT_PEM)
                        i=PEM_write_bio_SSL_SESSION(out,x);
                else    {
index 294fc69..1dad636 100644 (file)
@@ -1038,8 +1038,7 @@ bad:
                ah.data=(char *)x;
                ah.meth=X509_asn1_meth();
 
-               /* no macro for this one yet */
-               i=ASN1_i2d_bio(i2d_ASN1_HEADER,out,(unsigned char *)&ah);
+               i=ASN1_i2d_bio_of(ASN1_HEADER,i2d_ASN1_HEADER,out,&ah);
                }
        else    {
                BIO_printf(bio_err,"bad output format specified for outfile\n");
index 2e99e4c..40baeb1 100644 (file)
@@ -66,11 +66,12 @@ static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb);
 #ifndef NO_OLD_ASN1
 #ifndef OPENSSL_NO_FP_API
 
-char *ASN1_d2i_fp(char *(*xnew)(), char *(*d2i)(), FILE *in,
-            unsigned char **x)
+void *ASN1_d2i_fp(void *(*xnew)(void),
+                 void *(*d2i)(void **,const unsigned char **,long), FILE *in,
+                 void **x)
         {
         BIO *b;
-        char *ret;
+        void *ret;
 
         if ((b=BIO_new(BIO_s_file())) == NULL)
                {
@@ -84,18 +85,19 @@ char *ASN1_d2i_fp(char *(*xnew)(), char *(*d2i)(), FILE *in,
         }
 #endif
 
-char *ASN1_d2i_bio(char *(*xnew)(), char *(*d2i)(), BIO *in,
-            unsigned char **x)
+char *ASN1_d2i_bio(void *(*xnew)(void),
+                  void *(*d2i)(void **,const unsigned char **,long), BIO *in,
+                  void **x)
        {
        BUF_MEM *b = NULL;
-       unsigned char *p;
-       char *ret=NULL;
+       const unsigned char *p;
+       void *ret=NULL;
        int len;
 
        len = asn1_d2i_read_bio(in, &b);
        if(len < 0) goto err;
 
-       p=(unsigned char *)b->data;
+       p=b->data;
        ret=d2i(x,&p,len);
 err:
        if (b != NULL) BUF_MEM_free(b);
index 7182e9f..b728e5c 100644 (file)
@@ -72,8 +72,9 @@
 
 #ifndef NO_ASN1_OLD
 
-int ASN1_digest(int (*i2d)(), const EVP_MD *type, char *data,
-               unsigned char *md, unsigned int *len)
+int ASN1_digest(int (*i2d)(void *, unsigned char **),
+               const EVP_MD *type, char *data, unsigned char *md,
+               unsigned int *len)
        {
        int i;
        unsigned char *str,*p;
index dc6826a..8679263 100644 (file)
@@ -62,7 +62,8 @@
 
 #ifndef NO_OLD_ASN1
 
-char *ASN1_dup(int (*i2d)(), char *(*d2i)(), char *x)
+void *ASN1_dup(int (*i2d)(char *,void *), 
+              char *(*d2i)(void *,unsigned char **,long), char *x)
        {
        unsigned char *b,*p;
        long i;
index b354ae5..c5520b7 100644 (file)
@@ -83,10 +83,10 @@ ASN1_HEADER *d2i_ASN1_HEADER(ASN1_HEADER **a, const unsigned char **pp,
 
        M_ASN1_D2I_Init();
         M_ASN1_D2I_start_sequence();
-        M_ASN1_D2I_get(ret->header,d2i_ASN1_OCTET_STRING);
+        M_ASN1_D2I_get(ASN1_OCTET_STRING,ret->header,d2i_ASN1_OCTET_STRING);
        if (ret->meth != NULL)
                {
-               M_ASN1_D2I_get(ret->data,ret->meth->d2i);
+               M_ASN1_D2I_get(void,ret->data,ret->meth->d2i);
                }
        else
                {
index f4f1b73..159c050 100644 (file)
@@ -64,7 +64,8 @@
 #ifndef NO_OLD_ASN1
 
 #ifndef OPENSSL_NO_FP_API
-int ASN1_i2d_fp(int (*i2d)(), FILE *out, unsigned char *x)
+int ASN1_i2d_fp(int (*i2d)(void *, unsigned char **), FILE *out,
+               void *x)
         {
         BIO *b;
         int ret;
@@ -81,7 +82,8 @@ int ASN1_i2d_fp(int (*i2d)(), FILE *out, unsigned char *x)
         }
 #endif
 
-int ASN1_i2d_bio(int (*i2d)(), BIO *out, unsigned char *x)
+int ASN1_i2d_bio(int (*i2d)(void *, unsigned char **), BIO *out,
+                unsigned char *x)
        {
        char *b;
        unsigned char *p;
index 63158e9..50bea91 100644 (file)
 #include <openssl/asn1.h>
 
 static  ASN1_METHOD ia5string_meth={
-       (int (*)())     i2d_ASN1_IA5STRING,
-       (char *(*)())   d2i_ASN1_IA5STRING,
-       (char *(*)())   ASN1_STRING_new,
-       (void (*)())    ASN1_STRING_free};
+       (I2D_OF(void))  i2d_ASN1_IA5STRING,
+       (D2I_OF(void))  d2i_ASN1_IA5STRING,
+       (void *(*)(void))ASN1_STRING_new,
+       (void (*)(void *))ASN1_STRING_free};
 
 static  ASN1_METHOD bit_string_meth={
-       (int (*)())     i2d_ASN1_BIT_STRING,
-       (char *(*)())   d2i_ASN1_BIT_STRING,
-       (char *(*)())   ASN1_STRING_new,
-       (void (*)())    ASN1_STRING_free};
+       (I2D_OF(void))  i2d_ASN1_BIT_STRING,
+       (D2I_OF(void))  d2i_ASN1_BIT_STRING,
+       (void *(*)(void))ASN1_STRING_new,
+       (void (*)(void *))ASN1_STRING_free};
 
 ASN1_METHOD *ASN1_IA5STRING_asn1_meth(void)
        {
index 3c8d3d5..9218719 100644 (file)
@@ -85,7 +85,7 @@ static int SetBlobCmp(const void *elem1, const void *elem2 )
     }
 
 /* int is_set:  if TRUE, then sort the contents (i.e. it isn't a SEQUENCE)    */
-int i2d_ASN1_SET(STACK *a, unsigned char **pp, int (*func)(), int ex_tag,
+int i2d_ASN1_SET(STACK *a, unsigned char **pp, int (*func)(void *,unsigned char **), int ex_tag,
             int ex_class, int is_set)
        {
        int ret=0,r;
@@ -163,7 +163,8 @@ SetBlob
         }
 
 STACK *d2i_ASN1_SET(STACK **a, const unsigned char **pp, long length,
-            char *(*func)(), void (*free_func)(void *), int ex_tag, int ex_class)
+                   char *(*d2i)(void **,const unsigned char **,long),
+                   void (*free_func)(void *), int ex_tag, int ex_class)
        {
        ASN1_const_CTX c;
        STACK *ret=NULL;
@@ -210,7 +211,9 @@ STACK *d2i_ASN1_SET(STACK **a, const unsigned char **pp, long length,
                char *s;
 
                if (M_ASN1_D2I_end_sequence()) break;
-               if ((s=func(NULL,&c.p,c.slen,c.max-c.p)) == NULL)
+               /* XXX: This was called with 4 arguments, incorrectly, it seems
+                  if ((s=func(NULL,&c.p,c.slen,c.max-c.p)) == NULL) */
+               if ((s=d2i(NULL,&c.p,c.slen)) == NULL)
                        {
                        ASN1err(ASN1_F_D2I_ASN1_SET,ASN1_R_ERROR_PARSING_SET_ELEMENT);
                        asn1_add_error(*pp,(int)(c.q- *pp));
index 37e1e84..2542f75 100644 (file)
 
 #ifndef NO_ASN1_OLD
 
-int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2,
-            ASN1_BIT_STRING *signature, char *data, EVP_PKEY *pkey,
-            const EVP_MD *type)
+int ASN1_sign(int (*i2d)(void *, unsigned char **), X509_ALGOR *algor1,
+             X509_ALGOR *algor2, ASN1_BIT_STRING *signature, char *data,
+             EVP_PKEY *pkey, const EVP_MD *type)
        {
        EVP_MD_CTX ctx;
        unsigned char *p,*buf_in=NULL,*buf_out=NULL;
index b91678a..d34e287 100644 (file)
@@ -73,8 +73,9 @@
 
 #ifndef NO_ASN1_OLD
 
-int ASN1_verify(int (*i2d)(), X509_ALGOR *a, ASN1_BIT_STRING *signature,
-            char *data, EVP_PKEY *pkey)
+int ASN1_verify(int (*i2d)(void *, unsigned char **),
+               X509_ALGOR *a, ASN1_BIT_STRING *signature,
+               char *data, EVP_PKEY *pkey)
        {
        EVP_MD_CTX ctx;
        const EVP_MD *type;
index f340e08..a4ec442 100644 (file)
@@ -317,6 +317,10 @@ typedef struct ASN1_VALUE_st ASN1_VALUE;
        type *name##_new(void); \
        void name##_free(type *a);
 
+#define D2I_OF(type) type *(*)(type **,const unsigned char **,long)
+#define I2D_OF(type) int (*)(type *,unsigned char **)
+#define I2D_OF_const(type) int (*)(const type *,unsigned char **)
+
 /* The following macros and typedefs allow an ASN1_ITEM
  * to be embedded in a structure and referenced. Since
  * the ASN1_ITEM pointers need to be globally accessible
@@ -508,17 +512,17 @@ DECLARE_ASN1_SET_OF(ASN1_TYPE)
 
 typedef struct asn1_method_st
        {
-       int (*i2d)();
-       char *(*d2i)();
-       char *(*create)();
-       void (*destroy)();
+       int (*i2d)(void *, unsigned char **);
+       void *(*d2i)(void **,const unsigned char **,long);
+       void *(*create)(void);
+       void (*destroy)(void *);
        } ASN1_METHOD;
 
 /* This is used when parsing some Netscape objects */
 typedef struct asn1_header_st
        {
        ASN1_OCTET_STRING *header;
-       char *data;
+       void *data;
        ASN1_METHOD *meth;
        } ASN1_HEADER;
 
@@ -831,11 +835,13 @@ ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s,time_t t);
 int ASN1_TIME_check(ASN1_TIME *t);
 ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out);
 
-int            i2d_ASN1_SET(STACK *a, unsigned char **pp,
-                       int (*func)(), int ex_tag, int ex_class, int is_set);
-STACK *                d2i_ASN1_SET(STACK **a, const unsigned char **pp, long length,
-                       char *(*func)(), void (*free_func)(void *),
-                       int ex_tag, int ex_class);
+int i2d_ASN1_SET(STACK *a, unsigned char **pp,
+                int (*func)(void *,unsigned char **), int ex_tag, int ex_class,
+                int is_set);
+STACK *        d2i_ASN1_SET(STACK **a, const unsigned char **pp, long length,
+                    char *(*func)(void **,const unsigned char **,long),
+                    void (*free_func)(void *),
+                    int ex_tag, int ex_class);
 
 #ifndef OPENSSL_NO_BIO
 int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a);
@@ -889,14 +895,28 @@ int ASN1_put_eoc(unsigned char **pp);
 int ASN1_object_size(int constructed, int length, int tag);
 
 /* Used to implement other functions */
-char *ASN1_dup(int (*i2d)(),char *(*d2i)(),char *x);
+void *ASN1_dup(int (*i2d)(char *,void *), 
+              char *(*d2i)(void *,unsigned char **,long), char *x);
+#define ASN1_dup_of(type,i2d,d2i,x) \
+       ((type *(*)(I2D_OF(type),D2I_OF(type),type *))ASN1_dup)(i2d,d2i,x)
+#define ASN1_dup_of_const(type,i2d,d2i,x) \
+       ((type *(*)(I2D_OF_const(type),D2I_OF(type),type *))ASN1_dup)(i2d,d2i,x)
 
 void *ASN1_item_dup(const ASN1_ITEM *it, void *x);
 
 #ifndef OPENSSL_NO_FP_API
-char *ASN1_d2i_fp(char *(*xnew)(),char *(*d2i)(),FILE *fp,unsigned char **x);
+void *ASN1_d2i_fp(void *(*xnew)(void),
+                 void *(*d2i)(void **,const unsigned char **,long), FILE *in,
+                 void **x);
+#define ASN1_d2i_fp_of(type,xnew,d2i,in,x) \
+       ((type *(*)(type *(*)(void),D2I_OF(type),FILE *,type **))ASN1_d2i_fp)(xnew,d2i,in,x)
 void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x);
-int ASN1_i2d_fp(int (*i2d)(),FILE *out,unsigned char *x);
+int ASN1_i2d_fp(int (*i2d)(void *, unsigned char **),FILE *out,
+               void *x);
+#define ASN1_i2d_fp_of(type,i2d,out,x) \
+       ((int (*)(I2D_OF(type),FILE *,type *))ASN1_i2d_fp)(i2d,out,x)
+#define ASN1_i2d_fp_of_const(type,i2d,out,x) \
+       ((int (*)(I2D_OF_const(type),FILE *,type *))ASN1_i2d_fp)(i2d,out,x)
 int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x);
 int ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags);
 #endif
@@ -904,9 +924,21 @@ int ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags);
 int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in);
 
 #ifndef OPENSSL_NO_BIO
-char *ASN1_d2i_bio(char *(*xnew)(),char *(*d2i)(),BIO *bp,unsigned char **x);
+char *ASN1_d2i_bio(void *(*xnew)(void),
+                  void *(*d2i)(void **,const unsigned char **,long), BIO *in,
+                  void **x);
+#define ASN1_d2i_bio_of(type,xnew,d2i,in,x) \
+       ((type *(*)(type *(*)(void),D2I_OF(type),BIO *,type **))ASN1_d2i_bio)(xnew,d2i,in,x)
+char *ASN1_d2i_bio(void *(*xnew)(void),
+                  void *(*d2i)(void **,const unsigned char **,long), BIO *in,
+                  void **x);
 void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x);
-int ASN1_i2d_bio(int (*i2d)(),BIO *out,unsigned char *x);
+int ASN1_i2d_bio(int (*i2d)(void *, unsigned char **),BIO *out,
+                unsigned char *x);
+#define ASN1_i2d_bio_of(type,i2d,out,x) \
+       ((int (*)(I2D_OF(type),BIO *,type *))ASN1_i2d_bio)(i2d,out,x)
+#define ASN1_i2d_bio_of_const(type,i2d,out,x) \
+       ((int (*)(I2D_OF_const(type),BIO *,type *))ASN1_i2d_bio)(i2d,out,x)
 int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x);
 int ASN1_UTCTIME_print(BIO *fp,ASN1_UTCTIME *a);
 int ASN1_GENERALIZEDTIME_print(BIO *fp,ASN1_GENERALIZEDTIME *a);
@@ -941,13 +973,19 @@ int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num,
 int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a,long *num,
        unsigned char *data, int max_len);
 
-STACK *ASN1_seq_unpack(const unsigned char *buf, int len, char *(*d2i)(),
-                                                void (*free_func)(void *) );
-unsigned char *ASN1_seq_pack(STACK *safes, int (*i2d)(), unsigned char **buf,
-                            int *len );
-void *ASN1_unpack_string(ASN1_STRING *oct, char *(*d2i)());
+STACK *ASN1_seq_unpack(const unsigned char *buf, int len,
+                      char *(*d2i)(void **,const unsigned char **,long),
+                      void (*free_func)(void *));
+unsigned char *ASN1_seq_pack(STACK *safes,
+                            int (*i2d)(void *, unsigned char **),
+                            unsigned char **buf, int *len );
+void *ASN1_unpack_string(ASN1_STRING *oct,
+                        void *(*d2i)(void *,const unsigned char **,long));
 void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it);
-ASN1_STRING *ASN1_pack_string(void *obj, int (*i2d)(), ASN1_OCTET_STRING **oct);
+ASN1_STRING *ASN1_pack_string(void *obj, int (*i2d)(void *, unsigned char **),
+                             ASN1_OCTET_STRING **oct);
+#define ASN1_pack_string_of(type,obj,i2d,oct) \
+       ((ASN1_STRING *(*)(type *,I2D_OF(type),ASN1_OCTET_STRING **))ASN1_pack_string)(obj,i2d,oct)
 ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_OCTET_STRING **oct);
 
 void ASN1_STRING_set_default_mask(unsigned long mask);
index efd8021..4341e54 100644 (file)
@@ -471,10 +471,12 @@ static ASN1_TYPE *asn1_multi(int utype, const char *section, X509V3_CTX *cnf)
                is_set = 0;
 
 
-       derlen = i2d_ASN1_SET((STACK *)sk, NULL, i2d_ASN1_TYPE, utype, V_ASN1_UNIVERSAL, is_set);
+       derlen = i2d_ASN1_SET_OF_ASN1_TYPE(sk, NULL, i2d_ASN1_TYPE, utype,
+                                          V_ASN1_UNIVERSAL, is_set);
        der = OPENSSL_malloc(derlen);
        p = der;
-       i2d_ASN1_SET((STACK *)sk, &p, i2d_ASN1_TYPE, utype, V_ASN1_UNIVERSAL, is_set);
+       i2d_ASN1_SET_OF_ASN1_TYPE(sk, &p, i2d_ASN1_TYPE, utype,
+                                 V_ASN1_UNIVERSAL, is_set);
 
        if (!(ret = ASN1_TYPE_new()))
                goto bad;
index a67fb34..f95cb14 100644 (file)
@@ -126,9 +126,9 @@ err:\
                (c.eos=ASN1_const_check_infinite_end(&c.p,c.slen)))
 
 /* Don't use this with d2i_ASN1_BOOLEAN() */
-#define M_ASN1_D2I_get(b,func) \
+#define M_ASN1_D2I_get(type,b,func) \
        c.q=c.p; \
-       if (func(&(b),&c.p,c.slen) == NULL) \
+       if (((D2I_OF(type))func)(&(b),&c.p,c.slen) == NULL) \
                {c.line=__LINE__; goto err; } \
        c.slen-=(c.p-c.q);
 
index ea56aa6..e3535bc 100644 (file)
@@ -66,8 +66,9 @@
 
 /* Turn an ASN1 encoded SEQUENCE OF into a STACK of structures */
 
-STACK *ASN1_seq_unpack(const unsigned char *buf, int len, char *(*d2i)(),
-            void (*free_func)(void *))
+STACK *ASN1_seq_unpack(const unsigned char *buf, int len,
+                      char *(*d2i)(void **,const unsigned char **,long),
+                      void (*free_func)(void *))
 {
     STACK *sk;
     const unsigned char *pbuf;
@@ -82,8 +83,8 @@ STACK *ASN1_seq_unpack(const unsigned char *buf, int len, char *(*d2i)(),
  * OPENSSL_malloc'ed buffer
  */
 
-unsigned char *ASN1_seq_pack(STACK *safes, int (*i2d)(), unsigned char **buf,
-            int *len)
+unsigned char *ASN1_seq_pack(STACK *safes, int (*i2d)(void *,unsigned char **),
+                            unsigned char **buf, int *len)
 {
        int safelen;
        unsigned char *safe, *p;
@@ -106,9 +107,10 @@ unsigned char *ASN1_seq_pack(STACK *safes, int (*i2d)(), unsigned char **buf,
 
 /* Extract an ASN1 object from an ASN1_STRING */
 
-void *ASN1_unpack_string (ASN1_STRING *oct, char *(*d2i)())
+void *ASN1_unpack_string (ASN1_STRING *oct,
+                         void *(*d2i)(void *,const unsigned char **,long))
 {
-       unsigned char *p;
+       const unsigned char *p;
        char *ret;
 
        p = oct->data;
@@ -119,7 +121,8 @@ void *ASN1_unpack_string (ASN1_STRING *oct, char *(*d2i)())
 
 /* Pack an ASN1 object into an ASN1_STRING */
 
-ASN1_STRING *ASN1_pack_string(void *obj, int (*i2d)(), ASN1_STRING **oct)
+ASN1_STRING *ASN1_pack_string(void *obj, int (*i2d)(void *,unsigned char **),
+                             ASN1_STRING **oct)
 {
        unsigned char *p;
        ASN1_STRING *octmp;
index a5a02e8..e1bb322 100644 (file)
@@ -107,14 +107,20 @@ DECLARE_ASN1_ENCODE_FUNCTIONS_const(NETSCAPE_PKEY,NETSCAPE_PKEY)
 IMPLEMENT_ASN1_FUNCTIONS_const(NETSCAPE_PKEY)
 
 static RSA *d2i_RSA_NET_2(RSA **a, ASN1_OCTET_STRING *os,
-            int (*cb)(), int sgckey);
+                         int (*cb)(char *buf, int len, const char *prompt,
+                                   int verify),
+                         int sgckey);
 
-int i2d_Netscape_RSA(const RSA *a, unsigned char **pp, int (*cb)())
+int i2d_Netscape_RSA(const RSA *a, unsigned char **pp,
+                    int (*cb)(char *buf, int len, const char *prompt,
+                              int verify))
 {
        return i2d_RSA_NET(a, pp, cb, 0);
 }
 
-int i2d_RSA_NET(const RSA *a, unsigned char **pp, int (*cb)(), int sgckey)
+int i2d_RSA_NET(const RSA *a, unsigned char **pp,
+               int (*cb)(char *buf, int len, const char *prompt, int verify),
+               int sgckey)
        {
        int i, j, ret = 0;
        int rsalen, pkeylen, olen;
@@ -224,12 +230,16 @@ err:
        }
 
 
-RSA *d2i_Netscape_RSA(RSA **a, const unsigned char **pp, long length, int (*cb)())
+RSA *d2i_Netscape_RSA(RSA **a, const unsigned char **pp, long length,
+                     int (*cb)(char *buf, int len, const char *prompt,
+                               int verify))
 {
        return d2i_RSA_NET(a, pp, length, cb, 0);
 }
 
-RSA *d2i_RSA_NET(RSA **a, const unsigned char **pp, long length, int (*cb)(), int sgckey)
+RSA *d2i_RSA_NET(RSA **a, const unsigned char **pp, long length,
+                int (*cb)(char *buf, int len, const char *prompt, int verify),
+                int sgckey)
        {
        RSA *ret=NULL;
        const unsigned char *p, *kp;
@@ -269,7 +279,8 @@ RSA *d2i_RSA_NET(RSA **a, const unsigned char **pp, long length, int (*cb)(), in
        }
 
 static RSA *d2i_RSA_NET_2(RSA **a, ASN1_OCTET_STRING *os,
-            int (*cb)(), int sgckey)
+                         int (*cb)(char *buf, int len, const char *prompt,
+                                   int verify), int sgckey)
        {
        NETSCAPE_PKEY *pkey=NULL;
        RSA *ret=NULL;
index ec78826..9893dd5 100644 (file)
@@ -106,7 +106,8 @@ X509_ALGOR *PKCS5_pbe_set(int alg, int iter, unsigned char *salt,
        }
 
        astype->type = V_ASN1_SEQUENCE;
-       if(!ASN1_pack_string(pbe, i2d_PBEPARAM, &astype->value.sequence)) {
+       if(!ASN1_pack_string_of(PBEPARAM, pbe, i2d_PBEPARAM,
+                               &astype->value.sequence)) {
                ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE);
                goto err;
        }
index 1aff495..c834a38 100644 (file)
@@ -164,7 +164,7 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
 
        if(!(pbe2->keyfunc->parameter = ASN1_TYPE_new())) goto merr;
 
-       if(!ASN1_pack_string(kdf, i2d_PBKDF2PARAM,
+       if(!ASN1_pack_string_of(PBKDF2PARAM, kdf, i2d_PBKDF2PARAM,
                         &pbe2->keyfunc->parameter->value.sequence)) goto merr;
        pbe2->keyfunc->parameter->type = V_ASN1_SEQUENCE;
 
@@ -180,7 +180,7 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
 
        /* Encode PBE2PARAM into parameter */
 
-       if(!ASN1_pack_string(pbe2, i2d_PBE2PARAM,
+       if(!ASN1_pack_string_of(PBE2PARAM, pbe2, i2d_PBE2PARAM,
                                 &ret->parameter->value.sequence)) goto merr;
        ret->parameter->type = V_ASN1_SEQUENCE;
 
index c88cfd5..ee860be 100644 (file)
@@ -76,8 +76,8 @@ X509_PKEY *d2i_X509_PKEY(X509_PKEY **a, const unsigned char **pp, long length)
 
        M_ASN1_D2I_Init();
        M_ASN1_D2I_start_sequence();
-       M_ASN1_D2I_get(ret->enc_algor,d2i_X509_ALGOR);
-       M_ASN1_D2I_get(ret->enc_pkey,d2i_ASN1_OCTET_STRING);
+       M_ASN1_D2I_get(X509_ALGOR,ret->enc_algor,d2i_X509_ALGOR);
+       M_ASN1_D2I_get(ASN1_OCTET_STRING,ret->enc_pkey,d2i_ASN1_OCTET_STRING);
 
        ret->cipher.cipher=EVP_get_cipherbyname(
                OBJ_nid2ln(OBJ_obj2nid(ret->enc_algor->algorithm)));
index eff2290..12d1a25 100644 (file)
@@ -128,11 +128,13 @@ ASN1_SEQUENCE_ref(X509, x509_cb, CRYPTO_LOCK_X509) = {
 IMPLEMENT_ASN1_FUNCTIONS(X509)
 IMPLEMENT_ASN1_DUP_FUNCTION(X509)
 
-static ASN1_METHOD meth={
-       (int (*)())  i2d_X509,
-       (char *(*)())d2i_X509,
-       (char *(*)())X509_new,
-       (void (*)()) X509_free};
+static ASN1_METHOD meth=
+    {
+    (I2D_OF(void))  i2d_X509,
+    (D2I_OF(void)) d2i_X509,
+    (void *(*)(void))X509_new,
+    (void (*)(void *)) X509_free
+    };
 
 ASN1_METHOD *X509_asn1_meth(void)
        {
index a608d81..bfb2b57 100644 (file)
@@ -590,9 +590,9 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr)
                break;
        case BIO_CTRL_GET_CALLBACK:
                {
-               int (**fptr)();
+               int (**fptr)(const BIO *bio,int state,int ret);
 
-               fptr=(int (**)())ptr;
+               fptr=(int (**)(const BIO *bio,int state,int ret))ptr;
                *fptr=data->info_callback;
                }
                break;
index 312340e..991a018 100644 (file)
@@ -142,21 +142,13 @@ struct dh_st
    this for backward compatibility: */
 #define DH_CHECK_P_NOT_STRONG_PRIME    DH_CHECK_P_NOT_SAFE_PRIME
 
-#define DHparams_dup(x) (DH *)ASN1_dup((int (*)())i2d_DHparams, \
-               (char *(*)())d2i_DHparams,(char *)(x))
+#define DHparams_dup(x) ASN1_dup_of_const(DH,i2d_DHparams,d2i_DHparams,x)
 #define d2i_DHparams_fp(fp,x) (DH *)ASN1_d2i_fp((char *(*)())DH_new, \
                (char *(*)())d2i_DHparams,(fp),(unsigned char **)(x))
 #define i2d_DHparams_fp(fp,x) ASN1_i2d_fp(i2d_DHparams,(fp), \
                (unsigned char *)(x))
-#define d2i_DHparams_bio(bp,x) (DH *)ASN1_d2i_bio((char *(*)())DH_new, \
-               (char *(*)())d2i_DHparams,(bp),(unsigned char **)(x))
-#ifdef  __cplusplus
-#define i2d_DHparams_bio(bp,x) ASN1_i2d_bio((int (*)())i2d_DHparams,(bp), \
-               (unsigned char *)(x))
-#else
-#define i2d_DHparams_bio(bp,x) ASN1_i2d_bio(i2d_DHparams,(bp), \
-               (unsigned char *)(x))
-#endif
+#define d2i_DHparams_bio(bp,x) ASN1_d2i_bio_of(DH,DH_new,d2i_DHparams,bp,x)
+#define i2d_DHparams_bio(bp,x) ASN1_i2d_bio_of_const(DH,i2d_DHparams,bp,x)
 
 const DH_METHOD *DH_OpenSSL(void);
 
index 068e18c..8eec737 100644 (file)
@@ -154,16 +154,13 @@ struct dsa_st
        ENGINE *engine;
        };
 
-#define DSAparams_dup(x) (DSA *)ASN1_dup((int (*)())i2d_DSAparams, \
-               (char *(*)())d2i_DSAparams,(char *)(x))
+#define DSAparams_dup(x) ASN1_dup_of_const(DSA,i2d_DSAparams,d2i_DSAparams,x)
 #define d2i_DSAparams_fp(fp,x) (DSA *)ASN1_d2i_fp((char *(*)())DSA_new, \
                (char *(*)())d2i_DSAparams,(fp),(unsigned char **)(x))
 #define i2d_DSAparams_fp(fp,x) ASN1_i2d_fp(i2d_DSAparams,(fp), \
                (unsigned char *)(x))
-#define d2i_DSAparams_bio(bp,x) (DSA *)ASN1_d2i_bio((char *(*)())DSA_new, \
-               (char *(*)())d2i_DSAparams,(bp),(unsigned char **)(x))
-#define i2d_DSAparams_bio(bp,x) ASN1_i2d_bio(i2d_DSAparams,(bp), \
-               (unsigned char *)(x))
+#define d2i_DSAparams_bio(bp,x) ASN1_d2i_bio_of(DSA,DSA_new,d2i_DSAparams,bp,x)
+#define i2d_DSAparams_bio(bp,x) ASN1_i2d_bio_of_const(DSA,i2d_DSAparams,bp,x)
 
 
 DSA_SIG * DSA_SIG_new(void);
index b3267df..d60b4c1 100644 (file)
@@ -277,10 +277,8 @@ typedef struct ecpk_parameters_st ECPKPARAMETERS;
 EC_GROUP *d2i_ECPKParameters(EC_GROUP **, const unsigned char **in, long len);
 int i2d_ECPKParameters(const EC_GROUP *, unsigned char **out);
 
-#define d2i_ECPKParameters_bio(bp,x) (EC_GROUP *)ASN1_d2i_bio(NULL, \
-                (char *(*)())d2i_ECPKParameters,(bp),(unsigned char **)(x))
-#define i2d_ECPKParameters_bio(bp,x) ASN1_i2d_bio(i2d_ECPKParameters,(bp), \
-               (unsigned char *)(x))
+#define d2i_ECPKParameters_bio(bp,x) ASN1_d2i_bio_of(EC_GROUP,NULL,d2i_ECPKParameters,bp,x)
+#define i2d_ECPKParameters_bio(bp,x) ASN1_i2d_bio_of_const(EC_GROUP,i2d_ECPKParameters,bp,x)
 #define d2i_ECPKParameters_fp(fp,x) (EC_GROUP *)ASN1_d2i_fp(NULL, \
                 (char *(*)())d2i_ECPKParameters,(fp),(unsigned char **)(x))
 #define i2d_ECPKParameters_fp(fp,x) ASN1_i2d_fp(i2d_ECPKParameters,(fp), \
@@ -351,8 +349,7 @@ int ECParameters_print_fp(FILE *fp, const EC_KEY *x);
 int    EC_KEY_print_fp(FILE *fp, const EC_KEY *x, int off);
 #endif
 
-#define ECParameters_dup(x) (EC_KEY *)ASN1_dup((int (*)())i2d_ECParameters,\
-               (char *(*)())d2i_ECParameters,(char *)(x))
+#define ECParameters_dup(x) ASN1_dup_of(EC_KEY,i2d_ECParameters,d2i_ECParameters,x)
 
 /* BEGIN ERROR CODES */
 /* The following lines are auto generated by the script mkerr.pl. Any changes
index 1852748..4455ef6 100644 (file)
@@ -100,7 +100,8 @@ static int int_ctrl_cmd_by_num(const ENGINE_CMD_DEFN *defn, unsigned int num)
        return -1;
        }
 
-static int int_ctrl_helper(ENGINE *e, int cmd, long i, void *p, void (*f)())
+static int int_ctrl_helper(ENGINE *e, int cmd, long i, void *p,
+                          void (*f)(void))
        {
        int idx;
        char *s = (char *)p;
index c2d0297..cf82f49 100644 (file)
@@ -72,7 +72,7 @@ int main(int argc, char *argv[])
 #include <openssl/engine.h>
 #include <openssl/err.h>
 
-static void display_engine_list()
+static void display_engine_list(void)
        {
        ENGINE *h;
        int loop;
index e28ec56..655299a 100644 (file)
@@ -541,7 +541,7 @@ static ERR_STRING_DATA SYS_str_reasons[NUM_SYS_STR_REASONS + 1];
  * will be returned for SYSerr(), which always gets an errno
  * value and never one of those 'standard' reason codes. */
 
-static void build_SYS_str_reasons()
+static void build_SYS_str_reasons(void)
        {
        /* OPENSSL_malloc cannot be used here, use static storage instead */
        static char strerror_tab[NUM_SYS_STR_REASONS][LEN_SYS_STR_REASON];
index 70c79b3..209e16c 100644 (file)
@@ -233,20 +233,31 @@ struct env_md_st
        int (*cleanup)(EVP_MD_CTX *ctx);
 
        /* FIXME: prototype these some day */
-       int (*sign)();
-       int (*verify)();
+       int (*sign)(int type, const unsigned char *m, unsigned int m_length,
+                   unsigned char *sigret, unsigned int *siglen, void *key);
+       int (*verify)(int type, const unsigned char *m, unsigned int m_length,
+                     const unsigned char *sigbuf, unsigned int siglen,
+                     void *key);
        int required_pkey_type[5]; /*EVP_PKEY_xxx */
        int block_size;
        int ctx_size; /* how big does the ctx->md_data need to be */
        } /* EVP_MD */;
 
+typedef int evp_sign_method(int type,const unsigned char *m,
+                           unsigned int m_length,unsigned char *sigret,
+                           unsigned int *siglen, void *key);
+typedef int evp_verify_method(int type,const unsigned char *m,
+                           unsigned int m_length,const unsigned char *sigbuf,
+                           unsigned int siglen, void *key);
+
 #define EVP_MD_FLAG_ONESHOT    0x0001 /* digest can only handle a single
                                        * block */
 
 #define EVP_PKEY_NULL_method   NULL,NULL,{0,0,0,0}
 
 #ifndef OPENSSL_NO_DSA
-#define EVP_PKEY_DSA_method    DSA_sign,DSA_verify, \
+#define EVP_PKEY_DSA_method    (evp_sign_method *)DSA_sign, \
+                               (evp_verify_method *)DSA_verify, \
                                {EVP_PKEY_DSA,EVP_PKEY_DSA2,EVP_PKEY_DSA3, \
                                        EVP_PKEY_DSA4,0}
 #else
@@ -254,14 +265,16 @@ struct env_md_st
 #endif
 
 #ifndef OPENSSL_NO_ECDSA
-#define EVP_PKEY_ECDSA_method   ECDSA_sign,ECDSA_verify, \
+#define EVP_PKEY_ECDSA_method   (evp_sign_method *)ECDSA_sign, \
+                               (evp_verify_method *)ECDSA_verify, \
                                  {EVP_PKEY_EC,0,0,0}
 #else   
 #define EVP_PKEY_ECDSA_method   EVP_PKEY_NULL_method
 #endif
 
 #ifndef OPENSSL_NO_RSA
-#define EVP_PKEY_RSA_method    RSA_sign,RSA_verify, \
+#define EVP_PKEY_RSA_method    (evp_sign_method *)RSA_sign, \
+                               (evp_verify_method *)RSA_verify, \
                                {EVP_PKEY_RSA,EVP_PKEY_RSA2,0,0}
 #define EVP_PKEY_RSA_ASN1_OCTET_STRING_method \
                                RSA_sign_ASN1_OCTET_STRING, \
index e752c20..7570a6e 100644 (file)
@@ -360,7 +360,7 @@ PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8_broken(EVP_PKEY *pkey, int broken)
 
                p8->pkeyalg->algorithm = OBJ_nid2obj(NID_rsaEncryption);
                p8->pkeyalg->parameter->type = V_ASN1_NULL;
-               if (!ASN1_pack_string ((char *)pkey, i2d_PrivateKey,
+               if (!ASN1_pack_string_of (EVP_PKEY,pkey, i2d_PrivateKey,
                                         &p8->pkey->value.octet_string)) {
                        EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE);
                        PKCS8_PRIV_KEY_INFO_free (p8);
@@ -458,7 +458,7 @@ static int dsa_pkey2pkcs8(PKCS8_PRIV_KEY_INFO *p8, EVP_PKEY *pkey)
                case PKCS8_OK:
                case PKCS8_NO_OCTET:
 
-               if (!ASN1_pack_string((char *)prkey, i2d_ASN1_INTEGER,
+               if (!ASN1_pack_string_of(ASN1_INTEGER,prkey, i2d_ASN1_INTEGER,
                                         &p8->pkey->value.octet_string)) {
                        EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE);
                        goto err;
index 9856c26..d952b71 100644 (file)
@@ -401,7 +401,7 @@ static LHASH_NODE **getrn(LHASH *lh, const void *data, unsigned long *rhash)
        {
        LHASH_NODE **ret,*n1;
        unsigned long hash,nn;
-       int (*cf)();
+       LHASH_COMP_FN_TYPE cf;
 
        hash=(*(lh->hash))(data);
        lh->num_hash_calls++;
index fab3c03..37375c1 100644 (file)
@@ -349,13 +349,9 @@ typedef struct ocsp_service_locator_st
 #define PEM_STRING_OCSP_REQUEST        "OCSP REQUEST"
 #define PEM_STRING_OCSP_RESPONSE "OCSP RESPONSE"
 
-#define d2i_OCSP_REQUEST_bio(bp,p) (OCSP_REQUEST*)ASN1_d2i_bio((char*(*)()) \
-               OCSP_REQUEST_new,(char *(*)())d2i_OCSP_REQUEST, (bp),\
-               (unsigned char **)(p))
+#define d2i_OCSP_REQUEST_bio(bp,p) ASN1_d2i_bio_of(OCSP_REQUEST,OCSP_REQUEST_new,d2i_OCSP_REQUEST,bp,p)
 
-#define d2i_OCSP_RESPONSE_bio(bp,p) (OCSP_RESPONSE*)ASN1_d2i_bio((char*(*)())\
-               OCSP_REQUEST_new,(char *(*)())d2i_OCSP_RESPONSE, (bp),\
-               (unsigned char **)(p))
+#define d2i_OCSP_RESPONSE_bio(bp,p) ASN1_d2i_bio_of(OCSP_RESPONSE,OCSP_RESPONSE_new,d2i_OCSP_RESPONSE,bp,p)
 
 #define        PEM_read_bio_OCSP_REQUEST(bp,x,cb) (OCSP_REQUEST *)PEM_ASN1_read_bio( \
      (char *(*)())d2i_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,bp,(char **)x,cb,NULL)
@@ -371,11 +367,9 @@ typedef struct ocsp_service_locator_st
     PEM_ASN1_write_bio((int (*)())i2d_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,\
                        bp,(char *)o, NULL,NULL,0,NULL,NULL)
 
-#define i2d_OCSP_RESPONSE_bio(bp,o) ASN1_i2d_bio(i2d_OCSP_RESPONSE,bp,\
-               (unsigned char *)o)
+#define i2d_OCSP_RESPONSE_bio(bp,o) ASN1_i2d_bio_of(OCSP_RESPONSE,i2d_OCSP_RESPONSE,bp,o)
 
-#define i2d_OCSP_REQUEST_bio(bp,o) ASN1_i2d_bio(i2d_OCSP_REQUEST,bp,\
-               (unsigned char *)o)
+#define i2d_OCSP_REQUEST_bio(bp,o) ASN1_i2d_bio_of(OCSP_REQUEST,i2d_OCSP_REQUEST,bp,o)
 
 #define OCSP_REQUEST_sign(o,pkey,md) \
        ASN1_item_sign(ASN1_ITEM_rptr(OCSP_REQINFO),\
@@ -396,8 +390,7 @@ typedef struct ocsp_service_locator_st
 #define ASN1_BIT_STRING_digest(data,type,md,len) \
        ASN1_item_digest(ASN1_ITEM_rptr(ASN1_BIT_STRING),type,data,md,len)
 
-#define OCSP_CERTID_dup(cid) (OCSP_CERTID*)ASN1_dup((int(*)())i2d_OCSP_CERTID,\
-               (char *(*)())d2i_OCSP_CERTID,(char *)(cid))
+#define OCSP_CERTID_dup(cid) ASN1_dup_of(OCSP_CERTID,i2d_OCSP_CERTID,d2i_OCSP_CERTID,cid)
 
 #define OCSP_CERTSTATUS_dup(cs)\
                 (OCSP_CERTSTATUS*)ASN1_dup((int(*)())i2d_OCSP_CERTSTATUS,\
@@ -473,8 +466,11 @@ int OCSP_basic_sign(OCSP_BASICRESP *brsp,
                        X509 *signer, EVP_PKEY *key, const EVP_MD *dgst,
                        STACK_OF(X509) *certs, unsigned long flags);
 
-ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s, int (*i2d)(), 
-                               char *data, STACK_OF(ASN1_OBJECT) *sk);
+ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s,
+                               int (*i2d)(void *,unsigned char **), 
+                               void *data, STACK_OF(ASN1_OBJECT) *sk);
+#define ASN1_STRING_encode_of(type,s,i2d,data,sk) \
+((ASN1_STRING *(*)(ASN1_STRING *,I2D_OF(type),type *,STACK_OF(ASN1_OBJECT) *))ASN1_STRING_encode)(s,i2d,data,sk)
 
 X509_EXTENSION *OCSP_crlID_new(char *url, long *n, char *tim);
 
index 5739943..658a891 100644 (file)
@@ -265,8 +265,9 @@ int OCSP_SINGLERESP_add_ext(OCSP_SINGLERESP *x, X509_EXTENSION *ex, int loc)
 
 /* also CRL Entry Extensions */
 
-ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s, int (*i2d)(), 
-                               char *data, STACK_OF(ASN1_OBJECT) *sk)
+ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s,
+                               int (*i2d)(void *,unsigned char **), 
+                               void *data, STACK_OF(ASN1_OBJECT) *sk)
         {
        int i;
        unsigned char *p, *b = NULL;
@@ -274,18 +275,23 @@ ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s, int (*i2d)(),
        if (data)
                {
                if ((i=i2d(data,NULL)) <= 0) goto err;
-               if (!(b=p=(unsigned char*)OPENSSL_malloc((unsigned int)i)))
+               if (!(b=p=OPENSSL_malloc((unsigned int)i)))
                        goto err;
                if (i2d(data, &p) <= 0) goto err;
                }
        else if (sk)
                {
-               if ((i=i2d_ASN1_SET_OF_ASN1_OBJECT(sk,NULL,i2d,V_ASN1_SEQUENCE,
-                                  V_ASN1_UNIVERSAL,IS_SEQUENCE))<=0) goto err;
-               if (!(b=p=(unsigned char*)OPENSSL_malloc((unsigned int)i)))
+               if ((i=i2d_ASN1_SET_OF_ASN1_OBJECT(sk,NULL,
+                                                  (I2D_OF(ASN1_OBJECT))i2d,
+                                                  V_ASN1_SEQUENCE,
+                                                  V_ASN1_UNIVERSAL,
+                                                  IS_SEQUENCE))<=0) goto err;
+               if (!(b=p=OPENSSL_malloc((unsigned int)i)))
                        goto err;
-               if (i2d_ASN1_SET_OF_ASN1_OBJECT(sk,&p,i2d,V_ASN1_SEQUENCE,
-                                V_ASN1_UNIVERSAL,IS_SEQUENCE)<=0) goto err;
+               if (i2d_ASN1_SET_OF_ASN1_OBJECT(sk,&p,(I2D_OF(ASN1_OBJECT))i2d,
+                                               V_ASN1_SEQUENCE,
+                                               V_ASN1_UNIVERSAL,
+                                               IS_SEQUENCE)<=0) goto err;
                }
        else
                {
@@ -439,7 +445,8 @@ X509_EXTENSION *OCSP_crlID_new(char *url, long *n, char *tim)
                }
        if (!(x = X509_EXTENSION_new())) goto err;
        if (!(x->object = OBJ_nid2obj(NID_id_pkix_OCSP_CrlID))) goto err;
-       if (!(ASN1_STRING_encode(x->value,i2d_OCSP_CRLID,(char*)cid,NULL)))
+       if (!(ASN1_STRING_encode_of(OCSP_CRLID,x->value,i2d_OCSP_CRLID,cid,
+                                   NULL)))
                goto err;
        OCSP_CRLID_free(cid);
        return x;
@@ -467,7 +474,8 @@ X509_EXTENSION *OCSP_accept_responses_new(char **oids)
        if (!(x = X509_EXTENSION_new())) goto err;
        if (!(x->object = OBJ_nid2obj(NID_id_pkix_OCSP_acceptableResponses)))
                goto err;
-       if (!(ASN1_STRING_encode(x->value,i2d_ASN1_OBJECT,NULL,sk)))
+       if (!(ASN1_STRING_encode_of(ASN1_OBJECT,x->value,i2d_ASN1_OBJECT,NULL,
+                                   sk)))
                goto err;
        sk_ASN1_OBJECT_pop_free(sk, ASN1_OBJECT_free);
        return x;
@@ -487,8 +495,8 @@ X509_EXTENSION *OCSP_archive_cutoff_new(char* tim)
        if (!(ASN1_GENERALIZEDTIME_set_string(gt, tim))) goto err;
        if (!(x = X509_EXTENSION_new())) goto err;
        if (!(x->object=OBJ_nid2obj(NID_id_pkix_OCSP_archiveCutoff)))goto err;
-       if (!(ASN1_STRING_encode(x->value,i2d_ASN1_GENERALIZEDTIME,
-                                (char*)gt,NULL))) goto err;
+       if (!(ASN1_STRING_encode_of(ASN1_GENERALIZEDTIME,x->value,
+                                   i2d_ASN1_GENERALIZEDTIME,gt,NULL))) goto err;
        ASN1_GENERALIZEDTIME_free(gt);
        return x;
 err:
@@ -526,8 +534,8 @@ X509_EXTENSION *OCSP_url_svcloc_new(X509_NAME* issuer, char **urls)
        if (!(x = X509_EXTENSION_new())) goto err;
        if (!(x->object = OBJ_nid2obj(NID_id_pkix_OCSP_serviceLocator))) 
                goto err;
-       if (!(ASN1_STRING_encode(x->value, i2d_OCSP_SERVICELOC,
-                                (char*)sloc, NULL))) goto err;
+       if (!(ASN1_STRING_encode_of(OCSP_SERVICELOC,x->value,
+                                   i2d_OCSP_SERVICELOC,sloc,NULL))) goto err;
        OCSP_SERVICELOC_free(sloc);
        return x;
 err:
index ce5b75c..9a5fa03 100644 (file)
@@ -220,15 +220,19 @@ typedef struct pem_ctx_st
 #define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \
 type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u)\
 { \
-return((type *)PEM_ASN1_read((char *(*)())d2i_##asn1, str,fp,(char **)x,\
-       cb,u)); \
+return(((type *(*)(D2I_OF(type),char *,FILE *,type **,pem_password_cb *,void *))PEM_ASN1_read)(d2i_##asn1, str,fp,x,cb,u)); \
 } \
 
 #define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \
 int PEM_write_##name(FILE *fp, type *x) \
 { \
-return(PEM_ASN1_write((int (*)())i2d_##asn1,str,fp, (char *)x, \
-                                                        NULL,NULL,0,NULL,NULL)); \
+return(((int (*)(I2D_OF(type),const char *,FILE *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))PEM_ASN1_write)(i2d_##asn1,str,fp,x,NULL,NULL,0,NULL,NULL)); \
+}
+
+#define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \
+int PEM_write_##name(FILE *fp, type *x) \
+{ \
+return(((int (*)(I2D_OF_const(type),const char *,FILE *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))PEM_ASN1_write)(i2d_##asn1,str,fp,x,NULL,NULL,0,NULL,NULL)); \
 }
 
 #define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \
@@ -236,8 +240,15 @@ int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \
             unsigned char *kstr, int klen, pem_password_cb *cb, \
                  void *u) \
        { \
-       return(PEM_ASN1_write((int (*)())i2d_##asn1,str,fp, \
-               (char *)x,enc,kstr,klen,cb,u)); \
+       return(((int (*)(I2D_OF(type),const char *,FILE *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))PEM_ASN1_write)(i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u)); \
+       }
+
+#define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \
+int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \
+            unsigned char *kstr, int klen, pem_password_cb *cb, \
+                 void *u) \
+       { \
+       return(((int (*)(I2D_OF_const(type),const char *,FILE *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))PEM_ASN1_write)(i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u)); \
        }
 
 #endif
@@ -245,33 +256,51 @@ int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \
 #define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \
 type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u)\
 { \
-return((type *)PEM_ASN1_read_bio((char *(*)())d2i_##asn1, str,bp,\
-                                                       (char **)x,cb,u)); \
+return(((type *(*)(D2I_OF(type),const char *,BIO *,type **,pem_password_cb *,void *))PEM_ASN1_read_bio)(d2i_##asn1, str,bp,x,cb,u)); \
 }
 
 #define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \
 int PEM_write_bio_##name(BIO *bp, type *x) \
 { \
-return(PEM_ASN1_write_bio((int (*)())i2d_##asn1,str,bp, (char *)x, \
-                                                        NULL,NULL,0,NULL,NULL)); \
+return(((int (*)(I2D_OF(type),const char *,BIO *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))PEM_ASN1_write_bio)(i2d_##asn1,str,bp,x,NULL,NULL,0,NULL,NULL)); \
+}
+
+#define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \
+int PEM_write_bio_##name(BIO *bp, type *x) \
+{ \
+return(((int (*)(I2D_OF_const(type),const char *,BIO *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))PEM_ASN1_write_bio)(i2d_##asn1,str,bp,x,NULL,NULL,0,NULL,NULL)); \
 }
 
 #define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \
 int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
             unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \
        { \
-       return(PEM_ASN1_write_bio((int (*)())i2d_##asn1,str,bp, \
-               (char *)x,enc,kstr,klen,cb,u)); \
+       return(((int (*)(I2D_OF(type),const char *,BIO *,type *,const EVP_CIPHER *,unsigned char *,int,pem_password_cb *,void *))PEM_ASN1_write_bio)(i2d_##asn1,str,bp,x,enc,kstr,klen,cb,u)); \
+       }
+
+#define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \
+int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
+            unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \
+       { \
+       return(((int (*)(I2D_OF_const(type),const char *,BIO *,type *,const EVP_CIPHER *,unsigned char *,int,pem_password_cb *,void *))PEM_ASN1_write_bio)(i2d_##asn1,str,bp,x,enc,kstr,klen,cb,u)); \
        }
 
 #define IMPLEMENT_PEM_write(name, type, str, asn1) \
        IMPLEMENT_PEM_write_bio(name, type, str, asn1) \
        IMPLEMENT_PEM_write_fp(name, type, str, asn1) 
 
+#define IMPLEMENT_PEM_write_const(name, type, str, asn1) \
+       IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \
+       IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) 
+
 #define IMPLEMENT_PEM_write_cb(name, type, str, asn1) \
        IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \
        IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) 
 
+#define IMPLEMENT_PEM_write_cb_const(name, type, str, asn1) \
+       IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \
+       IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) 
+
 #define IMPLEMENT_PEM_read(name, type, str, asn1) \
        IMPLEMENT_PEM_read_bio(name, type, str, asn1) \
        IMPLEMENT_PEM_read_fp(name, type, str, asn1) 
@@ -280,6 +309,10 @@ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
        IMPLEMENT_PEM_read(name, type, str, asn1) \
        IMPLEMENT_PEM_write(name, type, str, asn1)
 
+#define IMPLEMENT_PEM_rw_const(name, type, str, asn1) \
+       IMPLEMENT_PEM_read(name, type, str, asn1) \
+       IMPLEMENT_PEM_write_const(name, type, str, asn1)
+
 #define IMPLEMENT_PEM_rw_cb(name, type, str, asn1) \
        IMPLEMENT_PEM_read(name, type, str, asn1) \
        IMPLEMENT_PEM_write_cb(name, type, str, asn1)
@@ -410,9 +443,6 @@ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
         (char *(*)())d2i_NETSCAPE_CERT_SEQUENCE,PEM_STRING_X509,fp,\
                                                        (char **)x,cb,u)
 
-#define PEM_write_bio_SSL_SESSION(bp,x) \
-               PEM_ASN1_write_bio((int (*)())i2d_SSL_SESSION, \
-                       PEM_STRING_SSL_SESSION,bp, (char *)x, NULL,NULL,0,NULL,NULL)
 #define PEM_write_bio_X509(bp,x) \
                PEM_ASN1_write_bio((int (*)())i2d_X509,PEM_STRING_X509,bp, \
                        (char *)x, NULL,NULL,0,NULL,NULL)
@@ -451,8 +481,6 @@ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
                        PEM_STRING_X509,bp, \
                         (char *)x, NULL,NULL,0,NULL,NULL)
 
-#define        PEM_read_bio_SSL_SESSION(bp,x,cb,u) (SSL_SESSION *)PEM_ASN1_read_bio( \
-       (char *(*)())d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,bp,(char **)x,cb,u)
 #define        PEM_read_bio_X509(bp,x,cb,u) (X509 *)PEM_ASN1_read_bio( \
        (char *(*)())d2i_X509,PEM_STRING_X509,bp,(char **)x,cb,u)
 #define        PEM_read_bio_X509_REQ(bp,x,cb,u) (X509_REQ *)PEM_ASN1_read_bio( \
@@ -501,11 +529,17 @@ int       PEM_write_bio(BIO *bp,const char *name,char *hdr,unsigned char *data,
                long len);
 int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, const char *name, BIO *bp,
             pem_password_cb *cb, void *u);
-char * PEM_ASN1_read_bio(char *(*d2i)(),const char *name,BIO *bp,char **x,
-               pem_password_cb *cb, void *u);
-int    PEM_ASN1_write_bio(int (*i2d)(),const char *name,BIO *bp,char *x,
+void * PEM_ASN1_read_bio(void *(*d2i)(void **,const unsigned char **,long),
+                         const char *name,BIO *bp,void **x,
+                         pem_password_cb *cb, void *u);
+#define PEM_ASN1_read_bio_of(type,d2i,name,bp,x,cb,u) \
+((type *(*)(D2I_OF(type),const char *,BIO *,type **,pem_password_cb *,void *))PEM_ASN1_read_bio)(d2i,name,bp,x,cb,u)
+int    PEM_ASN1_write_bio(int (*i2d)(void *,unsigned char **),const char *name,BIO *bp,char *x,
                           const EVP_CIPHER *enc,unsigned char *kstr,int klen,
                           pem_password_cb *cb, void *u);
+#define PEM_ASN1_write_bio_of(type,i2d,name,bp,x,enc,kstr,klen,cb,u) \
+       ((int (*)(I2D_OF(type),const char *,BIO *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))PEM_ASN1_write_bio)(i2d,name,bp,x,enc,kstr,klen,cb,u)
+
 STACK_OF(X509_INFO) *  PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u);
 int    PEM_X509_INFO_write_bio(BIO *bp,X509_INFO *xi, EVP_CIPHER *enc,
                unsigned char *kstr, int klen, pem_password_cb *cd, void *u);
@@ -515,11 +549,12 @@ int       PEM_X509_INFO_write_bio(BIO *bp,X509_INFO *xi, EVP_CIPHER *enc,
 int    PEM_read(FILE *fp, char **name, char **header,
                unsigned char **data,long *len);
 int    PEM_write(FILE *fp,char *name,char *hdr,unsigned char *data,long len);
-char * PEM_ASN1_read(char *(*d2i)(),const char *name,FILE *fp,char **x,
-       pem_password_cb *cb, void *u);
-int    PEM_ASN1_write(int (*i2d)(),const char *name,FILE *fp,char *x,
-                      const EVP_CIPHER *enc,unsigned char *kstr,int klen,
-                      pem_password_cb *callback, void *u);
+void *  PEM_ASN1_read(void *(*d2i)(void **,const unsigned char **,long),
+                     const char *name,FILE *fp,void **x,pem_password_cb *cb,
+                     void *u);
+int    PEM_ASN1_write(int (*i2d)(void *,unsigned char **),const char *name,FILE *fp,
+                      char *x,const EVP_CIPHER *enc,unsigned char *kstr,
+                      int klen,pem_password_cb *callback, void *u);
 STACK_OF(X509_INFO) *  PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk,
        pem_password_cb *cb, void *u);
 #endif
index a4357d5..a9ac52d 100644 (file)
@@ -188,8 +188,8 @@ RSA *PEM_read_RSAPrivateKey(FILE *fp, RSA **rsa, pem_password_cb *cb,
 
 #endif
 
-IMPLEMENT_PEM_write_cb(RSAPrivateKey, RSA, PEM_STRING_RSA, RSAPrivateKey)
-IMPLEMENT_PEM_rw(RSAPublicKey, RSA, PEM_STRING_RSA_PUBLIC, RSAPublicKey)
+IMPLEMENT_PEM_write_cb_const(RSAPrivateKey, RSA, PEM_STRING_RSA, RSAPrivateKey)
+IMPLEMENT_PEM_rw_const(RSAPublicKey, RSA, PEM_STRING_RSA_PUBLIC, RSAPublicKey)
 IMPLEMENT_PEM_rw(RSA_PUBKEY, RSA, PEM_STRING_PUBLIC, RSA_PUBKEY)
 
 #endif
@@ -218,7 +218,7 @@ DSA *PEM_read_bio_DSAPrivateKey(BIO *bp, DSA **dsa, pem_password_cb *cb,
        return pkey_get_dsa(pktmp, dsa);
 }
 
-IMPLEMENT_PEM_write_cb(DSAPrivateKey, DSA, PEM_STRING_DSA, DSAPrivateKey)
+IMPLEMENT_PEM_write_cb_const(DSAPrivateKey, DSA, PEM_STRING_DSA, DSAPrivateKey)
 IMPLEMENT_PEM_rw(DSA_PUBKEY, DSA, PEM_STRING_PUBLIC, DSA_PUBKEY)
 
 #ifndef OPENSSL_NO_FP_API
@@ -233,7 +233,7 @@ DSA *PEM_read_DSAPrivateKey(FILE *fp, DSA **dsa, pem_password_cb *cb,
 
 #endif
 
-IMPLEMENT_PEM_rw(DSAparams, DSA, PEM_STRING_DSAPARAMS, DSAparams)
+IMPLEMENT_PEM_rw_const(DSAparams, DSA, PEM_STRING_DSAPARAMS, DSAparams)
 
 #endif
 
@@ -262,7 +262,7 @@ EC_KEY *PEM_read_bio_ECPrivateKey(BIO *bp, EC_KEY **key, pem_password_cb *cb,
        return pkey_get_eckey(pktmp, key);
 }
 
-IMPLEMENT_PEM_rw(ECPKParameters, EC_GROUP, PEM_STRING_ECPARAMETERS, ECPKParameters)
+IMPLEMENT_PEM_rw_const(ECPKParameters, EC_GROUP, PEM_STRING_ECPARAMETERS, ECPKParameters)
 
 IMPLEMENT_PEM_write_cb(ECPrivateKey, EC_KEY, PEM_STRING_ECPRIVATEKEY, ECPrivateKey)
 
@@ -284,7 +284,7 @@ EC_KEY *PEM_read_ECPrivateKey(FILE *fp, EC_KEY **eckey, pem_password_cb *cb,
 
 #ifndef OPENSSL_NO_DH
 
-IMPLEMENT_PEM_rw(DHparams, DH, PEM_STRING_DHPARAMS, DHparams)
+IMPLEMENT_PEM_rw_const(DHparams, DH, PEM_STRING_DHPARAMS, DHparams)
 
 #endif
 
index 7eba3b2..b9e2ab5 100644 (file)
@@ -88,12 +88,13 @@ STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pe
        {
        X509_INFO *xi=NULL;
        char *name=NULL,*header=NULL,**pp;
-       unsigned char *data=NULL,*p;
+       unsigned char *data=NULL;
+       const unsigned char *p;
        long len,error=0;
        int ok=0;
        STACK_OF(X509_INFO) *ret=NULL;
        unsigned int i,raw;
-       char *(*d2i)();
+       char *(*d2i)(void *,const unsigned char **,long);
 
        if (sk == NULL)
                {
@@ -125,7 +126,7 @@ start:
                if (    (strcmp(name,PEM_STRING_X509) == 0) ||
                        (strcmp(name,PEM_STRING_X509_OLD) == 0))
                        {
-                       d2i=(char *(*)())d2i_X509;
+                       (D2I_OF(X509))d2i=d2i_X509;
                        if (xi->x509 != NULL)
                                {
                                if (!sk_X509_INFO_push(ret,xi)) goto err;
@@ -136,7 +137,7 @@ start:
                        }
                else if ((strcmp(name,PEM_STRING_X509_TRUSTED) == 0))
                        {
-                       d2i=(char *(*)())d2i_X509_AUX;
+                       (D2I_OF(X509))d2i=d2i_X509_AUX;
                        if (xi->x509 != NULL)
                                {
                                if (!sk_X509_INFO_push(ret,xi)) goto err;
@@ -147,7 +148,7 @@ start:
                        }
                else if (strcmp(name,PEM_STRING_X509_CRL) == 0)
                        {
-                       d2i=(char *(*)())d2i_X509_CRL;
+                       (D2I_OF(X509_CRL))d2i=d2i_X509_CRL;
                        if (xi->crl != NULL)
                                {
                                if (!sk_X509_INFO_push(ret,xi)) goto err;
@@ -160,7 +161,7 @@ start:
 #ifndef OPENSSL_NO_RSA
                        if (strcmp(name,PEM_STRING_RSA) == 0)
                        {
-                       d2i=(char *(*)())d2i_RSAPrivateKey;
+                       (D2I_OF(RSA))d2i=d2i_RSAPrivateKey;
                        if (xi->x_pkey != NULL) 
                                {
                                if (!sk_X509_INFO_push(ret,xi)) goto err;
@@ -184,7 +185,7 @@ start:
 #ifndef OPENSSL_NO_DSA
                        if (strcmp(name,PEM_STRING_DSA) == 0)
                        {
-                       d2i=(char *(*)())d2i_DSAPrivateKey;
+                       (D2I_OF(RSA))d2i=d2i_DSAPrivateKey;
                        if (xi->x_pkey != NULL) 
                                {
                                if (!sk_X509_INFO_push(ret,xi)) goto err;
@@ -208,7 +209,7 @@ start:
 #ifndef OPENSSL_NO_EC
                        if (strcmp(name,PEM_STRING_ECPRIVATEKEY) == 0)
                        {
-                               d2i=(char *(*)())d2i_ECPrivateKey;
+                               (D2I_OF(EC_KEY))d2i=d2i_ECPrivateKey;
                                if (xi->x_pkey != NULL) 
                                {
                                        if (!sk_X509_INFO_push(ret,xi)) goto err;
index ae0a87e..6e1bb4a 100644 (file)
@@ -158,11 +158,12 @@ void PEM_dek_info(char *buf, const char *type, int len, char *str)
        }
 
 #ifndef OPENSSL_NO_FP_API
-char *PEM_ASN1_read(char *(*d2i)(), const char *name, FILE *fp, char **x,
-            pem_password_cb *cb, void *u)
+void *PEM_ASN1_read(void *(*d2i)(void **,const unsigned char **,long),
+                   const char *name, FILE *fp,void **x,pem_password_cb *cb,
+                   void *u)
        {
         BIO *b;
-        char *ret;
+        void *ret;
 
         if ((b=BIO_new(BIO_s_file())) == NULL)
                {
@@ -260,9 +261,9 @@ err:
        }
 
 #ifndef OPENSSL_NO_FP_API
-int PEM_ASN1_write(int (*i2d)(), const char *name, FILE *fp, char *x,
-            const EVP_CIPHER *enc, unsigned char *kstr, int klen,
-            pem_password_cb *callback, void *u)
+int PEM_ASN1_write(int (*i2d)(void *,unsigned char **), const char *name, FILE *fp,
+                  char *x, const EVP_CIPHER *enc, unsigned char *kstr,
+                  int klen, pem_password_cb *callback, void *u)
         {
         BIO *b;
         int ret;
@@ -279,9 +280,9 @@ int PEM_ASN1_write(int (*i2d)(), const char *name, FILE *fp, char *x,
         }
 #endif
 
-int PEM_ASN1_write_bio(int (*i2d)(), const char *name, BIO *bp, char *x,
-            const EVP_CIPHER *enc, unsigned char *kstr, int klen,
-            pem_password_cb *callback, void *u)
+int PEM_ASN1_write_bio(int (*i2d)(void *,unsigned char **), const char *name, BIO *bp,
+                      char *x, const EVP_CIPHER *enc, unsigned char *kstr,
+                      int klen, pem_password_cb *callback, void *u)
        {
        EVP_CIPHER_CTX ctx;
        int dsize=0,i,j,ret=0;
index 8d9064e..a5e9204 100644 (file)
 
 /* Handle 'other' PEMs: not private keys */
 
-char *PEM_ASN1_read_bio(char *(*d2i)(), const char *name, BIO *bp, char **x,
-            pem_password_cb *cb, void *u)
+void *PEM_ASN1_read_bio(void *(*d2i)(void **,const unsigned char **,long),
+                       const char *name, BIO *bp, void **x,
+                       pem_password_cb *cb, void *u)
        {
-       unsigned char *p=NULL,*data=NULL;
+       const unsigned char *p=NULL;
+       unsigned char *data=NULL;
        long len;
        char *ret=NULL;
 
index 210ec1e..d4b98fd 100644 (file)
@@ -110,9 +110,6 @@ static void mime_hdr_free(MIME_HEADER *hdr);
 #define MAX_SMLEN 1024
 #define mime_debug(x) /* x */
 
-
-typedef void (*stkfree)();
-
 /* Base 64 read and write of PKCS#7 structure */
 
 static int B64_write_PKCS7(BIO *bio, PKCS7 *p7)
index 00a7873..4bfd51a 100644 (file)
@@ -247,11 +247,19 @@ int       RSA_print_fp(FILE *fp, const RSA *r,int offset);
 int    RSA_print(BIO *bp, const RSA *r,int offset);
 #endif
 
-int i2d_RSA_NET(const RSA *a, unsigned char **pp, int (*cb)(), int sgckey);
-RSA *d2i_RSA_NET(RSA **a, const unsigned char **pp, long length, int (*cb)(), int sgckey);
-
-int i2d_Netscape_RSA(const RSA *a, unsigned char **pp, int (*cb)());
-RSA *d2i_Netscape_RSA(RSA **a, const unsigned char **pp, long length, int (*cb)());
+int i2d_RSA_NET(const RSA *a, unsigned char **pp,
+               int (*cb)(char *buf, int len, const char *prompt, int verify),
+               int sgckey);
+RSA *d2i_RSA_NET(RSA **a, const unsigned char **pp, long length,
+                int (*cb)(char *buf, int len, const char *prompt, int verify),
+                int sgckey);
+
+int i2d_Netscape_RSA(const RSA *a, unsigned char **pp,
+                    int (*cb)(char *buf, int len, const char *prompt,
+                              int verify));
+RSA *d2i_Netscape_RSA(RSA **a, const unsigned char **pp, long length,
+                     int (*cb)(char *buf, int len, const char *prompt,
+                               int verify));
 
 /* The following 2 functions sign and verify a X509_SIG ASN1 object
  * inside PKCS#1 padded RSA encryption */
index 1455a7e..bbbf26d 100644 (file)
 #include <openssl/asn1t.h>
 
 static ASN1_METHOD method={
-        (int (*)())  i2d_RSAPrivateKey,
-        (char *(*)())d2i_RSAPrivateKey,
-        (char *(*)())RSA_new,
-        (void (*)()) RSA_free};
+        (I2D_OF(void))     i2d_RSAPrivateKey,
+        (D2I_OF(void))     d2i_RSAPrivateKey,
+        (void *(*)(void))  RSA_new,
+        (void (*)(void *)) RSA_free};
 
 ASN1_METHOD *RSAPrivateKey_asn1_meth(void)
        {
index 6d6739e..b50149d 100644 (file)
@@ -201,7 +201,7 @@ STACK_OF(type) \
 #define        SKM_ASN1_seq_pack(type, st, i2d_func, buf, len) \
        ASN1_seq_pack(st, i2d_func, buf, len)
 #define        SKM_ASN1_seq_unpack(type, buf, len, d2i_func, free_func) \
-       ASN1_seq_unpack(buf,len,(char *(*)())d2i_func, (void(*)(void *))free_func)
+       ASN1_seq_unpack(buf,len,(char *(*)(void *,unsigned char **,long))d2i_func, (void(*)(void *))free_func)
 
 #define SKM_PKCS12_decrypt_d2i(type, algor, d2i_func, free_func, pass, passlen, oct, seq) \
        ((STACK *)PKCS12_decrypt_d2i(algor,(char *(*)())d2i_func, (void(*)(void *))free_func,pass,passlen,oct,seq))
index 58b300b..b3a7a42 100644 (file)
@@ -92,7 +92,7 @@ TXT_DB *TXT_DB_read(BIO *in, int num)
                goto err;
        if ((ret->index=(LHASH **)OPENSSL_malloc(sizeof(LHASH *)*num)) == NULL)
                goto err;
-       if ((ret->qual=(int (**)())OPENSSL_malloc(sizeof(int (**)())*num)) == NULL)
+       if ((ret->qual=(int (**)(char **))OPENSSL_malloc(sizeof(int (**)(char **))*num)) == NULL)
                goto err;
        for (i=0; i<num; i++)
                {
@@ -210,11 +210,11 @@ char **TXT_DB_get_by_index(TXT_DB *db, int idx, char **value)
        return(ret);
        }
 
-int TXT_DB_create_index(TXT_DB *db, int field, int (*qual)(),
+int TXT_DB_create_index(TXT_DB *db, int field, int (*qual)(char **),
                LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp)
        {
        LHASH *idx;
-       char *r;
+       char **r;
        int i,n;
 
        if (field >= db->num_fields)
@@ -230,12 +230,12 @@ int TXT_DB_create_index(TXT_DB *db, int field, int (*qual)(),
        n=sk_num(db->data);
        for (i=0; i<n; i++)
                {
-               r=(char *)sk_value(db->data,i);
+               r=(char **)sk_value(db->data,i);
                if ((qual != NULL) && (qual(r) == 0)) continue;
                if ((r=lh_insert(idx,r)) != NULL)
                        {
                        db->error=DB_ERROR_INDEX_CLASH;
-                       db->arg1=sk_find(db->data,r);
+                       db->arg1=sk_find(db->data,(char *)r);
                        db->arg2=i;
                        lh_free(idx);
                        return(0);
index c98e287..307e1ba 100644 (file)
@@ -82,7 +82,7 @@ typedef struct txt_db_st
        int num_fields;
        STACK /* char ** */ *data;
        LHASH **index;
-       int (**qual)();
+       int (**qual)(char **);
        long error;
        long arg1;
        long arg2;
@@ -96,7 +96,7 @@ long TXT_DB_write(BIO *out, TXT_DB *db);
 TXT_DB *TXT_DB_read(char *in, int num);
 long TXT_DB_write(char *out, TXT_DB *db);
 #endif
-int TXT_DB_create_index(TXT_DB *db,int field,int (*qual)(),
+int TXT_DB_create_index(TXT_DB *db,int field,int (*qual)(char **),
                LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp);
 void TXT_DB_free(TXT_DB *db);
 char **TXT_DB_get_by_index(TXT_DB *db, int idx, char **value);
index 59da88e..0182964 100644 (file)
@@ -211,7 +211,7 @@ int UI_process(UI *ui);
 /* Give a user interface parametrised control commands.  This can be used to
    send down an integer, a data pointer or a function pointer, as well as
    be used to get information from a UI. */
-int UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f)());
+int UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f)(void));
 
 /* The commands */
 /* Use UI_CONTROL_PRINT_ERRORS with the value 1 to have UI_process print the
index dbc9711..2d0d989 100644 (file)
@@ -545,7 +545,7 @@ int UI_process(UI *ui)
        return ok;
        }
 
-int UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f)())
+int UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f)(void))
        {
        if (ui == NULL)
                {
index 4c7d914..2afbcfd 100644 (file)
@@ -136,8 +136,8 @@ extern "C" {
 typedef struct X509_objects_st
        {
        int nid;
-       int (*a2i)();
-       int (*i2a)();
+       int (*a2i)(void);
+       int (*i2a)(void);
        } X509_OBJECTS;
 
 struct X509_algor_st
@@ -966,15 +966,16 @@ X509_INFO *       X509_INFO_new(void);
 void           X509_INFO_free(X509_INFO *a);
 char *         X509_NAME_oneline(X509_NAME *a,char *buf,int size);
 
-int ASN1_verify(int (*i2d)(), X509_ALGOR *algor1,
+int ASN1_verify(int (*i2d)(void *, unsigned char **), X509_ALGOR *algor1,
        ASN1_BIT_STRING *signature,char *data,EVP_PKEY *pkey);
 
-int ASN1_digest(int (*i2d)(),const EVP_MD *type,char *data,
-       unsigned char *md,unsigned int *len);
+int ASN1_digest(int (*i2d)(void *, unsigned char **),
+               const EVP_MD *type,char *data,
+               unsigned char *md,unsigned int *len);
 
-int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2,
-       ASN1_BIT_STRING *signature,
-       char *data,EVP_PKEY *pkey, const EVP_MD *type);
+int ASN1_sign(int (*i2d)(void *, unsigned char **), X509_ALGOR *algor1,
+             X509_ALGOR *algor2, ASN1_BIT_STRING *signature,
+             char *data,EVP_PKEY *pkey, const EVP_MD *type);
 
 int ASN1_item_digest(const ASN1_ITEM *it,const EVP_MD *type,void *data,
        unsigned char *md,unsigned int *len);
index ffc07cc..431a620 100644 (file)
@@ -102,7 +102,7 @@ int X509_verify_cert(X509_STORE_CTX *ctx)
        X509_VERIFY_PARAM *param = ctx->param;
        int depth,i,ok=0;
        int num;
-       int (*cb)();
+       int (*cb)(int ok,X509_STORE_CTX *ctx);
        STACK_OF(X509) *sktmp=NULL;
        if (ctx->cert == NULL)
                {
@@ -388,7 +388,7 @@ static int check_chain_extensions(X509_STORE_CTX *ctx)
 #else
        int i, ok=0, must_be_ca;
        X509 *x;
-       int (*cb)();
+       int (*cb)(int ok,X509_STORE_CTX *ctx);
        int proxy_path_length = 0;
        cb=ctx->verify_cb;
 
@@ -515,7 +515,7 @@ static int check_trust(X509_STORE_CTX *ctx)
 #else
        int i, ok;
        X509 *x;
-       int (*cb)();
+       int (*cb)(int ok,X509_STORE_CTX *ctx);
        cb=ctx->verify_cb;
 /* For now just check the last certificate in the chain */
        i = sk_X509_num(ctx->chain) - 1;
@@ -925,7 +925,7 @@ static int internal_verify(X509_STORE_CTX *ctx)
        int ok=0,n;
        X509 *xs,*xi;
        EVP_PKEY *pkey=NULL;
-       int (*cb)();
+       int (*cb)(int ok,X509_STORE_CTX *ctx);
 
        cb=ctx->verify_cb;
 
index 4701959..84ec5d5 100644 (file)
@@ -225,9 +225,9 @@ RSA *d2i_RSAPublicKey_fp(FILE *fp, RSA **rsa)
 
 RSA *d2i_RSA_PUBKEY_fp(FILE *fp, RSA **rsa)
        {
-       return((RSA *)ASN1_d2i_fp((char *(*)())
-               RSA_new,(char *(*)())d2i_RSA_PUBKEY, (fp),
-               (unsigned char **)(rsa)));
+       return ASN1_d2i_fp((void *(*)(void))
+                          RSA_new,(D2I_OF(void))d2i_RSA_PUBKEY, fp,
+                          (void **)rsa);
        }
 
 int i2d_RSAPublicKey_fp(FILE *fp, RSA *rsa)
@@ -237,7 +237,7 @@ int i2d_RSAPublicKey_fp(FILE *fp, RSA *rsa)
 
 int i2d_RSA_PUBKEY_fp(FILE *fp, RSA *rsa)
        {
-       return(ASN1_i2d_fp(i2d_RSA_PUBKEY,fp,(unsigned char *)rsa));
+       return ASN1_i2d_fp((I2D_OF(void))i2d_RSA_PUBKEY,fp,rsa);
        }
 #endif
 
@@ -259,9 +259,7 @@ RSA *d2i_RSAPublicKey_bio(BIO *bp, RSA **rsa)
 
 RSA *d2i_RSA_PUBKEY_bio(BIO *bp, RSA **rsa)
        {
-       return((RSA *)ASN1_d2i_bio((char *(*)())
-               RSA_new,(char *(*)())d2i_RSA_PUBKEY, (bp),
-               (unsigned char **)(rsa)));
+       return ASN1_d2i_bio_of(RSA,RSA_new,d2i_RSA_PUBKEY,bp,rsa);
        }
 
 int i2d_RSAPublicKey_bio(BIO *bp, RSA *rsa)
@@ -271,7 +269,7 @@ int i2d_RSAPublicKey_bio(BIO *bp, RSA *rsa)
 
 int i2d_RSA_PUBKEY_bio(BIO *bp, RSA *rsa)
        {
-       return(ASN1_i2d_bio(i2d_RSA_PUBKEY,bp,(unsigned char *)rsa));
+       return ASN1_i2d_bio_of(RSA,i2d_RSA_PUBKEY,bp,rsa);
        }
 #endif
 
@@ -279,51 +277,44 @@ int i2d_RSA_PUBKEY_bio(BIO *bp, RSA *rsa)
 #ifndef OPENSSL_NO_FP_API
 DSA *d2i_DSAPrivateKey_fp(FILE *fp, DSA **dsa)
        {
-       return((DSA *)ASN1_d2i_fp((char *(*)())
-               DSA_new,(char *(*)())d2i_DSAPrivateKey, (fp),
-               (unsigned char **)(dsa)));
+       return ASN1_d2i_fp_of(DSA,DSA_new,d2i_DSAPrivateKey,fp,dsa);
        }
 
 int i2d_DSAPrivateKey_fp(FILE *fp, DSA *dsa)
        {
-       return(ASN1_i2d_fp(i2d_DSAPrivateKey,fp,(unsigned char *)dsa));
+       return ASN1_i2d_fp_of_const(DSA,i2d_DSAPrivateKey,fp,dsa);
        }
 
 DSA *d2i_DSA_PUBKEY_fp(FILE *fp, DSA **dsa)
        {
-       return((DSA *)ASN1_d2i_fp((char *(*)())
-               DSA_new,(char *(*)())d2i_DSA_PUBKEY, (fp),
-               (unsigned char **)(dsa)));
+       return ASN1_d2i_fp_of(DSA,DSA_new,d2i_DSA_PUBKEY,fp,dsa);
        }
 
 int i2d_DSA_PUBKEY_fp(FILE *fp, DSA *dsa)
        {
-       return(ASN1_i2d_fp(i2d_DSA_PUBKEY,fp,(unsigned char *)dsa));
+       return ASN1_i2d_fp_of(DSA,i2d_DSA_PUBKEY,fp,dsa);
        }
 #endif
 
 DSA *d2i_DSAPrivateKey_bio(BIO *bp, DSA **dsa)
        {
-       return((DSA *)ASN1_d2i_bio((char *(*)())
-               DSA_new,(char *(*)())d2i_DSAPrivateKey, (bp),
-               (unsigned char **)(dsa)));
+       return ASN1_d2i_bio_of(DSA,DSA_new,d2i_DSAPrivateKey,bp,dsa
+);
        }
 
 int i2d_DSAPrivateKey_bio(BIO *bp, DSA *dsa)
        {
-       return(ASN1_i2d_bio(i2d_DSAPrivateKey,bp,(unsigned char *)dsa));
+       return ASN1_i2d_bio_of_const(DSA,i2d_DSAPrivateKey,bp,dsa);
        }
 
 DSA *d2i_DSA_PUBKEY_bio(BIO *bp, DSA **dsa)
        {
-       return((DSA *)ASN1_d2i_bio((char *(*)())
-               DSA_new,(char *(*)())d2i_DSA_PUBKEY, (bp),
-               (unsigned char **)(dsa)));
+       return ASN1_d2i_bio_of(DSA,DSA_new,d2i_DSA_PUBKEY,bp,dsa);
        }
 
 int i2d_DSA_PUBKEY_bio(BIO *bp, DSA *dsa)
        {
-       return(ASN1_i2d_bio(i2d_DSA_PUBKEY,bp,(unsigned char *)dsa));
+       return ASN1_i2d_bio_of(DSA,i2d_DSA_PUBKEY,bp,dsa);
        }
 
 #endif
@@ -332,50 +323,42 @@ int i2d_DSA_PUBKEY_bio(BIO *bp, DSA *dsa)
 #ifndef OPENSSL_NO_FP_API
 EC_KEY *d2i_EC_PUBKEY_fp(FILE *fp, EC_KEY **eckey)
        {
-       return((EC_KEY *)ASN1_d2i_fp((char *(*)())
-               EC_KEY_new,(char *(*)())d2i_EC_PUBKEY, (fp),
-               (unsigned char **)(eckey)));
+       return ASN1_d2i_fp_of(EC_KEY,EC_KEY_new,d2i_EC_PUBKEY,fp,eckey);
        }
   
 int i2d_EC_PUBKEY_fp(FILE *fp, EC_KEY *eckey)
        {
-       return(ASN1_i2d_fp(i2d_EC_PUBKEY,fp,(unsigned char *)eckey));
+       return ASN1_i2d_fp_of(EC_KEY,i2d_EC_PUBKEY,fp,eckey);
        }
 
 EC_KEY *d2i_ECPrivateKey_fp(FILE *fp, EC_KEY **eckey)
        {
-       return((EC_KEY *)ASN1_d2i_fp((char *(*)())
-               EC_KEY_new,(char *(*)())d2i_ECPrivateKey, (fp),
-               (unsigned char **)(eckey)));
+       return ASN1_d2i_fp_of(EC_KEY,EC_KEY_new,d2i_ECPrivateKey,fp,eckey);
        }
   
 int i2d_ECPrivateKey_fp(FILE *fp, EC_KEY *eckey)
        {
-       return(ASN1_i2d_fp(i2d_ECPrivateKey,fp,(unsigned char *)eckey));
+       return ASN1_i2d_fp_of(EC_KEY,i2d_ECPrivateKey,fp,eckey);
        }
 #endif
 EC_KEY *d2i_EC_PUBKEY_bio(BIO *bp, EC_KEY **eckey)
        {
-       return((EC_KEY *)ASN1_d2i_bio((char *(*)())
-               EC_KEY_new,(char *(*)())d2i_EC_PUBKEY, (bp),
-               (unsigned char **)(eckey)));
+       return ASN1_d2i_bio_of(EC_KEY,EC_KEY_new,d2i_EC_PUBKEY,bp,eckey);
        }
   
 int i2d_EC_PUBKEY_bio(BIO *bp, EC_KEY *ecdsa)
        {
-       return(ASN1_i2d_bio(i2d_EC_PUBKEY,bp,(unsigned char *)ecdsa));
+       return ASN1_i2d_bio_of(EC_KEY,i2d_EC_PUBKEY,bp,ecdsa);
        }
 
 EC_KEY *d2i_ECPrivateKey_bio(BIO *bp, EC_KEY **eckey)
        {
-       return((EC_KEY *)ASN1_d2i_bio((char *(*)())
-               EC_KEY_new,(char *(*)())d2i_ECPrivateKey, (bp),
-               (unsigned char **)(eckey)));
+       return ASN1_d2i_bio_of(EC_KEY,EC_KEY_new,d2i_ECPrivateKey,bp,eckey);
        }
   
 int i2d_ECPrivateKey_bio(BIO *bp, EC_KEY *eckey)
        {
-       return(ASN1_i2d_bio(i2d_ECPrivateKey,bp,(unsigned char *)eckey));
+       return ASN1_i2d_bio_of(EC_KEY,i2d_ECPrivateKey,bp,eckey);
        }
 #endif
 
@@ -424,40 +407,37 @@ int PKCS7_ISSUER_AND_SERIAL_digest(PKCS7_ISSUER_AND_SERIAL *data, const EVP_MD *
 #ifndef OPENSSL_NO_FP_API
 X509_SIG *d2i_PKCS8_fp(FILE *fp, X509_SIG **p8)
        {
-       return((X509_SIG *)ASN1_d2i_fp((char *(*)())X509_SIG_new,
-               (char *(*)())d2i_X509_SIG, (fp),(unsigned char **)(p8)));
+       return ASN1_d2i_fp_of(X509_SIG,X509_SIG_new,d2i_X509_SIG,fp,p8);
        }
 
 int i2d_PKCS8_fp(FILE *fp, X509_SIG *p8)
        {
-       return(ASN1_i2d_fp(i2d_X509_SIG,fp,(unsigned char *)p8));
+       return ASN1_i2d_fp_of(X509_SIG,i2d_X509_SIG,fp,p8);
        }
 #endif
 
 X509_SIG *d2i_PKCS8_bio(BIO *bp, X509_SIG **p8)
        {
-       return((X509_SIG *)ASN1_d2i_bio((char *(*)())X509_SIG_new,
-               (char *(*)())d2i_X509_SIG, (bp),(unsigned char **)(p8)));
+       return ASN1_d2i_bio_of(X509_SIG,X509_SIG_new,d2i_X509_SIG,bp,p8);
        }
 
 int i2d_PKCS8_bio(BIO *bp, X509_SIG *p8)
        {
-       return(ASN1_i2d_bio(i2d_X509_SIG,bp,(unsigned char *)p8));
+       return ASN1_i2d_bio_of(X509_SIG,i2d_X509_SIG,bp,p8);
        }
 
 #ifndef OPENSSL_NO_FP_API
 PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_fp(FILE *fp,
                                                 PKCS8_PRIV_KEY_INFO **p8inf)
        {
-       return((PKCS8_PRIV_KEY_INFO *)ASN1_d2i_fp(
-               (char *(*)())PKCS8_PRIV_KEY_INFO_new,
-               (char *(*)())d2i_PKCS8_PRIV_KEY_INFO, (fp),
-                               (unsigned char **)(p8inf)));
+       return ASN1_d2i_fp_of(PKCS8_PRIV_KEY_INFO,PKCS8_PRIV_KEY_INFO_new,
+                             d2i_PKCS8_PRIV_KEY_INFO,fp,p8inf);
        }
 
 int i2d_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, PKCS8_PRIV_KEY_INFO *p8inf)
        {
-       return(ASN1_i2d_fp(i2d_PKCS8_PRIV_KEY_INFO,fp,(unsigned char *)p8inf));
+       return ASN1_i2d_fp_of(PKCS8_PRIV_KEY_INFO,i2d_PKCS8_PRIV_KEY_INFO,fp,
+                             p8inf);
        }
 
 int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, EVP_PKEY *key)
@@ -473,24 +453,22 @@ int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, EVP_PKEY *key)
 
 int i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *pkey)
        {
-       return(ASN1_i2d_fp(i2d_PrivateKey,fp,(unsigned char *)pkey));
+       return ASN1_i2d_fp_of(EVP_PKEY,i2d_PrivateKey,fp,pkey);
        }
 
 EVP_PKEY *d2i_PrivateKey_fp(FILE *fp, EVP_PKEY **a)
 {
-       return((EVP_PKEY *)ASN1_d2i_fp((char *(*)())EVP_PKEY_new,
-               (char *(*)())d2i_AutoPrivateKey, (fp),(unsigned char **)(a)));
+       return ASN1_d2i_fp_of(EVP_PKEY,EVP_PKEY_new,d2i_AutoPrivateKey,fp,a);
 }
 
 int i2d_PUBKEY_fp(FILE *fp, EVP_PKEY *pkey)
        {
-       return(ASN1_i2d_fp(i2d_PUBKEY,fp,(unsigned char *)pkey));
+       return ASN1_i2d_fp_of(EVP_PKEY,i2d_PUBKEY,fp,pkey);
        }
 
 EVP_PKEY *d2i_PUBKEY_fp(FILE *fp, EVP_PKEY **a)
 {
-       return((EVP_PKEY *)ASN1_d2i_fp((char *(*)())EVP_PKEY_new,
-               (char *(*)())d2i_PUBKEY, (fp),(unsigned char **)(a)));
+       return ASN1_d2i_fp_of(EVP_PKEY,EVP_PKEY_new,d2i_PUBKEY,fp,a);
 }
 
 #endif
@@ -498,15 +476,14 @@ EVP_PKEY *d2i_PUBKEY_fp(FILE *fp, EVP_PKEY **a)
 PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp,
                                                 PKCS8_PRIV_KEY_INFO **p8inf)
        {
-       return((PKCS8_PRIV_KEY_INFO *)ASN1_d2i_bio(
-               (char *(*)())PKCS8_PRIV_KEY_INFO_new,
-               (char *(*)())d2i_PKCS8_PRIV_KEY_INFO, (bp),
-                               (unsigned char **)(p8inf)));
+       return ASN1_d2i_bio_of(PKCS8_PRIV_KEY_INFO,PKCS8_PRIV_KEY_INFO_new,
+                           d2i_PKCS8_PRIV_KEY_INFO,bp,p8inf);
        }
 
 int i2d_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, PKCS8_PRIV_KEY_INFO *p8inf)
        {
-       return(ASN1_i2d_bio(i2d_PKCS8_PRIV_KEY_INFO,bp,(unsigned char *)p8inf));
+       return ASN1_i2d_bio_of(PKCS8_PRIV_KEY_INFO,i2d_PKCS8_PRIV_KEY_INFO,bp,
+                              p8inf);
        }
 
 int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, EVP_PKEY *key)
@@ -522,22 +499,20 @@ int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, EVP_PKEY *key)
 
 int i2d_PrivateKey_bio(BIO *bp, EVP_PKEY *pkey)
        {
-       return(ASN1_i2d_bio(i2d_PrivateKey,bp,(unsigned char *)pkey));
+       return ASN1_i2d_bio_of(EVP_PKEY,i2d_PrivateKey,bp,pkey);
        }
 
 EVP_PKEY *d2i_PrivateKey_bio(BIO *bp, EVP_PKEY **a)
        {
-       return((EVP_PKEY *)ASN1_d2i_bio((char *(*)())EVP_PKEY_new,
-               (char *(*)())d2i_AutoPrivateKey, (bp),(unsigned char **)(a)));
+       return ASN1_d2i_bio_of(EVP_PKEY,EVP_PKEY_new,d2i_AutoPrivateKey,bp,a);
        }
 
 int i2d_PUBKEY_bio(BIO *bp, EVP_PKEY *pkey)
        {
-       return(ASN1_i2d_bio(i2d_PUBKEY,bp,(unsigned char *)pkey));
+       return ASN1_i2d_bio_of(EVP_PKEY,i2d_PUBKEY,bp,pkey);
        }
 
 EVP_PKEY *d2i_PUBKEY_bio(BIO *bp, EVP_PKEY **a)
        {
-       return((EVP_PKEY *)ASN1_d2i_bio((char *(*)())EVP_PKEY_new,
-               (char *(*)())d2i_PUBKEY, (bp),(unsigned char **)(a)));
+       return ASN1_d2i_bio_of(EVP_PKEY,EVP_PKEY_new,d2i_PUBKEY,bp,a);
        }
index 2b2792d..5e9754f 100644 (file)
@@ -171,8 +171,8 @@ typedef AEP_RV t_AEP_GenRandom(AEP_CONNECTION_HNDL hConnection,
 #endif
 
 typedef AEP_RV t_AEP_Initialize(AEP_VOID_PTR pInitArgs);
-typedef AEP_RV t_AEP_Finalize();
-typedef AEP_RV t_AEP_SetBNCallBacks(AEP_RV (*GetBigNumSizeFunc)(),
-                                   AEP_RV (*MakeAEPBigNumFunc)(),
-                                   AEP_RV (*ConverAEPBigNumFunc)());
+typedef AEP_RV t_AEP_Finalize(void);
+typedef AEP_RV t_AEP_SetBNCallBacks(AEP_RV (*GetBigNumSizeFunc)(AEP_VOID_PTR ArbBigNum, AEP_U32* BigNumSize),
+                                   AEP_RV (*MakeAEPBigNumFunc)(AEP_VOID_PTR ArbBigNum, AEP_U32 BigNumSize, unsigned char* AEP_BigNum),
+                                   AEP_RV (*ConverAEPBigNumFunc)(void* ArbBigNum, AEP_U32 BigNumSize, unsigned char* AEP_BigNum));
 
index 4bc2202..e46b000 100644 (file)
@@ -47,7 +47,7 @@ extern SW_EXPORT SureWareHook_Init_t SureWareHook_Init;
 /*
 *      SureWare Finish function
 */
-typedef void SureWareHook_Finish_t();
+typedef void SureWareHook_Finish_t(void);
 extern SW_EXPORT SureWareHook_Finish_t SureWareHook_Finish;
 /*
 *       PRE_CONDITION:
index d683ee4..1db216b 100644 (file)
@@ -465,9 +465,9 @@ static long ssl_ctrl(BIO *b, int cmd, long num, void *ptr)
                break;
        case BIO_CTRL_GET_CALLBACK:
                {
-               void (**fptr)();
+               void (**fptr)(const SSL *ssl,int type,int val);
 
-               fptr=(void (**)())ptr;
+               fptr=(void (**)(const SSL *ssl,int type,int val))ptr;
                *fptr=SSL_get_info_callback(ssl);
                }
                break;
index 8d7dbcf..bcfda91 100644 (file)
@@ -93,7 +93,7 @@ static SSL_METHOD SSLv23_data= {
        ssl_bad_method,
        ssl23_default_timeout,
        &ssl3_undef_enc_method,
-       ssl_undefined_function,
+       ssl_undefined_void_function,
        ssl3_callback_ctrl,
        ssl3_ctx_callback_ctrl,
        };
index b89b83f..6f7d11f 100644 (file)
@@ -234,7 +234,7 @@ static SSL_METHOD SSLv2_data= {
        ssl_bad_method,
        ssl2_default_timeout,
        &ssl3_undef_enc_method,
-       ssl_undefined_function,
+       ssl_undefined_void_function,
        ssl2_callback_ctrl,     /* local */
        ssl2_ctx_callback_ctrl, /* local */
        };
@@ -348,7 +348,7 @@ long ssl2_ctrl(SSL *s, int cmd, long larg, void *parg)
        return(ret);
        }
 
-long ssl2_callback_ctrl(SSL *s, int cmd, void (*fp)())
+long ssl2_callback_ctrl(SSL *s, int cmd, void (*fp)(void))
        {
        return(0);
        }
@@ -358,7 +358,7 @@ long ssl2_ctx_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg)
        return(0);
        }
 
-long ssl2_ctx_callback_ctrl(SSL_CTX *ctx, int cmd, void (*fp)())
+long ssl2_ctx_callback_ctrl(SSL_CTX *ctx, int cmd, void (*fp)(void))
        {
        return(0);
        }
index bbca61f..345f74b 100644 (file)
@@ -1391,7 +1391,7 @@ static SSL_METHOD SSLv3_data= {
        ssl_bad_method,
        ssl3_default_timeout,
        &SSLv3_enc_data,
-       ssl_undefined_function,
+       ssl_undefined_void_function,
        ssl3_callback_ctrl,
        ssl3_ctx_callback_ctrl,
        };
@@ -1680,7 +1680,7 @@ long ssl3_ctrl(SSL *s, int cmd, long larg, void *parg)
        return(ret);
        }
 
-long ssl3_callback_ctrl(SSL *s, int cmd, void (*fp)())
+long ssl3_callback_ctrl(SSL *s, int cmd, void (*fp)(void))
        {
        int ret=0;
 
@@ -1874,7 +1874,7 @@ long ssl3_ctx_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg)
        return(1);
        }
 
-long ssl3_ctx_callback_ctrl(SSL_CTX *ctx, int cmd, void (*fp)())
+long ssl3_ctx_callback_ctrl(SSL_CTX *ctx, int cmd, void (*fp)(void))
        {
        CERT *cert;
 
index 185d4b7..df9acf9 100644 (file)
--- a/ssl/ssl.h
+++ b/ssl/ssl.h
@@ -386,9 +386,9 @@ typedef struct ssl_method_st
        struct ssl_method_st *(*get_ssl_method)(int version);
        long (*get_timeout)(void);
        struct ssl3_enc_method *ssl3_enc; /* Extra SSLv3/TLS stuff */
-       int (*ssl_version)();
-       long (*ssl_callback_ctrl)(SSL *s, int cb_id, void (*fp)());
-       long (*ssl_ctx_callback_ctrl)(SSL_CTX *s, int cb_id, void (*fp)());
+       int (*ssl_version)(void);
+       long (*ssl_callback_ctrl)(SSL *s, int cb_id, void (*fp)(void));
+       long (*ssl_ctx_callback_ctrl)(SSL_CTX *s, int cb_id, void (*fp)(void));
        } SSL_METHOD;
 
 /* Lets make this into an ASN.1 type structure as follows
@@ -819,7 +819,7 @@ struct ssl_st
 
        /* true when we are actually in SSL_accept() or SSL_connect() */
        int in_handshake;
-       int (*handshake_func)();
+       int (*handshake_func)(SSL *);
 
        /* Imagine that here's a boolean member "init" that is
         * switched as soon as SSL_set_{accept/connect}_state
@@ -1050,21 +1050,16 @@ size_t SSL_get_peer_finished(const SSL *s, void *buf, size_t count);
 #define SSL_set_timeout(a,b)   SSL_SESSION_set_timeout((a),(b))
 
 #if 1 /*SSLEAY_MACROS*/
-#define d2i_SSL_SESSION_bio(bp,s_id) (SSL_SESSION *)ASN1_d2i_bio( \
-       (char *(*)())SSL_SESSION_new,(char *(*)())d2i_SSL_SESSION, \
-       (bp),(unsigned char **)(s_id))
-#define i2d_SSL_SESSION_bio(bp,s_id) ASN1_i2d_bio(i2d_SSL_SESSION, \
-       bp,(unsigned char *)s_id)
+#define d2i_SSL_SESSION_bio(bp,s_id) ASN1_d2i_bio_of(SSL_SESSION,SSL_SESSION_new,d2i_SSL_SESSION,bp,s_id)
+#define i2d_SSL_SESSION_bio(bp,s_id) ASN1_i2d_bio_of(SSL_SESSION,i2d_SSL_SESSION,bp,s_id)
 #define PEM_read_SSL_SESSION(fp,x,cb,u) (SSL_SESSION *)PEM_ASN1_read( \
        (char *(*)())d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,fp,(char **)x,cb,u)
-#define PEM_read_bio_SSL_SESSION(bp,x,cb,u) (SSL_SESSION *)PEM_ASN1_read_bio( \
-       (char *(*)())d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,bp,(char **)x,cb,u)
+#define PEM_read_bio_SSL_SESSION(bp,x,cb,u) PEM_ASN1_read_bio_of(SSL_SESSION,d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,bp,x,cb,u)
 #define PEM_write_SSL_SESSION(fp,x) \
        PEM_ASN1_write((int (*)())i2d_SSL_SESSION, \
                PEM_STRING_SSL_SESSION,fp, (char *)x, NULL,NULL,0,NULL,NULL)
 #define PEM_write_bio_SSL_SESSION(bp,x) \
-       PEM_ASN1_write_bio((int (*)())i2d_SSL_SESSION, \
-               PEM_STRING_SSL_SESSION,bp, (char *)x, NULL,NULL,0,NULL,NULL)
+       PEM_ASN1_write_bio_of(SSL_SESSION,i2d_SSL_SESSION,PEM_STRING_SSL_SESSION,bp,x,NULL,NULL,0,NULL,NULL)
 #endif
 
 #define SSL_AD_REASON_OFFSET           1000
@@ -1290,7 +1285,7 @@ int       SSL_CTX_set_generate_session_id(SSL_CTX *, GEN_SESSION_CB);
 int    SSL_set_generate_session_id(SSL *, GEN_SESSION_CB);
 int    SSL_has_matching_session_id(const SSL *ssl, const unsigned char *id,
                                        unsigned int id_len);
-SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a,const unsigned char * const *pp,
+SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a,const unsigned char **pp,
                             long length);
 
 #ifdef HEADER_X509_H
@@ -1341,9 +1336,9 @@ int       SSL_read(SSL *ssl,void *buf,int num);
 int    SSL_peek(SSL *ssl,void *buf,int num);
 int    SSL_write(SSL *ssl,const void *buf,int num);
 long   SSL_ctrl(SSL *ssl,int cmd, long larg, void *parg);
-long   SSL_callback_ctrl(SSL *, int, void (*)());
+long   SSL_callback_ctrl(SSL *, int, void (*)(void));
 long   SSL_CTX_ctrl(SSL_CTX *ctx,int cmd, long larg, void *parg);
-long   SSL_CTX_callback_ctrl(SSL_CTX *, int, void (*)());
+long   SSL_CTX_callback_ctrl(SSL_CTX *, int, void (*)(void));
 
 int    SSL_get_error(const SSL *s,int ret_code);
 const char *SSL_get_version(const SSL *s);
@@ -1645,6 +1640,7 @@ void ERR_load_SSL_strings(void);
 #define SSL_F_SSL_SHUTDOWN                              224
 #define SSL_F_SSL_UNDEFINED_CONST_FUNCTION              243
 #define SSL_F_SSL_UNDEFINED_FUNCTION                    197
+#define SSL_F_SSL_UNDEFINED_VOID_FUNCTION               244
 #define SSL_F_SSL_USE_CERTIFICATE                       198
 #define SSL_F_SSL_USE_CERTIFICATE_ASN1                  199
 #define SSL_F_SSL_USE_CERTIFICATE_FILE                  200
index 9667d0b..c2fa410 100644 (file)
@@ -226,7 +226,7 @@ int i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp)
        M_ASN1_I2D_finish();
        }
 
-SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char * const *pp,
+SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp,
             long length)
        {
        int version,ssl_version=0,i;
@@ -242,18 +242,18 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char * const *pp,
        M_ASN1_D2I_start_sequence();
 
        ai.data=NULL; ai.length=0;
-       M_ASN1_D2I_get(aip,d2i_ASN1_INTEGER);
+       M_ASN1_D2I_get(ASN1_INTEGER,aip,d2i_ASN1_INTEGER);
        version=(int)ASN1_INTEGER_get(aip);
        if (ai.data != NULL) { OPENSSL_free(ai.data); ai.data=NULL; ai.length=0; }
 
        /* we don't care about the version right now :-) */
-       M_ASN1_D2I_get(aip,d2i_ASN1_INTEGER);
+       M_ASN1_D2I_get(ASN1_INTEGER,aip,d2i_ASN1_INTEGER);
        ssl_version=(int)ASN1_INTEGER_get(aip);
        ret->ssl_version=ssl_version;
        if (ai.data != NULL) { OPENSSL_free(ai.data); ai.data=NULL; ai.length=0; }
 
        os.data=NULL; os.length=0;
-       M_ASN1_D2I_get(osp,d2i_ASN1_OCTET_STRING);
+       M_ASN1_D2I_get(ASN1_OCTET_STRING,osp,d2i_ASN1_OCTET_STRING);
        if (ssl_version == SSL2_VERSION)
                {
                if (os.length != 3)
@@ -286,7 +286,7 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char * const *pp,
        ret->cipher=NULL;
        ret->cipher_id=id;
 
-       M_ASN1_D2I_get(osp,d2i_ASN1_OCTET_STRING);
+       M_ASN1_D2I_get(ASN1_OCTET_STRING,osp,d2i_ASN1_OCTET_STRING);
        if ((ssl_version>>8) == SSL3_VERSION)
                i=SSL3_MAX_SSL_SESSION_ID_LENGTH;
        else /* if (ssl_version == SSL2_VERSION) */
@@ -301,7 +301,7 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char * const *pp,
        OPENSSL_assert(os.length <= (int)sizeof(ret->session_id));
        memcpy(ret->session_id,os.data,os.length);
 
-       M_ASN1_D2I_get(osp,d2i_ASN1_OCTET_STRING);
+       M_ASN1_D2I_get(ASN1_OCTET_STRING,osp,d2i_ASN1_OCTET_STRING);
        if (ret->master_key_length > SSL_MAX_MASTER_KEY_LENGTH)
                ret->master_key_length=SSL_MAX_MASTER_KEY_LENGTH;
        else
index 2472b4d..66bc5c2 100644 (file)
@@ -1,6 +1,6 @@
 /* ssl/ssl_err.c */
 /* ====================================================================
- * Copyright (c) 1999-2003 The OpenSSL Project.  All rights reserved.
+ * Copyright (c) 1999-2005 The OpenSSL Project.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -195,6 +195,7 @@ static ERR_STRING_DATA SSL_str_functs[]=
 {ERR_PACK(0,SSL_F_SSL_SHUTDOWN,0),     "SSL_shutdown"},
 {ERR_PACK(0,SSL_F_SSL_UNDEFINED_CONST_FUNCTION,0),     "SSL_UNDEFINED_CONST_FUNCTION"},
 {ERR_PACK(0,SSL_F_SSL_UNDEFINED_FUNCTION,0),   "SSL_UNDEFINED_FUNCTION"},
+{ERR_PACK(0,SSL_F_SSL_UNDEFINED_VOID_FUNCTION,0),      "SSL_UNDEFINED_VOID_FUNCTION"},
 {ERR_PACK(0,SSL_F_SSL_USE_CERTIFICATE,0),      "SSL_use_certificate"},
 {ERR_PACK(0,SSL_F_SSL_USE_CERTIFICATE_ASN1,0), "SSL_use_certificate_ASN1"},
 {ERR_PACK(0,SSL_F_SSL_USE_CERTIFICATE_FILE,0), "SSL_use_certificate_file"},
index 2351279..71d4f64 100644 (file)
@@ -962,7 +962,7 @@ long SSL_ctrl(SSL *s,int cmd,long larg,void *parg)
                }
        }
 
-long SSL_callback_ctrl(SSL *s, int cmd, void (*fp)())
+long SSL_callback_ctrl(SSL *s, int cmd, void (*fp)(void))
        {
        switch(cmd)
                {
@@ -1050,7 +1050,7 @@ long SSL_CTX_ctrl(SSL_CTX *ctx,int cmd,long larg,void *parg)
                }
        }
 
-long SSL_CTX_callback_ctrl(SSL_CTX *ctx, int cmd, void (*fp)())
+long SSL_CTX_callback_ctrl(SSL_CTX *ctx, int cmd, void (*fp)(void))
        {
        switch(cmd)
                {
@@ -2029,6 +2029,12 @@ int ssl_undefined_function(SSL *s)
        return(0);
        }
 
+int ssl_undefined_void_function(void)
+       {
+       SSLerr(SSL_F_SSL_UNDEFINED_VOID_FUNCTION,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
+       return(0);
+       }
+
 int ssl_undefined_const_function(const SSL *s)
        {
        SSLerr(SSL_F_SSL_UNDEFINED_CONST_FUNCTION,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
@@ -2446,14 +2452,14 @@ void SSL_CTX_set_tmp_rsa_callback(SSL_CTX *ctx,RSA *(*cb)(SSL *ssl,
                                                          int is_export,
                                                          int keylength))
     {
-    SSL_CTX_callback_ctrl(ctx,SSL_CTRL_SET_TMP_RSA_CB,(void (*)())cb);
+    SSL_CTX_callback_ctrl(ctx,SSL_CTRL_SET_TMP_RSA_CB,(void (*)(void))cb);
     }
 
 void SSL_set_tmp_rsa_callback(SSL *ssl,RSA *(*cb)(SSL *ssl,
                                                  int is_export,
                                                  int keylength))
     {
-    SSL_callback_ctrl(ssl,SSL_CTRL_SET_TMP_RSA_CB,(void (*)())cb);
+    SSL_callback_ctrl(ssl,SSL_CTRL_SET_TMP_RSA_CB,(void (*)(void))cb);
     }
 #endif
 
@@ -2482,13 +2488,13 @@ RSA *cb(SSL *ssl,int is_export,int keylength)
 void SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx,DH *(*dh)(SSL *ssl,int is_export,
                                                        int keylength))
        {
-       SSL_CTX_callback_ctrl(ctx,SSL_CTRL_SET_TMP_DH_CB,(void (*)())dh);
+       SSL_CTX_callback_ctrl(ctx,SSL_CTRL_SET_TMP_DH_CB,(void (*)(void))dh);
        }
 
 void SSL_set_tmp_dh_callback(SSL *ssl,DH *(*dh)(SSL *ssl,int is_export,
                                                int keylength))
        {
-       SSL_callback_ctrl(ssl,SSL_CTRL_SET_TMP_DH_CB,(void (*)())dh);
+       SSL_callback_ctrl(ssl,SSL_CTRL_SET_TMP_DH_CB,(void (*)(void))dh);
        }
 #endif
 
@@ -2496,24 +2502,24 @@ void SSL_set_tmp_dh_callback(SSL *ssl,DH *(*dh)(SSL *ssl,int is_export,
 void SSL_CTX_set_tmp_ecdh_callback(SSL_CTX *ctx,EC_KEY *(*ecdh)(SSL *ssl,int is_export,
                                                        int keylength))
        {
-       SSL_CTX_callback_ctrl(ctx,SSL_CTRL_SET_TMP_ECDH_CB,(void (*)())ecdh);
+       SSL_CTX_callback_ctrl(ctx,SSL_CTRL_SET_TMP_ECDH_CB,(void (*)(void))ecdh);
        }
 
 void SSL_set_tmp_ecdh_callback(SSL *ssl,EC_KEY *(*ecdh)(SSL *ssl,int is_export,
                                                int keylength))
        {
-       SSL_callback_ctrl(ssl,SSL_CTRL_SET_TMP_ECDH_CB,(void (*)())ecdh);
+       SSL_callback_ctrl(ssl,SSL_CTRL_SET_TMP_ECDH_CB,(void (*)(void))ecdh);
        }
 #endif
 
 
 void SSL_CTX_set_msg_callback(SSL_CTX *ctx, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg))
        {
-       SSL_CTX_callback_ctrl(ctx, SSL_CTRL_SET_MSG_CALLBACK, (void (*)())cb);
+       SSL_CTX_callback_ctrl(ctx, SSL_CTRL_SET_MSG_CALLBACK, (void (*)(void))cb);
        }
 void SSL_set_msg_callback(SSL *ssl, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg))
        {
-       SSL_callback_ctrl(ssl, SSL_CTRL_SET_MSG_CALLBACK, (void (*)())cb);
+       SSL_callback_ctrl(ssl, SSL_CTRL_SET_MSG_CALLBACK, (void (*)(void))cb);
        }
 
 
index 6dac9d8..fcbfb16 100644 (file)
@@ -523,6 +523,7 @@ int ssl_cipher_get_evp(const SSL_SESSION *s,const EVP_CIPHER **enc,
                       const EVP_MD **md,SSL_COMP **comp);
 int ssl_verify_cert_chain(SSL *s,STACK_OF(X509) *sk);
 int ssl_undefined_function(SSL *s);
+int ssl_undefined_void_function(void);
 int ssl_undefined_const_function(const SSL *s);
 X509 *ssl_get_server_send_cert(SSL *);
 EVP_PKEY *ssl_get_sign_pkey(SSL *,SSL_CIPHER *);
@@ -555,8 +556,8 @@ int ssl2_shutdown(SSL *s);
 void   ssl2_clear(SSL *s);
 long   ssl2_ctrl(SSL *s,int cmd, long larg, void *parg);
 long   ssl2_ctx_ctrl(SSL_CTX *s,int cmd, long larg, void *parg);
-long   ssl2_callback_ctrl(SSL *s,int cmd, void (*fp)());
-long   ssl2_ctx_callback_ctrl(SSL_CTX *s,int cmd, void (*fp)());
+long   ssl2_callback_ctrl(SSL *s,int cmd, void (*fp)(void));
+long   ssl2_ctx_callback_ctrl(SSL_CTX *s,int cmd, void (*fp)(void));
 int    ssl2_pending(const SSL *s);
 
 SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p);
@@ -603,8 +604,8 @@ int ssl3_shutdown(SSL *s);
 void   ssl3_clear(SSL *s);
 long   ssl3_ctrl(SSL *s,int cmd, long larg, void *parg);
 long   ssl3_ctx_ctrl(SSL_CTX *s,int cmd, long larg, void *parg);
-long   ssl3_callback_ctrl(SSL *s,int cmd, void (*fp)());
-long   ssl3_ctx_callback_ctrl(SSL_CTX *s,int cmd, void (*fp)());
+long   ssl3_callback_ctrl(SSL *s,int cmd, void (*fp)(void));
+long   ssl3_ctx_callback_ctrl(SSL_CTX *s,int cmd, void (*fp)(void));
 int    ssl3_pending(const SSL *s);
 
 int ssl23_accept(SSL *s);
@@ -616,7 +617,7 @@ int tls1_new(SSL *s);
 void tls1_free(SSL *s);
 void tls1_clear(SSL *s);
 long tls1_ctrl(SSL *s,int cmd, long larg, void *parg);
-long tls1_callback_ctrl(SSL *s,int cmd, void (*fp)());
+long tls1_callback_ctrl(SSL *s,int cmd, void (*fp)(void));
 SSL_METHOD *tlsv1_base_method(void );
 
 int ssl_init_wbio_buffer(SSL *s, int push);
index ca6c03d..447fc0d 100644 (file)
@@ -101,7 +101,7 @@ static SSL_METHOD TLSv1_data= {
        ssl_bad_method,
        tls1_default_timeout,
        &TLSv1_enc_data,
-       ssl_undefined_function,
+       ssl_undefined_void_function,
        ssl3_callback_ctrl,
        ssl3_ctx_callback_ctrl,
        };
index 9fd937a..27d1469 100644 (file)
@@ -974,8 +974,11 @@ md5test.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
 md5test.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
 md5test.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
 md5test.o: ../include/openssl/stack.h ../include/openssl/symhacks.h md5test.c
-mdc2test.o: ../e_os.h ../include/openssl/e_os2.h
-mdc2test.o: ../include/openssl/opensslconf.h mdc2test.c
+mdc2test.o: ../include/openssl/buffer.h ../include/openssl/crypto.h
+mdc2test.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h
+mdc2test.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+mdc2test.o: ../include/openssl/safestack.h ../include/openssl/stack.h
+mdc2test.o: ../include/openssl/symhacks.h mdc2test.c
 randtest.o: ../e_os.h ../include/openssl/e_os2.h
 randtest.o: ../include/openssl/opensslconf.h ../include/openssl/ossl_typ.h
 randtest.o: ../include/openssl/rand.h randtest.c
@@ -984,8 +987,11 @@ rc2test.o: ../include/openssl/opensslconf.h ../include/openssl/rc2.h rc2test.c
 rc4test.o: ../e_os.h ../include/openssl/e_os2.h
 rc4test.o: ../include/openssl/opensslconf.h ../include/openssl/rc4.h
 rc4test.o: ../include/openssl/sha.h rc4test.c
-rc5test.o: ../e_os.h ../include/openssl/e_os2.h
-rc5test.o: ../include/openssl/opensslconf.h rc5test.c
+rc5test.o: ../include/openssl/buffer.h ../include/openssl/crypto.h
+rc5test.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h
+rc5test.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+rc5test.o: ../include/openssl/safestack.h ../include/openssl/stack.h
+rc5test.o: ../include/openssl/symhacks.h rc5test.c
 rmdtest.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
 rmdtest.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
 rmdtest.o: ../include/openssl/evp.h ../include/openssl/obj_mac.h