Fixes for Win32 build.
authorDr. Stephen Henson <steve@openssl.org>
Wed, 21 Jun 2000 02:25:30 +0000 (02:25 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Wed, 21 Jun 2000 02:25:30 +0000 (02:25 +0000)
This is mostly a work around for the old VC++ problem
that it treats func() as func(void).

Various prototypes had been added to 'compare' function
pointers that triggered this. This could be fixed by removing
the prototype, adding function pointer casts to every call or
changing the passed function to use the expected arguments.
I mostly did the latter.

The mkdef.pl script was modified to remove the typesafe
functions which no longer exist.

Oh and some functions called OPENSSL_freeLibrary() were
changed back to FreeLibrary(), wonder how that happened :-)

26 files changed:
CHANGES
crypto/asn1/a_set.c
crypto/asn1/a_strnid.c
crypto/asn1/asn1.h
crypto/asn1/asn_pack.c
crypto/bio/bf_buff.c
crypto/bio/bf_nbio.c
crypto/bio/bf_null.c
crypto/bio/bio.h
crypto/bio/bss_conn.c
crypto/dso/dso_win32.c
crypto/evp/bio_b64.c
crypto/evp/bio_enc.c
crypto/evp/bio_md.c
crypto/evp/bio_ok.c
crypto/evp/evp_pbe.c
crypto/objects/o_names.c
crypto/objects/obj_dat.c
crypto/pkcs12/p12_decr.c
crypto/pkcs12/pkcs12.h
crypto/rand/rand_win.c
crypto/stack/safestack.h
ssl/bio_ssl.c
ssl/s2_lib.c
ssl/s3_lib.c
util/mkdef.pl

diff --git a/CHANGES b/CHANGES
index fca3a14..a0e7a78 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,12 @@
 
  Changes between 0.9.5a and 0.9.6  [xx XXX 2000]
 
+  *) Patches to make OpenSSL compile under Win32 again. Mostly
+     work arounds for the VC++ problem that it treats func() as
+     func(void). Also stripped out the parts of mkdef.pl that
+     added extra typesafe functions: these no longer exist.
+     [Steve Henson]
+
   *) Reorganisation of the stack code. The macros are now all 
      collected in safestack.h . Each macro is defined in terms of
      a "stack macro" of the form SKM_<name>(type, a, b). The 
index 8cde848..1921f5e 100644 (file)
@@ -152,7 +152,7 @@ SetBlob
         }
 
 STACK *d2i_ASN1_SET(STACK **a, unsigned char **pp, long length,
-            char *(*func)(), void (*free_func)(), int ex_tag, int ex_class)
+            char *(*func)(), void (*free_func)(void *), int ex_tag, int ex_class)
        {
        ASN1_CTX c;
        STACK *ret=NULL;
index 4a65e40..6b10cff 100644 (file)
@@ -67,7 +67,7 @@ static STACK_OF(ASN1_STRING_TABLE) *stable = NULL;
 static void st_free(ASN1_STRING_TABLE *tbl);
 static int sk_table_cmp(const ASN1_STRING_TABLE * const *a,
                        const ASN1_STRING_TABLE * const *b);
-static int table_cmp(ASN1_STRING_TABLE *a, ASN1_STRING_TABLE *b);
+static int table_cmp(const void *a, const void *b);
 
 
 /* This is the global mask for the mbstring functions: this is use to
@@ -180,9 +180,10 @@ static int sk_table_cmp(const ASN1_STRING_TABLE * const *a,
        return (*a)->nid - (*b)->nid;
 }
 
-static int table_cmp(ASN1_STRING_TABLE *a, ASN1_STRING_TABLE *b)
+static int table_cmp(const void *a, const void *b)
 {
-       return a->nid - b->nid;
+       const ASN1_STRING_TABLE *sa = a, *sb = b;
+       return sa->nid - sb->nid;
 }
 
 ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid)
@@ -194,7 +195,7 @@ ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid)
        ttmp = (ASN1_STRING_TABLE *) OBJ_bsearch((char *)&fnd,
                                        (char *)tbl_standard, 
                        sizeof(tbl_standard)/sizeof(ASN1_STRING_TABLE),
-                       sizeof(ASN1_STRING_TABLE), (int(*)())table_cmp);
+                       sizeof(ASN1_STRING_TABLE), table_cmp);
        if(ttmp) return ttmp;
        if(!stable) return NULL;
        idx = sk_ASN1_STRING_TABLE_find(stable, &fnd);
index 4aa5a56..be3317c 100644 (file)
@@ -658,7 +658,7 @@ ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s,time_t t);
 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, unsigned char **pp, long length,
-                       char *(*func)(), void (*free_func)(),
+                       char *(*func)(), void (*free_func)(void *),
                        int ex_tag, int ex_class);
 
 #ifndef NO_BIO
@@ -753,7 +753,7 @@ int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a,long *num,
        unsigned char *data, int max_len);
 
 STACK *ASN1_seq_unpack(unsigned char *buf, int len, char *(*d2i)(),
-                                                void (*free_func)() ); 
+                                                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)());
index 2969d5f..bdf5f13 100644 (file)
@@ -65,7 +65,7 @@
 /* Turn an ASN1 encoded SEQUENCE OF into a STACK of structures */
 
 STACK *ASN1_seq_unpack(unsigned char *buf, int len, char *(*d2i)(),
-            void (*free_func)())
+            void (*free_func)(void *))
 {
     STACK *sk;
     unsigned char *pbuf;
index e9916d2..c65dc14 100644 (file)
@@ -69,7 +69,7 @@ static int buffer_gets(BIO *h, char *str, int size);
 static long buffer_ctrl(BIO *h, int cmd, long arg1, void *arg2);
 static int buffer_new(BIO *h);
 static int buffer_free(BIO *data);
-static long buffer_callback_ctrl(BIO *h, int cmd, void (*fp)());
+static long buffer_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp);
 #define DEFAULT_BUFFER_SIZE    1024
 
 static BIO_METHOD methods_buffer=
