From: Dr. Stephen Henson Date: Wed, 21 Jun 2000 02:25:30 +0000 (+0000) Subject: Fixes for Win32 build. X-Git-Tag: OpenSSL-engine-0_9_6-beta1~21^2~38 X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff_plain;h=130832150c1313824868b154cccda3ace88fa950;hp=7ef8206859f9a52f48e817c023c744fe00e82c5d Fixes for Win32 build. 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 :-) --- diff --git a/CHANGES b/CHANGES index fca3a14d56..a0e7a785c5 100644 --- 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_(type, a, b). The diff --git a/crypto/asn1/a_set.c b/crypto/asn1/a_set.c index 8cde848689..1921f5eaa1 100644 --- a/crypto/asn1/a_set.c +++ b/crypto/asn1/a_set.c @@ -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; diff --git a/crypto/asn1/a_strnid.c b/crypto/asn1/a_strnid.c index 4a65e4097b..6b10cff994 100644 --- a/crypto/asn1/a_strnid.c +++ b/crypto/asn1/a_strnid.c @@ -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); diff --git a/crypto/asn1/asn1.h b/crypto/asn1/asn1.h index 4aa5a56876..be3317c896 100644 --- a/crypto/asn1/asn1.h +++ b/crypto/asn1/asn1.h @@ -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)()); diff --git a/crypto/asn1/asn_pack.c b/crypto/asn1/asn_pack.c index 2969d5f8e3..bdf5f130b3 100644 --- a/crypto/asn1/asn_pack.c +++ b/crypto/asn1/asn_pack.c @@ -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; diff --git a/crypto/bio/bf_buff.c b/crypto/bio/bf_buff.c index e9916d29eb..c65dc142a5 100644 --- a/crypto/bio/bf_buff.c +++ b/crypto/bio/bf_buff.c @@ -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; diff --git a/crypto/bio/bf_nbio.c b/crypto/bio/bf_nbio.c index a4a60a0c6d..413ef5c4c5 100644 --- a/crypto/bio/bf_nbio.c +++ b/crypto/bio/bf_nbio.c @@ -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; diff --git a/crypto/bio/bf_null.c b/crypto/bio/bf_null.c index a3f0b02a7f..2678a1a85d 100644 --- a/crypto/bio/bf_null.c +++ b/crypto/bio/bf_null.c @@ -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; diff --git a/crypto/bio/bio.h b/crypto/bio/bio.h index 68107d9798..5634a96a79 100644 --- a/crypto/bio/bio.h +++ b/crypto/bio/bio.h @@ -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) diff --git a/crypto/bio/bss_conn.c b/crypto/bio/bss_conn.c index 1281a0af0d..7ed26f358f 100644 --- a/crypto/bio/bss_conn.c +++ b/crypto/bio/bss_conn.c @@ -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; diff --git a/crypto/dso/dso_win32.c b/crypto/dso/dso_win32.c index 3a2baf2643..d613fbf378 100644 --- a/crypto/dso/dso_win32.c +++ b/crypto/dso/dso_win32.c @@ -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 diff --git a/crypto/evp/bio_b64.c b/crypto/evp/bio_b64.c index a275ef4c7d..35c514a771 100644 --- a/crypto/evp/bio_b64.c +++ b/crypto/evp/bio_b64.c @@ -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; diff --git a/crypto/evp/bio_enc.c b/crypto/evp/bio_enc.c index 129e2e30a4..831c71a2b5 100644 --- a/crypto/evp/bio_enc.c +++ b/crypto/evp/bio_enc.c @@ -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; diff --git a/crypto/evp/bio_md.c b/crypto/evp/bio_md.c index 194555be4e..2373c247d8 100644 --- a/crypto/evp/bio_md.c +++ b/crypto/evp/bio_md.c @@ -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; diff --git a/crypto/evp/bio_ok.c b/crypto/evp/bio_ok.c index a358aadbaf..e617ce1d43 100644 --- a/crypto/evp/bio_ok.c +++ b/crypto/evp/bio_ok.c @@ -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; diff --git a/crypto/evp/evp_pbe.c b/crypto/evp/evp_pbe.c index 229ac673a7..224a422b12 100644 --- a/crypto/evp/evp_pbe.c +++ b/crypto/evp/evp_pbe.c @@ -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; diff --git a/crypto/objects/o_names.c b/crypto/objects/o_names.c index f6bb643491..dca988230e 100644 --- a/crypto/objects/o_names.c +++ b/crypto/objects/o_names.c @@ -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; diff --git a/crypto/objects/obj_dat.c b/crypto/objects/obj_dat.c index 018ad5ef97..24d312d764 100644 --- a/crypto/objects/obj_dat.c +++ b/crypto/objects/obj_dat.c @@ -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; diff --git a/crypto/pkcs12/p12_decr.c b/crypto/pkcs12/p12_decr.c index 9ba90bbbdf..8cd7e2f414 100644 --- a/crypto/pkcs12/p12_decr.c +++ b/crypto/pkcs12/p12_decr.c @@ -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; diff --git a/crypto/pkcs12/pkcs12.h b/crypto/pkcs12/pkcs12.h index 094f4f8914..502fceff95 100644 --- a/crypto/pkcs12/pkcs12.h +++ b/crypto/pkcs12/pkcs12.h @@ -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, diff --git a/crypto/rand/rand_win.c b/crypto/rand/rand_win.c index 2ee4a48cc8..222ea4a608 100644 --- a/crypto/rand/rand_win.c +++ b/crypto/rand/rand_win.c @@ -110,7 +110,8 @@ */ -#ifdef WINDOWS +#if defined(WINDOWS) || defined(WIN32) +#include "cryptlib.h" #include #include /* XXX There are probably other includes missing here ... */ diff --git a/crypto/stack/safestack.h b/crypto/stack/safestack.h index 137b286ce4..20342c6e6b 100644 --- a/crypto/stack/safestack.h +++ b/crypto/stack/safestack.h @@ -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) diff --git a/ssl/bio_ssl.c b/ssl/bio_ssl.c index f6396db82e..d85555a7e6 100644 --- a/ssl/bio_ssl.c +++ b/ssl/bio_ssl.c @@ -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; diff --git a/ssl/s2_lib.c b/ssl/s2_lib.c index 8c9d992541..129ed89d97 100644 --- a/ssl/s2_lib.c +++ b/ssl/s2_lib.c @@ -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 diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c index 9b664ab4cb..cee2021b6b 100644 --- a/ssl/s3_lib.c +++ b/ssl/s3_lib.c @@ -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 diff --git a/util/mkdef.pl b/util/mkdef.pl index c6db12db4a..c7a08926a8 100755 --- a/util/mkdef.pl +++ b/util/mkdef.pl @@ -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" ||