From: Ben Laurie Date: Thu, 31 Mar 2005 09:26:39 +0000 (+0000) Subject: Give everything prototypes (well, everything that's actually used). X-Git-Tag: OpenSSL_0_9_7g~17^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=41a15c4f0f2535591ba9f258cf76119f86477c43;p=openssl Give everything prototypes (well, everything that's actually used). --- diff --git a/CHANGES b/CHANGES index 20a8b5459e..942279d25b 100644 --- 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". diff --git a/apps/progs.h b/apps/progs.h index 131a721a39..d3ddf8286b 100644 --- a/apps/progs.h +++ b/apps/progs.h @@ -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[] = { diff --git a/apps/s_apps.h b/apps/s_apps.h index 4e989b819c..ca5caacd04 100644 --- a/apps/s_apps.h +++ b/apps/s_apps.h @@ -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 diff --git a/apps/s_socket.c b/apps/s_socket.c index 45014fa14d..727425744c 100644 --- a/apps/s_socket.c +++ b/apps/s_socket.c @@ -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; diff --git a/apps/sess_id.c b/apps/sess_id.c index d91d84d220..c379b0e373 100644 --- a/apps/sess_id.c +++ b/apps/sess_id.c @@ -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 { diff --git a/apps/x509.c b/apps/x509.c index 294fc69573..1dad6363de 100644 --- a/apps/x509.c +++ b/apps/x509.c @@ -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"); diff --git a/crypto/asn1/a_d2i_fp.c b/crypto/asn1/a_d2i_fp.c index 2e99e4c69a..40baeb16ad 100644 --- a/crypto/asn1/a_d2i_fp.c +++ b/crypto/asn1/a_d2i_fp.c @@ -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); diff --git a/crypto/asn1/a_digest.c b/crypto/asn1/a_digest.c index 7182e9fa5d..b728e5c0e2 100644 --- a/crypto/asn1/a_digest.c +++ b/crypto/asn1/a_digest.c @@ -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; diff --git a/crypto/asn1/a_dup.c b/crypto/asn1/a_dup.c index dc6826ad1b..8679263378 100644 --- a/crypto/asn1/a_dup.c +++ b/crypto/asn1/a_dup.c @@ -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; diff --git a/crypto/asn1/a_hdr.c b/crypto/asn1/a_hdr.c index b354ae5865..c5520b77f9 100644 --- a/crypto/asn1/a_hdr.c +++ b/crypto/asn1/a_hdr.c @@ -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 { diff --git a/crypto/asn1/a_i2d_fp.c b/crypto/asn1/a_i2d_fp.c index f4f1b73ebe..159c05097e 100644 --- a/crypto/asn1/a_i2d_fp.c +++ b/crypto/asn1/a_i2d_fp.c @@ -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; diff --git a/crypto/asn1/a_meth.c b/crypto/asn1/a_meth.c index 63158e9cab..50bea917e3 100644 --- a/crypto/asn1/a_meth.c +++ b/crypto/asn1/a_meth.c @@ -62,16 +62,16 @@ #include 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) { diff --git a/crypto/asn1/a_set.c b/crypto/asn1/a_set.c index 3c8d3d5629..9218719750 100644 --- a/crypto/asn1/a_set.c +++ b/crypto/asn1/a_set.c @@ -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)); diff --git a/crypto/asn1/a_sign.c b/crypto/asn1/a_sign.c index 37e1e84a11..2542f750a2 100644 --- a/crypto/asn1/a_sign.c +++ b/crypto/asn1/a_sign.c @@ -126,9 +126,9 @@ #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; diff --git a/crypto/asn1/a_verify.c b/crypto/asn1/a_verify.c index b91678a9f6..d34e287177 100644 --- a/crypto/asn1/a_verify.c +++ b/crypto/asn1/a_verify.c @@ -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; diff --git a/crypto/asn1/asn1.h b/crypto/asn1/asn1.h index f340e0850b..a4ec44219d 100644 --- a/crypto/asn1/asn1.h +++ b/crypto/asn1/asn1.h @@ -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); diff --git a/crypto/asn1/asn1_gen.c b/crypto/asn1/asn1_gen.c index efd80215c2..4341e5415a 100644 --- a/crypto/asn1/asn1_gen.c +++ b/crypto/asn1/asn1_gen.c @@ -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; diff --git a/crypto/asn1/asn1_mac.h b/crypto/asn1/asn1_mac.h index a67fb341ee..f95cb145b7 100644 --- a/crypto/asn1/asn1_mac.h +++ b/crypto/asn1/asn1_mac.h @@ -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); diff --git a/crypto/asn1/asn_pack.c b/crypto/asn1/asn_pack.c index ea56aa6abe..e3535bc435 100644 --- a/crypto/asn1/asn_pack.c +++ b/crypto/asn1/asn_pack.c @@ -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; diff --git a/crypto/asn1/n_pkey.c b/crypto/asn1/n_pkey.c index a5a02e843c..e1bb322416 100644 --- a/crypto/asn1/n_pkey.c +++ b/crypto/asn1/n_pkey.c @@ -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; diff --git a/crypto/asn1/p5_pbe.c b/crypto/asn1/p5_pbe.c index ec788267e0..9893dd5daf 100644 --- a/crypto/asn1/p5_pbe.c +++ b/crypto/asn1/p5_pbe.c @@ -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; } diff --git a/crypto/asn1/p5_pbev2.c b/crypto/asn1/p5_pbev2.c index 1aff49570a..c834a38ddf 100644 --- a/crypto/asn1/p5_pbev2.c +++ b/crypto/asn1/p5_pbev2.c @@ -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; diff --git a/crypto/asn1/x_pkey.c b/crypto/asn1/x_pkey.c index c88cfd5932..ee860beaa6 100644 --- a/crypto/asn1/x_pkey.c +++ b/crypto/asn1/x_pkey.c @@ -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))); diff --git a/crypto/asn1/x_x509.c b/crypto/asn1/x_x509.c index eff2290c2b..12d1a25659 100644 --- a/crypto/asn1/x_x509.c +++ b/crypto/asn1/x_x509.c @@ -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) { diff --git a/crypto/bio/bss_conn.c b/crypto/bio/bss_conn.c index a608d81c7f..bfb2b57713 100644 --- a/crypto/bio/bss_conn.c +++ b/crypto/bio/bss_conn.c @@ -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; diff --git a/crypto/dh/dh.h b/crypto/dh/dh.h index 312340e9f3..991a018ef2 100644 --- a/crypto/dh/dh.h +++ b/crypto/dh/dh.h @@ -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); diff --git a/crypto/dsa/dsa.h b/crypto/dsa/dsa.h index 068e18cb18..8eec737e38 100644 --- a/crypto/dsa/dsa.h +++ b/crypto/dsa/dsa.h @@ -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); diff --git a/crypto/ec/ec.h b/crypto/ec/ec.h index b3267df62b..d60b4c1e83 100644 --- a/crypto/ec/ec.h +++ b/crypto/ec/ec.h @@ -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 diff --git a/crypto/engine/eng_ctrl.c b/crypto/engine/eng_ctrl.c index 18527484ce..4455ef6b95 100644 --- a/crypto/engine/eng_ctrl.c +++ b/crypto/engine/eng_ctrl.c @@ -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; diff --git a/crypto/engine/enginetest.c b/crypto/engine/enginetest.c index c2d0297392..cf82f490db 100644 --- a/crypto/engine/enginetest.c +++ b/crypto/engine/enginetest.c @@ -72,7 +72,7 @@ int main(int argc, char *argv[]) #include #include -static void display_engine_list() +static void display_engine_list(void) { ENGINE *h; int loop; diff --git a/crypto/err/err.c b/crypto/err/err.c index e28ec56ffa..655299a3a7 100644 --- a/crypto/err/err.c +++ b/crypto/err/err.c @@ -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]; diff --git a/crypto/evp/evp.h b/crypto/evp/evp.h index 70c79b3464..209e16c1be 100644 --- a/crypto/evp/evp.h +++ b/crypto/evp/evp.h @@ -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, \ diff --git a/crypto/evp/evp_pkey.c b/crypto/evp/evp_pkey.c index e752c2073a..7570a6eee6 100644 --- a/crypto/evp/evp_pkey.c +++ b/crypto/evp/evp_pkey.c @@ -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; diff --git a/crypto/lhash/lhash.c b/crypto/lhash/lhash.c index 9856c26d43..d952b71d1d 100644 --- a/crypto/lhash/lhash.c +++ b/crypto/lhash/lhash.c @@ -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++; diff --git a/crypto/ocsp/ocsp.h b/crypto/ocsp/ocsp.h index fab3c03182..37375c15d3 100644 --- a/crypto/ocsp/ocsp.h +++ b/crypto/ocsp/ocsp.h @@ -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); diff --git a/crypto/ocsp/ocsp_ext.c b/crypto/ocsp/ocsp_ext.c index 57399433fc..658a89161f 100644 --- a/crypto/ocsp/ocsp_ext.c +++ b/crypto/ocsp/ocsp_ext.c @@ -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: diff --git a/crypto/pem/pem.h b/crypto/pem/pem.h index ce5b75c315..9a5fa03e2a 100644 --- a/crypto/pem/pem.h +++ b/crypto/pem/pem.h @@ -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 diff --git a/crypto/pem/pem_all.c b/crypto/pem/pem_all.c index a4357d591c..a9ac52de02 100644 --- a/crypto/pem/pem_all.c +++ b/crypto/pem/pem_all.c @@ -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 diff --git a/crypto/pem/pem_info.c b/crypto/pem/pem_info.c index 7eba3b26c1..b9e2ab51f3 100644 --- a/crypto/pem/pem_info.c +++ b/crypto/pem/pem_info.c @@ -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; diff --git a/crypto/pem/pem_lib.c b/crypto/pem/pem_lib.c index ae0a87e978..6e1bb4a62a 100644 --- a/crypto/pem/pem_lib.c +++ b/crypto/pem/pem_lib.c @@ -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; diff --git a/crypto/pem/pem_oth.c b/crypto/pem/pem_oth.c index 8d9064ea7c..a5e9204590 100644 --- a/crypto/pem/pem_oth.c +++ b/crypto/pem/pem_oth.c @@ -67,10 +67,12 @@ /* 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; diff --git a/crypto/pkcs7/pk7_mime.c b/crypto/pkcs7/pk7_mime.c index 210ec1e8c4..d4b98fda37 100644 --- a/crypto/pkcs7/pk7_mime.c +++ b/crypto/pkcs7/pk7_mime.c @@ -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) diff --git a/crypto/rsa/rsa.h b/crypto/rsa/rsa.h index 00a7873f92..4bfd51a4bb 100644 --- a/crypto/rsa/rsa.h +++ b/crypto/rsa/rsa.h @@ -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 */ diff --git a/crypto/rsa/rsa_asn1.c b/crypto/rsa/rsa_asn1.c index 1455a7e0e4..bbbf26d50e 100644 --- a/crypto/rsa/rsa_asn1.c +++ b/crypto/rsa/rsa_asn1.c @@ -63,10 +63,10 @@ #include 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) { diff --git a/crypto/stack/safestack.h b/crypto/stack/safestack.h index 6d6739eae1..b50149dd96 100644 --- a/crypto/stack/safestack.h +++ b/crypto/stack/safestack.h @@ -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)) diff --git a/crypto/txt_db/txt_db.c b/crypto/txt_db/txt_db.c index 58b300b00b..b3a7a42ca0 100644 --- a/crypto/txt_db/txt_db.c +++ b/crypto/txt_db/txt_db.c @@ -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= 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; idata,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); diff --git a/crypto/txt_db/txt_db.h b/crypto/txt_db/txt_db.h index c98e287703..307e1ba23f 100644 --- a/crypto/txt_db/txt_db.h +++ b/crypto/txt_db/txt_db.h @@ -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); diff --git a/crypto/ui/ui.h b/crypto/ui/ui.h index 59da88ea02..018296412b 100644 --- a/crypto/ui/ui.h +++ b/crypto/ui/ui.h @@ -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 diff --git a/crypto/ui/ui_lib.c b/crypto/ui/ui_lib.c index dbc9711a2d..2d0d98926d 100644 --- a/crypto/ui/ui_lib.c +++ b/crypto/ui/ui_lib.c @@ -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) { diff --git a/crypto/x509/x509.h b/crypto/x509/x509.h index 4c7d91452a..2afbcfd04a 100644 --- a/crypto/x509/x509.h +++ b/crypto/x509/x509.h @@ -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); diff --git a/crypto/x509/x509_vfy.c b/crypto/x509/x509_vfy.c index ffc07cce6f..431a620618 100644 --- a/crypto/x509/x509_vfy.c +++ b/crypto/x509/x509_vfy.c @@ -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; diff --git a/crypto/x509/x_all.c b/crypto/x509/x_all.c index 4701959b1e..84ec5d5098 100644 --- a/crypto/x509/x_all.c +++ b/crypto/x509/x_all.c @@ -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); } diff --git a/engines/vendor_defns/aep.h b/engines/vendor_defns/aep.h index 2b2792d2d6..5e9754fe43 100644 --- a/engines/vendor_defns/aep.h +++ b/engines/vendor_defns/aep.h @@ -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)); diff --git a/engines/vendor_defns/sureware.h b/engines/vendor_defns/sureware.h index 4bc22027f9..e46b000ddc 100644 --- a/engines/vendor_defns/sureware.h +++ b/engines/vendor_defns/sureware.h @@ -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: diff --git a/ssl/bio_ssl.c b/ssl/bio_ssl.c index d683ee43e1..1db216be8b 100644 --- a/ssl/bio_ssl.c +++ b/ssl/bio_ssl.c @@ -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; diff --git a/ssl/s23_lib.c b/ssl/s23_lib.c index 8d7dbcf569..bcfda91fe5 100644 --- a/ssl/s23_lib.c +++ b/ssl/s23_lib.c @@ -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, }; diff --git a/ssl/s2_lib.c b/ssl/s2_lib.c index b89b83f4f8..6f7d11f0dd 100644 --- a/ssl/s2_lib.c +++ b/ssl/s2_lib.c @@ -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); } diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c index bbca61f3ff..345f74bea0 100644 --- a/ssl/s3_lib.c +++ b/ssl/s3_lib.c @@ -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; diff --git a/ssl/ssl.h b/ssl/ssl.h index 185d4b790e..df9acf9828 100644 --- 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 diff --git a/ssl/ssl_asn1.c b/ssl/ssl_asn1.c index 9667d0b826..c2fa410ce4 100644 --- a/ssl/ssl_asn1.c +++ b/ssl/ssl_asn1.c @@ -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 diff --git a/ssl/ssl_err.c b/ssl/ssl_err.c index 2472b4dfad..66bc5c2c3a 100644 --- a/ssl/ssl_err.c +++ b/ssl/ssl_err.c @@ -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"}, diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index 2351279f0e..71d4f64975 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -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); } diff --git a/ssl/ssl_locl.h b/ssl/ssl_locl.h index 6dac9d81a0..fcbfb161aa 100644 --- a/ssl/ssl_locl.h +++ b/ssl/ssl_locl.h @@ -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); diff --git a/ssl/t1_lib.c b/ssl/t1_lib.c index ca6c03d5af..447fc0d399 100644 --- a/ssl/t1_lib.c +++ b/ssl/t1_lib.c @@ -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, }; diff --git a/test/Makefile b/test/Makefile index 9fd937aabf..27d1469b4c 100644 --- a/test/Makefile +++ b/test/Makefile @@ -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