@@ -439,7 +439,7 @@ malloc_error:
        return(0);
        }
 
-static long buffer_callback_ctrl(BIO *b, int cmd, void (*fp)())
+static long buffer_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
        {
        long ret=1;
 
index a4a60a0..413ef5c 100644 (file)
@@ -73,7 +73,7 @@ static int nbiof_gets(BIO *h,char *str,int size);
 static long nbiof_ctrl(BIO *h,int cmd,long arg1,void *arg2);
 static int nbiof_new(BIO *h);
 static int nbiof_free(BIO *data);
-static long nbiof_callback_ctrl(BIO *h,int cmd,void (*fp)());
+static long nbiof_callback_ctrl(BIO *h,int cmd,bio_info_cb *fp);
 typedef struct nbio_test_st
        {
        /* only set if we sent a 'should retry' error */
@@ -226,7 +226,7 @@ static long nbiof_ctrl(BIO *b, int cmd, long num, void *ptr)
        return(ret);
        }
 
-static long nbiof_callback_ctrl(BIO *b, int cmd, void (*fp)())
+static long nbiof_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
        {
        long ret=1;
 
index a3f0b02..2678a1a 100644 (file)
@@ -72,7 +72,7 @@ static int nullf_gets(BIO *h, char *str, int size);
 static long nullf_ctrl(BIO *h, int cmd, long arg1, void *arg2);
 static int nullf_new(BIO *h);
 static int nullf_free(BIO *data);
-static long nullf_callback_ctrl(BIO *h, int cmd, void (*fp)());
+static long nullf_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp);
 static BIO_METHOD methods_nullf=
        {
        BIO_TYPE_NULL_FILTER,
@@ -154,7 +154,7 @@ static long nullf_ctrl(BIO *b, int cmd, long num, void *ptr)
        return(ret);
        }
 
-static long nullf_callback_ctrl(BIO *b, int cmd, void (*fp)())
+static long nullf_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
        {
        long ret=1;
 
index 68107d9..5634a96 100644 (file)
@@ -211,6 +211,8 @@ extern "C" {
 
 typedef struct bio_st BIO;
 
+typedef void bio_info_cb(struct bio_st *, int, const char *, int, long, long);
+
 #ifndef WIN16
 typedef struct bio_method_st
        {
@@ -223,7 +225,7 @@ typedef struct bio_method_st
        long (*ctrl)(BIO *, int, long, void *);
        int (*create)(BIO *);
        int (*destroy)(BIO *);
-       long (*callback_ctrl)(BIO *, int, void (*)(struct bio_st *, int, const char *, int, long, long));
+        long (*callback_ctrl)(BIO *, int, bio_info_cb *);
        } BIO_METHOD;
 #else
 typedef struct bio_method_st
@@ -460,8 +462,8 @@ int BIO_read_filename(BIO *b,const char *name);
 size_t BIO_ctrl_pending(BIO *b);
 size_t BIO_ctrl_wpending(BIO *b);
 #define BIO_flush(b)           (int)BIO_ctrl(b,BIO_CTRL_FLUSH,0,NULL)
-#define BIO_get_info_callback(b,cbp) (int)BIO_ctrl(b,BIO_CTRL_GET_CALLBACK,0,(void (**)())(cbp))
-#define BIO_set_info_callback(b,cb) (int)BIO_callback_ctrl(b,BIO_CTRL_SET_CALLBACK,(void (*)())(cb))
+#define BIO_get_info_callback(b,cbp) (int)BIO_ctrl(b,BIO_CTRL_GET_CALLBACK,0,(bio_info_cb **)(cbp))
+#define BIO_set_info_callback(b,cb) (int)BIO_callback_ctrl(b,BIO_CTRL_SET_CALLBACK,(bio_info_cb *)(cb))
 
 /* For the BIO_f_buffer() type */
 #define BIO_buffer_get_num_lines(b) BIO_ctrl(b,BIO_CTRL_GET,0,NULL)
index 1281a0a..7ed26f3 100644 (file)
@@ -104,7 +104,7 @@ static int conn_puts(BIO *h, const char *str);
 static long conn_ctrl(BIO *h, int cmd, long arg1, void *arg2);
 static int conn_new(BIO *h);
 static int conn_free(BIO *data);
-static long conn_callback_ctrl(BIO *h, int cmd, void (*fp)());
+static long conn_callback_ctrl(BIO *h, int cmd, bio_info_cb *);
 
 static int conn_state(BIO *b, BIO_CONNECT *c);
 static void conn_close_socket(BIO *data);
@@ -574,7 +574,7 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr)
                if (data->param_hostname)
                        BIO_set_conn_hostname(dbio,data->param_hostname);
                BIO_set_nbio(dbio,data->nbio);
-               (void)BIO_set_info_callback(dbio,(void *(*)())(data->info_callback));
+                (void)BIO_set_info_callback(dbio,data->info_callback);
                }
                break;
        case BIO_CTRL_SET_CALLBACK:
@@ -602,7 +602,7 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr)
        return(ret);
        }
 
