[kernel] the hash_conntrack is no longer broken on ARM since 2.6.25.4
[openwrt/svn-archive/archive.git] / package / openssl / patches / 180-gcc_breakage.patch
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
5 @@ -322,6 +322,17 @@
6 #define I2D_OF(type) int (*)(type *,unsigned char **)
7 #define I2D_OF_const(type) int (*)(const type *,unsigned char **)
8
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))
19 +
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)
23 @@ -902,23 +913,41 @@
24
25 /* Used to implement other functions */
26 void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, char *x);
27 +
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)))
33 +
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)))
39
40 void *ASN1_item_dup(const ASN1_ITEM *it, void *x);
41
42 #ifndef OPENSSL_NO_FP_API
43 void *ASN1_d2i_fp(void *(*xnew)(void), d2i_of_void *d2i, FILE *in, void **x);
44 +
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), \
49 + in, \
50 + CHECKED_PPTR_OF(type, x)))
51 +
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);
54 +
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), \
58 + out, \
59 + CHECKED_PTR_OF(type, x)))
60 +
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), \
64 + out, \
65 + CHECKED_PTR_OF(const type, x)))
66 +
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);
69 #endif
70 @@ -927,14 +956,26 @@
71
72 #ifndef OPENSSL_NO_BIO
73 void *ASN1_d2i_bio(void *(*xnew)(void), d2i_of_void *d2i, BIO *in, void **x);
74 +
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), \
79 + in, \
80 + CHECKED_PPTR_OF(type, x)))
81 +
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);
84 +
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), \
88 + out, \
89 + CHECKED_PTR_OF(type, x)))
90 +
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), \
94 + out, \
95 + CHECKED_PTR_OF(const type, x)))
96 +
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);
104 +
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), \
109 + oct))
110 +
111 ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_OCTET_STRING **oct);
112
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)\
121 { \
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), \
124 + str, fp, \
125 + CHECKED_PPTR_OF(type, x), \
126 + cb, u); \
127 }
128
129 #define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \
130 int PEM_write_##name(FILE *fp, type *x) \
131 { \
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), \
134 + str, fp, \
135 + CHECKED_PTR_OF(type, x), \
136 + NULL, NULL, 0, NULL, NULL); \
137 }
138
139 #define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \
140 int PEM_write_##name(FILE *fp, const type *x) \
141 { \
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), \
144 + str, fp, \
145 + CHECKED_PTR_OF(const type, x), \
146 + NULL, NULL, 0, NULL, NULL); \
147 }
148
149 #define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \
150 @@ -240,7 +249,10 @@
151 unsigned char *kstr, int klen, pem_password_cb *cb, \
152 void *u) \
153 { \
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), \
156 + str, fp, \
157 + CHECKED_PTR_OF(type, x), \
158 + enc, kstr, klen, cb, u); \
159 }
160
161 #define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \
162 @@ -248,7 +260,10 @@
163 unsigned char *kstr, int klen, pem_password_cb *cb, \
164 void *u) \
165 { \
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), \
168 + str, fp, \
169 + CHECKED_PTR_OF(const type, x), \
170 + enc, kstr, klen, cb, u); \
171 }
172
173 #endif
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)\
177 { \
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), \
180 + str, bp, \
181 + CHECKED_PPTR_OF(type, x), \
182 + cb, u); \
183 }
184
185 #define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \
186 int PEM_write_bio_##name(BIO *bp, type *x) \
187 { \
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), \
190 + str, bp, \
191 + CHECKED_PTR_OF(type, x), \
192 + NULL, NULL, 0, NULL, NULL); \
193 }
194
195 #define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \
196 int PEM_write_bio_##name(BIO *bp, const type *x) \
197 { \
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), \
200 + str, bp, \
201 + CHECKED_PTR_OF(const type, x), \
202 + NULL, NULL, 0, NULL, NULL); \
203 }
204
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) \
208 { \
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), \
211 + str, bp, \
212 + CHECKED_PTR_OF(type, x), \
213 + enc, kstr, klen, cb, u); \
214 }
215
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) \
219 { \
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), \
222 + str, bp, \
223 + CHECKED_PTR_OF(const type, x), \
224 + enc, kstr, klen, cb, u); \
225 }
226
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);
232 +
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), \
236 + name, bp, \
237 + CHECKED_PPTR_OF(type, x), \
238 + cb, u))
239 +
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);
243 +
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), \
247 + name, bp, \
248 + CHECKED_PTR_OF(type, x), \
249 + enc, kstr, klen, cb, u))
250
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,