1 Index: openssl-0.9.8e/crypto/asn1/asn1.h
2 ===================================================================
3 --- openssl-0.9.8e.orig/crypto/asn1/asn1.h 2007-06-28 22:59:12.856745040 +0200
4 +++ openssl-0.9.8e/crypto/asn1/asn1.h 2007-06-28 23:00:11.137884960 +0200
6 #define I2D_OF(type) int (*)(type *,unsigned char **)
7 #define I2D_OF_const(type) int (*)(const type *,unsigned char **)
9 +#define CHECKED_D2I_OF(type, d2i) \
10 + ((d2i_of_void*) (1 ? d2i : ((D2I_OF(type))0)))
11 +#define CHECKED_I2D_OF(type, i2d) \
12 + ((i2d_of_void*) (1 ? i2d : ((I2D_OF(type))0)))
13 +#define CHECKED_NEW_OF(type, xnew) \
14 + ((void *(*)(void)) (1 ? xnew : ((type *(*)(void))0)))
15 +#define CHECKED_PTR_OF(type, p) \
16 + ((void*) (1 ? p : (type*)0))
17 +#define CHECKED_PPTR_OF(type, p) \
18 + ((void**) (1 ? p : (type**)0))
20 #define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const unsigned char **,long)
21 #define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type(type *,unsigned char **)
22 #define TYPEDEF_D2I2D_OF(type) TYPEDEF_D2I_OF(type); TYPEDEF_I2D_OF(type)
25 /* Used to implement other functions */
26 void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, char *x);
28 #define ASN1_dup_of(type,i2d,d2i,x) \
29 - ((type *(*)(I2D_OF(type),D2I_OF(type),type *))openssl_fcast(ASN1_dup))(i2d,d2i,x)
30 + ((type*)ASN1_dup(CHECKED_I2D_OF(type, i2d), \
31 + CHECKED_D2I_OF(type, d2i), \
32 + CHECKED_PTR_OF(type, x)))
34 #define ASN1_dup_of_const(type,i2d,d2i,x) \
35 - ((type *(*)(I2D_OF_const(type),D2I_OF(type),type *))openssl_fcast(ASN1_dup))(i2d,d2i,x)
36 + ((type*)ASN1_dup(CHECKED_I2D_OF(const type, i2d), \
37 + CHECKED_D2I_OF(type, d2i), \
38 + CHECKED_PTR_OF(const type, x)))
40 void *ASN1_item_dup(const ASN1_ITEM *it, void *x);
42 #ifndef OPENSSL_NO_FP_API
43 void *ASN1_d2i_fp(void *(*xnew)(void), d2i_of_void *d2i, FILE *in, void **x);
45 #define ASN1_d2i_fp_of(type,xnew,d2i,in,x) \
46 - ((type *(*)(type *(*)(void),D2I_OF(type),FILE *,type **))openssl_fcast(ASN1_d2i_fp))(xnew,d2i,in,x)
47 + ((type*)ASN1_d2i_fp(CHECKED_NEW_OF(type, xnew), \
48 + CHECKED_D2I_OF(type, d2i), \
50 + CHECKED_PPTR_OF(type, x)))
52 void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x);
53 int ASN1_i2d_fp(i2d_of_void *i2d,FILE *out,void *x);
55 #define ASN1_i2d_fp_of(type,i2d,out,x) \
56 - ((int (*)(I2D_OF(type),FILE *,type *))openssl_fcast(ASN1_i2d_fp))(i2d,out,x)
57 + (ASN1_i2d_fp(CHECKED_I2D_OF(type, i2d), \
59 + CHECKED_PTR_OF(type, x)))
61 #define ASN1_i2d_fp_of_const(type,i2d,out,x) \
62 - ((int (*)(I2D_OF_const(type),FILE *,type *))openssl_fcast(ASN1_i2d_fp))(i2d,out,x)
63 + (ASN1_i2d_fp(CHECKED_I2D_OF(const type, i2d), \
65 + CHECKED_PTR_OF(const type, x)))
67 int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x);
68 int ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags);
72 #ifndef OPENSSL_NO_BIO
73 void *ASN1_d2i_bio(void *(*xnew)(void), d2i_of_void *d2i, BIO *in, void **x);
75 #define ASN1_d2i_bio_of(type,xnew,d2i,in,x) \
76 - ((type *(*)(type *(*)(void),D2I_OF(type),BIO *,type **))openssl_fcast(ASN1_d2i_bio))(xnew,d2i,in,x)
77 + ((type*)ASN1_d2i_bio( CHECKED_NEW_OF(type, xnew), \
78 + CHECKED_D2I_OF(type, d2i), \
80 + CHECKED_PPTR_OF(type, x)))
82 void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x);
83 int ASN1_i2d_bio(i2d_of_void *i2d,BIO *out, unsigned char *x);
85 #define ASN1_i2d_bio_of(type,i2d,out,x) \
86 - ((int (*)(I2D_OF(type),BIO *,type *))openssl_fcast(ASN1_i2d_bio))(i2d,out,x)
87 + (ASN1_i2d_bio(CHECKED_I2D_OF(type, i2d), \
89 + CHECKED_PTR_OF(type, x)))
91 #define ASN1_i2d_bio_of_const(type,i2d,out,x) \
92 - ((int (*)(I2D_OF_const(type),BIO *,const type *))openssl_fcast(ASN1_i2d_bio))(i2d,out,x)
93 + (ASN1_i2d_bio(CHECKED_I2D_OF(const type, i2d), \
95 + CHECKED_PTR_OF(const type, x)))
97 int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x);
98 int ASN1_UTCTIME_print(BIO *fp,ASN1_UTCTIME *a);
99 int ASN1_GENERALIZEDTIME_print(BIO *fp,ASN1_GENERALIZEDTIME *a);
100 @@ -977,8 +1018,12 @@
101 void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it);
102 ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d,
103 ASN1_OCTET_STRING **oct);
105 #define ASN1_pack_string_of(type,obj,i2d,oct) \
106 - ((ASN1_STRING *(*)(type *,I2D_OF(type),ASN1_OCTET_STRING **))openssl_fcast(ASN1_pack_string))(obj,i2d,oct)
107 + (ASN1_pack_string(CHECKED_PTR_OF(type, obj), \
108 + CHECKED_I2D_OF(type, i2d), \
111 ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_OCTET_STRING **oct);
113 void ASN1_STRING_set_default_mask(unsigned long mask);
114 Index: openssl-0.9.8e/crypto/pem/pem.h
115 ===================================================================
116 --- openssl-0.9.8e.orig/crypto/pem/pem.h 2007-06-28 22:59:46.719597104 +0200
117 +++ openssl-0.9.8e/crypto/pem/pem.h 2007-06-28 23:00:11.138884808 +0200
118 @@ -220,19 +220,28 @@
119 #define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \
120 type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u)\
122 -return(((type *(*)(D2I_OF(type),char *,FILE *,type **,pem_password_cb *,void *))openssl_fcast(PEM_ASN1_read))(d2i_##asn1, str,fp,x,cb,u)); \
123 + return (type*)PEM_ASN1_read(CHECKED_D2I_OF(type, d2i_##asn1), \
125 + CHECKED_PPTR_OF(type, x), \
129 #define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \
130 int PEM_write_##name(FILE *fp, type *x) \
132 -return(((int (*)(I2D_OF(type),const char *,FILE *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write))(i2d_##asn1,str,fp,x,NULL,NULL,0,NULL,NULL)); \
133 + return PEM_ASN1_write(CHECKED_I2D_OF(type, i2d_##asn1), \
135 + CHECKED_PTR_OF(type, x), \
136 + NULL, NULL, 0, NULL, NULL); \
139 #define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \
140 int PEM_write_##name(FILE *fp, const type *x) \
142 -return(((int (*)(I2D_OF_const(type),const char *,FILE *, const type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write))(i2d_##asn1,str,fp,x,NULL,NULL,0,NULL,NULL)); \
143 + return PEM_ASN1_write(CHECKED_I2D_OF(const type, i2d_##asn1), \
145 + CHECKED_PTR_OF(const type, x), \
146 + NULL, NULL, 0, NULL, NULL); \
149 #define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \
151 unsigned char *kstr, int klen, pem_password_cb *cb, \
154 - return(((int (*)(I2D_OF(type),const char *,FILE *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write))(i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u)); \
155 + return PEM_ASN1_write(CHECKED_I2D_OF(type, i2d_##asn1), \
157 + CHECKED_PTR_OF(type, x), \
158 + enc, kstr, klen, cb, u); \
161 #define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \
163 unsigned char *kstr, int klen, pem_password_cb *cb, \
166 - return(((int (*)(I2D_OF_const(type),const char *,FILE *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write))(i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u)); \
167 + return PEM_ASN1_write(CHECKED_I2D_OF(const type, i2d_##asn1), \
169 + CHECKED_PTR_OF(const type, x), \
170 + enc, kstr, klen, cb, u); \
174 @@ -256,33 +271,48 @@
175 #define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \
176 type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u)\
178 -return(((type *(*)(D2I_OF(type),const char *,BIO *,type **,pem_password_cb *,void *))openssl_fcast(PEM_ASN1_read_bio))(d2i_##asn1, str,bp,x,cb,u)); \
179 + return (type*)PEM_ASN1_read_bio(CHECKED_D2I_OF(type, d2i_##asn1), \
181 + CHECKED_PPTR_OF(type, x), \
185 #define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \
186 int PEM_write_bio_##name(BIO *bp, type *x) \
188 -return(((int (*)(I2D_OF(type),const char *,BIO *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write_bio))(i2d_##asn1,str,bp,x,NULL,NULL,0,NULL,NULL)); \
189 + return PEM_ASN1_write_bio(CHECKED_I2D_OF(type, i2d_##asn1), \
191 + CHECKED_PTR_OF(type, x), \
192 + NULL, NULL, 0, NULL, NULL); \
195 #define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \
196 int PEM_write_bio_##name(BIO *bp, const type *x) \
198 -return(((int (*)(I2D_OF_const(type),const char *,BIO *,const type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write_bio))(i2d_##asn1,str,bp,x,NULL,NULL,0,NULL,NULL)); \
199 + return PEM_ASN1_write_bio(CHECKED_I2D_OF(const type, i2d_##asn1), \
201 + CHECKED_PTR_OF(const type, x), \
202 + NULL, NULL, 0, NULL, NULL); \
205 #define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \
206 int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
207 unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \
209 - return(((int (*)(I2D_OF(type),const char *,BIO *,type *,const EVP_CIPHER *,unsigned char *,int,pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write_bio))(i2d_##asn1,str,bp,x,enc,kstr,klen,cb,u)); \
210 + return PEM_ASN1_write_bio(CHECKED_I2D_OF(type, i2d_##asn1), \
212 + CHECKED_PTR_OF(type, x), \
213 + enc, kstr, klen, cb, u); \
216 #define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \
217 int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
218 unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \
220 - return(((int (*)(I2D_OF_const(type),const char *,BIO *,type *,const EVP_CIPHER *,unsigned char *,int,pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write_bio))(i2d_##asn1,str,bp,x,enc,kstr,klen,cb,u)); \
221 + return PEM_ASN1_write_bio(CHECKED_I2D_OF(const type, i2d_##asn1), \
223 + CHECKED_PTR_OF(const type, x), \
224 + enc, kstr, klen, cb, u); \
227 #define IMPLEMENT_PEM_write(name, type, str, asn1) \
228 @@ -545,13 +575,22 @@
229 pem_password_cb *cb, void *u);
230 void * PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp,
231 void **x, pem_password_cb *cb, void *u);
233 #define PEM_ASN1_read_bio_of(type,d2i,name,bp,x,cb,u) \
234 -((type *(*)(D2I_OF(type),const char *,BIO *,type **,pem_password_cb *,void *))openssl_fcast(PEM_ASN1_read_bio))(d2i,name,bp,x,cb,u)
235 + ((type*)PEM_ASN1_read_bio(CHECKED_D2I_OF(type, d2i), \
237 + CHECKED_PPTR_OF(type, x), \
240 int PEM_ASN1_write_bio(i2d_of_void *i2d,const char *name,BIO *bp,char *x,
241 const EVP_CIPHER *enc,unsigned char *kstr,int klen,
242 pem_password_cb *cb, void *u);
244 #define PEM_ASN1_write_bio_of(type,i2d,name,bp,x,enc,kstr,klen,cb,u) \
245 - ((int (*)(I2D_OF(type),const char *,BIO *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write_bio))(i2d,name,bp,x,enc,kstr,klen,cb,u)
246 + (PEM_ASN1_write_bio(CHECKED_I2D_OF(type, i2d), \
248 + CHECKED_PTR_OF(type, x), \
249 + enc, kstr, klen, cb, u))
251 STACK_OF(X509_INFO) * PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u);
252 int PEM_X509_INFO_write_bio(BIO *bp,X509_INFO *xi, EVP_CIPHER *enc,