blob: 2a60b8f9656307e62e74cdeed8e685f4a48069f2 [file] [log] [blame]
Adam Langley95c29f32014-06-20 12:00:00 -07001/* Copyright (c) 2014, Google Inc.
2 *
3 * Permission to use, copy, modify, and/or distribute this software for any
4 * purpose with or without fee is hereby granted, provided that the above
5 * copyright notice and this permission notice appear in all copies.
6 *
7 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
10 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
12 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
13 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
14
15#if !defined(IN_STACK_H)
16#error "Don't include this file directly. Include stack.h."
17#endif
18
19/* ACCESS_DESCRIPTION */
20#define sk_ACCESS_DESCRIPTION_new(comp) \
21 ((STACK_OF(ACCESS_DESCRIPTION) *)sk_new(CHECKED_CAST( \
22 stack_cmp_func, \
23 int (*)(const ACCESS_DESCRIPTION **a, const ACCESS_DESCRIPTION **b), \
24 comp)))
25
26#define sk_ACCESS_DESCRIPTION_new_null() \
27 ((STACK_OF(ACCESS_DESCRIPTION) *)sk_new_null())
28
29#define sk_ACCESS_DESCRIPTION_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -040030 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(ACCESS_DESCRIPTION) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -070031
32#define sk_ACCESS_DESCRIPTION_zero(sk) \
33 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk));
34
David Benjaminada97992016-05-13 13:14:28 -040035#define sk_ACCESS_DESCRIPTION_value(sk, i) \
36 ((ACCESS_DESCRIPTION *)sk_value( \
37 CHECKED_CAST(const _STACK *, const STACK_OF(ACCESS_DESCRIPTION) *, sk), \
38 (i)))
Adam Langley95c29f32014-06-20 12:00:00 -070039
40#define sk_ACCESS_DESCRIPTION_set(sk, i, p) \
41 ((ACCESS_DESCRIPTION *)sk_set( \
42 CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk), (i), \
43 CHECKED_CAST(void *, ACCESS_DESCRIPTION *, p)))
44
45#define sk_ACCESS_DESCRIPTION_free(sk) \
46 sk_free(CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk))
47
48#define sk_ACCESS_DESCRIPTION_pop_free(sk, free_func) \
49 sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk), \
50 CHECKED_CAST(void (*)(void *), void (*)(ACCESS_DESCRIPTION *), \
51 free_func))
52
53#define sk_ACCESS_DESCRIPTION_insert(sk, p, where) \
54 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk), \
55 CHECKED_CAST(void *, ACCESS_DESCRIPTION *, p), (where))
56
57#define sk_ACCESS_DESCRIPTION_delete(sk, where) \
58 ((ACCESS_DESCRIPTION *)sk_delete( \
59 CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk), (where)))
60
61#define sk_ACCESS_DESCRIPTION_delete_ptr(sk, p) \
62 ((ACCESS_DESCRIPTION *)sk_delete_ptr( \
63 CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk), \
64 CHECKED_CAST(void *, ACCESS_DESCRIPTION *, p)))
65
66#define sk_ACCESS_DESCRIPTION_find(sk, out_index, p) \
67 sk_find(CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk), \
68 (out_index), CHECKED_CAST(void *, ACCESS_DESCRIPTION *, p))
69
70#define sk_ACCESS_DESCRIPTION_shift(sk) \
71 ((ACCESS_DESCRIPTION *)sk_shift( \
72 CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk)))
73
74#define sk_ACCESS_DESCRIPTION_push(sk, p) \
75 sk_push(CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk), \
76 CHECKED_CAST(void *, ACCESS_DESCRIPTION *, p))
77
78#define sk_ACCESS_DESCRIPTION_pop(sk) \
79 ((ACCESS_DESCRIPTION *)sk_pop( \
80 CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk)))
81
82#define sk_ACCESS_DESCRIPTION_dup(sk) \
83 ((STACK_OF(ACCESS_DESCRIPTION) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -040084 CHECKED_CAST(const _STACK *, const STACK_OF(ACCESS_DESCRIPTION) *, sk)))
Adam Langley95c29f32014-06-20 12:00:00 -070085
86#define sk_ACCESS_DESCRIPTION_sort(sk) \
87 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk))
88
89#define sk_ACCESS_DESCRIPTION_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -040090 sk_is_sorted( \
91 CHECKED_CAST(const _STACK *, const STACK_OF(ACCESS_DESCRIPTION) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -070092
Adam Langley2d96a672015-02-11 14:28:41 -080093#define sk_ACCESS_DESCRIPTION_set_cmp_func(sk, comp) \
94 ((int (*)(const ACCESS_DESCRIPTION **a, const ACCESS_DESCRIPTION **b)) \
95 sk_set_cmp_func( \
96 CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk), \
97 CHECKED_CAST(stack_cmp_func, int (*)(const ACCESS_DESCRIPTION **a, \
98 const ACCESS_DESCRIPTION **b), \
99 comp)))
David Benjamin6f260012014-08-15 13:49:12 -0400100
Adam Langleya1048a72015-02-11 14:27:21 -0800101#define sk_ACCESS_DESCRIPTION_deep_copy(sk, copy_func, free_func) \
102 ((STACK_OF(ACCESS_DESCRIPTION) *)sk_deep_copy( \
103 CHECKED_CAST(const _STACK *, const STACK_OF(ACCESS_DESCRIPTION) *, sk), \
104 CHECKED_CAST(void *(*)(void *), \
105 ACCESS_DESCRIPTION *(*)(ACCESS_DESCRIPTION *), copy_func), \
106 CHECKED_CAST(void (*)(void *), void (*)(ACCESS_DESCRIPTION *), \
107 free_func)))
108
Adam Langley95c29f32014-06-20 12:00:00 -0700109/* ASN1_ADB_TABLE */
110#define sk_ASN1_ADB_TABLE_new(comp) \
111 ((STACK_OF(ASN1_ADB_TABLE) *)sk_new(CHECKED_CAST( \
112 stack_cmp_func, \
113 int (*)(const ASN1_ADB_TABLE **a, const ASN1_ADB_TABLE **b), comp)))
114
115#define sk_ASN1_ADB_TABLE_new_null() ((STACK_OF(ASN1_ADB_TABLE) *)sk_new_null())
116
117#define sk_ASN1_ADB_TABLE_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -0400118 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_ADB_TABLE) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -0700119
120#define sk_ASN1_ADB_TABLE_zero(sk) \
121 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk));
122
David Benjaminada97992016-05-13 13:14:28 -0400123#define sk_ASN1_ADB_TABLE_value(sk, i) \
124 ((ASN1_ADB_TABLE *)sk_value( \
125 CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_ADB_TABLE) *, sk), \
126 (i)))
Adam Langley95c29f32014-06-20 12:00:00 -0700127
128#define sk_ASN1_ADB_TABLE_set(sk, i, p) \
129 ((ASN1_ADB_TABLE *)sk_set( \
130 CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk), (i), \
131 CHECKED_CAST(void *, ASN1_ADB_TABLE *, p)))
132
133#define sk_ASN1_ADB_TABLE_free(sk) \
134 sk_free(CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk))
135
136#define sk_ASN1_ADB_TABLE_pop_free(sk, free_func) \
137 sk_pop_free( \
138 CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk), \
139 CHECKED_CAST(void (*)(void *), void (*)(ASN1_ADB_TABLE *), free_func))
140
141#define sk_ASN1_ADB_TABLE_insert(sk, p, where) \
142 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk), \
143 CHECKED_CAST(void *, ASN1_ADB_TABLE *, p), (where))
144
145#define sk_ASN1_ADB_TABLE_delete(sk, where) \
146 ((ASN1_ADB_TABLE *)sk_delete( \
147 CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk), (where)))
148
149#define sk_ASN1_ADB_TABLE_delete_ptr(sk, p) \
150 ((ASN1_ADB_TABLE *)sk_delete_ptr( \
151 CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk), \
152 CHECKED_CAST(void *, ASN1_ADB_TABLE *, p)))
153
154#define sk_ASN1_ADB_TABLE_find(sk, out_index, p) \
155 sk_find(CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk), (out_index), \
156 CHECKED_CAST(void *, ASN1_ADB_TABLE *, p))
157
158#define sk_ASN1_ADB_TABLE_shift(sk) \
159 ((ASN1_ADB_TABLE *)sk_shift( \
160 CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk)))
161
162#define sk_ASN1_ADB_TABLE_push(sk, p) \
163 sk_push(CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk), \
164 CHECKED_CAST(void *, ASN1_ADB_TABLE *, p))
165
166#define sk_ASN1_ADB_TABLE_pop(sk) \
167 ((ASN1_ADB_TABLE *)sk_pop( \
168 CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk)))
169
170#define sk_ASN1_ADB_TABLE_dup(sk) \
171 ((STACK_OF(ASN1_ADB_TABLE) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -0400172 CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_ADB_TABLE) *, sk)))
Adam Langley95c29f32014-06-20 12:00:00 -0700173
174#define sk_ASN1_ADB_TABLE_sort(sk) \
175 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk))
176
177#define sk_ASN1_ADB_TABLE_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -0400178 sk_is_sorted( \
179 CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_ADB_TABLE) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -0700180
Adam Langley2d96a672015-02-11 14:28:41 -0800181#define sk_ASN1_ADB_TABLE_set_cmp_func(sk, comp) \
182 ((int (*)(const ASN1_ADB_TABLE **a, const ASN1_ADB_TABLE **b)) \
183 sk_set_cmp_func( \
184 CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk), \
185 CHECKED_CAST(stack_cmp_func, int (*)(const ASN1_ADB_TABLE **a, \
186 const ASN1_ADB_TABLE **b), \
187 comp)))
David Benjamin6f260012014-08-15 13:49:12 -0400188
Adam Langleya1048a72015-02-11 14:27:21 -0800189#define sk_ASN1_ADB_TABLE_deep_copy(sk, copy_func, free_func) \
190 ((STACK_OF(ASN1_ADB_TABLE) *)sk_deep_copy( \
191 CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_ADB_TABLE) *, sk), \
192 CHECKED_CAST(void *(*)(void *), ASN1_ADB_TABLE *(*)(ASN1_ADB_TABLE *), \
193 copy_func), \
194 CHECKED_CAST(void (*)(void *), void (*)(ASN1_ADB_TABLE *), free_func)))
195
Adam Langley95c29f32014-06-20 12:00:00 -0700196/* ASN1_GENERALSTRING */
197#define sk_ASN1_GENERALSTRING_new(comp) \
198 ((STACK_OF(ASN1_GENERALSTRING) *)sk_new(CHECKED_CAST( \
199 stack_cmp_func, \
200 int (*)(const ASN1_GENERALSTRING **a, const ASN1_GENERALSTRING **b), \
201 comp)))
202
203#define sk_ASN1_GENERALSTRING_new_null() \
204 ((STACK_OF(ASN1_GENERALSTRING) *)sk_new_null())
205
206#define sk_ASN1_GENERALSTRING_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -0400207 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_GENERALSTRING) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -0700208
209#define sk_ASN1_GENERALSTRING_zero(sk) \
210 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk));
211
David Benjaminada97992016-05-13 13:14:28 -0400212#define sk_ASN1_GENERALSTRING_value(sk, i) \
213 ((ASN1_GENERALSTRING *)sk_value( \
214 CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_GENERALSTRING) *, sk), \
215 (i)))
Adam Langley95c29f32014-06-20 12:00:00 -0700216
217#define sk_ASN1_GENERALSTRING_set(sk, i, p) \
218 ((ASN1_GENERALSTRING *)sk_set( \
219 CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk), (i), \
220 CHECKED_CAST(void *, ASN1_GENERALSTRING *, p)))
221
222#define sk_ASN1_GENERALSTRING_free(sk) \
223 sk_free(CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk))
224
225#define sk_ASN1_GENERALSTRING_pop_free(sk, free_func) \
226 sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk), \
227 CHECKED_CAST(void (*)(void *), void (*)(ASN1_GENERALSTRING *), \
228 free_func))
229
230#define sk_ASN1_GENERALSTRING_insert(sk, p, where) \
231 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk), \
232 CHECKED_CAST(void *, ASN1_GENERALSTRING *, p), (where))
233
234#define sk_ASN1_GENERALSTRING_delete(sk, where) \
235 ((ASN1_GENERALSTRING *)sk_delete( \
236 CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk), (where)))
237
238#define sk_ASN1_GENERALSTRING_delete_ptr(sk, p) \
239 ((ASN1_GENERALSTRING *)sk_delete_ptr( \
240 CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk), \
241 CHECKED_CAST(void *, ASN1_GENERALSTRING *, p)))
242
243#define sk_ASN1_GENERALSTRING_find(sk, out_index, p) \
244 sk_find(CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk), \
245 (out_index), CHECKED_CAST(void *, ASN1_GENERALSTRING *, p))
246
247#define sk_ASN1_GENERALSTRING_shift(sk) \
248 ((ASN1_GENERALSTRING *)sk_shift( \
249 CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk)))
250
251#define sk_ASN1_GENERALSTRING_push(sk, p) \
252 sk_push(CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk), \
253 CHECKED_CAST(void *, ASN1_GENERALSTRING *, p))
254
255#define sk_ASN1_GENERALSTRING_pop(sk) \
256 ((ASN1_GENERALSTRING *)sk_pop( \
257 CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk)))
258
259#define sk_ASN1_GENERALSTRING_dup(sk) \
260 ((STACK_OF(ASN1_GENERALSTRING) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -0400261 CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_GENERALSTRING) *, sk)))
Adam Langley95c29f32014-06-20 12:00:00 -0700262
263#define sk_ASN1_GENERALSTRING_sort(sk) \
264 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk))
265
266#define sk_ASN1_GENERALSTRING_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -0400267 sk_is_sorted( \
268 CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_GENERALSTRING) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -0700269
Adam Langley2d96a672015-02-11 14:28:41 -0800270#define sk_ASN1_GENERALSTRING_set_cmp_func(sk, comp) \
271 ((int (*)(const ASN1_GENERALSTRING **a, const ASN1_GENERALSTRING **b)) \
272 sk_set_cmp_func( \
273 CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk), \
274 CHECKED_CAST(stack_cmp_func, int (*)(const ASN1_GENERALSTRING **a, \
275 const ASN1_GENERALSTRING **b), \
276 comp)))
David Benjamin6f260012014-08-15 13:49:12 -0400277
Adam Langleya1048a72015-02-11 14:27:21 -0800278#define sk_ASN1_GENERALSTRING_deep_copy(sk, copy_func, free_func) \
279 ((STACK_OF(ASN1_GENERALSTRING) *)sk_deep_copy( \
280 CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_GENERALSTRING) *, sk), \
281 CHECKED_CAST(void *(*)(void *), \
282 ASN1_GENERALSTRING *(*)(ASN1_GENERALSTRING *), copy_func), \
283 CHECKED_CAST(void (*)(void *), void (*)(ASN1_GENERALSTRING *), \
284 free_func)))
285
Adam Langley95c29f32014-06-20 12:00:00 -0700286/* ASN1_INTEGER */
287#define sk_ASN1_INTEGER_new(comp) \
288 ((STACK_OF(ASN1_INTEGER) *)sk_new(CHECKED_CAST( \
289 stack_cmp_func, int (*)(const ASN1_INTEGER **a, const ASN1_INTEGER **b), \
290 comp)))
291
292#define sk_ASN1_INTEGER_new_null() ((STACK_OF(ASN1_INTEGER) *)sk_new_null())
293
294#define sk_ASN1_INTEGER_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -0400295 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_INTEGER) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -0700296
297#define sk_ASN1_INTEGER_zero(sk) \
298 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk));
299
300#define sk_ASN1_INTEGER_value(sk, i) \
301 ((ASN1_INTEGER *)sk_value( \
David Benjaminada97992016-05-13 13:14:28 -0400302 CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_INTEGER) *, sk), (i)))
Adam Langley95c29f32014-06-20 12:00:00 -0700303
304#define sk_ASN1_INTEGER_set(sk, i, p) \
305 ((ASN1_INTEGER *)sk_set( \
306 CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk), (i), \
307 CHECKED_CAST(void *, ASN1_INTEGER *, p)))
308
309#define sk_ASN1_INTEGER_free(sk) \
310 sk_free(CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk))
311
312#define sk_ASN1_INTEGER_pop_free(sk, free_func) \
313 sk_pop_free( \
314 CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk), \
315 CHECKED_CAST(void (*)(void *), void (*)(ASN1_INTEGER *), free_func))
316
317#define sk_ASN1_INTEGER_insert(sk, p, where) \
318 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk), \
319 CHECKED_CAST(void *, ASN1_INTEGER *, p), (where))
320
321#define sk_ASN1_INTEGER_delete(sk, where) \
322 ((ASN1_INTEGER *)sk_delete( \
323 CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk), (where)))
324
325#define sk_ASN1_INTEGER_delete_ptr(sk, p) \
326 ((ASN1_INTEGER *)sk_delete_ptr( \
327 CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk), \
328 CHECKED_CAST(void *, ASN1_INTEGER *, p)))
329
330#define sk_ASN1_INTEGER_find(sk, out_index, p) \
331 sk_find(CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk), (out_index), \
332 CHECKED_CAST(void *, ASN1_INTEGER *, p))
333
334#define sk_ASN1_INTEGER_shift(sk) \
335 ((ASN1_INTEGER *)sk_shift( \
336 CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk)))
337
338#define sk_ASN1_INTEGER_push(sk, p) \
339 sk_push(CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk), \
340 CHECKED_CAST(void *, ASN1_INTEGER *, p))
341
342#define sk_ASN1_INTEGER_pop(sk) \
343 ((ASN1_INTEGER *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk)))
344
345#define sk_ASN1_INTEGER_dup(sk) \
346 ((STACK_OF(ASN1_INTEGER) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -0400347 CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_INTEGER) *, sk)))
Adam Langley95c29f32014-06-20 12:00:00 -0700348
349#define sk_ASN1_INTEGER_sort(sk) \
350 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk))
351
352#define sk_ASN1_INTEGER_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -0400353 sk_is_sorted(CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_INTEGER) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -0700354
355#define sk_ASN1_INTEGER_set_cmp_func(sk, comp) \
356 ((int (*)(const ASN1_INTEGER **a, const ASN1_INTEGER **b))sk_set_cmp_func( \
357 CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk), \
358 CHECKED_CAST(stack_cmp_func, \
359 int (*)(const ASN1_INTEGER **a, const ASN1_INTEGER **b), \
360 comp)))
361
Adam Langleya1048a72015-02-11 14:27:21 -0800362#define sk_ASN1_INTEGER_deep_copy(sk, copy_func, free_func) \
363 ((STACK_OF(ASN1_INTEGER) *)sk_deep_copy( \
364 CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_INTEGER) *, sk), \
365 CHECKED_CAST(void *(*)(void *), ASN1_INTEGER *(*)(ASN1_INTEGER *), \
366 copy_func), \
367 CHECKED_CAST(void (*)(void *), void (*)(ASN1_INTEGER *), free_func)))
368
Adam Langley95c29f32014-06-20 12:00:00 -0700369/* ASN1_OBJECT */
370#define sk_ASN1_OBJECT_new(comp) \
371 ((STACK_OF(ASN1_OBJECT) *)sk_new(CHECKED_CAST( \
372 stack_cmp_func, int (*)(const ASN1_OBJECT **a, const ASN1_OBJECT **b), \
373 comp)))
374
375#define sk_ASN1_OBJECT_new_null() ((STACK_OF(ASN1_OBJECT) *)sk_new_null())
376
377#define sk_ASN1_OBJECT_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -0400378 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_OBJECT) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -0700379
380#define sk_ASN1_OBJECT_zero(sk) \
381 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk));
382
383#define sk_ASN1_OBJECT_value(sk, i) \
384 ((ASN1_OBJECT *)sk_value( \
David Benjaminada97992016-05-13 13:14:28 -0400385 CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_OBJECT) *, sk), (i)))
Adam Langley95c29f32014-06-20 12:00:00 -0700386
387#define sk_ASN1_OBJECT_set(sk, i, p) \
388 ((ASN1_OBJECT *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk), \
389 (i), CHECKED_CAST(void *, ASN1_OBJECT *, p)))
390
391#define sk_ASN1_OBJECT_free(sk) \
392 sk_free(CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk))
393
394#define sk_ASN1_OBJECT_pop_free(sk, free_func) \
395 sk_pop_free( \
396 CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk), \
397 CHECKED_CAST(void (*)(void *), void (*)(ASN1_OBJECT *), free_func))
398
399#define sk_ASN1_OBJECT_insert(sk, p, where) \
400 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk), \
401 CHECKED_CAST(void *, ASN1_OBJECT *, p), (where))
402
403#define sk_ASN1_OBJECT_delete(sk, where) \
404 ((ASN1_OBJECT *)sk_delete( \
405 CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk), (where)))
406
407#define sk_ASN1_OBJECT_delete_ptr(sk, p) \
408 ((ASN1_OBJECT *)sk_delete_ptr( \
409 CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk), \
410 CHECKED_CAST(void *, ASN1_OBJECT *, p)))
411
412#define sk_ASN1_OBJECT_find(sk, out_index, p) \
413 sk_find(CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk), (out_index), \
414 CHECKED_CAST(void *, ASN1_OBJECT *, p))
415
416#define sk_ASN1_OBJECT_shift(sk) \
417 ((ASN1_OBJECT *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk)))
418
419#define sk_ASN1_OBJECT_push(sk, p) \
420 sk_push(CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk), \
421 CHECKED_CAST(void *, ASN1_OBJECT *, p))
422
423#define sk_ASN1_OBJECT_pop(sk) \
424 ((ASN1_OBJECT *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk)))
425
426#define sk_ASN1_OBJECT_dup(sk) \
427 ((STACK_OF(ASN1_OBJECT) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -0400428 CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_OBJECT) *, sk)))
Adam Langley95c29f32014-06-20 12:00:00 -0700429
430#define sk_ASN1_OBJECT_sort(sk) \
431 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk))
432
433#define sk_ASN1_OBJECT_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -0400434 sk_is_sorted(CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_OBJECT) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -0700435
436#define sk_ASN1_OBJECT_set_cmp_func(sk, comp) \
437 ((int (*)(const ASN1_OBJECT **a, const ASN1_OBJECT **b))sk_set_cmp_func( \
438 CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk), \
439 CHECKED_CAST(stack_cmp_func, \
440 int (*)(const ASN1_OBJECT **a, const ASN1_OBJECT **b), \
441 comp)))
442
Adam Langleya1048a72015-02-11 14:27:21 -0800443#define sk_ASN1_OBJECT_deep_copy(sk, copy_func, free_func) \
444 ((STACK_OF(ASN1_OBJECT) *)sk_deep_copy( \
445 CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_OBJECT) *, sk), \
446 CHECKED_CAST(void *(*)(void *), ASN1_OBJECT *(*)(ASN1_OBJECT *), \
447 copy_func), \
448 CHECKED_CAST(void (*)(void *), void (*)(ASN1_OBJECT *), free_func)))
449
Adam Langley95c29f32014-06-20 12:00:00 -0700450/* ASN1_STRING_TABLE */
451#define sk_ASN1_STRING_TABLE_new(comp) \
452 ((STACK_OF(ASN1_STRING_TABLE) *)sk_new(CHECKED_CAST( \
453 stack_cmp_func, \
454 int (*)(const ASN1_STRING_TABLE **a, const ASN1_STRING_TABLE **b), \
455 comp)))
456
457#define sk_ASN1_STRING_TABLE_new_null() \
458 ((STACK_OF(ASN1_STRING_TABLE) *)sk_new_null())
459
460#define sk_ASN1_STRING_TABLE_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -0400461 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_STRING_TABLE) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -0700462
463#define sk_ASN1_STRING_TABLE_zero(sk) \
464 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk));
465
David Benjaminada97992016-05-13 13:14:28 -0400466#define sk_ASN1_STRING_TABLE_value(sk, i) \
467 ((ASN1_STRING_TABLE *)sk_value( \
468 CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_STRING_TABLE) *, sk), \
469 (i)))
Adam Langley95c29f32014-06-20 12:00:00 -0700470
471#define sk_ASN1_STRING_TABLE_set(sk, i, p) \
472 ((ASN1_STRING_TABLE *)sk_set( \
473 CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk), (i), \
474 CHECKED_CAST(void *, ASN1_STRING_TABLE *, p)))
475
476#define sk_ASN1_STRING_TABLE_free(sk) \
477 sk_free(CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk))
478
479#define sk_ASN1_STRING_TABLE_pop_free(sk, free_func) \
480 sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk), \
481 CHECKED_CAST(void (*)(void *), void (*)(ASN1_STRING_TABLE *), \
482 free_func))
483
484#define sk_ASN1_STRING_TABLE_insert(sk, p, where) \
485 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk), \
486 CHECKED_CAST(void *, ASN1_STRING_TABLE *, p), (where))
487
488#define sk_ASN1_STRING_TABLE_delete(sk, where) \
489 ((ASN1_STRING_TABLE *)sk_delete( \
490 CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk), (where)))
491
492#define sk_ASN1_STRING_TABLE_delete_ptr(sk, p) \
493 ((ASN1_STRING_TABLE *)sk_delete_ptr( \
494 CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk), \
495 CHECKED_CAST(void *, ASN1_STRING_TABLE *, p)))
496
497#define sk_ASN1_STRING_TABLE_find(sk, out_index, p) \
498 sk_find(CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk), \
499 (out_index), CHECKED_CAST(void *, ASN1_STRING_TABLE *, p))
500
501#define sk_ASN1_STRING_TABLE_shift(sk) \
502 ((ASN1_STRING_TABLE *)sk_shift( \
503 CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk)))
504
505#define sk_ASN1_STRING_TABLE_push(sk, p) \
506 sk_push(CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk), \
507 CHECKED_CAST(void *, ASN1_STRING_TABLE *, p))
508
509#define sk_ASN1_STRING_TABLE_pop(sk) \
510 ((ASN1_STRING_TABLE *)sk_pop( \
511 CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk)))
512
513#define sk_ASN1_STRING_TABLE_dup(sk) \
514 ((STACK_OF(ASN1_STRING_TABLE) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -0400515 CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_STRING_TABLE) *, sk)))
Adam Langley95c29f32014-06-20 12:00:00 -0700516
517#define sk_ASN1_STRING_TABLE_sort(sk) \
518 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk))
519
520#define sk_ASN1_STRING_TABLE_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -0400521 sk_is_sorted( \
522 CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_STRING_TABLE) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -0700523
Adam Langley2d96a672015-02-11 14:28:41 -0800524#define sk_ASN1_STRING_TABLE_set_cmp_func(sk, comp) \
525 ((int (*)(const ASN1_STRING_TABLE **a, const ASN1_STRING_TABLE **b)) \
526 sk_set_cmp_func( \
527 CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk), \
528 CHECKED_CAST(stack_cmp_func, int (*)(const ASN1_STRING_TABLE **a, \
529 const ASN1_STRING_TABLE **b), \
530 comp)))
David Benjamin6f260012014-08-15 13:49:12 -0400531
Adam Langleya1048a72015-02-11 14:27:21 -0800532#define sk_ASN1_STRING_TABLE_deep_copy(sk, copy_func, free_func) \
533 ((STACK_OF(ASN1_STRING_TABLE) *)sk_deep_copy( \
534 CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_STRING_TABLE) *, sk), \
535 CHECKED_CAST(void *(*)(void *), \
536 ASN1_STRING_TABLE *(*)(ASN1_STRING_TABLE *), copy_func), \
537 CHECKED_CAST(void (*)(void *), void (*)(ASN1_STRING_TABLE *), \
538 free_func)))
539
Adam Langley95c29f32014-06-20 12:00:00 -0700540/* ASN1_TYPE */
541#define sk_ASN1_TYPE_new(comp) \
542 ((STACK_OF(ASN1_TYPE) *)sk_new( \
543 CHECKED_CAST(stack_cmp_func, \
544 int (*)(const ASN1_TYPE **a, const ASN1_TYPE **b), comp)))
545
546#define sk_ASN1_TYPE_new_null() ((STACK_OF(ASN1_TYPE) *)sk_new_null())
547
548#define sk_ASN1_TYPE_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -0400549 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_TYPE) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -0700550
551#define sk_ASN1_TYPE_zero(sk) \
552 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk));
553
554#define sk_ASN1_TYPE_value(sk, i) \
555 ((ASN1_TYPE *)sk_value( \
David Benjaminada97992016-05-13 13:14:28 -0400556 CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_TYPE) *, sk), (i)))
Adam Langley95c29f32014-06-20 12:00:00 -0700557
558#define sk_ASN1_TYPE_set(sk, i, p) \
559 ((ASN1_TYPE *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk), (i), \
560 CHECKED_CAST(void *, ASN1_TYPE *, p)))
561
562#define sk_ASN1_TYPE_free(sk) \
563 sk_free(CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk))
564
565#define sk_ASN1_TYPE_pop_free(sk, free_func) \
566 sk_pop_free( \
567 CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk), \
568 CHECKED_CAST(void (*)(void *), void (*)(ASN1_TYPE *), free_func))
569
570#define sk_ASN1_TYPE_insert(sk, p, where) \
571 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk), \
572 CHECKED_CAST(void *, ASN1_TYPE *, p), (where))
573
574#define sk_ASN1_TYPE_delete(sk, where) \
575 ((ASN1_TYPE *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk), \
576 (where)))
577
578#define sk_ASN1_TYPE_delete_ptr(sk, p) \
579 ((ASN1_TYPE *)sk_delete_ptr( \
580 CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk), \
581 CHECKED_CAST(void *, ASN1_TYPE *, p)))
582
583#define sk_ASN1_TYPE_find(sk, out_index, p) \
584 sk_find(CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk), (out_index), \
585 CHECKED_CAST(void *, ASN1_TYPE *, p))
586
587#define sk_ASN1_TYPE_shift(sk) \
588 ((ASN1_TYPE *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk)))
589
590#define sk_ASN1_TYPE_push(sk, p) \
591 sk_push(CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk), \
592 CHECKED_CAST(void *, ASN1_TYPE *, p))
593
594#define sk_ASN1_TYPE_pop(sk) \
595 ((ASN1_TYPE *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk)))
596
597#define sk_ASN1_TYPE_dup(sk) \
598 ((STACK_OF(ASN1_TYPE) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -0400599 CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_TYPE) *, sk)))
Adam Langley95c29f32014-06-20 12:00:00 -0700600
601#define sk_ASN1_TYPE_sort(sk) \
602 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk))
603
604#define sk_ASN1_TYPE_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -0400605 sk_is_sorted(CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_TYPE) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -0700606
607#define sk_ASN1_TYPE_set_cmp_func(sk, comp) \
608 ((int (*)(const ASN1_TYPE **a, const ASN1_TYPE **b))sk_set_cmp_func( \
609 CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk), \
610 CHECKED_CAST(stack_cmp_func, \
611 int (*)(const ASN1_TYPE **a, const ASN1_TYPE **b), comp)))
612
Adam Langleya1048a72015-02-11 14:27:21 -0800613#define sk_ASN1_TYPE_deep_copy(sk, copy_func, free_func) \
614 ((STACK_OF(ASN1_TYPE) *)sk_deep_copy( \
615 CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_TYPE) *, sk), \
616 CHECKED_CAST(void *(*)(void *), ASN1_TYPE *(*)(ASN1_TYPE *), copy_func), \
617 CHECKED_CAST(void (*)(void *), void (*)(ASN1_TYPE *), free_func)))
618
Adam Langley95c29f32014-06-20 12:00:00 -0700619/* ASN1_VALUE */
620#define sk_ASN1_VALUE_new(comp) \
621 ((STACK_OF(ASN1_VALUE) *)sk_new(CHECKED_CAST( \
622 stack_cmp_func, int (*)(const ASN1_VALUE **a, const ASN1_VALUE **b), \
623 comp)))
624
625#define sk_ASN1_VALUE_new_null() ((STACK_OF(ASN1_VALUE) *)sk_new_null())
626
627#define sk_ASN1_VALUE_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -0400628 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_VALUE) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -0700629
630#define sk_ASN1_VALUE_zero(sk) \
631 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk));
632
633#define sk_ASN1_VALUE_value(sk, i) \
634 ((ASN1_VALUE *)sk_value( \
David Benjaminada97992016-05-13 13:14:28 -0400635 CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_VALUE) *, sk), (i)))
Adam Langley95c29f32014-06-20 12:00:00 -0700636
637#define sk_ASN1_VALUE_set(sk, i, p) \
638 ((ASN1_VALUE *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk), \
639 (i), CHECKED_CAST(void *, ASN1_VALUE *, p)))
640
641#define sk_ASN1_VALUE_free(sk) \
642 sk_free(CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk))
643
644#define sk_ASN1_VALUE_pop_free(sk, free_func) \
645 sk_pop_free( \
646 CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk), \
647 CHECKED_CAST(void (*)(void *), void (*)(ASN1_VALUE *), free_func))
648
649#define sk_ASN1_VALUE_insert(sk, p, where) \
650 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk), \
651 CHECKED_CAST(void *, ASN1_VALUE *, p), (where))
652
653#define sk_ASN1_VALUE_delete(sk, where) \
654 ((ASN1_VALUE *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk), \
655 (where)))
656
657#define sk_ASN1_VALUE_delete_ptr(sk, p) \
658 ((ASN1_VALUE *)sk_delete_ptr( \
659 CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk), \
660 CHECKED_CAST(void *, ASN1_VALUE *, p)))
661
662#define sk_ASN1_VALUE_find(sk, out_index, p) \
663 sk_find(CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk), (out_index), \
664 CHECKED_CAST(void *, ASN1_VALUE *, p))
665
666#define sk_ASN1_VALUE_shift(sk) \
667 ((ASN1_VALUE *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk)))
668
669#define sk_ASN1_VALUE_push(sk, p) \
670 sk_push(CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk), \
671 CHECKED_CAST(void *, ASN1_VALUE *, p))
672
673#define sk_ASN1_VALUE_pop(sk) \
674 ((ASN1_VALUE *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk)))
675
676#define sk_ASN1_VALUE_dup(sk) \
677 ((STACK_OF(ASN1_VALUE) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -0400678 CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_VALUE) *, sk)))
Adam Langley95c29f32014-06-20 12:00:00 -0700679
680#define sk_ASN1_VALUE_sort(sk) \
681 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk))
682
683#define sk_ASN1_VALUE_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -0400684 sk_is_sorted(CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_VALUE) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -0700685
686#define sk_ASN1_VALUE_set_cmp_func(sk, comp) \
687 ((int (*)(const ASN1_VALUE **a, const ASN1_VALUE **b))sk_set_cmp_func( \
688 CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk), \
689 CHECKED_CAST(stack_cmp_func, \
690 int (*)(const ASN1_VALUE **a, const ASN1_VALUE **b), \
691 comp)))
692
Adam Langleya1048a72015-02-11 14:27:21 -0800693#define sk_ASN1_VALUE_deep_copy(sk, copy_func, free_func) \
694 ((STACK_OF(ASN1_VALUE) *)sk_deep_copy( \
695 CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_VALUE) *, sk), \
696 CHECKED_CAST(void *(*)(void *), ASN1_VALUE *(*)(ASN1_VALUE *), \
697 copy_func), \
698 CHECKED_CAST(void (*)(void *), void (*)(ASN1_VALUE *), free_func)))
699
Adam Langley95c29f32014-06-20 12:00:00 -0700700/* BIO */
701#define sk_BIO_new(comp) \
702 ((STACK_OF(BIO) *)sk_new(CHECKED_CAST( \
703 stack_cmp_func, int (*)(const BIO **a, const BIO **b), comp)))
704
705#define sk_BIO_new_null() ((STACK_OF(BIO) *)sk_new_null())
706
David Benjaminada97992016-05-13 13:14:28 -0400707#define sk_BIO_num(sk) \
708 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(BIO) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -0700709
710#define sk_BIO_zero(sk) sk_zero(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk));
711
David Benjaminada97992016-05-13 13:14:28 -0400712#define sk_BIO_value(sk, i) \
713 ((BIO *)sk_value(CHECKED_CAST(const _STACK *, const STACK_OF(BIO) *, sk), \
714 (i)))
Adam Langley95c29f32014-06-20 12:00:00 -0700715
716#define sk_BIO_set(sk, i, p) \
717 ((BIO *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk), (i), \
718 CHECKED_CAST(void *, BIO *, p)))
719
720#define sk_BIO_free(sk) sk_free(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk))
721
722#define sk_BIO_pop_free(sk, free_func) \
723 sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk), \
724 CHECKED_CAST(void (*)(void *), void (*)(BIO *), free_func))
725
726#define sk_BIO_insert(sk, p, where) \
727 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk), \
728 CHECKED_CAST(void *, BIO *, p), (where))
729
730#define sk_BIO_delete(sk, where) \
731 ((BIO *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk), (where)))
732
733#define sk_BIO_delete_ptr(sk, p) \
734 ((BIO *)sk_delete_ptr(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk), \
735 CHECKED_CAST(void *, BIO *, p)))
736
737#define sk_BIO_find(sk, out_index, p) \
738 sk_find(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk), (out_index), \
739 CHECKED_CAST(void *, BIO *, p))
740
741#define sk_BIO_shift(sk) \
742 ((BIO *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk)))
743
744#define sk_BIO_push(sk, p) \
745 sk_push(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk), \
746 CHECKED_CAST(void *, BIO *, p))
747
748#define sk_BIO_pop(sk) \
749 ((BIO *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk)))
750
David Benjaminada97992016-05-13 13:14:28 -0400751#define sk_BIO_dup(sk) \
752 ((STACK_OF(BIO) *)sk_dup( \
753 CHECKED_CAST(const _STACK *, const STACK_OF(BIO) *, sk)))
Adam Langley95c29f32014-06-20 12:00:00 -0700754
755#define sk_BIO_sort(sk) sk_sort(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk))
756
757#define sk_BIO_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -0400758 sk_is_sorted(CHECKED_CAST(const _STACK *, const STACK_OF(BIO) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -0700759
760#define sk_BIO_set_cmp_func(sk, comp) \
761 ((int (*)(const BIO **a, const BIO **b))sk_set_cmp_func( \
762 CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk), \
763 CHECKED_CAST(stack_cmp_func, int (*)(const BIO **a, const BIO **b), \
764 comp)))
765
Adam Langleya1048a72015-02-11 14:27:21 -0800766#define sk_BIO_deep_copy(sk, copy_func, free_func) \
767 ((STACK_OF(BIO) *)sk_deep_copy( \
768 CHECKED_CAST(const _STACK *, const STACK_OF(BIO) *, sk), \
769 CHECKED_CAST(void *(*)(void *), BIO *(*)(BIO *), copy_func), \
770 CHECKED_CAST(void (*)(void *), void (*)(BIO *), free_func)))
771
Adam Langley95c29f32014-06-20 12:00:00 -0700772/* BY_DIR_ENTRY */
773#define sk_BY_DIR_ENTRY_new(comp) \
774 ((STACK_OF(BY_DIR_ENTRY) *)sk_new(CHECKED_CAST( \
775 stack_cmp_func, int (*)(const BY_DIR_ENTRY **a, const BY_DIR_ENTRY **b), \
776 comp)))
777
778#define sk_BY_DIR_ENTRY_new_null() ((STACK_OF(BY_DIR_ENTRY) *)sk_new_null())
779
780#define sk_BY_DIR_ENTRY_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -0400781 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(BY_DIR_ENTRY) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -0700782
783#define sk_BY_DIR_ENTRY_zero(sk) \
784 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk));
785
786#define sk_BY_DIR_ENTRY_value(sk, i) \
787 ((BY_DIR_ENTRY *)sk_value( \
David Benjaminada97992016-05-13 13:14:28 -0400788 CHECKED_CAST(const _STACK *, const STACK_OF(BY_DIR_ENTRY) *, sk), (i)))
Adam Langley95c29f32014-06-20 12:00:00 -0700789
790#define sk_BY_DIR_ENTRY_set(sk, i, p) \
791 ((BY_DIR_ENTRY *)sk_set( \
792 CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk), (i), \
793 CHECKED_CAST(void *, BY_DIR_ENTRY *, p)))
794
795#define sk_BY_DIR_ENTRY_free(sk) \
796 sk_free(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk))
797
798#define sk_BY_DIR_ENTRY_pop_free(sk, free_func) \
799 sk_pop_free( \
800 CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk), \
801 CHECKED_CAST(void (*)(void *), void (*)(BY_DIR_ENTRY *), free_func))
802
803#define sk_BY_DIR_ENTRY_insert(sk, p, where) \
804 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk), \
805 CHECKED_CAST(void *, BY_DIR_ENTRY *, p), (where))
806
807#define sk_BY_DIR_ENTRY_delete(sk, where) \
808 ((BY_DIR_ENTRY *)sk_delete( \
809 CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk), (where)))
810
811#define sk_BY_DIR_ENTRY_delete_ptr(sk, p) \
812 ((BY_DIR_ENTRY *)sk_delete_ptr( \
813 CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk), \
814 CHECKED_CAST(void *, BY_DIR_ENTRY *, p)))
815
816#define sk_BY_DIR_ENTRY_find(sk, out_index, p) \
817 sk_find(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk), (out_index), \
818 CHECKED_CAST(void *, BY_DIR_ENTRY *, p))
819
820#define sk_BY_DIR_ENTRY_shift(sk) \
821 ((BY_DIR_ENTRY *)sk_shift( \
822 CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk)))
823
824#define sk_BY_DIR_ENTRY_push(sk, p) \
825 sk_push(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk), \
826 CHECKED_CAST(void *, BY_DIR_ENTRY *, p))
827
828#define sk_BY_DIR_ENTRY_pop(sk) \
829 ((BY_DIR_ENTRY *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk)))
830
831#define sk_BY_DIR_ENTRY_dup(sk) \
832 ((STACK_OF(BY_DIR_ENTRY) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -0400833 CHECKED_CAST(const _STACK *, const STACK_OF(BY_DIR_ENTRY) *, sk)))
Adam Langley95c29f32014-06-20 12:00:00 -0700834
835#define sk_BY_DIR_ENTRY_sort(sk) \
836 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk))
837
838#define sk_BY_DIR_ENTRY_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -0400839 sk_is_sorted(CHECKED_CAST(const _STACK *, const STACK_OF(BY_DIR_ENTRY) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -0700840
841#define sk_BY_DIR_ENTRY_set_cmp_func(sk, comp) \
842 ((int (*)(const BY_DIR_ENTRY **a, const BY_DIR_ENTRY **b))sk_set_cmp_func( \
843 CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk), \
844 CHECKED_CAST(stack_cmp_func, \
845 int (*)(const BY_DIR_ENTRY **a, const BY_DIR_ENTRY **b), \
846 comp)))
847
Adam Langleya1048a72015-02-11 14:27:21 -0800848#define sk_BY_DIR_ENTRY_deep_copy(sk, copy_func, free_func) \
849 ((STACK_OF(BY_DIR_ENTRY) *)sk_deep_copy( \
850 CHECKED_CAST(const _STACK *, const STACK_OF(BY_DIR_ENTRY) *, sk), \
851 CHECKED_CAST(void *(*)(void *), BY_DIR_ENTRY *(*)(BY_DIR_ENTRY *), \
852 copy_func), \
853 CHECKED_CAST(void (*)(void *), void (*)(BY_DIR_ENTRY *), free_func)))
854
Adam Langley95c29f32014-06-20 12:00:00 -0700855/* BY_DIR_HASH */
856#define sk_BY_DIR_HASH_new(comp) \
857 ((STACK_OF(BY_DIR_HASH) *)sk_new(CHECKED_CAST( \
858 stack_cmp_func, int (*)(const BY_DIR_HASH **a, const BY_DIR_HASH **b), \
859 comp)))
860
861#define sk_BY_DIR_HASH_new_null() ((STACK_OF(BY_DIR_HASH) *)sk_new_null())
862
863#define sk_BY_DIR_HASH_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -0400864 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(BY_DIR_HASH) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -0700865
866#define sk_BY_DIR_HASH_zero(sk) \
867 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk));
868
869#define sk_BY_DIR_HASH_value(sk, i) \
870 ((BY_DIR_HASH *)sk_value( \
David Benjaminada97992016-05-13 13:14:28 -0400871 CHECKED_CAST(const _STACK *, const STACK_OF(BY_DIR_HASH) *, sk), (i)))
Adam Langley95c29f32014-06-20 12:00:00 -0700872
873#define sk_BY_DIR_HASH_set(sk, i, p) \
874 ((BY_DIR_HASH *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk), \
875 (i), CHECKED_CAST(void *, BY_DIR_HASH *, p)))
876
877#define sk_BY_DIR_HASH_free(sk) \
878 sk_free(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk))
879
880#define sk_BY_DIR_HASH_pop_free(sk, free_func) \
881 sk_pop_free( \
882 CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk), \
883 CHECKED_CAST(void (*)(void *), void (*)(BY_DIR_HASH *), free_func))
884
885#define sk_BY_DIR_HASH_insert(sk, p, where) \
886 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk), \
887 CHECKED_CAST(void *, BY_DIR_HASH *, p), (where))
888
889#define sk_BY_DIR_HASH_delete(sk, where) \
890 ((BY_DIR_HASH *)sk_delete( \
891 CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk), (where)))
892
893#define sk_BY_DIR_HASH_delete_ptr(sk, p) \
894 ((BY_DIR_HASH *)sk_delete_ptr( \
895 CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk), \
896 CHECKED_CAST(void *, BY_DIR_HASH *, p)))
897
898#define sk_BY_DIR_HASH_find(sk, out_index, p) \
899 sk_find(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk), (out_index), \
900 CHECKED_CAST(void *, BY_DIR_HASH *, p))
901
902#define sk_BY_DIR_HASH_shift(sk) \
903 ((BY_DIR_HASH *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk)))
904
905#define sk_BY_DIR_HASH_push(sk, p) \
906 sk_push(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk), \
907 CHECKED_CAST(void *, BY_DIR_HASH *, p))
908
909#define sk_BY_DIR_HASH_pop(sk) \
910 ((BY_DIR_HASH *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk)))
911
912#define sk_BY_DIR_HASH_dup(sk) \
913 ((STACK_OF(BY_DIR_HASH) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -0400914 CHECKED_CAST(const _STACK *, const STACK_OF(BY_DIR_HASH) *, sk)))
Adam Langley95c29f32014-06-20 12:00:00 -0700915
916#define sk_BY_DIR_HASH_sort(sk) \
917 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk))
918
919#define sk_BY_DIR_HASH_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -0400920 sk_is_sorted(CHECKED_CAST(const _STACK *, const STACK_OF(BY_DIR_HASH) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -0700921
922#define sk_BY_DIR_HASH_set_cmp_func(sk, comp) \
923 ((int (*)(const BY_DIR_HASH **a, const BY_DIR_HASH **b))sk_set_cmp_func( \
924 CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk), \
925 CHECKED_CAST(stack_cmp_func, \
926 int (*)(const BY_DIR_HASH **a, const BY_DIR_HASH **b), \
927 comp)))
928
Adam Langleya1048a72015-02-11 14:27:21 -0800929#define sk_BY_DIR_HASH_deep_copy(sk, copy_func, free_func) \
930 ((STACK_OF(BY_DIR_HASH) *)sk_deep_copy( \
931 CHECKED_CAST(const _STACK *, const STACK_OF(BY_DIR_HASH) *, sk), \
932 CHECKED_CAST(void *(*)(void *), BY_DIR_HASH *(*)(BY_DIR_HASH *), \
933 copy_func), \
934 CHECKED_CAST(void (*)(void *), void (*)(BY_DIR_HASH *), free_func)))
935
Adam Langley95c29f32014-06-20 12:00:00 -0700936/* CONF_VALUE */
937#define sk_CONF_VALUE_new(comp) \
938 ((STACK_OF(CONF_VALUE) *)sk_new(CHECKED_CAST( \
939 stack_cmp_func, int (*)(const CONF_VALUE **a, const CONF_VALUE **b), \
940 comp)))
941
942#define sk_CONF_VALUE_new_null() ((STACK_OF(CONF_VALUE) *)sk_new_null())
943
944#define sk_CONF_VALUE_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -0400945 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(CONF_VALUE) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -0700946
947#define sk_CONF_VALUE_zero(sk) \
948 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk));
949
950#define sk_CONF_VALUE_value(sk, i) \
951 ((CONF_VALUE *)sk_value( \
David Benjaminada97992016-05-13 13:14:28 -0400952 CHECKED_CAST(const _STACK *, const STACK_OF(CONF_VALUE) *, sk), (i)))
Adam Langley95c29f32014-06-20 12:00:00 -0700953
954#define sk_CONF_VALUE_set(sk, i, p) \
955 ((CONF_VALUE *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk), \
956 (i), CHECKED_CAST(void *, CONF_VALUE *, p)))
957
958#define sk_CONF_VALUE_free(sk) \
959 sk_free(CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk))
960
961#define sk_CONF_VALUE_pop_free(sk, free_func) \
962 sk_pop_free( \
963 CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk), \
964 CHECKED_CAST(void (*)(void *), void (*)(CONF_VALUE *), free_func))
965
966#define sk_CONF_VALUE_insert(sk, p, where) \
967 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk), \
968 CHECKED_CAST(void *, CONF_VALUE *, p), (where))
969
970#define sk_CONF_VALUE_delete(sk, where) \
971 ((CONF_VALUE *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk), \
972 (where)))
973
974#define sk_CONF_VALUE_delete_ptr(sk, p) \
975 ((CONF_VALUE *)sk_delete_ptr( \
976 CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk), \
977 CHECKED_CAST(void *, CONF_VALUE *, p)))
978
979#define sk_CONF_VALUE_find(sk, out_index, p) \
980 sk_find(CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk), (out_index), \
981 CHECKED_CAST(void *, CONF_VALUE *, p))
982
983#define sk_CONF_VALUE_shift(sk) \
984 ((CONF_VALUE *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk)))
985
986#define sk_CONF_VALUE_push(sk, p) \
987 sk_push(CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk), \
988 CHECKED_CAST(void *, CONF_VALUE *, p))
989
990#define sk_CONF_VALUE_pop(sk) \
991 ((CONF_VALUE *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk)))
992
993#define sk_CONF_VALUE_dup(sk) \
994 ((STACK_OF(CONF_VALUE) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -0400995 CHECKED_CAST(const _STACK *, const STACK_OF(CONF_VALUE) *, sk)))
Adam Langley95c29f32014-06-20 12:00:00 -0700996
997#define sk_CONF_VALUE_sort(sk) \
998 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk))
999
1000#define sk_CONF_VALUE_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -04001001 sk_is_sorted(CHECKED_CAST(const _STACK *, const STACK_OF(CONF_VALUE) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -07001002
1003#define sk_CONF_VALUE_set_cmp_func(sk, comp) \
1004 ((int (*)(const CONF_VALUE **a, const CONF_VALUE **b))sk_set_cmp_func( \
1005 CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk), \
1006 CHECKED_CAST(stack_cmp_func, \
1007 int (*)(const CONF_VALUE **a, const CONF_VALUE **b), \
1008 comp)))
1009
Adam Langleya1048a72015-02-11 14:27:21 -08001010#define sk_CONF_VALUE_deep_copy(sk, copy_func, free_func) \
1011 ((STACK_OF(CONF_VALUE) *)sk_deep_copy( \
1012 CHECKED_CAST(const _STACK *, const STACK_OF(CONF_VALUE) *, sk), \
1013 CHECKED_CAST(void *(*)(void *), CONF_VALUE *(*)(CONF_VALUE *), \
1014 copy_func), \
1015 CHECKED_CAST(void (*)(void *), void (*)(CONF_VALUE *), free_func)))
1016
Adam Langley95c29f32014-06-20 12:00:00 -07001017/* CRYPTO_EX_DATA_FUNCS */
1018#define sk_CRYPTO_EX_DATA_FUNCS_new(comp) \
1019 ((STACK_OF(CRYPTO_EX_DATA_FUNCS) *)sk_new(CHECKED_CAST( \
1020 stack_cmp_func, \
1021 int (*)(const CRYPTO_EX_DATA_FUNCS **a, const CRYPTO_EX_DATA_FUNCS **b), \
1022 comp)))
1023
1024#define sk_CRYPTO_EX_DATA_FUNCS_new_null() \
1025 ((STACK_OF(CRYPTO_EX_DATA_FUNCS) *)sk_new_null())
1026
David Benjaminada97992016-05-13 13:14:28 -04001027#define sk_CRYPTO_EX_DATA_FUNCS_num(sk) \
1028 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(CRYPTO_EX_DATA_FUNCS) *, \
1029 sk))
Adam Langley95c29f32014-06-20 12:00:00 -07001030
1031#define sk_CRYPTO_EX_DATA_FUNCS_zero(sk) \
1032 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk));
1033
David Benjaminada97992016-05-13 13:14:28 -04001034#define sk_CRYPTO_EX_DATA_FUNCS_value(sk, i) \
1035 ((CRYPTO_EX_DATA_FUNCS *)sk_value( \
1036 CHECKED_CAST(const _STACK *, const STACK_OF(CRYPTO_EX_DATA_FUNCS) *, \
1037 sk), \
Adam Langley95c29f32014-06-20 12:00:00 -07001038 (i)))
1039
1040#define sk_CRYPTO_EX_DATA_FUNCS_set(sk, i, p) \
1041 ((CRYPTO_EX_DATA_FUNCS *)sk_set( \
1042 CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk), (i), \
1043 CHECKED_CAST(void *, CRYPTO_EX_DATA_FUNCS *, p)))
1044
1045#define sk_CRYPTO_EX_DATA_FUNCS_free(sk) \
1046 sk_free(CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk))
1047
1048#define sk_CRYPTO_EX_DATA_FUNCS_pop_free(sk, free_func) \
1049 sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk), \
1050 CHECKED_CAST(void (*)(void *), void (*)(CRYPTO_EX_DATA_FUNCS *), \
1051 free_func))
1052
1053#define sk_CRYPTO_EX_DATA_FUNCS_insert(sk, p, where) \
1054 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk), \
1055 CHECKED_CAST(void *, CRYPTO_EX_DATA_FUNCS *, p), (where))
1056
1057#define sk_CRYPTO_EX_DATA_FUNCS_delete(sk, where) \
1058 ((CRYPTO_EX_DATA_FUNCS *)sk_delete( \
1059 CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk), (where)))
1060
1061#define sk_CRYPTO_EX_DATA_FUNCS_delete_ptr(sk, p) \
1062 ((CRYPTO_EX_DATA_FUNCS *)sk_delete_ptr( \
1063 CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk), \
1064 CHECKED_CAST(void *, CRYPTO_EX_DATA_FUNCS *, p)))
1065
1066#define sk_CRYPTO_EX_DATA_FUNCS_find(sk, out_index, p) \
1067 sk_find(CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk), \
1068 (out_index), CHECKED_CAST(void *, CRYPTO_EX_DATA_FUNCS *, p))
1069
1070#define sk_CRYPTO_EX_DATA_FUNCS_shift(sk) \
1071 ((CRYPTO_EX_DATA_FUNCS *)sk_shift( \
1072 CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk)))
1073
1074#define sk_CRYPTO_EX_DATA_FUNCS_push(sk, p) \
1075 sk_push(CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk), \
1076 CHECKED_CAST(void *, CRYPTO_EX_DATA_FUNCS *, p))
1077
1078#define sk_CRYPTO_EX_DATA_FUNCS_pop(sk) \
1079 ((CRYPTO_EX_DATA_FUNCS *)sk_pop( \
1080 CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk)))
1081
David Benjaminada97992016-05-13 13:14:28 -04001082#define sk_CRYPTO_EX_DATA_FUNCS_dup(sk) \
1083 ((STACK_OF(CRYPTO_EX_DATA_FUNCS) *)sk_dup(CHECKED_CAST( \
1084 const _STACK *, const STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk)))
Adam Langley95c29f32014-06-20 12:00:00 -07001085
1086#define sk_CRYPTO_EX_DATA_FUNCS_sort(sk) \
1087 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk))
1088
1089#define sk_CRYPTO_EX_DATA_FUNCS_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -04001090 sk_is_sorted(CHECKED_CAST(const _STACK *, \
1091 const STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -07001092
1093#define sk_CRYPTO_EX_DATA_FUNCS_set_cmp_func(sk, comp) \
1094 ((int (*)(const CRYPTO_EX_DATA_FUNCS **a, const CRYPTO_EX_DATA_FUNCS **b)) \
Adam Langley2d96a672015-02-11 14:28:41 -08001095 sk_set_cmp_func( \
1096 CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk), \
1097 CHECKED_CAST(stack_cmp_func, \
1098 int (*)(const CRYPTO_EX_DATA_FUNCS **a, \
1099 const CRYPTO_EX_DATA_FUNCS **b), \
1100 comp)))
David Benjamin6f260012014-08-15 13:49:12 -04001101
Adam Langleya1048a72015-02-11 14:27:21 -08001102#define sk_CRYPTO_EX_DATA_FUNCS_deep_copy(sk, copy_func, free_func) \
1103 ((STACK_OF(CRYPTO_EX_DATA_FUNCS) *)sk_deep_copy( \
1104 CHECKED_CAST(const _STACK *, const STACK_OF(CRYPTO_EX_DATA_FUNCS) *, \
1105 sk), \
1106 CHECKED_CAST(void *(*)(void *), \
1107 CRYPTO_EX_DATA_FUNCS *(*)(CRYPTO_EX_DATA_FUNCS *), \
1108 copy_func), \
1109 CHECKED_CAST(void (*)(void *), void (*)(CRYPTO_EX_DATA_FUNCS *), \
1110 free_func)))
1111
Adam Langley95c29f32014-06-20 12:00:00 -07001112/* DIST_POINT */
1113#define sk_DIST_POINT_new(comp) \
1114 ((STACK_OF(DIST_POINT) *)sk_new(CHECKED_CAST( \
1115 stack_cmp_func, int (*)(const DIST_POINT **a, const DIST_POINT **b), \
1116 comp)))
1117
1118#define sk_DIST_POINT_new_null() ((STACK_OF(DIST_POINT) *)sk_new_null())
1119
1120#define sk_DIST_POINT_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -04001121 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(DIST_POINT) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -07001122
1123#define sk_DIST_POINT_zero(sk) \
1124 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk));
1125
1126#define sk_DIST_POINT_value(sk, i) \
1127 ((DIST_POINT *)sk_value( \
David Benjaminada97992016-05-13 13:14:28 -04001128 CHECKED_CAST(const _STACK *, const STACK_OF(DIST_POINT) *, sk), (i)))
Adam Langley95c29f32014-06-20 12:00:00 -07001129
1130#define sk_DIST_POINT_set(sk, i, p) \
1131 ((DIST_POINT *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk), \
1132 (i), CHECKED_CAST(void *, DIST_POINT *, p)))
1133
1134#define sk_DIST_POINT_free(sk) \
1135 sk_free(CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk))
1136
1137#define sk_DIST_POINT_pop_free(sk, free_func) \
1138 sk_pop_free( \
1139 CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk), \
1140 CHECKED_CAST(void (*)(void *), void (*)(DIST_POINT *), free_func))
1141
1142#define sk_DIST_POINT_insert(sk, p, where) \
1143 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk), \
1144 CHECKED_CAST(void *, DIST_POINT *, p), (where))
1145
1146#define sk_DIST_POINT_delete(sk, where) \
1147 ((DIST_POINT *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk), \
1148 (where)))
1149
1150#define sk_DIST_POINT_delete_ptr(sk, p) \
1151 ((DIST_POINT *)sk_delete_ptr( \
1152 CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk), \
1153 CHECKED_CAST(void *, DIST_POINT *, p)))
1154
1155#define sk_DIST_POINT_find(sk, out_index, p) \
1156 sk_find(CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk), (out_index), \
1157 CHECKED_CAST(void *, DIST_POINT *, p))
1158
1159#define sk_DIST_POINT_shift(sk) \
1160 ((DIST_POINT *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk)))
1161
1162#define sk_DIST_POINT_push(sk, p) \
1163 sk_push(CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk), \
1164 CHECKED_CAST(void *, DIST_POINT *, p))
1165
1166#define sk_DIST_POINT_pop(sk) \
1167 ((DIST_POINT *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk)))
1168
1169#define sk_DIST_POINT_dup(sk) \
1170 ((STACK_OF(DIST_POINT) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -04001171 CHECKED_CAST(const _STACK *, const STACK_OF(DIST_POINT) *, sk)))
Adam Langley95c29f32014-06-20 12:00:00 -07001172
1173#define sk_DIST_POINT_sort(sk) \
1174 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk))
1175
1176#define sk_DIST_POINT_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -04001177 sk_is_sorted(CHECKED_CAST(const _STACK *, const STACK_OF(DIST_POINT) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -07001178
1179#define sk_DIST_POINT_set_cmp_func(sk, comp) \
1180 ((int (*)(const DIST_POINT **a, const DIST_POINT **b))sk_set_cmp_func( \
1181 CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk), \
1182 CHECKED_CAST(stack_cmp_func, \
1183 int (*)(const DIST_POINT **a, const DIST_POINT **b), \
1184 comp)))
1185
Adam Langleya1048a72015-02-11 14:27:21 -08001186#define sk_DIST_POINT_deep_copy(sk, copy_func, free_func) \
1187 ((STACK_OF(DIST_POINT) *)sk_deep_copy( \
1188 CHECKED_CAST(const _STACK *, const STACK_OF(DIST_POINT) *, sk), \
1189 CHECKED_CAST(void *(*)(void *), DIST_POINT *(*)(DIST_POINT *), \
1190 copy_func), \
1191 CHECKED_CAST(void (*)(void *), void (*)(DIST_POINT *), free_func)))
1192
Adam Langley95c29f32014-06-20 12:00:00 -07001193/* GENERAL_NAME */
1194#define sk_GENERAL_NAME_new(comp) \
1195 ((STACK_OF(GENERAL_NAME) *)sk_new(CHECKED_CAST( \
1196 stack_cmp_func, int (*)(const GENERAL_NAME **a, const GENERAL_NAME **b), \
1197 comp)))
1198
1199#define sk_GENERAL_NAME_new_null() ((STACK_OF(GENERAL_NAME) *)sk_new_null())
1200
1201#define sk_GENERAL_NAME_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -04001202 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(GENERAL_NAME) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -07001203
1204#define sk_GENERAL_NAME_zero(sk) \
1205 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk));
1206
1207#define sk_GENERAL_NAME_value(sk, i) \
1208 ((GENERAL_NAME *)sk_value( \
David Benjaminada97992016-05-13 13:14:28 -04001209 CHECKED_CAST(const _STACK *, const STACK_OF(GENERAL_NAME) *, sk), (i)))
Adam Langley95c29f32014-06-20 12:00:00 -07001210
1211#define sk_GENERAL_NAME_set(sk, i, p) \
1212 ((GENERAL_NAME *)sk_set( \
1213 CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk), (i), \
1214 CHECKED_CAST(void *, GENERAL_NAME *, p)))
1215
1216#define sk_GENERAL_NAME_free(sk) \
1217 sk_free(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk))
1218
1219#define sk_GENERAL_NAME_pop_free(sk, free_func) \
1220 sk_pop_free( \
1221 CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk), \
1222 CHECKED_CAST(void (*)(void *), void (*)(GENERAL_NAME *), free_func))
1223
1224#define sk_GENERAL_NAME_insert(sk, p, where) \
1225 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk), \
1226 CHECKED_CAST(void *, GENERAL_NAME *, p), (where))
1227
1228#define sk_GENERAL_NAME_delete(sk, where) \
1229 ((GENERAL_NAME *)sk_delete( \
1230 CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk), (where)))
1231
1232#define sk_GENERAL_NAME_delete_ptr(sk, p) \
1233 ((GENERAL_NAME *)sk_delete_ptr( \
1234 CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk), \
1235 CHECKED_CAST(void *, GENERAL_NAME *, p)))
1236
1237#define sk_GENERAL_NAME_find(sk, out_index, p) \
1238 sk_find(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk), (out_index), \
1239 CHECKED_CAST(void *, GENERAL_NAME *, p))
1240
1241#define sk_GENERAL_NAME_shift(sk) \
1242 ((GENERAL_NAME *)sk_shift( \
1243 CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk)))
1244
1245#define sk_GENERAL_NAME_push(sk, p) \
1246 sk_push(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk), \
1247 CHECKED_CAST(void *, GENERAL_NAME *, p))
1248
1249#define sk_GENERAL_NAME_pop(sk) \
1250 ((GENERAL_NAME *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk)))
1251
1252#define sk_GENERAL_NAME_dup(sk) \
1253 ((STACK_OF(GENERAL_NAME) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -04001254 CHECKED_CAST(const _STACK *, const STACK_OF(GENERAL_NAME) *, sk)))
Adam Langley95c29f32014-06-20 12:00:00 -07001255
1256#define sk_GENERAL_NAME_sort(sk) \
1257 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk))
1258
1259#define sk_GENERAL_NAME_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -04001260 sk_is_sorted(CHECKED_CAST(const _STACK *, const STACK_OF(GENERAL_NAME) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -07001261
1262#define sk_GENERAL_NAME_set_cmp_func(sk, comp) \
1263 ((int (*)(const GENERAL_NAME **a, const GENERAL_NAME **b))sk_set_cmp_func( \
1264 CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk), \
1265 CHECKED_CAST(stack_cmp_func, \
1266 int (*)(const GENERAL_NAME **a, const GENERAL_NAME **b), \
1267 comp)))
1268
Adam Langleya1048a72015-02-11 14:27:21 -08001269#define sk_GENERAL_NAME_deep_copy(sk, copy_func, free_func) \
1270 ((STACK_OF(GENERAL_NAME) *)sk_deep_copy( \
1271 CHECKED_CAST(const _STACK *, const STACK_OF(GENERAL_NAME) *, sk), \
1272 CHECKED_CAST(void *(*)(void *), GENERAL_NAME *(*)(GENERAL_NAME *), \
1273 copy_func), \
1274 CHECKED_CAST(void (*)(void *), void (*)(GENERAL_NAME *), free_func)))
1275
Adam Langley95c29f32014-06-20 12:00:00 -07001276/* GENERAL_NAMES */
1277#define sk_GENERAL_NAMES_new(comp) \
1278 ((STACK_OF(GENERAL_NAMES) *)sk_new(CHECKED_CAST( \
1279 stack_cmp_func, \
1280 int (*)(const GENERAL_NAMES **a, const GENERAL_NAMES **b), comp)))
1281
1282#define sk_GENERAL_NAMES_new_null() ((STACK_OF(GENERAL_NAMES) *)sk_new_null())
1283
1284#define sk_GENERAL_NAMES_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -04001285 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(GENERAL_NAMES) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -07001286
1287#define sk_GENERAL_NAMES_zero(sk) \
1288 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk));
1289
1290#define sk_GENERAL_NAMES_value(sk, i) \
1291 ((GENERAL_NAMES *)sk_value( \
David Benjaminada97992016-05-13 13:14:28 -04001292 CHECKED_CAST(const _STACK *, const STACK_OF(GENERAL_NAMES) *, sk), (i)))
Adam Langley95c29f32014-06-20 12:00:00 -07001293
1294#define sk_GENERAL_NAMES_set(sk, i, p) \
1295 ((GENERAL_NAMES *)sk_set( \
1296 CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk), (i), \
1297 CHECKED_CAST(void *, GENERAL_NAMES *, p)))
1298
1299#define sk_GENERAL_NAMES_free(sk) \
1300 sk_free(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk))
1301
1302#define sk_GENERAL_NAMES_pop_free(sk, free_func) \
1303 sk_pop_free( \
1304 CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk), \
1305 CHECKED_CAST(void (*)(void *), void (*)(GENERAL_NAMES *), free_func))
1306
1307#define sk_GENERAL_NAMES_insert(sk, p, where) \
1308 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk), \
1309 CHECKED_CAST(void *, GENERAL_NAMES *, p), (where))
1310
1311#define sk_GENERAL_NAMES_delete(sk, where) \
1312 ((GENERAL_NAMES *)sk_delete( \
1313 CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk), (where)))
1314
1315#define sk_GENERAL_NAMES_delete_ptr(sk, p) \
1316 ((GENERAL_NAMES *)sk_delete_ptr( \
1317 CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk), \
1318 CHECKED_CAST(void *, GENERAL_NAMES *, p)))
1319
1320#define sk_GENERAL_NAMES_find(sk, out_index, p) \
1321 sk_find(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk), (out_index), \
1322 CHECKED_CAST(void *, GENERAL_NAMES *, p))
1323
1324#define sk_GENERAL_NAMES_shift(sk) \
1325 ((GENERAL_NAMES *)sk_shift( \
1326 CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk)))
1327
1328#define sk_GENERAL_NAMES_push(sk, p) \
1329 sk_push(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk), \
1330 CHECKED_CAST(void *, GENERAL_NAMES *, p))
1331
1332#define sk_GENERAL_NAMES_pop(sk) \
1333 ((GENERAL_NAMES *)sk_pop( \
1334 CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk)))
1335
1336#define sk_GENERAL_NAMES_dup(sk) \
1337 ((STACK_OF(GENERAL_NAMES) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -04001338 CHECKED_CAST(const _STACK *, const STACK_OF(GENERAL_NAMES) *, sk)))
Adam Langley95c29f32014-06-20 12:00:00 -07001339
1340#define sk_GENERAL_NAMES_sort(sk) \
1341 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk))
1342
1343#define sk_GENERAL_NAMES_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -04001344 sk_is_sorted( \
1345 CHECKED_CAST(const _STACK *, const STACK_OF(GENERAL_NAMES) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -07001346
1347#define sk_GENERAL_NAMES_set_cmp_func(sk, comp) \
1348 ((int (*)(const GENERAL_NAMES **a, const GENERAL_NAMES **b))sk_set_cmp_func( \
1349 CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk), \
1350 CHECKED_CAST(stack_cmp_func, \
1351 int (*)(const GENERAL_NAMES **a, const GENERAL_NAMES **b), \
1352 comp)))
1353
Adam Langleya1048a72015-02-11 14:27:21 -08001354#define sk_GENERAL_NAMES_deep_copy(sk, copy_func, free_func) \
1355 ((STACK_OF(GENERAL_NAMES) *)sk_deep_copy( \
1356 CHECKED_CAST(const _STACK *, const STACK_OF(GENERAL_NAMES) *, sk), \
1357 CHECKED_CAST(void *(*)(void *), GENERAL_NAMES *(*)(GENERAL_NAMES *), \
1358 copy_func), \
1359 CHECKED_CAST(void (*)(void *), void (*)(GENERAL_NAMES *), free_func)))
1360
Adam Langley95c29f32014-06-20 12:00:00 -07001361/* GENERAL_SUBTREE */
1362#define sk_GENERAL_SUBTREE_new(comp) \
1363 ((STACK_OF(GENERAL_SUBTREE) *)sk_new(CHECKED_CAST( \
1364 stack_cmp_func, \
1365 int (*)(const GENERAL_SUBTREE **a, const GENERAL_SUBTREE **b), comp)))
1366
1367#define sk_GENERAL_SUBTREE_new_null() \
1368 ((STACK_OF(GENERAL_SUBTREE) *)sk_new_null())
1369
1370#define sk_GENERAL_SUBTREE_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -04001371 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(GENERAL_SUBTREE) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -07001372
1373#define sk_GENERAL_SUBTREE_zero(sk) \
1374 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk));
1375
David Benjaminada97992016-05-13 13:14:28 -04001376#define sk_GENERAL_SUBTREE_value(sk, i) \
1377 ((GENERAL_SUBTREE *)sk_value( \
1378 CHECKED_CAST(const _STACK *, const STACK_OF(GENERAL_SUBTREE) *, sk), \
1379 (i)))
Adam Langley95c29f32014-06-20 12:00:00 -07001380
1381#define sk_GENERAL_SUBTREE_set(sk, i, p) \
1382 ((GENERAL_SUBTREE *)sk_set( \
1383 CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk), (i), \
1384 CHECKED_CAST(void *, GENERAL_SUBTREE *, p)))
1385
1386#define sk_GENERAL_SUBTREE_free(sk) \
1387 sk_free(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk))
1388
1389#define sk_GENERAL_SUBTREE_pop_free(sk, free_func) \
1390 sk_pop_free( \
1391 CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk), \
1392 CHECKED_CAST(void (*)(void *), void (*)(GENERAL_SUBTREE *), free_func))
1393
1394#define sk_GENERAL_SUBTREE_insert(sk, p, where) \
1395 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk), \
1396 CHECKED_CAST(void *, GENERAL_SUBTREE *, p), (where))
1397
1398#define sk_GENERAL_SUBTREE_delete(sk, where) \
1399 ((GENERAL_SUBTREE *)sk_delete( \
1400 CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk), (where)))
1401
1402#define sk_GENERAL_SUBTREE_delete_ptr(sk, p) \
1403 ((GENERAL_SUBTREE *)sk_delete_ptr( \
1404 CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk), \
1405 CHECKED_CAST(void *, GENERAL_SUBTREE *, p)))
1406
1407#define sk_GENERAL_SUBTREE_find(sk, out_index, p) \
1408 sk_find(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk), \
1409 (out_index), CHECKED_CAST(void *, GENERAL_SUBTREE *, p))
1410
1411#define sk_GENERAL_SUBTREE_shift(sk) \
1412 ((GENERAL_SUBTREE *)sk_shift( \
1413 CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk)))
1414
1415#define sk_GENERAL_SUBTREE_push(sk, p) \
1416 sk_push(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk), \
1417 CHECKED_CAST(void *, GENERAL_SUBTREE *, p))
1418
1419#define sk_GENERAL_SUBTREE_pop(sk) \
1420 ((GENERAL_SUBTREE *)sk_pop( \
1421 CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk)))
1422
1423#define sk_GENERAL_SUBTREE_dup(sk) \
1424 ((STACK_OF(GENERAL_SUBTREE) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -04001425 CHECKED_CAST(const _STACK *, const STACK_OF(GENERAL_SUBTREE) *, sk)))
Adam Langley95c29f32014-06-20 12:00:00 -07001426
1427#define sk_GENERAL_SUBTREE_sort(sk) \
1428 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk))
1429
1430#define sk_GENERAL_SUBTREE_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -04001431 sk_is_sorted( \
1432 CHECKED_CAST(const _STACK *, const STACK_OF(GENERAL_SUBTREE) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -07001433
Adam Langley2d96a672015-02-11 14:28:41 -08001434#define sk_GENERAL_SUBTREE_set_cmp_func(sk, comp) \
1435 ((int (*)(const GENERAL_SUBTREE **a, const GENERAL_SUBTREE **b)) \
1436 sk_set_cmp_func( \
1437 CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk), \
1438 CHECKED_CAST(stack_cmp_func, int (*)(const GENERAL_SUBTREE **a, \
1439 const GENERAL_SUBTREE **b), \
1440 comp)))
David Benjamin6f260012014-08-15 13:49:12 -04001441
Adam Langleya1048a72015-02-11 14:27:21 -08001442#define sk_GENERAL_SUBTREE_deep_copy(sk, copy_func, free_func) \
1443 ((STACK_OF(GENERAL_SUBTREE) *)sk_deep_copy( \
1444 CHECKED_CAST(const _STACK *, const STACK_OF(GENERAL_SUBTREE) *, sk), \
1445 CHECKED_CAST(void *(*)(void *), GENERAL_SUBTREE *(*)(GENERAL_SUBTREE *), \
1446 copy_func), \
1447 CHECKED_CAST(void (*)(void *), void (*)(GENERAL_SUBTREE *), free_func)))
1448
Adam Langley95c29f32014-06-20 12:00:00 -07001449/* POLICYINFO */
1450#define sk_POLICYINFO_new(comp) \
1451 ((STACK_OF(POLICYINFO) *)sk_new(CHECKED_CAST( \
1452 stack_cmp_func, int (*)(const POLICYINFO **a, const POLICYINFO **b), \
1453 comp)))
1454
1455#define sk_POLICYINFO_new_null() ((STACK_OF(POLICYINFO) *)sk_new_null())
1456
1457#define sk_POLICYINFO_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -04001458 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(POLICYINFO) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -07001459
1460#define sk_POLICYINFO_zero(sk) \
1461 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk));
1462
1463#define sk_POLICYINFO_value(sk, i) \
1464 ((POLICYINFO *)sk_value( \
David Benjaminada97992016-05-13 13:14:28 -04001465 CHECKED_CAST(const _STACK *, const STACK_OF(POLICYINFO) *, sk), (i)))
Adam Langley95c29f32014-06-20 12:00:00 -07001466
1467#define sk_POLICYINFO_set(sk, i, p) \
1468 ((POLICYINFO *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk), \
1469 (i), CHECKED_CAST(void *, POLICYINFO *, p)))
1470
1471#define sk_POLICYINFO_free(sk) \
1472 sk_free(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk))
1473
1474#define sk_POLICYINFO_pop_free(sk, free_func) \
1475 sk_pop_free( \
1476 CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk), \
1477 CHECKED_CAST(void (*)(void *), void (*)(POLICYINFO *), free_func))
1478
1479#define sk_POLICYINFO_insert(sk, p, where) \
1480 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk), \
1481 CHECKED_CAST(void *, POLICYINFO *, p), (where))
1482
1483#define sk_POLICYINFO_delete(sk, where) \
1484 ((POLICYINFO *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk), \
1485 (where)))
1486
1487#define sk_POLICYINFO_delete_ptr(sk, p) \
1488 ((POLICYINFO *)sk_delete_ptr( \
1489 CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk), \
1490 CHECKED_CAST(void *, POLICYINFO *, p)))
1491
1492#define sk_POLICYINFO_find(sk, out_index, p) \
1493 sk_find(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk), (out_index), \
1494 CHECKED_CAST(void *, POLICYINFO *, p))
1495
1496#define sk_POLICYINFO_shift(sk) \
1497 ((POLICYINFO *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk)))
1498
1499#define sk_POLICYINFO_push(sk, p) \
1500 sk_push(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk), \
1501 CHECKED_CAST(void *, POLICYINFO *, p))
1502
1503#define sk_POLICYINFO_pop(sk) \
1504 ((POLICYINFO *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk)))
1505
1506#define sk_POLICYINFO_dup(sk) \
1507 ((STACK_OF(POLICYINFO) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -04001508 CHECKED_CAST(const _STACK *, const STACK_OF(POLICYINFO) *, sk)))
Adam Langley95c29f32014-06-20 12:00:00 -07001509
1510#define sk_POLICYINFO_sort(sk) \
1511 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk))
1512
1513#define sk_POLICYINFO_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -04001514 sk_is_sorted(CHECKED_CAST(const _STACK *, const STACK_OF(POLICYINFO) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -07001515
1516#define sk_POLICYINFO_set_cmp_func(sk, comp) \
1517 ((int (*)(const POLICYINFO **a, const POLICYINFO **b))sk_set_cmp_func( \
1518 CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk), \
1519 CHECKED_CAST(stack_cmp_func, \
1520 int (*)(const POLICYINFO **a, const POLICYINFO **b), \
1521 comp)))
1522
Adam Langleya1048a72015-02-11 14:27:21 -08001523#define sk_POLICYINFO_deep_copy(sk, copy_func, free_func) \
1524 ((STACK_OF(POLICYINFO) *)sk_deep_copy( \
1525 CHECKED_CAST(const _STACK *, const STACK_OF(POLICYINFO) *, sk), \
1526 CHECKED_CAST(void *(*)(void *), POLICYINFO *(*)(POLICYINFO *), \
1527 copy_func), \
1528 CHECKED_CAST(void (*)(void *), void (*)(POLICYINFO *), free_func)))
1529
Adam Langley839b8812015-05-26 11:36:46 -07001530/* POLICYQUALINFO */
1531#define sk_POLICYQUALINFO_new(comp) \
1532 ((STACK_OF(POLICYQUALINFO) *)sk_new(CHECKED_CAST( \
1533 stack_cmp_func, \
1534 int (*)(const POLICYQUALINFO **a, const POLICYQUALINFO **b), comp)))
1535
1536#define sk_POLICYQUALINFO_new_null() ((STACK_OF(POLICYQUALINFO) *)sk_new_null())
1537
1538#define sk_POLICYQUALINFO_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -04001539 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(POLICYQUALINFO) *, sk))
Adam Langley839b8812015-05-26 11:36:46 -07001540
1541#define sk_POLICYQUALINFO_zero(sk) \
1542 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk));
1543
David Benjaminada97992016-05-13 13:14:28 -04001544#define sk_POLICYQUALINFO_value(sk, i) \
1545 ((POLICYQUALINFO *)sk_value( \
1546 CHECKED_CAST(const _STACK *, const STACK_OF(POLICYQUALINFO) *, sk), \
1547 (i)))
Adam Langley839b8812015-05-26 11:36:46 -07001548
1549#define sk_POLICYQUALINFO_set(sk, i, p) \
1550 ((POLICYQUALINFO *)sk_set( \
1551 CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk), (i), \
1552 CHECKED_CAST(void *, POLICYQUALINFO *, p)))
1553
1554#define sk_POLICYQUALINFO_free(sk) \
1555 sk_free(CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk))
1556
1557#define sk_POLICYQUALINFO_pop_free(sk, free_func) \
1558 sk_pop_free( \
1559 CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk), \
1560 CHECKED_CAST(void (*)(void *), void (*)(POLICYQUALINFO *), free_func))
1561
1562#define sk_POLICYQUALINFO_insert(sk, p, where) \
1563 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk), \
1564 CHECKED_CAST(void *, POLICYQUALINFO *, p), (where))
1565
1566#define sk_POLICYQUALINFO_delete(sk, where) \
1567 ((POLICYQUALINFO *)sk_delete( \
1568 CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk), (where)))
1569
1570#define sk_POLICYQUALINFO_delete_ptr(sk, p) \
1571 ((POLICYQUALINFO *)sk_delete_ptr( \
1572 CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk), \
1573 CHECKED_CAST(void *, POLICYQUALINFO *, p)))
1574
1575#define sk_POLICYQUALINFO_find(sk, out_index, p) \
1576 sk_find(CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk), (out_index), \
1577 CHECKED_CAST(void *, POLICYQUALINFO *, p))
1578
1579#define sk_POLICYQUALINFO_shift(sk) \
1580 ((POLICYQUALINFO *)sk_shift( \
1581 CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk)))
1582
1583#define sk_POLICYQUALINFO_push(sk, p) \
1584 sk_push(CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk), \
1585 CHECKED_CAST(void *, POLICYQUALINFO *, p))
1586
1587#define sk_POLICYQUALINFO_pop(sk) \
1588 ((POLICYQUALINFO *)sk_pop( \
1589 CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk)))
1590
1591#define sk_POLICYQUALINFO_dup(sk) \
1592 ((STACK_OF(POLICYQUALINFO) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -04001593 CHECKED_CAST(const _STACK *, const STACK_OF(POLICYQUALINFO) *, sk)))
Adam Langley839b8812015-05-26 11:36:46 -07001594
1595#define sk_POLICYQUALINFO_sort(sk) \
1596 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk))
1597
1598#define sk_POLICYQUALINFO_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -04001599 sk_is_sorted( \
1600 CHECKED_CAST(const _STACK *, const STACK_OF(POLICYQUALINFO) *, sk))
Adam Langley839b8812015-05-26 11:36:46 -07001601
1602#define sk_POLICYQUALINFO_set_cmp_func(sk, comp) \
1603 ((int (*)(const POLICYQUALINFO **a, const POLICYQUALINFO **b)) \
1604 sk_set_cmp_func( \
1605 CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk), \
1606 CHECKED_CAST(stack_cmp_func, int (*)(const POLICYQUALINFO **a, \
1607 const POLICYQUALINFO **b), \
1608 comp)))
1609
1610#define sk_POLICYQUALINFO_deep_copy(sk, copy_func, free_func) \
1611 ((STACK_OF(POLICYQUALINFO) *)sk_deep_copy( \
1612 CHECKED_CAST(const _STACK *, const STACK_OF(POLICYQUALINFO) *, sk), \
1613 CHECKED_CAST(void *(*)(void *), POLICYQUALINFO *(*)(POLICYQUALINFO *), \
1614 copy_func), \
1615 CHECKED_CAST(void (*)(void *), void (*)(POLICYQUALINFO *), free_func)))
1616
Adam Langley35349192015-07-21 11:06:45 -07001617/* POLICY_MAPPING */
1618#define sk_POLICY_MAPPING_new(comp) \
1619 ((STACK_OF(POLICY_MAPPING) *)sk_new(CHECKED_CAST( \
1620 stack_cmp_func, \
1621 int (*)(const POLICY_MAPPING **a, const POLICY_MAPPING **b), comp)))
1622
1623#define sk_POLICY_MAPPING_new_null() ((STACK_OF(POLICY_MAPPING) *)sk_new_null())
1624
1625#define sk_POLICY_MAPPING_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -04001626 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(POLICY_MAPPING) *, sk))
Adam Langley35349192015-07-21 11:06:45 -07001627
1628#define sk_POLICY_MAPPING_zero(sk) \
1629 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk));
1630
David Benjaminada97992016-05-13 13:14:28 -04001631#define sk_POLICY_MAPPING_value(sk, i) \
1632 ((POLICY_MAPPING *)sk_value( \
1633 CHECKED_CAST(const _STACK *, const STACK_OF(POLICY_MAPPING) *, sk), \
1634 (i)))
Adam Langley35349192015-07-21 11:06:45 -07001635
1636#define sk_POLICY_MAPPING_set(sk, i, p) \
1637 ((POLICY_MAPPING *)sk_set( \
1638 CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk), (i), \
1639 CHECKED_CAST(void *, POLICY_MAPPING *, p)))
1640
1641#define sk_POLICY_MAPPING_free(sk) \
1642 sk_free(CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk))
1643
1644#define sk_POLICY_MAPPING_pop_free(sk, free_func) \
1645 sk_pop_free( \
1646 CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk), \
1647 CHECKED_CAST(void (*)(void *), void (*)(POLICY_MAPPING *), free_func))
1648
1649#define sk_POLICY_MAPPING_insert(sk, p, where) \
1650 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk), \
1651 CHECKED_CAST(void *, POLICY_MAPPING *, p), (where))
1652
1653#define sk_POLICY_MAPPING_delete(sk, where) \
1654 ((POLICY_MAPPING *)sk_delete( \
1655 CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk), (where)))
1656
1657#define sk_POLICY_MAPPING_delete_ptr(sk, p) \
1658 ((POLICY_MAPPING *)sk_delete_ptr( \
1659 CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk), \
1660 CHECKED_CAST(void *, POLICY_MAPPING *, p)))
1661
1662#define sk_POLICY_MAPPING_find(sk, out_index, p) \
1663 sk_find(CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk), (out_index), \
1664 CHECKED_CAST(void *, POLICY_MAPPING *, p))
1665
1666#define sk_POLICY_MAPPING_shift(sk) \
1667 ((POLICY_MAPPING *)sk_shift( \
1668 CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk)))
1669
1670#define sk_POLICY_MAPPING_push(sk, p) \
1671 sk_push(CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk), \
1672 CHECKED_CAST(void *, POLICY_MAPPING *, p))
1673
1674#define sk_POLICY_MAPPING_pop(sk) \
1675 ((POLICY_MAPPING *)sk_pop( \
1676 CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk)))
1677
1678#define sk_POLICY_MAPPING_dup(sk) \
1679 ((STACK_OF(POLICY_MAPPING) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -04001680 CHECKED_CAST(const _STACK *, const STACK_OF(POLICY_MAPPING) *, sk)))
Adam Langley35349192015-07-21 11:06:45 -07001681
1682#define sk_POLICY_MAPPING_sort(sk) \
1683 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk))
1684
1685#define sk_POLICY_MAPPING_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -04001686 sk_is_sorted( \
1687 CHECKED_CAST(const _STACK *, const STACK_OF(POLICY_MAPPING) *, sk))
Adam Langley35349192015-07-21 11:06:45 -07001688
1689#define sk_POLICY_MAPPING_set_cmp_func(sk, comp) \
1690 ((int (*)(const POLICY_MAPPING **a, const POLICY_MAPPING **b)) \
1691 sk_set_cmp_func( \
1692 CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk), \
1693 CHECKED_CAST(stack_cmp_func, int (*)(const POLICY_MAPPING **a, \
1694 const POLICY_MAPPING **b), \
1695 comp)))
1696
1697#define sk_POLICY_MAPPING_deep_copy(sk, copy_func, free_func) \
1698 ((STACK_OF(POLICY_MAPPING) *)sk_deep_copy( \
1699 CHECKED_CAST(const _STACK *, const STACK_OF(POLICY_MAPPING) *, sk), \
1700 CHECKED_CAST(void *(*)(void *), POLICY_MAPPING *(*)(POLICY_MAPPING *), \
1701 copy_func), \
1702 CHECKED_CAST(void (*)(void *), void (*)(POLICY_MAPPING *), free_func)))
Adam Langley839b8812015-05-26 11:36:46 -07001703
1704/* RSA_additional_prime */
1705#define sk_RSA_additional_prime_new(comp) \
1706 ((STACK_OF(RSA_additional_prime) *)sk_new(CHECKED_CAST( \
1707 stack_cmp_func, \
1708 int (*)(const RSA_additional_prime **a, const RSA_additional_prime **b), \
1709 comp)))
1710
1711#define sk_RSA_additional_prime_new_null() \
1712 ((STACK_OF(RSA_additional_prime) *)sk_new_null())
1713
David Benjaminada97992016-05-13 13:14:28 -04001714#define sk_RSA_additional_prime_num(sk) \
1715 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(RSA_additional_prime) *, \
1716 sk))
Adam Langley839b8812015-05-26 11:36:46 -07001717
1718#define sk_RSA_additional_prime_zero(sk) \
1719 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(RSA_additional_prime) *, sk));
1720
David Benjaminada97992016-05-13 13:14:28 -04001721#define sk_RSA_additional_prime_value(sk, i) \
1722 ((RSA_additional_prime *)sk_value( \
1723 CHECKED_CAST(const _STACK *, const STACK_OF(RSA_additional_prime) *, \
1724 sk), \
Adam Langley839b8812015-05-26 11:36:46 -07001725 (i)))
1726
1727#define sk_RSA_additional_prime_set(sk, i, p) \
1728 ((RSA_additional_prime *)sk_set( \
1729 CHECKED_CAST(_STACK *, STACK_OF(RSA_additional_prime) *, sk), (i), \
1730 CHECKED_CAST(void *, RSA_additional_prime *, p)))
1731
1732#define sk_RSA_additional_prime_free(sk) \
1733 sk_free(CHECKED_CAST(_STACK *, STACK_OF(RSA_additional_prime) *, sk))
1734
1735#define sk_RSA_additional_prime_pop_free(sk, free_func) \
1736 sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(RSA_additional_prime) *, sk), \
1737 CHECKED_CAST(void (*)(void *), void (*)(RSA_additional_prime *), \
1738 free_func))
1739
1740#define sk_RSA_additional_prime_insert(sk, p, where) \
1741 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(RSA_additional_prime) *, sk), \
1742 CHECKED_CAST(void *, RSA_additional_prime *, p), (where))
1743
1744#define sk_RSA_additional_prime_delete(sk, where) \
1745 ((RSA_additional_prime *)sk_delete( \
1746 CHECKED_CAST(_STACK *, STACK_OF(RSA_additional_prime) *, sk), (where)))
1747
1748#define sk_RSA_additional_prime_delete_ptr(sk, p) \
1749 ((RSA_additional_prime *)sk_delete_ptr( \
1750 CHECKED_CAST(_STACK *, STACK_OF(RSA_additional_prime) *, sk), \
1751 CHECKED_CAST(void *, RSA_additional_prime *, p)))
1752
1753#define sk_RSA_additional_prime_find(sk, out_index, p) \
1754 sk_find(CHECKED_CAST(_STACK *, STACK_OF(RSA_additional_prime) *, sk), \
1755 (out_index), CHECKED_CAST(void *, RSA_additional_prime *, p))
1756
1757#define sk_RSA_additional_prime_shift(sk) \
1758 ((RSA_additional_prime *)sk_shift( \
1759 CHECKED_CAST(_STACK *, STACK_OF(RSA_additional_prime) *, sk)))
1760
1761#define sk_RSA_additional_prime_push(sk, p) \
1762 sk_push(CHECKED_CAST(_STACK *, STACK_OF(RSA_additional_prime) *, sk), \
1763 CHECKED_CAST(void *, RSA_additional_prime *, p))
1764
1765#define sk_RSA_additional_prime_pop(sk) \
1766 ((RSA_additional_prime *)sk_pop( \
1767 CHECKED_CAST(_STACK *, STACK_OF(RSA_additional_prime) *, sk)))
1768
David Benjaminada97992016-05-13 13:14:28 -04001769#define sk_RSA_additional_prime_dup(sk) \
1770 ((STACK_OF(RSA_additional_prime) *)sk_dup(CHECKED_CAST( \
1771 const _STACK *, const STACK_OF(RSA_additional_prime) *, sk)))
Adam Langley839b8812015-05-26 11:36:46 -07001772
1773#define sk_RSA_additional_prime_sort(sk) \
1774 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(RSA_additional_prime) *, sk))
1775
1776#define sk_RSA_additional_prime_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -04001777 sk_is_sorted(CHECKED_CAST(const _STACK *, \
1778 const STACK_OF(RSA_additional_prime) *, sk))
Adam Langley839b8812015-05-26 11:36:46 -07001779
1780#define sk_RSA_additional_prime_set_cmp_func(sk, comp) \
1781 ((int (*)(const RSA_additional_prime **a, const RSA_additional_prime **b)) \
1782 sk_set_cmp_func( \
1783 CHECKED_CAST(_STACK *, STACK_OF(RSA_additional_prime) *, sk), \
1784 CHECKED_CAST(stack_cmp_func, \
1785 int (*)(const RSA_additional_prime **a, \
1786 const RSA_additional_prime **b), \
1787 comp)))
1788
1789#define sk_RSA_additional_prime_deep_copy(sk, copy_func, free_func) \
1790 ((STACK_OF(RSA_additional_prime) *)sk_deep_copy( \
1791 CHECKED_CAST(const _STACK *, const STACK_OF(RSA_additional_prime) *, \
1792 sk), \
1793 CHECKED_CAST(void *(*)(void *), \
1794 RSA_additional_prime *(*)(RSA_additional_prime *), \
1795 copy_func), \
1796 CHECKED_CAST(void (*)(void *), void (*)(RSA_additional_prime *), \
1797 free_func)))
1798
Adam Langley95c29f32014-06-20 12:00:00 -07001799/* SSL_COMP */
1800#define sk_SSL_COMP_new(comp) \
1801 ((STACK_OF(SSL_COMP) *)sk_new(CHECKED_CAST( \
1802 stack_cmp_func, int (*)(const SSL_COMP **a, const SSL_COMP **b), comp)))
1803
1804#define sk_SSL_COMP_new_null() ((STACK_OF(SSL_COMP) *)sk_new_null())
1805
1806#define sk_SSL_COMP_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -04001807 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(SSL_COMP) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -07001808
1809#define sk_SSL_COMP_zero(sk) \
1810 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk));
1811
1812#define sk_SSL_COMP_value(sk, i) \
1813 ((SSL_COMP *)sk_value( \
David Benjaminada97992016-05-13 13:14:28 -04001814 CHECKED_CAST(const _STACK *, const STACK_OF(SSL_COMP) *, sk), (i)))
Adam Langley95c29f32014-06-20 12:00:00 -07001815
1816#define sk_SSL_COMP_set(sk, i, p) \
1817 ((SSL_COMP *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk), (i), \
1818 CHECKED_CAST(void *, SSL_COMP *, p)))
1819
1820#define sk_SSL_COMP_free(sk) \
1821 sk_free(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk))
1822
1823#define sk_SSL_COMP_pop_free(sk, free_func) \
1824 sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk), \
1825 CHECKED_CAST(void (*)(void *), void (*)(SSL_COMP *), free_func))
1826
1827#define sk_SSL_COMP_insert(sk, p, where) \
1828 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk), \
1829 CHECKED_CAST(void *, SSL_COMP *, p), (where))
1830
1831#define sk_SSL_COMP_delete(sk, where) \
1832 ((SSL_COMP *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk), \
1833 (where)))
1834
1835#define sk_SSL_COMP_delete_ptr(sk, p) \
1836 ((SSL_COMP *)sk_delete_ptr(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk), \
1837 CHECKED_CAST(void *, SSL_COMP *, p)))
1838
1839#define sk_SSL_COMP_find(sk, out_index, p) \
1840 sk_find(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk), (out_index), \
1841 CHECKED_CAST(void *, SSL_COMP *, p))
1842
1843#define sk_SSL_COMP_shift(sk) \
1844 ((SSL_COMP *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk)))
1845
1846#define sk_SSL_COMP_push(sk, p) \
1847 sk_push(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk), \
1848 CHECKED_CAST(void *, SSL_COMP *, p))
1849
1850#define sk_SSL_COMP_pop(sk) \
1851 ((SSL_COMP *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk)))
1852
1853#define sk_SSL_COMP_dup(sk) \
1854 ((STACK_OF(SSL_COMP) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -04001855 CHECKED_CAST(const _STACK *, const STACK_OF(SSL_COMP) *, sk)))
Adam Langley95c29f32014-06-20 12:00:00 -07001856
1857#define sk_SSL_COMP_sort(sk) \
1858 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk))
1859
1860#define sk_SSL_COMP_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -04001861 sk_is_sorted(CHECKED_CAST(const _STACK *, const STACK_OF(SSL_COMP) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -07001862
1863#define sk_SSL_COMP_set_cmp_func(sk, comp) \
1864 ((int (*)(const SSL_COMP **a, const SSL_COMP **b))sk_set_cmp_func( \
1865 CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk), \
1866 CHECKED_CAST(stack_cmp_func, \
1867 int (*)(const SSL_COMP **a, const SSL_COMP **b), comp)))
1868
Adam Langleya1048a72015-02-11 14:27:21 -08001869#define sk_SSL_COMP_deep_copy(sk, copy_func, free_func) \
1870 ((STACK_OF(SSL_COMP) *)sk_deep_copy( \
1871 CHECKED_CAST(const _STACK *, const STACK_OF(SSL_COMP) *, sk), \
1872 CHECKED_CAST(void *(*)(void *), SSL_COMP *(*)(SSL_COMP *), copy_func), \
1873 CHECKED_CAST(void (*)(void *), void (*)(SSL_COMP *), free_func)))
1874
Adam Langley09505632015-07-30 18:10:13 -07001875/* SSL_CUSTOM_EXTENSION */
1876#define sk_SSL_CUSTOM_EXTENSION_new(comp) \
1877 ((STACK_OF(SSL_CUSTOM_EXTENSION) *)sk_new(CHECKED_CAST( \
1878 stack_cmp_func, \
1879 int (*)(const SSL_CUSTOM_EXTENSION **a, const SSL_CUSTOM_EXTENSION **b), \
1880 comp)))
1881
1882#define sk_SSL_CUSTOM_EXTENSION_new_null() \
1883 ((STACK_OF(SSL_CUSTOM_EXTENSION) *)sk_new_null())
1884
David Benjaminada97992016-05-13 13:14:28 -04001885#define sk_SSL_CUSTOM_EXTENSION_num(sk) \
1886 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(SSL_CUSTOM_EXTENSION) *, \
1887 sk))
Adam Langley09505632015-07-30 18:10:13 -07001888
1889#define sk_SSL_CUSTOM_EXTENSION_zero(sk) \
1890 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(SSL_CUSTOM_EXTENSION) *, sk));
1891
David Benjaminada97992016-05-13 13:14:28 -04001892#define sk_SSL_CUSTOM_EXTENSION_value(sk, i) \
1893 ((SSL_CUSTOM_EXTENSION *)sk_value( \
1894 CHECKED_CAST(const _STACK *, const STACK_OF(SSL_CUSTOM_EXTENSION) *, \
1895 sk), \
Adam Langley09505632015-07-30 18:10:13 -07001896 (i)))
1897
1898#define sk_SSL_CUSTOM_EXTENSION_set(sk, i, p) \
1899 ((SSL_CUSTOM_EXTENSION *)sk_set( \
1900 CHECKED_CAST(_STACK *, STACK_OF(SSL_CUSTOM_EXTENSION) *, sk), (i), \
1901 CHECKED_CAST(void *, SSL_CUSTOM_EXTENSION *, p)))
1902
1903#define sk_SSL_CUSTOM_EXTENSION_free(sk) \
1904 sk_free(CHECKED_CAST(_STACK *, STACK_OF(SSL_CUSTOM_EXTENSION) *, sk))
1905
1906#define sk_SSL_CUSTOM_EXTENSION_pop_free(sk, free_func) \
1907 sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(SSL_CUSTOM_EXTENSION) *, sk), \
1908 CHECKED_CAST(void (*)(void *), void (*)(SSL_CUSTOM_EXTENSION *), \
1909 free_func))
1910
1911#define sk_SSL_CUSTOM_EXTENSION_insert(sk, p, where) \
1912 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(SSL_CUSTOM_EXTENSION) *, sk), \
1913 CHECKED_CAST(void *, SSL_CUSTOM_EXTENSION *, p), (where))
1914
1915#define sk_SSL_CUSTOM_EXTENSION_delete(sk, where) \
1916 ((SSL_CUSTOM_EXTENSION *)sk_delete( \
1917 CHECKED_CAST(_STACK *, STACK_OF(SSL_CUSTOM_EXTENSION) *, sk), (where)))
1918
1919#define sk_SSL_CUSTOM_EXTENSION_delete_ptr(sk, p) \
1920 ((SSL_CUSTOM_EXTENSION *)sk_delete_ptr( \
1921 CHECKED_CAST(_STACK *, STACK_OF(SSL_CUSTOM_EXTENSION) *, sk), \
1922 CHECKED_CAST(void *, SSL_CUSTOM_EXTENSION *, p)))
1923
1924#define sk_SSL_CUSTOM_EXTENSION_find(sk, out_index, p) \
1925 sk_find(CHECKED_CAST(_STACK *, STACK_OF(SSL_CUSTOM_EXTENSION) *, sk), \
1926 (out_index), CHECKED_CAST(void *, SSL_CUSTOM_EXTENSION *, p))
1927
1928#define sk_SSL_CUSTOM_EXTENSION_shift(sk) \
1929 ((SSL_CUSTOM_EXTENSION *)sk_shift( \
1930 CHECKED_CAST(_STACK *, STACK_OF(SSL_CUSTOM_EXTENSION) *, sk)))
1931
1932#define sk_SSL_CUSTOM_EXTENSION_push(sk, p) \
1933 sk_push(CHECKED_CAST(_STACK *, STACK_OF(SSL_CUSTOM_EXTENSION) *, sk), \
1934 CHECKED_CAST(void *, SSL_CUSTOM_EXTENSION *, p))
1935
1936#define sk_SSL_CUSTOM_EXTENSION_pop(sk) \
1937 ((SSL_CUSTOM_EXTENSION *)sk_pop( \
1938 CHECKED_CAST(_STACK *, STACK_OF(SSL_CUSTOM_EXTENSION) *, sk)))
1939
David Benjaminada97992016-05-13 13:14:28 -04001940#define sk_SSL_CUSTOM_EXTENSION_dup(sk) \
1941 ((STACK_OF(SSL_CUSTOM_EXTENSION) *)sk_dup(CHECKED_CAST( \
1942 const _STACK *, const STACK_OF(SSL_CUSTOM_EXTENSION) *, sk)))
Adam Langley09505632015-07-30 18:10:13 -07001943
1944#define sk_SSL_CUSTOM_EXTENSION_sort(sk) \
1945 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(SSL_CUSTOM_EXTENSION) *, sk))
1946
1947#define sk_SSL_CUSTOM_EXTENSION_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -04001948 sk_is_sorted(CHECKED_CAST(const _STACK *, \
1949 const STACK_OF(SSL_CUSTOM_EXTENSION) *, sk))
Adam Langley09505632015-07-30 18:10:13 -07001950
1951#define sk_SSL_CUSTOM_EXTENSION_set_cmp_func(sk, comp) \
1952 ((int (*)(const SSL_CUSTOM_EXTENSION **a, const SSL_CUSTOM_EXTENSION **b)) \
1953 sk_set_cmp_func( \
1954 CHECKED_CAST(_STACK *, STACK_OF(SSL_CUSTOM_EXTENSION) *, sk), \
1955 CHECKED_CAST(stack_cmp_func, \
1956 int (*)(const SSL_CUSTOM_EXTENSION **a, \
1957 const SSL_CUSTOM_EXTENSION **b), \
1958 comp)))
1959
1960#define sk_SSL_CUSTOM_EXTENSION_deep_copy(sk, copy_func, free_func) \
1961 ((STACK_OF(SSL_CUSTOM_EXTENSION) *)sk_deep_copy( \
1962 CHECKED_CAST(const _STACK *, const STACK_OF(SSL_CUSTOM_EXTENSION) *, \
1963 sk), \
1964 CHECKED_CAST(void *(*)(void *), \
1965 SSL_CUSTOM_EXTENSION *(*)(SSL_CUSTOM_EXTENSION *), \
1966 copy_func), \
1967 CHECKED_CAST(void (*)(void *), void (*)(SSL_CUSTOM_EXTENSION *), \
1968 free_func)))
1969
Adam Langley95c29f32014-06-20 12:00:00 -07001970/* STACK_OF_X509_NAME_ENTRY */
1971#define sk_STACK_OF_X509_NAME_ENTRY_new(comp) \
1972 ((STACK_OF(STACK_OF_X509_NAME_ENTRY) *)sk_new(CHECKED_CAST( \
1973 stack_cmp_func, int (*)(const STACK_OF_X509_NAME_ENTRY **a, \
1974 const STACK_OF_X509_NAME_ENTRY **b), \
1975 comp)))
1976
1977#define sk_STACK_OF_X509_NAME_ENTRY_new_null() \
1978 ((STACK_OF(STACK_OF_X509_NAME_ENTRY) *)sk_new_null())
1979
1980#define sk_STACK_OF_X509_NAME_ENTRY_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -04001981 sk_num(CHECKED_CAST(const _STACK *, \
1982 const STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -07001983
1984#define sk_STACK_OF_X509_NAME_ENTRY_zero(sk) \
1985 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk));
1986
David Benjaminada97992016-05-13 13:14:28 -04001987#define sk_STACK_OF_X509_NAME_ENTRY_value(sk, i) \
1988 ((STACK_OF_X509_NAME_ENTRY *)sk_value( \
1989 CHECKED_CAST(const _STACK *, const STACK_OF(STACK_OF_X509_NAME_ENTRY) *, \
1990 sk), \
Adam Langley95c29f32014-06-20 12:00:00 -07001991 (i)))
1992
1993#define sk_STACK_OF_X509_NAME_ENTRY_set(sk, i, p) \
1994 ((STACK_OF_X509_NAME_ENTRY *)sk_set( \
1995 CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk), (i), \
1996 CHECKED_CAST(void *, STACK_OF_X509_NAME_ENTRY *, p)))
1997
1998#define sk_STACK_OF_X509_NAME_ENTRY_free(sk) \
1999 sk_free(CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk))
2000
2001#define sk_STACK_OF_X509_NAME_ENTRY_pop_free(sk, free_func) \
2002 sk_pop_free( \
2003 CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk), \
2004 CHECKED_CAST(void (*)(void *), void (*)(STACK_OF_X509_NAME_ENTRY *), \
2005 free_func))
2006
2007#define sk_STACK_OF_X509_NAME_ENTRY_insert(sk, p, where) \
2008 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk), \
2009 CHECKED_CAST(void *, STACK_OF_X509_NAME_ENTRY *, p), (where))
2010
2011#define sk_STACK_OF_X509_NAME_ENTRY_delete(sk, where) \
2012 ((STACK_OF_X509_NAME_ENTRY *)sk_delete( \
2013 CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk), \
2014 (where)))
2015
2016#define sk_STACK_OF_X509_NAME_ENTRY_delete_ptr(sk, p) \
2017 ((STACK_OF_X509_NAME_ENTRY *)sk_delete_ptr( \
2018 CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk), \
2019 CHECKED_CAST(void *, STACK_OF_X509_NAME_ENTRY *, p)))
2020
2021#define sk_STACK_OF_X509_NAME_ENTRY_find(sk, out_index, p) \
2022 sk_find(CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk), \
2023 (out_index), CHECKED_CAST(void *, STACK_OF_X509_NAME_ENTRY *, p))
2024
2025#define sk_STACK_OF_X509_NAME_ENTRY_shift(sk) \
2026 ((STACK_OF_X509_NAME_ENTRY *)sk_shift( \
2027 CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk)))
2028
2029#define sk_STACK_OF_X509_NAME_ENTRY_push(sk, p) \
2030 sk_push(CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk), \
2031 CHECKED_CAST(void *, STACK_OF_X509_NAME_ENTRY *, p))
2032
2033#define sk_STACK_OF_X509_NAME_ENTRY_pop(sk) \
2034 ((STACK_OF_X509_NAME_ENTRY *)sk_pop( \
2035 CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk)))
2036
David Benjaminada97992016-05-13 13:14:28 -04002037#define sk_STACK_OF_X509_NAME_ENTRY_dup(sk) \
2038 ((STACK_OF(STACK_OF_X509_NAME_ENTRY) *)sk_dup(CHECKED_CAST( \
2039 const _STACK *, const STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk)))
Adam Langley95c29f32014-06-20 12:00:00 -07002040
2041#define sk_STACK_OF_X509_NAME_ENTRY_sort(sk) \
2042 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk))
2043
2044#define sk_STACK_OF_X509_NAME_ENTRY_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -04002045 sk_is_sorted(CHECKED_CAST(const _STACK *, \
2046 const STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -07002047
Adam Langley2d96a672015-02-11 14:28:41 -08002048#define sk_STACK_OF_X509_NAME_ENTRY_set_cmp_func(sk, comp) \
2049 ((int (*)(const STACK_OF_X509_NAME_ENTRY **a, \
2050 const STACK_OF_X509_NAME_ENTRY **b)) \
2051 sk_set_cmp_func( \
2052 CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk), \
2053 CHECKED_CAST(stack_cmp_func, \
2054 int (*)(const STACK_OF_X509_NAME_ENTRY **a, \
2055 const STACK_OF_X509_NAME_ENTRY **b), \
2056 comp)))
David Benjamin6f260012014-08-15 13:49:12 -04002057
Adam Langleya1048a72015-02-11 14:27:21 -08002058#define sk_STACK_OF_X509_NAME_ENTRY_deep_copy(sk, copy_func, free_func) \
2059 ((STACK_OF(STACK_OF_X509_NAME_ENTRY) *)sk_deep_copy( \
2060 CHECKED_CAST(const _STACK *, const STACK_OF(STACK_OF_X509_NAME_ENTRY) *, \
2061 sk), \
2062 CHECKED_CAST(void *(*)(void *), \
2063 STACK_OF_X509_NAME_ENTRY *(*)(STACK_OF_X509_NAME_ENTRY *), \
2064 copy_func), \
2065 CHECKED_CAST(void (*)(void *), void (*)(STACK_OF_X509_NAME_ENTRY *), \
2066 free_func)))
2067
Adam Langley95c29f32014-06-20 12:00:00 -07002068/* SXNETID */
2069#define sk_SXNETID_new(comp) \
2070 ((STACK_OF(SXNETID) *)sk_new(CHECKED_CAST( \
2071 stack_cmp_func, int (*)(const SXNETID **a, const SXNETID **b), comp)))
2072
2073#define sk_SXNETID_new_null() ((STACK_OF(SXNETID) *)sk_new_null())
2074
2075#define sk_SXNETID_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -04002076 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(SXNETID) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -07002077
2078#define sk_SXNETID_zero(sk) \
2079 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk));
2080
David Benjaminada97992016-05-13 13:14:28 -04002081#define sk_SXNETID_value(sk, i) \
2082 ((SXNETID *)sk_value( \
2083 CHECKED_CAST(const _STACK *, const STACK_OF(SXNETID) *, sk), (i)))
Adam Langley95c29f32014-06-20 12:00:00 -07002084
2085#define sk_SXNETID_set(sk, i, p) \
2086 ((SXNETID *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk), (i), \
2087 CHECKED_CAST(void *, SXNETID *, p)))
2088
2089#define sk_SXNETID_free(sk) \
2090 sk_free(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk))
2091
2092#define sk_SXNETID_pop_free(sk, free_func) \
2093 sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk), \
2094 CHECKED_CAST(void (*)(void *), void (*)(SXNETID *), free_func))
2095
2096#define sk_SXNETID_insert(sk, p, where) \
2097 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk), \
2098 CHECKED_CAST(void *, SXNETID *, p), (where))
2099
2100#define sk_SXNETID_delete(sk, where) \
2101 ((SXNETID *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk), \
2102 (where)))
2103
2104#define sk_SXNETID_delete_ptr(sk, p) \
2105 ((SXNETID *)sk_delete_ptr(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk), \
2106 CHECKED_CAST(void *, SXNETID *, p)))
2107
2108#define sk_SXNETID_find(sk, out_index, p) \
2109 sk_find(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk), (out_index), \
2110 CHECKED_CAST(void *, SXNETID *, p))
2111
2112#define sk_SXNETID_shift(sk) \
2113 ((SXNETID *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk)))
2114
2115#define sk_SXNETID_push(sk, p) \
2116 sk_push(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk), \
2117 CHECKED_CAST(void *, SXNETID *, p))
2118
2119#define sk_SXNETID_pop(sk) \
2120 ((SXNETID *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk)))
2121
2122#define sk_SXNETID_dup(sk) \
2123 ((STACK_OF(SXNETID) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -04002124 CHECKED_CAST(const _STACK *, const STACK_OF(SXNETID) *, sk)))
Adam Langley95c29f32014-06-20 12:00:00 -07002125
2126#define sk_SXNETID_sort(sk) \
2127 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk))
2128
2129#define sk_SXNETID_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -04002130 sk_is_sorted(CHECKED_CAST(const _STACK *, const STACK_OF(SXNETID) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -07002131
2132#define sk_SXNETID_set_cmp_func(sk, comp) \
2133 ((int (*)(const SXNETID **a, const SXNETID **b))sk_set_cmp_func( \
2134 CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk), \
2135 CHECKED_CAST(stack_cmp_func, \
2136 int (*)(const SXNETID **a, const SXNETID **b), comp)))
2137
Adam Langleya1048a72015-02-11 14:27:21 -08002138#define sk_SXNETID_deep_copy(sk, copy_func, free_func) \
2139 ((STACK_OF(SXNETID) *)sk_deep_copy( \
2140 CHECKED_CAST(const _STACK *, const STACK_OF(SXNETID) *, sk), \
2141 CHECKED_CAST(void *(*)(void *), SXNETID *(*)(SXNETID *), copy_func), \
2142 CHECKED_CAST(void (*)(void *), void (*)(SXNETID *), free_func)))
2143
Adam Langley95c29f32014-06-20 12:00:00 -07002144/* X509 */
2145#define sk_X509_new(comp) \
2146 ((STACK_OF(X509) *)sk_new(CHECKED_CAST( \
2147 stack_cmp_func, int (*)(const X509 **a, const X509 **b), comp)))
2148
2149#define sk_X509_new_null() ((STACK_OF(X509) *)sk_new_null())
2150
David Benjaminada97992016-05-13 13:14:28 -04002151#define sk_X509_num(sk) \
2152 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(X509) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -07002153
2154#define sk_X509_zero(sk) sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk));
2155
David Benjaminada97992016-05-13 13:14:28 -04002156#define sk_X509_value(sk, i) \
2157 ((X509 *)sk_value(CHECKED_CAST(const _STACK *, const STACK_OF(X509) *, sk), \
2158 (i)))
Adam Langley95c29f32014-06-20 12:00:00 -07002159
2160#define sk_X509_set(sk, i, p) \
2161 ((X509 *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk), (i), \
2162 CHECKED_CAST(void *, X509 *, p)))
2163
2164#define sk_X509_free(sk) sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk))
2165
2166#define sk_X509_pop_free(sk, free_func) \
2167 sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk), \
2168 CHECKED_CAST(void (*)(void *), void (*)(X509 *), free_func))
2169
2170#define sk_X509_insert(sk, p, where) \
2171 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk), \
2172 CHECKED_CAST(void *, X509 *, p), (where))
2173
2174#define sk_X509_delete(sk, where) \
2175 ((X509 *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk), (where)))
2176
2177#define sk_X509_delete_ptr(sk, p) \
2178 ((X509 *)sk_delete_ptr(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk), \
2179 CHECKED_CAST(void *, X509 *, p)))
2180
2181#define sk_X509_find(sk, out_index, p) \
2182 sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk), (out_index), \
2183 CHECKED_CAST(void *, X509 *, p))
2184
2185#define sk_X509_shift(sk) \
2186 ((X509 *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk)))
2187
2188#define sk_X509_push(sk, p) \
2189 sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk), \
2190 CHECKED_CAST(void *, X509 *, p))
2191
2192#define sk_X509_pop(sk) \
2193 ((X509 *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk)))
2194
David Benjaminada97992016-05-13 13:14:28 -04002195#define sk_X509_dup(sk) \
2196 ((STACK_OF(X509) *)sk_dup( \
2197 CHECKED_CAST(const _STACK *, const STACK_OF(X509) *, sk)))
Adam Langley95c29f32014-06-20 12:00:00 -07002198
2199#define sk_X509_sort(sk) sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk))
2200
2201#define sk_X509_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -04002202 sk_is_sorted(CHECKED_CAST(const _STACK *, const STACK_OF(X509) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -07002203
2204#define sk_X509_set_cmp_func(sk, comp) \
2205 ((int (*)(const X509 **a, const X509 **b))sk_set_cmp_func( \
2206 CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk), \
2207 CHECKED_CAST(stack_cmp_func, int (*)(const X509 **a, const X509 **b), \
2208 comp)))
2209
Adam Langleya1048a72015-02-11 14:27:21 -08002210#define sk_X509_deep_copy(sk, copy_func, free_func) \
2211 ((STACK_OF(X509) *)sk_deep_copy( \
2212 CHECKED_CAST(const _STACK *, const STACK_OF(X509) *, sk), \
2213 CHECKED_CAST(void *(*)(void *), X509 *(*)(X509 *), copy_func), \
2214 CHECKED_CAST(void (*)(void *), void (*)(X509 *), free_func)))
2215
Adam Langley95c29f32014-06-20 12:00:00 -07002216/* X509V3_EXT_METHOD */
2217#define sk_X509V3_EXT_METHOD_new(comp) \
2218 ((STACK_OF(X509V3_EXT_METHOD) *)sk_new(CHECKED_CAST( \
2219 stack_cmp_func, \
2220 int (*)(const X509V3_EXT_METHOD **a, const X509V3_EXT_METHOD **b), \
2221 comp)))
2222
2223#define sk_X509V3_EXT_METHOD_new_null() \
2224 ((STACK_OF(X509V3_EXT_METHOD) *)sk_new_null())
2225
2226#define sk_X509V3_EXT_METHOD_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -04002227 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(X509V3_EXT_METHOD) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -07002228
2229#define sk_X509V3_EXT_METHOD_zero(sk) \
2230 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk));
2231
David Benjaminada97992016-05-13 13:14:28 -04002232#define sk_X509V3_EXT_METHOD_value(sk, i) \
2233 ((X509V3_EXT_METHOD *)sk_value( \
2234 CHECKED_CAST(const _STACK *, const STACK_OF(X509V3_EXT_METHOD) *, sk), \
2235 (i)))
Adam Langley95c29f32014-06-20 12:00:00 -07002236
2237#define sk_X509V3_EXT_METHOD_set(sk, i, p) \
2238 ((X509V3_EXT_METHOD *)sk_set( \
2239 CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk), (i), \
2240 CHECKED_CAST(void *, X509V3_EXT_METHOD *, p)))
2241
2242#define sk_X509V3_EXT_METHOD_free(sk) \
2243 sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk))
2244
2245#define sk_X509V3_EXT_METHOD_pop_free(sk, free_func) \
2246 sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk), \
2247 CHECKED_CAST(void (*)(void *), void (*)(X509V3_EXT_METHOD *), \
2248 free_func))
2249
2250#define sk_X509V3_EXT_METHOD_insert(sk, p, where) \
2251 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk), \
2252 CHECKED_CAST(void *, X509V3_EXT_METHOD *, p), (where))
2253
2254#define sk_X509V3_EXT_METHOD_delete(sk, where) \
2255 ((X509V3_EXT_METHOD *)sk_delete( \
2256 CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk), (where)))
2257
2258#define sk_X509V3_EXT_METHOD_delete_ptr(sk, p) \
2259 ((X509V3_EXT_METHOD *)sk_delete_ptr( \
2260 CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk), \
2261 CHECKED_CAST(void *, X509V3_EXT_METHOD *, p)))
2262
2263#define sk_X509V3_EXT_METHOD_find(sk, out_index, p) \
2264 sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk), \
2265 (out_index), CHECKED_CAST(void *, X509V3_EXT_METHOD *, p))
2266
2267#define sk_X509V3_EXT_METHOD_shift(sk) \
2268 ((X509V3_EXT_METHOD *)sk_shift( \
2269 CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk)))
2270
2271#define sk_X509V3_EXT_METHOD_push(sk, p) \
2272 sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk), \
2273 CHECKED_CAST(void *, X509V3_EXT_METHOD *, p))
2274
2275#define sk_X509V3_EXT_METHOD_pop(sk) \
2276 ((X509V3_EXT_METHOD *)sk_pop( \
2277 CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk)))
2278
2279#define sk_X509V3_EXT_METHOD_dup(sk) \
2280 ((STACK_OF(X509V3_EXT_METHOD) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -04002281 CHECKED_CAST(const _STACK *, const STACK_OF(X509V3_EXT_METHOD) *, sk)))
Adam Langley95c29f32014-06-20 12:00:00 -07002282
2283#define sk_X509V3_EXT_METHOD_sort(sk) \
2284 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk))
2285
2286#define sk_X509V3_EXT_METHOD_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -04002287 sk_is_sorted( \
2288 CHECKED_CAST(const _STACK *, const STACK_OF(X509V3_EXT_METHOD) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -07002289
Adam Langley2d96a672015-02-11 14:28:41 -08002290#define sk_X509V3_EXT_METHOD_set_cmp_func(sk, comp) \
2291 ((int (*)(const X509V3_EXT_METHOD **a, const X509V3_EXT_METHOD **b)) \
2292 sk_set_cmp_func( \
2293 CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk), \
2294 CHECKED_CAST(stack_cmp_func, int (*)(const X509V3_EXT_METHOD **a, \
2295 const X509V3_EXT_METHOD **b), \
2296 comp)))
David Benjamin6f260012014-08-15 13:49:12 -04002297
Adam Langleya1048a72015-02-11 14:27:21 -08002298#define sk_X509V3_EXT_METHOD_deep_copy(sk, copy_func, free_func) \
2299 ((STACK_OF(X509V3_EXT_METHOD) *)sk_deep_copy( \
2300 CHECKED_CAST(const _STACK *, const STACK_OF(X509V3_EXT_METHOD) *, sk), \
2301 CHECKED_CAST(void *(*)(void *), \
2302 X509V3_EXT_METHOD *(*)(X509V3_EXT_METHOD *), copy_func), \
2303 CHECKED_CAST(void (*)(void *), void (*)(X509V3_EXT_METHOD *), \
2304 free_func)))
2305
Adam Langley35349192015-07-21 11:06:45 -07002306/* X509_ALGOR */
2307#define sk_X509_ALGOR_new(comp) \
2308 ((STACK_OF(X509_ALGOR) *)sk_new(CHECKED_CAST( \
2309 stack_cmp_func, int (*)(const X509_ALGOR **a, const X509_ALGOR **b), \
2310 comp)))
2311
2312#define sk_X509_ALGOR_new_null() ((STACK_OF(X509_ALGOR) *)sk_new_null())
2313
2314#define sk_X509_ALGOR_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -04002315 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(X509_ALGOR) *, sk))
Adam Langley35349192015-07-21 11:06:45 -07002316
2317#define sk_X509_ALGOR_zero(sk) \
2318 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk));
2319
2320#define sk_X509_ALGOR_value(sk, i) \
2321 ((X509_ALGOR *)sk_value( \
David Benjaminada97992016-05-13 13:14:28 -04002322 CHECKED_CAST(const _STACK *, const STACK_OF(X509_ALGOR) *, sk), (i)))
Adam Langley35349192015-07-21 11:06:45 -07002323
2324#define sk_X509_ALGOR_set(sk, i, p) \
2325 ((X509_ALGOR *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk), \
2326 (i), CHECKED_CAST(void *, X509_ALGOR *, p)))
2327
2328#define sk_X509_ALGOR_free(sk) \
2329 sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk))
2330
2331#define sk_X509_ALGOR_pop_free(sk, free_func) \
2332 sk_pop_free( \
2333 CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk), \
2334 CHECKED_CAST(void (*)(void *), void (*)(X509_ALGOR *), free_func))
2335
2336#define sk_X509_ALGOR_insert(sk, p, where) \
2337 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk), \
2338 CHECKED_CAST(void *, X509_ALGOR *, p), (where))
2339
2340#define sk_X509_ALGOR_delete(sk, where) \
2341 ((X509_ALGOR *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk), \
2342 (where)))
2343
2344#define sk_X509_ALGOR_delete_ptr(sk, p) \
2345 ((X509_ALGOR *)sk_delete_ptr( \
2346 CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk), \
2347 CHECKED_CAST(void *, X509_ALGOR *, p)))
2348
2349#define sk_X509_ALGOR_find(sk, out_index, p) \
2350 sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk), (out_index), \
2351 CHECKED_CAST(void *, X509_ALGOR *, p))
2352
2353#define sk_X509_ALGOR_shift(sk) \
2354 ((X509_ALGOR *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk)))
2355
2356#define sk_X509_ALGOR_push(sk, p) \
2357 sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk), \
2358 CHECKED_CAST(void *, X509_ALGOR *, p))
2359
2360#define sk_X509_ALGOR_pop(sk) \
2361 ((X509_ALGOR *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk)))
2362
2363#define sk_X509_ALGOR_dup(sk) \
2364 ((STACK_OF(X509_ALGOR) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -04002365 CHECKED_CAST(const _STACK *, const STACK_OF(X509_ALGOR) *, sk)))
Adam Langley35349192015-07-21 11:06:45 -07002366
2367#define sk_X509_ALGOR_sort(sk) \
2368 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk))
2369
2370#define sk_X509_ALGOR_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -04002371 sk_is_sorted(CHECKED_CAST(const _STACK *, const STACK_OF(X509_ALGOR) *, sk))
Adam Langley35349192015-07-21 11:06:45 -07002372
2373#define sk_X509_ALGOR_set_cmp_func(sk, comp) \
2374 ((int (*)(const X509_ALGOR **a, const X509_ALGOR **b))sk_set_cmp_func( \
2375 CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk), \
2376 CHECKED_CAST(stack_cmp_func, \
2377 int (*)(const X509_ALGOR **a, const X509_ALGOR **b), \
2378 comp)))
2379
2380#define sk_X509_ALGOR_deep_copy(sk, copy_func, free_func) \
2381 ((STACK_OF(X509_ALGOR) *)sk_deep_copy( \
2382 CHECKED_CAST(const _STACK *, const STACK_OF(X509_ALGOR) *, sk), \
2383 CHECKED_CAST(void *(*)(void *), X509_ALGOR *(*)(X509_ALGOR *), \
2384 copy_func), \
2385 CHECKED_CAST(void (*)(void *), void (*)(X509_ALGOR *), free_func)))
2386
2387/* X509_ATTRIBUTE */
2388#define sk_X509_ATTRIBUTE_new(comp) \
2389 ((STACK_OF(X509_ATTRIBUTE) *)sk_new(CHECKED_CAST( \
2390 stack_cmp_func, \
2391 int (*)(const X509_ATTRIBUTE **a, const X509_ATTRIBUTE **b), comp)))
2392
2393#define sk_X509_ATTRIBUTE_new_null() ((STACK_OF(X509_ATTRIBUTE) *)sk_new_null())
2394
2395#define sk_X509_ATTRIBUTE_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -04002396 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(X509_ATTRIBUTE) *, sk))
Adam Langley35349192015-07-21 11:06:45 -07002397
2398#define sk_X509_ATTRIBUTE_zero(sk) \
2399 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk));
2400
David Benjaminada97992016-05-13 13:14:28 -04002401#define sk_X509_ATTRIBUTE_value(sk, i) \
2402 ((X509_ATTRIBUTE *)sk_value( \
2403 CHECKED_CAST(const _STACK *, const STACK_OF(X509_ATTRIBUTE) *, sk), \
2404 (i)))
Adam Langley35349192015-07-21 11:06:45 -07002405
2406#define sk_X509_ATTRIBUTE_set(sk, i, p) \
2407 ((X509_ATTRIBUTE *)sk_set( \
2408 CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk), (i), \
2409 CHECKED_CAST(void *, X509_ATTRIBUTE *, p)))
2410
2411#define sk_X509_ATTRIBUTE_free(sk) \
2412 sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk))
2413
2414#define sk_X509_ATTRIBUTE_pop_free(sk, free_func) \
2415 sk_pop_free( \
2416 CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk), \
2417 CHECKED_CAST(void (*)(void *), void (*)(X509_ATTRIBUTE *), free_func))
2418
2419#define sk_X509_ATTRIBUTE_insert(sk, p, where) \
2420 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk), \
2421 CHECKED_CAST(void *, X509_ATTRIBUTE *, p), (where))
2422
2423#define sk_X509_ATTRIBUTE_delete(sk, where) \
2424 ((X509_ATTRIBUTE *)sk_delete( \
2425 CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk), (where)))
2426
2427#define sk_X509_ATTRIBUTE_delete_ptr(sk, p) \
2428 ((X509_ATTRIBUTE *)sk_delete_ptr( \
2429 CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk), \
2430 CHECKED_CAST(void *, X509_ATTRIBUTE *, p)))
2431
2432#define sk_X509_ATTRIBUTE_find(sk, out_index, p) \
2433 sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk), (out_index), \
2434 CHECKED_CAST(void *, X509_ATTRIBUTE *, p))
2435
2436#define sk_X509_ATTRIBUTE_shift(sk) \
2437 ((X509_ATTRIBUTE *)sk_shift( \
2438 CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk)))
2439
2440#define sk_X509_ATTRIBUTE_push(sk, p) \
2441 sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk), \
2442 CHECKED_CAST(void *, X509_ATTRIBUTE *, p))
2443
2444#define sk_X509_ATTRIBUTE_pop(sk) \
2445 ((X509_ATTRIBUTE *)sk_pop( \
2446 CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk)))
2447
2448#define sk_X509_ATTRIBUTE_dup(sk) \
2449 ((STACK_OF(X509_ATTRIBUTE) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -04002450 CHECKED_CAST(const _STACK *, const STACK_OF(X509_ATTRIBUTE) *, sk)))
Adam Langley35349192015-07-21 11:06:45 -07002451
2452#define sk_X509_ATTRIBUTE_sort(sk) \
2453 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk))
2454
2455#define sk_X509_ATTRIBUTE_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -04002456 sk_is_sorted( \
2457 CHECKED_CAST(const _STACK *, const STACK_OF(X509_ATTRIBUTE) *, sk))
Adam Langley35349192015-07-21 11:06:45 -07002458
2459#define sk_X509_ATTRIBUTE_set_cmp_func(sk, comp) \
2460 ((int (*)(const X509_ATTRIBUTE **a, const X509_ATTRIBUTE **b)) \
2461 sk_set_cmp_func( \
2462 CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk), \
2463 CHECKED_CAST(stack_cmp_func, int (*)(const X509_ATTRIBUTE **a, \
2464 const X509_ATTRIBUTE **b), \
2465 comp)))
2466
2467#define sk_X509_ATTRIBUTE_deep_copy(sk, copy_func, free_func) \
2468 ((STACK_OF(X509_ATTRIBUTE) *)sk_deep_copy( \
2469 CHECKED_CAST(const _STACK *, const STACK_OF(X509_ATTRIBUTE) *, sk), \
2470 CHECKED_CAST(void *(*)(void *), X509_ATTRIBUTE *(*)(X509_ATTRIBUTE *), \
2471 copy_func), \
2472 CHECKED_CAST(void (*)(void *), void (*)(X509_ATTRIBUTE *), free_func)))
2473
2474/* X509_CRL */
2475#define sk_X509_CRL_new(comp) \
2476 ((STACK_OF(X509_CRL) *)sk_new(CHECKED_CAST( \
2477 stack_cmp_func, int (*)(const X509_CRL **a, const X509_CRL **b), comp)))
2478
2479#define sk_X509_CRL_new_null() ((STACK_OF(X509_CRL) *)sk_new_null())
2480
2481#define sk_X509_CRL_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -04002482 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(X509_CRL) *, sk))
Adam Langley35349192015-07-21 11:06:45 -07002483
2484#define sk_X509_CRL_zero(sk) \
2485 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk));
2486
2487#define sk_X509_CRL_value(sk, i) \
2488 ((X509_CRL *)sk_value( \
David Benjaminada97992016-05-13 13:14:28 -04002489 CHECKED_CAST(const _STACK *, const STACK_OF(X509_CRL) *, sk), (i)))
Adam Langley35349192015-07-21 11:06:45 -07002490
2491#define sk_X509_CRL_set(sk, i, p) \
2492 ((X509_CRL *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk), (i), \
2493 CHECKED_CAST(void *, X509_CRL *, p)))
2494
2495#define sk_X509_CRL_free(sk) \
2496 sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk))
2497
2498#define sk_X509_CRL_pop_free(sk, free_func) \
2499 sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk), \
2500 CHECKED_CAST(void (*)(void *), void (*)(X509_CRL *), free_func))
2501
2502#define sk_X509_CRL_insert(sk, p, where) \
2503 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk), \
2504 CHECKED_CAST(void *, X509_CRL *, p), (where))
2505
2506#define sk_X509_CRL_delete(sk, where) \
2507 ((X509_CRL *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk), \
2508 (where)))
2509
2510#define sk_X509_CRL_delete_ptr(sk, p) \
2511 ((X509_CRL *)sk_delete_ptr(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk), \
2512 CHECKED_CAST(void *, X509_CRL *, p)))
2513
2514#define sk_X509_CRL_find(sk, out_index, p) \
2515 sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk), (out_index), \
2516 CHECKED_CAST(void *, X509_CRL *, p))
2517
2518#define sk_X509_CRL_shift(sk) \
2519 ((X509_CRL *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk)))
2520
2521#define sk_X509_CRL_push(sk, p) \
2522 sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk), \
2523 CHECKED_CAST(void *, X509_CRL *, p))
2524
2525#define sk_X509_CRL_pop(sk) \
2526 ((X509_CRL *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk)))
2527
2528#define sk_X509_CRL_dup(sk) \
2529 ((STACK_OF(X509_CRL) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -04002530 CHECKED_CAST(const _STACK *, const STACK_OF(X509_CRL) *, sk)))
Adam Langley35349192015-07-21 11:06:45 -07002531
2532#define sk_X509_CRL_sort(sk) \
2533 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk))
2534
2535#define sk_X509_CRL_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -04002536 sk_is_sorted(CHECKED_CAST(const _STACK *, const STACK_OF(X509_CRL) *, sk))
Adam Langley35349192015-07-21 11:06:45 -07002537
2538#define sk_X509_CRL_set_cmp_func(sk, comp) \
2539 ((int (*)(const X509_CRL **a, const X509_CRL **b))sk_set_cmp_func( \
2540 CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk), \
2541 CHECKED_CAST(stack_cmp_func, \
2542 int (*)(const X509_CRL **a, const X509_CRL **b), comp)))
2543
2544#define sk_X509_CRL_deep_copy(sk, copy_func, free_func) \
2545 ((STACK_OF(X509_CRL) *)sk_deep_copy( \
2546 CHECKED_CAST(const _STACK *, const STACK_OF(X509_CRL) *, sk), \
2547 CHECKED_CAST(void *(*)(void *), X509_CRL *(*)(X509_CRL *), copy_func), \
2548 CHECKED_CAST(void (*)(void *), void (*)(X509_CRL *), free_func)))
2549
2550/* X509_EXTENSION */
2551#define sk_X509_EXTENSION_new(comp) \
2552 ((STACK_OF(X509_EXTENSION) *)sk_new(CHECKED_CAST( \
2553 stack_cmp_func, \
2554 int (*)(const X509_EXTENSION **a, const X509_EXTENSION **b), comp)))
2555
2556#define sk_X509_EXTENSION_new_null() ((STACK_OF(X509_EXTENSION) *)sk_new_null())
2557
2558#define sk_X509_EXTENSION_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -04002559 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(X509_EXTENSION) *, sk))
Adam Langley35349192015-07-21 11:06:45 -07002560
2561#define sk_X509_EXTENSION_zero(sk) \
2562 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk));
2563
David Benjaminada97992016-05-13 13:14:28 -04002564#define sk_X509_EXTENSION_value(sk, i) \
2565 ((X509_EXTENSION *)sk_value( \
2566 CHECKED_CAST(const _STACK *, const STACK_OF(X509_EXTENSION) *, sk), \
2567 (i)))
Adam Langley35349192015-07-21 11:06:45 -07002568
2569#define sk_X509_EXTENSION_set(sk, i, p) \
2570 ((X509_EXTENSION *)sk_set( \
2571 CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk), (i), \
2572 CHECKED_CAST(void *, X509_EXTENSION *, p)))
2573
2574#define sk_X509_EXTENSION_free(sk) \
2575 sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk))
2576
2577#define sk_X509_EXTENSION_pop_free(sk, free_func) \
2578 sk_pop_free( \
2579 CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk), \
2580 CHECKED_CAST(void (*)(void *), void (*)(X509_EXTENSION *), free_func))
2581
2582#define sk_X509_EXTENSION_insert(sk, p, where) \
2583 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk), \
2584 CHECKED_CAST(void *, X509_EXTENSION *, p), (where))
2585
2586#define sk_X509_EXTENSION_delete(sk, where) \
2587 ((X509_EXTENSION *)sk_delete( \
2588 CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk), (where)))
2589
2590#define sk_X509_EXTENSION_delete_ptr(sk, p) \
2591 ((X509_EXTENSION *)sk_delete_ptr( \
2592 CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk), \
2593 CHECKED_CAST(void *, X509_EXTENSION *, p)))
2594
2595#define sk_X509_EXTENSION_find(sk, out_index, p) \
2596 sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk), (out_index), \
2597 CHECKED_CAST(void *, X509_EXTENSION *, p))
2598
2599#define sk_X509_EXTENSION_shift(sk) \
2600 ((X509_EXTENSION *)sk_shift( \
2601 CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk)))
2602
2603#define sk_X509_EXTENSION_push(sk, p) \
2604 sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk), \
2605 CHECKED_CAST(void *, X509_EXTENSION *, p))
2606
2607#define sk_X509_EXTENSION_pop(sk) \
2608 ((X509_EXTENSION *)sk_pop( \
2609 CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk)))
2610
2611#define sk_X509_EXTENSION_dup(sk) \
2612 ((STACK_OF(X509_EXTENSION) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -04002613 CHECKED_CAST(const _STACK *, const STACK_OF(X509_EXTENSION) *, sk)))
Adam Langley35349192015-07-21 11:06:45 -07002614
2615#define sk_X509_EXTENSION_sort(sk) \
2616 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk))
2617
2618#define sk_X509_EXTENSION_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -04002619 sk_is_sorted( \
2620 CHECKED_CAST(const _STACK *, const STACK_OF(X509_EXTENSION) *, sk))
Adam Langley35349192015-07-21 11:06:45 -07002621
2622#define sk_X509_EXTENSION_set_cmp_func(sk, comp) \
2623 ((int (*)(const X509_EXTENSION **a, const X509_EXTENSION **b)) \
2624 sk_set_cmp_func( \
2625 CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk), \
2626 CHECKED_CAST(stack_cmp_func, int (*)(const X509_EXTENSION **a, \
2627 const X509_EXTENSION **b), \
2628 comp)))
2629
2630#define sk_X509_EXTENSION_deep_copy(sk, copy_func, free_func) \
2631 ((STACK_OF(X509_EXTENSION) *)sk_deep_copy( \
2632 CHECKED_CAST(const _STACK *, const STACK_OF(X509_EXTENSION) *, sk), \
2633 CHECKED_CAST(void *(*)(void *), X509_EXTENSION *(*)(X509_EXTENSION *), \
2634 copy_func), \
2635 CHECKED_CAST(void (*)(void *), void (*)(X509_EXTENSION *), free_func)))
2636
2637/* X509_INFO */
2638#define sk_X509_INFO_new(comp) \
2639 ((STACK_OF(X509_INFO) *)sk_new( \
2640 CHECKED_CAST(stack_cmp_func, \
2641 int (*)(const X509_INFO **a, const X509_INFO **b), comp)))
2642
2643#define sk_X509_INFO_new_null() ((STACK_OF(X509_INFO) *)sk_new_null())
2644
2645#define sk_X509_INFO_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -04002646 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(X509_INFO) *, sk))
Adam Langley35349192015-07-21 11:06:45 -07002647
2648#define sk_X509_INFO_zero(sk) \
2649 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk));
2650
2651#define sk_X509_INFO_value(sk, i) \
2652 ((X509_INFO *)sk_value( \
David Benjaminada97992016-05-13 13:14:28 -04002653 CHECKED_CAST(const _STACK *, const STACK_OF(X509_INFO) *, sk), (i)))
Adam Langley35349192015-07-21 11:06:45 -07002654
2655#define sk_X509_INFO_set(sk, i, p) \
2656 ((X509_INFO *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk), (i), \
2657 CHECKED_CAST(void *, X509_INFO *, p)))
2658
2659#define sk_X509_INFO_free(sk) \
2660 sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk))
2661
2662#define sk_X509_INFO_pop_free(sk, free_func) \
2663 sk_pop_free( \
2664 CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk), \
2665 CHECKED_CAST(void (*)(void *), void (*)(X509_INFO *), free_func))
2666
2667#define sk_X509_INFO_insert(sk, p, where) \
2668 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk), \
2669 CHECKED_CAST(void *, X509_INFO *, p), (where))
2670
2671#define sk_X509_INFO_delete(sk, where) \
2672 ((X509_INFO *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk), \
2673 (where)))
2674
2675#define sk_X509_INFO_delete_ptr(sk, p) \
2676 ((X509_INFO *)sk_delete_ptr( \
2677 CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk), \
2678 CHECKED_CAST(void *, X509_INFO *, p)))
2679
2680#define sk_X509_INFO_find(sk, out_index, p) \
2681 sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk), (out_index), \
2682 CHECKED_CAST(void *, X509_INFO *, p))
2683
2684#define sk_X509_INFO_shift(sk) \
2685 ((X509_INFO *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk)))
2686
2687#define sk_X509_INFO_push(sk, p) \
2688 sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk), \
2689 CHECKED_CAST(void *, X509_INFO *, p))
2690
2691#define sk_X509_INFO_pop(sk) \
2692 ((X509_INFO *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk)))
2693
2694#define sk_X509_INFO_dup(sk) \
2695 ((STACK_OF(X509_INFO) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -04002696 CHECKED_CAST(const _STACK *, const STACK_OF(X509_INFO) *, sk)))
Adam Langley35349192015-07-21 11:06:45 -07002697
2698#define sk_X509_INFO_sort(sk) \
2699 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk))
2700
2701#define sk_X509_INFO_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -04002702 sk_is_sorted(CHECKED_CAST(const _STACK *, const STACK_OF(X509_INFO) *, sk))
Adam Langley35349192015-07-21 11:06:45 -07002703
2704#define sk_X509_INFO_set_cmp_func(sk, comp) \
2705 ((int (*)(const X509_INFO **a, const X509_INFO **b))sk_set_cmp_func( \
2706 CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk), \
2707 CHECKED_CAST(stack_cmp_func, \
2708 int (*)(const X509_INFO **a, const X509_INFO **b), comp)))
2709
2710#define sk_X509_INFO_deep_copy(sk, copy_func, free_func) \
2711 ((STACK_OF(X509_INFO) *)sk_deep_copy( \
2712 CHECKED_CAST(const _STACK *, const STACK_OF(X509_INFO) *, sk), \
2713 CHECKED_CAST(void *(*)(void *), X509_INFO *(*)(X509_INFO *), copy_func), \
2714 CHECKED_CAST(void (*)(void *), void (*)(X509_INFO *), free_func)))
2715
2716/* X509_LOOKUP */
2717#define sk_X509_LOOKUP_new(comp) \
2718 ((STACK_OF(X509_LOOKUP) *)sk_new(CHECKED_CAST( \
2719 stack_cmp_func, int (*)(const X509_LOOKUP **a, const X509_LOOKUP **b), \
2720 comp)))
2721
2722#define sk_X509_LOOKUP_new_null() ((STACK_OF(X509_LOOKUP) *)sk_new_null())
2723
2724#define sk_X509_LOOKUP_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -04002725 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(X509_LOOKUP) *, sk))
Adam Langley35349192015-07-21 11:06:45 -07002726
2727#define sk_X509_LOOKUP_zero(sk) \
2728 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk));
2729
2730#define sk_X509_LOOKUP_value(sk, i) \
2731 ((X509_LOOKUP *)sk_value( \
David Benjaminada97992016-05-13 13:14:28 -04002732 CHECKED_CAST(const _STACK *, const STACK_OF(X509_LOOKUP) *, sk), (i)))
Adam Langley35349192015-07-21 11:06:45 -07002733
2734#define sk_X509_LOOKUP_set(sk, i, p) \
2735 ((X509_LOOKUP *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk), \
2736 (i), CHECKED_CAST(void *, X509_LOOKUP *, p)))
2737
2738#define sk_X509_LOOKUP_free(sk) \
2739 sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk))
2740
2741#define sk_X509_LOOKUP_pop_free(sk, free_func) \
2742 sk_pop_free( \
2743 CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk), \
2744 CHECKED_CAST(void (*)(void *), void (*)(X509_LOOKUP *), free_func))
2745
2746#define sk_X509_LOOKUP_insert(sk, p, where) \
2747 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk), \
2748 CHECKED_CAST(void *, X509_LOOKUP *, p), (where))
2749
2750#define sk_X509_LOOKUP_delete(sk, where) \
2751 ((X509_LOOKUP *)sk_delete( \
2752 CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk), (where)))
2753
2754#define sk_X509_LOOKUP_delete_ptr(sk, p) \
2755 ((X509_LOOKUP *)sk_delete_ptr( \
2756 CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk), \
2757 CHECKED_CAST(void *, X509_LOOKUP *, p)))
2758
2759#define sk_X509_LOOKUP_find(sk, out_index, p) \
2760 sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk), (out_index), \
2761 CHECKED_CAST(void *, X509_LOOKUP *, p))
2762
2763#define sk_X509_LOOKUP_shift(sk) \
2764 ((X509_LOOKUP *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk)))
2765
2766#define sk_X509_LOOKUP_push(sk, p) \
2767 sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk), \
2768 CHECKED_CAST(void *, X509_LOOKUP *, p))
2769
2770#define sk_X509_LOOKUP_pop(sk) \
2771 ((X509_LOOKUP *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk)))
2772
2773#define sk_X509_LOOKUP_dup(sk) \
2774 ((STACK_OF(X509_LOOKUP) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -04002775 CHECKED_CAST(const _STACK *, const STACK_OF(X509_LOOKUP) *, sk)))
Adam Langley35349192015-07-21 11:06:45 -07002776
2777#define sk_X509_LOOKUP_sort(sk) \
2778 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk))
2779
2780#define sk_X509_LOOKUP_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -04002781 sk_is_sorted(CHECKED_CAST(const _STACK *, const STACK_OF(X509_LOOKUP) *, sk))
Adam Langley35349192015-07-21 11:06:45 -07002782
2783#define sk_X509_LOOKUP_set_cmp_func(sk, comp) \
2784 ((int (*)(const X509_LOOKUP **a, const X509_LOOKUP **b))sk_set_cmp_func( \
2785 CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk), \
2786 CHECKED_CAST(stack_cmp_func, \
2787 int (*)(const X509_LOOKUP **a, const X509_LOOKUP **b), \
2788 comp)))
2789
2790#define sk_X509_LOOKUP_deep_copy(sk, copy_func, free_func) \
2791 ((STACK_OF(X509_LOOKUP) *)sk_deep_copy( \
2792 CHECKED_CAST(const _STACK *, const STACK_OF(X509_LOOKUP) *, sk), \
2793 CHECKED_CAST(void *(*)(void *), X509_LOOKUP *(*)(X509_LOOKUP *), \
2794 copy_func), \
2795 CHECKED_CAST(void (*)(void *), void (*)(X509_LOOKUP *), free_func)))
2796
2797/* X509_NAME */
2798#define sk_X509_NAME_new(comp) \
2799 ((STACK_OF(X509_NAME) *)sk_new( \
2800 CHECKED_CAST(stack_cmp_func, \
2801 int (*)(const X509_NAME **a, const X509_NAME **b), comp)))
2802
2803#define sk_X509_NAME_new_null() ((STACK_OF(X509_NAME) *)sk_new_null())
2804
2805#define sk_X509_NAME_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -04002806 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(X509_NAME) *, sk))
Adam Langley35349192015-07-21 11:06:45 -07002807
2808#define sk_X509_NAME_zero(sk) \
2809 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk));
2810
2811#define sk_X509_NAME_value(sk, i) \
2812 ((X509_NAME *)sk_value( \
David Benjaminada97992016-05-13 13:14:28 -04002813 CHECKED_CAST(const _STACK *, const STACK_OF(X509_NAME) *, sk), (i)))
Adam Langley35349192015-07-21 11:06:45 -07002814
2815#define sk_X509_NAME_set(sk, i, p) \
2816 ((X509_NAME *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk), (i), \
2817 CHECKED_CAST(void *, X509_NAME *, p)))
2818
2819#define sk_X509_NAME_free(sk) \
2820 sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk))
2821
2822#define sk_X509_NAME_pop_free(sk, free_func) \
2823 sk_pop_free( \
2824 CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk), \
2825 CHECKED_CAST(void (*)(void *), void (*)(X509_NAME *), free_func))
2826
2827#define sk_X509_NAME_insert(sk, p, where) \
2828 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk), \
2829 CHECKED_CAST(void *, X509_NAME *, p), (where))
2830
2831#define sk_X509_NAME_delete(sk, where) \
2832 ((X509_NAME *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk), \
2833 (where)))
2834
2835#define sk_X509_NAME_delete_ptr(sk, p) \
2836 ((X509_NAME *)sk_delete_ptr( \
2837 CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk), \
2838 CHECKED_CAST(void *, X509_NAME *, p)))
2839
2840#define sk_X509_NAME_find(sk, out_index, p) \
2841 sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk), (out_index), \
2842 CHECKED_CAST(void *, X509_NAME *, p))
2843
2844#define sk_X509_NAME_shift(sk) \
2845 ((X509_NAME *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk)))
2846
2847#define sk_X509_NAME_push(sk, p) \
2848 sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk), \
2849 CHECKED_CAST(void *, X509_NAME *, p))
2850
2851#define sk_X509_NAME_pop(sk) \
2852 ((X509_NAME *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk)))
2853
2854#define sk_X509_NAME_dup(sk) \
2855 ((STACK_OF(X509_NAME) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -04002856 CHECKED_CAST(const _STACK *, const STACK_OF(X509_NAME) *, sk)))
Adam Langley35349192015-07-21 11:06:45 -07002857
2858#define sk_X509_NAME_sort(sk) \
2859 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk))
2860
2861#define sk_X509_NAME_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -04002862 sk_is_sorted(CHECKED_CAST(const _STACK *, const STACK_OF(X509_NAME) *, sk))
Adam Langley35349192015-07-21 11:06:45 -07002863
2864#define sk_X509_NAME_set_cmp_func(sk, comp) \
2865 ((int (*)(const X509_NAME **a, const X509_NAME **b))sk_set_cmp_func( \
2866 CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk), \
2867 CHECKED_CAST(stack_cmp_func, \
2868 int (*)(const X509_NAME **a, const X509_NAME **b), comp)))
2869
2870#define sk_X509_NAME_deep_copy(sk, copy_func, free_func) \
2871 ((STACK_OF(X509_NAME) *)sk_deep_copy( \
2872 CHECKED_CAST(const _STACK *, const STACK_OF(X509_NAME) *, sk), \
2873 CHECKED_CAST(void *(*)(void *), X509_NAME *(*)(X509_NAME *), copy_func), \
2874 CHECKED_CAST(void (*)(void *), void (*)(X509_NAME *), free_func)))
2875
2876/* X509_NAME_ENTRY */
2877#define sk_X509_NAME_ENTRY_new(comp) \
2878 ((STACK_OF(X509_NAME_ENTRY) *)sk_new(CHECKED_CAST( \
2879 stack_cmp_func, \
2880 int (*)(const X509_NAME_ENTRY **a, const X509_NAME_ENTRY **b), comp)))
2881
2882#define sk_X509_NAME_ENTRY_new_null() \
2883 ((STACK_OF(X509_NAME_ENTRY) *)sk_new_null())
2884
2885#define sk_X509_NAME_ENTRY_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -04002886 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(X509_NAME_ENTRY) *, sk))
Adam Langley35349192015-07-21 11:06:45 -07002887
2888#define sk_X509_NAME_ENTRY_zero(sk) \
2889 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk));
2890
David Benjaminada97992016-05-13 13:14:28 -04002891#define sk_X509_NAME_ENTRY_value(sk, i) \
2892 ((X509_NAME_ENTRY *)sk_value( \
2893 CHECKED_CAST(const _STACK *, const STACK_OF(X509_NAME_ENTRY) *, sk), \
2894 (i)))
Adam Langley35349192015-07-21 11:06:45 -07002895
2896#define sk_X509_NAME_ENTRY_set(sk, i, p) \
2897 ((X509_NAME_ENTRY *)sk_set( \
2898 CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk), (i), \
2899 CHECKED_CAST(void *, X509_NAME_ENTRY *, p)))
2900
2901#define sk_X509_NAME_ENTRY_free(sk) \
2902 sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk))
2903
2904#define sk_X509_NAME_ENTRY_pop_free(sk, free_func) \
2905 sk_pop_free( \
2906 CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk), \
2907 CHECKED_CAST(void (*)(void *), void (*)(X509_NAME_ENTRY *), free_func))
2908
2909#define sk_X509_NAME_ENTRY_insert(sk, p, where) \
2910 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk), \
2911 CHECKED_CAST(void *, X509_NAME_ENTRY *, p), (where))
2912
2913#define sk_X509_NAME_ENTRY_delete(sk, where) \
2914 ((X509_NAME_ENTRY *)sk_delete( \
2915 CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk), (where)))
2916
2917#define sk_X509_NAME_ENTRY_delete_ptr(sk, p) \
2918 ((X509_NAME_ENTRY *)sk_delete_ptr( \
2919 CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk), \
2920 CHECKED_CAST(void *, X509_NAME_ENTRY *, p)))
2921
2922#define sk_X509_NAME_ENTRY_find(sk, out_index, p) \
2923 sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk), \
2924 (out_index), CHECKED_CAST(void *, X509_NAME_ENTRY *, p))
2925
2926#define sk_X509_NAME_ENTRY_shift(sk) \
2927 ((X509_NAME_ENTRY *)sk_shift( \
2928 CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk)))
2929
2930#define sk_X509_NAME_ENTRY_push(sk, p) \
2931 sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk), \
2932 CHECKED_CAST(void *, X509_NAME_ENTRY *, p))
2933
2934#define sk_X509_NAME_ENTRY_pop(sk) \
2935 ((X509_NAME_ENTRY *)sk_pop( \
2936 CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk)))
2937
2938#define sk_X509_NAME_ENTRY_dup(sk) \
2939 ((STACK_OF(X509_NAME_ENTRY) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -04002940 CHECKED_CAST(const _STACK *, const STACK_OF(X509_NAME_ENTRY) *, sk)))
Adam Langley35349192015-07-21 11:06:45 -07002941
2942#define sk_X509_NAME_ENTRY_sort(sk) \
2943 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk))
2944
2945#define sk_X509_NAME_ENTRY_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -04002946 sk_is_sorted( \
2947 CHECKED_CAST(const _STACK *, const STACK_OF(X509_NAME_ENTRY) *, sk))
Adam Langley35349192015-07-21 11:06:45 -07002948
2949#define sk_X509_NAME_ENTRY_set_cmp_func(sk, comp) \
2950 ((int (*)(const X509_NAME_ENTRY **a, const X509_NAME_ENTRY **b)) \
2951 sk_set_cmp_func( \
2952 CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk), \
2953 CHECKED_CAST(stack_cmp_func, int (*)(const X509_NAME_ENTRY **a, \
2954 const X509_NAME_ENTRY **b), \
2955 comp)))
2956
2957#define sk_X509_NAME_ENTRY_deep_copy(sk, copy_func, free_func) \
2958 ((STACK_OF(X509_NAME_ENTRY) *)sk_deep_copy( \
2959 CHECKED_CAST(const _STACK *, const STACK_OF(X509_NAME_ENTRY) *, sk), \
2960 CHECKED_CAST(void *(*)(void *), X509_NAME_ENTRY *(*)(X509_NAME_ENTRY *), \
2961 copy_func), \
2962 CHECKED_CAST(void (*)(void *), void (*)(X509_NAME_ENTRY *), free_func)))
2963
2964/* X509_OBJECT */
2965#define sk_X509_OBJECT_new(comp) \
2966 ((STACK_OF(X509_OBJECT) *)sk_new(CHECKED_CAST( \
2967 stack_cmp_func, int (*)(const X509_OBJECT **a, const X509_OBJECT **b), \
2968 comp)))
2969
2970#define sk_X509_OBJECT_new_null() ((STACK_OF(X509_OBJECT) *)sk_new_null())
2971
2972#define sk_X509_OBJECT_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -04002973 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(X509_OBJECT) *, sk))
Adam Langley35349192015-07-21 11:06:45 -07002974
2975#define sk_X509_OBJECT_zero(sk) \
2976 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk));
2977
2978#define sk_X509_OBJECT_value(sk, i) \
2979 ((X509_OBJECT *)sk_value( \
David Benjaminada97992016-05-13 13:14:28 -04002980 CHECKED_CAST(const _STACK *, const STACK_OF(X509_OBJECT) *, sk), (i)))
Adam Langley35349192015-07-21 11:06:45 -07002981
2982#define sk_X509_OBJECT_set(sk, i, p) \
2983 ((X509_OBJECT *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk), \
2984 (i), CHECKED_CAST(void *, X509_OBJECT *, p)))
2985
2986#define sk_X509_OBJECT_free(sk) \
2987 sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk))
2988
2989#define sk_X509_OBJECT_pop_free(sk, free_func) \
2990 sk_pop_free( \
2991 CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk), \
2992 CHECKED_CAST(void (*)(void *), void (*)(X509_OBJECT *), free_func))
2993
2994#define sk_X509_OBJECT_insert(sk, p, where) \
2995 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk), \
2996 CHECKED_CAST(void *, X509_OBJECT *, p), (where))
2997
2998#define sk_X509_OBJECT_delete(sk, where) \
2999 ((X509_OBJECT *)sk_delete( \
3000 CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk), (where)))
3001
3002#define sk_X509_OBJECT_delete_ptr(sk, p) \
3003 ((X509_OBJECT *)sk_delete_ptr( \
3004 CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk), \
3005 CHECKED_CAST(void *, X509_OBJECT *, p)))
3006
3007#define sk_X509_OBJECT_find(sk, out_index, p) \
3008 sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk), (out_index), \
3009 CHECKED_CAST(void *, X509_OBJECT *, p))
3010
3011#define sk_X509_OBJECT_shift(sk) \
3012 ((X509_OBJECT *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk)))
3013
3014#define sk_X509_OBJECT_push(sk, p) \
3015 sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk), \
3016 CHECKED_CAST(void *, X509_OBJECT *, p))
3017
3018#define sk_X509_OBJECT_pop(sk) \
3019 ((X509_OBJECT *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk)))
3020
3021#define sk_X509_OBJECT_dup(sk) \
3022 ((STACK_OF(X509_OBJECT) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -04003023 CHECKED_CAST(const _STACK *, const STACK_OF(X509_OBJECT) *, sk)))
Adam Langley35349192015-07-21 11:06:45 -07003024
3025#define sk_X509_OBJECT_sort(sk) \
3026 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk))
3027
3028#define sk_X509_OBJECT_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -04003029 sk_is_sorted(CHECKED_CAST(const _STACK *, const STACK_OF(X509_OBJECT) *, sk))
Adam Langley35349192015-07-21 11:06:45 -07003030
3031#define sk_X509_OBJECT_set_cmp_func(sk, comp) \
3032 ((int (*)(const X509_OBJECT **a, const X509_OBJECT **b))sk_set_cmp_func( \
3033 CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk), \
3034 CHECKED_CAST(stack_cmp_func, \
3035 int (*)(const X509_OBJECT **a, const X509_OBJECT **b), \
3036 comp)))
3037
3038#define sk_X509_OBJECT_deep_copy(sk, copy_func, free_func) \
3039 ((STACK_OF(X509_OBJECT) *)sk_deep_copy( \
3040 CHECKED_CAST(const _STACK *, const STACK_OF(X509_OBJECT) *, sk), \
3041 CHECKED_CAST(void *(*)(void *), X509_OBJECT *(*)(X509_OBJECT *), \
3042 copy_func), \
3043 CHECKED_CAST(void (*)(void *), void (*)(X509_OBJECT *), free_func)))
3044
3045/* X509_POLICY_DATA */
3046#define sk_X509_POLICY_DATA_new(comp) \
3047 ((STACK_OF(X509_POLICY_DATA) *)sk_new(CHECKED_CAST( \
3048 stack_cmp_func, \
3049 int (*)(const X509_POLICY_DATA **a, const X509_POLICY_DATA **b), comp)))
3050
3051#define sk_X509_POLICY_DATA_new_null() \
3052 ((STACK_OF(X509_POLICY_DATA) *)sk_new_null())
3053
3054#define sk_X509_POLICY_DATA_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -04003055 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(X509_POLICY_DATA) *, sk))
Adam Langley35349192015-07-21 11:06:45 -07003056
3057#define sk_X509_POLICY_DATA_zero(sk) \
3058 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk));
3059
David Benjaminada97992016-05-13 13:14:28 -04003060#define sk_X509_POLICY_DATA_value(sk, i) \
3061 ((X509_POLICY_DATA *)sk_value( \
3062 CHECKED_CAST(const _STACK *, const STACK_OF(X509_POLICY_DATA) *, sk), \
3063 (i)))
Adam Langley35349192015-07-21 11:06:45 -07003064
3065#define sk_X509_POLICY_DATA_set(sk, i, p) \
3066 ((X509_POLICY_DATA *)sk_set( \
3067 CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk), (i), \
3068 CHECKED_CAST(void *, X509_POLICY_DATA *, p)))
3069
3070#define sk_X509_POLICY_DATA_free(sk) \
3071 sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk))
3072
3073#define sk_X509_POLICY_DATA_pop_free(sk, free_func) \
3074 sk_pop_free( \
3075 CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk), \
3076 CHECKED_CAST(void (*)(void *), void (*)(X509_POLICY_DATA *), free_func))
3077
3078#define sk_X509_POLICY_DATA_insert(sk, p, where) \
3079 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk), \
3080 CHECKED_CAST(void *, X509_POLICY_DATA *, p), (where))
3081
3082#define sk_X509_POLICY_DATA_delete(sk, where) \
3083 ((X509_POLICY_DATA *)sk_delete( \
3084 CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk), (where)))
3085
3086#define sk_X509_POLICY_DATA_delete_ptr(sk, p) \
3087 ((X509_POLICY_DATA *)sk_delete_ptr( \
3088 CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk), \
3089 CHECKED_CAST(void *, X509_POLICY_DATA *, p)))
3090
3091#define sk_X509_POLICY_DATA_find(sk, out_index, p) \
3092 sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk), \
3093 (out_index), CHECKED_CAST(void *, X509_POLICY_DATA *, p))
3094
3095#define sk_X509_POLICY_DATA_shift(sk) \
3096 ((X509_POLICY_DATA *)sk_shift( \
3097 CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk)))
3098
3099#define sk_X509_POLICY_DATA_push(sk, p) \
3100 sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk), \
3101 CHECKED_CAST(void *, X509_POLICY_DATA *, p))
3102
3103#define sk_X509_POLICY_DATA_pop(sk) \
3104 ((X509_POLICY_DATA *)sk_pop( \
3105 CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk)))
3106
3107#define sk_X509_POLICY_DATA_dup(sk) \
3108 ((STACK_OF(X509_POLICY_DATA) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -04003109 CHECKED_CAST(const _STACK *, const STACK_OF(X509_POLICY_DATA) *, sk)))
Adam Langley35349192015-07-21 11:06:45 -07003110
3111#define sk_X509_POLICY_DATA_sort(sk) \
3112 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk))
3113
3114#define sk_X509_POLICY_DATA_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -04003115 sk_is_sorted( \
3116 CHECKED_CAST(const _STACK *, const STACK_OF(X509_POLICY_DATA) *, sk))
Adam Langley35349192015-07-21 11:06:45 -07003117
3118#define sk_X509_POLICY_DATA_set_cmp_func(sk, comp) \
3119 ((int (*)(const X509_POLICY_DATA **a, const X509_POLICY_DATA **b)) \
3120 sk_set_cmp_func( \
3121 CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk), \
3122 CHECKED_CAST(stack_cmp_func, int (*)(const X509_POLICY_DATA **a, \
3123 const X509_POLICY_DATA **b), \
3124 comp)))
3125
3126#define sk_X509_POLICY_DATA_deep_copy(sk, copy_func, free_func) \
3127 ((STACK_OF(X509_POLICY_DATA) *)sk_deep_copy( \
3128 CHECKED_CAST(const _STACK *, const STACK_OF(X509_POLICY_DATA) *, sk), \
3129 CHECKED_CAST(void *(*)(void *), \
3130 X509_POLICY_DATA *(*)(X509_POLICY_DATA *), copy_func), \
3131 CHECKED_CAST(void (*)(void *), void (*)(X509_POLICY_DATA *), \
3132 free_func)))
3133
3134/* X509_POLICY_NODE */
3135#define sk_X509_POLICY_NODE_new(comp) \
3136 ((STACK_OF(X509_POLICY_NODE) *)sk_new(CHECKED_CAST( \
3137 stack_cmp_func, \
3138 int (*)(const X509_POLICY_NODE **a, const X509_POLICY_NODE **b), comp)))
3139
3140#define sk_X509_POLICY_NODE_new_null() \
3141 ((STACK_OF(X509_POLICY_NODE) *)sk_new_null())
3142
3143#define sk_X509_POLICY_NODE_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -04003144 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(X509_POLICY_NODE) *, sk))
Adam Langley35349192015-07-21 11:06:45 -07003145
3146#define sk_X509_POLICY_NODE_zero(sk) \
3147 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk));
3148
David Benjaminada97992016-05-13 13:14:28 -04003149#define sk_X509_POLICY_NODE_value(sk, i) \
3150 ((X509_POLICY_NODE *)sk_value( \
3151 CHECKED_CAST(const _STACK *, const STACK_OF(X509_POLICY_NODE) *, sk), \
3152 (i)))
Adam Langley35349192015-07-21 11:06:45 -07003153
3154#define sk_X509_POLICY_NODE_set(sk, i, p) \
3155 ((X509_POLICY_NODE *)sk_set( \
3156 CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk), (i), \
3157 CHECKED_CAST(void *, X509_POLICY_NODE *, p)))
3158
3159#define sk_X509_POLICY_NODE_free(sk) \
3160 sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk))
3161
3162#define sk_X509_POLICY_NODE_pop_free(sk, free_func) \
3163 sk_pop_free( \
3164 CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk), \
3165 CHECKED_CAST(void (*)(void *), void (*)(X509_POLICY_NODE *), free_func))
3166
3167#define sk_X509_POLICY_NODE_insert(sk, p, where) \
3168 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk), \
3169 CHECKED_CAST(void *, X509_POLICY_NODE *, p), (where))
3170
3171#define sk_X509_POLICY_NODE_delete(sk, where) \
3172 ((X509_POLICY_NODE *)sk_delete( \
3173 CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk), (where)))
3174
3175#define sk_X509_POLICY_NODE_delete_ptr(sk, p) \
3176 ((X509_POLICY_NODE *)sk_delete_ptr( \
3177 CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk), \
3178 CHECKED_CAST(void *, X509_POLICY_NODE *, p)))
3179
3180#define sk_X509_POLICY_NODE_find(sk, out_index, p) \
3181 sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk), \
3182 (out_index), CHECKED_CAST(void *, X509_POLICY_NODE *, p))
3183
3184#define sk_X509_POLICY_NODE_shift(sk) \
3185 ((X509_POLICY_NODE *)sk_shift( \
3186 CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk)))
3187
3188#define sk_X509_POLICY_NODE_push(sk, p) \
3189 sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk), \
3190 CHECKED_CAST(void *, X509_POLICY_NODE *, p))
3191
3192#define sk_X509_POLICY_NODE_pop(sk) \
3193 ((X509_POLICY_NODE *)sk_pop( \
3194 CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk)))
3195
3196#define sk_X509_POLICY_NODE_dup(sk) \
3197 ((STACK_OF(X509_POLICY_NODE) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -04003198 CHECKED_CAST(const _STACK *, const STACK_OF(X509_POLICY_NODE) *, sk)))
Adam Langley35349192015-07-21 11:06:45 -07003199
3200#define sk_X509_POLICY_NODE_sort(sk) \
3201 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk))
3202
3203#define sk_X509_POLICY_NODE_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -04003204 sk_is_sorted( \
3205 CHECKED_CAST(const _STACK *, const STACK_OF(X509_POLICY_NODE) *, sk))
Adam Langley35349192015-07-21 11:06:45 -07003206
3207#define sk_X509_POLICY_NODE_set_cmp_func(sk, comp) \
3208 ((int (*)(const X509_POLICY_NODE **a, const X509_POLICY_NODE **b)) \
3209 sk_set_cmp_func( \
3210 CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk), \
3211 CHECKED_CAST(stack_cmp_func, int (*)(const X509_POLICY_NODE **a, \
3212 const X509_POLICY_NODE **b), \
3213 comp)))
3214
3215#define sk_X509_POLICY_NODE_deep_copy(sk, copy_func, free_func) \
3216 ((STACK_OF(X509_POLICY_NODE) *)sk_deep_copy( \
3217 CHECKED_CAST(const _STACK *, const STACK_OF(X509_POLICY_NODE) *, sk), \
3218 CHECKED_CAST(void *(*)(void *), \
3219 X509_POLICY_NODE *(*)(X509_POLICY_NODE *), copy_func), \
3220 CHECKED_CAST(void (*)(void *), void (*)(X509_POLICY_NODE *), \
3221 free_func)))
3222
3223/* X509_PURPOSE */
3224#define sk_X509_PURPOSE_new(comp) \
3225 ((STACK_OF(X509_PURPOSE) *)sk_new(CHECKED_CAST( \
3226 stack_cmp_func, int (*)(const X509_PURPOSE **a, const X509_PURPOSE **b), \
3227 comp)))
3228
3229#define sk_X509_PURPOSE_new_null() ((STACK_OF(X509_PURPOSE) *)sk_new_null())
3230
3231#define sk_X509_PURPOSE_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -04003232 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(X509_PURPOSE) *, sk))
Adam Langley35349192015-07-21 11:06:45 -07003233
3234#define sk_X509_PURPOSE_zero(sk) \
3235 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk));
3236
3237#define sk_X509_PURPOSE_value(sk, i) \
3238 ((X509_PURPOSE *)sk_value( \
David Benjaminada97992016-05-13 13:14:28 -04003239 CHECKED_CAST(const _STACK *, const STACK_OF(X509_PURPOSE) *, sk), (i)))
Adam Langley35349192015-07-21 11:06:45 -07003240
3241#define sk_X509_PURPOSE_set(sk, i, p) \
3242 ((X509_PURPOSE *)sk_set( \
3243 CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk), (i), \
3244 CHECKED_CAST(void *, X509_PURPOSE *, p)))
3245
3246#define sk_X509_PURPOSE_free(sk) \
3247 sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk))
3248
3249#define sk_X509_PURPOSE_pop_free(sk, free_func) \
3250 sk_pop_free( \
3251 CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk), \
3252 CHECKED_CAST(void (*)(void *), void (*)(X509_PURPOSE *), free_func))
3253
3254#define sk_X509_PURPOSE_insert(sk, p, where) \
3255 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk), \
3256 CHECKED_CAST(void *, X509_PURPOSE *, p), (where))
3257
3258#define sk_X509_PURPOSE_delete(sk, where) \
3259 ((X509_PURPOSE *)sk_delete( \
3260 CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk), (where)))
3261
3262#define sk_X509_PURPOSE_delete_ptr(sk, p) \
3263 ((X509_PURPOSE *)sk_delete_ptr( \
3264 CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk), \
3265 CHECKED_CAST(void *, X509_PURPOSE *, p)))
3266
3267#define sk_X509_PURPOSE_find(sk, out_index, p) \
3268 sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk), (out_index), \
3269 CHECKED_CAST(void *, X509_PURPOSE *, p))
3270
3271#define sk_X509_PURPOSE_shift(sk) \
3272 ((X509_PURPOSE *)sk_shift( \
3273 CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk)))
3274
3275#define sk_X509_PURPOSE_push(sk, p) \
3276 sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk), \
3277 CHECKED_CAST(void *, X509_PURPOSE *, p))
3278
3279#define sk_X509_PURPOSE_pop(sk) \
3280 ((X509_PURPOSE *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk)))
3281
3282#define sk_X509_PURPOSE_dup(sk) \
3283 ((STACK_OF(X509_PURPOSE) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -04003284 CHECKED_CAST(const _STACK *, const STACK_OF(X509_PURPOSE) *, sk)))
Adam Langley35349192015-07-21 11:06:45 -07003285
3286#define sk_X509_PURPOSE_sort(sk) \
3287 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk))
3288
3289#define sk_X509_PURPOSE_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -04003290 sk_is_sorted(CHECKED_CAST(const _STACK *, const STACK_OF(X509_PURPOSE) *, sk))
Adam Langley35349192015-07-21 11:06:45 -07003291
3292#define sk_X509_PURPOSE_set_cmp_func(sk, comp) \
3293 ((int (*)(const X509_PURPOSE **a, const X509_PURPOSE **b))sk_set_cmp_func( \
3294 CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk), \
3295 CHECKED_CAST(stack_cmp_func, \
3296 int (*)(const X509_PURPOSE **a, const X509_PURPOSE **b), \
3297 comp)))
3298
3299#define sk_X509_PURPOSE_deep_copy(sk, copy_func, free_func) \
3300 ((STACK_OF(X509_PURPOSE) *)sk_deep_copy( \
3301 CHECKED_CAST(const _STACK *, const STACK_OF(X509_PURPOSE) *, sk), \
3302 CHECKED_CAST(void *(*)(void *), X509_PURPOSE *(*)(X509_PURPOSE *), \
3303 copy_func), \
3304 CHECKED_CAST(void (*)(void *), void (*)(X509_PURPOSE *), free_func)))
3305
3306/* X509_REVOKED */
3307#define sk_X509_REVOKED_new(comp) \
3308 ((STACK_OF(X509_REVOKED) *)sk_new(CHECKED_CAST( \
3309 stack_cmp_func, int (*)(const X509_REVOKED **a, const X509_REVOKED **b), \
3310 comp)))
3311
3312#define sk_X509_REVOKED_new_null() ((STACK_OF(X509_REVOKED) *)sk_new_null())
3313
3314#define sk_X509_REVOKED_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -04003315 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(X509_REVOKED) *, sk))
Adam Langley35349192015-07-21 11:06:45 -07003316
3317#define sk_X509_REVOKED_zero(sk) \
3318 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk));
3319
3320#define sk_X509_REVOKED_value(sk, i) \
3321 ((X509_REVOKED *)sk_value( \
David Benjaminada97992016-05-13 13:14:28 -04003322 CHECKED_CAST(const _STACK *, const STACK_OF(X509_REVOKED) *, sk), (i)))
Adam Langley35349192015-07-21 11:06:45 -07003323
3324#define sk_X509_REVOKED_set(sk, i, p) \
3325 ((X509_REVOKED *)sk_set( \
3326 CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk), (i), \
3327 CHECKED_CAST(void *, X509_REVOKED *, p)))
3328
3329#define sk_X509_REVOKED_free(sk) \
3330 sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk))
3331
3332#define sk_X509_REVOKED_pop_free(sk, free_func) \
3333 sk_pop_free( \
3334 CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk), \
3335 CHECKED_CAST(void (*)(void *), void (*)(X509_REVOKED *), free_func))
3336
3337#define sk_X509_REVOKED_insert(sk, p, where) \
3338 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk), \
3339 CHECKED_CAST(void *, X509_REVOKED *, p), (where))
3340
3341#define sk_X509_REVOKED_delete(sk, where) \
3342 ((X509_REVOKED *)sk_delete( \
3343 CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk), (where)))
3344
3345#define sk_X509_REVOKED_delete_ptr(sk, p) \
3346 ((X509_REVOKED *)sk_delete_ptr( \
3347 CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk), \
3348 CHECKED_CAST(void *, X509_REVOKED *, p)))
3349
3350#define sk_X509_REVOKED_find(sk, out_index, p) \
3351 sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk), (out_index), \
3352 CHECKED_CAST(void *, X509_REVOKED *, p))
3353
3354#define sk_X509_REVOKED_shift(sk) \
3355 ((X509_REVOKED *)sk_shift( \
3356 CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk)))
3357
3358#define sk_X509_REVOKED_push(sk, p) \
3359 sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk), \
3360 CHECKED_CAST(void *, X509_REVOKED *, p))
3361
3362#define sk_X509_REVOKED_pop(sk) \
3363 ((X509_REVOKED *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk)))
3364
3365#define sk_X509_REVOKED_dup(sk) \
3366 ((STACK_OF(X509_REVOKED) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -04003367 CHECKED_CAST(const _STACK *, const STACK_OF(X509_REVOKED) *, sk)))
Adam Langley35349192015-07-21 11:06:45 -07003368
3369#define sk_X509_REVOKED_sort(sk) \
3370 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk))
3371
3372#define sk_X509_REVOKED_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -04003373 sk_is_sorted(CHECKED_CAST(const _STACK *, const STACK_OF(X509_REVOKED) *, sk))
Adam Langley35349192015-07-21 11:06:45 -07003374
3375#define sk_X509_REVOKED_set_cmp_func(sk, comp) \
3376 ((int (*)(const X509_REVOKED **a, const X509_REVOKED **b))sk_set_cmp_func( \
3377 CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk), \
3378 CHECKED_CAST(stack_cmp_func, \
3379 int (*)(const X509_REVOKED **a, const X509_REVOKED **b), \
3380 comp)))
3381
3382#define sk_X509_REVOKED_deep_copy(sk, copy_func, free_func) \
3383 ((STACK_OF(X509_REVOKED) *)sk_deep_copy( \
3384 CHECKED_CAST(const _STACK *, const STACK_OF(X509_REVOKED) *, sk), \
3385 CHECKED_CAST(void *(*)(void *), X509_REVOKED *(*)(X509_REVOKED *), \
3386 copy_func), \
3387 CHECKED_CAST(void (*)(void *), void (*)(X509_REVOKED *), free_func)))
3388
3389/* X509_TRUST */
3390#define sk_X509_TRUST_new(comp) \
3391 ((STACK_OF(X509_TRUST) *)sk_new(CHECKED_CAST( \
3392 stack_cmp_func, int (*)(const X509_TRUST **a, const X509_TRUST **b), \
3393 comp)))
3394
3395#define sk_X509_TRUST_new_null() ((STACK_OF(X509_TRUST) *)sk_new_null())
3396
3397#define sk_X509_TRUST_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -04003398 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(X509_TRUST) *, sk))
Adam Langley35349192015-07-21 11:06:45 -07003399
3400#define sk_X509_TRUST_zero(sk) \
3401 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk));
3402
3403#define sk_X509_TRUST_value(sk, i) \
3404 ((X509_TRUST *)sk_value( \
David Benjaminada97992016-05-13 13:14:28 -04003405 CHECKED_CAST(const _STACK *, const STACK_OF(X509_TRUST) *, sk), (i)))
Adam Langley35349192015-07-21 11:06:45 -07003406
3407#define sk_X509_TRUST_set(sk, i, p) \
3408 ((X509_TRUST *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk), \
3409 (i), CHECKED_CAST(void *, X509_TRUST *, p)))
3410
3411#define sk_X509_TRUST_free(sk) \
3412 sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk))
3413
3414#define sk_X509_TRUST_pop_free(sk, free_func) \
3415 sk_pop_free( \
3416 CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk), \
3417 CHECKED_CAST(void (*)(void *), void (*)(X509_TRUST *), free_func))
3418
3419#define sk_X509_TRUST_insert(sk, p, where) \
3420 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk), \
3421 CHECKED_CAST(void *, X509_TRUST *, p), (where))
3422
3423#define sk_X509_TRUST_delete(sk, where) \
3424 ((X509_TRUST *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk), \
3425 (where)))
3426
3427#define sk_X509_TRUST_delete_ptr(sk, p) \
3428 ((X509_TRUST *)sk_delete_ptr( \
3429 CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk), \
3430 CHECKED_CAST(void *, X509_TRUST *, p)))
3431
3432#define sk_X509_TRUST_find(sk, out_index, p) \
3433 sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk), (out_index), \
3434 CHECKED_CAST(void *, X509_TRUST *, p))
3435
3436#define sk_X509_TRUST_shift(sk) \
3437 ((X509_TRUST *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk)))
3438
3439#define sk_X509_TRUST_push(sk, p) \
3440 sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk), \
3441 CHECKED_CAST(void *, X509_TRUST *, p))
3442
3443#define sk_X509_TRUST_pop(sk) \
3444 ((X509_TRUST *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk)))
3445
3446#define sk_X509_TRUST_dup(sk) \
3447 ((STACK_OF(X509_TRUST) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -04003448 CHECKED_CAST(const _STACK *, const STACK_OF(X509_TRUST) *, sk)))
Adam Langley35349192015-07-21 11:06:45 -07003449
3450#define sk_X509_TRUST_sort(sk) \
3451 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk))
3452
3453#define sk_X509_TRUST_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -04003454 sk_is_sorted(CHECKED_CAST(const _STACK *, const STACK_OF(X509_TRUST) *, sk))
Adam Langley35349192015-07-21 11:06:45 -07003455
3456#define sk_X509_TRUST_set_cmp_func(sk, comp) \
3457 ((int (*)(const X509_TRUST **a, const X509_TRUST **b))sk_set_cmp_func( \
3458 CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk), \
3459 CHECKED_CAST(stack_cmp_func, \
3460 int (*)(const X509_TRUST **a, const X509_TRUST **b), \
3461 comp)))
3462
3463#define sk_X509_TRUST_deep_copy(sk, copy_func, free_func) \
3464 ((STACK_OF(X509_TRUST) *)sk_deep_copy( \
3465 CHECKED_CAST(const _STACK *, const STACK_OF(X509_TRUST) *, sk), \
3466 CHECKED_CAST(void *(*)(void *), X509_TRUST *(*)(X509_TRUST *), \
3467 copy_func), \
3468 CHECKED_CAST(void (*)(void *), void (*)(X509_TRUST *), free_func)))
Adam Langleya1048a72015-02-11 14:27:21 -08003469
Adam Langley95c29f32014-06-20 12:00:00 -07003470/* X509_VERIFY_PARAM */
3471#define sk_X509_VERIFY_PARAM_new(comp) \
3472 ((STACK_OF(X509_VERIFY_PARAM) *)sk_new(CHECKED_CAST( \
3473 stack_cmp_func, \
3474 int (*)(const X509_VERIFY_PARAM **a, const X509_VERIFY_PARAM **b), \
3475 comp)))
3476
3477#define sk_X509_VERIFY_PARAM_new_null() \
3478 ((STACK_OF(X509_VERIFY_PARAM) *)sk_new_null())
3479
3480#define sk_X509_VERIFY_PARAM_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -04003481 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(X509_VERIFY_PARAM) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -07003482
3483#define sk_X509_VERIFY_PARAM_zero(sk) \
3484 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk));
3485
David Benjaminada97992016-05-13 13:14:28 -04003486#define sk_X509_VERIFY_PARAM_value(sk, i) \
3487 ((X509_VERIFY_PARAM *)sk_value( \
3488 CHECKED_CAST(const _STACK *, const STACK_OF(X509_VERIFY_PARAM) *, sk), \
3489 (i)))
Adam Langley95c29f32014-06-20 12:00:00 -07003490
3491#define sk_X509_VERIFY_PARAM_set(sk, i, p) \
3492 ((X509_VERIFY_PARAM *)sk_set( \
3493 CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk), (i), \
3494 CHECKED_CAST(void *, X509_VERIFY_PARAM *, p)))
3495
3496#define sk_X509_VERIFY_PARAM_free(sk) \
3497 sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk))
3498
3499#define sk_X509_VERIFY_PARAM_pop_free(sk, free_func) \
3500 sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk), \
3501 CHECKED_CAST(void (*)(void *), void (*)(X509_VERIFY_PARAM *), \
3502 free_func))
3503
3504#define sk_X509_VERIFY_PARAM_insert(sk, p, where) \
3505 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk), \
3506 CHECKED_CAST(void *, X509_VERIFY_PARAM *, p), (where))
3507
3508#define sk_X509_VERIFY_PARAM_delete(sk, where) \
3509 ((X509_VERIFY_PARAM *)sk_delete( \
3510 CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk), (where)))
3511
3512#define sk_X509_VERIFY_PARAM_delete_ptr(sk, p) \
3513 ((X509_VERIFY_PARAM *)sk_delete_ptr( \
3514 CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk), \
3515 CHECKED_CAST(void *, X509_VERIFY_PARAM *, p)))
3516
3517#define sk_X509_VERIFY_PARAM_find(sk, out_index, p) \
3518 sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk), \
3519 (out_index), CHECKED_CAST(void *, X509_VERIFY_PARAM *, p))
3520
3521#define sk_X509_VERIFY_PARAM_shift(sk) \
3522 ((X509_VERIFY_PARAM *)sk_shift( \
3523 CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk)))
3524
3525#define sk_X509_VERIFY_PARAM_push(sk, p) \
3526 sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk), \
3527 CHECKED_CAST(void *, X509_VERIFY_PARAM *, p))
3528
3529#define sk_X509_VERIFY_PARAM_pop(sk) \
3530 ((X509_VERIFY_PARAM *)sk_pop( \
3531 CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk)))
3532
3533#define sk_X509_VERIFY_PARAM_dup(sk) \
3534 ((STACK_OF(X509_VERIFY_PARAM) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -04003535 CHECKED_CAST(const _STACK *, const STACK_OF(X509_VERIFY_PARAM) *, sk)))
Adam Langley95c29f32014-06-20 12:00:00 -07003536
3537#define sk_X509_VERIFY_PARAM_sort(sk) \
3538 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk))
3539
3540#define sk_X509_VERIFY_PARAM_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -04003541 sk_is_sorted( \
3542 CHECKED_CAST(const _STACK *, const STACK_OF(X509_VERIFY_PARAM) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -07003543
Adam Langley2d96a672015-02-11 14:28:41 -08003544#define sk_X509_VERIFY_PARAM_set_cmp_func(sk, comp) \
3545 ((int (*)(const X509_VERIFY_PARAM **a, const X509_VERIFY_PARAM **b)) \
3546 sk_set_cmp_func( \
3547 CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk), \
3548 CHECKED_CAST(stack_cmp_func, int (*)(const X509_VERIFY_PARAM **a, \
3549 const X509_VERIFY_PARAM **b), \
3550 comp)))
David Benjamin6f260012014-08-15 13:49:12 -04003551
Adam Langleya1048a72015-02-11 14:27:21 -08003552#define sk_X509_VERIFY_PARAM_deep_copy(sk, copy_func, free_func) \
3553 ((STACK_OF(X509_VERIFY_PARAM) *)sk_deep_copy( \
3554 CHECKED_CAST(const _STACK *, const STACK_OF(X509_VERIFY_PARAM) *, sk), \
3555 CHECKED_CAST(void *(*)(void *), \
3556 X509_VERIFY_PARAM *(*)(X509_VERIFY_PARAM *), copy_func), \
3557 CHECKED_CAST(void (*)(void *), void (*)(X509_VERIFY_PARAM *), \
3558 free_func)))
3559
Adam Langley35349192015-07-21 11:06:45 -07003560/* void */
David Benjaminada97992016-05-13 13:14:28 -04003561#define sk_void_new(comp) \
3562 ((STACK_OF(void) *)sk_new(CHECKED_CAST( \
Adam Langley35349192015-07-21 11:06:45 -07003563 stack_cmp_func, int (*)(const void **a, const void **b), comp)))
3564
David Benjaminada97992016-05-13 13:14:28 -04003565#define sk_void_new_null() ((STACK_OF(void) *)sk_new_null())
Adam Langley35349192015-07-21 11:06:45 -07003566
David Benjaminada97992016-05-13 13:14:28 -04003567#define sk_void_num(sk) \
3568 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(void) *, sk))
Adam Langley35349192015-07-21 11:06:45 -07003569
3570#define sk_void_zero(sk) sk_zero(CHECKED_CAST(_STACK *, STACK_OF(void) *, sk));
3571
David Benjaminada97992016-05-13 13:14:28 -04003572#define sk_void_value(sk, i) \
3573 ((void *)sk_value(CHECKED_CAST(const _STACK *, const STACK_OF(void) *, sk), \
3574 (i)))
Adam Langley35349192015-07-21 11:06:45 -07003575
David Benjaminada97992016-05-13 13:14:28 -04003576#define sk_void_set(sk, i, p) \
3577 ((void *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(void) *, sk), (i), \
Adam Langley35349192015-07-21 11:06:45 -07003578 CHECKED_CAST(void *, void *, p)))
3579
3580#define sk_void_free(sk) sk_free(CHECKED_CAST(_STACK *, STACK_OF(void) *, sk))
3581
3582#define sk_void_pop_free(sk, free_func) \
3583 sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(void) *, sk), \
3584 CHECKED_CAST(void (*)(void *), void (*)(void *), free_func))
3585
3586#define sk_void_insert(sk, p, where) \
3587 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(void) *, sk), \
3588 CHECKED_CAST(void *, void *, p), (where))
3589
3590#define sk_void_delete(sk, where) \
David Benjaminada97992016-05-13 13:14:28 -04003591 ((void *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(void) *, sk), (where)))
Adam Langley35349192015-07-21 11:06:45 -07003592
David Benjaminada97992016-05-13 13:14:28 -04003593#define sk_void_delete_ptr(sk, p) \
3594 ((void *)sk_delete_ptr(CHECKED_CAST(_STACK *, STACK_OF(void) *, sk), \
Adam Langley35349192015-07-21 11:06:45 -07003595 CHECKED_CAST(void *, void *, p)))
3596
3597#define sk_void_find(sk, out_index, p) \
3598 sk_find(CHECKED_CAST(_STACK *, STACK_OF(void) *, sk), (out_index), \
3599 CHECKED_CAST(void *, void *, p))
3600
3601#define sk_void_shift(sk) \
David Benjaminada97992016-05-13 13:14:28 -04003602 ((void *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(void) *, sk)))
Adam Langley35349192015-07-21 11:06:45 -07003603
3604#define sk_void_push(sk, p) \
3605 sk_push(CHECKED_CAST(_STACK *, STACK_OF(void) *, sk), \
3606 CHECKED_CAST(void *, void *, p))
3607
3608#define sk_void_pop(sk) \
David Benjaminada97992016-05-13 13:14:28 -04003609 ((void *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(void) *, sk)))
Adam Langley35349192015-07-21 11:06:45 -07003610
David Benjaminada97992016-05-13 13:14:28 -04003611#define sk_void_dup(sk) \
3612 ((STACK_OF(void) *)sk_dup( \
3613 CHECKED_CAST(const _STACK *, const STACK_OF(void) *, sk)))
Adam Langley35349192015-07-21 11:06:45 -07003614
3615#define sk_void_sort(sk) sk_sort(CHECKED_CAST(_STACK *, STACK_OF(void) *, sk))
3616
3617#define sk_void_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -04003618 sk_is_sorted(CHECKED_CAST(const _STACK *, const STACK_OF(void) *, sk))
Adam Langley35349192015-07-21 11:06:45 -07003619
3620#define sk_void_set_cmp_func(sk, comp) \
3621 ((int (*)(const void **a, const void **b))sk_set_cmp_func( \
David Benjaminada97992016-05-13 13:14:28 -04003622 CHECKED_CAST(_STACK *, STACK_OF(void) *, sk), \
Adam Langley35349192015-07-21 11:06:45 -07003623 CHECKED_CAST(stack_cmp_func, int (*)(const void **a, const void **b), \
3624 comp)))
3625
3626#define sk_void_deep_copy(sk, copy_func, free_func) \
David Benjaminada97992016-05-13 13:14:28 -04003627 ((STACK_OF(void) *)sk_deep_copy( \
Adam Langley35349192015-07-21 11:06:45 -07003628 CHECKED_CAST(const _STACK *, const STACK_OF(void) *, sk), \
3629 CHECKED_CAST(void *(*)(void *), void *(*)(void *), copy_func), \
3630 CHECKED_CAST(void (*)(void *), void (*)(void *), free_func)))
Adam Langleya1048a72015-02-11 14:27:21 -08003631
David Benjaminbc44c082015-01-01 15:02:11 -05003632/* SRTP_PROTECTION_PROFILE */
3633#define sk_SRTP_PROTECTION_PROFILE_new(comp) \
3634 ((STACK_OF(SRTP_PROTECTION_PROFILE) *)sk_new(CHECKED_CAST( \
3635 stack_cmp_func, int (*)(const const SRTP_PROTECTION_PROFILE **a, \
3636 const const SRTP_PROTECTION_PROFILE **b), \
3637 comp)))
3638
3639#define sk_SRTP_PROTECTION_PROFILE_new_null() \
3640 ((STACK_OF(SRTP_PROTECTION_PROFILE) *)sk_new_null())
3641
3642#define sk_SRTP_PROTECTION_PROFILE_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -04003643 sk_num(CHECKED_CAST(const _STACK *, \
3644 const STACK_OF(SRTP_PROTECTION_PROFILE) *, sk))
David Benjaminbc44c082015-01-01 15:02:11 -05003645
3646#define sk_SRTP_PROTECTION_PROFILE_zero(sk) \
3647 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk));
3648
David Benjaminada97992016-05-13 13:14:28 -04003649#define sk_SRTP_PROTECTION_PROFILE_value(sk, i) \
3650 ((const SRTP_PROTECTION_PROFILE *)sk_value( \
3651 CHECKED_CAST(const _STACK *, const STACK_OF(SRTP_PROTECTION_PROFILE) *, \
3652 sk), \
David Benjaminbc44c082015-01-01 15:02:11 -05003653 (i)))
3654
3655#define sk_SRTP_PROTECTION_PROFILE_set(sk, i, p) \
3656 ((const SRTP_PROTECTION_PROFILE *)sk_set( \
3657 CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk), (i), \
3658 CHECKED_CAST(void *, const SRTP_PROTECTION_PROFILE *, p)))
3659
3660#define sk_SRTP_PROTECTION_PROFILE_free(sk) \
3661 sk_free(CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk))
3662
3663#define sk_SRTP_PROTECTION_PROFILE_pop_free(sk, free_func) \
3664 sk_pop_free( \
3665 CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk), \
3666 CHECKED_CAST(void (*)(void *), \
3667 void (*)(const SRTP_PROTECTION_PROFILE *), free_func))
3668
3669#define sk_SRTP_PROTECTION_PROFILE_insert(sk, p, where) \
3670 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk), \
3671 CHECKED_CAST(void *, const SRTP_PROTECTION_PROFILE *, p), (where))
3672
3673#define sk_SRTP_PROTECTION_PROFILE_delete(sk, where) \
3674 ((const SRTP_PROTECTION_PROFILE *)sk_delete( \
3675 CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk), \
3676 (where)))
3677
3678#define sk_SRTP_PROTECTION_PROFILE_delete_ptr(sk, p) \
3679 ((const SRTP_PROTECTION_PROFILE *)sk_delete_ptr( \
3680 CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk), \
3681 CHECKED_CAST(void *, const SRTP_PROTECTION_PROFILE *, p)))
3682
3683#define sk_SRTP_PROTECTION_PROFILE_find(sk, out_index, p) \
3684 sk_find(CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk), \
3685 (out_index), \
3686 CHECKED_CAST(void *, const SRTP_PROTECTION_PROFILE *, p))
3687
3688#define sk_SRTP_PROTECTION_PROFILE_shift(sk) \
3689 ((const SRTP_PROTECTION_PROFILE *)sk_shift( \
3690 CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk)))
3691
3692#define sk_SRTP_PROTECTION_PROFILE_push(sk, p) \
3693 sk_push(CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk), \
3694 CHECKED_CAST(void *, const SRTP_PROTECTION_PROFILE *, p))
3695
3696#define sk_SRTP_PROTECTION_PROFILE_pop(sk) \
3697 ((const SRTP_PROTECTION_PROFILE *)sk_pop( \
3698 CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk)))
3699
David Benjaminada97992016-05-13 13:14:28 -04003700#define sk_SRTP_PROTECTION_PROFILE_dup(sk) \
3701 ((STACK_OF(SRTP_PROTECTION_PROFILE) *)sk_dup(CHECKED_CAST( \
3702 const _STACK *, const STACK_OF(SRTP_PROTECTION_PROFILE) *, sk)))
David Benjaminbc44c082015-01-01 15:02:11 -05003703
3704#define sk_SRTP_PROTECTION_PROFILE_sort(sk) \
3705 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk))
3706
3707#define sk_SRTP_PROTECTION_PROFILE_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -04003708 sk_is_sorted(CHECKED_CAST(const _STACK *, \
3709 const STACK_OF(SRTP_PROTECTION_PROFILE) *, sk))
David Benjaminbc44c082015-01-01 15:02:11 -05003710
Adam Langley2d96a672015-02-11 14:28:41 -08003711#define sk_SRTP_PROTECTION_PROFILE_set_cmp_func(sk, comp) \
3712 ((int (*)(const SRTP_PROTECTION_PROFILE **a, \
3713 const SRTP_PROTECTION_PROFILE **b)) \
3714 sk_set_cmp_func( \
3715 CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk), \
3716 CHECKED_CAST(stack_cmp_func, \
3717 int (*)(const SRTP_PROTECTION_PROFILE **a, \
3718 const SRTP_PROTECTION_PROFILE **b), \
3719 comp)))
David Benjaminbc44c082015-01-01 15:02:11 -05003720
David Benjaminada97992016-05-13 13:14:28 -04003721#define sk_SRTP_PROTECTION_PROFILE_deep_copy(sk, copy_func, free_func) \
3722 ((STACK_OF(SRTP_PROTECTION_PROFILE) *)sk_deep_copy( \
3723 CHECKED_CAST(const _STACK *, const STACK_OF(SRTP_PROTECTION_PROFILE) *, \
3724 sk), \
3725 CHECKED_CAST( \
3726 void *(*)(void *), \
3727 const SRTP_PROTECTION_PROFILE *(*)(const SRTP_PROTECTION_PROFILE *), \
3728 copy_func), \
3729 CHECKED_CAST(void (*)(void *), \
Adam Langleya1048a72015-02-11 14:27:21 -08003730 void (*)(const SRTP_PROTECTION_PROFILE *), free_func)))
3731
David Benjamin6f260012014-08-15 13:49:12 -04003732/* SSL_CIPHER */
3733#define sk_SSL_CIPHER_new(comp) \
3734 ((STACK_OF(SSL_CIPHER) *)sk_new(CHECKED_CAST( \
3735 stack_cmp_func, \
3736 int (*)(const const SSL_CIPHER **a, const const SSL_CIPHER **b), comp)))
3737
3738#define sk_SSL_CIPHER_new_null() ((STACK_OF(SSL_CIPHER) *)sk_new_null())
3739
3740#define sk_SSL_CIPHER_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -04003741 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(SSL_CIPHER) *, sk))
David Benjamin6f260012014-08-15 13:49:12 -04003742
3743#define sk_SSL_CIPHER_zero(sk) \
3744 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk));
3745
3746#define sk_SSL_CIPHER_value(sk, i) \
3747 ((const SSL_CIPHER *)sk_value( \
David Benjaminada97992016-05-13 13:14:28 -04003748 CHECKED_CAST(const _STACK *, const STACK_OF(SSL_CIPHER) *, sk), (i)))
David Benjamin6f260012014-08-15 13:49:12 -04003749
3750#define sk_SSL_CIPHER_set(sk, i, p) \
3751 ((const SSL_CIPHER *)sk_set( \
3752 CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk), (i), \
3753 CHECKED_CAST(void *, const SSL_CIPHER *, p)))
3754
3755#define sk_SSL_CIPHER_free(sk) \
3756 sk_free(CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk))
3757
3758#define sk_SSL_CIPHER_pop_free(sk, free_func) \
3759 sk_pop_free( \
3760 CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk), \
3761 CHECKED_CAST(void (*)(void *), void (*)(const SSL_CIPHER *), free_func))
3762
3763#define sk_SSL_CIPHER_insert(sk, p, where) \
3764 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk), \
3765 CHECKED_CAST(void *, const SSL_CIPHER *, p), (where))
3766
3767#define sk_SSL_CIPHER_delete(sk, where) \
3768 ((const SSL_CIPHER *)sk_delete( \
3769 CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk), (where)))
3770
3771#define sk_SSL_CIPHER_delete_ptr(sk, p) \
3772 ((const SSL_CIPHER *)sk_delete_ptr( \
3773 CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk), \
3774 CHECKED_CAST(void *, const SSL_CIPHER *, p)))
3775
3776#define sk_SSL_CIPHER_find(sk, out_index, p) \
3777 sk_find(CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk), (out_index), \
3778 CHECKED_CAST(void *, const SSL_CIPHER *, p))
3779
3780#define sk_SSL_CIPHER_shift(sk) \
3781 ((const SSL_CIPHER *)sk_shift( \
3782 CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk)))
3783
3784#define sk_SSL_CIPHER_push(sk, p) \
3785 sk_push(CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk), \
3786 CHECKED_CAST(void *, const SSL_CIPHER *, p))
3787
3788#define sk_SSL_CIPHER_pop(sk) \
3789 ((const SSL_CIPHER *)sk_pop( \
3790 CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk)))
3791
3792#define sk_SSL_CIPHER_dup(sk) \
3793 ((STACK_OF(SSL_CIPHER) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -04003794 CHECKED_CAST(const _STACK *, const STACK_OF(SSL_CIPHER) *, sk)))
David Benjamin6f260012014-08-15 13:49:12 -04003795
3796#define sk_SSL_CIPHER_sort(sk) \
3797 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk))
3798
3799#define sk_SSL_CIPHER_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -04003800 sk_is_sorted(CHECKED_CAST(const _STACK *, const STACK_OF(SSL_CIPHER) *, sk))
David Benjamin6f260012014-08-15 13:49:12 -04003801
3802#define sk_SSL_CIPHER_set_cmp_func(sk, comp) \
3803 ((int (*)(const SSL_CIPHER **a, const SSL_CIPHER **b))sk_set_cmp_func( \
3804 CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk), \
3805 CHECKED_CAST(stack_cmp_func, \
3806 int (*)(const SSL_CIPHER **a, const SSL_CIPHER **b), \
3807 comp)))
3808
Adam Langleya1048a72015-02-11 14:27:21 -08003809#define sk_SSL_CIPHER_deep_copy(sk, copy_func, free_func) \
3810 ((STACK_OF(SSL_CIPHER) *)sk_deep_copy( \
3811 CHECKED_CAST(const _STACK *, const STACK_OF(SSL_CIPHER) *, sk), \
3812 CHECKED_CAST(void *(*)(void *), \
3813 const SSL_CIPHER *(*)(const SSL_CIPHER *), copy_func), \
3814 CHECKED_CAST(void (*)(void *), void (*)(const SSL_CIPHER *), \
3815 free_func)))
3816
Adam Langley95c29f32014-06-20 12:00:00 -07003817/* OPENSSL_STRING */
3818#define sk_OPENSSL_STRING_new(comp) \
3819 ((STACK_OF(OPENSSL_STRING) *)sk_new(CHECKED_CAST( \
3820 stack_cmp_func, \
3821 int (*)(const OPENSSL_STRING *a, const OPENSSL_STRING *b), comp)))
3822
3823#define sk_OPENSSL_STRING_new_null() ((STACK_OF(OPENSSL_STRING) *)sk_new_null())
3824
3825#define sk_OPENSSL_STRING_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -04003826 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(OPENSSL_STRING) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -07003827
3828#define sk_OPENSSL_STRING_zero(sk) \
3829 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk));
3830
David Benjaminada97992016-05-13 13:14:28 -04003831#define sk_OPENSSL_STRING_value(sk, i) \
3832 ((OPENSSL_STRING)sk_value( \
3833 CHECKED_CAST(const _STACK *, const STACK_OF(OPENSSL_STRING) *, sk), \
3834 (i)))
Adam Langley95c29f32014-06-20 12:00:00 -07003835
3836#define sk_OPENSSL_STRING_set(sk, i, p) \
3837 ((OPENSSL_STRING)sk_set( \
3838 CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk), (i), \
3839 CHECKED_CAST(void *, OPENSSL_STRING, p)))
3840
3841#define sk_OPENSSL_STRING_free(sk) \
3842 sk_free(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk))
3843
3844#define sk_OPENSSL_STRING_pop_free(sk, free_func) \
3845 sk_pop_free( \
3846 CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk), \
3847 CHECKED_CAST(void (*)(void *), void (*)(OPENSSL_STRING), free_func))
3848
3849#define sk_OPENSSL_STRING_insert(sk, p, where) \
3850 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk), \
3851 CHECKED_CAST(void *, OPENSSL_STRING, p), (where))
3852
3853#define sk_OPENSSL_STRING_delete(sk, where) \
3854 ((OPENSSL_STRING)sk_delete( \
3855 CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk), (where)))
3856
3857#define sk_OPENSSL_STRING_delete_ptr(sk, p) \
3858 ((OPENSSL_STRING)sk_delete_ptr( \
3859 CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk), \
3860 CHECKED_CAST(void *, OPENSSL_STRING, p)))
3861
3862#define sk_OPENSSL_STRING_find(sk, out_index, p) \
3863 sk_find(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk), (out_index), \
3864 CHECKED_CAST(void *, OPENSSL_STRING, p))
3865
3866#define sk_OPENSSL_STRING_shift(sk) \
3867 ((OPENSSL_STRING)sk_shift( \
3868 CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk)))
3869
3870#define sk_OPENSSL_STRING_push(sk, p) \
3871 sk_push(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk), \
3872 CHECKED_CAST(void *, OPENSSL_STRING, p))
3873
3874#define sk_OPENSSL_STRING_pop(sk) \
3875 ((OPENSSL_STRING)sk_pop( \
3876 CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk)))
3877
3878#define sk_OPENSSL_STRING_dup(sk) \
3879 ((STACK_OF(OPENSSL_STRING) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -04003880 CHECKED_CAST(const _STACK *, const STACK_OF(OPENSSL_STRING) *, sk)))
Adam Langley95c29f32014-06-20 12:00:00 -07003881
3882#define sk_OPENSSL_STRING_sort(sk) \
3883 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk))
3884
3885#define sk_OPENSSL_STRING_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -04003886 sk_is_sorted( \
3887 CHECKED_CAST(const _STACK *, const STACK_OF(OPENSSL_STRING) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -07003888
Adam Langley2d96a672015-02-11 14:28:41 -08003889#define sk_OPENSSL_STRING_set_cmp_func(sk, comp) \
3890 ((int (*)(const OPENSSL_STRING **a, const OPENSSL_STRING **b)) \
3891 sk_set_cmp_func( \
3892 CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk), \
3893 CHECKED_CAST(stack_cmp_func, int (*)(const OPENSSL_STRING **a, \
3894 const OPENSSL_STRING **b), \
3895 comp)))
David Benjamin6f260012014-08-15 13:49:12 -04003896
Adam Langleya1048a72015-02-11 14:27:21 -08003897#define sk_OPENSSL_STRING_deep_copy(sk, copy_func, free_func) \
3898 ((STACK_OF(OPENSSL_STRING) *)sk_deep_copy( \
3899 CHECKED_CAST(const _STACK *, const STACK_OF(OPENSSL_STRING) *, sk), \
3900 CHECKED_CAST(void *(*)(void *), OPENSSL_STRING (*)(OPENSSL_STRING), \
3901 copy_func), \
3902 CHECKED_CAST(void (*)(void *), void (*)(OPENSSL_STRING), free_func)))
3903
Adam Langley95c29f32014-06-20 12:00:00 -07003904/* OPENSSL_BLOCK */
3905#define sk_OPENSSL_BLOCK_new(comp) \
3906 ((STACK_OF(OPENSSL_BLOCK) *)sk_new(CHECKED_CAST( \
3907 stack_cmp_func, int (*)(const OPENSSL_BLOCK *a, const OPENSSL_BLOCK *b), \
3908 comp)))
3909
3910#define sk_OPENSSL_BLOCK_new_null() ((STACK_OF(OPENSSL_BLOCK) *)sk_new_null())
3911
3912#define sk_OPENSSL_BLOCK_num(sk) \
David Benjaminada97992016-05-13 13:14:28 -04003913 sk_num(CHECKED_CAST(const _STACK *, const STACK_OF(OPENSSL_BLOCK) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -07003914
3915#define sk_OPENSSL_BLOCK_zero(sk) \
3916 sk_zero(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk));
3917
3918#define sk_OPENSSL_BLOCK_value(sk, i) \
3919 ((OPENSSL_BLOCK)sk_value( \
David Benjaminada97992016-05-13 13:14:28 -04003920 CHECKED_CAST(const _STACK *, const STACK_OF(OPENSSL_BLOCK) *, sk), (i)))
Adam Langley95c29f32014-06-20 12:00:00 -07003921
3922#define sk_OPENSSL_BLOCK_set(sk, i, p) \
3923 ((OPENSSL_BLOCK)sk_set( \
3924 CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk), (i), \
3925 CHECKED_CAST(void *, OPENSSL_BLOCK, p)))
3926
3927#define sk_OPENSSL_BLOCK_free(sk) \
3928 sk_free(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk))
3929
3930#define sk_OPENSSL_BLOCK_pop_free(sk, free_func) \
3931 sk_pop_free( \
3932 CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk), \
3933 CHECKED_CAST(void (*)(void *), void (*)(OPENSSL_BLOCK), free_func))
3934
3935#define sk_OPENSSL_BLOCK_insert(sk, p, where) \
3936 sk_insert(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk), \
3937 CHECKED_CAST(void *, OPENSSL_BLOCK, p), (where))
3938
3939#define sk_OPENSSL_BLOCK_delete(sk, where) \
3940 ((OPENSSL_BLOCK)sk_delete( \
3941 CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk), (where)))
3942
3943#define sk_OPENSSL_BLOCK_delete_ptr(sk, p) \
3944 ((OPENSSL_BLOCK)sk_delete_ptr( \
3945 CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk), \
3946 CHECKED_CAST(void *, OPENSSL_BLOCK, p)))
3947
3948#define sk_OPENSSL_BLOCK_find(sk, out_index, p) \
3949 sk_find(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk), (out_index), \
3950 CHECKED_CAST(void *, OPENSSL_BLOCK, p))
3951
3952#define sk_OPENSSL_BLOCK_shift(sk) \
3953 ((OPENSSL_BLOCK)sk_shift( \
3954 CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk)))
3955
3956#define sk_OPENSSL_BLOCK_push(sk, p) \
3957 sk_push(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk), \
3958 CHECKED_CAST(void *, OPENSSL_BLOCK, p))
3959
3960#define sk_OPENSSL_BLOCK_pop(sk) \
3961 ((OPENSSL_BLOCK)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk)))
3962
3963#define sk_OPENSSL_BLOCK_dup(sk) \
3964 ((STACK_OF(OPENSSL_BLOCK) *)sk_dup( \
David Benjaminada97992016-05-13 13:14:28 -04003965 CHECKED_CAST(const _STACK *, const STACK_OF(OPENSSL_BLOCK) *, sk)))
Adam Langley95c29f32014-06-20 12:00:00 -07003966
3967#define sk_OPENSSL_BLOCK_sort(sk) \
3968 sk_sort(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk))
3969
3970#define sk_OPENSSL_BLOCK_is_sorted(sk) \
David Benjaminada97992016-05-13 13:14:28 -04003971 sk_is_sorted( \
3972 CHECKED_CAST(const _STACK *, const STACK_OF(OPENSSL_BLOCK) *, sk))
Adam Langley95c29f32014-06-20 12:00:00 -07003973
3974#define sk_OPENSSL_BLOCK_set_cmp_func(sk, comp) \
3975 ((int (*)(const OPENSSL_BLOCK **a, const OPENSSL_BLOCK **b))sk_set_cmp_func( \
3976 CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk), \
3977 CHECKED_CAST(stack_cmp_func, \
3978 int (*)(const OPENSSL_BLOCK **a, const OPENSSL_BLOCK **b), \
3979 comp)))
Adam Langleya1048a72015-02-11 14:27:21 -08003980
3981#define sk_OPENSSL_BLOCK_deep_copy(sk, copy_func, free_func) \
3982 ((STACK_OF(OPENSSL_BLOCK) *)sk_deep_copy( \
3983 CHECKED_CAST(const _STACK *, const STACK_OF(OPENSSL_BLOCK) *, sk), \
3984 CHECKED_CAST(void *(*)(void *), OPENSSL_BLOCK (*)(OPENSSL_BLOCK), \
3985 copy_func), \
3986 CHECKED_CAST(void (*)(void *), void (*)(OPENSSL_BLOCK), free_func)))