-static long conn_callback_ctrl(BIO *b, int cmd, void (*fp)())
+static long conn_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
        {
        long ret=1;
        BIO_CONNECT *data;
index 3a2baf2..d613fbf 100644 (file)
@@ -141,14 +141,14 @@ static int win32_load(DSO *dso, const char *filename)
        if(p == NULL)
                {
                DSOerr(DSO_F_WIN32_LOAD,ERR_R_MALLOC_FAILURE);
-               OPENSSL_freeLibrary(h);
+                FreeLibrary(h);
                return(0);
                }
        *p = h;
        if(!sk_push(dso->meth_data, (char *)p))
                {
                DSOerr(DSO_F_WIN32_LOAD,DSO_R_STACK_ERROR);
-               OPENSSL_freeLibrary(h);
+                FreeLibrary(h);
                OPENSSL_free(p);
                return(0);
                }
@@ -171,7 +171,7 @@ static int win32_unload(DSO *dso)
                DSOerr(DSO_F_WIN32_UNLOAD,DSO_R_NULL_HANDLE);
                return(0);
                }
-       if(!OPENSSL_freeLibrary(p))
+        if(!FreeLibrary(*p))
                {
                DSOerr(DSO_F_WIN32_UNLOAD,DSO_R_UNLOAD_FAILED);
                /* We should push the value back onto the stack in
index a275ef4..35c514a 100644 (file)
@@ -69,7 +69,7 @@ static int b64_read(BIO *h, char *buf, int size);
 static long b64_ctrl(BIO *h, int cmd, long arg1, void *arg2);
 static int b64_new(BIO *h);
 static int b64_free(BIO *data);
-static long b64_callback_ctrl(BIO *h,int cmd,void (*fp)());
+static long b64_callback_ctrl(BIO *h,int cmd,bio_info_cb *fp);
 #define B64_BLOCK_SIZE 1024
 #define B64_BLOCK_SIZE2        768
 #define B64_NONE       0
@@ -524,7 +524,7 @@ again:
        return(ret);
        }
 
-static long b64_callback_ctrl(BIO *b, int cmd, void (*fp)())
+static long b64_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
        {
        long ret=1;
 
index 129e2e3..831c71a 100644 (file)
@@ -69,7 +69,7 @@ static int enc_read(BIO *h, char *buf, int size);
 static long enc_ctrl(BIO *h, int cmd, long arg1, void *arg2);
 static int enc_new(BIO *h);
 static int enc_free(BIO *data);
-static long enc_callback_ctrl(BIO *h, int cmd, void (*fp)());
+static long enc_callback_ctrl(BIO *h, int cmd, bio_info_cb *fps);
 #define ENC_BLOCK_SIZE (1024*4)
 
 typedef struct enc_struct
@@ -370,7 +370,7 @@ again:
        return(ret);
        }
 
-static long enc_callback_ctrl(BIO *b, int cmd, void (*fp)())
+static long enc_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
        {
        long ret=1;
 
index 194555b..2373c24 100644 (file)
@@ -72,7 +72,7 @@ static int md_gets(BIO *h, char *str, int size);
 static long md_ctrl(BIO *h, int cmd, long arg1, void *arg2);
 static int md_new(BIO *h);
 static int md_free(BIO *data);
-static long md_callback_ctrl(BIO *h,int cmd,void (*fp)());
+static long md_callback_ctrl(BIO *h,int cmd,bio_info_cb *fp);
 
 static BIO_METHOD methods_md=
        {
@@ -223,7 +223,7 @@ static long md_ctrl(BIO *b, int cmd, long num, void *ptr)
        return(ret);
        }
 
-static long md_callback_ctrl(BIO *b, int cmd, void (*fp)())
+static long md_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
        {
        long ret=1;
 
index a358aad..e617ce1 100644 (file)
@@ -130,7 +130,7 @@ static int ok_read(BIO *h, char *buf, int size);
 static long ok_ctrl(BIO *h, int cmd, long arg1, void *arg2);
 static int ok_new(BIO *h);
 static int ok_free(BIO *data);
-static long ok_callback_ctrl(BIO *h, int cmd, void (*fp)());
+static long ok_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp);
 
 static void sig_out(BIO* b);
 static void sig_in(BIO* b);
@@ -431,7 +431,7 @@ static long ok_ctrl(BIO *b, int cmd, long num, void *ptr)
        return(ret);
        }
 
-static long ok_callback_ctrl(BIO *b, int cmd, void (*fp)())
+static long ok_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
        {
        long ret=1;
 
index 229ac67..224a422 100644 (file)
@@ -104,8 +104,9 @@ int EVP_PBE_CipherInit (ASN1_OBJECT *pbe_obj, const char *pass, int passlen,
        return 1;       
 }
 
-static int pbe_cmp (EVP_PBE_CTL **pbe1, EVP_PBE_CTL **pbe2)
+static int pbe_cmp(const char * const *a, const char * const *b)
 {
+       EVP_PBE_CTL **pbe1 = (EVP_PBE_CTL **) a,  **pbe2 = (EVP_PBE_CTL **)b;
        return ((*pbe1)->pbe_nid - (*pbe2)->pbe_nid);
 }
 
@@ -115,7 +116,7 @@ int EVP_PBE_alg_add (int nid, EVP_CIPHER *cipher, EVP_MD *md,
             EVP_PBE_KEYGEN *keygen)
 {
        EVP_PBE_CTL *pbe_tmp;
-       if (!pbe_algs) pbe_algs = sk_new ((int (*)())pbe_cmp);
+       if (!pbe_algs) pbe_algs = sk_new(pbe_cmp);
        if (!(pbe_tmp = (EVP_PBE_CTL*) OPENSSL_malloc (sizeof(EVP_PBE_CTL)))) {
                EVPerr(EVP_F_EVP_PBE_ALG_ADD,ERR_R_MALLOC_FAILURE);
                return 0;
index f6bb643..dca9882 100644 (file)
@@ -36,8 +36,9 @@ int OBJ_NAME_init(void)
        return(names_lh != NULL);
        }
 
-int OBJ_NAME_new_index(unsigned long (*hash_func)(), int (*cmp_func)(),
-            void (*free_func)())
+int OBJ_NAME_new_index(unsigned long (*hash_func)(const char *),
+       int (*cmp_func)(const void *, const void *),
+       void (*free_func)(const char *, int, const char *))
        {
        int ret;
        int i;
index 018ad5e..24d312d 100644 (file)
@@ -79,9 +79,9 @@ static ASN1_OBJECT *ln_objs[1];
 static ASN1_OBJECT *obj_objs[1];
 #endif
 
-static int sn_cmp(ASN1_OBJECT **a, ASN1_OBJECT **b);
-static int ln_cmp(ASN1_OBJECT **a, ASN1_OBJECT **b);
-static int obj_cmp(ASN1_OBJECT **a, ASN1_OBJECT **b);
+static int sn_cmp(const void *a, const void *b);
+static int ln_cmp(const void *a, const void *b);
+static int obj_cmp(const void *a, const void *b);
 #define ADDED_DATA     0
 #define ADDED_SNAME    1
 #define ADDED_LNAME    2
@@ -96,11 +96,17 @@ typedef struct added_obj_st
 static int new_nid=NUM_NID;
 static LHASH *added=NULL;
 
-static int sn_cmp(ASN1_OBJECT **ap, ASN1_OBJECT **bp)
-       { return(strcmp((*ap)->sn,(*bp)->sn)); }
+static int sn_cmp(const void *a, const void *b)
+       {
+       const ASN1_OBJECT * const *ap = a, * const *bp = b;
+       return(strcmp((*ap)->sn,(*bp)->sn));
+       }
 
-static int ln_cmp(ASN1_OBJECT **ap, ASN1_OBJECT **bp)
-       { return(strcmp((*ap)->ln,(*bp)->ln)); }
+static int ln_cmp(const void *a, const void *b)
+       { 
+       const ASN1_OBJECT * const *ap = a, * const *bp = b;
+       return(strcmp((*ap)->ln,(*bp)->ln));
+       }
 
 static unsigned long add_hash(ADDED_OBJ *ca)
        {
@@ -365,7 +371,7 @@ int OBJ_obj2nid(ASN1_OBJECT *a)
                if (adp != NULL) return (adp->obj->nid);
                }
        op=(ASN1_OBJECT **)OBJ_bsearch((char *)&a,(char *)obj_objs,NUM_OBJ,
-               sizeof(ASN1_OBJECT *),(int (*)())obj_cmp);
+               sizeof(ASN1_OBJECT *),obj_cmp);
        if (op == NULL)
                return(NID_undef);
        return((*op)->nid);
@@ -504,7 +510,7 @@ int OBJ_ln2nid(const char *s)
                if (adp != NULL) return (adp->obj->nid);
                }
        op=(ASN1_OBJECT **)OBJ_bsearch((char *)&oo,(char *)ln_objs,NUM_LN,
-               sizeof(ASN1_OBJECT *),(int (*)())ln_cmp);
+               sizeof(ASN1_OBJECT *),ln_cmp);
        if (op == NULL) return(NID_undef);
        return((*op)->nid);
        }
@@ -523,23 +529,23 @@ int OBJ_sn2nid(const char *s)
                if (adp != NULL) return (adp->obj->nid);
                }
        op=(ASN1_OBJECT **)OBJ_bsearch((char *)&oo,(char *)sn_objs,NUM_SN,
-               sizeof(ASN1_OBJECT *),(int (*)())sn_cmp);
+               sizeof(ASN1_OBJECT *),sn_cmp);
        if (op == NULL) return(NID_undef);
        return((*op)->nid);
        }
 
-static int obj_cmp(ASN1_OBJECT **ap, ASN1_OBJECT **bp)
+static int obj_cmp(const void *ap, const void *bp)
        {
        int j;
-       ASN1_OBJECT *a= *ap;
-       ASN1_OBJECT *b= *bp;
+       ASN1_OBJECT *a= *(ASN1_OBJECT **)ap;
+       ASN1_OBJECT *b= *(ASN1_OBJECT **)bp;
 
        j=(a->length - b->length);
         if (j) return(j);
        return(memcmp(a->data,b->data,a->length));
         }
 
-char *OBJ_bsearch(char *key, char *base, int num, int size, int (*cmp)())
+char *OBJ_bsearch(char *key, char *base, int num, int size, int (*cmp)(const void *, const void *))
        {
        int l,h,i,c;
        char *p;
index 9ba90bb..8cd7e2f 100644 (file)
@@ -109,7 +109,7 @@ unsigned char * PKCS12_pbe_crypt (X509_ALGOR *algor, const char *pass,
  */
 
 char * PKCS12_decrypt_d2i (X509_ALGOR *algor, char * (*d2i)(),
-            void (*free_func)(), const char *pass, int passlen,
+            void (*free_func)(void *), const char *pass, int passlen,
             ASN1_OCTET_STRING *oct, int seq)
 {
        unsigned char *out, *p;
index 094f4f8..502fcef 100644 (file)
@@ -182,13 +182,13 @@ PKCS12_decrypt_d2i_PKCS12_SAFEBAG((p7)->d.encrypted->enc_data->algorithm,\
 
 #define M_PKCS12_decrypt_skey(bag, pass, passlen) \
 (PKCS8_PRIV_KEY_INFO *) PKCS12_decrypt_d2i((bag)->value.shkeybag->algor, \
-(char *(*)())d2i_PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO_free, \
+(char *(*)())d2i_PKCS8_PRIV_KEY_INFO, (void (*)(void *))PKCS8_PRIV_KEY_INFO_free, \
                                                (pass), (passlen), \
                         (bag)->value.shkeybag->digest, 2)
 
 #define M_PKCS8_decrypt(p8, pass, passlen) \
 (PKCS8_PRIV_KEY_INFO *) PKCS12_decrypt_d2i((p8)->algor, \
-(char *(*)())d2i_PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO_free,\
+(char *(*)())d2i_PKCS8_PRIV_KEY_INFO, (void (*)(void *))PKCS8_PRIV_KEY_INFO_free,\
                         (pass), (passlen), (p8)->digest, 2)
 
 #define PKCS12_get_attr(bag, attr_nid) \
@@ -226,7 +226,7 @@ unsigned char *PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass,
                                int passlen, unsigned char *in, int inlen,
                                unsigned char **data, int *datalen, int en_de);
 char *PKCS12_decrypt_d2i(X509_ALGOR *algor, char *(*d2i)(),
-                        void (*free_func)(), const char *pass, int passlen,
+                        void (*free_func)(void *), const char *pass, int passlen,
                         ASN1_STRING *oct, int seq);
 ASN1_STRING *PKCS12_i2d_encrypt(X509_ALGOR *algor, int (*i2d)(),
                                const char *pass, int passlen, char *obj,
index 2ee4a48..222ea4a 100644 (file)
  */
 
 
-#ifdef WINDOWS
+#if defined(WINDOWS) || defined(WIN32)
+#include "cryptlib.h"
 #include <windows.h>
 #include <openssl/rand.h>
 /* XXX There are probably other includes missing here ... */
index 137b286..20342c6 100644 (file)
@@ -189,7 +189,7 @@ STACK_OF(type) \
        sk_sort(st)
 
 #define        SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
-       d2i_ASN1_SET(st,pp,length, (char *(*)())d2i_func, (void (*)())free_func, ex_tag,ex_class)
+       d2i_ASN1_SET(st,pp,length, (char *(*)())d2i_func, (void (*)(void *))free_func, ex_tag,ex_class)
 #define        SKM_ASN1_SET_OF_i2d(type, st, pp, i2d_func, ex_tag, ex_class, is_set) \
        i2d_ASN1_SET(st,pp,i2d_func,ex_tag,ex_class,is_set)
 
index f6396db..d85555a 100644 (file)
@@ -71,7 +71,7 @@ static int ssl_puts(BIO *h, const char *str);
 static long ssl_ctrl(BIO *h, int cmd, long arg1, void *arg2);
 static int ssl_new(BIO *h);
 static int ssl_free(BIO *data);
-static long ssl_callback_ctrl(BIO *h, int cmd, void (*fp)());
+static long ssl_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp);
 typedef struct bio_ssl_st
        {
        SSL *ssl; /* The ssl handle :-) */
@@ -470,7 +470,7 @@ static long ssl_ctrl(BIO *b, int cmd, long num, void *ptr)
        return(ret);
        }
 
-static long ssl_callback_ctrl(BIO *b, int cmd, void (*fp)())
+static long ssl_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
        {
        SSL *ssl;
        BIO_SSL *bs;
index 8c9d992..129ed89 100644 (file)
@@ -384,7 +384,7 @@ SSL_CIPHER *ssl2_get_cipher_by_char(const unsigned char *p)
        cpp=(SSL_CIPHER **)OBJ_bsearch((char *)&cp,
                (char *)sorted,
                SSL2_NUM_CIPHERS,sizeof(SSL_CIPHER *),
-               (int (*)())ssl_cipher_ptr_id_cmp);
+               FP_ICC ssl_cipher_ptr_id_cmp);
        if ((cpp == NULL) || !(*cpp)->valid)
                return(NULL);
        else
index 9b664ab..cee2021 100644 (file)
@@ -1041,7 +1041,7 @@ SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p)
        cpp=(SSL_CIPHER **)OBJ_bsearch((char *)&cp,
                (char *)sorted,
                SSL3_NUM_CIPHERS,sizeof(SSL_CIPHER *),
-               (int (*)())ssl_cipher_ptr_id_cmp);
+               FP_ICC ssl_cipher_ptr_id_cmp);
        if ((cpp == NULL) || !(*cpp)->valid)
                return(NULL);
        else
