• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* 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) \
30   sk_num(CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk))
31 
32 #define sk_ACCESS_DESCRIPTION_zero(sk) \
33   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk));
34 
35 #define sk_ACCESS_DESCRIPTION_value(sk, i) \
36   ((ACCESS_DESCRIPTION *)sk_value(         \
37       CHECKED_CAST(_STACK *, const STACK_OF(ACCESS_DESCRIPTION) *, sk), (i)))
38 
39 #define sk_ACCESS_DESCRIPTION_set(sk, i, p)                            \
40   ((ACCESS_DESCRIPTION *)sk_set(                                       \
41       CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk), (i), \
42       CHECKED_CAST(void *, ACCESS_DESCRIPTION *, p)))
43 
44 #define sk_ACCESS_DESCRIPTION_free(sk) \
45   sk_free(CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk))
46 
47 #define sk_ACCESS_DESCRIPTION_pop_free(sk, free_func)                        \
48   sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk),    \
49               CHECKED_CAST(void (*)(void *), void (*)(ACCESS_DESCRIPTION *), \
50                            free_func))
51 
52 #define sk_ACCESS_DESCRIPTION_insert(sk, p, where)                      \
53   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk), \
54             CHECKED_CAST(void *, ACCESS_DESCRIPTION *, p), (where))
55 
56 #define sk_ACCESS_DESCRIPTION_delete(sk, where) \
57   ((ACCESS_DESCRIPTION *)sk_delete(             \
58       CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk), (where)))
59 
60 #define sk_ACCESS_DESCRIPTION_delete_ptr(sk, p)                   \
61   ((ACCESS_DESCRIPTION *)sk_delete_ptr(                           \
62       CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk), \
63       CHECKED_CAST(void *, ACCESS_DESCRIPTION *, p)))
64 
65 #define sk_ACCESS_DESCRIPTION_find(sk, out_index, p)                  \
66   sk_find(CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk), \
67           (out_index), CHECKED_CAST(void *, ACCESS_DESCRIPTION *, p))
68 
69 #define sk_ACCESS_DESCRIPTION_shift(sk) \
70   ((ACCESS_DESCRIPTION *)sk_shift(      \
71       CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk)))
72 
73 #define sk_ACCESS_DESCRIPTION_push(sk, p)                             \
74   sk_push(CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk), \
75           CHECKED_CAST(void *, ACCESS_DESCRIPTION *, p))
76 
77 #define sk_ACCESS_DESCRIPTION_pop(sk) \
78   ((ACCESS_DESCRIPTION *)sk_pop(      \
79       CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk)))
80 
81 #define sk_ACCESS_DESCRIPTION_dup(sk)      \
82   ((STACK_OF(ACCESS_DESCRIPTION) *)sk_dup( \
83       CHECKED_CAST(_STACK *, const STACK_OF(ACCESS_DESCRIPTION) *, sk)))
84 
85 #define sk_ACCESS_DESCRIPTION_sort(sk) \
86   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk))
87 
88 #define sk_ACCESS_DESCRIPTION_is_sorted(sk) \
89   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(ACCESS_DESCRIPTION) *, sk))
90 
91 #define sk_ACCESS_DESCRIPTION_set_cmp_func(sk, comp)                           \
92   ((int (*)(const ACCESS_DESCRIPTION **a, const ACCESS_DESCRIPTION **b))       \
93        sk_set_cmp_func(                                                        \
94            CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk),         \
95            CHECKED_CAST(stack_cmp_func, int (*)(const ACCESS_DESCRIPTION **a,  \
96                                                 const ACCESS_DESCRIPTION **b), \
97                         comp)))
98 
99 #define sk_ACCESS_DESCRIPTION_deep_copy(sk, copy_func, free_func)             \
100   ((STACK_OF(ACCESS_DESCRIPTION) *)sk_deep_copy(                              \
101       CHECKED_CAST(const _STACK *, const STACK_OF(ACCESS_DESCRIPTION) *, sk), \
102       CHECKED_CAST(void *(*)(void *),                                         \
103                    ACCESS_DESCRIPTION *(*)(ACCESS_DESCRIPTION *), copy_func), \
104       CHECKED_CAST(void (*)(void *), void (*)(ACCESS_DESCRIPTION *),          \
105                    free_func)))
106 
107 /* ASN1_ADB_TABLE */
108 #define sk_ASN1_ADB_TABLE_new(comp)                 \
109   ((STACK_OF(ASN1_ADB_TABLE) *)sk_new(CHECKED_CAST( \
110       stack_cmp_func,                               \
111       int (*)(const ASN1_ADB_TABLE **a, const ASN1_ADB_TABLE **b), comp)))
112 
113 #define sk_ASN1_ADB_TABLE_new_null() ((STACK_OF(ASN1_ADB_TABLE) *)sk_new_null())
114 
115 #define sk_ASN1_ADB_TABLE_num(sk) \
116   sk_num(CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk))
117 
118 #define sk_ASN1_ADB_TABLE_zero(sk) \
119   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk));
120 
121 #define sk_ASN1_ADB_TABLE_value(sk, i) \
122   ((ASN1_ADB_TABLE *)sk_value(         \
123       CHECKED_CAST(_STACK *, const STACK_OF(ASN1_ADB_TABLE) *, sk), (i)))
124 
125 #define sk_ASN1_ADB_TABLE_set(sk, i, p)                            \
126   ((ASN1_ADB_TABLE *)sk_set(                                       \
127       CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk), (i), \
128       CHECKED_CAST(void *, ASN1_ADB_TABLE *, p)))
129 
130 #define sk_ASN1_ADB_TABLE_free(sk) \
131   sk_free(CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk))
132 
133 #define sk_ASN1_ADB_TABLE_pop_free(sk, free_func)             \
134   sk_pop_free(                                                \
135       CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk), \
136       CHECKED_CAST(void (*)(void *), void (*)(ASN1_ADB_TABLE *), free_func))
137 
138 #define sk_ASN1_ADB_TABLE_insert(sk, p, where)                      \
139   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk), \
140             CHECKED_CAST(void *, ASN1_ADB_TABLE *, p), (where))
141 
142 #define sk_ASN1_ADB_TABLE_delete(sk, where) \
143   ((ASN1_ADB_TABLE *)sk_delete(             \
144       CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk), (where)))
145 
146 #define sk_ASN1_ADB_TABLE_delete_ptr(sk, p)                   \
147   ((ASN1_ADB_TABLE *)sk_delete_ptr(                           \
148       CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk), \
149       CHECKED_CAST(void *, ASN1_ADB_TABLE *, p)))
150 
151 #define sk_ASN1_ADB_TABLE_find(sk, out_index, p)                               \
152   sk_find(CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk), (out_index), \
153           CHECKED_CAST(void *, ASN1_ADB_TABLE *, p))
154 
155 #define sk_ASN1_ADB_TABLE_shift(sk) \
156   ((ASN1_ADB_TABLE *)sk_shift(      \
157       CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk)))
158 
159 #define sk_ASN1_ADB_TABLE_push(sk, p)                             \
160   sk_push(CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk), \
161           CHECKED_CAST(void *, ASN1_ADB_TABLE *, p))
162 
163 #define sk_ASN1_ADB_TABLE_pop(sk) \
164   ((ASN1_ADB_TABLE *)sk_pop(      \
165       CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk)))
166 
167 #define sk_ASN1_ADB_TABLE_dup(sk)      \
168   ((STACK_OF(ASN1_ADB_TABLE) *)sk_dup( \
169       CHECKED_CAST(_STACK *, const STACK_OF(ASN1_ADB_TABLE) *, sk)))
170 
171 #define sk_ASN1_ADB_TABLE_sort(sk) \
172   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk))
173 
174 #define sk_ASN1_ADB_TABLE_is_sorted(sk) \
175   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(ASN1_ADB_TABLE) *, sk))
176 
177 #define sk_ASN1_ADB_TABLE_set_cmp_func(sk, comp)                           \
178   ((int (*)(const ASN1_ADB_TABLE **a, const ASN1_ADB_TABLE **b))           \
179        sk_set_cmp_func(                                                    \
180            CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk),         \
181            CHECKED_CAST(stack_cmp_func, int (*)(const ASN1_ADB_TABLE **a,  \
182                                                 const ASN1_ADB_TABLE **b), \
183                         comp)))
184 
185 #define sk_ASN1_ADB_TABLE_deep_copy(sk, copy_func, free_func)                \
186   ((STACK_OF(ASN1_ADB_TABLE) *)sk_deep_copy(                                 \
187       CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_ADB_TABLE) *, sk),    \
188       CHECKED_CAST(void *(*)(void *), ASN1_ADB_TABLE *(*)(ASN1_ADB_TABLE *), \
189                    copy_func),                                               \
190       CHECKED_CAST(void (*)(void *), void (*)(ASN1_ADB_TABLE *), free_func)))
191 
192 /* ASN1_GENERALSTRING */
193 #define sk_ASN1_GENERALSTRING_new(comp)                                    \
194   ((STACK_OF(ASN1_GENERALSTRING) *)sk_new(CHECKED_CAST(                    \
195       stack_cmp_func,                                                      \
196       int (*)(const ASN1_GENERALSTRING **a, const ASN1_GENERALSTRING **b), \
197       comp)))
198 
199 #define sk_ASN1_GENERALSTRING_new_null() \
200   ((STACK_OF(ASN1_GENERALSTRING) *)sk_new_null())
201 
202 #define sk_ASN1_GENERALSTRING_num(sk) \
203   sk_num(CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk))
204 
205 #define sk_ASN1_GENERALSTRING_zero(sk) \
206   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk));
207 
208 #define sk_ASN1_GENERALSTRING_value(sk, i) \
209   ((ASN1_GENERALSTRING *)sk_value(         \
210       CHECKED_CAST(_STACK *, const STACK_OF(ASN1_GENERALSTRING) *, sk), (i)))
211 
212 #define sk_ASN1_GENERALSTRING_set(sk, i, p)                            \
213   ((ASN1_GENERALSTRING *)sk_set(                                       \
214       CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk), (i), \
215       CHECKED_CAST(void *, ASN1_GENERALSTRING *, p)))
216 
217 #define sk_ASN1_GENERALSTRING_free(sk) \
218   sk_free(CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk))
219 
220 #define sk_ASN1_GENERALSTRING_pop_free(sk, free_func)                        \
221   sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk),    \
222               CHECKED_CAST(void (*)(void *), void (*)(ASN1_GENERALSTRING *), \
223                            free_func))
224 
225 #define sk_ASN1_GENERALSTRING_insert(sk, p, where)                      \
226   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk), \
227             CHECKED_CAST(void *, ASN1_GENERALSTRING *, p), (where))
228 
229 #define sk_ASN1_GENERALSTRING_delete(sk, where) \
230   ((ASN1_GENERALSTRING *)sk_delete(             \
231       CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk), (where)))
232 
233 #define sk_ASN1_GENERALSTRING_delete_ptr(sk, p)                   \
234   ((ASN1_GENERALSTRING *)sk_delete_ptr(                           \
235       CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk), \
236       CHECKED_CAST(void *, ASN1_GENERALSTRING *, p)))
237 
238 #define sk_ASN1_GENERALSTRING_find(sk, out_index, p)                  \
239   sk_find(CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk), \
240           (out_index), CHECKED_CAST(void *, ASN1_GENERALSTRING *, p))
241 
242 #define sk_ASN1_GENERALSTRING_shift(sk) \
243   ((ASN1_GENERALSTRING *)sk_shift(      \
244       CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk)))
245 
246 #define sk_ASN1_GENERALSTRING_push(sk, p)                             \
247   sk_push(CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk), \
248           CHECKED_CAST(void *, ASN1_GENERALSTRING *, p))
249 
250 #define sk_ASN1_GENERALSTRING_pop(sk) \
251   ((ASN1_GENERALSTRING *)sk_pop(      \
252       CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk)))
253 
254 #define sk_ASN1_GENERALSTRING_dup(sk)      \
255   ((STACK_OF(ASN1_GENERALSTRING) *)sk_dup( \
256       CHECKED_CAST(_STACK *, const STACK_OF(ASN1_GENERALSTRING) *, sk)))
257 
258 #define sk_ASN1_GENERALSTRING_sort(sk) \
259   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk))
260 
261 #define sk_ASN1_GENERALSTRING_is_sorted(sk) \
262   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(ASN1_GENERALSTRING) *, sk))
263 
264 #define sk_ASN1_GENERALSTRING_set_cmp_func(sk, comp)                           \
265   ((int (*)(const ASN1_GENERALSTRING **a, const ASN1_GENERALSTRING **b))       \
266        sk_set_cmp_func(                                                        \
267            CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk),         \
268            CHECKED_CAST(stack_cmp_func, int (*)(const ASN1_GENERALSTRING **a,  \
269                                                 const ASN1_GENERALSTRING **b), \
270                         comp)))
271 
272 #define sk_ASN1_GENERALSTRING_deep_copy(sk, copy_func, free_func)             \
273   ((STACK_OF(ASN1_GENERALSTRING) *)sk_deep_copy(                              \
274       CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_GENERALSTRING) *, sk), \
275       CHECKED_CAST(void *(*)(void *),                                         \
276                    ASN1_GENERALSTRING *(*)(ASN1_GENERALSTRING *), copy_func), \
277       CHECKED_CAST(void (*)(void *), void (*)(ASN1_GENERALSTRING *),          \
278                    free_func)))
279 
280 /* ASN1_INTEGER */
281 #define sk_ASN1_INTEGER_new(comp)                                              \
282   ((STACK_OF(ASN1_INTEGER) *)sk_new(CHECKED_CAST(                              \
283       stack_cmp_func, int (*)(const ASN1_INTEGER **a, const ASN1_INTEGER **b), \
284       comp)))
285 
286 #define sk_ASN1_INTEGER_new_null() ((STACK_OF(ASN1_INTEGER) *)sk_new_null())
287 
288 #define sk_ASN1_INTEGER_num(sk) \
289   sk_num(CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk))
290 
291 #define sk_ASN1_INTEGER_zero(sk) \
292   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk));
293 
294 #define sk_ASN1_INTEGER_value(sk, i) \
295   ((ASN1_INTEGER *)sk_value(         \
296       CHECKED_CAST(_STACK *, const STACK_OF(ASN1_INTEGER) *, sk), (i)))
297 
298 #define sk_ASN1_INTEGER_set(sk, i, p)                            \
299   ((ASN1_INTEGER *)sk_set(                                       \
300       CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk), (i), \
301       CHECKED_CAST(void *, ASN1_INTEGER *, p)))
302 
303 #define sk_ASN1_INTEGER_free(sk) \
304   sk_free(CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk))
305 
306 #define sk_ASN1_INTEGER_pop_free(sk, free_func)             \
307   sk_pop_free(                                              \
308       CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk), \
309       CHECKED_CAST(void (*)(void *), void (*)(ASN1_INTEGER *), free_func))
310 
311 #define sk_ASN1_INTEGER_insert(sk, p, where)                      \
312   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk), \
313             CHECKED_CAST(void *, ASN1_INTEGER *, p), (where))
314 
315 #define sk_ASN1_INTEGER_delete(sk, where) \
316   ((ASN1_INTEGER *)sk_delete(             \
317       CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk), (where)))
318 
319 #define sk_ASN1_INTEGER_delete_ptr(sk, p)                   \
320   ((ASN1_INTEGER *)sk_delete_ptr(                           \
321       CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk), \
322       CHECKED_CAST(void *, ASN1_INTEGER *, p)))
323 
324 #define sk_ASN1_INTEGER_find(sk, out_index, p)                               \
325   sk_find(CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk), (out_index), \
326           CHECKED_CAST(void *, ASN1_INTEGER *, p))
327 
328 #define sk_ASN1_INTEGER_shift(sk) \
329   ((ASN1_INTEGER *)sk_shift(      \
330       CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk)))
331 
332 #define sk_ASN1_INTEGER_push(sk, p)                             \
333   sk_push(CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk), \
334           CHECKED_CAST(void *, ASN1_INTEGER *, p))
335 
336 #define sk_ASN1_INTEGER_pop(sk) \
337   ((ASN1_INTEGER *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk)))
338 
339 #define sk_ASN1_INTEGER_dup(sk)      \
340   ((STACK_OF(ASN1_INTEGER) *)sk_dup( \
341       CHECKED_CAST(_STACK *, const STACK_OF(ASN1_INTEGER) *, sk)))
342 
343 #define sk_ASN1_INTEGER_sort(sk) \
344   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk))
345 
346 #define sk_ASN1_INTEGER_is_sorted(sk) \
347   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(ASN1_INTEGER) *, sk))
348 
349 #define sk_ASN1_INTEGER_set_cmp_func(sk, comp)                               \
350   ((int (*)(const ASN1_INTEGER **a, const ASN1_INTEGER **b))sk_set_cmp_func( \
351       CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk),                  \
352       CHECKED_CAST(stack_cmp_func,                                           \
353                    int (*)(const ASN1_INTEGER **a, const ASN1_INTEGER **b),  \
354                    comp)))
355 
356 #define sk_ASN1_INTEGER_deep_copy(sk, copy_func, free_func)              \
357   ((STACK_OF(ASN1_INTEGER) *)sk_deep_copy(                               \
358       CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_INTEGER) *, sk),  \
359       CHECKED_CAST(void *(*)(void *), ASN1_INTEGER *(*)(ASN1_INTEGER *), \
360                    copy_func),                                           \
361       CHECKED_CAST(void (*)(void *), void (*)(ASN1_INTEGER *), free_func)))
362 
363 /* ASN1_OBJECT */
364 #define sk_ASN1_OBJECT_new(comp)                                             \
365   ((STACK_OF(ASN1_OBJECT) *)sk_new(CHECKED_CAST(                             \
366       stack_cmp_func, int (*)(const ASN1_OBJECT **a, const ASN1_OBJECT **b), \
367       comp)))
368 
369 #define sk_ASN1_OBJECT_new_null() ((STACK_OF(ASN1_OBJECT) *)sk_new_null())
370 
371 #define sk_ASN1_OBJECT_num(sk) \
372   sk_num(CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk))
373 
374 #define sk_ASN1_OBJECT_zero(sk) \
375   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk));
376 
377 #define sk_ASN1_OBJECT_value(sk, i) \
378   ((ASN1_OBJECT *)sk_value(         \
379       CHECKED_CAST(_STACK *, const STACK_OF(ASN1_OBJECT) *, sk), (i)))
380 
381 #define sk_ASN1_OBJECT_set(sk, i, p)                                          \
382   ((ASN1_OBJECT *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk), \
383                          (i), CHECKED_CAST(void *, ASN1_OBJECT *, p)))
384 
385 #define sk_ASN1_OBJECT_free(sk) \
386   sk_free(CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk))
387 
388 #define sk_ASN1_OBJECT_pop_free(sk, free_func)             \
389   sk_pop_free(                                             \
390       CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk), \
391       CHECKED_CAST(void (*)(void *), void (*)(ASN1_OBJECT *), free_func))
392 
393 #define sk_ASN1_OBJECT_insert(sk, p, where)                      \
394   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk), \
395             CHECKED_CAST(void *, ASN1_OBJECT *, p), (where))
396 
397 #define sk_ASN1_OBJECT_delete(sk, where) \
398   ((ASN1_OBJECT *)sk_delete(             \
399       CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk), (where)))
400 
401 #define sk_ASN1_OBJECT_delete_ptr(sk, p)                   \
402   ((ASN1_OBJECT *)sk_delete_ptr(                           \
403       CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk), \
404       CHECKED_CAST(void *, ASN1_OBJECT *, p)))
405 
406 #define sk_ASN1_OBJECT_find(sk, out_index, p)                               \
407   sk_find(CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk), (out_index), \
408           CHECKED_CAST(void *, ASN1_OBJECT *, p))
409 
410 #define sk_ASN1_OBJECT_shift(sk) \
411   ((ASN1_OBJECT *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk)))
412 
413 #define sk_ASN1_OBJECT_push(sk, p)                             \
414   sk_push(CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk), \
415           CHECKED_CAST(void *, ASN1_OBJECT *, p))
416 
417 #define sk_ASN1_OBJECT_pop(sk) \
418   ((ASN1_OBJECT *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk)))
419 
420 #define sk_ASN1_OBJECT_dup(sk)      \
421   ((STACK_OF(ASN1_OBJECT) *)sk_dup( \
422       CHECKED_CAST(_STACK *, const STACK_OF(ASN1_OBJECT) *, sk)))
423 
424 #define sk_ASN1_OBJECT_sort(sk) \
425   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk))
426 
427 #define sk_ASN1_OBJECT_is_sorted(sk) \
428   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(ASN1_OBJECT) *, sk))
429 
430 #define sk_ASN1_OBJECT_set_cmp_func(sk, comp)                              \
431   ((int (*)(const ASN1_OBJECT **a, const ASN1_OBJECT **b))sk_set_cmp_func( \
432       CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk),                 \
433       CHECKED_CAST(stack_cmp_func,                                         \
434                    int (*)(const ASN1_OBJECT **a, const ASN1_OBJECT **b),  \
435                    comp)))
436 
437 #define sk_ASN1_OBJECT_deep_copy(sk, copy_func, free_func)             \
438   ((STACK_OF(ASN1_OBJECT) *)sk_deep_copy(                              \
439       CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_OBJECT) *, sk), \
440       CHECKED_CAST(void *(*)(void *), ASN1_OBJECT *(*)(ASN1_OBJECT *), \
441                    copy_func),                                         \
442       CHECKED_CAST(void (*)(void *), void (*)(ASN1_OBJECT *), free_func)))
443 
444 /* ASN1_STRING_TABLE */
445 #define sk_ASN1_STRING_TABLE_new(comp)                                   \
446   ((STACK_OF(ASN1_STRING_TABLE) *)sk_new(CHECKED_CAST(                   \
447       stack_cmp_func,                                                    \
448       int (*)(const ASN1_STRING_TABLE **a, const ASN1_STRING_TABLE **b), \
449       comp)))
450 
451 #define sk_ASN1_STRING_TABLE_new_null() \
452   ((STACK_OF(ASN1_STRING_TABLE) *)sk_new_null())
453 
454 #define sk_ASN1_STRING_TABLE_num(sk) \
455   sk_num(CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk))
456 
457 #define sk_ASN1_STRING_TABLE_zero(sk) \
458   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk));
459 
460 #define sk_ASN1_STRING_TABLE_value(sk, i) \
461   ((ASN1_STRING_TABLE *)sk_value(         \
462       CHECKED_CAST(_STACK *, const STACK_OF(ASN1_STRING_TABLE) *, sk), (i)))
463 
464 #define sk_ASN1_STRING_TABLE_set(sk, i, p)                            \
465   ((ASN1_STRING_TABLE *)sk_set(                                       \
466       CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk), (i), \
467       CHECKED_CAST(void *, ASN1_STRING_TABLE *, p)))
468 
469 #define sk_ASN1_STRING_TABLE_free(sk) \
470   sk_free(CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk))
471 
472 #define sk_ASN1_STRING_TABLE_pop_free(sk, free_func)                        \
473   sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk),    \
474               CHECKED_CAST(void (*)(void *), void (*)(ASN1_STRING_TABLE *), \
475                            free_func))
476 
477 #define sk_ASN1_STRING_TABLE_insert(sk, p, where)                      \
478   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk), \
479             CHECKED_CAST(void *, ASN1_STRING_TABLE *, p), (where))
480 
481 #define sk_ASN1_STRING_TABLE_delete(sk, where) \
482   ((ASN1_STRING_TABLE *)sk_delete(             \
483       CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk), (where)))
484 
485 #define sk_ASN1_STRING_TABLE_delete_ptr(sk, p)                   \
486   ((ASN1_STRING_TABLE *)sk_delete_ptr(                           \
487       CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk), \
488       CHECKED_CAST(void *, ASN1_STRING_TABLE *, p)))
489 
490 #define sk_ASN1_STRING_TABLE_find(sk, out_index, p)                  \
491   sk_find(CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk), \
492           (out_index), CHECKED_CAST(void *, ASN1_STRING_TABLE *, p))
493 
494 #define sk_ASN1_STRING_TABLE_shift(sk) \
495   ((ASN1_STRING_TABLE *)sk_shift(      \
496       CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk)))
497 
498 #define sk_ASN1_STRING_TABLE_push(sk, p)                             \
499   sk_push(CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk), \
500           CHECKED_CAST(void *, ASN1_STRING_TABLE *, p))
501 
502 #define sk_ASN1_STRING_TABLE_pop(sk) \
503   ((ASN1_STRING_TABLE *)sk_pop(      \
504       CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk)))
505 
506 #define sk_ASN1_STRING_TABLE_dup(sk)      \
507   ((STACK_OF(ASN1_STRING_TABLE) *)sk_dup( \
508       CHECKED_CAST(_STACK *, const STACK_OF(ASN1_STRING_TABLE) *, sk)))
509 
510 #define sk_ASN1_STRING_TABLE_sort(sk) \
511   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk))
512 
513 #define sk_ASN1_STRING_TABLE_is_sorted(sk) \
514   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(ASN1_STRING_TABLE) *, sk))
515 
516 #define sk_ASN1_STRING_TABLE_set_cmp_func(sk, comp)                           \
517   ((int (*)(const ASN1_STRING_TABLE **a, const ASN1_STRING_TABLE **b))        \
518        sk_set_cmp_func(                                                       \
519            CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk),         \
520            CHECKED_CAST(stack_cmp_func, int (*)(const ASN1_STRING_TABLE **a,  \
521                                                 const ASN1_STRING_TABLE **b), \
522                         comp)))
523 
524 #define sk_ASN1_STRING_TABLE_deep_copy(sk, copy_func, free_func)             \
525   ((STACK_OF(ASN1_STRING_TABLE) *)sk_deep_copy(                              \
526       CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_STRING_TABLE) *, sk), \
527       CHECKED_CAST(void *(*)(void *),                                        \
528                    ASN1_STRING_TABLE *(*)(ASN1_STRING_TABLE *), copy_func),  \
529       CHECKED_CAST(void (*)(void *), void (*)(ASN1_STRING_TABLE *),          \
530                    free_func)))
531 
532 /* ASN1_TYPE */
533 #define sk_ASN1_TYPE_new(comp)     \
534   ((STACK_OF(ASN1_TYPE) *)sk_new(  \
535       CHECKED_CAST(stack_cmp_func, \
536                    int (*)(const ASN1_TYPE **a, const ASN1_TYPE **b), comp)))
537 
538 #define sk_ASN1_TYPE_new_null() ((STACK_OF(ASN1_TYPE) *)sk_new_null())
539 
540 #define sk_ASN1_TYPE_num(sk) \
541   sk_num(CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk))
542 
543 #define sk_ASN1_TYPE_zero(sk) \
544   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk));
545 
546 #define sk_ASN1_TYPE_value(sk, i) \
547   ((ASN1_TYPE *)sk_value(         \
548       CHECKED_CAST(_STACK *, const STACK_OF(ASN1_TYPE) *, sk), (i)))
549 
550 #define sk_ASN1_TYPE_set(sk, i, p)                                             \
551   ((ASN1_TYPE *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk), (i), \
552                        CHECKED_CAST(void *, ASN1_TYPE *, p)))
553 
554 #define sk_ASN1_TYPE_free(sk) \
555   sk_free(CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk))
556 
557 #define sk_ASN1_TYPE_pop_free(sk, free_func)             \
558   sk_pop_free(                                           \
559       CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk), \
560       CHECKED_CAST(void (*)(void *), void (*)(ASN1_TYPE *), free_func))
561 
562 #define sk_ASN1_TYPE_insert(sk, p, where)                      \
563   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk), \
564             CHECKED_CAST(void *, ASN1_TYPE *, p), (where))
565 
566 #define sk_ASN1_TYPE_delete(sk, where)                                       \
567   ((ASN1_TYPE *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk), \
568                           (where)))
569 
570 #define sk_ASN1_TYPE_delete_ptr(sk, p)                   \
571   ((ASN1_TYPE *)sk_delete_ptr(                           \
572       CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk), \
573       CHECKED_CAST(void *, ASN1_TYPE *, p)))
574 
575 #define sk_ASN1_TYPE_find(sk, out_index, p)                               \
576   sk_find(CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk), (out_index), \
577           CHECKED_CAST(void *, ASN1_TYPE *, p))
578 
579 #define sk_ASN1_TYPE_shift(sk) \
580   ((ASN1_TYPE *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk)))
581 
582 #define sk_ASN1_TYPE_push(sk, p)                             \
583   sk_push(CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk), \
584           CHECKED_CAST(void *, ASN1_TYPE *, p))
585 
586 #define sk_ASN1_TYPE_pop(sk) \
587   ((ASN1_TYPE *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk)))
588 
589 #define sk_ASN1_TYPE_dup(sk)      \
590   ((STACK_OF(ASN1_TYPE) *)sk_dup( \
591       CHECKED_CAST(_STACK *, const STACK_OF(ASN1_TYPE) *, sk)))
592 
593 #define sk_ASN1_TYPE_sort(sk) \
594   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk))
595 
596 #define sk_ASN1_TYPE_is_sorted(sk) \
597   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(ASN1_TYPE) *, sk))
598 
599 #define sk_ASN1_TYPE_set_cmp_func(sk, comp)                            \
600   ((int (*)(const ASN1_TYPE **a, const ASN1_TYPE **b))sk_set_cmp_func( \
601       CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk),               \
602       CHECKED_CAST(stack_cmp_func,                                     \
603                    int (*)(const ASN1_TYPE **a, const ASN1_TYPE **b), comp)))
604 
605 #define sk_ASN1_TYPE_deep_copy(sk, copy_func, free_func)                       \
606   ((STACK_OF(ASN1_TYPE) *)sk_deep_copy(                                        \
607       CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_TYPE) *, sk),           \
608       CHECKED_CAST(void *(*)(void *), ASN1_TYPE *(*)(ASN1_TYPE *), copy_func), \
609       CHECKED_CAST(void (*)(void *), void (*)(ASN1_TYPE *), free_func)))
610 
611 /* ASN1_VALUE */
612 #define sk_ASN1_VALUE_new(comp)                                            \
613   ((STACK_OF(ASN1_VALUE) *)sk_new(CHECKED_CAST(                            \
614       stack_cmp_func, int (*)(const ASN1_VALUE **a, const ASN1_VALUE **b), \
615       comp)))
616 
617 #define sk_ASN1_VALUE_new_null() ((STACK_OF(ASN1_VALUE) *)sk_new_null())
618 
619 #define sk_ASN1_VALUE_num(sk) \
620   sk_num(CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk))
621 
622 #define sk_ASN1_VALUE_zero(sk) \
623   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk));
624 
625 #define sk_ASN1_VALUE_value(sk, i) \
626   ((ASN1_VALUE *)sk_value(         \
627       CHECKED_CAST(_STACK *, const STACK_OF(ASN1_VALUE) *, sk), (i)))
628 
629 #define sk_ASN1_VALUE_set(sk, i, p)                                         \
630   ((ASN1_VALUE *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk), \
631                         (i), CHECKED_CAST(void *, ASN1_VALUE *, p)))
632 
633 #define sk_ASN1_VALUE_free(sk) \
634   sk_free(CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk))
635 
636 #define sk_ASN1_VALUE_pop_free(sk, free_func)             \
637   sk_pop_free(                                            \
638       CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk), \
639       CHECKED_CAST(void (*)(void *), void (*)(ASN1_VALUE *), free_func))
640 
641 #define sk_ASN1_VALUE_insert(sk, p, where)                      \
642   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk), \
643             CHECKED_CAST(void *, ASN1_VALUE *, p), (where))
644 
645 #define sk_ASN1_VALUE_delete(sk, where)                                        \
646   ((ASN1_VALUE *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk), \
647                            (where)))
648 
649 #define sk_ASN1_VALUE_delete_ptr(sk, p)                   \
650   ((ASN1_VALUE *)sk_delete_ptr(                           \
651       CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk), \
652       CHECKED_CAST(void *, ASN1_VALUE *, p)))
653 
654 #define sk_ASN1_VALUE_find(sk, out_index, p)                               \
655   sk_find(CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk), (out_index), \
656           CHECKED_CAST(void *, ASN1_VALUE *, p))
657 
658 #define sk_ASN1_VALUE_shift(sk) \
659   ((ASN1_VALUE *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk)))
660 
661 #define sk_ASN1_VALUE_push(sk, p)                             \
662   sk_push(CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk), \
663           CHECKED_CAST(void *, ASN1_VALUE *, p))
664 
665 #define sk_ASN1_VALUE_pop(sk) \
666   ((ASN1_VALUE *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk)))
667 
668 #define sk_ASN1_VALUE_dup(sk)      \
669   ((STACK_OF(ASN1_VALUE) *)sk_dup( \
670       CHECKED_CAST(_STACK *, const STACK_OF(ASN1_VALUE) *, sk)))
671 
672 #define sk_ASN1_VALUE_sort(sk) \
673   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk))
674 
675 #define sk_ASN1_VALUE_is_sorted(sk) \
676   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(ASN1_VALUE) *, sk))
677 
678 #define sk_ASN1_VALUE_set_cmp_func(sk, comp)                             \
679   ((int (*)(const ASN1_VALUE **a, const ASN1_VALUE **b))sk_set_cmp_func( \
680       CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk),                \
681       CHECKED_CAST(stack_cmp_func,                                       \
682                    int (*)(const ASN1_VALUE **a, const ASN1_VALUE **b),  \
683                    comp)))
684 
685 #define sk_ASN1_VALUE_deep_copy(sk, copy_func, free_func)             \
686   ((STACK_OF(ASN1_VALUE) *)sk_deep_copy(                              \
687       CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_VALUE) *, sk), \
688       CHECKED_CAST(void *(*)(void *), ASN1_VALUE *(*)(ASN1_VALUE *),  \
689                    copy_func),                                        \
690       CHECKED_CAST(void (*)(void *), void (*)(ASN1_VALUE *), free_func)))
691 
692 /* BIO */
693 #define sk_BIO_new(comp)                 \
694   ((STACK_OF(BIO) *)sk_new(CHECKED_CAST( \
695       stack_cmp_func, int (*)(const BIO **a, const BIO **b), comp)))
696 
697 #define sk_BIO_new_null() ((STACK_OF(BIO) *)sk_new_null())
698 
699 #define sk_BIO_num(sk) sk_num(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk))
700 
701 #define sk_BIO_zero(sk) sk_zero(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk));
702 
703 #define sk_BIO_value(sk, i) \
704   ((BIO *)sk_value(CHECKED_CAST(_STACK *, const STACK_OF(BIO) *, sk), (i)))
705 
706 #define sk_BIO_set(sk, i, p)                                       \
707   ((BIO *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk), (i), \
708                  CHECKED_CAST(void *, BIO *, p)))
709 
710 #define sk_BIO_free(sk) sk_free(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk))
711 
712 #define sk_BIO_pop_free(sk, free_func)                     \
713   sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk), \
714               CHECKED_CAST(void (*)(void *), void (*)(BIO *), free_func))
715 
716 #define sk_BIO_insert(sk, p, where)                      \
717   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk), \
718             CHECKED_CAST(void *, BIO *, p), (where))
719 
720 #define sk_BIO_delete(sk, where) \
721   ((BIO *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk), (where)))
722 
723 #define sk_BIO_delete_ptr(sk, p)                                     \
724   ((BIO *)sk_delete_ptr(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk), \
725                         CHECKED_CAST(void *, BIO *, p)))
726 
727 #define sk_BIO_find(sk, out_index, p)                               \
728   sk_find(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk), (out_index), \
729           CHECKED_CAST(void *, BIO *, p))
730 
731 #define sk_BIO_shift(sk) \
732   ((BIO *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk)))
733 
734 #define sk_BIO_push(sk, p)                             \
735   sk_push(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk), \
736           CHECKED_CAST(void *, BIO *, p))
737 
738 #define sk_BIO_pop(sk) \
739   ((BIO *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk)))
740 
741 #define sk_BIO_dup(sk) \
742   ((STACK_OF(BIO) *)sk_dup(CHECKED_CAST(_STACK *, const STACK_OF(BIO) *, sk)))
743 
744 #define sk_BIO_sort(sk) sk_sort(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk))
745 
746 #define sk_BIO_is_sorted(sk) \
747   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(BIO) *, sk))
748 
749 #define sk_BIO_set_cmp_func(sk, comp)                                     \
750   ((int (*)(const BIO **a, const BIO **b))sk_set_cmp_func(                \
751       CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk),                        \
752       CHECKED_CAST(stack_cmp_func, int (*)(const BIO **a, const BIO **b), \
753                    comp)))
754 
755 #define sk_BIO_deep_copy(sk, copy_func, free_func)                 \
756   ((STACK_OF(BIO) *)sk_deep_copy(                                  \
757       CHECKED_CAST(const _STACK *, const STACK_OF(BIO) *, sk),     \
758       CHECKED_CAST(void *(*)(void *), BIO *(*)(BIO *), copy_func), \
759       CHECKED_CAST(void (*)(void *), void (*)(BIO *), free_func)))
760 
761 /* BY_DIR_ENTRY */
762 #define sk_BY_DIR_ENTRY_new(comp)                                              \
763   ((STACK_OF(BY_DIR_ENTRY) *)sk_new(CHECKED_CAST(                              \
764       stack_cmp_func, int (*)(const BY_DIR_ENTRY **a, const BY_DIR_ENTRY **b), \
765       comp)))
766 
767 #define sk_BY_DIR_ENTRY_new_null() ((STACK_OF(BY_DIR_ENTRY) *)sk_new_null())
768 
769 #define sk_BY_DIR_ENTRY_num(sk) \
770   sk_num(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk))
771 
772 #define sk_BY_DIR_ENTRY_zero(sk) \
773   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk));
774 
775 #define sk_BY_DIR_ENTRY_value(sk, i) \
776   ((BY_DIR_ENTRY *)sk_value(         \
777       CHECKED_CAST(_STACK *, const STACK_OF(BY_DIR_ENTRY) *, sk), (i)))
778 
779 #define sk_BY_DIR_ENTRY_set(sk, i, p)                            \
780   ((BY_DIR_ENTRY *)sk_set(                                       \
781       CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk), (i), \
782       CHECKED_CAST(void *, BY_DIR_ENTRY *, p)))
783 
784 #define sk_BY_DIR_ENTRY_free(sk) \
785   sk_free(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk))
786 
787 #define sk_BY_DIR_ENTRY_pop_free(sk, free_func)             \
788   sk_pop_free(                                              \
789       CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk), \
790       CHECKED_CAST(void (*)(void *), void (*)(BY_DIR_ENTRY *), free_func))
791 
792 #define sk_BY_DIR_ENTRY_insert(sk, p, where)                      \
793   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk), \
794             CHECKED_CAST(void *, BY_DIR_ENTRY *, p), (where))
795 
796 #define sk_BY_DIR_ENTRY_delete(sk, where) \
797   ((BY_DIR_ENTRY *)sk_delete(             \
798       CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk), (where)))
799 
800 #define sk_BY_DIR_ENTRY_delete_ptr(sk, p)                   \
801   ((BY_DIR_ENTRY *)sk_delete_ptr(                           \
802       CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk), \
803       CHECKED_CAST(void *, BY_DIR_ENTRY *, p)))
804 
805 #define sk_BY_DIR_ENTRY_find(sk, out_index, p)                               \
806   sk_find(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk), (out_index), \
807           CHECKED_CAST(void *, BY_DIR_ENTRY *, p))
808 
809 #define sk_BY_DIR_ENTRY_shift(sk) \
810   ((BY_DIR_ENTRY *)sk_shift(      \
811       CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk)))
812 
813 #define sk_BY_DIR_ENTRY_push(sk, p)                             \
814   sk_push(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk), \
815           CHECKED_CAST(void *, BY_DIR_ENTRY *, p))
816 
817 #define sk_BY_DIR_ENTRY_pop(sk) \
818   ((BY_DIR_ENTRY *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk)))
819 
820 #define sk_BY_DIR_ENTRY_dup(sk)      \
821   ((STACK_OF(BY_DIR_ENTRY) *)sk_dup( \
822       CHECKED_CAST(_STACK *, const STACK_OF(BY_DIR_ENTRY) *, sk)))
823 
824 #define sk_BY_DIR_ENTRY_sort(sk) \
825   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk))
826 
827 #define sk_BY_DIR_ENTRY_is_sorted(sk) \
828   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(BY_DIR_ENTRY) *, sk))
829 
830 #define sk_BY_DIR_ENTRY_set_cmp_func(sk, comp)                               \
831   ((int (*)(const BY_DIR_ENTRY **a, const BY_DIR_ENTRY **b))sk_set_cmp_func( \
832       CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk),                  \
833       CHECKED_CAST(stack_cmp_func,                                           \
834                    int (*)(const BY_DIR_ENTRY **a, const BY_DIR_ENTRY **b),  \
835                    comp)))
836 
837 #define sk_BY_DIR_ENTRY_deep_copy(sk, copy_func, free_func)              \
838   ((STACK_OF(BY_DIR_ENTRY) *)sk_deep_copy(                               \
839       CHECKED_CAST(const _STACK *, const STACK_OF(BY_DIR_ENTRY) *, sk),  \
840       CHECKED_CAST(void *(*)(void *), BY_DIR_ENTRY *(*)(BY_DIR_ENTRY *), \
841                    copy_func),                                           \
842       CHECKED_CAST(void (*)(void *), void (*)(BY_DIR_ENTRY *), free_func)))
843 
844 /* BY_DIR_HASH */
845 #define sk_BY_DIR_HASH_new(comp)                                             \
846   ((STACK_OF(BY_DIR_HASH) *)sk_new(CHECKED_CAST(                             \
847       stack_cmp_func, int (*)(const BY_DIR_HASH **a, const BY_DIR_HASH **b), \
848       comp)))
849 
850 #define sk_BY_DIR_HASH_new_null() ((STACK_OF(BY_DIR_HASH) *)sk_new_null())
851 
852 #define sk_BY_DIR_HASH_num(sk) \
853   sk_num(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk))
854 
855 #define sk_BY_DIR_HASH_zero(sk) \
856   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk));
857 
858 #define sk_BY_DIR_HASH_value(sk, i) \
859   ((BY_DIR_HASH *)sk_value(         \
860       CHECKED_CAST(_STACK *, const STACK_OF(BY_DIR_HASH) *, sk), (i)))
861 
862 #define sk_BY_DIR_HASH_set(sk, i, p)                                          \
863   ((BY_DIR_HASH *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk), \
864                          (i), CHECKED_CAST(void *, BY_DIR_HASH *, p)))
865 
866 #define sk_BY_DIR_HASH_free(sk) \
867   sk_free(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk))
868 
869 #define sk_BY_DIR_HASH_pop_free(sk, free_func)             \
870   sk_pop_free(                                             \
871       CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk), \
872       CHECKED_CAST(void (*)(void *), void (*)(BY_DIR_HASH *), free_func))
873 
874 #define sk_BY_DIR_HASH_insert(sk, p, where)                      \
875   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk), \
876             CHECKED_CAST(void *, BY_DIR_HASH *, p), (where))
877 
878 #define sk_BY_DIR_HASH_delete(sk, where) \
879   ((BY_DIR_HASH *)sk_delete(             \
880       CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk), (where)))
881 
882 #define sk_BY_DIR_HASH_delete_ptr(sk, p)                   \
883   ((BY_DIR_HASH *)sk_delete_ptr(                           \
884       CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk), \
885       CHECKED_CAST(void *, BY_DIR_HASH *, p)))
886 
887 #define sk_BY_DIR_HASH_find(sk, out_index, p)                               \
888   sk_find(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk), (out_index), \
889           CHECKED_CAST(void *, BY_DIR_HASH *, p))
890 
891 #define sk_BY_DIR_HASH_shift(sk) \
892   ((BY_DIR_HASH *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk)))
893 
894 #define sk_BY_DIR_HASH_push(sk, p)                             \
895   sk_push(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk), \
896           CHECKED_CAST(void *, BY_DIR_HASH *, p))
897 
898 #define sk_BY_DIR_HASH_pop(sk) \
899   ((BY_DIR_HASH *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk)))
900 
901 #define sk_BY_DIR_HASH_dup(sk)      \
902   ((STACK_OF(BY_DIR_HASH) *)sk_dup( \
903       CHECKED_CAST(_STACK *, const STACK_OF(BY_DIR_HASH) *, sk)))
904 
905 #define sk_BY_DIR_HASH_sort(sk) \
906   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk))
907 
908 #define sk_BY_DIR_HASH_is_sorted(sk) \
909   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(BY_DIR_HASH) *, sk))
910 
911 #define sk_BY_DIR_HASH_set_cmp_func(sk, comp)                              \
912   ((int (*)(const BY_DIR_HASH **a, const BY_DIR_HASH **b))sk_set_cmp_func( \
913       CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk),                 \
914       CHECKED_CAST(stack_cmp_func,                                         \
915                    int (*)(const BY_DIR_HASH **a, const BY_DIR_HASH **b),  \
916                    comp)))
917 
918 #define sk_BY_DIR_HASH_deep_copy(sk, copy_func, free_func)             \
919   ((STACK_OF(BY_DIR_HASH) *)sk_deep_copy(                              \
920       CHECKED_CAST(const _STACK *, const STACK_OF(BY_DIR_HASH) *, sk), \
921       CHECKED_CAST(void *(*)(void *), BY_DIR_HASH *(*)(BY_DIR_HASH *), \
922                    copy_func),                                         \
923       CHECKED_CAST(void (*)(void *), void (*)(BY_DIR_HASH *), free_func)))
924 
925 /* CONF_VALUE */
926 #define sk_CONF_VALUE_new(comp)                                            \
927   ((STACK_OF(CONF_VALUE) *)sk_new(CHECKED_CAST(                            \
928       stack_cmp_func, int (*)(const CONF_VALUE **a, const CONF_VALUE **b), \
929       comp)))
930 
931 #define sk_CONF_VALUE_new_null() ((STACK_OF(CONF_VALUE) *)sk_new_null())
932 
933 #define sk_CONF_VALUE_num(sk) \
934   sk_num(CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk))
935 
936 #define sk_CONF_VALUE_zero(sk) \
937   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk));
938 
939 #define sk_CONF_VALUE_value(sk, i) \
940   ((CONF_VALUE *)sk_value(         \
941       CHECKED_CAST(_STACK *, const STACK_OF(CONF_VALUE) *, sk), (i)))
942 
943 #define sk_CONF_VALUE_set(sk, i, p)                                         \
944   ((CONF_VALUE *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk), \
945                         (i), CHECKED_CAST(void *, CONF_VALUE *, p)))
946 
947 #define sk_CONF_VALUE_free(sk) \
948   sk_free(CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk))
949 
950 #define sk_CONF_VALUE_pop_free(sk, free_func)             \
951   sk_pop_free(                                            \
952       CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk), \
953       CHECKED_CAST(void (*)(void *), void (*)(CONF_VALUE *), free_func))
954 
955 #define sk_CONF_VALUE_insert(sk, p, where)                      \
956   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk), \
957             CHECKED_CAST(void *, CONF_VALUE *, p), (where))
958 
959 #define sk_CONF_VALUE_delete(sk, where)                                        \
960   ((CONF_VALUE *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk), \
961                            (where)))
962 
963 #define sk_CONF_VALUE_delete_ptr(sk, p)                   \
964   ((CONF_VALUE *)sk_delete_ptr(                           \
965       CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk), \
966       CHECKED_CAST(void *, CONF_VALUE *, p)))
967 
968 #define sk_CONF_VALUE_find(sk, out_index, p)                               \
969   sk_find(CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk), (out_index), \
970           CHECKED_CAST(void *, CONF_VALUE *, p))
971 
972 #define sk_CONF_VALUE_shift(sk) \
973   ((CONF_VALUE *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk)))
974 
975 #define sk_CONF_VALUE_push(sk, p)                             \
976   sk_push(CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk), \
977           CHECKED_CAST(void *, CONF_VALUE *, p))
978 
979 #define sk_CONF_VALUE_pop(sk) \
980   ((CONF_VALUE *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk)))
981 
982 #define sk_CONF_VALUE_dup(sk)      \
983   ((STACK_OF(CONF_VALUE) *)sk_dup( \
984       CHECKED_CAST(_STACK *, const STACK_OF(CONF_VALUE) *, sk)))
985 
986 #define sk_CONF_VALUE_sort(sk) \
987   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk))
988 
989 #define sk_CONF_VALUE_is_sorted(sk) \
990   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(CONF_VALUE) *, sk))
991 
992 #define sk_CONF_VALUE_set_cmp_func(sk, comp)                             \
993   ((int (*)(const CONF_VALUE **a, const CONF_VALUE **b))sk_set_cmp_func( \
994       CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk),                \
995       CHECKED_CAST(stack_cmp_func,                                       \
996                    int (*)(const CONF_VALUE **a, const CONF_VALUE **b),  \
997                    comp)))
998 
999 #define sk_CONF_VALUE_deep_copy(sk, copy_func, free_func)             \
1000   ((STACK_OF(CONF_VALUE) *)sk_deep_copy(                              \
1001       CHECKED_CAST(const _STACK *, const STACK_OF(CONF_VALUE) *, sk), \
1002       CHECKED_CAST(void *(*)(void *), CONF_VALUE *(*)(CONF_VALUE *),  \
1003                    copy_func),                                        \
1004       CHECKED_CAST(void (*)(void *), void (*)(CONF_VALUE *), free_func)))
1005 
1006 /* CRYPTO_EX_DATA_FUNCS */
1007 #define sk_CRYPTO_EX_DATA_FUNCS_new(comp)                                      \
1008   ((STACK_OF(CRYPTO_EX_DATA_FUNCS) *)sk_new(CHECKED_CAST(                      \
1009       stack_cmp_func,                                                          \
1010       int (*)(const CRYPTO_EX_DATA_FUNCS **a, const CRYPTO_EX_DATA_FUNCS **b), \
1011       comp)))
1012 
1013 #define sk_CRYPTO_EX_DATA_FUNCS_new_null() \
1014   ((STACK_OF(CRYPTO_EX_DATA_FUNCS) *)sk_new_null())
1015 
1016 #define sk_CRYPTO_EX_DATA_FUNCS_num(sk) \
1017   sk_num(CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk))
1018 
1019 #define sk_CRYPTO_EX_DATA_FUNCS_zero(sk) \
1020   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk));
1021 
1022 #define sk_CRYPTO_EX_DATA_FUNCS_value(sk, i)                              \
1023   ((CRYPTO_EX_DATA_FUNCS *)sk_value(                                      \
1024       CHECKED_CAST(_STACK *, const STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk), \
1025       (i)))
1026 
1027 #define sk_CRYPTO_EX_DATA_FUNCS_set(sk, i, p)                            \
1028   ((CRYPTO_EX_DATA_FUNCS *)sk_set(                                       \
1029       CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk), (i), \
1030       CHECKED_CAST(void *, CRYPTO_EX_DATA_FUNCS *, p)))
1031 
1032 #define sk_CRYPTO_EX_DATA_FUNCS_free(sk) \
1033   sk_free(CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk))
1034 
1035 #define sk_CRYPTO_EX_DATA_FUNCS_pop_free(sk, free_func)                        \
1036   sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk),    \
1037               CHECKED_CAST(void (*)(void *), void (*)(CRYPTO_EX_DATA_FUNCS *), \
1038                            free_func))
1039 
1040 #define sk_CRYPTO_EX_DATA_FUNCS_insert(sk, p, where)                      \
1041   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk), \
1042             CHECKED_CAST(void *, CRYPTO_EX_DATA_FUNCS *, p), (where))
1043 
1044 #define sk_CRYPTO_EX_DATA_FUNCS_delete(sk, where) \
1045   ((CRYPTO_EX_DATA_FUNCS *)sk_delete(             \
1046       CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk), (where)))
1047 
1048 #define sk_CRYPTO_EX_DATA_FUNCS_delete_ptr(sk, p)                   \
1049   ((CRYPTO_EX_DATA_FUNCS *)sk_delete_ptr(                           \
1050       CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk), \
1051       CHECKED_CAST(void *, CRYPTO_EX_DATA_FUNCS *, p)))
1052 
1053 #define sk_CRYPTO_EX_DATA_FUNCS_find(sk, out_index, p)                  \
1054   sk_find(CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk), \
1055           (out_index), CHECKED_CAST(void *, CRYPTO_EX_DATA_FUNCS *, p))
1056 
1057 #define sk_CRYPTO_EX_DATA_FUNCS_shift(sk) \
1058   ((CRYPTO_EX_DATA_FUNCS *)sk_shift(      \
1059       CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk)))
1060 
1061 #define sk_CRYPTO_EX_DATA_FUNCS_push(sk, p)                             \
1062   sk_push(CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk), \
1063           CHECKED_CAST(void *, CRYPTO_EX_DATA_FUNCS *, p))
1064 
1065 #define sk_CRYPTO_EX_DATA_FUNCS_pop(sk) \
1066   ((CRYPTO_EX_DATA_FUNCS *)sk_pop(      \
1067       CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk)))
1068 
1069 #define sk_CRYPTO_EX_DATA_FUNCS_dup(sk)      \
1070   ((STACK_OF(CRYPTO_EX_DATA_FUNCS) *)sk_dup( \
1071       CHECKED_CAST(_STACK *, const STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk)))
1072 
1073 #define sk_CRYPTO_EX_DATA_FUNCS_sort(sk) \
1074   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk))
1075 
1076 #define sk_CRYPTO_EX_DATA_FUNCS_is_sorted(sk) \
1077   sk_is_sorted(                               \
1078       CHECKED_CAST(_STACK *, const STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk))
1079 
1080 #define sk_CRYPTO_EX_DATA_FUNCS_set_cmp_func(sk, comp)                       \
1081   ((int (*)(const CRYPTO_EX_DATA_FUNCS **a, const CRYPTO_EX_DATA_FUNCS **b)) \
1082        sk_set_cmp_func(                                                      \
1083            CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk),     \
1084            CHECKED_CAST(stack_cmp_func,                                      \
1085                         int (*)(const CRYPTO_EX_DATA_FUNCS **a,              \
1086                                 const CRYPTO_EX_DATA_FUNCS **b),             \
1087                         comp)))
1088 
1089 #define sk_CRYPTO_EX_DATA_FUNCS_deep_copy(sk, copy_func, free_func)        \
1090   ((STACK_OF(CRYPTO_EX_DATA_FUNCS) *)sk_deep_copy(                         \
1091       CHECKED_CAST(const _STACK *, const STACK_OF(CRYPTO_EX_DATA_FUNCS) *, \
1092                    sk),                                                    \
1093       CHECKED_CAST(void *(*)(void *),                                      \
1094                    CRYPTO_EX_DATA_FUNCS *(*)(CRYPTO_EX_DATA_FUNCS *),      \
1095                    copy_func),                                             \
1096       CHECKED_CAST(void (*)(void *), void (*)(CRYPTO_EX_DATA_FUNCS *),     \
1097                    free_func)))
1098 
1099 /* DIST_POINT */
1100 #define sk_DIST_POINT_new(comp)                                            \
1101   ((STACK_OF(DIST_POINT) *)sk_new(CHECKED_CAST(                            \
1102       stack_cmp_func, int (*)(const DIST_POINT **a, const DIST_POINT **b), \
1103       comp)))
1104 
1105 #define sk_DIST_POINT_new_null() ((STACK_OF(DIST_POINT) *)sk_new_null())
1106 
1107 #define sk_DIST_POINT_num(sk) \
1108   sk_num(CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk))
1109 
1110 #define sk_DIST_POINT_zero(sk) \
1111   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk));
1112 
1113 #define sk_DIST_POINT_value(sk, i) \
1114   ((DIST_POINT *)sk_value(         \
1115       CHECKED_CAST(_STACK *, const STACK_OF(DIST_POINT) *, sk), (i)))
1116 
1117 #define sk_DIST_POINT_set(sk, i, p)                                         \
1118   ((DIST_POINT *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk), \
1119                         (i), CHECKED_CAST(void *, DIST_POINT *, p)))
1120 
1121 #define sk_DIST_POINT_free(sk) \
1122   sk_free(CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk))
1123 
1124 #define sk_DIST_POINT_pop_free(sk, free_func)             \
1125   sk_pop_free(                                            \
1126       CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk), \
1127       CHECKED_CAST(void (*)(void *), void (*)(DIST_POINT *), free_func))
1128 
1129 #define sk_DIST_POINT_insert(sk, p, where)                      \
1130   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk), \
1131             CHECKED_CAST(void *, DIST_POINT *, p), (where))
1132 
1133 #define sk_DIST_POINT_delete(sk, where)                                        \
1134   ((DIST_POINT *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk), \
1135                            (where)))
1136 
1137 #define sk_DIST_POINT_delete_ptr(sk, p)                   \
1138   ((DIST_POINT *)sk_delete_ptr(                           \
1139       CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk), \
1140       CHECKED_CAST(void *, DIST_POINT *, p)))
1141 
1142 #define sk_DIST_POINT_find(sk, out_index, p)                               \
1143   sk_find(CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk), (out_index), \
1144           CHECKED_CAST(void *, DIST_POINT *, p))
1145 
1146 #define sk_DIST_POINT_shift(sk) \
1147   ((DIST_POINT *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk)))
1148 
1149 #define sk_DIST_POINT_push(sk, p)                             \
1150   sk_push(CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk), \
1151           CHECKED_CAST(void *, DIST_POINT *, p))
1152 
1153 #define sk_DIST_POINT_pop(sk) \
1154   ((DIST_POINT *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk)))
1155 
1156 #define sk_DIST_POINT_dup(sk)      \
1157   ((STACK_OF(DIST_POINT) *)sk_dup( \
1158       CHECKED_CAST(_STACK *, const STACK_OF(DIST_POINT) *, sk)))
1159 
1160 #define sk_DIST_POINT_sort(sk) \
1161   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk))
1162 
1163 #define sk_DIST_POINT_is_sorted(sk) \
1164   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(DIST_POINT) *, sk))
1165 
1166 #define sk_DIST_POINT_set_cmp_func(sk, comp)                             \
1167   ((int (*)(const DIST_POINT **a, const DIST_POINT **b))sk_set_cmp_func( \
1168       CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk),                \
1169       CHECKED_CAST(stack_cmp_func,                                       \
1170                    int (*)(const DIST_POINT **a, const DIST_POINT **b),  \
1171                    comp)))
1172 
1173 #define sk_DIST_POINT_deep_copy(sk, copy_func, free_func)             \
1174   ((STACK_OF(DIST_POINT) *)sk_deep_copy(                              \
1175       CHECKED_CAST(const _STACK *, const STACK_OF(DIST_POINT) *, sk), \
1176       CHECKED_CAST(void *(*)(void *), DIST_POINT *(*)(DIST_POINT *),  \
1177                    copy_func),                                        \
1178       CHECKED_CAST(void (*)(void *), void (*)(DIST_POINT *), free_func)))
1179 
1180 /* GENERAL_NAME */
1181 #define sk_GENERAL_NAME_new(comp)                                              \
1182   ((STACK_OF(GENERAL_NAME) *)sk_new(CHECKED_CAST(                              \
1183       stack_cmp_func, int (*)(const GENERAL_NAME **a, const GENERAL_NAME **b), \
1184       comp)))
1185 
1186 #define sk_GENERAL_NAME_new_null() ((STACK_OF(GENERAL_NAME) *)sk_new_null())
1187 
1188 #define sk_GENERAL_NAME_num(sk) \
1189   sk_num(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk))
1190 
1191 #define sk_GENERAL_NAME_zero(sk) \
1192   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk));
1193 
1194 #define sk_GENERAL_NAME_value(sk, i) \
1195   ((GENERAL_NAME *)sk_value(         \
1196       CHECKED_CAST(_STACK *, const STACK_OF(GENERAL_NAME) *, sk), (i)))
1197 
1198 #define sk_GENERAL_NAME_set(sk, i, p)                            \
1199   ((GENERAL_NAME *)sk_set(                                       \
1200       CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk), (i), \
1201       CHECKED_CAST(void *, GENERAL_NAME *, p)))
1202 
1203 #define sk_GENERAL_NAME_free(sk) \
1204   sk_free(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk))
1205 
1206 #define sk_GENERAL_NAME_pop_free(sk, free_func)             \
1207   sk_pop_free(                                              \
1208       CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk), \
1209       CHECKED_CAST(void (*)(void *), void (*)(GENERAL_NAME *), free_func))
1210 
1211 #define sk_GENERAL_NAME_insert(sk, p, where)                      \
1212   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk), \
1213             CHECKED_CAST(void *, GENERAL_NAME *, p), (where))
1214 
1215 #define sk_GENERAL_NAME_delete(sk, where) \
1216   ((GENERAL_NAME *)sk_delete(             \
1217       CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk), (where)))
1218 
1219 #define sk_GENERAL_NAME_delete_ptr(sk, p)                   \
1220   ((GENERAL_NAME *)sk_delete_ptr(                           \
1221       CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk), \
1222       CHECKED_CAST(void *, GENERAL_NAME *, p)))
1223 
1224 #define sk_GENERAL_NAME_find(sk, out_index, p)                               \
1225   sk_find(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk), (out_index), \
1226           CHECKED_CAST(void *, GENERAL_NAME *, p))
1227 
1228 #define sk_GENERAL_NAME_shift(sk) \
1229   ((GENERAL_NAME *)sk_shift(      \
1230       CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk)))
1231 
1232 #define sk_GENERAL_NAME_push(sk, p)                             \
1233   sk_push(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk), \
1234           CHECKED_CAST(void *, GENERAL_NAME *, p))
1235 
1236 #define sk_GENERAL_NAME_pop(sk) \
1237   ((GENERAL_NAME *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk)))
1238 
1239 #define sk_GENERAL_NAME_dup(sk)      \
1240   ((STACK_OF(GENERAL_NAME) *)sk_dup( \
1241       CHECKED_CAST(_STACK *, const STACK_OF(GENERAL_NAME) *, sk)))
1242 
1243 #define sk_GENERAL_NAME_sort(sk) \
1244   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk))
1245 
1246 #define sk_GENERAL_NAME_is_sorted(sk) \
1247   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(GENERAL_NAME) *, sk))
1248 
1249 #define sk_GENERAL_NAME_set_cmp_func(sk, comp)                               \
1250   ((int (*)(const GENERAL_NAME **a, const GENERAL_NAME **b))sk_set_cmp_func( \
1251       CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk),                  \
1252       CHECKED_CAST(stack_cmp_func,                                           \
1253                    int (*)(const GENERAL_NAME **a, const GENERAL_NAME **b),  \
1254                    comp)))
1255 
1256 #define sk_GENERAL_NAME_deep_copy(sk, copy_func, free_func)              \
1257   ((STACK_OF(GENERAL_NAME) *)sk_deep_copy(                               \
1258       CHECKED_CAST(const _STACK *, const STACK_OF(GENERAL_NAME) *, sk),  \
1259       CHECKED_CAST(void *(*)(void *), GENERAL_NAME *(*)(GENERAL_NAME *), \
1260                    copy_func),                                           \
1261       CHECKED_CAST(void (*)(void *), void (*)(GENERAL_NAME *), free_func)))
1262 
1263 /* GENERAL_NAMES */
1264 #define sk_GENERAL_NAMES_new(comp)                 \
1265   ((STACK_OF(GENERAL_NAMES) *)sk_new(CHECKED_CAST( \
1266       stack_cmp_func,                              \
1267       int (*)(const GENERAL_NAMES **a, const GENERAL_NAMES **b), comp)))
1268 
1269 #define sk_GENERAL_NAMES_new_null() ((STACK_OF(GENERAL_NAMES) *)sk_new_null())
1270 
1271 #define sk_GENERAL_NAMES_num(sk) \
1272   sk_num(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk))
1273 
1274 #define sk_GENERAL_NAMES_zero(sk) \
1275   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk));
1276 
1277 #define sk_GENERAL_NAMES_value(sk, i) \
1278   ((GENERAL_NAMES *)sk_value(         \
1279       CHECKED_CAST(_STACK *, const STACK_OF(GENERAL_NAMES) *, sk), (i)))
1280 
1281 #define sk_GENERAL_NAMES_set(sk, i, p)                            \
1282   ((GENERAL_NAMES *)sk_set(                                       \
1283       CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk), (i), \
1284       CHECKED_CAST(void *, GENERAL_NAMES *, p)))
1285 
1286 #define sk_GENERAL_NAMES_free(sk) \
1287   sk_free(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk))
1288 
1289 #define sk_GENERAL_NAMES_pop_free(sk, free_func)             \
1290   sk_pop_free(                                               \
1291       CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk), \
1292       CHECKED_CAST(void (*)(void *), void (*)(GENERAL_NAMES *), free_func))
1293 
1294 #define sk_GENERAL_NAMES_insert(sk, p, where)                      \
1295   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk), \
1296             CHECKED_CAST(void *, GENERAL_NAMES *, p), (where))
1297 
1298 #define sk_GENERAL_NAMES_delete(sk, where) \
1299   ((GENERAL_NAMES *)sk_delete(             \
1300       CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk), (where)))
1301 
1302 #define sk_GENERAL_NAMES_delete_ptr(sk, p)                   \
1303   ((GENERAL_NAMES *)sk_delete_ptr(                           \
1304       CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk), \
1305       CHECKED_CAST(void *, GENERAL_NAMES *, p)))
1306 
1307 #define sk_GENERAL_NAMES_find(sk, out_index, p)                               \
1308   sk_find(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk), (out_index), \
1309           CHECKED_CAST(void *, GENERAL_NAMES *, p))
1310 
1311 #define sk_GENERAL_NAMES_shift(sk) \
1312   ((GENERAL_NAMES *)sk_shift(      \
1313       CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk)))
1314 
1315 #define sk_GENERAL_NAMES_push(sk, p)                             \
1316   sk_push(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk), \
1317           CHECKED_CAST(void *, GENERAL_NAMES *, p))
1318 
1319 #define sk_GENERAL_NAMES_pop(sk) \
1320   ((GENERAL_NAMES *)sk_pop(      \
1321       CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk)))
1322 
1323 #define sk_GENERAL_NAMES_dup(sk)      \
1324   ((STACK_OF(GENERAL_NAMES) *)sk_dup( \
1325       CHECKED_CAST(_STACK *, const STACK_OF(GENERAL_NAMES) *, sk)))
1326 
1327 #define sk_GENERAL_NAMES_sort(sk) \
1328   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk))
1329 
1330 #define sk_GENERAL_NAMES_is_sorted(sk) \
1331   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(GENERAL_NAMES) *, sk))
1332 
1333 #define sk_GENERAL_NAMES_set_cmp_func(sk, comp)                                \
1334   ((int (*)(const GENERAL_NAMES **a, const GENERAL_NAMES **b))sk_set_cmp_func( \
1335       CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk),                   \
1336       CHECKED_CAST(stack_cmp_func,                                             \
1337                    int (*)(const GENERAL_NAMES **a, const GENERAL_NAMES **b),  \
1338                    comp)))
1339 
1340 #define sk_GENERAL_NAMES_deep_copy(sk, copy_func, free_func)               \
1341   ((STACK_OF(GENERAL_NAMES) *)sk_deep_copy(                                \
1342       CHECKED_CAST(const _STACK *, const STACK_OF(GENERAL_NAMES) *, sk),   \
1343       CHECKED_CAST(void *(*)(void *), GENERAL_NAMES *(*)(GENERAL_NAMES *), \
1344                    copy_func),                                             \
1345       CHECKED_CAST(void (*)(void *), void (*)(GENERAL_NAMES *), free_func)))
1346 
1347 /* GENERAL_SUBTREE */
1348 #define sk_GENERAL_SUBTREE_new(comp)                 \
1349   ((STACK_OF(GENERAL_SUBTREE) *)sk_new(CHECKED_CAST( \
1350       stack_cmp_func,                                \
1351       int (*)(const GENERAL_SUBTREE **a, const GENERAL_SUBTREE **b), comp)))
1352 
1353 #define sk_GENERAL_SUBTREE_new_null() \
1354   ((STACK_OF(GENERAL_SUBTREE) *)sk_new_null())
1355 
1356 #define sk_GENERAL_SUBTREE_num(sk) \
1357   sk_num(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk))
1358 
1359 #define sk_GENERAL_SUBTREE_zero(sk) \
1360   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk));
1361 
1362 #define sk_GENERAL_SUBTREE_value(sk, i) \
1363   ((GENERAL_SUBTREE *)sk_value(         \
1364       CHECKED_CAST(_STACK *, const STACK_OF(GENERAL_SUBTREE) *, sk), (i)))
1365 
1366 #define sk_GENERAL_SUBTREE_set(sk, i, p)                            \
1367   ((GENERAL_SUBTREE *)sk_set(                                       \
1368       CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk), (i), \
1369       CHECKED_CAST(void *, GENERAL_SUBTREE *, p)))
1370 
1371 #define sk_GENERAL_SUBTREE_free(sk) \
1372   sk_free(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk))
1373 
1374 #define sk_GENERAL_SUBTREE_pop_free(sk, free_func)             \
1375   sk_pop_free(                                                 \
1376       CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk), \
1377       CHECKED_CAST(void (*)(void *), void (*)(GENERAL_SUBTREE *), free_func))
1378 
1379 #define sk_GENERAL_SUBTREE_insert(sk, p, where)                      \
1380   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk), \
1381             CHECKED_CAST(void *, GENERAL_SUBTREE *, p), (where))
1382 
1383 #define sk_GENERAL_SUBTREE_delete(sk, where) \
1384   ((GENERAL_SUBTREE *)sk_delete(             \
1385       CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk), (where)))
1386 
1387 #define sk_GENERAL_SUBTREE_delete_ptr(sk, p)                   \
1388   ((GENERAL_SUBTREE *)sk_delete_ptr(                           \
1389       CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk), \
1390       CHECKED_CAST(void *, GENERAL_SUBTREE *, p)))
1391 
1392 #define sk_GENERAL_SUBTREE_find(sk, out_index, p)                  \
1393   sk_find(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk), \
1394           (out_index), CHECKED_CAST(void *, GENERAL_SUBTREE *, p))
1395 
1396 #define sk_GENERAL_SUBTREE_shift(sk) \
1397   ((GENERAL_SUBTREE *)sk_shift(      \
1398       CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk)))
1399 
1400 #define sk_GENERAL_SUBTREE_push(sk, p)                             \
1401   sk_push(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk), \
1402           CHECKED_CAST(void *, GENERAL_SUBTREE *, p))
1403 
1404 #define sk_GENERAL_SUBTREE_pop(sk) \
1405   ((GENERAL_SUBTREE *)sk_pop(      \
1406       CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk)))
1407 
1408 #define sk_GENERAL_SUBTREE_dup(sk)      \
1409   ((STACK_OF(GENERAL_SUBTREE) *)sk_dup( \
1410       CHECKED_CAST(_STACK *, const STACK_OF(GENERAL_SUBTREE) *, sk)))
1411 
1412 #define sk_GENERAL_SUBTREE_sort(sk) \
1413   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk))
1414 
1415 #define sk_GENERAL_SUBTREE_is_sorted(sk) \
1416   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(GENERAL_SUBTREE) *, sk))
1417 
1418 #define sk_GENERAL_SUBTREE_set_cmp_func(sk, comp)                           \
1419   ((int (*)(const GENERAL_SUBTREE **a, const GENERAL_SUBTREE **b))          \
1420        sk_set_cmp_func(                                                     \
1421            CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk),         \
1422            CHECKED_CAST(stack_cmp_func, int (*)(const GENERAL_SUBTREE **a,  \
1423                                                 const GENERAL_SUBTREE **b), \
1424                         comp)))
1425 
1426 #define sk_GENERAL_SUBTREE_deep_copy(sk, copy_func, free_func)                 \
1427   ((STACK_OF(GENERAL_SUBTREE) *)sk_deep_copy(                                  \
1428       CHECKED_CAST(const _STACK *, const STACK_OF(GENERAL_SUBTREE) *, sk),     \
1429       CHECKED_CAST(void *(*)(void *), GENERAL_SUBTREE *(*)(GENERAL_SUBTREE *), \
1430                    copy_func),                                                 \
1431       CHECKED_CAST(void (*)(void *), void (*)(GENERAL_SUBTREE *), free_func)))
1432 
1433 /* MIME_HEADER */
1434 #define sk_MIME_HEADER_new(comp)                                             \
1435   ((STACK_OF(MIME_HEADER) *)sk_new(CHECKED_CAST(                             \
1436       stack_cmp_func, int (*)(const MIME_HEADER **a, const MIME_HEADER **b), \
1437       comp)))
1438 
1439 #define sk_MIME_HEADER_new_null() ((STACK_OF(MIME_HEADER) *)sk_new_null())
1440 
1441 #define sk_MIME_HEADER_num(sk) \
1442   sk_num(CHECKED_CAST(_STACK *, STACK_OF(MIME_HEADER) *, sk))
1443 
1444 #define sk_MIME_HEADER_zero(sk) \
1445   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(MIME_HEADER) *, sk));
1446 
1447 #define sk_MIME_HEADER_value(sk, i) \
1448   ((MIME_HEADER *)sk_value(         \
1449       CHECKED_CAST(_STACK *, const STACK_OF(MIME_HEADER) *, sk), (i)))
1450 
1451 #define sk_MIME_HEADER_set(sk, i, p)                                          \
1452   ((MIME_HEADER *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(MIME_HEADER) *, sk), \
1453                          (i), CHECKED_CAST(void *, MIME_HEADER *, p)))
1454 
1455 #define sk_MIME_HEADER_free(sk) \
1456   sk_free(CHECKED_CAST(_STACK *, STACK_OF(MIME_HEADER) *, sk))
1457 
1458 #define sk_MIME_HEADER_pop_free(sk, free_func)             \
1459   sk_pop_free(                                             \
1460       CHECKED_CAST(_STACK *, STACK_OF(MIME_HEADER) *, sk), \
1461       CHECKED_CAST(void (*)(void *), void (*)(MIME_HEADER *), free_func))
1462 
1463 #define sk_MIME_HEADER_insert(sk, p, where)                      \
1464   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(MIME_HEADER) *, sk), \
1465             CHECKED_CAST(void *, MIME_HEADER *, p), (where))
1466 
1467 #define sk_MIME_HEADER_delete(sk, where) \
1468   ((MIME_HEADER *)sk_delete(             \
1469       CHECKED_CAST(_STACK *, STACK_OF(MIME_HEADER) *, sk), (where)))
1470 
1471 #define sk_MIME_HEADER_delete_ptr(sk, p)                   \
1472   ((MIME_HEADER *)sk_delete_ptr(                           \
1473       CHECKED_CAST(_STACK *, STACK_OF(MIME_HEADER) *, sk), \
1474       CHECKED_CAST(void *, MIME_HEADER *, p)))
1475 
1476 #define sk_MIME_HEADER_find(sk, out_index, p)                               \
1477   sk_find(CHECKED_CAST(_STACK *, STACK_OF(MIME_HEADER) *, sk), (out_index), \
1478           CHECKED_CAST(void *, MIME_HEADER *, p))
1479 
1480 #define sk_MIME_HEADER_shift(sk) \
1481   ((MIME_HEADER *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(MIME_HEADER) *, sk)))
1482 
1483 #define sk_MIME_HEADER_push(sk, p)                             \
1484   sk_push(CHECKED_CAST(_STACK *, STACK_OF(MIME_HEADER) *, sk), \
1485           CHECKED_CAST(void *, MIME_HEADER *, p))
1486 
1487 #define sk_MIME_HEADER_pop(sk) \
1488   ((MIME_HEADER *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(MIME_HEADER) *, sk)))
1489 
1490 #define sk_MIME_HEADER_dup(sk)      \
1491   ((STACK_OF(MIME_HEADER) *)sk_dup( \
1492       CHECKED_CAST(_STACK *, const STACK_OF(MIME_HEADER) *, sk)))
1493 
1494 #define sk_MIME_HEADER_sort(sk) \
1495   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(MIME_HEADER) *, sk))
1496 
1497 #define sk_MIME_HEADER_is_sorted(sk) \
1498   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(MIME_HEADER) *, sk))
1499 
1500 #define sk_MIME_HEADER_set_cmp_func(sk, comp)                              \
1501   ((int (*)(const MIME_HEADER **a, const MIME_HEADER **b))sk_set_cmp_func( \
1502       CHECKED_CAST(_STACK *, STACK_OF(MIME_HEADER) *, sk),                 \
1503       CHECKED_CAST(stack_cmp_func,                                         \
1504                    int (*)(const MIME_HEADER **a, const MIME_HEADER **b),  \
1505                    comp)))
1506 
1507 #define sk_MIME_HEADER_deep_copy(sk, copy_func, free_func)             \
1508   ((STACK_OF(MIME_HEADER) *)sk_deep_copy(                              \
1509       CHECKED_CAST(const _STACK *, const STACK_OF(MIME_HEADER) *, sk), \
1510       CHECKED_CAST(void *(*)(void *), MIME_HEADER *(*)(MIME_HEADER *), \
1511                    copy_func),                                         \
1512       CHECKED_CAST(void (*)(void *), void (*)(MIME_HEADER *), free_func)))
1513 
1514 /* PKCS7_SIGNER_INFO */
1515 #define sk_PKCS7_SIGNER_INFO_new(comp)                                   \
1516   ((STACK_OF(PKCS7_SIGNER_INFO) *)sk_new(CHECKED_CAST(                   \
1517       stack_cmp_func,                                                    \
1518       int (*)(const PKCS7_SIGNER_INFO **a, const PKCS7_SIGNER_INFO **b), \
1519       comp)))
1520 
1521 #define sk_PKCS7_SIGNER_INFO_new_null() \
1522   ((STACK_OF(PKCS7_SIGNER_INFO) *)sk_new_null())
1523 
1524 #define sk_PKCS7_SIGNER_INFO_num(sk) \
1525   sk_num(CHECKED_CAST(_STACK *, STACK_OF(PKCS7_SIGNER_INFO) *, sk))
1526 
1527 #define sk_PKCS7_SIGNER_INFO_zero(sk) \
1528   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(PKCS7_SIGNER_INFO) *, sk));
1529 
1530 #define sk_PKCS7_SIGNER_INFO_value(sk, i) \
1531   ((PKCS7_SIGNER_INFO *)sk_value(         \
1532       CHECKED_CAST(_STACK *, const STACK_OF(PKCS7_SIGNER_INFO) *, sk), (i)))
1533 
1534 #define sk_PKCS7_SIGNER_INFO_set(sk, i, p)                            \
1535   ((PKCS7_SIGNER_INFO *)sk_set(                                       \
1536       CHECKED_CAST(_STACK *, STACK_OF(PKCS7_SIGNER_INFO) *, sk), (i), \
1537       CHECKED_CAST(void *, PKCS7_SIGNER_INFO *, p)))
1538 
1539 #define sk_PKCS7_SIGNER_INFO_free(sk) \
1540   sk_free(CHECKED_CAST(_STACK *, STACK_OF(PKCS7_SIGNER_INFO) *, sk))
1541 
1542 #define sk_PKCS7_SIGNER_INFO_pop_free(sk, free_func)                        \
1543   sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(PKCS7_SIGNER_INFO) *, sk),    \
1544               CHECKED_CAST(void (*)(void *), void (*)(PKCS7_SIGNER_INFO *), \
1545                            free_func))
1546 
1547 #define sk_PKCS7_SIGNER_INFO_insert(sk, p, where)                      \
1548   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(PKCS7_SIGNER_INFO) *, sk), \
1549             CHECKED_CAST(void *, PKCS7_SIGNER_INFO *, p), (where))
1550 
1551 #define sk_PKCS7_SIGNER_INFO_delete(sk, where) \
1552   ((PKCS7_SIGNER_INFO *)sk_delete(             \
1553       CHECKED_CAST(_STACK *, STACK_OF(PKCS7_SIGNER_INFO) *, sk), (where)))
1554 
1555 #define sk_PKCS7_SIGNER_INFO_delete_ptr(sk, p)                   \
1556   ((PKCS7_SIGNER_INFO *)sk_delete_ptr(                           \
1557       CHECKED_CAST(_STACK *, STACK_OF(PKCS7_SIGNER_INFO) *, sk), \
1558       CHECKED_CAST(void *, PKCS7_SIGNER_INFO *, p)))
1559 
1560 #define sk_PKCS7_SIGNER_INFO_find(sk, out_index, p)                  \
1561   sk_find(CHECKED_CAST(_STACK *, STACK_OF(PKCS7_SIGNER_INFO) *, sk), \
1562           (out_index), CHECKED_CAST(void *, PKCS7_SIGNER_INFO *, p))
1563 
1564 #define sk_PKCS7_SIGNER_INFO_shift(sk) \
1565   ((PKCS7_SIGNER_INFO *)sk_shift(      \
1566       CHECKED_CAST(_STACK *, STACK_OF(PKCS7_SIGNER_INFO) *, sk)))
1567 
1568 #define sk_PKCS7_SIGNER_INFO_push(sk, p)                             \
1569   sk_push(CHECKED_CAST(_STACK *, STACK_OF(PKCS7_SIGNER_INFO) *, sk), \
1570           CHECKED_CAST(void *, PKCS7_SIGNER_INFO *, p))
1571 
1572 #define sk_PKCS7_SIGNER_INFO_pop(sk) \
1573   ((PKCS7_SIGNER_INFO *)sk_pop(      \
1574       CHECKED_CAST(_STACK *, STACK_OF(PKCS7_SIGNER_INFO) *, sk)))
1575 
1576 #define sk_PKCS7_SIGNER_INFO_dup(sk)      \
1577   ((STACK_OF(PKCS7_SIGNER_INFO) *)sk_dup( \
1578       CHECKED_CAST(_STACK *, const STACK_OF(PKCS7_SIGNER_INFO) *, sk)))
1579 
1580 #define sk_PKCS7_SIGNER_INFO_sort(sk) \
1581   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(PKCS7_SIGNER_INFO) *, sk))
1582 
1583 #define sk_PKCS7_SIGNER_INFO_is_sorted(sk) \
1584   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(PKCS7_SIGNER_INFO) *, sk))
1585 
1586 #define sk_PKCS7_SIGNER_INFO_set_cmp_func(sk, comp)                           \
1587   ((int (*)(const PKCS7_SIGNER_INFO **a, const PKCS7_SIGNER_INFO **b))        \
1588        sk_set_cmp_func(                                                       \
1589            CHECKED_CAST(_STACK *, STACK_OF(PKCS7_SIGNER_INFO) *, sk),         \
1590            CHECKED_CAST(stack_cmp_func, int (*)(const PKCS7_SIGNER_INFO **a,  \
1591                                                 const PKCS7_SIGNER_INFO **b), \
1592                         comp)))
1593 
1594 #define sk_PKCS7_SIGNER_INFO_deep_copy(sk, copy_func, free_func)             \
1595   ((STACK_OF(PKCS7_SIGNER_INFO) *)sk_deep_copy(                              \
1596       CHECKED_CAST(const _STACK *, const STACK_OF(PKCS7_SIGNER_INFO) *, sk), \
1597       CHECKED_CAST(void *(*)(void *),                                        \
1598                    PKCS7_SIGNER_INFO *(*)(PKCS7_SIGNER_INFO *), copy_func),  \
1599       CHECKED_CAST(void (*)(void *), void (*)(PKCS7_SIGNER_INFO *),          \
1600                    free_func)))
1601 
1602 /* PKCS7_RECIP_INFO */
1603 #define sk_PKCS7_RECIP_INFO_new(comp)                 \
1604   ((STACK_OF(PKCS7_RECIP_INFO) *)sk_new(CHECKED_CAST( \
1605       stack_cmp_func,                                 \
1606       int (*)(const PKCS7_RECIP_INFO **a, const PKCS7_RECIP_INFO **b), comp)))
1607 
1608 #define sk_PKCS7_RECIP_INFO_new_null() \
1609   ((STACK_OF(PKCS7_RECIP_INFO) *)sk_new_null())
1610 
1611 #define sk_PKCS7_RECIP_INFO_num(sk) \
1612   sk_num(CHECKED_CAST(_STACK *, STACK_OF(PKCS7_RECIP_INFO) *, sk))
1613 
1614 #define sk_PKCS7_RECIP_INFO_zero(sk) \
1615   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(PKCS7_RECIP_INFO) *, sk));
1616 
1617 #define sk_PKCS7_RECIP_INFO_value(sk, i) \
1618   ((PKCS7_RECIP_INFO *)sk_value(         \
1619       CHECKED_CAST(_STACK *, const STACK_OF(PKCS7_RECIP_INFO) *, sk), (i)))
1620 
1621 #define sk_PKCS7_RECIP_INFO_set(sk, i, p)                            \
1622   ((PKCS7_RECIP_INFO *)sk_set(                                       \
1623       CHECKED_CAST(_STACK *, STACK_OF(PKCS7_RECIP_INFO) *, sk), (i), \
1624       CHECKED_CAST(void *, PKCS7_RECIP_INFO *, p)))
1625 
1626 #define sk_PKCS7_RECIP_INFO_free(sk) \
1627   sk_free(CHECKED_CAST(_STACK *, STACK_OF(PKCS7_RECIP_INFO) *, sk))
1628 
1629 #define sk_PKCS7_RECIP_INFO_pop_free(sk, free_func)             \
1630   sk_pop_free(                                                  \
1631       CHECKED_CAST(_STACK *, STACK_OF(PKCS7_RECIP_INFO) *, sk), \
1632       CHECKED_CAST(void (*)(void *), void (*)(PKCS7_RECIP_INFO *), free_func))
1633 
1634 #define sk_PKCS7_RECIP_INFO_insert(sk, p, where)                      \
1635   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(PKCS7_RECIP_INFO) *, sk), \
1636             CHECKED_CAST(void *, PKCS7_RECIP_INFO *, p), (where))
1637 
1638 #define sk_PKCS7_RECIP_INFO_delete(sk, where) \
1639   ((PKCS7_RECIP_INFO *)sk_delete(             \
1640       CHECKED_CAST(_STACK *, STACK_OF(PKCS7_RECIP_INFO) *, sk), (where)))
1641 
1642 #define sk_PKCS7_RECIP_INFO_delete_ptr(sk, p)                   \
1643   ((PKCS7_RECIP_INFO *)sk_delete_ptr(                           \
1644       CHECKED_CAST(_STACK *, STACK_OF(PKCS7_RECIP_INFO) *, sk), \
1645       CHECKED_CAST(void *, PKCS7_RECIP_INFO *, p)))
1646 
1647 #define sk_PKCS7_RECIP_INFO_find(sk, out_index, p)                  \
1648   sk_find(CHECKED_CAST(_STACK *, STACK_OF(PKCS7_RECIP_INFO) *, sk), \
1649           (out_index), CHECKED_CAST(void *, PKCS7_RECIP_INFO *, p))
1650 
1651 #define sk_PKCS7_RECIP_INFO_shift(sk) \
1652   ((PKCS7_RECIP_INFO *)sk_shift(      \
1653       CHECKED_CAST(_STACK *, STACK_OF(PKCS7_RECIP_INFO) *, sk)))
1654 
1655 #define sk_PKCS7_RECIP_INFO_push(sk, p)                             \
1656   sk_push(CHECKED_CAST(_STACK *, STACK_OF(PKCS7_RECIP_INFO) *, sk), \
1657           CHECKED_CAST(void *, PKCS7_RECIP_INFO *, p))
1658 
1659 #define sk_PKCS7_RECIP_INFO_pop(sk) \
1660   ((PKCS7_RECIP_INFO *)sk_pop(      \
1661       CHECKED_CAST(_STACK *, STACK_OF(PKCS7_RECIP_INFO) *, sk)))
1662 
1663 #define sk_PKCS7_RECIP_INFO_dup(sk)      \
1664   ((STACK_OF(PKCS7_RECIP_INFO) *)sk_dup( \
1665       CHECKED_CAST(_STACK *, const STACK_OF(PKCS7_RECIP_INFO) *, sk)))
1666 
1667 #define sk_PKCS7_RECIP_INFO_sort(sk) \
1668   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(PKCS7_RECIP_INFO) *, sk))
1669 
1670 #define sk_PKCS7_RECIP_INFO_is_sorted(sk) \
1671   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(PKCS7_RECIP_INFO) *, sk))
1672 
1673 #define sk_PKCS7_RECIP_INFO_set_cmp_func(sk, comp)                           \
1674   ((int (*)(const PKCS7_RECIP_INFO **a, const PKCS7_RECIP_INFO **b))         \
1675        sk_set_cmp_func(                                                      \
1676            CHECKED_CAST(_STACK *, STACK_OF(PKCS7_RECIP_INFO) *, sk),         \
1677            CHECKED_CAST(stack_cmp_func, int (*)(const PKCS7_RECIP_INFO **a,  \
1678                                                 const PKCS7_RECIP_INFO **b), \
1679                         comp)))
1680 
1681 #define sk_PKCS7_RECIP_INFO_deep_copy(sk, copy_func, free_func)             \
1682   ((STACK_OF(PKCS7_RECIP_INFO) *)sk_deep_copy(                              \
1683       CHECKED_CAST(const _STACK *, const STACK_OF(PKCS7_RECIP_INFO) *, sk), \
1684       CHECKED_CAST(void *(*)(void *),                                       \
1685                    PKCS7_RECIP_INFO *(*)(PKCS7_RECIP_INFO *), copy_func),   \
1686       CHECKED_CAST(void (*)(void *), void (*)(PKCS7_RECIP_INFO *),          \
1687                    free_func)))
1688 
1689 /* POLICYINFO */
1690 #define sk_POLICYINFO_new(comp)                                            \
1691   ((STACK_OF(POLICYINFO) *)sk_new(CHECKED_CAST(                            \
1692       stack_cmp_func, int (*)(const POLICYINFO **a, const POLICYINFO **b), \
1693       comp)))
1694 
1695 #define sk_POLICYINFO_new_null() ((STACK_OF(POLICYINFO) *)sk_new_null())
1696 
1697 #define sk_POLICYINFO_num(sk) \
1698   sk_num(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk))
1699 
1700 #define sk_POLICYINFO_zero(sk) \
1701   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk));
1702 
1703 #define sk_POLICYINFO_value(sk, i) \
1704   ((POLICYINFO *)sk_value(         \
1705       CHECKED_CAST(_STACK *, const STACK_OF(POLICYINFO) *, sk), (i)))
1706 
1707 #define sk_POLICYINFO_set(sk, i, p)                                         \
1708   ((POLICYINFO *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk), \
1709                         (i), CHECKED_CAST(void *, POLICYINFO *, p)))
1710 
1711 #define sk_POLICYINFO_free(sk) \
1712   sk_free(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk))
1713 
1714 #define sk_POLICYINFO_pop_free(sk, free_func)             \
1715   sk_pop_free(                                            \
1716       CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk), \
1717       CHECKED_CAST(void (*)(void *), void (*)(POLICYINFO *), free_func))
1718 
1719 #define sk_POLICYINFO_insert(sk, p, where)                      \
1720   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk), \
1721             CHECKED_CAST(void *, POLICYINFO *, p), (where))
1722 
1723 #define sk_POLICYINFO_delete(sk, where)                                        \
1724   ((POLICYINFO *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk), \
1725                            (where)))
1726 
1727 #define sk_POLICYINFO_delete_ptr(sk, p)                   \
1728   ((POLICYINFO *)sk_delete_ptr(                           \
1729       CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk), \
1730       CHECKED_CAST(void *, POLICYINFO *, p)))
1731 
1732 #define sk_POLICYINFO_find(sk, out_index, p)                               \
1733   sk_find(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk), (out_index), \
1734           CHECKED_CAST(void *, POLICYINFO *, p))
1735 
1736 #define sk_POLICYINFO_shift(sk) \
1737   ((POLICYINFO *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk)))
1738 
1739 #define sk_POLICYINFO_push(sk, p)                             \
1740   sk_push(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk), \
1741           CHECKED_CAST(void *, POLICYINFO *, p))
1742 
1743 #define sk_POLICYINFO_pop(sk) \
1744   ((POLICYINFO *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk)))
1745 
1746 #define sk_POLICYINFO_dup(sk)      \
1747   ((STACK_OF(POLICYINFO) *)sk_dup( \
1748       CHECKED_CAST(_STACK *, const STACK_OF(POLICYINFO) *, sk)))
1749 
1750 #define sk_POLICYINFO_sort(sk) \
1751   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk))
1752 
1753 #define sk_POLICYINFO_is_sorted(sk) \
1754   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(POLICYINFO) *, sk))
1755 
1756 #define sk_POLICYINFO_set_cmp_func(sk, comp)                             \
1757   ((int (*)(const POLICYINFO **a, const POLICYINFO **b))sk_set_cmp_func( \
1758       CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk),                \
1759       CHECKED_CAST(stack_cmp_func,                                       \
1760                    int (*)(const POLICYINFO **a, const POLICYINFO **b),  \
1761                    comp)))
1762 
1763 #define sk_POLICYINFO_deep_copy(sk, copy_func, free_func)             \
1764   ((STACK_OF(POLICYINFO) *)sk_deep_copy(                              \
1765       CHECKED_CAST(const _STACK *, const STACK_OF(POLICYINFO) *, sk), \
1766       CHECKED_CAST(void *(*)(void *), POLICYINFO *(*)(POLICYINFO *),  \
1767                    copy_func),                                        \
1768       CHECKED_CAST(void (*)(void *), void (*)(POLICYINFO *), free_func)))
1769 
1770 /* POLICYQUALINFO */
1771 #define sk_POLICYQUALINFO_new(comp)                 \
1772   ((STACK_OF(POLICYQUALINFO) *)sk_new(CHECKED_CAST( \
1773       stack_cmp_func,                               \
1774       int (*)(const POLICYQUALINFO **a, const POLICYQUALINFO **b), comp)))
1775 
1776 #define sk_POLICYQUALINFO_new_null() ((STACK_OF(POLICYQUALINFO) *)sk_new_null())
1777 
1778 #define sk_POLICYQUALINFO_num(sk) \
1779   sk_num(CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk))
1780 
1781 #define sk_POLICYQUALINFO_zero(sk) \
1782   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk));
1783 
1784 #define sk_POLICYQUALINFO_value(sk, i) \
1785   ((POLICYQUALINFO *)sk_value(         \
1786       CHECKED_CAST(_STACK *, const STACK_OF(POLICYQUALINFO) *, sk), (i)))
1787 
1788 #define sk_POLICYQUALINFO_set(sk, i, p)                            \
1789   ((POLICYQUALINFO *)sk_set(                                       \
1790       CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk), (i), \
1791       CHECKED_CAST(void *, POLICYQUALINFO *, p)))
1792 
1793 #define sk_POLICYQUALINFO_free(sk) \
1794   sk_free(CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk))
1795 
1796 #define sk_POLICYQUALINFO_pop_free(sk, free_func)             \
1797   sk_pop_free(                                                \
1798       CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk), \
1799       CHECKED_CAST(void (*)(void *), void (*)(POLICYQUALINFO *), free_func))
1800 
1801 #define sk_POLICYQUALINFO_insert(sk, p, where)                      \
1802   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk), \
1803             CHECKED_CAST(void *, POLICYQUALINFO *, p), (where))
1804 
1805 #define sk_POLICYQUALINFO_delete(sk, where) \
1806   ((POLICYQUALINFO *)sk_delete(             \
1807       CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk), (where)))
1808 
1809 #define sk_POLICYQUALINFO_delete_ptr(sk, p)                   \
1810   ((POLICYQUALINFO *)sk_delete_ptr(                           \
1811       CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk), \
1812       CHECKED_CAST(void *, POLICYQUALINFO *, p)))
1813 
1814 #define sk_POLICYQUALINFO_find(sk, out_index, p)                               \
1815   sk_find(CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk), (out_index), \
1816           CHECKED_CAST(void *, POLICYQUALINFO *, p))
1817 
1818 #define sk_POLICYQUALINFO_shift(sk) \
1819   ((POLICYQUALINFO *)sk_shift(      \
1820       CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk)))
1821 
1822 #define sk_POLICYQUALINFO_push(sk, p)                             \
1823   sk_push(CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk), \
1824           CHECKED_CAST(void *, POLICYQUALINFO *, p))
1825 
1826 #define sk_POLICYQUALINFO_pop(sk) \
1827   ((POLICYQUALINFO *)sk_pop(      \
1828       CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk)))
1829 
1830 #define sk_POLICYQUALINFO_dup(sk)      \
1831   ((STACK_OF(POLICYQUALINFO) *)sk_dup( \
1832       CHECKED_CAST(_STACK *, const STACK_OF(POLICYQUALINFO) *, sk)))
1833 
1834 #define sk_POLICYQUALINFO_sort(sk) \
1835   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk))
1836 
1837 #define sk_POLICYQUALINFO_is_sorted(sk) \
1838   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(POLICYQUALINFO) *, sk))
1839 
1840 #define sk_POLICYQUALINFO_set_cmp_func(sk, comp)                           \
1841   ((int (*)(const POLICYQUALINFO **a, const POLICYQUALINFO **b))           \
1842        sk_set_cmp_func(                                                    \
1843            CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk),         \
1844            CHECKED_CAST(stack_cmp_func, int (*)(const POLICYQUALINFO **a,  \
1845                                                 const POLICYQUALINFO **b), \
1846                         comp)))
1847 
1848 #define sk_POLICYQUALINFO_deep_copy(sk, copy_func, free_func)                \
1849   ((STACK_OF(POLICYQUALINFO) *)sk_deep_copy(                                 \
1850       CHECKED_CAST(const _STACK *, const STACK_OF(POLICYQUALINFO) *, sk),    \
1851       CHECKED_CAST(void *(*)(void *), POLICYQUALINFO *(*)(POLICYQUALINFO *), \
1852                    copy_func),                                               \
1853       CHECKED_CAST(void (*)(void *), void (*)(POLICYQUALINFO *), free_func)))
1854 
1855 /* POLICY_MAPPING */
1856 #define sk_POLICY_MAPPING_new(comp)                 \
1857   ((STACK_OF(POLICY_MAPPING) *)sk_new(CHECKED_CAST( \
1858       stack_cmp_func,                               \
1859       int (*)(const POLICY_MAPPING **a, const POLICY_MAPPING **b), comp)))
1860 
1861 #define sk_POLICY_MAPPING_new_null() ((STACK_OF(POLICY_MAPPING) *)sk_new_null())
1862 
1863 #define sk_POLICY_MAPPING_num(sk) \
1864   sk_num(CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk))
1865 
1866 #define sk_POLICY_MAPPING_zero(sk) \
1867   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk));
1868 
1869 #define sk_POLICY_MAPPING_value(sk, i) \
1870   ((POLICY_MAPPING *)sk_value(         \
1871       CHECKED_CAST(_STACK *, const STACK_OF(POLICY_MAPPING) *, sk), (i)))
1872 
1873 #define sk_POLICY_MAPPING_set(sk, i, p)                            \
1874   ((POLICY_MAPPING *)sk_set(                                       \
1875       CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk), (i), \
1876       CHECKED_CAST(void *, POLICY_MAPPING *, p)))
1877 
1878 #define sk_POLICY_MAPPING_free(sk) \
1879   sk_free(CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk))
1880 
1881 #define sk_POLICY_MAPPING_pop_free(sk, free_func)             \
1882   sk_pop_free(                                                \
1883       CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk), \
1884       CHECKED_CAST(void (*)(void *), void (*)(POLICY_MAPPING *), free_func))
1885 
1886 #define sk_POLICY_MAPPING_insert(sk, p, where)                      \
1887   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk), \
1888             CHECKED_CAST(void *, POLICY_MAPPING *, p), (where))
1889 
1890 #define sk_POLICY_MAPPING_delete(sk, where) \
1891   ((POLICY_MAPPING *)sk_delete(             \
1892       CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk), (where)))
1893 
1894 #define sk_POLICY_MAPPING_delete_ptr(sk, p)                   \
1895   ((POLICY_MAPPING *)sk_delete_ptr(                           \
1896       CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk), \
1897       CHECKED_CAST(void *, POLICY_MAPPING *, p)))
1898 
1899 #define sk_POLICY_MAPPING_find(sk, out_index, p)                               \
1900   sk_find(CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk), (out_index), \
1901           CHECKED_CAST(void *, POLICY_MAPPING *, p))
1902 
1903 #define sk_POLICY_MAPPING_shift(sk) \
1904   ((POLICY_MAPPING *)sk_shift(      \
1905       CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk)))
1906 
1907 #define sk_POLICY_MAPPING_push(sk, p)                             \
1908   sk_push(CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk), \
1909           CHECKED_CAST(void *, POLICY_MAPPING *, p))
1910 
1911 #define sk_POLICY_MAPPING_pop(sk) \
1912   ((POLICY_MAPPING *)sk_pop(      \
1913       CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk)))
1914 
1915 #define sk_POLICY_MAPPING_dup(sk)      \
1916   ((STACK_OF(POLICY_MAPPING) *)sk_dup( \
1917       CHECKED_CAST(_STACK *, const STACK_OF(POLICY_MAPPING) *, sk)))
1918 
1919 #define sk_POLICY_MAPPING_sort(sk) \
1920   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk))
1921 
1922 #define sk_POLICY_MAPPING_is_sorted(sk) \
1923   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(POLICY_MAPPING) *, sk))
1924 
1925 #define sk_POLICY_MAPPING_set_cmp_func(sk, comp)                           \
1926   ((int (*)(const POLICY_MAPPING **a, const POLICY_MAPPING **b))           \
1927        sk_set_cmp_func(                                                    \
1928            CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk),         \
1929            CHECKED_CAST(stack_cmp_func, int (*)(const POLICY_MAPPING **a,  \
1930                                                 const POLICY_MAPPING **b), \
1931                         comp)))
1932 
1933 #define sk_POLICY_MAPPING_deep_copy(sk, copy_func, free_func)                \
1934   ((STACK_OF(POLICY_MAPPING) *)sk_deep_copy(                                 \
1935       CHECKED_CAST(const _STACK *, const STACK_OF(POLICY_MAPPING) *, sk),    \
1936       CHECKED_CAST(void *(*)(void *), POLICY_MAPPING *(*)(POLICY_MAPPING *), \
1937                    copy_func),                                               \
1938       CHECKED_CAST(void (*)(void *), void (*)(POLICY_MAPPING *), free_func)))
1939 
1940 /* SSL_COMP */
1941 #define sk_SSL_COMP_new(comp)                 \
1942   ((STACK_OF(SSL_COMP) *)sk_new(CHECKED_CAST( \
1943       stack_cmp_func, int (*)(const SSL_COMP **a, const SSL_COMP **b), comp)))
1944 
1945 #define sk_SSL_COMP_new_null() ((STACK_OF(SSL_COMP) *)sk_new_null())
1946 
1947 #define sk_SSL_COMP_num(sk) \
1948   sk_num(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk))
1949 
1950 #define sk_SSL_COMP_zero(sk) \
1951   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk));
1952 
1953 #define sk_SSL_COMP_value(sk, i) \
1954   ((SSL_COMP *)sk_value(         \
1955       CHECKED_CAST(_STACK *, const STACK_OF(SSL_COMP) *, sk), (i)))
1956 
1957 #define sk_SSL_COMP_set(sk, i, p)                                            \
1958   ((SSL_COMP *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk), (i), \
1959                       CHECKED_CAST(void *, SSL_COMP *, p)))
1960 
1961 #define sk_SSL_COMP_free(sk) \
1962   sk_free(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk))
1963 
1964 #define sk_SSL_COMP_pop_free(sk, free_func)                     \
1965   sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk), \
1966               CHECKED_CAST(void (*)(void *), void (*)(SSL_COMP *), free_func))
1967 
1968 #define sk_SSL_COMP_insert(sk, p, where)                      \
1969   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk), \
1970             CHECKED_CAST(void *, SSL_COMP *, p), (where))
1971 
1972 #define sk_SSL_COMP_delete(sk, where)                                      \
1973   ((SSL_COMP *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk), \
1974                          (where)))
1975 
1976 #define sk_SSL_COMP_delete_ptr(sk, p)                                          \
1977   ((SSL_COMP *)sk_delete_ptr(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk), \
1978                              CHECKED_CAST(void *, SSL_COMP *, p)))
1979 
1980 #define sk_SSL_COMP_find(sk, out_index, p)                               \
1981   sk_find(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk), (out_index), \
1982           CHECKED_CAST(void *, SSL_COMP *, p))
1983 
1984 #define sk_SSL_COMP_shift(sk) \
1985   ((SSL_COMP *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk)))
1986 
1987 #define sk_SSL_COMP_push(sk, p)                             \
1988   sk_push(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk), \
1989           CHECKED_CAST(void *, SSL_COMP *, p))
1990 
1991 #define sk_SSL_COMP_pop(sk) \
1992   ((SSL_COMP *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk)))
1993 
1994 #define sk_SSL_COMP_dup(sk)      \
1995   ((STACK_OF(SSL_COMP) *)sk_dup( \
1996       CHECKED_CAST(_STACK *, const STACK_OF(SSL_COMP) *, sk)))
1997 
1998 #define sk_SSL_COMP_sort(sk) \
1999   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk))
2000 
2001 #define sk_SSL_COMP_is_sorted(sk) \
2002   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(SSL_COMP) *, sk))
2003 
2004 #define sk_SSL_COMP_set_cmp_func(sk, comp)                           \
2005   ((int (*)(const SSL_COMP **a, const SSL_COMP **b))sk_set_cmp_func( \
2006       CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk),              \
2007       CHECKED_CAST(stack_cmp_func,                                   \
2008                    int (*)(const SSL_COMP **a, const SSL_COMP **b), comp)))
2009 
2010 #define sk_SSL_COMP_deep_copy(sk, copy_func, free_func)                      \
2011   ((STACK_OF(SSL_COMP) *)sk_deep_copy(                                       \
2012       CHECKED_CAST(const _STACK *, const STACK_OF(SSL_COMP) *, sk),          \
2013       CHECKED_CAST(void *(*)(void *), SSL_COMP *(*)(SSL_COMP *), copy_func), \
2014       CHECKED_CAST(void (*)(void *), void (*)(SSL_COMP *), free_func)))
2015 
2016 /* STACK_OF_X509_NAME_ENTRY */
2017 #define sk_STACK_OF_X509_NAME_ENTRY_new(comp)                      \
2018   ((STACK_OF(STACK_OF_X509_NAME_ENTRY) *)sk_new(CHECKED_CAST(      \
2019       stack_cmp_func, int (*)(const STACK_OF_X509_NAME_ENTRY **a,  \
2020                               const STACK_OF_X509_NAME_ENTRY **b), \
2021       comp)))
2022 
2023 #define sk_STACK_OF_X509_NAME_ENTRY_new_null() \
2024   ((STACK_OF(STACK_OF_X509_NAME_ENTRY) *)sk_new_null())
2025 
2026 #define sk_STACK_OF_X509_NAME_ENTRY_num(sk) \
2027   sk_num(CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk))
2028 
2029 #define sk_STACK_OF_X509_NAME_ENTRY_zero(sk) \
2030   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk));
2031 
2032 #define sk_STACK_OF_X509_NAME_ENTRY_value(sk, i)                              \
2033   ((STACK_OF_X509_NAME_ENTRY *)sk_value(                                      \
2034       CHECKED_CAST(_STACK *, const STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk), \
2035       (i)))
2036 
2037 #define sk_STACK_OF_X509_NAME_ENTRY_set(sk, i, p)                            \
2038   ((STACK_OF_X509_NAME_ENTRY *)sk_set(                                       \
2039       CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk), (i), \
2040       CHECKED_CAST(void *, STACK_OF_X509_NAME_ENTRY *, p)))
2041 
2042 #define sk_STACK_OF_X509_NAME_ENTRY_free(sk) \
2043   sk_free(CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk))
2044 
2045 #define sk_STACK_OF_X509_NAME_ENTRY_pop_free(sk, free_func)                \
2046   sk_pop_free(                                                             \
2047       CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk),    \
2048       CHECKED_CAST(void (*)(void *), void (*)(STACK_OF_X509_NAME_ENTRY *), \
2049                    free_func))
2050 
2051 #define sk_STACK_OF_X509_NAME_ENTRY_insert(sk, p, where)                      \
2052   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk), \
2053             CHECKED_CAST(void *, STACK_OF_X509_NAME_ENTRY *, p), (where))
2054 
2055 #define sk_STACK_OF_X509_NAME_ENTRY_delete(sk, where)                   \
2056   ((STACK_OF_X509_NAME_ENTRY *)sk_delete(                               \
2057       CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk), \
2058       (where)))
2059 
2060 #define sk_STACK_OF_X509_NAME_ENTRY_delete_ptr(sk, p)                   \
2061   ((STACK_OF_X509_NAME_ENTRY *)sk_delete_ptr(                           \
2062       CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk), \
2063       CHECKED_CAST(void *, STACK_OF_X509_NAME_ENTRY *, p)))
2064 
2065 #define sk_STACK_OF_X509_NAME_ENTRY_find(sk, out_index, p)                  \
2066   sk_find(CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk), \
2067           (out_index), CHECKED_CAST(void *, STACK_OF_X509_NAME_ENTRY *, p))
2068 
2069 #define sk_STACK_OF_X509_NAME_ENTRY_shift(sk) \
2070   ((STACK_OF_X509_NAME_ENTRY *)sk_shift(      \
2071       CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk)))
2072 
2073 #define sk_STACK_OF_X509_NAME_ENTRY_push(sk, p)                             \
2074   sk_push(CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk), \
2075           CHECKED_CAST(void *, STACK_OF_X509_NAME_ENTRY *, p))
2076 
2077 #define sk_STACK_OF_X509_NAME_ENTRY_pop(sk) \
2078   ((STACK_OF_X509_NAME_ENTRY *)sk_pop(      \
2079       CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk)))
2080 
2081 #define sk_STACK_OF_X509_NAME_ENTRY_dup(sk)      \
2082   ((STACK_OF(STACK_OF_X509_NAME_ENTRY) *)sk_dup( \
2083       CHECKED_CAST(_STACK *, const STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk)))
2084 
2085 #define sk_STACK_OF_X509_NAME_ENTRY_sort(sk) \
2086   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk))
2087 
2088 #define sk_STACK_OF_X509_NAME_ENTRY_is_sorted(sk) \
2089   sk_is_sorted(                                   \
2090       CHECKED_CAST(_STACK *, const STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk))
2091 
2092 #define sk_STACK_OF_X509_NAME_ENTRY_set_cmp_func(sk, comp)                   \
2093   ((int (*)(const STACK_OF_X509_NAME_ENTRY **a,                              \
2094             const STACK_OF_X509_NAME_ENTRY **b))                             \
2095        sk_set_cmp_func(                                                      \
2096            CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk), \
2097            CHECKED_CAST(stack_cmp_func,                                      \
2098                         int (*)(const STACK_OF_X509_NAME_ENTRY **a,          \
2099                                 const STACK_OF_X509_NAME_ENTRY **b),         \
2100                         comp)))
2101 
2102 #define sk_STACK_OF_X509_NAME_ENTRY_deep_copy(sk, copy_func, free_func)        \
2103   ((STACK_OF(STACK_OF_X509_NAME_ENTRY) *)sk_deep_copy(                         \
2104       CHECKED_CAST(const _STACK *, const STACK_OF(STACK_OF_X509_NAME_ENTRY) *, \
2105                    sk),                                                        \
2106       CHECKED_CAST(void *(*)(void *),                                          \
2107                    STACK_OF_X509_NAME_ENTRY *(*)(STACK_OF_X509_NAME_ENTRY *),  \
2108                    copy_func),                                                 \
2109       CHECKED_CAST(void (*)(void *), void (*)(STACK_OF_X509_NAME_ENTRY *),     \
2110                    free_func)))
2111 
2112 /* SXNETID */
2113 #define sk_SXNETID_new(comp)                 \
2114   ((STACK_OF(SXNETID) *)sk_new(CHECKED_CAST( \
2115       stack_cmp_func, int (*)(const SXNETID **a, const SXNETID **b), comp)))
2116 
2117 #define sk_SXNETID_new_null() ((STACK_OF(SXNETID) *)sk_new_null())
2118 
2119 #define sk_SXNETID_num(sk) \
2120   sk_num(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk))
2121 
2122 #define sk_SXNETID_zero(sk) \
2123   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk));
2124 
2125 #define sk_SXNETID_value(sk, i)                                               \
2126   ((SXNETID *)sk_value(CHECKED_CAST(_STACK *, const STACK_OF(SXNETID) *, sk), \
2127                        (i)))
2128 
2129 #define sk_SXNETID_set(sk, i, p)                                           \
2130   ((SXNETID *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk), (i), \
2131                      CHECKED_CAST(void *, SXNETID *, p)))
2132 
2133 #define sk_SXNETID_free(sk) \
2134   sk_free(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk))
2135 
2136 #define sk_SXNETID_pop_free(sk, free_func)                     \
2137   sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk), \
2138               CHECKED_CAST(void (*)(void *), void (*)(SXNETID *), free_func))
2139 
2140 #define sk_SXNETID_insert(sk, p, where)                      \
2141   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk), \
2142             CHECKED_CAST(void *, SXNETID *, p), (where))
2143 
2144 #define sk_SXNETID_delete(sk, where)                                     \
2145   ((SXNETID *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk), \
2146                         (where)))
2147 
2148 #define sk_SXNETID_delete_ptr(sk, p)                                         \
2149   ((SXNETID *)sk_delete_ptr(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk), \
2150                             CHECKED_CAST(void *, SXNETID *, p)))
2151 
2152 #define sk_SXNETID_find(sk, out_index, p)                               \
2153   sk_find(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk), (out_index), \
2154           CHECKED_CAST(void *, SXNETID *, p))
2155 
2156 #define sk_SXNETID_shift(sk) \
2157   ((SXNETID *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk)))
2158 
2159 #define sk_SXNETID_push(sk, p)                             \
2160   sk_push(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk), \
2161           CHECKED_CAST(void *, SXNETID *, p))
2162 
2163 #define sk_SXNETID_pop(sk) \
2164   ((SXNETID *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk)))
2165 
2166 #define sk_SXNETID_dup(sk)      \
2167   ((STACK_OF(SXNETID) *)sk_dup( \
2168       CHECKED_CAST(_STACK *, const STACK_OF(SXNETID) *, sk)))
2169 
2170 #define sk_SXNETID_sort(sk) \
2171   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk))
2172 
2173 #define sk_SXNETID_is_sorted(sk) \
2174   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(SXNETID) *, sk))
2175 
2176 #define sk_SXNETID_set_cmp_func(sk, comp)                          \
2177   ((int (*)(const SXNETID **a, const SXNETID **b))sk_set_cmp_func( \
2178       CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk),             \
2179       CHECKED_CAST(stack_cmp_func,                                 \
2180                    int (*)(const SXNETID **a, const SXNETID **b), comp)))
2181 
2182 #define sk_SXNETID_deep_copy(sk, copy_func, free_func)                     \
2183   ((STACK_OF(SXNETID) *)sk_deep_copy(                                      \
2184       CHECKED_CAST(const _STACK *, const STACK_OF(SXNETID) *, sk),         \
2185       CHECKED_CAST(void *(*)(void *), SXNETID *(*)(SXNETID *), copy_func), \
2186       CHECKED_CAST(void (*)(void *), void (*)(SXNETID *), free_func)))
2187 
2188 /* X509 */
2189 #define sk_X509_new(comp)                 \
2190   ((STACK_OF(X509) *)sk_new(CHECKED_CAST( \
2191       stack_cmp_func, int (*)(const X509 **a, const X509 **b), comp)))
2192 
2193 #define sk_X509_new_null() ((STACK_OF(X509) *)sk_new_null())
2194 
2195 #define sk_X509_num(sk) sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk))
2196 
2197 #define sk_X509_zero(sk) sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk));
2198 
2199 #define sk_X509_value(sk, i) \
2200   ((X509 *)sk_value(CHECKED_CAST(_STACK *, const STACK_OF(X509) *, sk), (i)))
2201 
2202 #define sk_X509_set(sk, i, p)                                        \
2203   ((X509 *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk), (i), \
2204                   CHECKED_CAST(void *, X509 *, p)))
2205 
2206 #define sk_X509_free(sk) sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk))
2207 
2208 #define sk_X509_pop_free(sk, free_func)                     \
2209   sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk), \
2210               CHECKED_CAST(void (*)(void *), void (*)(X509 *), free_func))
2211 
2212 #define sk_X509_insert(sk, p, where)                      \
2213   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk), \
2214             CHECKED_CAST(void *, X509 *, p), (where))
2215 
2216 #define sk_X509_delete(sk, where) \
2217   ((X509 *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk), (where)))
2218 
2219 #define sk_X509_delete_ptr(sk, p)                                      \
2220   ((X509 *)sk_delete_ptr(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk), \
2221                          CHECKED_CAST(void *, X509 *, p)))
2222 
2223 #define sk_X509_find(sk, out_index, p)                               \
2224   sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk), (out_index), \
2225           CHECKED_CAST(void *, X509 *, p))
2226 
2227 #define sk_X509_shift(sk) \
2228   ((X509 *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk)))
2229 
2230 #define sk_X509_push(sk, p)                             \
2231   sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk), \
2232           CHECKED_CAST(void *, X509 *, p))
2233 
2234 #define sk_X509_pop(sk) \
2235   ((X509 *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk)))
2236 
2237 #define sk_X509_dup(sk) \
2238   ((STACK_OF(X509) *)sk_dup(CHECKED_CAST(_STACK *, const STACK_OF(X509) *, sk)))
2239 
2240 #define sk_X509_sort(sk) sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk))
2241 
2242 #define sk_X509_is_sorted(sk) \
2243   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509) *, sk))
2244 
2245 #define sk_X509_set_cmp_func(sk, comp)                                      \
2246   ((int (*)(const X509 **a, const X509 **b))sk_set_cmp_func(                \
2247       CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk),                         \
2248       CHECKED_CAST(stack_cmp_func, int (*)(const X509 **a, const X509 **b), \
2249                    comp)))
2250 
2251 #define sk_X509_deep_copy(sk, copy_func, free_func)                  \
2252   ((STACK_OF(X509) *)sk_deep_copy(                                   \
2253       CHECKED_CAST(const _STACK *, const STACK_OF(X509) *, sk),      \
2254       CHECKED_CAST(void *(*)(void *), X509 *(*)(X509 *), copy_func), \
2255       CHECKED_CAST(void (*)(void *), void (*)(X509 *), free_func)))
2256 
2257 /* X509V3_EXT_METHOD */
2258 #define sk_X509V3_EXT_METHOD_new(comp)                                   \
2259   ((STACK_OF(X509V3_EXT_METHOD) *)sk_new(CHECKED_CAST(                   \
2260       stack_cmp_func,                                                    \
2261       int (*)(const X509V3_EXT_METHOD **a, const X509V3_EXT_METHOD **b), \
2262       comp)))
2263 
2264 #define sk_X509V3_EXT_METHOD_new_null() \
2265   ((STACK_OF(X509V3_EXT_METHOD) *)sk_new_null())
2266 
2267 #define sk_X509V3_EXT_METHOD_num(sk) \
2268   sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk))
2269 
2270 #define sk_X509V3_EXT_METHOD_zero(sk) \
2271   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk));
2272 
2273 #define sk_X509V3_EXT_METHOD_value(sk, i) \
2274   ((X509V3_EXT_METHOD *)sk_value(         \
2275       CHECKED_CAST(_STACK *, const STACK_OF(X509V3_EXT_METHOD) *, sk), (i)))
2276 
2277 #define sk_X509V3_EXT_METHOD_set(sk, i, p)                            \
2278   ((X509V3_EXT_METHOD *)sk_set(                                       \
2279       CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk), (i), \
2280       CHECKED_CAST(void *, X509V3_EXT_METHOD *, p)))
2281 
2282 #define sk_X509V3_EXT_METHOD_free(sk) \
2283   sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk))
2284 
2285 #define sk_X509V3_EXT_METHOD_pop_free(sk, free_func)                        \
2286   sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk),    \
2287               CHECKED_CAST(void (*)(void *), void (*)(X509V3_EXT_METHOD *), \
2288                            free_func))
2289 
2290 #define sk_X509V3_EXT_METHOD_insert(sk, p, where)                      \
2291   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk), \
2292             CHECKED_CAST(void *, X509V3_EXT_METHOD *, p), (where))
2293 
2294 #define sk_X509V3_EXT_METHOD_delete(sk, where) \
2295   ((X509V3_EXT_METHOD *)sk_delete(             \
2296       CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk), (where)))
2297 
2298 #define sk_X509V3_EXT_METHOD_delete_ptr(sk, p)                   \
2299   ((X509V3_EXT_METHOD *)sk_delete_ptr(                           \
2300       CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk), \
2301       CHECKED_CAST(void *, X509V3_EXT_METHOD *, p)))
2302 
2303 #define sk_X509V3_EXT_METHOD_find(sk, out_index, p)                  \
2304   sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk), \
2305           (out_index), CHECKED_CAST(void *, X509V3_EXT_METHOD *, p))
2306 
2307 #define sk_X509V3_EXT_METHOD_shift(sk) \
2308   ((X509V3_EXT_METHOD *)sk_shift(      \
2309       CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk)))
2310 
2311 #define sk_X509V3_EXT_METHOD_push(sk, p)                             \
2312   sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk), \
2313           CHECKED_CAST(void *, X509V3_EXT_METHOD *, p))
2314 
2315 #define sk_X509V3_EXT_METHOD_pop(sk) \
2316   ((X509V3_EXT_METHOD *)sk_pop(      \
2317       CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk)))
2318 
2319 #define sk_X509V3_EXT_METHOD_dup(sk)      \
2320   ((STACK_OF(X509V3_EXT_METHOD) *)sk_dup( \
2321       CHECKED_CAST(_STACK *, const STACK_OF(X509V3_EXT_METHOD) *, sk)))
2322 
2323 #define sk_X509V3_EXT_METHOD_sort(sk) \
2324   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk))
2325 
2326 #define sk_X509V3_EXT_METHOD_is_sorted(sk) \
2327   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509V3_EXT_METHOD) *, sk))
2328 
2329 #define sk_X509V3_EXT_METHOD_set_cmp_func(sk, comp)                           \
2330   ((int (*)(const X509V3_EXT_METHOD **a, const X509V3_EXT_METHOD **b))        \
2331        sk_set_cmp_func(                                                       \
2332            CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk),         \
2333            CHECKED_CAST(stack_cmp_func, int (*)(const X509V3_EXT_METHOD **a,  \
2334                                                 const X509V3_EXT_METHOD **b), \
2335                         comp)))
2336 
2337 #define sk_X509V3_EXT_METHOD_deep_copy(sk, copy_func, free_func)             \
2338   ((STACK_OF(X509V3_EXT_METHOD) *)sk_deep_copy(                              \
2339       CHECKED_CAST(const _STACK *, const STACK_OF(X509V3_EXT_METHOD) *, sk), \
2340       CHECKED_CAST(void *(*)(void *),                                        \
2341                    X509V3_EXT_METHOD *(*)(X509V3_EXT_METHOD *), copy_func),  \
2342       CHECKED_CAST(void (*)(void *), void (*)(X509V3_EXT_METHOD *),          \
2343                    free_func)))
2344 
2345 /* X509_ALGOR */
2346 #define sk_X509_ALGOR_new(comp)                                            \
2347   ((STACK_OF(X509_ALGOR) *)sk_new(CHECKED_CAST(                            \
2348       stack_cmp_func, int (*)(const X509_ALGOR **a, const X509_ALGOR **b), \
2349       comp)))
2350 
2351 #define sk_X509_ALGOR_new_null() ((STACK_OF(X509_ALGOR) *)sk_new_null())
2352 
2353 #define sk_X509_ALGOR_num(sk) \
2354   sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk))
2355 
2356 #define sk_X509_ALGOR_zero(sk) \
2357   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk));
2358 
2359 #define sk_X509_ALGOR_value(sk, i) \
2360   ((X509_ALGOR *)sk_value(         \
2361       CHECKED_CAST(_STACK *, const STACK_OF(X509_ALGOR) *, sk), (i)))
2362 
2363 #define sk_X509_ALGOR_set(sk, i, p)                                         \
2364   ((X509_ALGOR *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk), \
2365                         (i), CHECKED_CAST(void *, X509_ALGOR *, p)))
2366 
2367 #define sk_X509_ALGOR_free(sk) \
2368   sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk))
2369 
2370 #define sk_X509_ALGOR_pop_free(sk, free_func)             \
2371   sk_pop_free(                                            \
2372       CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk), \
2373       CHECKED_CAST(void (*)(void *), void (*)(X509_ALGOR *), free_func))
2374 
2375 #define sk_X509_ALGOR_insert(sk, p, where)                      \
2376   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk), \
2377             CHECKED_CAST(void *, X509_ALGOR *, p), (where))
2378 
2379 #define sk_X509_ALGOR_delete(sk, where)                                        \
2380   ((X509_ALGOR *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk), \
2381                            (where)))
2382 
2383 #define sk_X509_ALGOR_delete_ptr(sk, p)                   \
2384   ((X509_ALGOR *)sk_delete_ptr(                           \
2385       CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk), \
2386       CHECKED_CAST(void *, X509_ALGOR *, p)))
2387 
2388 #define sk_X509_ALGOR_find(sk, out_index, p)                               \
2389   sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk), (out_index), \
2390           CHECKED_CAST(void *, X509_ALGOR *, p))
2391 
2392 #define sk_X509_ALGOR_shift(sk) \
2393   ((X509_ALGOR *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk)))
2394 
2395 #define sk_X509_ALGOR_push(sk, p)                             \
2396   sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk), \
2397           CHECKED_CAST(void *, X509_ALGOR *, p))
2398 
2399 #define sk_X509_ALGOR_pop(sk) \
2400   ((X509_ALGOR *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk)))
2401 
2402 #define sk_X509_ALGOR_dup(sk)      \
2403   ((STACK_OF(X509_ALGOR) *)sk_dup( \
2404       CHECKED_CAST(_STACK *, const STACK_OF(X509_ALGOR) *, sk)))
2405 
2406 #define sk_X509_ALGOR_sort(sk) \
2407   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk))
2408 
2409 #define sk_X509_ALGOR_is_sorted(sk) \
2410   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_ALGOR) *, sk))
2411 
2412 #define sk_X509_ALGOR_set_cmp_func(sk, comp)                             \
2413   ((int (*)(const X509_ALGOR **a, const X509_ALGOR **b))sk_set_cmp_func( \
2414       CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk),                \
2415       CHECKED_CAST(stack_cmp_func,                                       \
2416                    int (*)(const X509_ALGOR **a, const X509_ALGOR **b),  \
2417                    comp)))
2418 
2419 #define sk_X509_ALGOR_deep_copy(sk, copy_func, free_func)             \
2420   ((STACK_OF(X509_ALGOR) *)sk_deep_copy(                              \
2421       CHECKED_CAST(const _STACK *, const STACK_OF(X509_ALGOR) *, sk), \
2422       CHECKED_CAST(void *(*)(void *), X509_ALGOR *(*)(X509_ALGOR *),  \
2423                    copy_func),                                        \
2424       CHECKED_CAST(void (*)(void *), void (*)(X509_ALGOR *), free_func)))
2425 
2426 /* X509_ATTRIBUTE */
2427 #define sk_X509_ATTRIBUTE_new(comp)                 \
2428   ((STACK_OF(X509_ATTRIBUTE) *)sk_new(CHECKED_CAST( \
2429       stack_cmp_func,                               \
2430       int (*)(const X509_ATTRIBUTE **a, const X509_ATTRIBUTE **b), comp)))
2431 
2432 #define sk_X509_ATTRIBUTE_new_null() ((STACK_OF(X509_ATTRIBUTE) *)sk_new_null())
2433 
2434 #define sk_X509_ATTRIBUTE_num(sk) \
2435   sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk))
2436 
2437 #define sk_X509_ATTRIBUTE_zero(sk) \
2438   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk));
2439 
2440 #define sk_X509_ATTRIBUTE_value(sk, i) \
2441   ((X509_ATTRIBUTE *)sk_value(         \
2442       CHECKED_CAST(_STACK *, const STACK_OF(X509_ATTRIBUTE) *, sk), (i)))
2443 
2444 #define sk_X509_ATTRIBUTE_set(sk, i, p)                            \
2445   ((X509_ATTRIBUTE *)sk_set(                                       \
2446       CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk), (i), \
2447       CHECKED_CAST(void *, X509_ATTRIBUTE *, p)))
2448 
2449 #define sk_X509_ATTRIBUTE_free(sk) \
2450   sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk))
2451 
2452 #define sk_X509_ATTRIBUTE_pop_free(sk, free_func)             \
2453   sk_pop_free(                                                \
2454       CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk), \
2455       CHECKED_CAST(void (*)(void *), void (*)(X509_ATTRIBUTE *), free_func))
2456 
2457 #define sk_X509_ATTRIBUTE_insert(sk, p, where)                      \
2458   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk), \
2459             CHECKED_CAST(void *, X509_ATTRIBUTE *, p), (where))
2460 
2461 #define sk_X509_ATTRIBUTE_delete(sk, where) \
2462   ((X509_ATTRIBUTE *)sk_delete(             \
2463       CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk), (where)))
2464 
2465 #define sk_X509_ATTRIBUTE_delete_ptr(sk, p)                   \
2466   ((X509_ATTRIBUTE *)sk_delete_ptr(                           \
2467       CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk), \
2468       CHECKED_CAST(void *, X509_ATTRIBUTE *, p)))
2469 
2470 #define sk_X509_ATTRIBUTE_find(sk, out_index, p)                               \
2471   sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk), (out_index), \
2472           CHECKED_CAST(void *, X509_ATTRIBUTE *, p))
2473 
2474 #define sk_X509_ATTRIBUTE_shift(sk) \
2475   ((X509_ATTRIBUTE *)sk_shift(      \
2476       CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk)))
2477 
2478 #define sk_X509_ATTRIBUTE_push(sk, p)                             \
2479   sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk), \
2480           CHECKED_CAST(void *, X509_ATTRIBUTE *, p))
2481 
2482 #define sk_X509_ATTRIBUTE_pop(sk) \
2483   ((X509_ATTRIBUTE *)sk_pop(      \
2484       CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk)))
2485 
2486 #define sk_X509_ATTRIBUTE_dup(sk)      \
2487   ((STACK_OF(X509_ATTRIBUTE) *)sk_dup( \
2488       CHECKED_CAST(_STACK *, const STACK_OF(X509_ATTRIBUTE) *, sk)))
2489 
2490 #define sk_X509_ATTRIBUTE_sort(sk) \
2491   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk))
2492 
2493 #define sk_X509_ATTRIBUTE_is_sorted(sk) \
2494   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_ATTRIBUTE) *, sk))
2495 
2496 #define sk_X509_ATTRIBUTE_set_cmp_func(sk, comp)                           \
2497   ((int (*)(const X509_ATTRIBUTE **a, const X509_ATTRIBUTE **b))           \
2498        sk_set_cmp_func(                                                    \
2499            CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk),         \
2500            CHECKED_CAST(stack_cmp_func, int (*)(const X509_ATTRIBUTE **a,  \
2501                                                 const X509_ATTRIBUTE **b), \
2502                         comp)))
2503 
2504 #define sk_X509_ATTRIBUTE_deep_copy(sk, copy_func, free_func)                \
2505   ((STACK_OF(X509_ATTRIBUTE) *)sk_deep_copy(                                 \
2506       CHECKED_CAST(const _STACK *, const STACK_OF(X509_ATTRIBUTE) *, sk),    \
2507       CHECKED_CAST(void *(*)(void *), X509_ATTRIBUTE *(*)(X509_ATTRIBUTE *), \
2508                    copy_func),                                               \
2509       CHECKED_CAST(void (*)(void *), void (*)(X509_ATTRIBUTE *), free_func)))
2510 
2511 /* X509_CRL */
2512 #define sk_X509_CRL_new(comp)                 \
2513   ((STACK_OF(X509_CRL) *)sk_new(CHECKED_CAST( \
2514       stack_cmp_func, int (*)(const X509_CRL **a, const X509_CRL **b), comp)))
2515 
2516 #define sk_X509_CRL_new_null() ((STACK_OF(X509_CRL) *)sk_new_null())
2517 
2518 #define sk_X509_CRL_num(sk) \
2519   sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk))
2520 
2521 #define sk_X509_CRL_zero(sk) \
2522   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk));
2523 
2524 #define sk_X509_CRL_value(sk, i) \
2525   ((X509_CRL *)sk_value(         \
2526       CHECKED_CAST(_STACK *, const STACK_OF(X509_CRL) *, sk), (i)))
2527 
2528 #define sk_X509_CRL_set(sk, i, p)                                            \
2529   ((X509_CRL *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk), (i), \
2530                       CHECKED_CAST(void *, X509_CRL *, p)))
2531 
2532 #define sk_X509_CRL_free(sk) \
2533   sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk))
2534 
2535 #define sk_X509_CRL_pop_free(sk, free_func)                     \
2536   sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk), \
2537               CHECKED_CAST(void (*)(void *), void (*)(X509_CRL *), free_func))
2538 
2539 #define sk_X509_CRL_insert(sk, p, where)                      \
2540   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk), \
2541             CHECKED_CAST(void *, X509_CRL *, p), (where))
2542 
2543 #define sk_X509_CRL_delete(sk, where)                                      \
2544   ((X509_CRL *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk), \
2545                          (where)))
2546 
2547 #define sk_X509_CRL_delete_ptr(sk, p)                                          \
2548   ((X509_CRL *)sk_delete_ptr(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk), \
2549                              CHECKED_CAST(void *, X509_CRL *, p)))
2550 
2551 #define sk_X509_CRL_find(sk, out_index, p)                               \
2552   sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk), (out_index), \
2553           CHECKED_CAST(void *, X509_CRL *, p))
2554 
2555 #define sk_X509_CRL_shift(sk) \
2556   ((X509_CRL *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk)))
2557 
2558 #define sk_X509_CRL_push(sk, p)                             \
2559   sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk), \
2560           CHECKED_CAST(void *, X509_CRL *, p))
2561 
2562 #define sk_X509_CRL_pop(sk) \
2563   ((X509_CRL *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk)))
2564 
2565 #define sk_X509_CRL_dup(sk)      \
2566   ((STACK_OF(X509_CRL) *)sk_dup( \
2567       CHECKED_CAST(_STACK *, const STACK_OF(X509_CRL) *, sk)))
2568 
2569 #define sk_X509_CRL_sort(sk) \
2570   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk))
2571 
2572 #define sk_X509_CRL_is_sorted(sk) \
2573   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_CRL) *, sk))
2574 
2575 #define sk_X509_CRL_set_cmp_func(sk, comp)                           \
2576   ((int (*)(const X509_CRL **a, const X509_CRL **b))sk_set_cmp_func( \
2577       CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk),              \
2578       CHECKED_CAST(stack_cmp_func,                                   \
2579                    int (*)(const X509_CRL **a, const X509_CRL **b), comp)))
2580 
2581 #define sk_X509_CRL_deep_copy(sk, copy_func, free_func)                      \
2582   ((STACK_OF(X509_CRL) *)sk_deep_copy(                                       \
2583       CHECKED_CAST(const _STACK *, const STACK_OF(X509_CRL) *, sk),          \
2584       CHECKED_CAST(void *(*)(void *), X509_CRL *(*)(X509_CRL *), copy_func), \
2585       CHECKED_CAST(void (*)(void *), void (*)(X509_CRL *), free_func)))
2586 
2587 /* X509_EXTENSION */
2588 #define sk_X509_EXTENSION_new(comp)                 \
2589   ((STACK_OF(X509_EXTENSION) *)sk_new(CHECKED_CAST( \
2590       stack_cmp_func,                               \
2591       int (*)(const X509_EXTENSION **a, const X509_EXTENSION **b), comp)))
2592 
2593 #define sk_X509_EXTENSION_new_null() ((STACK_OF(X509_EXTENSION) *)sk_new_null())
2594 
2595 #define sk_X509_EXTENSION_num(sk) \
2596   sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk))
2597 
2598 #define sk_X509_EXTENSION_zero(sk) \
2599   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk));
2600 
2601 #define sk_X509_EXTENSION_value(sk, i) \
2602   ((X509_EXTENSION *)sk_value(         \
2603       CHECKED_CAST(_STACK *, const STACK_OF(X509_EXTENSION) *, sk), (i)))
2604 
2605 #define sk_X509_EXTENSION_set(sk, i, p)                            \
2606   ((X509_EXTENSION *)sk_set(                                       \
2607       CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk), (i), \
2608       CHECKED_CAST(void *, X509_EXTENSION *, p)))
2609 
2610 #define sk_X509_EXTENSION_free(sk) \
2611   sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk))
2612 
2613 #define sk_X509_EXTENSION_pop_free(sk, free_func)             \
2614   sk_pop_free(                                                \
2615       CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk), \
2616       CHECKED_CAST(void (*)(void *), void (*)(X509_EXTENSION *), free_func))
2617 
2618 #define sk_X509_EXTENSION_insert(sk, p, where)                      \
2619   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk), \
2620             CHECKED_CAST(void *, X509_EXTENSION *, p), (where))
2621 
2622 #define sk_X509_EXTENSION_delete(sk, where) \
2623   ((X509_EXTENSION *)sk_delete(             \
2624       CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk), (where)))
2625 
2626 #define sk_X509_EXTENSION_delete_ptr(sk, p)                   \
2627   ((X509_EXTENSION *)sk_delete_ptr(                           \
2628       CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk), \
2629       CHECKED_CAST(void *, X509_EXTENSION *, p)))
2630 
2631 #define sk_X509_EXTENSION_find(sk, out_index, p)                               \
2632   sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk), (out_index), \
2633           CHECKED_CAST(void *, X509_EXTENSION *, p))
2634 
2635 #define sk_X509_EXTENSION_shift(sk) \
2636   ((X509_EXTENSION *)sk_shift(      \
2637       CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk)))
2638 
2639 #define sk_X509_EXTENSION_push(sk, p)                             \
2640   sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk), \
2641           CHECKED_CAST(void *, X509_EXTENSION *, p))
2642 
2643 #define sk_X509_EXTENSION_pop(sk) \
2644   ((X509_EXTENSION *)sk_pop(      \
2645       CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk)))
2646 
2647 #define sk_X509_EXTENSION_dup(sk)      \
2648   ((STACK_OF(X509_EXTENSION) *)sk_dup( \
2649       CHECKED_CAST(_STACK *, const STACK_OF(X509_EXTENSION) *, sk)))
2650 
2651 #define sk_X509_EXTENSION_sort(sk) \
2652   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk))
2653 
2654 #define sk_X509_EXTENSION_is_sorted(sk) \
2655   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_EXTENSION) *, sk))
2656 
2657 #define sk_X509_EXTENSION_set_cmp_func(sk, comp)                           \
2658   ((int (*)(const X509_EXTENSION **a, const X509_EXTENSION **b))           \
2659        sk_set_cmp_func(                                                    \
2660            CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk),         \
2661            CHECKED_CAST(stack_cmp_func, int (*)(const X509_EXTENSION **a,  \
2662                                                 const X509_EXTENSION **b), \
2663                         comp)))
2664 
2665 #define sk_X509_EXTENSION_deep_copy(sk, copy_func, free_func)                \
2666   ((STACK_OF(X509_EXTENSION) *)sk_deep_copy(                                 \
2667       CHECKED_CAST(const _STACK *, const STACK_OF(X509_EXTENSION) *, sk),    \
2668       CHECKED_CAST(void *(*)(void *), X509_EXTENSION *(*)(X509_EXTENSION *), \
2669                    copy_func),                                               \
2670       CHECKED_CAST(void (*)(void *), void (*)(X509_EXTENSION *), free_func)))
2671 
2672 /* X509_INFO */
2673 #define sk_X509_INFO_new(comp)     \
2674   ((STACK_OF(X509_INFO) *)sk_new(  \
2675       CHECKED_CAST(stack_cmp_func, \
2676                    int (*)(const X509_INFO **a, const X509_INFO **b), comp)))
2677 
2678 #define sk_X509_INFO_new_null() ((STACK_OF(X509_INFO) *)sk_new_null())
2679 
2680 #define sk_X509_INFO_num(sk) \
2681   sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk))
2682 
2683 #define sk_X509_INFO_zero(sk) \
2684   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk));
2685 
2686 #define sk_X509_INFO_value(sk, i) \
2687   ((X509_INFO *)sk_value(         \
2688       CHECKED_CAST(_STACK *, const STACK_OF(X509_INFO) *, sk), (i)))
2689 
2690 #define sk_X509_INFO_set(sk, i, p)                                             \
2691   ((X509_INFO *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk), (i), \
2692                        CHECKED_CAST(void *, X509_INFO *, p)))
2693 
2694 #define sk_X509_INFO_free(sk) \
2695   sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk))
2696 
2697 #define sk_X509_INFO_pop_free(sk, free_func)             \
2698   sk_pop_free(                                           \
2699       CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk), \
2700       CHECKED_CAST(void (*)(void *), void (*)(X509_INFO *), free_func))
2701 
2702 #define sk_X509_INFO_insert(sk, p, where)                      \
2703   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk), \
2704             CHECKED_CAST(void *, X509_INFO *, p), (where))
2705 
2706 #define sk_X509_INFO_delete(sk, where)                                       \
2707   ((X509_INFO *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk), \
2708                           (where)))
2709 
2710 #define sk_X509_INFO_delete_ptr(sk, p)                   \
2711   ((X509_INFO *)sk_delete_ptr(                           \
2712       CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk), \
2713       CHECKED_CAST(void *, X509_INFO *, p)))
2714 
2715 #define sk_X509_INFO_find(sk, out_index, p)                               \
2716   sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk), (out_index), \
2717           CHECKED_CAST(void *, X509_INFO *, p))
2718 
2719 #define sk_X509_INFO_shift(sk) \
2720   ((X509_INFO *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk)))
2721 
2722 #define sk_X509_INFO_push(sk, p)                             \
2723   sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk), \
2724           CHECKED_CAST(void *, X509_INFO *, p))
2725 
2726 #define sk_X509_INFO_pop(sk) \
2727   ((X509_INFO *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk)))
2728 
2729 #define sk_X509_INFO_dup(sk)      \
2730   ((STACK_OF(X509_INFO) *)sk_dup( \
2731       CHECKED_CAST(_STACK *, const STACK_OF(X509_INFO) *, sk)))
2732 
2733 #define sk_X509_INFO_sort(sk) \
2734   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk))
2735 
2736 #define sk_X509_INFO_is_sorted(sk) \
2737   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_INFO) *, sk))
2738 
2739 #define sk_X509_INFO_set_cmp_func(sk, comp)                            \
2740   ((int (*)(const X509_INFO **a, const X509_INFO **b))sk_set_cmp_func( \
2741       CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk),               \
2742       CHECKED_CAST(stack_cmp_func,                                     \
2743                    int (*)(const X509_INFO **a, const X509_INFO **b), comp)))
2744 
2745 #define sk_X509_INFO_deep_copy(sk, copy_func, free_func)                       \
2746   ((STACK_OF(X509_INFO) *)sk_deep_copy(                                        \
2747       CHECKED_CAST(const _STACK *, const STACK_OF(X509_INFO) *, sk),           \
2748       CHECKED_CAST(void *(*)(void *), X509_INFO *(*)(X509_INFO *), copy_func), \
2749       CHECKED_CAST(void (*)(void *), void (*)(X509_INFO *), free_func)))
2750 
2751 /* X509_LOOKUP */
2752 #define sk_X509_LOOKUP_new(comp)                                             \
2753   ((STACK_OF(X509_LOOKUP) *)sk_new(CHECKED_CAST(                             \
2754       stack_cmp_func, int (*)(const X509_LOOKUP **a, const X509_LOOKUP **b), \
2755       comp)))
2756 
2757 #define sk_X509_LOOKUP_new_null() ((STACK_OF(X509_LOOKUP) *)sk_new_null())
2758 
2759 #define sk_X509_LOOKUP_num(sk) \
2760   sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk))
2761 
2762 #define sk_X509_LOOKUP_zero(sk) \
2763   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk));
2764 
2765 #define sk_X509_LOOKUP_value(sk, i) \
2766   ((X509_LOOKUP *)sk_value(         \
2767       CHECKED_CAST(_STACK *, const STACK_OF(X509_LOOKUP) *, sk), (i)))
2768 
2769 #define sk_X509_LOOKUP_set(sk, i, p)                                          \
2770   ((X509_LOOKUP *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk), \
2771                          (i), CHECKED_CAST(void *, X509_LOOKUP *, p)))
2772 
2773 #define sk_X509_LOOKUP_free(sk) \
2774   sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk))
2775 
2776 #define sk_X509_LOOKUP_pop_free(sk, free_func)             \
2777   sk_pop_free(                                             \
2778       CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk), \
2779       CHECKED_CAST(void (*)(void *), void (*)(X509_LOOKUP *), free_func))
2780 
2781 #define sk_X509_LOOKUP_insert(sk, p, where)                      \
2782   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk), \
2783             CHECKED_CAST(void *, X509_LOOKUP *, p), (where))
2784 
2785 #define sk_X509_LOOKUP_delete(sk, where) \
2786   ((X509_LOOKUP *)sk_delete(             \
2787       CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk), (where)))
2788 
2789 #define sk_X509_LOOKUP_delete_ptr(sk, p)                   \
2790   ((X509_LOOKUP *)sk_delete_ptr(                           \
2791       CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk), \
2792       CHECKED_CAST(void *, X509_LOOKUP *, p)))
2793 
2794 #define sk_X509_LOOKUP_find(sk, out_index, p)                               \
2795   sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk), (out_index), \
2796           CHECKED_CAST(void *, X509_LOOKUP *, p))
2797 
2798 #define sk_X509_LOOKUP_shift(sk) \
2799   ((X509_LOOKUP *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk)))
2800 
2801 #define sk_X509_LOOKUP_push(sk, p)                             \
2802   sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk), \
2803           CHECKED_CAST(void *, X509_LOOKUP *, p))
2804 
2805 #define sk_X509_LOOKUP_pop(sk) \
2806   ((X509_LOOKUP *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk)))
2807 
2808 #define sk_X509_LOOKUP_dup(sk)      \
2809   ((STACK_OF(X509_LOOKUP) *)sk_dup( \
2810       CHECKED_CAST(_STACK *, const STACK_OF(X509_LOOKUP) *, sk)))
2811 
2812 #define sk_X509_LOOKUP_sort(sk) \
2813   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk))
2814 
2815 #define sk_X509_LOOKUP_is_sorted(sk) \
2816   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_LOOKUP) *, sk))
2817 
2818 #define sk_X509_LOOKUP_set_cmp_func(sk, comp)                              \
2819   ((int (*)(const X509_LOOKUP **a, const X509_LOOKUP **b))sk_set_cmp_func( \
2820       CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk),                 \
2821       CHECKED_CAST(stack_cmp_func,                                         \
2822                    int (*)(const X509_LOOKUP **a, const X509_LOOKUP **b),  \
2823                    comp)))
2824 
2825 #define sk_X509_LOOKUP_deep_copy(sk, copy_func, free_func)             \
2826   ((STACK_OF(X509_LOOKUP) *)sk_deep_copy(                              \
2827       CHECKED_CAST(const _STACK *, const STACK_OF(X509_LOOKUP) *, sk), \
2828       CHECKED_CAST(void *(*)(void *), X509_LOOKUP *(*)(X509_LOOKUP *), \
2829                    copy_func),                                         \
2830       CHECKED_CAST(void (*)(void *), void (*)(X509_LOOKUP *), free_func)))
2831 
2832 /* X509_NAME */
2833 #define sk_X509_NAME_new(comp)     \
2834   ((STACK_OF(X509_NAME) *)sk_new(  \
2835       CHECKED_CAST(stack_cmp_func, \
2836                    int (*)(const X509_NAME **a, const X509_NAME **b), comp)))
2837 
2838 #define sk_X509_NAME_new_null() ((STACK_OF(X509_NAME) *)sk_new_null())
2839 
2840 #define sk_X509_NAME_num(sk) \
2841   sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk))
2842 
2843 #define sk_X509_NAME_zero(sk) \
2844   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk));
2845 
2846 #define sk_X509_NAME_value(sk, i) \
2847   ((X509_NAME *)sk_value(         \
2848       CHECKED_CAST(_STACK *, const STACK_OF(X509_NAME) *, sk), (i)))
2849 
2850 #define sk_X509_NAME_set(sk, i, p)                                             \
2851   ((X509_NAME *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk), (i), \
2852                        CHECKED_CAST(void *, X509_NAME *, p)))
2853 
2854 #define sk_X509_NAME_free(sk) \
2855   sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk))
2856 
2857 #define sk_X509_NAME_pop_free(sk, free_func)             \
2858   sk_pop_free(                                           \
2859       CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk), \
2860       CHECKED_CAST(void (*)(void *), void (*)(X509_NAME *), free_func))
2861 
2862 #define sk_X509_NAME_insert(sk, p, where)                      \
2863   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk), \
2864             CHECKED_CAST(void *, X509_NAME *, p), (where))
2865 
2866 #define sk_X509_NAME_delete(sk, where)                                       \
2867   ((X509_NAME *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk), \
2868                           (where)))
2869 
2870 #define sk_X509_NAME_delete_ptr(sk, p)                   \
2871   ((X509_NAME *)sk_delete_ptr(                           \
2872       CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk), \
2873       CHECKED_CAST(void *, X509_NAME *, p)))
2874 
2875 #define sk_X509_NAME_find(sk, out_index, p)                               \
2876   sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk), (out_index), \
2877           CHECKED_CAST(void *, X509_NAME *, p))
2878 
2879 #define sk_X509_NAME_shift(sk) \
2880   ((X509_NAME *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk)))
2881 
2882 #define sk_X509_NAME_push(sk, p)                             \
2883   sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk), \
2884           CHECKED_CAST(void *, X509_NAME *, p))
2885 
2886 #define sk_X509_NAME_pop(sk) \
2887   ((X509_NAME *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk)))
2888 
2889 #define sk_X509_NAME_dup(sk)      \
2890   ((STACK_OF(X509_NAME) *)sk_dup( \
2891       CHECKED_CAST(_STACK *, const STACK_OF(X509_NAME) *, sk)))
2892 
2893 #define sk_X509_NAME_sort(sk) \
2894   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk))
2895 
2896 #define sk_X509_NAME_is_sorted(sk) \
2897   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_NAME) *, sk))
2898 
2899 #define sk_X509_NAME_set_cmp_func(sk, comp)                            \
2900   ((int (*)(const X509_NAME **a, const X509_NAME **b))sk_set_cmp_func( \
2901       CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk),               \
2902       CHECKED_CAST(stack_cmp_func,                                     \
2903                    int (*)(const X509_NAME **a, const X509_NAME **b), comp)))
2904 
2905 #define sk_X509_NAME_deep_copy(sk, copy_func, free_func)                       \
2906   ((STACK_OF(X509_NAME) *)sk_deep_copy(                                        \
2907       CHECKED_CAST(const _STACK *, const STACK_OF(X509_NAME) *, sk),           \
2908       CHECKED_CAST(void *(*)(void *), X509_NAME *(*)(X509_NAME *), copy_func), \
2909       CHECKED_CAST(void (*)(void *), void (*)(X509_NAME *), free_func)))
2910 
2911 /* X509_NAME_ENTRY */
2912 #define sk_X509_NAME_ENTRY_new(comp)                 \
2913   ((STACK_OF(X509_NAME_ENTRY) *)sk_new(CHECKED_CAST( \
2914       stack_cmp_func,                                \
2915       int (*)(const X509_NAME_ENTRY **a, const X509_NAME_ENTRY **b), comp)))
2916 
2917 #define sk_X509_NAME_ENTRY_new_null() \
2918   ((STACK_OF(X509_NAME_ENTRY) *)sk_new_null())
2919 
2920 #define sk_X509_NAME_ENTRY_num(sk) \
2921   sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk))
2922 
2923 #define sk_X509_NAME_ENTRY_zero(sk) \
2924   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk));
2925 
2926 #define sk_X509_NAME_ENTRY_value(sk, i) \
2927   ((X509_NAME_ENTRY *)sk_value(         \
2928       CHECKED_CAST(_STACK *, const STACK_OF(X509_NAME_ENTRY) *, sk), (i)))
2929 
2930 #define sk_X509_NAME_ENTRY_set(sk, i, p)                            \
2931   ((X509_NAME_ENTRY *)sk_set(                                       \
2932       CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk), (i), \
2933       CHECKED_CAST(void *, X509_NAME_ENTRY *, p)))
2934 
2935 #define sk_X509_NAME_ENTRY_free(sk) \
2936   sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk))
2937 
2938 #define sk_X509_NAME_ENTRY_pop_free(sk, free_func)             \
2939   sk_pop_free(                                                 \
2940       CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk), \
2941       CHECKED_CAST(void (*)(void *), void (*)(X509_NAME_ENTRY *), free_func))
2942 
2943 #define sk_X509_NAME_ENTRY_insert(sk, p, where)                      \
2944   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk), \
2945             CHECKED_CAST(void *, X509_NAME_ENTRY *, p), (where))
2946 
2947 #define sk_X509_NAME_ENTRY_delete(sk, where) \
2948   ((X509_NAME_ENTRY *)sk_delete(             \
2949       CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk), (where)))
2950 
2951 #define sk_X509_NAME_ENTRY_delete_ptr(sk, p)                   \
2952   ((X509_NAME_ENTRY *)sk_delete_ptr(                           \
2953       CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk), \
2954       CHECKED_CAST(void *, X509_NAME_ENTRY *, p)))
2955 
2956 #define sk_X509_NAME_ENTRY_find(sk, out_index, p)                  \
2957   sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk), \
2958           (out_index), CHECKED_CAST(void *, X509_NAME_ENTRY *, p))
2959 
2960 #define sk_X509_NAME_ENTRY_shift(sk) \
2961   ((X509_NAME_ENTRY *)sk_shift(      \
2962       CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk)))
2963 
2964 #define sk_X509_NAME_ENTRY_push(sk, p)                             \
2965   sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk), \
2966           CHECKED_CAST(void *, X509_NAME_ENTRY *, p))
2967 
2968 #define sk_X509_NAME_ENTRY_pop(sk) \
2969   ((X509_NAME_ENTRY *)sk_pop(      \
2970       CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk)))
2971 
2972 #define sk_X509_NAME_ENTRY_dup(sk)      \
2973   ((STACK_OF(X509_NAME_ENTRY) *)sk_dup( \
2974       CHECKED_CAST(_STACK *, const STACK_OF(X509_NAME_ENTRY) *, sk)))
2975 
2976 #define sk_X509_NAME_ENTRY_sort(sk) \
2977   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk))
2978 
2979 #define sk_X509_NAME_ENTRY_is_sorted(sk) \
2980   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_NAME_ENTRY) *, sk))
2981 
2982 #define sk_X509_NAME_ENTRY_set_cmp_func(sk, comp)                           \
2983   ((int (*)(const X509_NAME_ENTRY **a, const X509_NAME_ENTRY **b))          \
2984        sk_set_cmp_func(                                                     \
2985            CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk),         \
2986            CHECKED_CAST(stack_cmp_func, int (*)(const X509_NAME_ENTRY **a,  \
2987                                                 const X509_NAME_ENTRY **b), \
2988                         comp)))
2989 
2990 #define sk_X509_NAME_ENTRY_deep_copy(sk, copy_func, free_func)                 \
2991   ((STACK_OF(X509_NAME_ENTRY) *)sk_deep_copy(                                  \
2992       CHECKED_CAST(const _STACK *, const STACK_OF(X509_NAME_ENTRY) *, sk),     \
2993       CHECKED_CAST(void *(*)(void *), X509_NAME_ENTRY *(*)(X509_NAME_ENTRY *), \
2994                    copy_func),                                                 \
2995       CHECKED_CAST(void (*)(void *), void (*)(X509_NAME_ENTRY *), free_func)))
2996 
2997 /* X509_OBJECT */
2998 #define sk_X509_OBJECT_new(comp)                                             \
2999   ((STACK_OF(X509_OBJECT) *)sk_new(CHECKED_CAST(                             \
3000       stack_cmp_func, int (*)(const X509_OBJECT **a, const X509_OBJECT **b), \
3001       comp)))
3002 
3003 #define sk_X509_OBJECT_new_null() ((STACK_OF(X509_OBJECT) *)sk_new_null())
3004 
3005 #define sk_X509_OBJECT_num(sk) \
3006   sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk))
3007 
3008 #define sk_X509_OBJECT_zero(sk) \
3009   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk));
3010 
3011 #define sk_X509_OBJECT_value(sk, i) \
3012   ((X509_OBJECT *)sk_value(         \
3013       CHECKED_CAST(_STACK *, const STACK_OF(X509_OBJECT) *, sk), (i)))
3014 
3015 #define sk_X509_OBJECT_set(sk, i, p)                                          \
3016   ((X509_OBJECT *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk), \
3017                          (i), CHECKED_CAST(void *, X509_OBJECT *, p)))
3018 
3019 #define sk_X509_OBJECT_free(sk) \
3020   sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk))
3021 
3022 #define sk_X509_OBJECT_pop_free(sk, free_func)             \
3023   sk_pop_free(                                             \
3024       CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk), \
3025       CHECKED_CAST(void (*)(void *), void (*)(X509_OBJECT *), free_func))
3026 
3027 #define sk_X509_OBJECT_insert(sk, p, where)                      \
3028   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk), \
3029             CHECKED_CAST(void *, X509_OBJECT *, p), (where))
3030 
3031 #define sk_X509_OBJECT_delete(sk, where) \
3032   ((X509_OBJECT *)sk_delete(             \
3033       CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk), (where)))
3034 
3035 #define sk_X509_OBJECT_delete_ptr(sk, p)                   \
3036   ((X509_OBJECT *)sk_delete_ptr(                           \
3037       CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk), \
3038       CHECKED_CAST(void *, X509_OBJECT *, p)))
3039 
3040 #define sk_X509_OBJECT_find(sk, out_index, p)                               \
3041   sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk), (out_index), \
3042           CHECKED_CAST(void *, X509_OBJECT *, p))
3043 
3044 #define sk_X509_OBJECT_shift(sk) \
3045   ((X509_OBJECT *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk)))
3046 
3047 #define sk_X509_OBJECT_push(sk, p)                             \
3048   sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk), \
3049           CHECKED_CAST(void *, X509_OBJECT *, p))
3050 
3051 #define sk_X509_OBJECT_pop(sk) \
3052   ((X509_OBJECT *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk)))
3053 
3054 #define sk_X509_OBJECT_dup(sk)      \
3055   ((STACK_OF(X509_OBJECT) *)sk_dup( \
3056       CHECKED_CAST(_STACK *, const STACK_OF(X509_OBJECT) *, sk)))
3057 
3058 #define sk_X509_OBJECT_sort(sk) \
3059   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk))
3060 
3061 #define sk_X509_OBJECT_is_sorted(sk) \
3062   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_OBJECT) *, sk))
3063 
3064 #define sk_X509_OBJECT_set_cmp_func(sk, comp)                              \
3065   ((int (*)(const X509_OBJECT **a, const X509_OBJECT **b))sk_set_cmp_func( \
3066       CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk),                 \
3067       CHECKED_CAST(stack_cmp_func,                                         \
3068                    int (*)(const X509_OBJECT **a, const X509_OBJECT **b),  \
3069                    comp)))
3070 
3071 #define sk_X509_OBJECT_deep_copy(sk, copy_func, free_func)             \
3072   ((STACK_OF(X509_OBJECT) *)sk_deep_copy(                              \
3073       CHECKED_CAST(const _STACK *, const STACK_OF(X509_OBJECT) *, sk), \
3074       CHECKED_CAST(void *(*)(void *), X509_OBJECT *(*)(X509_OBJECT *), \
3075                    copy_func),                                         \
3076       CHECKED_CAST(void (*)(void *), void (*)(X509_OBJECT *), free_func)))
3077 
3078 /* X509_POLICY_DATA */
3079 #define sk_X509_POLICY_DATA_new(comp)                 \
3080   ((STACK_OF(X509_POLICY_DATA) *)sk_new(CHECKED_CAST( \
3081       stack_cmp_func,                                 \
3082       int (*)(const X509_POLICY_DATA **a, const X509_POLICY_DATA **b), comp)))
3083 
3084 #define sk_X509_POLICY_DATA_new_null() \
3085   ((STACK_OF(X509_POLICY_DATA) *)sk_new_null())
3086 
3087 #define sk_X509_POLICY_DATA_num(sk) \
3088   sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk))
3089 
3090 #define sk_X509_POLICY_DATA_zero(sk) \
3091   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk));
3092 
3093 #define sk_X509_POLICY_DATA_value(sk, i) \
3094   ((X509_POLICY_DATA *)sk_value(         \
3095       CHECKED_CAST(_STACK *, const STACK_OF(X509_POLICY_DATA) *, sk), (i)))
3096 
3097 #define sk_X509_POLICY_DATA_set(sk, i, p)                            \
3098   ((X509_POLICY_DATA *)sk_set(                                       \
3099       CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk), (i), \
3100       CHECKED_CAST(void *, X509_POLICY_DATA *, p)))
3101 
3102 #define sk_X509_POLICY_DATA_free(sk) \
3103   sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk))
3104 
3105 #define sk_X509_POLICY_DATA_pop_free(sk, free_func)             \
3106   sk_pop_free(                                                  \
3107       CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk), \
3108       CHECKED_CAST(void (*)(void *), void (*)(X509_POLICY_DATA *), free_func))
3109 
3110 #define sk_X509_POLICY_DATA_insert(sk, p, where)                      \
3111   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk), \
3112             CHECKED_CAST(void *, X509_POLICY_DATA *, p), (where))
3113 
3114 #define sk_X509_POLICY_DATA_delete(sk, where) \
3115   ((X509_POLICY_DATA *)sk_delete(             \
3116       CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk), (where)))
3117 
3118 #define sk_X509_POLICY_DATA_delete_ptr(sk, p)                   \
3119   ((X509_POLICY_DATA *)sk_delete_ptr(                           \
3120       CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk), \
3121       CHECKED_CAST(void *, X509_POLICY_DATA *, p)))
3122 
3123 #define sk_X509_POLICY_DATA_find(sk, out_index, p)                  \
3124   sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk), \
3125           (out_index), CHECKED_CAST(void *, X509_POLICY_DATA *, p))
3126 
3127 #define sk_X509_POLICY_DATA_shift(sk) \
3128   ((X509_POLICY_DATA *)sk_shift(      \
3129       CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk)))
3130 
3131 #define sk_X509_POLICY_DATA_push(sk, p)                             \
3132   sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk), \
3133           CHECKED_CAST(void *, X509_POLICY_DATA *, p))
3134 
3135 #define sk_X509_POLICY_DATA_pop(sk) \
3136   ((X509_POLICY_DATA *)sk_pop(      \
3137       CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk)))
3138 
3139 #define sk_X509_POLICY_DATA_dup(sk)      \
3140   ((STACK_OF(X509_POLICY_DATA) *)sk_dup( \
3141       CHECKED_CAST(_STACK *, const STACK_OF(X509_POLICY_DATA) *, sk)))
3142 
3143 #define sk_X509_POLICY_DATA_sort(sk) \
3144   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk))
3145 
3146 #define sk_X509_POLICY_DATA_is_sorted(sk) \
3147   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_POLICY_DATA) *, sk))
3148 
3149 #define sk_X509_POLICY_DATA_set_cmp_func(sk, comp)                           \
3150   ((int (*)(const X509_POLICY_DATA **a, const X509_POLICY_DATA **b))         \
3151        sk_set_cmp_func(                                                      \
3152            CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk),         \
3153            CHECKED_CAST(stack_cmp_func, int (*)(const X509_POLICY_DATA **a,  \
3154                                                 const X509_POLICY_DATA **b), \
3155                         comp)))
3156 
3157 #define sk_X509_POLICY_DATA_deep_copy(sk, copy_func, free_func)             \
3158   ((STACK_OF(X509_POLICY_DATA) *)sk_deep_copy(                              \
3159       CHECKED_CAST(const _STACK *, const STACK_OF(X509_POLICY_DATA) *, sk), \
3160       CHECKED_CAST(void *(*)(void *),                                       \
3161                    X509_POLICY_DATA *(*)(X509_POLICY_DATA *), copy_func),   \
3162       CHECKED_CAST(void (*)(void *), void (*)(X509_POLICY_DATA *),          \
3163                    free_func)))
3164 
3165 /* X509_POLICY_NODE */
3166 #define sk_X509_POLICY_NODE_new(comp)                 \
3167   ((STACK_OF(X509_POLICY_NODE) *)sk_new(CHECKED_CAST( \
3168       stack_cmp_func,                                 \
3169       int (*)(const X509_POLICY_NODE **a, const X509_POLICY_NODE **b), comp)))
3170 
3171 #define sk_X509_POLICY_NODE_new_null() \
3172   ((STACK_OF(X509_POLICY_NODE) *)sk_new_null())
3173 
3174 #define sk_X509_POLICY_NODE_num(sk) \
3175   sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk))
3176 
3177 #define sk_X509_POLICY_NODE_zero(sk) \
3178   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk));
3179 
3180 #define sk_X509_POLICY_NODE_value(sk, i) \
3181   ((X509_POLICY_NODE *)sk_value(         \
3182       CHECKED_CAST(_STACK *, const STACK_OF(X509_POLICY_NODE) *, sk), (i)))
3183 
3184 #define sk_X509_POLICY_NODE_set(sk, i, p)                            \
3185   ((X509_POLICY_NODE *)sk_set(                                       \
3186       CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk), (i), \
3187       CHECKED_CAST(void *, X509_POLICY_NODE *, p)))
3188 
3189 #define sk_X509_POLICY_NODE_free(sk) \
3190   sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk))
3191 
3192 #define sk_X509_POLICY_NODE_pop_free(sk, free_func)             \
3193   sk_pop_free(                                                  \
3194       CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk), \
3195       CHECKED_CAST(void (*)(void *), void (*)(X509_POLICY_NODE *), free_func))
3196 
3197 #define sk_X509_POLICY_NODE_insert(sk, p, where)                      \
3198   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk), \
3199             CHECKED_CAST(void *, X509_POLICY_NODE *, p), (where))
3200 
3201 #define sk_X509_POLICY_NODE_delete(sk, where) \
3202   ((X509_POLICY_NODE *)sk_delete(             \
3203       CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk), (where)))
3204 
3205 #define sk_X509_POLICY_NODE_delete_ptr(sk, p)                   \
3206   ((X509_POLICY_NODE *)sk_delete_ptr(                           \
3207       CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk), \
3208       CHECKED_CAST(void *, X509_POLICY_NODE *, p)))
3209 
3210 #define sk_X509_POLICY_NODE_find(sk, out_index, p)                  \
3211   sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk), \
3212           (out_index), CHECKED_CAST(void *, X509_POLICY_NODE *, p))
3213 
3214 #define sk_X509_POLICY_NODE_shift(sk) \
3215   ((X509_POLICY_NODE *)sk_shift(      \
3216       CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk)))
3217 
3218 #define sk_X509_POLICY_NODE_push(sk, p)                             \
3219   sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk), \
3220           CHECKED_CAST(void *, X509_POLICY_NODE *, p))
3221 
3222 #define sk_X509_POLICY_NODE_pop(sk) \
3223   ((X509_POLICY_NODE *)sk_pop(      \
3224       CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk)))
3225 
3226 #define sk_X509_POLICY_NODE_dup(sk)      \
3227   ((STACK_OF(X509_POLICY_NODE) *)sk_dup( \
3228       CHECKED_CAST(_STACK *, const STACK_OF(X509_POLICY_NODE) *, sk)))
3229 
3230 #define sk_X509_POLICY_NODE_sort(sk) \
3231   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk))
3232 
3233 #define sk_X509_POLICY_NODE_is_sorted(sk) \
3234   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_POLICY_NODE) *, sk))
3235 
3236 #define sk_X509_POLICY_NODE_set_cmp_func(sk, comp)                           \
3237   ((int (*)(const X509_POLICY_NODE **a, const X509_POLICY_NODE **b))         \
3238        sk_set_cmp_func(                                                      \
3239            CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk),         \
3240            CHECKED_CAST(stack_cmp_func, int (*)(const X509_POLICY_NODE **a,  \
3241                                                 const X509_POLICY_NODE **b), \
3242                         comp)))
3243 
3244 #define sk_X509_POLICY_NODE_deep_copy(sk, copy_func, free_func)             \
3245   ((STACK_OF(X509_POLICY_NODE) *)sk_deep_copy(                              \
3246       CHECKED_CAST(const _STACK *, const STACK_OF(X509_POLICY_NODE) *, sk), \
3247       CHECKED_CAST(void *(*)(void *),                                       \
3248                    X509_POLICY_NODE *(*)(X509_POLICY_NODE *), copy_func),   \
3249       CHECKED_CAST(void (*)(void *), void (*)(X509_POLICY_NODE *),          \
3250                    free_func)))
3251 
3252 /* X509_PURPOSE */
3253 #define sk_X509_PURPOSE_new(comp)                                              \
3254   ((STACK_OF(X509_PURPOSE) *)sk_new(CHECKED_CAST(                              \
3255       stack_cmp_func, int (*)(const X509_PURPOSE **a, const X509_PURPOSE **b), \
3256       comp)))
3257 
3258 #define sk_X509_PURPOSE_new_null() ((STACK_OF(X509_PURPOSE) *)sk_new_null())
3259 
3260 #define sk_X509_PURPOSE_num(sk) \
3261   sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk))
3262 
3263 #define sk_X509_PURPOSE_zero(sk) \
3264   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk));
3265 
3266 #define sk_X509_PURPOSE_value(sk, i) \
3267   ((X509_PURPOSE *)sk_value(         \
3268       CHECKED_CAST(_STACK *, const STACK_OF(X509_PURPOSE) *, sk), (i)))
3269 
3270 #define sk_X509_PURPOSE_set(sk, i, p)                            \
3271   ((X509_PURPOSE *)sk_set(                                       \
3272       CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk), (i), \
3273       CHECKED_CAST(void *, X509_PURPOSE *, p)))
3274 
3275 #define sk_X509_PURPOSE_free(sk) \
3276   sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk))
3277 
3278 #define sk_X509_PURPOSE_pop_free(sk, free_func)             \
3279   sk_pop_free(                                              \
3280       CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk), \
3281       CHECKED_CAST(void (*)(void *), void (*)(X509_PURPOSE *), free_func))
3282 
3283 #define sk_X509_PURPOSE_insert(sk, p, where)                      \
3284   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk), \
3285             CHECKED_CAST(void *, X509_PURPOSE *, p), (where))
3286 
3287 #define sk_X509_PURPOSE_delete(sk, where) \
3288   ((X509_PURPOSE *)sk_delete(             \
3289       CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk), (where)))
3290 
3291 #define sk_X509_PURPOSE_delete_ptr(sk, p)                   \
3292   ((X509_PURPOSE *)sk_delete_ptr(                           \
3293       CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk), \
3294       CHECKED_CAST(void *, X509_PURPOSE *, p)))
3295 
3296 #define sk_X509_PURPOSE_find(sk, out_index, p)                               \
3297   sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk), (out_index), \
3298           CHECKED_CAST(void *, X509_PURPOSE *, p))
3299 
3300 #define sk_X509_PURPOSE_shift(sk) \
3301   ((X509_PURPOSE *)sk_shift(      \
3302       CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk)))
3303 
3304 #define sk_X509_PURPOSE_push(sk, p)                             \
3305   sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk), \
3306           CHECKED_CAST(void *, X509_PURPOSE *, p))
3307 
3308 #define sk_X509_PURPOSE_pop(sk) \
3309   ((X509_PURPOSE *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk)))
3310 
3311 #define sk_X509_PURPOSE_dup(sk)      \
3312   ((STACK_OF(X509_PURPOSE) *)sk_dup( \
3313       CHECKED_CAST(_STACK *, const STACK_OF(X509_PURPOSE) *, sk)))
3314 
3315 #define sk_X509_PURPOSE_sort(sk) \
3316   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk))
3317 
3318 #define sk_X509_PURPOSE_is_sorted(sk) \
3319   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_PURPOSE) *, sk))
3320 
3321 #define sk_X509_PURPOSE_set_cmp_func(sk, comp)                               \
3322   ((int (*)(const X509_PURPOSE **a, const X509_PURPOSE **b))sk_set_cmp_func( \
3323       CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk),                  \
3324       CHECKED_CAST(stack_cmp_func,                                           \
3325                    int (*)(const X509_PURPOSE **a, const X509_PURPOSE **b),  \
3326                    comp)))
3327 
3328 #define sk_X509_PURPOSE_deep_copy(sk, copy_func, free_func)              \
3329   ((STACK_OF(X509_PURPOSE) *)sk_deep_copy(                               \
3330       CHECKED_CAST(const _STACK *, const STACK_OF(X509_PURPOSE) *, sk),  \
3331       CHECKED_CAST(void *(*)(void *), X509_PURPOSE *(*)(X509_PURPOSE *), \
3332                    copy_func),                                           \
3333       CHECKED_CAST(void (*)(void *), void (*)(X509_PURPOSE *), free_func)))
3334 
3335 /* X509_REVOKED */
3336 #define sk_X509_REVOKED_new(comp)                                              \
3337   ((STACK_OF(X509_REVOKED) *)sk_new(CHECKED_CAST(                              \
3338       stack_cmp_func, int (*)(const X509_REVOKED **a, const X509_REVOKED **b), \
3339       comp)))
3340 
3341 #define sk_X509_REVOKED_new_null() ((STACK_OF(X509_REVOKED) *)sk_new_null())
3342 
3343 #define sk_X509_REVOKED_num(sk) \
3344   sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk))
3345 
3346 #define sk_X509_REVOKED_zero(sk) \
3347   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk));
3348 
3349 #define sk_X509_REVOKED_value(sk, i) \
3350   ((X509_REVOKED *)sk_value(         \
3351       CHECKED_CAST(_STACK *, const STACK_OF(X509_REVOKED) *, sk), (i)))
3352 
3353 #define sk_X509_REVOKED_set(sk, i, p)                            \
3354   ((X509_REVOKED *)sk_set(                                       \
3355       CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk), (i), \
3356       CHECKED_CAST(void *, X509_REVOKED *, p)))
3357 
3358 #define sk_X509_REVOKED_free(sk) \
3359   sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk))
3360 
3361 #define sk_X509_REVOKED_pop_free(sk, free_func)             \
3362   sk_pop_free(                                              \
3363       CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk), \
3364       CHECKED_CAST(void (*)(void *), void (*)(X509_REVOKED *), free_func))
3365 
3366 #define sk_X509_REVOKED_insert(sk, p, where)                      \
3367   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk), \
3368             CHECKED_CAST(void *, X509_REVOKED *, p), (where))
3369 
3370 #define sk_X509_REVOKED_delete(sk, where) \
3371   ((X509_REVOKED *)sk_delete(             \
3372       CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk), (where)))
3373 
3374 #define sk_X509_REVOKED_delete_ptr(sk, p)                   \
3375   ((X509_REVOKED *)sk_delete_ptr(                           \
3376       CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk), \
3377       CHECKED_CAST(void *, X509_REVOKED *, p)))
3378 
3379 #define sk_X509_REVOKED_find(sk, out_index, p)                               \
3380   sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk), (out_index), \
3381           CHECKED_CAST(void *, X509_REVOKED *, p))
3382 
3383 #define sk_X509_REVOKED_shift(sk) \
3384   ((X509_REVOKED *)sk_shift(      \
3385       CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk)))
3386 
3387 #define sk_X509_REVOKED_push(sk, p)                             \
3388   sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk), \
3389           CHECKED_CAST(void *, X509_REVOKED *, p))
3390 
3391 #define sk_X509_REVOKED_pop(sk) \
3392   ((X509_REVOKED *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk)))
3393 
3394 #define sk_X509_REVOKED_dup(sk)      \
3395   ((STACK_OF(X509_REVOKED) *)sk_dup( \
3396       CHECKED_CAST(_STACK *, const STACK_OF(X509_REVOKED) *, sk)))
3397 
3398 #define sk_X509_REVOKED_sort(sk) \
3399   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk))
3400 
3401 #define sk_X509_REVOKED_is_sorted(sk) \
3402   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_REVOKED) *, sk))
3403 
3404 #define sk_X509_REVOKED_set_cmp_func(sk, comp)                               \
3405   ((int (*)(const X509_REVOKED **a, const X509_REVOKED **b))sk_set_cmp_func( \
3406       CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk),                  \
3407       CHECKED_CAST(stack_cmp_func,                                           \
3408                    int (*)(const X509_REVOKED **a, const X509_REVOKED **b),  \
3409                    comp)))
3410 
3411 #define sk_X509_REVOKED_deep_copy(sk, copy_func, free_func)              \
3412   ((STACK_OF(X509_REVOKED) *)sk_deep_copy(                               \
3413       CHECKED_CAST(const _STACK *, const STACK_OF(X509_REVOKED) *, sk),  \
3414       CHECKED_CAST(void *(*)(void *), X509_REVOKED *(*)(X509_REVOKED *), \
3415                    copy_func),                                           \
3416       CHECKED_CAST(void (*)(void *), void (*)(X509_REVOKED *), free_func)))
3417 
3418 /* X509_TRUST */
3419 #define sk_X509_TRUST_new(comp)                                            \
3420   ((STACK_OF(X509_TRUST) *)sk_new(CHECKED_CAST(                            \
3421       stack_cmp_func, int (*)(const X509_TRUST **a, const X509_TRUST **b), \
3422       comp)))
3423 
3424 #define sk_X509_TRUST_new_null() ((STACK_OF(X509_TRUST) *)sk_new_null())
3425 
3426 #define sk_X509_TRUST_num(sk) \
3427   sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk))
3428 
3429 #define sk_X509_TRUST_zero(sk) \
3430   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk));
3431 
3432 #define sk_X509_TRUST_value(sk, i) \
3433   ((X509_TRUST *)sk_value(         \
3434       CHECKED_CAST(_STACK *, const STACK_OF(X509_TRUST) *, sk), (i)))
3435 
3436 #define sk_X509_TRUST_set(sk, i, p)                                         \
3437   ((X509_TRUST *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk), \
3438                         (i), CHECKED_CAST(void *, X509_TRUST *, p)))
3439 
3440 #define sk_X509_TRUST_free(sk) \
3441   sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk))
3442 
3443 #define sk_X509_TRUST_pop_free(sk, free_func)             \
3444   sk_pop_free(                                            \
3445       CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk), \
3446       CHECKED_CAST(void (*)(void *), void (*)(X509_TRUST *), free_func))
3447 
3448 #define sk_X509_TRUST_insert(sk, p, where)                      \
3449   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk), \
3450             CHECKED_CAST(void *, X509_TRUST *, p), (where))
3451 
3452 #define sk_X509_TRUST_delete(sk, where)                                        \
3453   ((X509_TRUST *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk), \
3454                            (where)))
3455 
3456 #define sk_X509_TRUST_delete_ptr(sk, p)                   \
3457   ((X509_TRUST *)sk_delete_ptr(                           \
3458       CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk), \
3459       CHECKED_CAST(void *, X509_TRUST *, p)))
3460 
3461 #define sk_X509_TRUST_find(sk, out_index, p)                               \
3462   sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk), (out_index), \
3463           CHECKED_CAST(void *, X509_TRUST *, p))
3464 
3465 #define sk_X509_TRUST_shift(sk) \
3466   ((X509_TRUST *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk)))
3467 
3468 #define sk_X509_TRUST_push(sk, p)                             \
3469   sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk), \
3470           CHECKED_CAST(void *, X509_TRUST *, p))
3471 
3472 #define sk_X509_TRUST_pop(sk) \
3473   ((X509_TRUST *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk)))
3474 
3475 #define sk_X509_TRUST_dup(sk)      \
3476   ((STACK_OF(X509_TRUST) *)sk_dup( \
3477       CHECKED_CAST(_STACK *, const STACK_OF(X509_TRUST) *, sk)))
3478 
3479 #define sk_X509_TRUST_sort(sk) \
3480   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk))
3481 
3482 #define sk_X509_TRUST_is_sorted(sk) \
3483   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_TRUST) *, sk))
3484 
3485 #define sk_X509_TRUST_set_cmp_func(sk, comp)                             \
3486   ((int (*)(const X509_TRUST **a, const X509_TRUST **b))sk_set_cmp_func( \
3487       CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk),                \
3488       CHECKED_CAST(stack_cmp_func,                                       \
3489                    int (*)(const X509_TRUST **a, const X509_TRUST **b),  \
3490                    comp)))
3491 
3492 #define sk_X509_TRUST_deep_copy(sk, copy_func, free_func)             \
3493   ((STACK_OF(X509_TRUST) *)sk_deep_copy(                              \
3494       CHECKED_CAST(const _STACK *, const STACK_OF(X509_TRUST) *, sk), \
3495       CHECKED_CAST(void *(*)(void *), X509_TRUST *(*)(X509_TRUST *),  \
3496                    copy_func),                                        \
3497       CHECKED_CAST(void (*)(void *), void (*)(X509_TRUST *), free_func)))
3498 
3499 /* X509_VERIFY_PARAM */
3500 #define sk_X509_VERIFY_PARAM_new(comp)                                   \
3501   ((STACK_OF(X509_VERIFY_PARAM) *)sk_new(CHECKED_CAST(                   \
3502       stack_cmp_func,                                                    \
3503       int (*)(const X509_VERIFY_PARAM **a, const X509_VERIFY_PARAM **b), \
3504       comp)))
3505 
3506 #define sk_X509_VERIFY_PARAM_new_null() \
3507   ((STACK_OF(X509_VERIFY_PARAM) *)sk_new_null())
3508 
3509 #define sk_X509_VERIFY_PARAM_num(sk) \
3510   sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk))
3511 
3512 #define sk_X509_VERIFY_PARAM_zero(sk) \
3513   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk));
3514 
3515 #define sk_X509_VERIFY_PARAM_value(sk, i) \
3516   ((X509_VERIFY_PARAM *)sk_value(         \
3517       CHECKED_CAST(_STACK *, const STACK_OF(X509_VERIFY_PARAM) *, sk), (i)))
3518 
3519 #define sk_X509_VERIFY_PARAM_set(sk, i, p)                            \
3520   ((X509_VERIFY_PARAM *)sk_set(                                       \
3521       CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk), (i), \
3522       CHECKED_CAST(void *, X509_VERIFY_PARAM *, p)))
3523 
3524 #define sk_X509_VERIFY_PARAM_free(sk) \
3525   sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk))
3526 
3527 #define sk_X509_VERIFY_PARAM_pop_free(sk, free_func)                        \
3528   sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk),    \
3529               CHECKED_CAST(void (*)(void *), void (*)(X509_VERIFY_PARAM *), \
3530                            free_func))
3531 
3532 #define sk_X509_VERIFY_PARAM_insert(sk, p, where)                      \
3533   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk), \
3534             CHECKED_CAST(void *, X509_VERIFY_PARAM *, p), (where))
3535 
3536 #define sk_X509_VERIFY_PARAM_delete(sk, where) \
3537   ((X509_VERIFY_PARAM *)sk_delete(             \
3538       CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk), (where)))
3539 
3540 #define sk_X509_VERIFY_PARAM_delete_ptr(sk, p)                   \
3541   ((X509_VERIFY_PARAM *)sk_delete_ptr(                           \
3542       CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk), \
3543       CHECKED_CAST(void *, X509_VERIFY_PARAM *, p)))
3544 
3545 #define sk_X509_VERIFY_PARAM_find(sk, out_index, p)                  \
3546   sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk), \
3547           (out_index), CHECKED_CAST(void *, X509_VERIFY_PARAM *, p))
3548 
3549 #define sk_X509_VERIFY_PARAM_shift(sk) \
3550   ((X509_VERIFY_PARAM *)sk_shift(      \
3551       CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk)))
3552 
3553 #define sk_X509_VERIFY_PARAM_push(sk, p)                             \
3554   sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk), \
3555           CHECKED_CAST(void *, X509_VERIFY_PARAM *, p))
3556 
3557 #define sk_X509_VERIFY_PARAM_pop(sk) \
3558   ((X509_VERIFY_PARAM *)sk_pop(      \
3559       CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk)))
3560 
3561 #define sk_X509_VERIFY_PARAM_dup(sk)      \
3562   ((STACK_OF(X509_VERIFY_PARAM) *)sk_dup( \
3563       CHECKED_CAST(_STACK *, const STACK_OF(X509_VERIFY_PARAM) *, sk)))
3564 
3565 #define sk_X509_VERIFY_PARAM_sort(sk) \
3566   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk))
3567 
3568 #define sk_X509_VERIFY_PARAM_is_sorted(sk) \
3569   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_VERIFY_PARAM) *, sk))
3570 
3571 #define sk_X509_VERIFY_PARAM_set_cmp_func(sk, comp)                           \
3572   ((int (*)(const X509_VERIFY_PARAM **a, const X509_VERIFY_PARAM **b))        \
3573        sk_set_cmp_func(                                                       \
3574            CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk),         \
3575            CHECKED_CAST(stack_cmp_func, int (*)(const X509_VERIFY_PARAM **a,  \
3576                                                 const X509_VERIFY_PARAM **b), \
3577                         comp)))
3578 
3579 #define sk_X509_VERIFY_PARAM_deep_copy(sk, copy_func, free_func)             \
3580   ((STACK_OF(X509_VERIFY_PARAM) *)sk_deep_copy(                              \
3581       CHECKED_CAST(const _STACK *, const STACK_OF(X509_VERIFY_PARAM) *, sk), \
3582       CHECKED_CAST(void *(*)(void *),                                        \
3583                    X509_VERIFY_PARAM *(*)(X509_VERIFY_PARAM *), copy_func),  \
3584       CHECKED_CAST(void (*)(void *), void (*)(X509_VERIFY_PARAM *),          \
3585                    free_func)))
3586 
3587 /* void */
3588 #define sk_void_new(comp)                \
3589   ((STACK_OF(void)*)sk_new(CHECKED_CAST( \
3590       stack_cmp_func, int (*)(const void **a, const void **b), comp)))
3591 
3592 #define sk_void_new_null() ((STACK_OF(void)*)sk_new_null())
3593 
3594 #define sk_void_num(sk) sk_num(CHECKED_CAST(_STACK *, STACK_OF(void)*, sk))
3595 
3596 #define sk_void_zero(sk) sk_zero(CHECKED_CAST(_STACK *, STACK_OF(void)*, sk));
3597 
3598 #define sk_void_value(sk, i) \
3599   ((void *)sk_value(CHECKED_CAST(_STACK *, const STACK_OF(void)*, sk), (i)))
3600 
3601 #define sk_void_set(sk, i, p)                                       \
3602   ((void *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(void)*, sk), (i), \
3603                   CHECKED_CAST(void *, void *, p)))
3604 
3605 #define sk_void_free(sk) sk_free(CHECKED_CAST(_STACK *, STACK_OF(void)*, sk))
3606 
3607 #define sk_void_pop_free(sk, free_func)                    \
3608   sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(void)*, sk), \
3609               CHECKED_CAST(void (*)(void *), void (*)(void *), free_func))
3610 
3611 #define sk_void_insert(sk, p, where)                     \
3612   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(void)*, sk), \
3613             CHECKED_CAST(void *, void *, p), (where))
3614 
3615 #define sk_void_delete(sk, where) \
3616   ((void *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(void)*, sk), (where)))
3617 
3618 #define sk_void_delete_ptr(sk, p)                                     \
3619   ((void *)sk_delete_ptr(CHECKED_CAST(_STACK *, STACK_OF(void)*, sk), \
3620                          CHECKED_CAST(void *, void *, p)))
3621 
3622 #define sk_void_find(sk, out_index, p)                              \
3623   sk_find(CHECKED_CAST(_STACK *, STACK_OF(void)*, sk), (out_index), \
3624           CHECKED_CAST(void *, void *, p))
3625 
3626 #define sk_void_shift(sk) \
3627   ((void *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(void)*, sk)))
3628 
3629 #define sk_void_push(sk, p)                            \
3630   sk_push(CHECKED_CAST(_STACK *, STACK_OF(void)*, sk), \
3631           CHECKED_CAST(void *, void *, p))
3632 
3633 #define sk_void_pop(sk) \
3634   ((void *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(void)*, sk)))
3635 
3636 #define sk_void_dup(sk) \
3637   ((STACK_OF(void)*)sk_dup(CHECKED_CAST(_STACK *, const STACK_OF(void)*, sk)))
3638 
3639 #define sk_void_sort(sk) sk_sort(CHECKED_CAST(_STACK *, STACK_OF(void)*, sk))
3640 
3641 #define sk_void_is_sorted(sk) \
3642   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(void)*, sk))
3643 
3644 #define sk_void_set_cmp_func(sk, comp)                                      \
3645   ((int (*)(const void **a, const void **b))sk_set_cmp_func(                \
3646       CHECKED_CAST(_STACK *, STACK_OF(void)*, sk),                          \
3647       CHECKED_CAST(stack_cmp_func, int (*)(const void **a, const void **b), \
3648                    comp)))
3649 
3650 #define sk_void_deep_copy(sk, copy_func, free_func)                  \
3651   ((STACK_OF(void)*)sk_deep_copy(                                    \
3652       CHECKED_CAST(const _STACK *, const STACK_OF(void)*, sk),       \
3653       CHECKED_CAST(void *(*)(void *), void *(*)(void *), copy_func), \
3654       CHECKED_CAST(void (*)(void *), void (*)(void *), free_func)))
3655 
3656 /* SRTP_PROTECTION_PROFILE */
3657 #define sk_SRTP_PROTECTION_PROFILE_new(comp)                            \
3658   ((STACK_OF(SRTP_PROTECTION_PROFILE) *)sk_new(CHECKED_CAST(            \
3659       stack_cmp_func, int (*)(const const SRTP_PROTECTION_PROFILE **a,  \
3660                               const const SRTP_PROTECTION_PROFILE **b), \
3661       comp)))
3662 
3663 #define sk_SRTP_PROTECTION_PROFILE_new_null() \
3664   ((STACK_OF(SRTP_PROTECTION_PROFILE) *)sk_new_null())
3665 
3666 #define sk_SRTP_PROTECTION_PROFILE_num(sk) \
3667   sk_num(CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk))
3668 
3669 #define sk_SRTP_PROTECTION_PROFILE_zero(sk) \
3670   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk));
3671 
3672 #define sk_SRTP_PROTECTION_PROFILE_value(sk, i)                              \
3673   ((const SRTP_PROTECTION_PROFILE *)sk_value(                                \
3674       CHECKED_CAST(_STACK *, const STACK_OF(SRTP_PROTECTION_PROFILE) *, sk), \
3675       (i)))
3676 
3677 #define sk_SRTP_PROTECTION_PROFILE_set(sk, i, p)                            \
3678   ((const SRTP_PROTECTION_PROFILE *)sk_set(                                 \
3679       CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk), (i), \
3680       CHECKED_CAST(void *, const SRTP_PROTECTION_PROFILE *, p)))
3681 
3682 #define sk_SRTP_PROTECTION_PROFILE_free(sk) \
3683   sk_free(CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk))
3684 
3685 #define sk_SRTP_PROTECTION_PROFILE_pop_free(sk, free_func)             \
3686   sk_pop_free(                                                         \
3687       CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk), \
3688       CHECKED_CAST(void (*)(void *),                                   \
3689                    void (*)(const SRTP_PROTECTION_PROFILE *), free_func))
3690 
3691 #define sk_SRTP_PROTECTION_PROFILE_insert(sk, p, where)                      \
3692   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk), \
3693             CHECKED_CAST(void *, const SRTP_PROTECTION_PROFILE *, p), (where))
3694 
3695 #define sk_SRTP_PROTECTION_PROFILE_delete(sk, where)                   \
3696   ((const SRTP_PROTECTION_PROFILE *)sk_delete(                         \
3697       CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk), \
3698       (where)))
3699 
3700 #define sk_SRTP_PROTECTION_PROFILE_delete_ptr(sk, p)                   \
3701   ((const SRTP_PROTECTION_PROFILE *)sk_delete_ptr(                     \
3702       CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk), \
3703       CHECKED_CAST(void *, const SRTP_PROTECTION_PROFILE *, p)))
3704 
3705 #define sk_SRTP_PROTECTION_PROFILE_find(sk, out_index, p)                  \
3706   sk_find(CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk), \
3707           (out_index),                                                     \
3708           CHECKED_CAST(void *, const SRTP_PROTECTION_PROFILE *, p))
3709 
3710 #define sk_SRTP_PROTECTION_PROFILE_shift(sk)  \
3711   ((const SRTP_PROTECTION_PROFILE *)sk_shift( \
3712       CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk)))
3713 
3714 #define sk_SRTP_PROTECTION_PROFILE_push(sk, p)                             \
3715   sk_push(CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk), \
3716           CHECKED_CAST(void *, const SRTP_PROTECTION_PROFILE *, p))
3717 
3718 #define sk_SRTP_PROTECTION_PROFILE_pop(sk)  \
3719   ((const SRTP_PROTECTION_PROFILE *)sk_pop( \
3720       CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk)))
3721 
3722 #define sk_SRTP_PROTECTION_PROFILE_dup(sk)      \
3723   ((STACK_OF(SRTP_PROTECTION_PROFILE) *)sk_dup( \
3724       CHECKED_CAST(_STACK *, const STACK_OF(SRTP_PROTECTION_PROFILE) *, sk)))
3725 
3726 #define sk_SRTP_PROTECTION_PROFILE_sort(sk) \
3727   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk))
3728 
3729 #define sk_SRTP_PROTECTION_PROFILE_is_sorted(sk) \
3730   sk_is_sorted(                                  \
3731       CHECKED_CAST(_STACK *, const STACK_OF(SRTP_PROTECTION_PROFILE) *, sk))
3732 
3733 #define sk_SRTP_PROTECTION_PROFILE_set_cmp_func(sk, comp)                   \
3734   ((int (*)(const SRTP_PROTECTION_PROFILE **a,                              \
3735             const SRTP_PROTECTION_PROFILE **b))                             \
3736        sk_set_cmp_func(                                                     \
3737            CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk), \
3738            CHECKED_CAST(stack_cmp_func,                                     \
3739                         int (*)(const SRTP_PROTECTION_PROFILE **a,          \
3740                                 const SRTP_PROTECTION_PROFILE **b),         \
3741                         comp)))
3742 
3743 #define sk_SRTP_PROTECTION_PROFILE_deep_copy(sk, copy_func, free_func)        \
3744   ((STACK_OF(SRTP_PROTECTION_PROFILE) *)sk_deep_copy(                         \
3745       CHECKED_CAST(const _STACK *, const STACK_OF(SRTP_PROTECTION_PROFILE) *, \
3746                    sk),                                                       \
3747       CHECKED_CAST(void *(*)(void *), const SRTP_PROTECTION_PROFILE *(*)(     \
3748                                           const SRTP_PROTECTION_PROFILE *),   \
3749                    copy_func),                                                \
3750       CHECKED_CAST(void (*)(void *),                                          \
3751                    void (*)(const SRTP_PROTECTION_PROFILE *), free_func)))
3752 
3753 /* SSL_CIPHER */
3754 #define sk_SSL_CIPHER_new(comp)                 \
3755   ((STACK_OF(SSL_CIPHER) *)sk_new(CHECKED_CAST( \
3756       stack_cmp_func,                           \
3757       int (*)(const const SSL_CIPHER **a, const const SSL_CIPHER **b), comp)))
3758 
3759 #define sk_SSL_CIPHER_new_null() ((STACK_OF(SSL_CIPHER) *)sk_new_null())
3760 
3761 #define sk_SSL_CIPHER_num(sk) \
3762   sk_num(CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk))
3763 
3764 #define sk_SSL_CIPHER_zero(sk) \
3765   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk));
3766 
3767 #define sk_SSL_CIPHER_value(sk, i) \
3768   ((const SSL_CIPHER *)sk_value(   \
3769       CHECKED_CAST(_STACK *, const STACK_OF(SSL_CIPHER) *, sk), (i)))
3770 
3771 #define sk_SSL_CIPHER_set(sk, i, p)                            \
3772   ((const SSL_CIPHER *)sk_set(                                 \
3773       CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk), (i), \
3774       CHECKED_CAST(void *, const SSL_CIPHER *, p)))
3775 
3776 #define sk_SSL_CIPHER_free(sk) \
3777   sk_free(CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk))
3778 
3779 #define sk_SSL_CIPHER_pop_free(sk, free_func)             \
3780   sk_pop_free(                                            \
3781       CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk), \
3782       CHECKED_CAST(void (*)(void *), void (*)(const SSL_CIPHER *), free_func))
3783 
3784 #define sk_SSL_CIPHER_insert(sk, p, where)                      \
3785   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk), \
3786             CHECKED_CAST(void *, const SSL_CIPHER *, p), (where))
3787 
3788 #define sk_SSL_CIPHER_delete(sk, where) \
3789   ((const SSL_CIPHER *)sk_delete(       \
3790       CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk), (where)))
3791 
3792 #define sk_SSL_CIPHER_delete_ptr(sk, p)                   \
3793   ((const SSL_CIPHER *)sk_delete_ptr(                     \
3794       CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk), \
3795       CHECKED_CAST(void *, const SSL_CIPHER *, p)))
3796 
3797 #define sk_SSL_CIPHER_find(sk, out_index, p)                               \
3798   sk_find(CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk), (out_index), \
3799           CHECKED_CAST(void *, const SSL_CIPHER *, p))
3800 
3801 #define sk_SSL_CIPHER_shift(sk)  \
3802   ((const SSL_CIPHER *)sk_shift( \
3803       CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk)))
3804 
3805 #define sk_SSL_CIPHER_push(sk, p)                             \
3806   sk_push(CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk), \
3807           CHECKED_CAST(void *, const SSL_CIPHER *, p))
3808 
3809 #define sk_SSL_CIPHER_pop(sk)  \
3810   ((const SSL_CIPHER *)sk_pop( \
3811       CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk)))
3812 
3813 #define sk_SSL_CIPHER_dup(sk)      \
3814   ((STACK_OF(SSL_CIPHER) *)sk_dup( \
3815       CHECKED_CAST(_STACK *, const STACK_OF(SSL_CIPHER) *, sk)))
3816 
3817 #define sk_SSL_CIPHER_sort(sk) \
3818   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk))
3819 
3820 #define sk_SSL_CIPHER_is_sorted(sk) \
3821   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(SSL_CIPHER) *, sk))
3822 
3823 #define sk_SSL_CIPHER_set_cmp_func(sk, comp)                             \
3824   ((int (*)(const SSL_CIPHER **a, const SSL_CIPHER **b))sk_set_cmp_func( \
3825       CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk),                \
3826       CHECKED_CAST(stack_cmp_func,                                       \
3827                    int (*)(const SSL_CIPHER **a, const SSL_CIPHER **b),  \
3828                    comp)))
3829 
3830 #define sk_SSL_CIPHER_deep_copy(sk, copy_func, free_func)                 \
3831   ((STACK_OF(SSL_CIPHER) *)sk_deep_copy(                                  \
3832       CHECKED_CAST(const _STACK *, const STACK_OF(SSL_CIPHER) *, sk),     \
3833       CHECKED_CAST(void *(*)(void *),                                     \
3834                    const SSL_CIPHER *(*)(const SSL_CIPHER *), copy_func), \
3835       CHECKED_CAST(void (*)(void *), void (*)(const SSL_CIPHER *),        \
3836                    free_func)))
3837 
3838 /* OPENSSL_STRING */
3839 #define sk_OPENSSL_STRING_new(comp)                 \
3840   ((STACK_OF(OPENSSL_STRING) *)sk_new(CHECKED_CAST( \
3841       stack_cmp_func,                               \
3842       int (*)(const OPENSSL_STRING *a, const OPENSSL_STRING *b), comp)))
3843 
3844 #define sk_OPENSSL_STRING_new_null() ((STACK_OF(OPENSSL_STRING) *)sk_new_null())
3845 
3846 #define sk_OPENSSL_STRING_num(sk) \
3847   sk_num(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk))
3848 
3849 #define sk_OPENSSL_STRING_zero(sk) \
3850   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk));
3851 
3852 #define sk_OPENSSL_STRING_value(sk, i) \
3853   ((OPENSSL_STRING)sk_value(           \
3854       CHECKED_CAST(_STACK *, const STACK_OF(OPENSSL_STRING) *, sk), (i)))
3855 
3856 #define sk_OPENSSL_STRING_set(sk, i, p)                            \
3857   ((OPENSSL_STRING)sk_set(                                         \
3858       CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk), (i), \
3859       CHECKED_CAST(void *, OPENSSL_STRING, p)))
3860 
3861 #define sk_OPENSSL_STRING_free(sk) \
3862   sk_free(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk))
3863 
3864 #define sk_OPENSSL_STRING_pop_free(sk, free_func)             \
3865   sk_pop_free(                                                \
3866       CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk), \
3867       CHECKED_CAST(void (*)(void *), void (*)(OPENSSL_STRING), free_func))
3868 
3869 #define sk_OPENSSL_STRING_insert(sk, p, where)                      \
3870   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk), \
3871             CHECKED_CAST(void *, OPENSSL_STRING, p), (where))
3872 
3873 #define sk_OPENSSL_STRING_delete(sk, where) \
3874   ((OPENSSL_STRING)sk_delete(               \
3875       CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk), (where)))
3876 
3877 #define sk_OPENSSL_STRING_delete_ptr(sk, p)                   \
3878   ((OPENSSL_STRING)sk_delete_ptr(                             \
3879       CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk), \
3880       CHECKED_CAST(void *, OPENSSL_STRING, p)))
3881 
3882 #define sk_OPENSSL_STRING_find(sk, out_index, p)                               \
3883   sk_find(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk), (out_index), \
3884           CHECKED_CAST(void *, OPENSSL_STRING, p))
3885 
3886 #define sk_OPENSSL_STRING_shift(sk) \
3887   ((OPENSSL_STRING)sk_shift(        \
3888       CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk)))
3889 
3890 #define sk_OPENSSL_STRING_push(sk, p)                             \
3891   sk_push(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk), \
3892           CHECKED_CAST(void *, OPENSSL_STRING, p))
3893 
3894 #define sk_OPENSSL_STRING_pop(sk) \
3895   ((OPENSSL_STRING)sk_pop(        \
3896       CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk)))
3897 
3898 #define sk_OPENSSL_STRING_dup(sk)      \
3899   ((STACK_OF(OPENSSL_STRING) *)sk_dup( \
3900       CHECKED_CAST(_STACK *, const STACK_OF(OPENSSL_STRING) *, sk)))
3901 
3902 #define sk_OPENSSL_STRING_sort(sk) \
3903   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk))
3904 
3905 #define sk_OPENSSL_STRING_is_sorted(sk) \
3906   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(OPENSSL_STRING) *, sk))
3907 
3908 #define sk_OPENSSL_STRING_set_cmp_func(sk, comp)                           \
3909   ((int (*)(const OPENSSL_STRING **a, const OPENSSL_STRING **b))           \
3910        sk_set_cmp_func(                                                    \
3911            CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk),         \
3912            CHECKED_CAST(stack_cmp_func, int (*)(const OPENSSL_STRING **a,  \
3913                                                 const OPENSSL_STRING **b), \
3914                         comp)))
3915 
3916 #define sk_OPENSSL_STRING_deep_copy(sk, copy_func, free_func)             \
3917   ((STACK_OF(OPENSSL_STRING) *)sk_deep_copy(                              \
3918       CHECKED_CAST(const _STACK *, const STACK_OF(OPENSSL_STRING) *, sk), \
3919       CHECKED_CAST(void *(*)(void *), OPENSSL_STRING (*)(OPENSSL_STRING), \
3920                    copy_func),                                            \
3921       CHECKED_CAST(void (*)(void *), void (*)(OPENSSL_STRING), free_func)))
3922 
3923 /* OPENSSL_BLOCK */
3924 #define sk_OPENSSL_BLOCK_new(comp)                                             \
3925   ((STACK_OF(OPENSSL_BLOCK) *)sk_new(CHECKED_CAST(                             \
3926       stack_cmp_func, int (*)(const OPENSSL_BLOCK *a, const OPENSSL_BLOCK *b), \
3927       comp)))
3928 
3929 #define sk_OPENSSL_BLOCK_new_null() ((STACK_OF(OPENSSL_BLOCK) *)sk_new_null())
3930 
3931 #define sk_OPENSSL_BLOCK_num(sk) \
3932   sk_num(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk))
3933 
3934 #define sk_OPENSSL_BLOCK_zero(sk) \
3935   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk));
3936 
3937 #define sk_OPENSSL_BLOCK_value(sk, i) \
3938   ((OPENSSL_BLOCK)sk_value(           \
3939       CHECKED_CAST(_STACK *, const STACK_OF(OPENSSL_BLOCK) *, sk), (i)))
3940 
3941 #define sk_OPENSSL_BLOCK_set(sk, i, p)                            \
3942   ((OPENSSL_BLOCK)sk_set(                                         \
3943       CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk), (i), \
3944       CHECKED_CAST(void *, OPENSSL_BLOCK, p)))
3945 
3946 #define sk_OPENSSL_BLOCK_free(sk) \
3947   sk_free(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk))
3948 
3949 #define sk_OPENSSL_BLOCK_pop_free(sk, free_func)             \
3950   sk_pop_free(                                               \
3951       CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk), \
3952       CHECKED_CAST(void (*)(void *), void (*)(OPENSSL_BLOCK), free_func))
3953 
3954 #define sk_OPENSSL_BLOCK_insert(sk, p, where)                      \
3955   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk), \
3956             CHECKED_CAST(void *, OPENSSL_BLOCK, p), (where))
3957 
3958 #define sk_OPENSSL_BLOCK_delete(sk, where) \
3959   ((OPENSSL_BLOCK)sk_delete(               \
3960       CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk), (where)))
3961 
3962 #define sk_OPENSSL_BLOCK_delete_ptr(sk, p)                   \
3963   ((OPENSSL_BLOCK)sk_delete_ptr(                             \
3964       CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk), \
3965       CHECKED_CAST(void *, OPENSSL_BLOCK, p)))
3966 
3967 #define sk_OPENSSL_BLOCK_find(sk, out_index, p)                               \
3968   sk_find(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk), (out_index), \
3969           CHECKED_CAST(void *, OPENSSL_BLOCK, p))
3970 
3971 #define sk_OPENSSL_BLOCK_shift(sk) \
3972   ((OPENSSL_BLOCK)sk_shift(        \
3973       CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk)))
3974 
3975 #define sk_OPENSSL_BLOCK_push(sk, p)                             \
3976   sk_push(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk), \
3977           CHECKED_CAST(void *, OPENSSL_BLOCK, p))
3978 
3979 #define sk_OPENSSL_BLOCK_pop(sk) \
3980   ((OPENSSL_BLOCK)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk)))
3981 
3982 #define sk_OPENSSL_BLOCK_dup(sk)      \
3983   ((STACK_OF(OPENSSL_BLOCK) *)sk_dup( \
3984       CHECKED_CAST(_STACK *, const STACK_OF(OPENSSL_BLOCK) *, sk)))
3985 
3986 #define sk_OPENSSL_BLOCK_sort(sk) \
3987   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk))
3988 
3989 #define sk_OPENSSL_BLOCK_is_sorted(sk) \
3990   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(OPENSSL_BLOCK) *, sk))
3991 
3992 #define sk_OPENSSL_BLOCK_set_cmp_func(sk, comp)                                \
3993   ((int (*)(const OPENSSL_BLOCK **a, const OPENSSL_BLOCK **b))sk_set_cmp_func( \
3994       CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk),                   \
3995       CHECKED_CAST(stack_cmp_func,                                             \
3996                    int (*)(const OPENSSL_BLOCK **a, const OPENSSL_BLOCK **b),  \
3997                    comp)))
3998 
3999 #define sk_OPENSSL_BLOCK_deep_copy(sk, copy_func, free_func)             \
4000   ((STACK_OF(OPENSSL_BLOCK) *)sk_deep_copy(                              \
4001       CHECKED_CAST(const _STACK *, const STACK_OF(OPENSSL_BLOCK) *, sk), \
4002       CHECKED_CAST(void *(*)(void *), OPENSSL_BLOCK (*)(OPENSSL_BLOCK),  \
4003                    copy_func),                                           \
4004       CHECKED_CAST(void (*)(void *), void (*)(OPENSSL_BLOCK), free_func)))
4005