summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Laurie <ben@openssl.org>2005-03-31 09:26:39 +0000
committerBen Laurie <ben@openssl.org>2005-03-31 09:26:39 +0000
commit41a15c4f0f2535591ba9f258cf76119f86477c43 (patch)
tree6aca3f255f97dc3e9bd18884beeddf7de26fa122
parentfea4280a8b1a37bfe1ae6ffaede58722ad71afa1 (diff)
Give everything prototypes (well, everything that's actually used).
-rw-r--r--CHANGES5
-rw-r--r--apps/progs.h2
-rw-r--r--apps/s_apps.h2
-rw-r--r--apps/s_socket.c2
-rw-r--r--apps/sess_id.c2
-rw-r--r--apps/x509.c3
-rw-r--r--crypto/asn1/a_d2i_fp.c18
-rw-r--r--crypto/asn1/a_digest.c5
-rw-r--r--crypto/asn1/a_dup.c3
-rw-r--r--crypto/asn1/a_hdr.c4
-rw-r--r--crypto/asn1/a_i2d_fp.c6
-rw-r--r--crypto/asn1/a_meth.c16
-rw-r--r--crypto/asn1/a_set.c9
-rw-r--r--crypto/asn1/a_sign.c6
-rw-r--r--crypto/asn1/a_verify.c5
-rw-r--r--crypto/asn1/asn1.h80
-rw-r--r--crypto/asn1/asn1_gen.c6
-rw-r--r--crypto/asn1/asn1_mac.h4
-rw-r--r--crypto/asn1/asn_pack.c17
-rw-r--r--crypto/asn1/n_pkey.c23
-rw-r--r--crypto/asn1/p5_pbe.c3
-rw-r--r--crypto/asn1/p5_pbev2.c4
-rw-r--r--crypto/asn1/x_pkey.c4
-rw-r--r--crypto/asn1/x_x509.c12
-rw-r--r--crypto/bio/bss_conn.c4
-rw-r--r--crypto/dh/dh.h14
-rw-r--r--crypto/dsa/dsa.h9
-rw-r--r--crypto/ec/ec.h9
-rw-r--r--crypto/engine/eng_ctrl.c3
-rw-r--r--crypto/engine/enginetest.c2
-rw-r--r--crypto/err/err.c2
-rw-r--r--crypto/evp/evp.h23
-rw-r--r--crypto/evp/evp_pkey.c4
-rw-r--r--crypto/lhash/lhash.c2
-rw-r--r--crypto/ocsp/ocsp.h24
-rw-r--r--crypto/ocsp/ocsp_ext.c36
-rw-r--r--crypto/pem/pem.h85
-rw-r--r--crypto/pem/pem_all.c12
-rw-r--r--crypto/pem/pem_info.c17
-rw-r--r--crypto/pem/pem_lib.c19
-rw-r--r--crypto/pem/pem_oth.c8
-rw-r--r--crypto/pkcs7/pk7_mime.c3
-rw-r--r--crypto/rsa/rsa.h18
-rw-r--r--crypto/rsa/rsa_asn1.c8
-rw-r--r--crypto/stack/safestack.h2
-rw-r--r--crypto/txt_db/txt_db.c10
-rw-r--r--crypto/txt_db/txt_db.h4
-rw-r--r--crypto/ui/ui.h2
-rw-r--r--crypto/ui/ui_lib.c2
-rw-r--r--crypto/x509/x509.h17
-rw-r--r--crypto/x509/x509_vfy.c8
-rw-r--r--crypto/x509/x_all.c111
-rw-r--r--engines/vendor_defns/aep.h8
-rw-r--r--engines/vendor_defns/sureware.h2
-rw-r--r--ssl/bio_ssl.c4
-rw-r--r--ssl/s23_lib.c2
-rw-r--r--ssl/s2_lib.c6
-rw-r--r--ssl/s3_lib.c6
-rw-r--r--ssl/ssl.h28
-rw-r--r--ssl/ssl_asn1.c12
-rw-r--r--ssl/ssl_err.c3
-rw-r--r--ssl/ssl_lib.c26
-rw-r--r--ssl/ssl_locl.h11
-rw-r--r--ssl/t1_lib.c2
-rw-r--r--test/Makefile14
65 files changed, 464 insertions, 359 deletions
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 <openssl/asn1.h>
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 c