We use the following gcc flags for our internal programs ---------------------------------------------------------------------- -Wmissing-prototypes -Wcomment -Wformat -Wimplicit -Wmain -Wmultichar -Wswitch -Wshadow -Wtrigraphs -Werror -Wchar-subscripts -Wstrict-prototypes -Wreturn-type -Wpointer-arith -W -Wunused -Wno-unused-parameter -Wuninitialized ----------------------------------------------------------------------
But using these flags we cannot compile our programs if they use OpenSSL, since the openssl include files have missing function prototypes. I have included `diff`s which fix this problem. However, I need to confess two problems There are cases where there are opaque data mismatches (e.g. RSA* for one function, DSA* for another, which both get stored in the same function pointer). gcc doesn't allow equivalent pointers in prototypes to be compatable function pointers. What needs to be done is to make all of these functions use void* and have the first line of the programs create the current properly typed variable, but I didn't have time to resolve all of the second level dependencies. I was willing to take openssl warnings to reduce warnings everywhere else, but I will understand if you don't feel that way. In addition, there were a few cases where I could not find user of some function pointers, so I used (void), but it is possible I just missed some. After I ran into too many of the pointer problems above, I gave up checking the incompatible pointers to find if I missed more. Index: crypto/asn1/asn1.h =================================================================== RCS file: /src/cvs/openssl/crypto/asn1/asn1.h,v retrieving revision 1.1.1.1 diff -u -u -r1.1.1.1 asn1.h --- crypto/asn1/asn1.h 15 Mar 2003 02:39:34 -0000 1.1.1.1 +++ crypto/asn1/asn1.h 15 Mar 2003 03:28:56 -0000 @@ -475,10 +475,10 @@ typedef struct asn1_method_st { - int (*i2d)(); - char *(*d2i)(); - char *(*create)(); - void (*destroy)(); + int (*i2d)(void *a, unsigned char **zz); + char *(*d2i)(void **a, unsigned char **zz, long len); + char *(*create)(void); + void (*destroy)(void *r); } ASN1_METHOD; /* This is used when parsing some Netscape objects */ @@ -797,9 +797,9 @@ 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); + int (*func)(void), 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)(void *), + char *(*func)(void), void (*free_func)(void *), int ex_tag, int ex_class); #ifndef OPENSSL_NO_BIO @@ -851,14 +851,14 @@ int ASN1_object_size(int constructed, int length, int tag); /* Used to implement other functions */ -char *ASN1_dup(int (*i2d)(),char *(*d2i)(),char *x); +char *ASN1_dup(int (*i2d)(void *a, unsigned char **zz),char *(*d2i)(void **a, unsigned char **zz, long len),char *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); +char *ASN1_d2i_fp(char *(*xnew)(void),char *(*d2i)(void **a, unsigned char **zz, long len),FILE *fp,unsigned char **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 *a, unsigned char **zz),FILE *out,unsigned char *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 @@ -866,9 +866,9 @@ 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(char *(*xnew)(void),char *(*d2i)(void **a, unsigned char **zz, long len),BIO *bp,unsigned char **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 *a, unsigned char **zz),BIO *out,unsigned char *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); @@ -903,13 +903,13 @@ 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)(), +STACK *ASN1_seq_unpack(unsigned char *buf, int len, char *(*d2i)(void **a, unsigned char **zz, long len), void (*free_func)(void *) ); -unsigned char *ASN1_seq_pack(STACK *safes, int (*i2d)(), unsigned char **buf, +unsigned char *ASN1_seq_pack(STACK *safes, int (*i2d)(void *a, unsigned char **zz), unsigned char **buf, int *len ); -void *ASN1_unpack_string(ASN1_STRING *oct, char *(*d2i)()); +void *ASN1_unpack_string(ASN1_STRING *oct, char *(*d2i)(void **a, unsigned char **zz, long len)); 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 *a, unsigned char **zz), ASN1_OCTET_STRING **oct); ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_OCTET_STRING **oct); void ASN1_STRING_set_default_mask(unsigned long mask); Index: crypto/comp/comp.h =================================================================== RCS file: /src/cvs/openssl/crypto/comp/comp.h,v retrieving revision 1.1.1.1 diff -u -u -r1.1.1.1 comp.h --- crypto/comp/comp.h 15 Mar 2003 02:39:35 -0000 1.1.1.1 +++ crypto/comp/comp.h 15 Mar 2003 03:04:23 -0000 @@ -8,16 +8,18 @@ extern "C" { #endif +struct comp_ctx_st; // Forward reference + typedef struct comp_method_st { int type; /* NID for compression library */ const char *name; /* A text string to identify the library */ - int (*init)(); - void (*finish)(); - int (*compress)(); - int (*expand)(); - long (*ctrl)(); - long (*callback_ctrl)(); + int (*init)(struct comp_ctx_st *ctx); + void (*finish)(struct comp_ctx_st *ctx); + int (*compress)(struct comp_ctx_st *ctx, unsigned char *out, unsigned int olen, unsigned char *in, unsigned int ilen); + int (*expand)(struct comp_ctx_st *ctx, unsigned char *out, unsigned int olen, unsigned char *in, unsigned int ilen); + long (*ctrl)(void); + long (*callback_ctrl)(void); } COMP_METHOD; typedef struct comp_ctx_st Index: crypto/evp/evp.h =================================================================== RCS file: /src/cvs/openssl/crypto/evp/evp.h,v retrieving revision 1.1.1.1 diff -u -u -r1.1.1.1 evp.h --- crypto/evp/evp.h 15 Mar 2003 02:39:35 -0000 1.1.1.1 +++ crypto/evp/evp.h 15 Mar 2003 03:51:21 -0000 @@ -281,8 +281,8 @@ 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 mlen, unsigned char *sigret, unsigned int *siglen, void *ptr); + int (*verify)(int type, const unsigned char *m, unsigned int mlen, unsigned char *sigret, unsigned int siglen, void *ptr); int required_pkey_type[5]; /*EVP_PKEY_xxx */ int block_size; int ctx_size; /* how big does the ctx->md_data need to be */ Index: crypto/pem/pem.h =================================================================== RCS file: /src/cvs/openssl/crypto/pem/pem.h,v retrieving revision 1.1.1.1 diff -u -u -r1.1.1.1 pem.h --- crypto/pem/pem.h 15 Mar 2003 02:39:36 -0000 1.1.1.1 +++ crypto/pem/pem.h 15 Mar 2003 03:36:52 -0000 @@ -494,9 +494,9 @@ 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, +char * PEM_ASN1_read_bio(char *(*d2i)(void **a, unsigned char **zz, long len),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, +int PEM_ASN1_write_bio(int (*i2d)(void *a, unsigned char **zz),const char *name,BIO *bp,char *x, const EVP_CIPHER *enc,unsigned char *kstr,int klen, pem_password_cb *cb, void *u); STACK_OF(X509_INFO) * PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u); @@ -508,9 +508,9 @@ 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, +char * PEM_ASN1_read(char *(*d2i)(void **a, unsigned char **zz, long len),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, +int PEM_ASN1_write(int (*i2d)(void *a, unsigned char **zz),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, Index: crypto/rsa/rsa.h =================================================================== RCS file: /src/cvs/openssl/crypto/rsa/rsa.h,v retrieving revision 1.1.1.1 diff -u -u -r1.1.1.1 rsa.h --- crypto/rsa/rsa.h 15 Mar 2003 02:39:36 -0000 1.1.1.1 +++ crypto/rsa/rsa.h 15 Mar 2003 03:30:59 -0000 @@ -225,11 +225,11 @@ 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_RSA_NET(const RSA *a, unsigned char **pp, int (*cb)(unsigned char *buf, int, char *prompt, int x), int sgckey); +RSA *d2i_RSA_NET(RSA **a, const unsigned char **pp, long length, int (*cb)(unsigned char *buf, int, char *prompt, int x), 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_Netscape_RSA(const RSA *a, unsigned char **pp, int (*cb)(unsigned char *buf, int, char *prompt, int x)); +RSA *d2i_Netscape_RSA(RSA **a, const unsigned char **pp, long length, int (*cb)(unsigned char *buf, int, char *prompt, int x)); /* The following 2 functions sign and verify a X509_SIG ASN1 object * inside PKCS#1 padded RSA encryption */ Index: crypto/ui/ui.h =================================================================== RCS file: /src/cvs/openssl/crypto/ui/ui.h,v retrieving revision 1.1.1.1 diff -u -u -r1.1.1.1 ui.h --- crypto/ui/ui.h 15 Mar 2003 02:39:36 -0000 1.1.1.1 +++ crypto/ui/ui.h 15 Mar 2003 03:08:54 -0000 @@ -217,7 +217,7 @@ /* Give a user interface parametrised control commands. This can be used to send down an integer, a data pointer or a function pointer, as well as be used to get information from a UI. */ -int UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f)()); +int UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f)(void)); /* The commands */ /* Use UI_CONTROL_PRINT_ERRORS with the value 1 to have UI_process print the Index: crypto/x509/x509.h =================================================================== RCS file: /src/cvs/openssl/crypto/x509/x509.h,v retrieving revision 1.1.1.1 diff -u -u -r1.1.1.1 x509.h --- crypto/x509/x509.h 15 Mar 2003 02:39:36 -0000 1.1.1.1 +++ crypto/x509/x509.h 15 Mar 2003 03:35:53 -0000 @@ -117,8 +117,8 @@ typedef struct X509_objects_st { int nid; - int (*a2i)(); - int (*i2a)(); + int (*a2i)(void); + int (*i2a)(void); } X509_OBJECTS; struct X509_algor_st @@ -912,13 +912,13 @@ 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 *a, unsigned char **zz), X509_ALGOR *algor1, ASN1_BIT_STRING *signature,char *data,EVP_PKEY *pkey); -int ASN1_digest(int (*i2d)(),const EVP_MD *type,char *data, +int ASN1_digest(int (*i2d)(void *a, unsigned char **zz),const EVP_MD *type,char *data, unsigned char *md,unsigned int *len); -int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2, +int ASN1_sign(int (*i2d)(void *a, unsigned char **zz), X509_ALGOR *algor1, X509_ALGOR *algor2, ASN1_BIT_STRING *signature, char *data,EVP_PKEY *pkey, const EVP_MD *type); Index: ssl/ssl.h =================================================================== RCS file: /src/cvs/openssl/ssl/ssl.h,v retrieving revision 1.1.1.1 diff -u -u -r1.1.1.1 ssl.h --- ssl/ssl.h 15 Mar 2003 02:39:37 -0000 1.1.1.1 +++ ssl/ssl.h 15 Mar 2003 03:40:31 -0000 @@ -378,9 +378,9 @@ 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)(SSL *s); + 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 @@ -806,7 +806,7 @@ /* true when we are actually in SSL_accept() or SSL_connect() */ int in_handshake; - int (*handshake_func)(); + int (*handshake_func)(SSL *s); /* Imagine that here's a boolean member "init" that is * switched as soon as SSL_set_{accept/connect}_state @@ -1317,9 +1317,9 @@ 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(SSL *s,int ret_code); const char *SSL_get_version(SSL *s); ______________________________________________________________________ OpenSSL Project http://www.openssl.org Development Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]