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 fca3a14d56872e5dddcb2daac825dfa0150cc3a0..a0e7a785c5fff85e138691379e99d7aaafb190ba 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 8cde8486894c3f83e6f095fff914c0b51f1a46ea..1921f5eaa1256929ab2b8372e8dc05d06bd92197 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 4a65e4097b107dceeb858a04f3a9b38e7fa50d3f..6b10cff99449395ae9120713a1ac2047ac1c3f5d 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 4aa5a5687623e30d701f608c9e26c6451a7aa460..be3317c89618e039e9bc7e33ad56be7cd5cf5639 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 2969d5f8e361f7fe14db54d2f769b269c24542aa..bdf5f130b3a3cd0c5ad7540287ea956602cb5808 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 e9916d29eb7de5497f4c9ef34446fb6608f6f119..c65dc142a5c3af239d4c8dbe145c95212679f1a3 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 a4a60a0c6dbd2fb934a88f7e6926f0edce456a3f..413ef5c4c5e943bb4a342e00872317639c2a7c16 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 a3f0b02a7f2461c6ee1a58fe4e3143bbaf3ff270..2678a1a85d91fdfc6b558b72bb48b1591aec44bc 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 68107d97989f8b6bf5b0e1d5d57da5d9a3935477..5634a96a79a960bc05a324252f833ba51077b734 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 1281a0af0dc8e7ed63e24f1cfedc39e82f446559..7ed26f358f8e42bd0888b63951bdf2b798fb7799 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 3a2baf26430c9ec612a85c064bcd4124c1aad8f2..d613fbf378be72d15e6b8372daf874c13fcddd09 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 a275ef4c7d0a1923b0ca6fe08651ccde6ec43473..35c514a771743d2c4f37edf16b587e848a107479 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 129e2e30a4086efc95c80a1f8c9f24aff16985d0..831c71a2b5988f598aad4efdd8ae20729404a07f 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 194555be4e19d6ee2801349925752149cee405ab..2373c247d8afc59ebaaad779f8a4bc007c82ab18 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 a358aadbaf9d967391e4676fde1d423a2b1f3601..e617ce1d437008ed77d1545060b73ca1b9eb7df9 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 229ac673a7beaa67df7d019a6583e6fb8cc32a9a..224a422b126e1909508b93d69cefb184b5192d01 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 f6bb6434910414eab8040008d9a1f1a3ec33ffe3..dca988230e8c69ac4a382d8c2331ee23895bc5f2 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 018ad5ef979bf59d9b77210b0a1a9d9dca252fd2..24d312d76427223c667bbae73ed56c71a07ef5ea 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 9ba90bbbdfef4704ad41e1bd7b5462bb61cb1dd1..8cd7e2f41470d1358db82b80dd2895e1bdbe38ca 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 094f4f8914cafd32dbf817b0ea09dd419c64a094..502fceff954ab35d54be609f3e31ec1180e5e951 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 2ee4a48cc80c6b2572a1c493071fda8ac92a8fd6..222ea4a608befa93cdeede4be0dfa0a6209608a6 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 137b286ce4f005e367ed00687bec47e116817451..20342c6e6b4c14cf5cdf321e1e66124d3feb9c3f 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 f6396db82edc12a378560cb01e4befd48e7cc447..d85555a7e697056411fd792e5dfc820be06cca21 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 8c9d992541bdb6e2d8803a14de804999df01e43f..129ed89d970448a84cefd0b3fcff9423f0186917 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 9b664ab4cb76df7916561fb289d7249959efa5b9..cee2021b6b0c518ffa6a76c6dcae2da71c10adbe 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 c6db12db4a45d589166a3ae34b775a2e41d0221f..c7a08926a83bf45871754c525e3a7a1745950b7a 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" ||