]> granicus.if.org Git - openssl/commitdiff
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 20a8b5459e60247d84e63961ce8a754750eca245..942279d25be755b3851b784c2fb2b9fce96e4069 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 131a721a3920ab8fa92d9ce72eadaccdb5da6a40..d3ddf8286b31890d945dbe2c24012a049904d4b9 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 4e989b819c352ee402deac611ea032825c0cffd0..ca5caacd0457dcc247abd3e1e6bf60baaabd5c28 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 45014fa14d5a3fc4038662d81b362afea5502926..727425744c73efb5c91d5cb3a1c3da4e5adc5ca7 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 d91d84d2206b08b570908d694bc082a90f58dc3c..c379b0e373d23e403a6399823688d9baf7214230 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 294fc69573fe00b4325c278a4c3f37748d8000f1..1dad6363ded7dac4814a52be95d4a5110343c20b 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 2e99e4c69a78ed59b02ba81f0ff7974e84d39130..40baeb16ad22c2574033500798cab518d0e61855 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 7182e9fa5d5319e5b42156f5f9ae61ab81d4a8fb..b728e5c0e201e781d05c892d5f26ba9a058c3c70 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 dc6826ad1bb51a7b18a3a6650a8b02a5ddc8fb5b..8679263378ca59acc470c2c4db1c208fa83d6e18 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 b354ae58659c47fb434e5fce9d5ab8fa27a1e558..c5520b77f9a17367c35cf5f01f83566faa9f9869 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 f4f1b73ebe880de661f57b47e85f45a7f0b7e053..159c05097ef22f2f388c804298bfffbf53128bc9 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 63158e9cab2dbeb2b276bdd0d922b21e064c9e58..50bea917e38be7f89c0a647336ace6ff3d4c6a29 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 3c8d3d56298c580a3730693a2f13f27ecc897695..9218719750372ff031fa710c446a7c39fa5749d2 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 37e1e84a11448d079aea41f4a2444b4748850a1e..2542f750a21ce0bf79b25543f0a714da1da182a5 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 b91678a9f6ecc59a166612d0a43b226daa508113..d34e2871773dedf55af6a7ee91d1b87f16e16cb6 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 f340e0850b5ee54c3d290a723659d73581285cae..a4ec44219d6c2d7045ad3628afea4a8ef83d4c26 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 efd80215c24ee72f4399aac3c43156a9110488fa..4341e5415a9b21401fb1f12fad73c62dec461f7a 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 a67fb341eebd837b25f996e5f6314159d622fbf4..f95cb145b79dcb1f72dfc794915d44859c6eb530 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 ea56aa6abeda31e73c1b38cc66ea7fb2415fea51..e3535bc435e053916062f9a2421e6cc43d08dfa5 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 a5a02e843c1f249c5f4b9d082019783619458627..e1bb322416f517d34c35e70e4e8528c57d60c8d4 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 ec788267e0124aabdf48f5d07772731dba804e2f..9893dd5daf39a929544e93f1a50b91bef5f8aaaf 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 1aff49570a4a0172f3f15e4869dba669266fa214..c834a38ddf3cfa16fec7e961e751d49eb5a8c462 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 c88cfd59322447b3b28d5e964639f60d4ace9d5d..ee860beaa6d7a650a57cc63c01775b8d27736926 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 eff2290c2bff441c895bda59163f3f0f1c13b46f..12d1a2565968873eb653478df969a6a996e2fb26 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 a608d81c7f3c6598e05cf95c49fce01b8f000cb5..bfb2b577138209f76b6ede0397cd7501f9eec469 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 312340e9f3e37e82b33998418fa881a0e6af236b..991a018ef2d5dc356178c361e594d61acfefd75e 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 068e18cb1885a8b625b9cd4230f0dec945c0d149..8eec737e38e16b2b9cf610c445c36359b9428629 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 b3267df62ba342eac68a0221eafcf989979df1f2..d60b4c1e83119bf1cc8791deb0d92f3f7a5fc619 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 18527484ce4668cb4ecbda6e1d19e81dd80fed01..4455ef6b9539586a8e02746bce1c82538e648e25 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 c2d0297392f15efd44d60a112c8184d16f6e8362..cf82f490dbb5e0542c59d12b9addd2707f4283c2 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 e28ec56ffa6a82ffc165cb9b58a9dfee3a6015d0..655299a3a7840b8678fee9f586385b4a7b01dcf4 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 70c79b3464153a5d15b455f76b78e1fa5c802cdd..209e16c1be1d7343b90e5f91173332af2fce578a 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 e752c2073a3a68d9eb97f5cad97f30e561dd25a0..7570a6eee64612f4ff9ea93fbc5f4e0fc5862994 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 9856c26d433e024d7c7c198f090e22ec58bf11f4..d952b71d1d28573d6146187346f5ddb33ad9bbe7 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 fab3c0318215160e28a1b9650d5b845dba88c359..37375c15d37e6bc14e3408f45a249a76ada13042 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 57399433fc4276c916714b02262679118df2bd69..658a89161fb1760b30a594df230b500583c23ae4 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 ce5b75c315757519b350e34c24fedb6afd4de4ad..9a5fa03e2a27db31077054822a93fb5e8ce0d62e 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 a4357d591cb30564e3a76695de1865d9002755d6..a9ac52de02b9d543b0c6c7073f3386a8c356072e 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 7eba3b26c1dd00ccfe53abe3badfdec6faa856aa..b9e2ab51f39bc5451992b35347308f6c1373d697 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 ae0a87e978b35bd80592896099b25dedab7482f6..6e1bb4a62aaf0ae44ec830de4124b01e52878e1e 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 8d9064ea7c83dd2890d4f3a783386102246f5290..a5e9204590958ed1ecd9b80ae018e27f32210b04 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 210ec1e8c4fb670bb596cf4a6140eae697145cf0..d4b98fda378d35daeef59d9d9d8b9dec6853b801 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 00a7873f921afb72fcd704f75ce725acd9c3816e..4bfd51a4bb0ece81118d63ef2f17ab4bb2ee22d4 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 1455a7e0e42bbf344823cfea777e0124ea3a37a7..bbbf26d50ed6b04039c5e59c0737eeaba759ede4 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 6d6739eae1f24270f7191f399928192c67f24fbd..b50149dd96cd5bc9894912025a115ec01001f726 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 58b300b00b01f2d29a9ced5bbedfa1a37fb4dfe9..b3a7a42ca09c36f97b5b10197bd937314448b7c2 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 c98e287703ca4ae845aee47f094a6bd362c49532..307e1ba23fc215e038fc651fd5aea24189103718 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 59da88ea02e512c5dfe6983860351bb2ff0cf54e..018296412b187107b7f971f18116b325d5b6eef9 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 dbc9711a2def68fb1db965f842c311e74f183fbc..2d0d98926d4e6564ca3b121a4c19e40ba20dc730 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 4c7d91452a50c6b113b96db4e8d5746fe7d15b93..2afbcfd04a7aa8368dfdd116aab8fe67cd03fe0d 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 ffc07cce6f1566f82cabfbacb64e2fe9ece25c1f..431a620618debf144fcfd71b84086cb40aac3748 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 4701959b1e89e2be2d0ae9d409ddf000ba5db0e2..84ec5d5098001cc9496e74eca69e4263fdb932ca 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 2b2792d2d6ff693a3b4e4e2c8378513a120647f8..5e9754fe43f5696585dc612b6767ddbcbb3d14d3 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 4bc22027f90a3fc232f9e4c4a08824eeb94bcfd4..e46b000ddcad8d8d5caa9b9eea61ddc113790134 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 d683ee43e192fabeb751cf9707956f44e9085dde..1db216be8bd9e3f5ee7bc68e280c7d310bccdc74 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 8d7dbcf569c3201e2cf2475c39687a349389515c..bcfda91fe50c620344151b9b5699eb3f5fd23fba 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 b89b83f4f8593809e220f4ea6d8f82b4912147f2..6f7d11f0dd13220b6a57c452d7354c5974045d10 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 bbca61f3ff022fa143a978fe75a0d8220ec772e2..345f74bea05e4c47bc4e14a719b8f67c13cb51a5 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 185d4b790e5a4e2c39600a9bc7ed9978137b6a01..df9acf9828dd2eb8fd1c2b9e1792fbc5c12553c0 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 9667d0b826fdd62e783b9b06e1af81d7493689de..c2fa410ce445dca52dc5b45c20d7f24c5c062f6f 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 2472b4dfad0b00896d522e2eb1e0880aa25107fa..66bc5c2c3a10c6b805dc7ddd2235454c1907e497 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 2351279f0e5e8f0ccc6c4f819b2345484a44adf8..71d4f64975761fcb950531c1ea661a29867464d6 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 6dac9d81a027cf942b13eb53b6ec47e67e3848c6..fcbfb161aa32d58ccacd67aeff132b5d4fd0c4d7 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 ca6c03d5af18654c7c1413b2bf4deac8749f63cd..447fc0d3990899a264761313fe4a798065328613 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 9fd937aabf403e88d82208ab8360e740206bf2b6..27d1469b4c53f9fd0620fcd4f38623509677140f 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