index c6db12d..c7a0892 100755 (executable)
@@ -270,37 +270,10 @@ sub do_defs
                        } elsif (/^\#/) {
                                next;
                        }
-                       if (!$safe_stack_def &&
-                               /^\s*DECLARE_STACK_OF\s*\(\s*(\w*)\s*\)/) {
+                       if (/^\s*DECLARE_STACK_OF\s*\(\s*(\w*)\s*\)/) {
                                next;
-                       } elsif ($safe_stack_def &&
-                               /^\s*DECLARE_STACK_OF\s*\(\s*(\w*)\s*\)/) {
-                               $funcs{"sk_${1}_new"} = 1;
-                               $funcs{"sk_${1}_new_null"} = 1;
-                               $funcs{"sk_${1}_free"} = 1;
-                               $funcs{"sk_${1}_num"} = 1;
-                               $funcs{"sk_${1}_value"} = 1;
-                               $funcs{"sk_${1}_set"} = 1;
-                               $funcs{"sk_${1}_zero"} = 1;
-                               $funcs{"sk_${1}_push"} = 1;
-                               $funcs{"sk_${1}_unshift"} = 1;
-                               $funcs{"sk_${1}_find"} = 1;
-                               $funcs{"sk_${1}_delete"} = 1;
-                               $funcs{"sk_${1}_delete_ptr"} = 1;
-                               $funcs{"sk_${1}_insert"} = 1;
-                               $funcs{"sk_${1}_set_cmp_func"} = 1;
-                               $funcs{"sk_${1}_dup"} = 1;
-                               $funcs{"sk_${1}_pop_free"} = 1;
-                               $funcs{"sk_${1}_shift"} = 1;
-                               $funcs{"sk_${1}_pop"} = 1;
-                               $funcs{"sk_${1}_sort"} = 1;
-                       } if (!$safe_stack_def &&
-                               /^\s*DECLARE_ASN1_SET_OF\s*\(\s*(\w*)\s*\)/) {
+                       } elsif (/^\s*DECLARE_ASN1_SET_OF\s*\(\s*(\w*)\s*\)/) {
                                next;
-                       } elsif ($safe_stack_def &&
-                               /^\s*DECLARE_ASN1_SET_OF\s*\(\s*(\w*)\s*\)/) {
-                               $funcs{"d2i_ASN1_SET_OF_${1}"} = 1;
-                               $funcs{"i2d_ASN1_SET_OF_${1}"} = 1;
                        } elsif (/^DECLARE_PEM_rw\s*\(\s*(\w*)\s*,/ ||
                                     /^DECLARE_PEM_rw_cb\s*\(\s*(\w*)\s*,/ ) {
                                if (!($no_rsa && ($1 eq "RSAPrivateKey" ||