Home | History | Annotate | Download | only in openssl
      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 /* POLICYINFO */
   1434 #define sk_POLICYINFO_new(comp)                                            \
   1435   ((STACK_OF(POLICYINFO) *)sk_new(CHECKED_CAST(                            \
   1436       stack_cmp_func, int (*)(const POLICYINFO **a, const POLICYINFO **b), \
   1437       comp)))
   1438 
   1439 #define sk_POLICYINFO_new_null() ((STACK_OF(POLICYINFO) *)sk_new_null())
   1440 
   1441 #define sk_POLICYINFO_num(sk) \
   1442   sk_num(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk))
   1443 
   1444 #define sk_POLICYINFO_zero(sk) \
   1445   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk));
   1446 
   1447 #define sk_POLICYINFO_value(sk, i) \
   1448   ((POLICYINFO *)sk_value(         \
   1449       CHECKED_CAST(_STACK *, const STACK_OF(POLICYINFO) *, sk), (i)))
   1450 
   1451 #define sk_POLICYINFO_set(sk, i, p)                                         \
   1452   ((POLICYINFO *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk), \
   1453                         (i), CHECKED_CAST(void *, POLICYINFO *, p)))
   1454 
   1455 #define sk_POLICYINFO_free(sk) \
   1456   sk_free(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk))
   1457 
   1458 #define sk_POLICYINFO_pop_free(sk, free_func)             \
   1459   sk_pop_free(                                            \
   1460       CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk), \
   1461       CHECKED_CAST(void (*)(void *), void (*)(POLICYINFO *), free_func))
   1462 
   1463 #define sk_POLICYINFO_insert(sk, p, where)                      \
   1464   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk), \
   1465             CHECKED_CAST(void *, POLICYINFO *, p), (where))
   1466 
   1467 #define sk_POLICYINFO_delete(sk, where)                                        \
   1468   ((POLICYINFO *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk), \
   1469                            (where)))
   1470 
   1471 #define sk_POLICYINFO_delete_ptr(sk, p)                   \
   1472   ((POLICYINFO *)sk_delete_ptr(                           \
   1473       CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk), \
   1474       CHECKED_CAST(void *, POLICYINFO *, p)))
   1475 
   1476 #define sk_POLICYINFO_find(sk, out_index, p)                               \
   1477   sk_find(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk), (out_index), \
   1478           CHECKED_CAST(void *, POLICYINFO *, p))
   1479 
   1480 #define sk_POLICYINFO_shift(sk) \
   1481   ((POLICYINFO *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk)))
   1482 
   1483 #define sk_POLICYINFO_push(sk, p)                             \
   1484   sk_push(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk), \
   1485           CHECKED_CAST(void *, POLICYINFO *, p))
   1486 
   1487 #define sk_POLICYINFO_pop(sk) \
   1488   ((POLICYINFO *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk)))
   1489 
   1490 #define sk_POLICYINFO_dup(sk)      \
   1491   ((STACK_OF(POLICYINFO) *)sk_dup( \
   1492       CHECKED_CAST(_STACK *, const STACK_OF(POLICYINFO) *, sk)))
   1493 
   1494 #define sk_POLICYINFO_sort(sk) \
   1495   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk))
   1496 
   1497 #define sk_POLICYINFO_is_sorted(sk) \
   1498   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(POLICYINFO) *, sk))
   1499 
   1500 #define sk_POLICYINFO_set_cmp_func(sk, comp)                             \
   1501   ((int (*)(const POLICYINFO **a, const POLICYINFO **b))sk_set_cmp_func( \
   1502       CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk),                \
   1503       CHECKED_CAST(stack_cmp_func,                                       \
   1504                    int (*)(const POLICYINFO **a, const POLICYINFO **b),  \
   1505                    comp)))
   1506 
   1507 #define sk_POLICYINFO_deep_copy(sk, copy_func, free_func)             \
   1508   ((STACK_OF(POLICYINFO) *)sk_deep_copy(                              \
   1509       CHECKED_CAST(const _STACK *, const STACK_OF(POLICYINFO) *, sk), \
   1510       CHECKED_CAST(void *(*)(void *), POLICYINFO *(*)(POLICYINFO *),  \
   1511                    copy_func),                                        \
   1512       CHECKED_CAST(void (*)(void *), void (*)(POLICYINFO *), free_func)))
   1513 
   1514 /* POLICYQUALINFO */
   1515 #define sk_POLICYQUALINFO_new(comp)                 \
   1516   ((STACK_OF(POLICYQUALINFO) *)sk_new(CHECKED_CAST( \
   1517       stack_cmp_func,                               \
   1518       int (*)(const POLICYQUALINFO **a, const POLICYQUALINFO **b), comp)))
   1519 
   1520 #define sk_POLICYQUALINFO_new_null() ((STACK_OF(POLICYQUALINFO) *)sk_new_null())
   1521 
   1522 #define sk_POLICYQUALINFO_num(sk) \
   1523   sk_num(CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk))
   1524 
   1525 #define sk_POLICYQUALINFO_zero(sk) \
   1526   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk));
   1527 
   1528 #define sk_POLICYQUALINFO_value(sk, i) \
   1529   ((POLICYQUALINFO *)sk_value(         \
   1530       CHECKED_CAST(_STACK *, const STACK_OF(POLICYQUALINFO) *, sk), (i)))
   1531 
   1532 #define sk_POLICYQUALINFO_set(sk, i, p)                            \
   1533   ((POLICYQUALINFO *)sk_set(                                       \
   1534       CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk), (i), \
   1535       CHECKED_CAST(void *, POLICYQUALINFO *, p)))
   1536 
   1537 #define sk_POLICYQUALINFO_free(sk) \
   1538   sk_free(CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk))
   1539 
   1540 #define sk_POLICYQUALINFO_pop_free(sk, free_func)             \
   1541   sk_pop_free(                                                \
   1542       CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk), \
   1543       CHECKED_CAST(void (*)(void *), void (*)(POLICYQUALINFO *), free_func))
   1544 
   1545 #define sk_POLICYQUALINFO_insert(sk, p, where)                      \
   1546   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk), \
   1547             CHECKED_CAST(void *, POLICYQUALINFO *, p), (where))
   1548 
   1549 #define sk_POLICYQUALINFO_delete(sk, where) \
   1550   ((POLICYQUALINFO *)sk_delete(             \
   1551       CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk), (where)))
   1552 
   1553 #define sk_POLICYQUALINFO_delete_ptr(sk, p)                   \
   1554   ((POLICYQUALINFO *)sk_delete_ptr(                           \
   1555       CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk), \
   1556       CHECKED_CAST(void *, POLICYQUALINFO *, p)))
   1557 
   1558 #define sk_POLICYQUALINFO_find(sk, out_index, p)                               \
   1559   sk_find(CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk), (out_index), \
   1560           CHECKED_CAST(void *, POLICYQUALINFO *, p))
   1561 
   1562 #define sk_POLICYQUALINFO_shift(sk) \
   1563   ((POLICYQUALINFO *)sk_shift(      \
   1564       CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk)))
   1565 
   1566 #define sk_POLICYQUALINFO_push(sk, p)                             \
   1567   sk_push(CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk), \
   1568           CHECKED_CAST(void *, POLICYQUALINFO *, p))
   1569 
   1570 #define sk_POLICYQUALINFO_pop(sk) \
   1571   ((POLICYQUALINFO *)sk_pop(      \
   1572       CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk)))
   1573 
   1574 #define sk_POLICYQUALINFO_dup(sk)      \
   1575   ((STACK_OF(POLICYQUALINFO) *)sk_dup( \
   1576       CHECKED_CAST(_STACK *, const STACK_OF(POLICYQUALINFO) *, sk)))
   1577 
   1578 #define sk_POLICYQUALINFO_sort(sk) \
   1579   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk))
   1580 
   1581 #define sk_POLICYQUALINFO_is_sorted(sk) \
   1582   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(POLICYQUALINFO) *, sk))
   1583 
   1584 #define sk_POLICYQUALINFO_set_cmp_func(sk, comp)                           \
   1585   ((int (*)(const POLICYQUALINFO **a, const POLICYQUALINFO **b))           \
   1586        sk_set_cmp_func(                                                    \
   1587            CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk),         \
   1588            CHECKED_CAST(stack_cmp_func, int (*)(const POLICYQUALINFO **a,  \
   1589                                                 const POLICYQUALINFO **b), \
   1590                         comp)))
   1591 
   1592 #define sk_POLICYQUALINFO_deep_copy(sk, copy_func, free_func)                \
   1593   ((STACK_OF(POLICYQUALINFO) *)sk_deep_copy(                                 \
   1594       CHECKED_CAST(const _STACK *, const STACK_OF(POLICYQUALINFO) *, sk),    \
   1595       CHECKED_CAST(void *(*)(void *), POLICYQUALINFO *(*)(POLICYQUALINFO *), \
   1596                    copy_func),                                               \
   1597       CHECKED_CAST(void (*)(void *), void (*)(POLICYQUALINFO *), free_func)))
   1598 
   1599 /* POLICY_MAPPING */
   1600 #define sk_POLICY_MAPPING_new(comp)                 \
   1601   ((STACK_OF(POLICY_MAPPING) *)sk_new(CHECKED_CAST( \
   1602       stack_cmp_func,                               \
   1603       int (*)(const POLICY_MAPPING **a, const POLICY_MAPPING **b), comp)))
   1604 
   1605 #define sk_POLICY_MAPPING_new_null() ((STACK_OF(POLICY_MAPPING) *)sk_new_null())
   1606 
   1607 #define sk_POLICY_MAPPING_num(sk) \
   1608   sk_num(CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk))
   1609 
   1610 #define sk_POLICY_MAPPING_zero(sk) \
   1611   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk));
   1612 
   1613 #define sk_POLICY_MAPPING_value(sk, i) \
   1614   ((POLICY_MAPPING *)sk_value(         \
   1615       CHECKED_CAST(_STACK *, const STACK_OF(POLICY_MAPPING) *, sk), (i)))
   1616 
   1617 #define sk_POLICY_MAPPING_set(sk, i, p)                            \
   1618   ((POLICY_MAPPING *)sk_set(                                       \
   1619       CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk), (i), \
   1620       CHECKED_CAST(void *, POLICY_MAPPING *, p)))
   1621 
   1622 #define sk_POLICY_MAPPING_free(sk) \
   1623   sk_free(CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk))
   1624 
   1625 #define sk_POLICY_MAPPING_pop_free(sk, free_func)             \
   1626   sk_pop_free(                                                \
   1627       CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk), \
   1628       CHECKED_CAST(void (*)(void *), void (*)(POLICY_MAPPING *), free_func))
   1629 
   1630 #define sk_POLICY_MAPPING_insert(sk, p, where)                      \
   1631   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk), \
   1632             CHECKED_CAST(void *, POLICY_MAPPING *, p), (where))
   1633 
   1634 #define sk_POLICY_MAPPING_delete(sk, where) \
   1635   ((POLICY_MAPPING *)sk_delete(             \
   1636       CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk), (where)))
   1637 
   1638 #define sk_POLICY_MAPPING_delete_ptr(sk, p)                   \
   1639   ((POLICY_MAPPING *)sk_delete_ptr(                           \
   1640       CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk), \
   1641       CHECKED_CAST(void *, POLICY_MAPPING *, p)))
   1642 
   1643 #define sk_POLICY_MAPPING_find(sk, out_index, p)                               \
   1644   sk_find(CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk), (out_index), \
   1645           CHECKED_CAST(void *, POLICY_MAPPING *, p))
   1646 
   1647 #define sk_POLICY_MAPPING_shift(sk) \
   1648   ((POLICY_MAPPING *)sk_shift(      \
   1649       CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk)))
   1650 
   1651 #define sk_POLICY_MAPPING_push(sk, p)                             \
   1652   sk_push(CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk), \
   1653           CHECKED_CAST(void *, POLICY_MAPPING *, p))
   1654 
   1655 #define sk_POLICY_MAPPING_pop(sk) \
   1656   ((POLICY_MAPPING *)sk_pop(      \
   1657       CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk)))
   1658 
   1659 #define sk_POLICY_MAPPING_dup(sk)      \
   1660   ((STACK_OF(POLICY_MAPPING) *)sk_dup( \
   1661       CHECKED_CAST(_STACK *, const STACK_OF(POLICY_MAPPING) *, sk)))
   1662 
   1663 #define sk_POLICY_MAPPING_sort(sk) \
   1664   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk))
   1665 
   1666 #define sk_POLICY_MAPPING_is_sorted(sk) \
   1667   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(POLICY_MAPPING) *, sk))
   1668 
   1669 #define sk_POLICY_MAPPING_set_cmp_func(sk, comp)                           \
   1670   ((int (*)(const POLICY_MAPPING **a, const POLICY_MAPPING **b))           \
   1671        sk_set_cmp_func(                                                    \
   1672            CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk),         \
   1673            CHECKED_CAST(stack_cmp_func, int (*)(const POLICY_MAPPING **a,  \
   1674                                                 const POLICY_MAPPING **b), \
   1675                         comp)))
   1676 
   1677 #define sk_POLICY_MAPPING_deep_copy(sk, copy_func, free_func)                \
   1678   ((STACK_OF(POLICY_MAPPING) *)sk_deep_copy(                                 \
   1679       CHECKED_CAST(const _STACK *, const STACK_OF(POLICY_MAPPING) *, sk),    \
   1680       CHECKED_CAST(void *(*)(void *), POLICY_MAPPING *(*)(POLICY_MAPPING *), \
   1681                    copy_func),                                               \
   1682       CHECKED_CAST(void (*)(void *), void (*)(POLICY_MAPPING *), free_func)))
   1683 
   1684 /* RSA_additional_prime */
   1685 #define sk_RSA_additional_prime_new(comp)                                      \
   1686   ((STACK_OF(RSA_additional_prime) *)sk_new(CHECKED_CAST(                      \
   1687       stack_cmp_func,                                                          \
   1688       int (*)(const RSA_additional_prime **a, const RSA_additional_prime **b), \
   1689       comp)))
   1690 
   1691 #define sk_RSA_additional_prime_new_null() \
   1692   ((STACK_OF(RSA_additional_prime) *)sk_new_null())
   1693 
   1694 #define sk_RSA_additional_prime_num(sk) \
   1695   sk_num(CHECKED_CAST(_STACK *, STACK_OF(RSA_additional_prime) *, sk))
   1696 
   1697 #define sk_RSA_additional_prime_zero(sk) \
   1698   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(RSA_additional_prime) *, sk));
   1699 
   1700 #define sk_RSA_additional_prime_value(sk, i)                              \
   1701   ((RSA_additional_prime *)sk_value(                                      \
   1702       CHECKED_CAST(_STACK *, const STACK_OF(RSA_additional_prime) *, sk), \
   1703       (i)))
   1704 
   1705 #define sk_RSA_additional_prime_set(sk, i, p)                            \
   1706   ((RSA_additional_prime *)sk_set(                                       \
   1707       CHECKED_CAST(_STACK *, STACK_OF(RSA_additional_prime) *, sk), (i), \
   1708       CHECKED_CAST(void *, RSA_additional_prime *, p)))
   1709 
   1710 #define sk_RSA_additional_prime_free(sk) \
   1711   sk_free(CHECKED_CAST(_STACK *, STACK_OF(RSA_additional_prime) *, sk))
   1712 
   1713 #define sk_RSA_additional_prime_pop_free(sk, free_func)                        \
   1714   sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(RSA_additional_prime) *, sk),    \
   1715               CHECKED_CAST(void (*)(void *), void (*)(RSA_additional_prime *), \
   1716                            free_func))
   1717 
   1718 #define sk_RSA_additional_prime_insert(sk, p, where)                      \
   1719   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(RSA_additional_prime) *, sk), \
   1720             CHECKED_CAST(void *, RSA_additional_prime *, p), (where))
   1721 
   1722 #define sk_RSA_additional_prime_delete(sk, where) \
   1723   ((RSA_additional_prime *)sk_delete(             \
   1724       CHECKED_CAST(_STACK *, STACK_OF(RSA_additional_prime) *, sk), (where)))
   1725 
   1726 #define sk_RSA_additional_prime_delete_ptr(sk, p)                   \
   1727   ((RSA_additional_prime *)sk_delete_ptr(                           \
   1728       CHECKED_CAST(_STACK *, STACK_OF(RSA_additional_prime) *, sk), \
   1729       CHECKED_CAST(void *, RSA_additional_prime *, p)))
   1730 
   1731 #define sk_RSA_additional_prime_find(sk, out_index, p)                  \
   1732   sk_find(CHECKED_CAST(_STACK *, STACK_OF(RSA_additional_prime) *, sk), \
   1733           (out_index), CHECKED_CAST(void *, RSA_additional_prime *, p))
   1734 
   1735 #define sk_RSA_additional_prime_shift(sk) \
   1736   ((RSA_additional_prime *)sk_shift(      \
   1737       CHECKED_CAST(_STACK *, STACK_OF(RSA_additional_prime) *, sk)))
   1738 
   1739 #define sk_RSA_additional_prime_push(sk, p)                             \
   1740   sk_push(CHECKED_CAST(_STACK *, STACK_OF(RSA_additional_prime) *, sk), \
   1741           CHECKED_CAST(void *, RSA_additional_prime *, p))
   1742 
   1743 #define sk_RSA_additional_prime_pop(sk) \
   1744   ((RSA_additional_prime *)sk_pop(      \
   1745       CHECKED_CAST(_STACK *, STACK_OF(RSA_additional_prime) *, sk)))
   1746 
   1747 #define sk_RSA_additional_prime_dup(sk)      \
   1748   ((STACK_OF(RSA_additional_prime) *)sk_dup( \
   1749       CHECKED_CAST(_STACK *, const STACK_OF(RSA_additional_prime) *, sk)))
   1750 
   1751 #define sk_RSA_additional_prime_sort(sk) \
   1752   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(RSA_additional_prime) *, sk))
   1753 
   1754 #define sk_RSA_additional_prime_is_sorted(sk) \
   1755   sk_is_sorted(                               \
   1756       CHECKED_CAST(_STACK *, const STACK_OF(RSA_additional_prime) *, sk))
   1757 
   1758 #define sk_RSA_additional_prime_set_cmp_func(sk, comp)                       \
   1759   ((int (*)(const RSA_additional_prime **a, const RSA_additional_prime **b)) \
   1760        sk_set_cmp_func(                                                      \
   1761            CHECKED_CAST(_STACK *, STACK_OF(RSA_additional_prime) *, sk),     \
   1762            CHECKED_CAST(stack_cmp_func,                                      \
   1763                         int (*)(const RSA_additional_prime **a,              \
   1764                                 const RSA_additional_prime **b),             \
   1765                         comp)))
   1766 
   1767 #define sk_RSA_additional_prime_deep_copy(sk, copy_func, free_func)        \
   1768   ((STACK_OF(RSA_additional_prime) *)sk_deep_copy(                         \
   1769       CHECKED_CAST(const _STACK *, const STACK_OF(RSA_additional_prime) *, \
   1770                    sk),                                                    \
   1771       CHECKED_CAST(void *(*)(void *),                                      \
   1772                    RSA_additional_prime *(*)(RSA_additional_prime *),      \
   1773                    copy_func),                                             \
   1774       CHECKED_CAST(void (*)(void *), void (*)(RSA_additional_prime *),     \
   1775                    free_func)))
   1776 
   1777 /* SSL_COMP */
   1778 #define sk_SSL_COMP_new(comp)                 \
   1779   ((STACK_OF(SSL_COMP) *)sk_new(CHECKED_CAST( \
   1780       stack_cmp_func, int (*)(const SSL_COMP **a, const SSL_COMP **b), comp)))
   1781 
   1782 #define sk_SSL_COMP_new_null() ((STACK_OF(SSL_COMP) *)sk_new_null())
   1783 
   1784 #define sk_SSL_COMP_num(sk) \
   1785   sk_num(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk))
   1786 
   1787 #define sk_SSL_COMP_zero(sk) \
   1788   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk));
   1789 
   1790 #define sk_SSL_COMP_value(sk, i) \
   1791   ((SSL_COMP *)sk_value(         \
   1792       CHECKED_CAST(_STACK *, const STACK_OF(SSL_COMP) *, sk), (i)))
   1793 
   1794 #define sk_SSL_COMP_set(sk, i, p)                                            \
   1795   ((SSL_COMP *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk), (i), \
   1796                       CHECKED_CAST(void *, SSL_COMP *, p)))
   1797 
   1798 #define sk_SSL_COMP_free(sk) \
   1799   sk_free(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk))
   1800 
   1801 #define sk_SSL_COMP_pop_free(sk, free_func)                     \
   1802   sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk), \
   1803               CHECKED_CAST(void (*)(void *), void (*)(SSL_COMP *), free_func))
   1804 
   1805 #define sk_SSL_COMP_insert(sk, p, where)                      \
   1806   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk), \
   1807             CHECKED_CAST(void *, SSL_COMP *, p), (where))
   1808 
   1809 #define sk_SSL_COMP_delete(sk, where)                                      \
   1810   ((SSL_COMP *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk), \
   1811                          (where)))
   1812 
   1813 #define sk_SSL_COMP_delete_ptr(sk, p)                                          \
   1814   ((SSL_COMP *)sk_delete_ptr(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk), \
   1815                              CHECKED_CAST(void *, SSL_COMP *, p)))
   1816 
   1817 #define sk_SSL_COMP_find(sk, out_index, p)                               \
   1818   sk_find(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk), (out_index), \
   1819           CHECKED_CAST(void *, SSL_COMP *, p))
   1820 
   1821 #define sk_SSL_COMP_shift(sk) \
   1822   ((SSL_COMP *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk)))
   1823 
   1824 #define sk_SSL_COMP_push(sk, p)                             \
   1825   sk_push(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk), \
   1826           CHECKED_CAST(void *, SSL_COMP *, p))
   1827 
   1828 #define sk_SSL_COMP_pop(sk) \
   1829   ((SSL_COMP *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk)))
   1830 
   1831 #define sk_SSL_COMP_dup(sk)      \
   1832   ((STACK_OF(SSL_COMP) *)sk_dup( \
   1833       CHECKED_CAST(_STACK *, const STACK_OF(SSL_COMP) *, sk)))
   1834 
   1835 #define sk_SSL_COMP_sort(sk) \
   1836   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk))
   1837 
   1838 #define sk_SSL_COMP_is_sorted(sk) \
   1839   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(SSL_COMP) *, sk))
   1840 
   1841 #define sk_SSL_COMP_set_cmp_func(sk, comp)                           \
   1842   ((int (*)(const SSL_COMP **a, const SSL_COMP **b))sk_set_cmp_func( \
   1843       CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk),              \
   1844       CHECKED_CAST(stack_cmp_func,                                   \
   1845                    int (*)(const SSL_COMP **a, const SSL_COMP **b), comp)))
   1846 
   1847 #define sk_SSL_COMP_deep_copy(sk, copy_func, free_func)                      \
   1848   ((STACK_OF(SSL_COMP) *)sk_deep_copy(                                       \
   1849       CHECKED_CAST(const _STACK *, const STACK_OF(SSL_COMP) *, sk),          \
   1850       CHECKED_CAST(void *(*)(void *), SSL_COMP *(*)(SSL_COMP *), copy_func), \
   1851       CHECKED_CAST(void (*)(void *), void (*)(SSL_COMP *), free_func)))
   1852 
   1853 /* SSL_CUSTOM_EXTENSION */
   1854 #define sk_SSL_CUSTOM_EXTENSION_new(comp)                                      \
   1855   ((STACK_OF(SSL_CUSTOM_EXTENSION) *)sk_new(CHECKED_CAST(                      \
   1856       stack_cmp_func,                                                          \
   1857       int (*)(const SSL_CUSTOM_EXTENSION **a, const SSL_CUSTOM_EXTENSION **b), \
   1858       comp)))
   1859 
   1860 #define sk_SSL_CUSTOM_EXTENSION_new_null() \
   1861   ((STACK_OF(SSL_CUSTOM_EXTENSION) *)sk_new_null())
   1862 
   1863 #define sk_SSL_CUSTOM_EXTENSION_num(sk) \
   1864   sk_num(CHECKED_CAST(_STACK *, STACK_OF(SSL_CUSTOM_EXTENSION) *, sk))
   1865 
   1866 #define sk_SSL_CUSTOM_EXTENSION_zero(sk) \
   1867   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(SSL_CUSTOM_EXTENSION) *, sk));
   1868 
   1869 #define sk_SSL_CUSTOM_EXTENSION_value(sk, i)                              \
   1870   ((SSL_CUSTOM_EXTENSION *)sk_value(                                      \
   1871       CHECKED_CAST(_STACK *, const STACK_OF(SSL_CUSTOM_EXTENSION) *, sk), \
   1872       (i)))
   1873 
   1874 #define sk_SSL_CUSTOM_EXTENSION_set(sk, i, p)                            \
   1875   ((SSL_CUSTOM_EXTENSION *)sk_set(                                       \
   1876       CHECKED_CAST(_STACK *, STACK_OF(SSL_CUSTOM_EXTENSION) *, sk), (i), \
   1877       CHECKED_CAST(void *, SSL_CUSTOM_EXTENSION *, p)))
   1878 
   1879 #define sk_SSL_CUSTOM_EXTENSION_free(sk) \
   1880   sk_free(CHECKED_CAST(_STACK *, STACK_OF(SSL_CUSTOM_EXTENSION) *, sk))
   1881 
   1882 #define sk_SSL_CUSTOM_EXTENSION_pop_free(sk, free_func)                        \
   1883   sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(SSL_CUSTOM_EXTENSION) *, sk),    \
   1884               CHECKED_CAST(void (*)(void *), void (*)(SSL_CUSTOM_EXTENSION *), \
   1885                            free_func))
   1886 
   1887 #define sk_SSL_CUSTOM_EXTENSION_insert(sk, p, where)                      \
   1888   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(SSL_CUSTOM_EXTENSION) *, sk), \
   1889             CHECKED_CAST(void *, SSL_CUSTOM_EXTENSION *, p), (where))
   1890 
   1891 #define sk_SSL_CUSTOM_EXTENSION_delete(sk, where) \
   1892   ((SSL_CUSTOM_EXTENSION *)sk_delete(             \
   1893       CHECKED_CAST(_STACK *, STACK_OF(SSL_CUSTOM_EXTENSION) *, sk), (where)))
   1894 
   1895 #define sk_SSL_CUSTOM_EXTENSION_delete_ptr(sk, p)                   \
   1896   ((SSL_CUSTOM_EXTENSION *)sk_delete_ptr(                           \
   1897       CHECKED_CAST(_STACK *, STACK_OF(SSL_CUSTOM_EXTENSION) *, sk), \
   1898       CHECKED_CAST(void *, SSL_CUSTOM_EXTENSION *, p)))
   1899 
   1900 #define sk_SSL_CUSTOM_EXTENSION_find(sk, out_index, p)                  \
   1901   sk_find(CHECKED_CAST(_STACK *, STACK_OF(SSL_CUSTOM_EXTENSION) *, sk), \
   1902           (out_index), CHECKED_CAST(void *, SSL_CUSTOM_EXTENSION *, p))
   1903 
   1904 #define sk_SSL_CUSTOM_EXTENSION_shift(sk) \
   1905   ((SSL_CUSTOM_EXTENSION *)sk_shift(      \
   1906       CHECKED_CAST(_STACK *, STACK_OF(SSL_CUSTOM_EXTENSION) *, sk)))
   1907 
   1908 #define sk_SSL_CUSTOM_EXTENSION_push(sk, p)                             \
   1909   sk_push(CHECKED_CAST(_STACK *, STACK_OF(SSL_CUSTOM_EXTENSION) *, sk), \
   1910           CHECKED_CAST(void *, SSL_CUSTOM_EXTENSION *, p))
   1911 
   1912 #define sk_SSL_CUSTOM_EXTENSION_pop(sk) \
   1913   ((SSL_CUSTOM_EXTENSION *)sk_pop(      \
   1914       CHECKED_CAST(_STACK *, STACK_OF(SSL_CUSTOM_EXTENSION) *, sk)))
   1915 
   1916 #define sk_SSL_CUSTOM_EXTENSION_dup(sk)      \
   1917   ((STACK_OF(SSL_CUSTOM_EXTENSION) *)sk_dup( \
   1918       CHECKED_CAST(_STACK *, const STACK_OF(SSL_CUSTOM_EXTENSION) *, sk)))
   1919 
   1920 #define sk_SSL_CUSTOM_EXTENSION_sort(sk) \
   1921   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(SSL_CUSTOM_EXTENSION) *, sk))
   1922 
   1923 #define sk_SSL_CUSTOM_EXTENSION_is_sorted(sk) \
   1924   sk_is_sorted(                               \
   1925       CHECKED_CAST(_STACK *, const STACK_OF(SSL_CUSTOM_EXTENSION) *, sk))
   1926 
   1927 #define sk_SSL_CUSTOM_EXTENSION_set_cmp_func(sk, comp)                       \
   1928   ((int (*)(const SSL_CUSTOM_EXTENSION **a, const SSL_CUSTOM_EXTENSION **b)) \
   1929        sk_set_cmp_func(                                                      \
   1930            CHECKED_CAST(_STACK *, STACK_OF(SSL_CUSTOM_EXTENSION) *, sk),     \
   1931            CHECKED_CAST(stack_cmp_func,                                      \
   1932                         int (*)(const SSL_CUSTOM_EXTENSION **a,              \
   1933                                 const SSL_CUSTOM_EXTENSION **b),             \
   1934                         comp)))
   1935 
   1936 #define sk_SSL_CUSTOM_EXTENSION_deep_copy(sk, copy_func, free_func)        \
   1937   ((STACK_OF(SSL_CUSTOM_EXTENSION) *)sk_deep_copy(                         \
   1938       CHECKED_CAST(const _STACK *, const STACK_OF(SSL_CUSTOM_EXTENSION) *, \
   1939                    sk),                                                    \
   1940       CHECKED_CAST(void *(*)(void *),                                      \
   1941                    SSL_CUSTOM_EXTENSION *(*)(SSL_CUSTOM_EXTENSION *),      \
   1942                    copy_func),                                             \
   1943       CHECKED_CAST(void (*)(void *), void (*)(SSL_CUSTOM_EXTENSION *),     \
   1944                    free_func)))
   1945 
   1946 /* STACK_OF_X509_NAME_ENTRY */
   1947 #define sk_STACK_OF_X509_NAME_ENTRY_new(comp)                      \
   1948   ((STACK_OF(STACK_OF_X509_NAME_ENTRY) *)sk_new(CHECKED_CAST(      \
   1949       stack_cmp_func, int (*)(const STACK_OF_X509_NAME_ENTRY **a,  \
   1950                               const STACK_OF_X509_NAME_ENTRY **b), \
   1951       comp)))
   1952 
   1953 #define sk_STACK_OF_X509_NAME_ENTRY_new_null() \
   1954   ((STACK_OF(STACK_OF_X509_NAME_ENTRY) *)sk_new_null())
   1955 
   1956 #define sk_STACK_OF_X509_NAME_ENTRY_num(sk) \
   1957   sk_num(CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk))
   1958 
   1959 #define sk_STACK_OF_X509_NAME_ENTRY_zero(sk) \
   1960   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk));
   1961 
   1962 #define sk_STACK_OF_X509_NAME_ENTRY_value(sk, i)                              \
   1963   ((STACK_OF_X509_NAME_ENTRY *)sk_value(                                      \
   1964       CHECKED_CAST(_STACK *, const STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk), \
   1965       (i)))
   1966 
   1967 #define sk_STACK_OF_X509_NAME_ENTRY_set(sk, i, p)                            \
   1968   ((STACK_OF_X509_NAME_ENTRY *)sk_set(                                       \
   1969       CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk), (i), \
   1970       CHECKED_CAST(void *, STACK_OF_X509_NAME_ENTRY *, p)))
   1971 
   1972 #define sk_STACK_OF_X509_NAME_ENTRY_free(sk) \
   1973   sk_free(CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk))
   1974 
   1975 #define sk_STACK_OF_X509_NAME_ENTRY_pop_free(sk, free_func)                \
   1976   sk_pop_free(                                                             \
   1977       CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk),    \
   1978       CHECKED_CAST(void (*)(void *), void (*)(STACK_OF_X509_NAME_ENTRY *), \
   1979                    free_func))
   1980 
   1981 #define sk_STACK_OF_X509_NAME_ENTRY_insert(sk, p, where)                      \
   1982   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk), \
   1983             CHECKED_CAST(void *, STACK_OF_X509_NAME_ENTRY *, p), (where))
   1984 
   1985 #define sk_STACK_OF_X509_NAME_ENTRY_delete(sk, where)                   \
   1986   ((STACK_OF_X509_NAME_ENTRY *)sk_delete(                               \
   1987       CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk), \
   1988       (where)))
   1989 
   1990 #define sk_STACK_OF_X509_NAME_ENTRY_delete_ptr(sk, p)                   \
   1991   ((STACK_OF_X509_NAME_ENTRY *)sk_delete_ptr(                           \
   1992       CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk), \
   1993       CHECKED_CAST(void *, STACK_OF_X509_NAME_ENTRY *, p)))
   1994 
   1995 #define sk_STACK_OF_X509_NAME_ENTRY_find(sk, out_index, p)                  \
   1996   sk_find(CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk), \
   1997           (out_index), CHECKED_CAST(void *, STACK_OF_X509_NAME_ENTRY *, p))
   1998 
   1999 #define sk_STACK_OF_X509_NAME_ENTRY_shift(sk) \
   2000   ((STACK_OF_X509_NAME_ENTRY *)sk_shift(      \
   2001       CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk)))
   2002 
   2003 #define sk_STACK_OF_X509_NAME_ENTRY_push(sk, p)                             \
   2004   sk_push(CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk), \
   2005           CHECKED_CAST(void *, STACK_OF_X509_NAME_ENTRY *, p))
   2006 
   2007 #define sk_STACK_OF_X509_NAME_ENTRY_pop(sk) \
   2008   ((STACK_OF_X509_NAME_ENTRY *)sk_pop(      \
   2009       CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk)))
   2010 
   2011 #define sk_STACK_OF_X509_NAME_ENTRY_dup(sk)      \
   2012   ((STACK_OF(STACK_OF_X509_NAME_ENTRY) *)sk_dup( \
   2013       CHECKED_CAST(_STACK *, const STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk)))
   2014 
   2015 #define sk_STACK_OF_X509_NAME_ENTRY_sort(sk) \
   2016   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk))
   2017 
   2018 #define sk_STACK_OF_X509_NAME_ENTRY_is_sorted(sk) \
   2019   sk_is_sorted(                                   \
   2020       CHECKED_CAST(_STACK *, const STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk))
   2021 
   2022 #define sk_STACK_OF_X509_NAME_ENTRY_set_cmp_func(sk, comp)                   \
   2023   ((int (*)(const STACK_OF_X509_NAME_ENTRY **a,                              \
   2024             const STACK_OF_X509_NAME_ENTRY **b))                             \
   2025        sk_set_cmp_func(                                                      \
   2026            CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk), \
   2027            CHECKED_CAST(stack_cmp_func,                                      \
   2028                         int (*)(const STACK_OF_X509_NAME_ENTRY **a,          \
   2029                                 const STACK_OF_X509_NAME_ENTRY **b),         \
   2030                         comp)))
   2031 
   2032 #define sk_STACK_OF_X509_NAME_ENTRY_deep_copy(sk, copy_func, free_func)        \
   2033   ((STACK_OF(STACK_OF_X509_NAME_ENTRY) *)sk_deep_copy(                         \
   2034       CHECKED_CAST(const _STACK *, const STACK_OF(STACK_OF_X509_NAME_ENTRY) *, \
   2035                    sk),                                                        \
   2036       CHECKED_CAST(void *(*)(void *),                                          \
   2037                    STACK_OF_X509_NAME_ENTRY *(*)(STACK_OF_X509_NAME_ENTRY *),  \
   2038                    copy_func),                                                 \
   2039       CHECKED_CAST(void (*)(void *), void (*)(STACK_OF_X509_NAME_ENTRY *),     \
   2040                    free_func)))
   2041 
   2042 /* SXNETID */
   2043 #define sk_SXNETID_new(comp)                 \
   2044   ((STACK_OF(SXNETID) *)sk_new(CHECKED_CAST( \
   2045       stack_cmp_func, int (*)(const SXNETID **a, const SXNETID **b), comp)))
   2046 
   2047 #define sk_SXNETID_new_null() ((STACK_OF(SXNETID) *)sk_new_null())
   2048 
   2049 #define sk_SXNETID_num(sk) \
   2050   sk_num(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk))
   2051 
   2052 #define sk_SXNETID_zero(sk) \
   2053   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk));
   2054 
   2055 #define sk_SXNETID_value(sk, i)                                               \
   2056   ((SXNETID *)sk_value(CHECKED_CAST(_STACK *, const STACK_OF(SXNETID) *, sk), \
   2057                        (i)))
   2058 
   2059 #define sk_SXNETID_set(sk, i, p)                                           \
   2060   ((SXNETID *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk), (i), \
   2061                      CHECKED_CAST(void *, SXNETID *, p)))
   2062 
   2063 #define sk_SXNETID_free(sk) \
   2064   sk_free(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk))
   2065 
   2066 #define sk_SXNETID_pop_free(sk, free_func)                     \
   2067   sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk), \
   2068               CHECKED_CAST(void (*)(void *), void (*)(SXNETID *), free_func))
   2069 
   2070 #define sk_SXNETID_insert(sk, p, where)                      \
   2071   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk), \
   2072             CHECKED_CAST(void *, SXNETID *, p), (where))
   2073 
   2074 #define sk_SXNETID_delete(sk, where)                                     \
   2075   ((SXNETID *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk), \
   2076                         (where)))
   2077 
   2078 #define sk_SXNETID_delete_ptr(sk, p)                                         \
   2079   ((SXNETID *)sk_delete_ptr(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk), \
   2080                             CHECKED_CAST(void *, SXNETID *, p)))
   2081 
   2082 #define sk_SXNETID_find(sk, out_index, p)                               \
   2083   sk_find(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk), (out_index), \
   2084           CHECKED_CAST(void *, SXNETID *, p))
   2085 
   2086 #define sk_SXNETID_shift(sk) \
   2087   ((SXNETID *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk)))
   2088 
   2089 #define sk_SXNETID_push(sk, p)                             \
   2090   sk_push(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk), \
   2091           CHECKED_CAST(void *, SXNETID *, p))
   2092 
   2093 #define sk_SXNETID_pop(sk) \
   2094   ((SXNETID *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk)))
   2095 
   2096 #define sk_SXNETID_dup(sk)      \
   2097   ((STACK_OF(SXNETID) *)sk_dup( \
   2098       CHECKED_CAST(_STACK *, const STACK_OF(SXNETID) *, sk)))
   2099 
   2100 #define sk_SXNETID_sort(sk) \
   2101   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk))
   2102 
   2103 #define sk_SXNETID_is_sorted(sk) \
   2104   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(SXNETID) *, sk))
   2105 
   2106 #define sk_SXNETID_set_cmp_func(sk, comp)                          \
   2107   ((int (*)(const SXNETID **a, const SXNETID **b))sk_set_cmp_func( \
   2108       CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk),             \
   2109       CHECKED_CAST(stack_cmp_func,                                 \
   2110                    int (*)(const SXNETID **a, const SXNETID **b), comp)))
   2111 
   2112 #define sk_SXNETID_deep_copy(sk, copy_func, free_func)                     \
   2113   ((STACK_OF(SXNETID) *)sk_deep_copy(                                      \
   2114       CHECKED_CAST(const _STACK *, const STACK_OF(SXNETID) *, sk),         \
   2115       CHECKED_CAST(void *(*)(void *), SXNETID *(*)(SXNETID *), copy_func), \
   2116       CHECKED_CAST(void (*)(void *), void (*)(SXNETID *), free_func)))
   2117 
   2118 /* X509 */
   2119 #define sk_X509_new(comp)                 \
   2120   ((STACK_OF(X509) *)sk_new(CHECKED_CAST( \
   2121       stack_cmp_func, int (*)(const X509 **a, const X509 **b), comp)))
   2122 
   2123 #define sk_X509_new_null() ((STACK_OF(X509) *)sk_new_null())
   2124 
   2125 #define sk_X509_num(sk) sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk))
   2126 
   2127 #define sk_X509_zero(sk) sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk));
   2128 
   2129 #define sk_X509_value(sk, i) \
   2130   ((X509 *)sk_value(CHECKED_CAST(_STACK *, const STACK_OF(X509) *, sk), (i)))
   2131 
   2132 #define sk_X509_set(sk, i, p)                                        \
   2133   ((X509 *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk), (i), \
   2134                   CHECKED_CAST(void *, X509 *, p)))
   2135 
   2136 #define sk_X509_free(sk) sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk))
   2137 
   2138 #define sk_X509_pop_free(sk, free_func)                     \
   2139   sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk), \
   2140               CHECKED_CAST(void (*)(void *), void (*)(X509 *), free_func))
   2141 
   2142 #define sk_X509_insert(sk, p, where)                      \
   2143   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk), \
   2144             CHECKED_CAST(void *, X509 *, p), (where))
   2145 
   2146 #define sk_X509_delete(sk, where) \
   2147   ((X509 *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk), (where)))
   2148 
   2149 #define sk_X509_delete_ptr(sk, p)                                      \
   2150   ((X509 *)sk_delete_ptr(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk), \
   2151                          CHECKED_CAST(void *, X509 *, p)))
   2152 
   2153 #define sk_X509_find(sk, out_index, p)                               \
   2154   sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk), (out_index), \
   2155           CHECKED_CAST(void *, X509 *, p))
   2156 
   2157 #define sk_X509_shift(sk) \
   2158   ((X509 *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk)))
   2159 
   2160 #define sk_X509_push(sk, p)                             \
   2161   sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk), \
   2162           CHECKED_CAST(void *, X509 *, p))
   2163 
   2164 #define sk_X509_pop(sk) \
   2165   ((X509 *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk)))
   2166 
   2167 #define sk_X509_dup(sk) \
   2168   ((STACK_OF(X509) *)sk_dup(CHECKED_CAST(_STACK *, const STACK_OF(X509) *, sk)))
   2169 
   2170 #define sk_X509_sort(sk) sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk))
   2171 
   2172 #define sk_X509_is_sorted(sk) \
   2173   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509) *, sk))
   2174 
   2175 #define sk_X509_set_cmp_func(sk, comp)                                      \
   2176   ((int (*)(const X509 **a, const X509 **b))sk_set_cmp_func(                \
   2177       CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk),                         \
   2178       CHECKED_CAST(stack_cmp_func, int (*)(const X509 **a, const X509 **b), \
   2179                    comp)))
   2180 
   2181 #define sk_X509_deep_copy(sk, copy_func, free_func)                  \
   2182   ((STACK_OF(X509) *)sk_deep_copy(                                   \
   2183       CHECKED_CAST(const _STACK *, const STACK_OF(X509) *, sk),      \
   2184       CHECKED_CAST(void *(*)(void *), X509 *(*)(X509 *), copy_func), \
   2185       CHECKED_CAST(void (*)(void *), void (*)(X509 *), free_func)))
   2186 
   2187 /* X509V3_EXT_METHOD */
   2188 #define sk_X509V3_EXT_METHOD_new(comp)                                   \
   2189   ((STACK_OF(X509V3_EXT_METHOD) *)sk_new(CHECKED_CAST(                   \
   2190       stack_cmp_func,                                                    \
   2191       int (*)(const X509V3_EXT_METHOD **a, const X509V3_EXT_METHOD **b), \
   2192       comp)))
   2193 
   2194 #define sk_X509V3_EXT_METHOD_new_null() \
   2195   ((STACK_OF(X509V3_EXT_METHOD) *)sk_new_null())
   2196 
   2197 #define sk_X509V3_EXT_METHOD_num(sk) \
   2198   sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk))
   2199 
   2200 #define sk_X509V3_EXT_METHOD_zero(sk) \
   2201   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk));
   2202 
   2203 #define sk_X509V3_EXT_METHOD_value(sk, i) \
   2204   ((X509V3_EXT_METHOD *)sk_value(         \
   2205       CHECKED_CAST(_STACK *, const STACK_OF(X509V3_EXT_METHOD) *, sk), (i)))
   2206 
   2207 #define sk_X509V3_EXT_METHOD_set(sk, i, p)                            \
   2208   ((X509V3_EXT_METHOD *)sk_set(                                       \
   2209       CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk), (i), \
   2210       CHECKED_CAST(void *, X509V3_EXT_METHOD *, p)))
   2211 
   2212 #define sk_X509V3_EXT_METHOD_free(sk) \
   2213   sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk))
   2214 
   2215 #define sk_X509V3_EXT_METHOD_pop_free(sk, free_func)                        \
   2216   sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk),    \
   2217               CHECKED_CAST(void (*)(void *), void (*)(X509V3_EXT_METHOD *), \
   2218                            free_func))
   2219 
   2220 #define sk_X509V3_EXT_METHOD_insert(sk, p, where)                      \
   2221   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk), \
   2222             CHECKED_CAST(void *, X509V3_EXT_METHOD *, p), (where))
   2223 
   2224 #define sk_X509V3_EXT_METHOD_delete(sk, where) \
   2225   ((X509V3_EXT_METHOD *)sk_delete(             \
   2226       CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk), (where)))
   2227 
   2228 #define sk_X509V3_EXT_METHOD_delete_ptr(sk, p)                   \
   2229   ((X509V3_EXT_METHOD *)sk_delete_ptr(                           \
   2230       CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk), \
   2231       CHECKED_CAST(void *, X509V3_EXT_METHOD *, p)))
   2232 
   2233 #define sk_X509V3_EXT_METHOD_find(sk, out_index, p)                  \
   2234   sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk), \
   2235           (out_index), CHECKED_CAST(void *, X509V3_EXT_METHOD *, p))
   2236 
   2237 #define sk_X509V3_EXT_METHOD_shift(sk) \
   2238   ((X509V3_EXT_METHOD *)sk_shift(      \
   2239       CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk)))
   2240 
   2241 #define sk_X509V3_EXT_METHOD_push(sk, p)                             \
   2242   sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk), \
   2243           CHECKED_CAST(void *, X509V3_EXT_METHOD *, p))
   2244 
   2245 #define sk_X509V3_EXT_METHOD_pop(sk) \
   2246   ((X509V3_EXT_METHOD *)sk_pop(      \
   2247       CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk)))
   2248 
   2249 #define sk_X509V3_EXT_METHOD_dup(sk)      \
   2250   ((STACK_OF(X509V3_EXT_METHOD) *)sk_dup( \
   2251       CHECKED_CAST(_STACK *, const STACK_OF(X509V3_EXT_METHOD) *, sk)))
   2252 
   2253 #define sk_X509V3_EXT_METHOD_sort(sk) \
   2254   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk))
   2255 
   2256 #define sk_X509V3_EXT_METHOD_is_sorted(sk) \
   2257   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509V3_EXT_METHOD) *, sk))
   2258 
   2259 #define sk_X509V3_EXT_METHOD_set_cmp_func(sk, comp)                           \
   2260   ((int (*)(const X509V3_EXT_METHOD **a, const X509V3_EXT_METHOD **b))        \
   2261        sk_set_cmp_func(                                                       \
   2262            CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk),         \
   2263            CHECKED_CAST(stack_cmp_func, int (*)(const X509V3_EXT_METHOD **a,  \
   2264                                                 const X509V3_EXT_METHOD **b), \
   2265                         comp)))
   2266 
   2267 #define sk_X509V3_EXT_METHOD_deep_copy(sk, copy_func, free_func)             \
   2268   ((STACK_OF(X509V3_EXT_METHOD) *)sk_deep_copy(                              \
   2269       CHECKED_CAST(const _STACK *, const STACK_OF(X509V3_EXT_METHOD) *, sk), \
   2270       CHECKED_CAST(void *(*)(void *),                                        \
   2271                    X509V3_EXT_METHOD *(*)(X509V3_EXT_METHOD *), copy_func),  \
   2272       CHECKED_CAST(void (*)(void *), void (*)(X509V3_EXT_METHOD *),          \
   2273                    free_func)))
   2274 
   2275 /* X509_ALGOR */
   2276 #define sk_X509_ALGOR_new(comp)                                            \
   2277   ((STACK_OF(X509_ALGOR) *)sk_new(CHECKED_CAST(                            \
   2278       stack_cmp_func, int (*)(const X509_ALGOR **a, const X509_ALGOR **b), \
   2279       comp)))
   2280 
   2281 #define sk_X509_ALGOR_new_null() ((STACK_OF(X509_ALGOR) *)sk_new_null())
   2282 
   2283 #define sk_X509_ALGOR_num(sk) \
   2284   sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk))
   2285 
   2286 #define sk_X509_ALGOR_zero(sk) \
   2287   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk));
   2288 
   2289 #define sk_X509_ALGOR_value(sk, i) \
   2290   ((X509_ALGOR *)sk_value(         \
   2291       CHECKED_CAST(_STACK *, const STACK_OF(X509_ALGOR) *, sk), (i)))
   2292 
   2293 #define sk_X509_ALGOR_set(sk, i, p)                                         \
   2294   ((X509_ALGOR *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk), \
   2295                         (i), CHECKED_CAST(void *, X509_ALGOR *, p)))
   2296 
   2297 #define sk_X509_ALGOR_free(sk) \
   2298   sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk))
   2299 
   2300 #define sk_X509_ALGOR_pop_free(sk, free_func)             \
   2301   sk_pop_free(                                            \
   2302       CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk), \
   2303       CHECKED_CAST(void (*)(void *), void (*)(X509_ALGOR *), free_func))
   2304 
   2305 #define sk_X509_ALGOR_insert(sk, p, where)                      \
   2306   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk), \
   2307             CHECKED_CAST(void *, X509_ALGOR *, p), (where))
   2308 
   2309 #define sk_X509_ALGOR_delete(sk, where)                                        \
   2310   ((X509_ALGOR *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk), \
   2311                            (where)))
   2312 
   2313 #define sk_X509_ALGOR_delete_ptr(sk, p)                   \
   2314   ((X509_ALGOR *)sk_delete_ptr(                           \
   2315       CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk), \
   2316       CHECKED_CAST(void *, X509_ALGOR *, p)))
   2317 
   2318 #define sk_X509_ALGOR_find(sk, out_index, p)                               \
   2319   sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk), (out_index), \
   2320           CHECKED_CAST(void *, X509_ALGOR *, p))
   2321 
   2322 #define sk_X509_ALGOR_shift(sk) \
   2323   ((X509_ALGOR *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk)))
   2324 
   2325 #define sk_X509_ALGOR_push(sk, p)                             \
   2326   sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk), \
   2327           CHECKED_CAST(void *, X509_ALGOR *, p))
   2328 
   2329 #define sk_X509_ALGOR_pop(sk) \
   2330   ((X509_ALGOR *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk)))
   2331 
   2332 #define sk_X509_ALGOR_dup(sk)      \
   2333   ((STACK_OF(X509_ALGOR) *)sk_dup( \
   2334       CHECKED_CAST(_STACK *, const STACK_OF(X509_ALGOR) *, sk)))
   2335 
   2336 #define sk_X509_ALGOR_sort(sk) \
   2337   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk))
   2338 
   2339 #define sk_X509_ALGOR_is_sorted(sk) \
   2340   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_ALGOR) *, sk))
   2341 
   2342 #define sk_X509_ALGOR_set_cmp_func(sk, comp)                             \
   2343   ((int (*)(const X509_ALGOR **a, const X509_ALGOR **b))sk_set_cmp_func( \
   2344       CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk),                \
   2345       CHECKED_CAST(stack_cmp_func,                                       \
   2346                    int (*)(const X509_ALGOR **a, const X509_ALGOR **b),  \
   2347                    comp)))
   2348 
   2349 #define sk_X509_ALGOR_deep_copy(sk, copy_func, free_func)             \
   2350   ((STACK_OF(X509_ALGOR) *)sk_deep_copy(                              \
   2351       CHECKED_CAST(const _STACK *, const STACK_OF(X509_ALGOR) *, sk), \
   2352       CHECKED_CAST(void *(*)(void *), X509_ALGOR *(*)(X509_ALGOR *),  \
   2353                    copy_func),                                        \
   2354       CHECKED_CAST(void (*)(void *), void (*)(X509_ALGOR *), free_func)))
   2355 
   2356 /* X509_ATTRIBUTE */
   2357 #define sk_X509_ATTRIBUTE_new(comp)                 \
   2358   ((STACK_OF(X509_ATTRIBUTE) *)sk_new(CHECKED_CAST( \
   2359       stack_cmp_func,                               \
   2360       int (*)(const X509_ATTRIBUTE **a, const X509_ATTRIBUTE **b), comp)))
   2361 
   2362 #define sk_X509_ATTRIBUTE_new_null() ((STACK_OF(X509_ATTRIBUTE) *)sk_new_null())
   2363 
   2364 #define sk_X509_ATTRIBUTE_num(sk) \
   2365   sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk))
   2366 
   2367 #define sk_X509_ATTRIBUTE_zero(sk) \
   2368   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk));
   2369 
   2370 #define sk_X509_ATTRIBUTE_value(sk, i) \
   2371   ((X509_ATTRIBUTE *)sk_value(         \
   2372       CHECKED_CAST(_STACK *, const STACK_OF(X509_ATTRIBUTE) *, sk), (i)))
   2373 
   2374 #define sk_X509_ATTRIBUTE_set(sk, i, p)                            \
   2375   ((X509_ATTRIBUTE *)sk_set(                                       \
   2376       CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk), (i), \
   2377       CHECKED_CAST(void *, X509_ATTRIBUTE *, p)))
   2378 
   2379 #define sk_X509_ATTRIBUTE_free(sk) \
   2380   sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk))
   2381 
   2382 #define sk_X509_ATTRIBUTE_pop_free(sk, free_func)             \
   2383   sk_pop_free(                                                \
   2384       CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk), \
   2385       CHECKED_CAST(void (*)(void *), void (*)(X509_ATTRIBUTE *), free_func))
   2386 
   2387 #define sk_X509_ATTRIBUTE_insert(sk, p, where)                      \
   2388   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk), \
   2389             CHECKED_CAST(void *, X509_ATTRIBUTE *, p), (where))
   2390 
   2391 #define sk_X509_ATTRIBUTE_delete(sk, where) \
   2392   ((X509_ATTRIBUTE *)sk_delete(             \
   2393       CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk), (where)))
   2394 
   2395 #define sk_X509_ATTRIBUTE_delete_ptr(sk, p)                   \
   2396   ((X509_ATTRIBUTE *)sk_delete_ptr(                           \
   2397       CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk), \
   2398       CHECKED_CAST(void *, X509_ATTRIBUTE *, p)))
   2399 
   2400 #define sk_X509_ATTRIBUTE_find(sk, out_index, p)                               \
   2401   sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk), (out_index), \
   2402           CHECKED_CAST(void *, X509_ATTRIBUTE *, p))
   2403 
   2404 #define sk_X509_ATTRIBUTE_shift(sk) \
   2405   ((X509_ATTRIBUTE *)sk_shift(      \
   2406       CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk)))
   2407 
   2408 #define sk_X509_ATTRIBUTE_push(sk, p)                             \
   2409   sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk), \
   2410           CHECKED_CAST(void *, X509_ATTRIBUTE *, p))
   2411 
   2412 #define sk_X509_ATTRIBUTE_pop(sk) \
   2413   ((X509_ATTRIBUTE *)sk_pop(      \
   2414       CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk)))
   2415 
   2416 #define sk_X509_ATTRIBUTE_dup(sk)      \
   2417   ((STACK_OF(X509_ATTRIBUTE) *)sk_dup( \
   2418       CHECKED_CAST(_STACK *, const STACK_OF(X509_ATTRIBUTE) *, sk)))
   2419 
   2420 #define sk_X509_ATTRIBUTE_sort(sk) \
   2421   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk))
   2422 
   2423 #define sk_X509_ATTRIBUTE_is_sorted(sk) \
   2424   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_ATTRIBUTE) *, sk))
   2425 
   2426 #define sk_X509_ATTRIBUTE_set_cmp_func(sk, comp)                           \
   2427   ((int (*)(const X509_ATTRIBUTE **a, const X509_ATTRIBUTE **b))           \
   2428        sk_set_cmp_func(                                                    \
   2429            CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk),         \
   2430            CHECKED_CAST(stack_cmp_func, int (*)(const X509_ATTRIBUTE **a,  \
   2431                                                 const X509_ATTRIBUTE **b), \
   2432                         comp)))
   2433 
   2434 #define sk_X509_ATTRIBUTE_deep_copy(sk, copy_func, free_func)                \
   2435   ((STACK_OF(X509_ATTRIBUTE) *)sk_deep_copy(                                 \
   2436       CHECKED_CAST(const _STACK *, const STACK_OF(X509_ATTRIBUTE) *, sk),    \
   2437       CHECKED_CAST(void *(*)(void *), X509_ATTRIBUTE *(*)(X509_ATTRIBUTE *), \
   2438                    copy_func),                                               \
   2439       CHECKED_CAST(void (*)(void *), void (*)(X509_ATTRIBUTE *), free_func)))
   2440 
   2441 /* X509_CRL */
   2442 #define sk_X509_CRL_new(comp)                 \
   2443   ((STACK_OF(X509_CRL) *)sk_new(CHECKED_CAST( \
   2444       stack_cmp_func, int (*)(const X509_CRL **a, const X509_CRL **b), comp)))
   2445 
   2446 #define sk_X509_CRL_new_null() ((STACK_OF(X509_CRL) *)sk_new_null())
   2447 
   2448 #define sk_X509_CRL_num(sk) \
   2449   sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk))
   2450 
   2451 #define sk_X509_CRL_zero(sk) \
   2452   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk));
   2453 
   2454 #define sk_X509_CRL_value(sk, i) \
   2455   ((X509_CRL *)sk_value(         \
   2456       CHECKED_CAST(_STACK *, const STACK_OF(X509_CRL) *, sk), (i)))
   2457 
   2458 #define sk_X509_CRL_set(sk, i, p)                                            \
   2459   ((X509_CRL *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk), (i), \
   2460                       CHECKED_CAST(void *, X509_CRL *, p)))
   2461 
   2462 #define sk_X509_CRL_free(sk) \
   2463   sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk))
   2464 
   2465 #define sk_X509_CRL_pop_free(sk, free_func)                     \
   2466   sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk), \
   2467               CHECKED_CAST(void (*)(void *), void (*)(X509_CRL *), free_func))
   2468 
   2469 #define sk_X509_CRL_insert(sk, p, where)                      \
   2470   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk), \
   2471             CHECKED_CAST(void *, X509_CRL *, p), (where))
   2472 
   2473 #define sk_X509_CRL_delete(sk, where)                                      \
   2474   ((X509_CRL *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk), \
   2475                          (where)))
   2476 
   2477 #define sk_X509_CRL_delete_ptr(sk, p)                                          \
   2478   ((X509_CRL *)sk_delete_ptr(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk), \
   2479                              CHECKED_CAST(void *, X509_CRL *, p)))
   2480 
   2481 #define sk_X509_CRL_find(sk, out_index, p)                               \
   2482   sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk), (out_index), \
   2483           CHECKED_CAST(void *, X509_CRL *, p))
   2484 
   2485 #define sk_X509_CRL_shift(sk) \
   2486   ((X509_CRL *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk)))
   2487 
   2488 #define sk_X509_CRL_push(sk, p)                             \
   2489   sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk), \
   2490           CHECKED_CAST(void *, X509_CRL *, p))
   2491 
   2492 #define sk_X509_CRL_pop(sk) \
   2493   ((X509_CRL *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk)))
   2494 
   2495 #define sk_X509_CRL_dup(sk)      \
   2496   ((STACK_OF(X509_CRL) *)sk_dup( \
   2497       CHECKED_CAST(_STACK *, const STACK_OF(X509_CRL) *, sk)))
   2498 
   2499 #define sk_X509_CRL_sort(sk) \
   2500   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk))
   2501 
   2502 #define sk_X509_CRL_is_sorted(sk) \
   2503   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_CRL) *, sk))
   2504 
   2505 #define sk_X509_CRL_set_cmp_func(sk, comp)                           \
   2506   ((int (*)(const X509_CRL **a, const X509_CRL **b))sk_set_cmp_func( \
   2507       CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk),              \
   2508       CHECKED_CAST(stack_cmp_func,                                   \
   2509                    int (*)(const X509_CRL **a, const X509_CRL **b), comp)))
   2510 
   2511 #define sk_X509_CRL_deep_copy(sk, copy_func, free_func)                      \
   2512   ((STACK_OF(X509_CRL) *)sk_deep_copy(                                       \
   2513       CHECKED_CAST(const _STACK *, const STACK_OF(X509_CRL) *, sk),          \
   2514       CHECKED_CAST(void *(*)(void *), X509_CRL *(*)(X509_CRL *), copy_func), \
   2515       CHECKED_CAST(void (*)(void *), void (*)(X509_CRL *), free_func)))
   2516 
   2517 /* X509_EXTENSION */
   2518 #define sk_X509_EXTENSION_new(comp)                 \
   2519   ((STACK_OF(X509_EXTENSION) *)sk_new(CHECKED_CAST( \
   2520       stack_cmp_func,                               \
   2521       int (*)(const X509_EXTENSION **a, const X509_EXTENSION **b), comp)))
   2522 
   2523 #define sk_X509_EXTENSION_new_null() ((STACK_OF(X509_EXTENSION) *)sk_new_null())
   2524 
   2525 #define sk_X509_EXTENSION_num(sk) \
   2526   sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk))
   2527 
   2528 #define sk_X509_EXTENSION_zero(sk) \
   2529   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk));
   2530 
   2531 #define sk_X509_EXTENSION_value(sk, i) \
   2532   ((X509_EXTENSION *)sk_value(         \
   2533       CHECKED_CAST(_STACK *, const STACK_OF(X509_EXTENSION) *, sk), (i)))
   2534 
   2535 #define sk_X509_EXTENSION_set(sk, i, p)                            \
   2536   ((X509_EXTENSION *)sk_set(                                       \
   2537       CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk), (i), \
   2538       CHECKED_CAST(void *, X509_EXTENSION *, p)))
   2539 
   2540 #define sk_X509_EXTENSION_free(sk) \
   2541   sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk))
   2542 
   2543 #define sk_X509_EXTENSION_pop_free(sk, free_func)             \
   2544   sk_pop_free(                                                \
   2545       CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk), \
   2546       CHECKED_CAST(void (*)(void *), void (*)(X509_EXTENSION *), free_func))
   2547 
   2548 #define sk_X509_EXTENSION_insert(sk, p, where)                      \
   2549   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk), \
   2550             CHECKED_CAST(void *, X509_EXTENSION *, p), (where))
   2551 
   2552 #define sk_X509_EXTENSION_delete(sk, where) \
   2553   ((X509_EXTENSION *)sk_delete(             \
   2554       CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk), (where)))
   2555 
   2556 #define sk_X509_EXTENSION_delete_ptr(sk, p)                   \
   2557   ((X509_EXTENSION *)sk_delete_ptr(                           \
   2558       CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk), \
   2559       CHECKED_CAST(void *, X509_EXTENSION *, p)))
   2560 
   2561 #define sk_X509_EXTENSION_find(sk, out_index, p)                               \
   2562   sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk), (out_index), \
   2563           CHECKED_CAST(void *, X509_EXTENSION *, p))
   2564 
   2565 #define sk_X509_EXTENSION_shift(sk) \
   2566   ((X509_EXTENSION *)sk_shift(      \
   2567       CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk)))
   2568 
   2569 #define sk_X509_EXTENSION_push(sk, p)                             \
   2570   sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk), \
   2571           CHECKED_CAST(void *, X509_EXTENSION *, p))
   2572 
   2573 #define sk_X509_EXTENSION_pop(sk) \
   2574   ((X509_EXTENSION *)sk_pop(      \
   2575       CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk)))
   2576 
   2577 #define sk_X509_EXTENSION_dup(sk)      \
   2578   ((STACK_OF(X509_EXTENSION) *)sk_dup( \
   2579       CHECKED_CAST(_STACK *, const STACK_OF(X509_EXTENSION) *, sk)))
   2580 
   2581 #define sk_X509_EXTENSION_sort(sk) \
   2582   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk))
   2583 
   2584 #define sk_X509_EXTENSION_is_sorted(sk) \
   2585   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_EXTENSION) *, sk))
   2586 
   2587 #define sk_X509_EXTENSION_set_cmp_func(sk, comp)                           \
   2588   ((int (*)(const X509_EXTENSION **a, const X509_EXTENSION **b))           \
   2589        sk_set_cmp_func(                                                    \
   2590            CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk),         \
   2591            CHECKED_CAST(stack_cmp_func, int (*)(const X509_EXTENSION **a,  \
   2592                                                 const X509_EXTENSION **b), \
   2593                         comp)))
   2594 
   2595 #define sk_X509_EXTENSION_deep_copy(sk, copy_func, free_func)                \
   2596   ((STACK_OF(X509_EXTENSION) *)sk_deep_copy(                                 \
   2597       CHECKED_CAST(const _STACK *, const STACK_OF(X509_EXTENSION) *, sk),    \
   2598       CHECKED_CAST(void *(*)(void *), X509_EXTENSION *(*)(X509_EXTENSION *), \
   2599                    copy_func),                                               \
   2600       CHECKED_CAST(void (*)(void *), void (*)(X509_EXTENSION *), free_func)))
   2601 
   2602 /* X509_INFO */
   2603 #define sk_X509_INFO_new(comp)     \
   2604   ((STACK_OF(X509_INFO) *)sk_new(  \
   2605       CHECKED_CAST(stack_cmp_func, \
   2606                    int (*)(const X509_INFO **a, const X509_INFO **b), comp)))
   2607 
   2608 #define sk_X509_INFO_new_null() ((STACK_OF(X509_INFO) *)sk_new_null())
   2609 
   2610 #define sk_X509_INFO_num(sk) \
   2611   sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk))
   2612 
   2613 #define sk_X509_INFO_zero(sk) \
   2614   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk));
   2615 
   2616 #define sk_X509_INFO_value(sk, i) \
   2617   ((X509_INFO *)sk_value(         \
   2618       CHECKED_CAST(_STACK *, const STACK_OF(X509_INFO) *, sk), (i)))
   2619 
   2620 #define sk_X509_INFO_set(sk, i, p)                                             \
   2621   ((X509_INFO *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk), (i), \
   2622                        CHECKED_CAST(void *, X509_INFO *, p)))
   2623 
   2624 #define sk_X509_INFO_free(sk) \
   2625   sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk))
   2626 
   2627 #define sk_X509_INFO_pop_free(sk, free_func)             \
   2628   sk_pop_free(                                           \
   2629       CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk), \
   2630       CHECKED_CAST(void (*)(void *), void (*)(X509_INFO *), free_func))
   2631 
   2632 #define sk_X509_INFO_insert(sk, p, where)                      \
   2633   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk), \
   2634             CHECKED_CAST(void *, X509_INFO *, p), (where))
   2635 
   2636 #define sk_X509_INFO_delete(sk, where)                                       \
   2637   ((X509_INFO *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk), \
   2638                           (where)))
   2639 
   2640 #define sk_X509_INFO_delete_ptr(sk, p)                   \
   2641   ((X509_INFO *)sk_delete_ptr(                           \
   2642       CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk), \
   2643       CHECKED_CAST(void *, X509_INFO *, p)))
   2644 
   2645 #define sk_X509_INFO_find(sk, out_index, p)                               \
   2646   sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk), (out_index), \
   2647           CHECKED_CAST(void *, X509_INFO *, p))
   2648 
   2649 #define sk_X509_INFO_shift(sk) \
   2650   ((X509_INFO *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk)))
   2651 
   2652 #define sk_X509_INFO_push(sk, p)                             \
   2653   sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk), \
   2654           CHECKED_CAST(void *, X509_INFO *, p))
   2655 
   2656 #define sk_X509_INFO_pop(sk) \
   2657   ((X509_INFO *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk)))
   2658 
   2659 #define sk_X509_INFO_dup(sk)      \
   2660   ((STACK_OF(X509_INFO) *)sk_dup( \
   2661       CHECKED_CAST(_STACK *, const STACK_OF(X509_INFO) *, sk)))
   2662 
   2663 #define sk_X509_INFO_sort(sk) \
   2664   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk))
   2665 
   2666 #define sk_X509_INFO_is_sorted(sk) \
   2667   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_INFO) *, sk))
   2668 
   2669 #define sk_X509_INFO_set_cmp_func(sk, comp)                            \
   2670   ((int (*)(const X509_INFO **a, const X509_INFO **b))sk_set_cmp_func( \
   2671       CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk),               \
   2672       CHECKED_CAST(stack_cmp_func,                                     \
   2673                    int (*)(const X509_INFO **a, const X509_INFO **b), comp)))
   2674 
   2675 #define sk_X509_INFO_deep_copy(sk, copy_func, free_func)                       \
   2676   ((STACK_OF(X509_INFO) *)sk_deep_copy(                                        \
   2677       CHECKED_CAST(const _STACK *, const STACK_OF(X509_INFO) *, sk),           \
   2678       CHECKED_CAST(void *(*)(void *), X509_INFO *(*)(X509_INFO *), copy_func), \
   2679       CHECKED_CAST(void (*)(void *), void (*)(X509_INFO *), free_func)))
   2680 
   2681 /* X509_LOOKUP */
   2682 #define sk_X509_LOOKUP_new(comp)                                             \
   2683   ((STACK_OF(X509_LOOKUP) *)sk_new(CHECKED_CAST(                             \
   2684       stack_cmp_func, int (*)(const X509_LOOKUP **a, const X509_LOOKUP **b), \
   2685       comp)))
   2686 
   2687 #define sk_X509_LOOKUP_new_null() ((STACK_OF(X509_LOOKUP) *)sk_new_null())
   2688 
   2689 #define sk_X509_LOOKUP_num(sk) \
   2690   sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk))
   2691 
   2692 #define sk_X509_LOOKUP_zero(sk) \
   2693   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk));
   2694 
   2695 #define sk_X509_LOOKUP_value(sk, i) \
   2696   ((X509_LOOKUP *)sk_value(         \
   2697       CHECKED_CAST(_STACK *, const STACK_OF(X509_LOOKUP) *, sk), (i)))
   2698 
   2699 #define sk_X509_LOOKUP_set(sk, i, p)                                          \
   2700   ((X509_LOOKUP *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk), \
   2701                          (i), CHECKED_CAST(void *, X509_LOOKUP *, p)))
   2702 
   2703 #define sk_X509_LOOKUP_free(sk) \
   2704   sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk))
   2705 
   2706 #define sk_X509_LOOKUP_pop_free(sk, free_func)             \
   2707   sk_pop_free(                                             \
   2708       CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk), \
   2709       CHECKED_CAST(void (*)(void *), void (*)(X509_LOOKUP *), free_func))
   2710 
   2711 #define sk_X509_LOOKUP_insert(sk, p, where)                      \
   2712   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk), \
   2713             CHECKED_CAST(void *, X509_LOOKUP *, p), (where))
   2714 
   2715 #define sk_X509_LOOKUP_delete(sk, where) \
   2716   ((X509_LOOKUP *)sk_delete(             \
   2717       CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk), (where)))
   2718 
   2719 #define sk_X509_LOOKUP_delete_ptr(sk, p)                   \
   2720   ((X509_LOOKUP *)sk_delete_ptr(                           \
   2721       CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk), \
   2722       CHECKED_CAST(void *, X509_LOOKUP *, p)))
   2723 
   2724 #define sk_X509_LOOKUP_find(sk, out_index, p)                               \
   2725   sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk), (out_index), \
   2726           CHECKED_CAST(void *, X509_LOOKUP *, p))
   2727 
   2728 #define sk_X509_LOOKUP_shift(sk) \
   2729   ((X509_LOOKUP *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk)))
   2730 
   2731 #define sk_X509_LOOKUP_push(sk, p)                             \
   2732   sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk), \
   2733           CHECKED_CAST(void *, X509_LOOKUP *, p))
   2734 
   2735 #define sk_X509_LOOKUP_pop(sk) \
   2736   ((X509_LOOKUP *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk)))
   2737 
   2738 #define sk_X509_LOOKUP_dup(sk)      \
   2739   ((STACK_OF(X509_LOOKUP) *)sk_dup( \
   2740       CHECKED_CAST(_STACK *, const STACK_OF(X509_LOOKUP) *, sk)))
   2741 
   2742 #define sk_X509_LOOKUP_sort(sk) \
   2743   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk))
   2744 
   2745 #define sk_X509_LOOKUP_is_sorted(sk) \
   2746   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_LOOKUP) *, sk))
   2747 
   2748 #define sk_X509_LOOKUP_set_cmp_func(sk, comp)                              \
   2749   ((int (*)(const X509_LOOKUP **a, const X509_LOOKUP **b))sk_set_cmp_func( \
   2750       CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk),                 \
   2751       CHECKED_CAST(stack_cmp_func,                                         \
   2752                    int (*)(const X509_LOOKUP **a, const X509_LOOKUP **b),  \
   2753                    comp)))
   2754 
   2755 #define sk_X509_LOOKUP_deep_copy(sk, copy_func, free_func)             \
   2756   ((STACK_OF(X509_LOOKUP) *)sk_deep_copy(                              \
   2757       CHECKED_CAST(const _STACK *, const STACK_OF(X509_LOOKUP) *, sk), \
   2758       CHECKED_CAST(void *(*)(void *), X509_LOOKUP *(*)(X509_LOOKUP *), \
   2759                    copy_func),                                         \
   2760       CHECKED_CAST(void (*)(void *), void (*)(X509_LOOKUP *), free_func)))
   2761 
   2762 /* X509_NAME */
   2763 #define sk_X509_NAME_new(comp)     \
   2764   ((STACK_OF(X509_NAME) *)sk_new(  \
   2765       CHECKED_CAST(stack_cmp_func, \
   2766                    int (*)(const X509_NAME **a, const X509_NAME **b), comp)))
   2767 
   2768 #define sk_X509_NAME_new_null() ((STACK_OF(X509_NAME) *)sk_new_null())
   2769 
   2770 #define sk_X509_NAME_num(sk) \
   2771   sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk))
   2772 
   2773 #define sk_X509_NAME_zero(sk) \
   2774   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk));
   2775 
   2776 #define sk_X509_NAME_value(sk, i) \
   2777   ((X509_NAME *)sk_value(         \
   2778       CHECKED_CAST(_STACK *, const STACK_OF(X509_NAME) *, sk), (i)))
   2779 
   2780 #define sk_X509_NAME_set(sk, i, p)                                             \
   2781   ((X509_NAME *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk), (i), \
   2782                        CHECKED_CAST(void *, X509_NAME *, p)))
   2783 
   2784 #define sk_X509_NAME_free(sk) \
   2785   sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk))
   2786 
   2787 #define sk_X509_NAME_pop_free(sk, free_func)             \
   2788   sk_pop_free(                                           \
   2789       CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk), \
   2790       CHECKED_CAST(void (*)(void *), void (*)(X509_NAME *), free_func))
   2791 
   2792 #define sk_X509_NAME_insert(sk, p, where)                      \
   2793   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk), \
   2794             CHECKED_CAST(void *, X509_NAME *, p), (where))
   2795 
   2796 #define sk_X509_NAME_delete(sk, where)                                       \
   2797   ((X509_NAME *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk), \
   2798                           (where)))
   2799 
   2800 #define sk_X509_NAME_delete_ptr(sk, p)                   \
   2801   ((X509_NAME *)sk_delete_ptr(                           \
   2802       CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk), \
   2803       CHECKED_CAST(void *, X509_NAME *, p)))
   2804 
   2805 #define sk_X509_NAME_find(sk, out_index, p)                               \
   2806   sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk), (out_index), \
   2807           CHECKED_CAST(void *, X509_NAME *, p))
   2808 
   2809 #define sk_X509_NAME_shift(sk) \
   2810   ((X509_NAME *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk)))
   2811 
   2812 #define sk_X509_NAME_push(sk, p)                             \
   2813   sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk), \
   2814           CHECKED_CAST(void *, X509_NAME *, p))
   2815 
   2816 #define sk_X509_NAME_pop(sk) \
   2817   ((X509_NAME *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk)))
   2818 
   2819 #define sk_X509_NAME_dup(sk)      \
   2820   ((STACK_OF(X509_NAME) *)sk_dup( \
   2821       CHECKED_CAST(_STACK *, const STACK_OF(X509_NAME) *, sk)))
   2822 
   2823 #define sk_X509_NAME_sort(sk) \
   2824   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk))
   2825 
   2826 #define sk_X509_NAME_is_sorted(sk) \
   2827   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_NAME) *, sk))
   2828 
   2829 #define sk_X509_NAME_set_cmp_func(sk, comp)                            \
   2830   ((int (*)(const X509_NAME **a, const X509_NAME **b))sk_set_cmp_func( \
   2831       CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk),               \
   2832       CHECKED_CAST(stack_cmp_func,                                     \
   2833                    int (*)(const X509_NAME **a, const X509_NAME **b), comp)))
   2834 
   2835 #define sk_X509_NAME_deep_copy(sk, copy_func, free_func)                       \
   2836   ((STACK_OF(X509_NAME) *)sk_deep_copy(                                        \
   2837       CHECKED_CAST(const _STACK *, const STACK_OF(X509_NAME) *, sk),           \
   2838       CHECKED_CAST(void *(*)(void *), X509_NAME *(*)(X509_NAME *), copy_func), \
   2839       CHECKED_CAST(void (*)(void *), void (*)(X509_NAME *), free_func)))
   2840 
   2841 /* X509_NAME_ENTRY */
   2842 #define sk_X509_NAME_ENTRY_new(comp)                 \
   2843   ((STACK_OF(X509_NAME_ENTRY) *)sk_new(CHECKED_CAST( \
   2844       stack_cmp_func,                                \
   2845       int (*)(const X509_NAME_ENTRY **a, const X509_NAME_ENTRY **b), comp)))
   2846 
   2847 #define sk_X509_NAME_ENTRY_new_null() \
   2848   ((STACK_OF(X509_NAME_ENTRY) *)sk_new_null())
   2849 
   2850 #define sk_X509_NAME_ENTRY_num(sk) \
   2851   sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk))
   2852 
   2853 #define sk_X509_NAME_ENTRY_zero(sk) \
   2854   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk));
   2855 
   2856 #define sk_X509_NAME_ENTRY_value(sk, i) \
   2857   ((X509_NAME_ENTRY *)sk_value(         \
   2858       CHECKED_CAST(_STACK *, const STACK_OF(X509_NAME_ENTRY) *, sk), (i)))
   2859 
   2860 #define sk_X509_NAME_ENTRY_set(sk, i, p)                            \
   2861   ((X509_NAME_ENTRY *)sk_set(                                       \
   2862       CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk), (i), \
   2863       CHECKED_CAST(void *, X509_NAME_ENTRY *, p)))
   2864 
   2865 #define sk_X509_NAME_ENTRY_free(sk) \
   2866   sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk))
   2867 
   2868 #define sk_X509_NAME_ENTRY_pop_free(sk, free_func)             \
   2869   sk_pop_free(                                                 \
   2870       CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk), \
   2871       CHECKED_CAST(void (*)(void *), void (*)(X509_NAME_ENTRY *), free_func))
   2872 
   2873 #define sk_X509_NAME_ENTRY_insert(sk, p, where)                      \
   2874   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk), \
   2875             CHECKED_CAST(void *, X509_NAME_ENTRY *, p), (where))
   2876 
   2877 #define sk_X509_NAME_ENTRY_delete(sk, where) \
   2878   ((X509_NAME_ENTRY *)sk_delete(             \
   2879       CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk), (where)))
   2880 
   2881 #define sk_X509_NAME_ENTRY_delete_ptr(sk, p)                   \
   2882   ((X509_NAME_ENTRY *)sk_delete_ptr(                           \
   2883       CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk), \
   2884       CHECKED_CAST(void *, X509_NAME_ENTRY *, p)))
   2885 
   2886 #define sk_X509_NAME_ENTRY_find(sk, out_index, p)                  \
   2887   sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk), \
   2888           (out_index), CHECKED_CAST(void *, X509_NAME_ENTRY *, p))
   2889 
   2890 #define sk_X509_NAME_ENTRY_shift(sk) \
   2891   ((X509_NAME_ENTRY *)sk_shift(      \
   2892       CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk)))
   2893 
   2894 #define sk_X509_NAME_ENTRY_push(sk, p)                             \
   2895   sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk), \
   2896           CHECKED_CAST(void *, X509_NAME_ENTRY *, p))
   2897 
   2898 #define sk_X509_NAME_ENTRY_pop(sk) \
   2899   ((X509_NAME_ENTRY *)sk_pop(      \
   2900       CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk)))
   2901 
   2902 #define sk_X509_NAME_ENTRY_dup(sk)      \
   2903   ((STACK_OF(X509_NAME_ENTRY) *)sk_dup( \
   2904       CHECKED_CAST(_STACK *, const STACK_OF(X509_NAME_ENTRY) *, sk)))
   2905 
   2906 #define sk_X509_NAME_ENTRY_sort(sk) \
   2907   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk))
   2908 
   2909 #define sk_X509_NAME_ENTRY_is_sorted(sk) \
   2910   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_NAME_ENTRY) *, sk))
   2911 
   2912 #define sk_X509_NAME_ENTRY_set_cmp_func(sk, comp)                           \
   2913   ((int (*)(const X509_NAME_ENTRY **a, const X509_NAME_ENTRY **b))          \
   2914        sk_set_cmp_func(                                                     \
   2915            CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk),         \
   2916            CHECKED_CAST(stack_cmp_func, int (*)(const X509_NAME_ENTRY **a,  \
   2917                                                 const X509_NAME_ENTRY **b), \
   2918                         comp)))
   2919 
   2920 #define sk_X509_NAME_ENTRY_deep_copy(sk, copy_func, free_func)                 \
   2921   ((STACK_OF(X509_NAME_ENTRY) *)sk_deep_copy(                                  \
   2922       CHECKED_CAST(const _STACK *, const STACK_OF(X509_NAME_ENTRY) *, sk),     \
   2923       CHECKED_CAST(void *(*)(void *), X509_NAME_ENTRY *(*)(X509_NAME_ENTRY *), \
   2924                    copy_func),                                                 \
   2925       CHECKED_CAST(void (*)(void *), void (*)(X509_NAME_ENTRY *), free_func)))
   2926 
   2927 /* X509_OBJECT */
   2928 #define sk_X509_OBJECT_new(comp)                                             \
   2929   ((STACK_OF(X509_OBJECT) *)sk_new(CHECKED_CAST(                             \
   2930       stack_cmp_func, int (*)(const X509_OBJECT **a, const X509_OBJECT **b), \
   2931       comp)))
   2932 
   2933 #define sk_X509_OBJECT_new_null() ((STACK_OF(X509_OBJECT) *)sk_new_null())
   2934 
   2935 #define sk_X509_OBJECT_num(sk) \
   2936   sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk))
   2937 
   2938 #define sk_X509_OBJECT_zero(sk) \
   2939   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk));
   2940 
   2941 #define sk_X509_OBJECT_value(sk, i) \
   2942   ((X509_OBJECT *)sk_value(         \
   2943       CHECKED_CAST(_STACK *, const STACK_OF(X509_OBJECT) *, sk), (i)))
   2944 
   2945 #define sk_X509_OBJECT_set(sk, i, p)                                          \
   2946   ((X509_OBJECT *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk), \
   2947                          (i), CHECKED_CAST(void *, X509_OBJECT *, p)))
   2948 
   2949 #define sk_X509_OBJECT_free(sk) \
   2950   sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk))
   2951 
   2952 #define sk_X509_OBJECT_pop_free(sk, free_func)             \
   2953   sk_pop_free(                                             \
   2954       CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk), \
   2955       CHECKED_CAST(void (*)(void *), void (*)(X509_OBJECT *), free_func))
   2956 
   2957 #define sk_X509_OBJECT_insert(sk, p, where)                      \
   2958   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk), \
   2959             CHECKED_CAST(void *, X509_OBJECT *, p), (where))
   2960 
   2961 #define sk_X509_OBJECT_delete(sk, where) \
   2962   ((X509_OBJECT *)sk_delete(             \
   2963       CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk), (where)))
   2964 
   2965 #define sk_X509_OBJECT_delete_ptr(sk, p)                   \
   2966   ((X509_OBJECT *)sk_delete_ptr(                           \
   2967       CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk), \
   2968       CHECKED_CAST(void *, X509_OBJECT *, p)))
   2969 
   2970 #define sk_X509_OBJECT_find(sk, out_index, p)                               \
   2971   sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk), (out_index), \
   2972           CHECKED_CAST(void *, X509_OBJECT *, p))
   2973 
   2974 #define sk_X509_OBJECT_shift(sk) \
   2975   ((X509_OBJECT *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk)))
   2976 
   2977 #define sk_X509_OBJECT_push(sk, p)                             \
   2978   sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk), \
   2979           CHECKED_CAST(void *, X509_OBJECT *, p))
   2980 
   2981 #define sk_X509_OBJECT_pop(sk) \
   2982   ((X509_OBJECT *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk)))
   2983 
   2984 #define sk_X509_OBJECT_dup(sk)      \
   2985   ((STACK_OF(X509_OBJECT) *)sk_dup( \
   2986       CHECKED_CAST(_STACK *, const STACK_OF(X509_OBJECT) *, sk)))
   2987 
   2988 #define sk_X509_OBJECT_sort(sk) \
   2989   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk))
   2990 
   2991 #define sk_X509_OBJECT_is_sorted(sk) \
   2992   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_OBJECT) *, sk))
   2993 
   2994 #define sk_X509_OBJECT_set_cmp_func(sk, comp)                              \
   2995   ((int (*)(const X509_OBJECT **a, const X509_OBJECT **b))sk_set_cmp_func( \
   2996       CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk),                 \
   2997       CHECKED_CAST(stack_cmp_func,                                         \
   2998                    int (*)(const X509_OBJECT **a, const X509_OBJECT **b),  \
   2999                    comp)))
   3000 
   3001 #define sk_X509_OBJECT_deep_copy(sk, copy_func, free_func)             \
   3002   ((STACK_OF(X509_OBJECT) *)sk_deep_copy(                              \
   3003       CHECKED_CAST(const _STACK *, const STACK_OF(X509_OBJECT) *, sk), \
   3004       CHECKED_CAST(void *(*)(void *), X509_OBJECT *(*)(X509_OBJECT *), \
   3005                    copy_func),                                         \
   3006       CHECKED_CAST(void (*)(void *), void (*)(X509_OBJECT *), free_func)))
   3007 
   3008 /* X509_POLICY_DATA */
   3009 #define sk_X509_POLICY_DATA_new(comp)                 \
   3010   ((STACK_OF(X509_POLICY_DATA) *)sk_new(CHECKED_CAST( \
   3011       stack_cmp_func,                                 \
   3012       int (*)(const X509_POLICY_DATA **a, const X509_POLICY_DATA **b), comp)))
   3013 
   3014 #define sk_X509_POLICY_DATA_new_null() \
   3015   ((STACK_OF(X509_POLICY_DATA) *)sk_new_null())
   3016 
   3017 #define sk_X509_POLICY_DATA_num(sk) \
   3018   sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk))
   3019 
   3020 #define sk_X509_POLICY_DATA_zero(sk) \
   3021   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk));
   3022 
   3023 #define sk_X509_POLICY_DATA_value(sk, i) \
   3024   ((X509_POLICY_DATA *)sk_value(         \
   3025       CHECKED_CAST(_STACK *, const STACK_OF(X509_POLICY_DATA) *, sk), (i)))
   3026 
   3027 #define sk_X509_POLICY_DATA_set(sk, i, p)                            \
   3028   ((X509_POLICY_DATA *)sk_set(                                       \
   3029       CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk), (i), \
   3030       CHECKED_CAST(void *, X509_POLICY_DATA *, p)))
   3031 
   3032 #define sk_X509_POLICY_DATA_free(sk) \
   3033   sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk))
   3034 
   3035 #define sk_X509_POLICY_DATA_pop_free(sk, free_func)             \
   3036   sk_pop_free(                                                  \
   3037       CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk), \
   3038       CHECKED_CAST(void (*)(void *), void (*)(X509_POLICY_DATA *), free_func))
   3039 
   3040 #define sk_X509_POLICY_DATA_insert(sk, p, where)                      \
   3041   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk), \
   3042             CHECKED_CAST(void *, X509_POLICY_DATA *, p), (where))
   3043 
   3044 #define sk_X509_POLICY_DATA_delete(sk, where) \
   3045   ((X509_POLICY_DATA *)sk_delete(             \
   3046       CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk), (where)))
   3047 
   3048 #define sk_X509_POLICY_DATA_delete_ptr(sk, p)                   \
   3049   ((X509_POLICY_DATA *)sk_delete_ptr(                           \
   3050       CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk), \
   3051       CHECKED_CAST(void *, X509_POLICY_DATA *, p)))
   3052 
   3053 #define sk_X509_POLICY_DATA_find(sk, out_index, p)                  \
   3054   sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk), \
   3055           (out_index), CHECKED_CAST(void *, X509_POLICY_DATA *, p))
   3056 
   3057 #define sk_X509_POLICY_DATA_shift(sk) \
   3058   ((X509_POLICY_DATA *)sk_shift(      \
   3059       CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk)))
   3060 
   3061 #define sk_X509_POLICY_DATA_push(sk, p)                             \
   3062   sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk), \
   3063           CHECKED_CAST(void *, X509_POLICY_DATA *, p))
   3064 
   3065 #define sk_X509_POLICY_DATA_pop(sk) \
   3066   ((X509_POLICY_DATA *)sk_pop(      \
   3067       CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk)))
   3068 
   3069 #define sk_X509_POLICY_DATA_dup(sk)      \
   3070   ((STACK_OF(X509_POLICY_DATA) *)sk_dup( \
   3071       CHECKED_CAST(_STACK *, const STACK_OF(X509_POLICY_DATA) *, sk)))
   3072 
   3073 #define sk_X509_POLICY_DATA_sort(sk) \
   3074   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk))
   3075 
   3076 #define sk_X509_POLICY_DATA_is_sorted(sk) \
   3077   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_POLICY_DATA) *, sk))
   3078 
   3079 #define sk_X509_POLICY_DATA_set_cmp_func(sk, comp)                           \
   3080   ((int (*)(const X509_POLICY_DATA **a, const X509_POLICY_DATA **b))         \
   3081        sk_set_cmp_func(                                                      \
   3082            CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk),         \
   3083            CHECKED_CAST(stack_cmp_func, int (*)(const X509_POLICY_DATA **a,  \
   3084                                                 const X509_POLICY_DATA **b), \
   3085                         comp)))
   3086 
   3087 #define sk_X509_POLICY_DATA_deep_copy(sk, copy_func, free_func)             \
   3088   ((STACK_OF(X509_POLICY_DATA) *)sk_deep_copy(                              \
   3089       CHECKED_CAST(const _STACK *, const STACK_OF(X509_POLICY_DATA) *, sk), \
   3090       CHECKED_CAST(void *(*)(void *),                                       \
   3091                    X509_POLICY_DATA *(*)(X509_POLICY_DATA *), copy_func),   \
   3092       CHECKED_CAST(void (*)(void *), void (*)(X509_POLICY_DATA *),          \
   3093                    free_func)))
   3094 
   3095 /* X509_POLICY_NODE */
   3096 #define sk_X509_POLICY_NODE_new(comp)                 \
   3097   ((STACK_OF(X509_POLICY_NODE) *)sk_new(CHECKED_CAST( \
   3098       stack_cmp_func,                                 \
   3099       int (*)(const X509_POLICY_NODE **a, const X509_POLICY_NODE **b), comp)))
   3100 
   3101 #define sk_X509_POLICY_NODE_new_null() \
   3102   ((STACK_OF(X509_POLICY_NODE) *)sk_new_null())
   3103 
   3104 #define sk_X509_POLICY_NODE_num(sk) \
   3105   sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk))
   3106 
   3107 #define sk_X509_POLICY_NODE_zero(sk) \
   3108   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk));
   3109 
   3110 #define sk_X509_POLICY_NODE_value(sk, i) \
   3111   ((X509_POLICY_NODE *)sk_value(         \
   3112       CHECKED_CAST(_STACK *, const STACK_OF(X509_POLICY_NODE) *, sk), (i)))
   3113 
   3114 #define sk_X509_POLICY_NODE_set(sk, i, p)                            \
   3115   ((X509_POLICY_NODE *)sk_set(                                       \
   3116       CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk), (i), \
   3117       CHECKED_CAST(void *, X509_POLICY_NODE *, p)))
   3118 
   3119 #define sk_X509_POLICY_NODE_free(sk) \
   3120   sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk))
   3121 
   3122 #define sk_X509_POLICY_NODE_pop_free(sk, free_func)             \
   3123   sk_pop_free(                                                  \
   3124       CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk), \
   3125       CHECKED_CAST(void (*)(void *), void (*)(X509_POLICY_NODE *), free_func))
   3126 
   3127 #define sk_X509_POLICY_NODE_insert(sk, p, where)                      \
   3128   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk), \
   3129             CHECKED_CAST(void *, X509_POLICY_NODE *, p), (where))
   3130 
   3131 #define sk_X509_POLICY_NODE_delete(sk, where) \
   3132   ((X509_POLICY_NODE *)sk_delete(             \
   3133       CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk), (where)))
   3134 
   3135 #define sk_X509_POLICY_NODE_delete_ptr(sk, p)                   \
   3136   ((X509_POLICY_NODE *)sk_delete_ptr(                           \
   3137       CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk), \
   3138       CHECKED_CAST(void *, X509_POLICY_NODE *, p)))
   3139 
   3140 #define sk_X509_POLICY_NODE_find(sk, out_index, p)                  \
   3141   sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk), \
   3142           (out_index), CHECKED_CAST(void *, X509_POLICY_NODE *, p))
   3143 
   3144 #define sk_X509_POLICY_NODE_shift(sk) \
   3145   ((X509_POLICY_NODE *)sk_shift(      \
   3146       CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk)))
   3147 
   3148 #define sk_X509_POLICY_NODE_push(sk, p)                             \
   3149   sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk), \
   3150           CHECKED_CAST(void *, X509_POLICY_NODE *, p))
   3151 
   3152 #define sk_X509_POLICY_NODE_pop(sk) \
   3153   ((X509_POLICY_NODE *)sk_pop(      \
   3154       CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk)))
   3155 
   3156 #define sk_X509_POLICY_NODE_dup(sk)      \
   3157   ((STACK_OF(X509_POLICY_NODE) *)sk_dup( \
   3158       CHECKED_CAST(_STACK *, const STACK_OF(X509_POLICY_NODE) *, sk)))
   3159 
   3160 #define sk_X509_POLICY_NODE_sort(sk) \
   3161   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk))
   3162 
   3163 #define sk_X509_POLICY_NODE_is_sorted(sk) \
   3164   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_POLICY_NODE) *, sk))
   3165 
   3166 #define sk_X509_POLICY_NODE_set_cmp_func(sk, comp)                           \
   3167   ((int (*)(const X509_POLICY_NODE **a, const X509_POLICY_NODE **b))         \
   3168        sk_set_cmp_func(                                                      \
   3169            CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk),         \
   3170            CHECKED_CAST(stack_cmp_func, int (*)(const X509_POLICY_NODE **a,  \
   3171                                                 const X509_POLICY_NODE **b), \
   3172                         comp)))
   3173 
   3174 #define sk_X509_POLICY_NODE_deep_copy(sk, copy_func, free_func)             \
   3175   ((STACK_OF(X509_POLICY_NODE) *)sk_deep_copy(                              \
   3176       CHECKED_CAST(const _STACK *, const STACK_OF(X509_POLICY_NODE) *, sk), \
   3177       CHECKED_CAST(void *(*)(void *),                                       \
   3178                    X509_POLICY_NODE *(*)(X509_POLICY_NODE *), copy_func),   \
   3179       CHECKED_CAST(void (*)(void *), void (*)(X509_POLICY_NODE *),          \
   3180                    free_func)))
   3181 
   3182 /* X509_PURPOSE */
   3183 #define sk_X509_PURPOSE_new(comp)                                              \
   3184   ((STACK_OF(X509_PURPOSE) *)sk_new(CHECKED_CAST(                              \
   3185       stack_cmp_func, int (*)(const X509_PURPOSE **a, const X509_PURPOSE **b), \
   3186       comp)))
   3187 
   3188 #define sk_X509_PURPOSE_new_null() ((STACK_OF(X509_PURPOSE) *)sk_new_null())
   3189 
   3190 #define sk_X509_PURPOSE_num(sk) \
   3191   sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk))
   3192 
   3193 #define sk_X509_PURPOSE_zero(sk) \
   3194   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk));
   3195 
   3196 #define sk_X509_PURPOSE_value(sk, i) \
   3197   ((X509_PURPOSE *)sk_value(         \
   3198       CHECKED_CAST(_STACK *, const STACK_OF(X509_PURPOSE) *, sk), (i)))
   3199 
   3200 #define sk_X509_PURPOSE_set(sk, i, p)                            \
   3201   ((X509_PURPOSE *)sk_set(                                       \
   3202       CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk), (i), \
   3203       CHECKED_CAST(void *, X509_PURPOSE *, p)))
   3204 
   3205 #define sk_X509_PURPOSE_free(sk) \
   3206   sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk))
   3207 
   3208 #define sk_X509_PURPOSE_pop_free(sk, free_func)             \
   3209   sk_pop_free(                                              \
   3210       CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk), \
   3211       CHECKED_CAST(void (*)(void *), void (*)(X509_PURPOSE *), free_func))
   3212 
   3213 #define sk_X509_PURPOSE_insert(sk, p, where)                      \
   3214   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk), \
   3215             CHECKED_CAST(void *, X509_PURPOSE *, p), (where))
   3216 
   3217 #define sk_X509_PURPOSE_delete(sk, where) \
   3218   ((X509_PURPOSE *)sk_delete(             \
   3219       CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk), (where)))
   3220 
   3221 #define sk_X509_PURPOSE_delete_ptr(sk, p)                   \
   3222   ((X509_PURPOSE *)sk_delete_ptr(                           \
   3223       CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk), \
   3224       CHECKED_CAST(void *, X509_PURPOSE *, p)))
   3225 
   3226 #define sk_X509_PURPOSE_find(sk, out_index, p)                               \
   3227   sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk), (out_index), \
   3228           CHECKED_CAST(void *, X509_PURPOSE *, p))
   3229 
   3230 #define sk_X509_PURPOSE_shift(sk) \
   3231   ((X509_PURPOSE *)sk_shift(      \
   3232       CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk)))
   3233 
   3234 #define sk_X509_PURPOSE_push(sk, p)                             \
   3235   sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk), \
   3236           CHECKED_CAST(void *, X509_PURPOSE *, p))
   3237 
   3238 #define sk_X509_PURPOSE_pop(sk) \
   3239   ((X509_PURPOSE *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk)))
   3240 
   3241 #define sk_X509_PURPOSE_dup(sk)      \
   3242   ((STACK_OF(X509_PURPOSE) *)sk_dup( \
   3243       CHECKED_CAST(_STACK *, const STACK_OF(X509_PURPOSE) *, sk)))
   3244 
   3245 #define sk_X509_PURPOSE_sort(sk) \
   3246   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk))
   3247 
   3248 #define sk_X509_PURPOSE_is_sorted(sk) \
   3249   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_PURPOSE) *, sk))
   3250 
   3251 #define sk_X509_PURPOSE_set_cmp_func(sk, comp)                               \
   3252   ((int (*)(const X509_PURPOSE **a, const X509_PURPOSE **b))sk_set_cmp_func( \
   3253       CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk),                  \
   3254       CHECKED_CAST(stack_cmp_func,                                           \
   3255                    int (*)(const X509_PURPOSE **a, const X509_PURPOSE **b),  \
   3256                    comp)))
   3257 
   3258 #define sk_X509_PURPOSE_deep_copy(sk, copy_func, free_func)              \
   3259   ((STACK_OF(X509_PURPOSE) *)sk_deep_copy(                               \
   3260       CHECKED_CAST(const _STACK *, const STACK_OF(X509_PURPOSE) *, sk),  \
   3261       CHECKED_CAST(void *(*)(void *), X509_PURPOSE *(*)(X509_PURPOSE *), \
   3262                    copy_func),                                           \
   3263       CHECKED_CAST(void (*)(void *), void (*)(X509_PURPOSE *), free_func)))
   3264 
   3265 /* X509_REVOKED */
   3266 #define sk_X509_REVOKED_new(comp)                                              \
   3267   ((STACK_OF(X509_REVOKED) *)sk_new(CHECKED_CAST(                              \
   3268       stack_cmp_func, int (*)(const X509_REVOKED **a, const X509_REVOKED **b), \
   3269       comp)))
   3270 
   3271 #define sk_X509_REVOKED_new_null() ((STACK_OF(X509_REVOKED) *)sk_new_null())
   3272 
   3273 #define sk_X509_REVOKED_num(sk) \
   3274   sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk))
   3275 
   3276 #define sk_X509_REVOKED_zero(sk) \
   3277   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk));
   3278 
   3279 #define sk_X509_REVOKED_value(sk, i) \
   3280   ((X509_REVOKED *)sk_value(         \
   3281       CHECKED_CAST(_STACK *, const STACK_OF(X509_REVOKED) *, sk), (i)))
   3282 
   3283 #define sk_X509_REVOKED_set(sk, i, p)                            \
   3284   ((X509_REVOKED *)sk_set(                                       \
   3285       CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk), (i), \
   3286       CHECKED_CAST(void *, X509_REVOKED *, p)))
   3287 
   3288 #define sk_X509_REVOKED_free(sk) \
   3289   sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk))
   3290 
   3291 #define sk_X509_REVOKED_pop_free(sk, free_func)             \
   3292   sk_pop_free(                                              \
   3293       CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk), \
   3294       CHECKED_CAST(void (*)(void *), void (*)(X509_REVOKED *), free_func))
   3295 
   3296 #define sk_X509_REVOKED_insert(sk, p, where)                      \
   3297   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk), \
   3298             CHECKED_CAST(void *, X509_REVOKED *, p), (where))
   3299 
   3300 #define sk_X509_REVOKED_delete(sk, where) \
   3301   ((X509_REVOKED *)sk_delete(             \
   3302       CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk), (where)))
   3303 
   3304 #define sk_X509_REVOKED_delete_ptr(sk, p)                   \
   3305   ((X509_REVOKED *)sk_delete_ptr(                           \
   3306       CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk), \
   3307       CHECKED_CAST(void *, X509_REVOKED *, p)))
   3308 
   3309 #define sk_X509_REVOKED_find(sk, out_index, p)                               \
   3310   sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk), (out_index), \
   3311           CHECKED_CAST(void *, X509_REVOKED *, p))
   3312 
   3313 #define sk_X509_REVOKED_shift(sk) \
   3314   ((X509_REVOKED *)sk_shift(      \
   3315       CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk)))
   3316 
   3317 #define sk_X509_REVOKED_push(sk, p)                             \
   3318   sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk), \
   3319           CHECKED_CAST(void *, X509_REVOKED *, p))
   3320 
   3321 #define sk_X509_REVOKED_pop(sk) \
   3322   ((X509_REVOKED *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk)))
   3323 
   3324 #define sk_X509_REVOKED_dup(sk)      \
   3325   ((STACK_OF(X509_REVOKED) *)sk_dup( \
   3326       CHECKED_CAST(_STACK *, const STACK_OF(X509_REVOKED) *, sk)))
   3327 
   3328 #define sk_X509_REVOKED_sort(sk) \
   3329   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk))
   3330 
   3331 #define sk_X509_REVOKED_is_sorted(sk) \
   3332   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_REVOKED) *, sk))
   3333 
   3334 #define sk_X509_REVOKED_set_cmp_func(sk, comp)                               \
   3335   ((int (*)(const X509_REVOKED **a, const X509_REVOKED **b))sk_set_cmp_func( \
   3336       CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk),                  \
   3337       CHECKED_CAST(stack_cmp_func,                                           \
   3338                    int (*)(const X509_REVOKED **a, const X509_REVOKED **b),  \
   3339                    comp)))
   3340 
   3341 #define sk_X509_REVOKED_deep_copy(sk, copy_func, free_func)              \
   3342   ((STACK_OF(X509_REVOKED) *)sk_deep_copy(                               \
   3343       CHECKED_CAST(const _STACK *, const STACK_OF(X509_REVOKED) *, sk),  \
   3344       CHECKED_CAST(void *(*)(void *), X509_REVOKED *(*)(X509_REVOKED *), \
   3345                    copy_func),                                           \
   3346       CHECKED_CAST(void (*)(void *), void (*)(X509_REVOKED *), free_func)))
   3347 
   3348 /* X509_TRUST */
   3349 #define sk_X509_TRUST_new(comp)                                            \
   3350   ((STACK_OF(X509_TRUST) *)sk_new(CHECKED_CAST(                            \
   3351       stack_cmp_func, int (*)(const X509_TRUST **a, const X509_TRUST **b), \
   3352       comp)))
   3353 
   3354 #define sk_X509_TRUST_new_null() ((STACK_OF(X509_TRUST) *)sk_new_null())
   3355 
   3356 #define sk_X509_TRUST_num(sk) \
   3357   sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk))
   3358 
   3359 #define sk_X509_TRUST_zero(sk) \
   3360   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk));
   3361 
   3362 #define sk_X509_TRUST_value(sk, i) \
   3363   ((X509_TRUST *)sk_value(         \
   3364       CHECKED_CAST(_STACK *, const STACK_OF(X509_TRUST) *, sk), (i)))
   3365 
   3366 #define sk_X509_TRUST_set(sk, i, p)                                         \
   3367   ((X509_TRUST *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk), \
   3368                         (i), CHECKED_CAST(void *, X509_TRUST *, p)))
   3369 
   3370 #define sk_X509_TRUST_free(sk) \
   3371   sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk))
   3372 
   3373 #define sk_X509_TRUST_pop_free(sk, free_func)             \
   3374   sk_pop_free(                                            \
   3375       CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk), \
   3376       CHECKED_CAST(void (*)(void *), void (*)(X509_TRUST *), free_func))
   3377 
   3378 #define sk_X509_TRUST_insert(sk, p, where)                      \
   3379   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk), \
   3380             CHECKED_CAST(void *, X509_TRUST *, p), (where))
   3381 
   3382 #define sk_X509_TRUST_delete(sk, where)                                        \
   3383   ((X509_TRUST *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk), \
   3384                            (where)))
   3385 
   3386 #define sk_X509_TRUST_delete_ptr(sk, p)                   \
   3387   ((X509_TRUST *)sk_delete_ptr(                           \
   3388       CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk), \
   3389       CHECKED_CAST(void *, X509_TRUST *, p)))
   3390 
   3391 #define sk_X509_TRUST_find(sk, out_index, p)                               \
   3392   sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk), (out_index), \
   3393           CHECKED_CAST(void *, X509_TRUST *, p))
   3394 
   3395 #define sk_X509_TRUST_shift(sk) \
   3396   ((X509_TRUST *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk)))
   3397 
   3398 #define sk_X509_TRUST_push(sk, p)                             \
   3399   sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk), \
   3400           CHECKED_CAST(void *, X509_TRUST *, p))
   3401 
   3402 #define sk_X509_TRUST_pop(sk) \
   3403   ((X509_TRUST *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk)))
   3404 
   3405 #define sk_X509_TRUST_dup(sk)      \
   3406   ((STACK_OF(X509_TRUST) *)sk_dup( \
   3407       CHECKED_CAST(_STACK *, const STACK_OF(X509_TRUST) *, sk)))
   3408 
   3409 #define sk_X509_TRUST_sort(sk) \
   3410   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk))
   3411 
   3412 #define sk_X509_TRUST_is_sorted(sk) \
   3413   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_TRUST) *, sk))
   3414 
   3415 #define sk_X509_TRUST_set_cmp_func(sk, comp)                             \
   3416   ((int (*)(const X509_TRUST **a, const X509_TRUST **b))sk_set_cmp_func( \
   3417       CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk),                \
   3418       CHECKED_CAST(stack_cmp_func,                                       \
   3419                    int (*)(const X509_TRUST **a, const X509_TRUST **b),  \
   3420                    comp)))
   3421 
   3422 #define sk_X509_TRUST_deep_copy(sk, copy_func, free_func)             \
   3423   ((STACK_OF(X509_TRUST) *)sk_deep_copy(                              \
   3424       CHECKED_CAST(const _STACK *, const STACK_OF(X509_TRUST) *, sk), \
   3425       CHECKED_CAST(void *(*)(void *), X509_TRUST *(*)(X509_TRUST *),  \
   3426                    copy_func),                                        \
   3427       CHECKED_CAST(void (*)(void *), void (*)(X509_TRUST *), free_func)))
   3428 
   3429 /* X509_VERIFY_PARAM */
   3430 #define sk_X509_VERIFY_PARAM_new(comp)                                   \
   3431   ((STACK_OF(X509_VERIFY_PARAM) *)sk_new(CHECKED_CAST(                   \
   3432       stack_cmp_func,                                                    \
   3433       int (*)(const X509_VERIFY_PARAM **a, const X509_VERIFY_PARAM **b), \
   3434       comp)))
   3435 
   3436 #define sk_X509_VERIFY_PARAM_new_null() \
   3437   ((STACK_OF(X509_VERIFY_PARAM) *)sk_new_null())
   3438 
   3439 #define sk_X509_VERIFY_PARAM_num(sk) \
   3440   sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk))
   3441 
   3442 #define sk_X509_VERIFY_PARAM_zero(sk) \
   3443   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk));
   3444 
   3445 #define sk_X509_VERIFY_PARAM_value(sk, i) \
   3446   ((X509_VERIFY_PARAM *)sk_value(         \
   3447       CHECKED_CAST(_STACK *, const STACK_OF(X509_VERIFY_PARAM) *, sk), (i)))
   3448 
   3449 #define sk_X509_VERIFY_PARAM_set(sk, i, p)                            \
   3450   ((X509_VERIFY_PARAM *)sk_set(                                       \
   3451       CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk), (i), \
   3452       CHECKED_CAST(void *, X509_VERIFY_PARAM *, p)))
   3453 
   3454 #define sk_X509_VERIFY_PARAM_free(sk) \
   3455   sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk))
   3456 
   3457 #define sk_X509_VERIFY_PARAM_pop_free(sk, free_func)                        \
   3458   sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk),    \
   3459               CHECKED_CAST(void (*)(void *), void (*)(X509_VERIFY_PARAM *), \
   3460                            free_func))
   3461 
   3462 #define sk_X509_VERIFY_PARAM_insert(sk, p, where)                      \
   3463   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk), \
   3464             CHECKED_CAST(void *, X509_VERIFY_PARAM *, p), (where))
   3465 
   3466 #define sk_X509_VERIFY_PARAM_delete(sk, where) \
   3467   ((X509_VERIFY_PARAM *)sk_delete(             \
   3468       CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk), (where)))
   3469 
   3470 #define sk_X509_VERIFY_PARAM_delete_ptr(sk, p)                   \
   3471   ((X509_VERIFY_PARAM *)sk_delete_ptr(                           \
   3472       CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk), \
   3473       CHECKED_CAST(void *, X509_VERIFY_PARAM *, p)))
   3474 
   3475 #define sk_X509_VERIFY_PARAM_find(sk, out_index, p)                  \
   3476   sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk), \
   3477           (out_index), CHECKED_CAST(void *, X509_VERIFY_PARAM *, p))
   3478 
   3479 #define sk_X509_VERIFY_PARAM_shift(sk) \
   3480   ((X509_VERIFY_PARAM *)sk_shift(      \
   3481       CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk)))
   3482 
   3483 #define sk_X509_VERIFY_PARAM_push(sk, p)                             \
   3484   sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk), \
   3485           CHECKED_CAST(void *, X509_VERIFY_PARAM *, p))
   3486 
   3487 #define sk_X509_VERIFY_PARAM_pop(sk) \
   3488   ((X509_VERIFY_PARAM *)sk_pop(      \
   3489       CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk)))
   3490 
   3491 #define sk_X509_VERIFY_PARAM_dup(sk)      \
   3492   ((STACK_OF(X509_VERIFY_PARAM) *)sk_dup( \
   3493       CHECKED_CAST(_STACK *, const STACK_OF(X509_VERIFY_PARAM) *, sk)))
   3494 
   3495 #define sk_X509_VERIFY_PARAM_sort(sk) \
   3496   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk))
   3497 
   3498 #define sk_X509_VERIFY_PARAM_is_sorted(sk) \
   3499   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_VERIFY_PARAM) *, sk))
   3500 
   3501 #define sk_X509_VERIFY_PARAM_set_cmp_func(sk, comp)                           \
   3502   ((int (*)(const X509_VERIFY_PARAM **a, const X509_VERIFY_PARAM **b))        \
   3503        sk_set_cmp_func(                                                       \
   3504            CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk),         \
   3505            CHECKED_CAST(stack_cmp_func, int (*)(const X509_VERIFY_PARAM **a,  \
   3506                                                 const X509_VERIFY_PARAM **b), \
   3507                         comp)))
   3508 
   3509 #define sk_X509_VERIFY_PARAM_deep_copy(sk, copy_func, free_func)             \
   3510   ((STACK_OF(X509_VERIFY_PARAM) *)sk_deep_copy(                              \
   3511       CHECKED_CAST(const _STACK *, const STACK_OF(X509_VERIFY_PARAM) *, sk), \
   3512       CHECKED_CAST(void *(*)(void *),                                        \
   3513                    X509_VERIFY_PARAM *(*)(X509_VERIFY_PARAM *), copy_func),  \
   3514       CHECKED_CAST(void (*)(void *), void (*)(X509_VERIFY_PARAM *),          \
   3515                    free_func)))
   3516 
   3517 /* void */
   3518 #define sk_void_new(comp)                \
   3519   ((STACK_OF(void)*)sk_new(CHECKED_CAST( \
   3520       stack_cmp_func, int (*)(const void **a, const void **b), comp)))
   3521 
   3522 #define sk_void_new_null() ((STACK_OF(void)*)sk_new_null())
   3523 
   3524 #define sk_void_num(sk) sk_num(CHECKED_CAST(_STACK *, STACK_OF(void) *, sk))
   3525 
   3526 #define sk_void_zero(sk) sk_zero(CHECKED_CAST(_STACK *, STACK_OF(void) *, sk));
   3527 
   3528 #define sk_void_value(sk, i) \
   3529   ((void *)sk_value(CHECKED_CAST(_STACK *, const STACK_OF(void) *, sk), (i)))
   3530 
   3531 #define sk_void_set(sk, i, p)                                       \
   3532   ((void *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(void)*, sk), (i), \
   3533                   CHECKED_CAST(void *, void *, p)))
   3534 
   3535 #define sk_void_free(sk) sk_free(CHECKED_CAST(_STACK *, STACK_OF(void) *, sk))
   3536 
   3537 #define sk_void_pop_free(sk, free_func)                     \
   3538   sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(void) *, sk), \
   3539               CHECKED_CAST(void (*)(void *), void (*)(void *), free_func))
   3540 
   3541 #define sk_void_insert(sk, p, where)                      \
   3542   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(void) *, sk), \
   3543             CHECKED_CAST(void *, void *, p), (where))
   3544 
   3545 #define sk_void_delete(sk, where) \
   3546   ((void *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(void)*, sk), (where)))
   3547 
   3548 #define sk_void_delete_ptr(sk, p)                                     \
   3549   ((void *)sk_delete_ptr(CHECKED_CAST(_STACK *, STACK_OF(void)*, sk), \
   3550                          CHECKED_CAST(void *, void *, p)))
   3551 
   3552 #define sk_void_find(sk, out_index, p)                               \
   3553   sk_find(CHECKED_CAST(_STACK *, STACK_OF(void) *, sk), (out_index), \
   3554           CHECKED_CAST(void *, void *, p))
   3555 
   3556 #define sk_void_shift(sk) \
   3557   ((void *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(void)*, sk)))
   3558 
   3559 #define sk_void_push(sk, p)                             \
   3560   sk_push(CHECKED_CAST(_STACK *, STACK_OF(void) *, sk), \
   3561           CHECKED_CAST(void *, void *, p))
   3562 
   3563 #define sk_void_pop(sk) \
   3564   ((void *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(void)*, sk)))
   3565 
   3566 #define sk_void_dup(sk) \
   3567   ((STACK_OF(void)*)sk_dup(CHECKED_CAST(_STACK *, const STACK_OF(void) *, sk)))
   3568 
   3569 #define sk_void_sort(sk) sk_sort(CHECKED_CAST(_STACK *, STACK_OF(void) *, sk))
   3570 
   3571 #define sk_void_is_sorted(sk) \
   3572   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(void) *, sk))
   3573 
   3574 #define sk_void_set_cmp_func(sk, comp)                                      \
   3575   ((int (*)(const void **a, const void **b))sk_set_cmp_func(                \
   3576       CHECKED_CAST(_STACK *, STACK_OF(void)*, sk),                          \
   3577       CHECKED_CAST(stack_cmp_func, int (*)(const void **a, const void **b), \
   3578                    comp)))
   3579 
   3580 #define sk_void_deep_copy(sk, copy_func, free_func)                  \
   3581   ((STACK_OF(void)*)sk_deep_copy(                                    \
   3582       CHECKED_CAST(const _STACK *, const STACK_OF(void) *, sk),      \
   3583       CHECKED_CAST(void *(*)(void *), void *(*)(void *), copy_func), \
   3584       CHECKED_CAST(void (*)(void *), void (*)(void *), free_func)))
   3585 
   3586 /* SRTP_PROTECTION_PROFILE */
   3587 #define sk_SRTP_PROTECTION_PROFILE_new(comp)                            \
   3588   ((STACK_OF(SRTP_PROTECTION_PROFILE) *)sk_new(CHECKED_CAST(            \
   3589       stack_cmp_func, int (*)(const const SRTP_PROTECTION_PROFILE **a,  \
   3590                               const const SRTP_PROTECTION_PROFILE **b), \
   3591       comp)))
   3592 
   3593 #define sk_SRTP_PROTECTION_PROFILE_new_null() \
   3594   ((STACK_OF(SRTP_PROTECTION_PROFILE) *)sk_new_null())
   3595 
   3596 #define sk_SRTP_PROTECTION_PROFILE_num(sk) \
   3597   sk_num(CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk))
   3598 
   3599 #define sk_SRTP_PROTECTION_PROFILE_zero(sk) \
   3600   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk));
   3601 
   3602 #define sk_SRTP_PROTECTION_PROFILE_value(sk, i)                              \
   3603   ((const SRTP_PROTECTION_PROFILE *)sk_value(                                \
   3604       CHECKED_CAST(_STACK *, const STACK_OF(SRTP_PROTECTION_PROFILE) *, sk), \
   3605       (i)))
   3606 
   3607 #define sk_SRTP_PROTECTION_PROFILE_set(sk, i, p)                            \
   3608   ((const SRTP_PROTECTION_PROFILE *)sk_set(                                 \
   3609       CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk), (i), \
   3610       CHECKED_CAST(void *, const SRTP_PROTECTION_PROFILE *, p)))
   3611 
   3612 #define sk_SRTP_PROTECTION_PROFILE_free(sk) \
   3613   sk_free(CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk))
   3614 
   3615 #define sk_SRTP_PROTECTION_PROFILE_pop_free(sk, free_func)             \
   3616   sk_pop_free(                                                         \
   3617       CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk), \
   3618       CHECKED_CAST(void (*)(void *),                                   \
   3619                    void (*)(const SRTP_PROTECTION_PROFILE *), free_func))
   3620 
   3621 #define sk_SRTP_PROTECTION_PROFILE_insert(sk, p, where)                      \
   3622   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk), \
   3623             CHECKED_CAST(void *, const SRTP_PROTECTION_PROFILE *, p), (where))
   3624 
   3625 #define sk_SRTP_PROTECTION_PROFILE_delete(sk, where)                   \
   3626   ((const SRTP_PROTECTION_PROFILE *)sk_delete(                         \
   3627       CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk), \
   3628       (where)))
   3629 
   3630 #define sk_SRTP_PROTECTION_PROFILE_delete_ptr(sk, p)                   \
   3631   ((const SRTP_PROTECTION_PROFILE *)sk_delete_ptr(                     \
   3632       CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk), \
   3633       CHECKED_CAST(void *, const SRTP_PROTECTION_PROFILE *, p)))
   3634 
   3635 #define sk_SRTP_PROTECTION_PROFILE_find(sk, out_index, p)                  \
   3636   sk_find(CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk), \
   3637           (out_index),                                                     \
   3638           CHECKED_CAST(void *, const SRTP_PROTECTION_PROFILE *, p))
   3639 
   3640 #define sk_SRTP_PROTECTION_PROFILE_shift(sk)  \
   3641   ((const SRTP_PROTECTION_PROFILE *)sk_shift( \
   3642       CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk)))
   3643 
   3644 #define sk_SRTP_PROTECTION_PROFILE_push(sk, p)                             \
   3645   sk_push(CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk), \
   3646           CHECKED_CAST(void *, const SRTP_PROTECTION_PROFILE *, p))
   3647 
   3648 #define sk_SRTP_PROTECTION_PROFILE_pop(sk)  \
   3649   ((const SRTP_PROTECTION_PROFILE *)sk_pop( \
   3650       CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk)))
   3651 
   3652 #define sk_SRTP_PROTECTION_PROFILE_dup(sk)      \
   3653   ((STACK_OF(SRTP_PROTECTION_PROFILE) *)sk_dup( \
   3654       CHECKED_CAST(_STACK *, const STACK_OF(SRTP_PROTECTION_PROFILE) *, sk)))
   3655 
   3656 #define sk_SRTP_PROTECTION_PROFILE_sort(sk) \
   3657   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk))
   3658 
   3659 #define sk_SRTP_PROTECTION_PROFILE_is_sorted(sk) \
   3660   sk_is_sorted(                                  \
   3661       CHECKED_CAST(_STACK *, const STACK_OF(SRTP_PROTECTION_PROFILE) *, sk))
   3662 
   3663 #define sk_SRTP_PROTECTION_PROFILE_set_cmp_func(sk, comp)                   \
   3664   ((int (*)(const SRTP_PROTECTION_PROFILE **a,                              \
   3665             const SRTP_PROTECTION_PROFILE **b))                             \
   3666        sk_set_cmp_func(                                                     \
   3667            CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk), \
   3668            CHECKED_CAST(stack_cmp_func,                                     \
   3669                         int (*)(const SRTP_PROTECTION_PROFILE **a,          \
   3670                                 const SRTP_PROTECTION_PROFILE **b),         \
   3671                         comp)))
   3672 
   3673 #define sk_SRTP_PROTECTION_PROFILE_deep_copy(sk, copy_func, free_func)        \
   3674   ((STACK_OF(SRTP_PROTECTION_PROFILE) *)sk_deep_copy(                         \
   3675       CHECKED_CAST(const _STACK *, const STACK_OF(SRTP_PROTECTION_PROFILE) *, \
   3676                    sk),                                                       \
   3677       CHECKED_CAST(void *(*)(void *), const SRTP_PROTECTION_PROFILE *(*)(     \
   3678                                           const SRTP_PROTECTION_PROFILE *),   \
   3679                    copy_func),                                                \
   3680       CHECKED_CAST(void (*)(void *),                                          \
   3681                    void (*)(const SRTP_PROTECTION_PROFILE *), free_func)))
   3682 
   3683 /* SSL_CIPHER */
   3684 #define sk_SSL_CIPHER_new(comp)                 \
   3685   ((STACK_OF(SSL_CIPHER) *)sk_new(CHECKED_CAST( \
   3686       stack_cmp_func,                           \
   3687       int (*)(const const SSL_CIPHER **a, const const SSL_CIPHER **b), comp)))
   3688 
   3689 #define sk_SSL_CIPHER_new_null() ((STACK_OF(SSL_CIPHER) *)sk_new_null())
   3690 
   3691 #define sk_SSL_CIPHER_num(sk) \
   3692   sk_num(CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk))
   3693 
   3694 #define sk_SSL_CIPHER_zero(sk) \
   3695   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk));
   3696 
   3697 #define sk_SSL_CIPHER_value(sk, i) \
   3698   ((const SSL_CIPHER *)sk_value(   \
   3699       CHECKED_CAST(_STACK *, const STACK_OF(SSL_CIPHER) *, sk), (i)))
   3700 
   3701 #define sk_SSL_CIPHER_set(sk, i, p)                            \
   3702   ((const SSL_CIPHER *)sk_set(                                 \
   3703       CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk), (i), \
   3704       CHECKED_CAST(void *, const SSL_CIPHER *, p)))
   3705 
   3706 #define sk_SSL_CIPHER_free(sk) \
   3707   sk_free(CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk))
   3708 
   3709 #define sk_SSL_CIPHER_pop_free(sk, free_func)             \
   3710   sk_pop_free(                                            \
   3711       CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk), \
   3712       CHECKED_CAST(void (*)(void *), void (*)(const SSL_CIPHER *), free_func))
   3713 
   3714 #define sk_SSL_CIPHER_insert(sk, p, where)                      \
   3715   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk), \
   3716             CHECKED_CAST(void *, const SSL_CIPHER *, p), (where))
   3717 
   3718 #define sk_SSL_CIPHER_delete(sk, where) \
   3719   ((const SSL_CIPHER *)sk_delete(       \
   3720       CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk), (where)))
   3721 
   3722 #define sk_SSL_CIPHER_delete_ptr(sk, p)                   \
   3723   ((const SSL_CIPHER *)sk_delete_ptr(                     \
   3724       CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk), \
   3725       CHECKED_CAST(void *, const SSL_CIPHER *, p)))
   3726 
   3727 #define sk_SSL_CIPHER_find(sk, out_index, p)                               \
   3728   sk_find(CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk), (out_index), \
   3729           CHECKED_CAST(void *, const SSL_CIPHER *, p))
   3730 
   3731 #define sk_SSL_CIPHER_shift(sk)  \
   3732   ((const SSL_CIPHER *)sk_shift( \
   3733       CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk)))
   3734 
   3735 #define sk_SSL_CIPHER_push(sk, p)                             \
   3736   sk_push(CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk), \
   3737           CHECKED_CAST(void *, const SSL_CIPHER *, p))
   3738 
   3739 #define sk_SSL_CIPHER_pop(sk)  \
   3740   ((const SSL_CIPHER *)sk_pop( \
   3741       CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk)))
   3742 
   3743 #define sk_SSL_CIPHER_dup(sk)      \
   3744   ((STACK_OF(SSL_CIPHER) *)sk_dup( \
   3745       CHECKED_CAST(_STACK *, const STACK_OF(SSL_CIPHER) *, sk)))
   3746 
   3747 #define sk_SSL_CIPHER_sort(sk) \
   3748   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk))
   3749 
   3750 #define sk_SSL_CIPHER_is_sorted(sk) \
   3751   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(SSL_CIPHER) *, sk))
   3752 
   3753 #define sk_SSL_CIPHER_set_cmp_func(sk, comp)                             \
   3754   ((int (*)(const SSL_CIPHER **a, const SSL_CIPHER **b))sk_set_cmp_func( \
   3755       CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk),                \
   3756       CHECKED_CAST(stack_cmp_func,                                       \
   3757                    int (*)(const SSL_CIPHER **a, const SSL_CIPHER **b),  \
   3758                    comp)))
   3759 
   3760 #define sk_SSL_CIPHER_deep_copy(sk, copy_func, free_func)                 \
   3761   ((STACK_OF(SSL_CIPHER) *)sk_deep_copy(                                  \
   3762       CHECKED_CAST(const _STACK *, const STACK_OF(SSL_CIPHER) *, sk),     \
   3763       CHECKED_CAST(void *(*)(void *),                                     \
   3764                    const SSL_CIPHER *(*)(const SSL_CIPHER *), copy_func), \
   3765       CHECKED_CAST(void (*)(void *), void (*)(const SSL_CIPHER *),        \
   3766                    free_func)))
   3767 
   3768 /* OPENSSL_STRING */
   3769 #define sk_OPENSSL_STRING_new(comp)                 \
   3770   ((STACK_OF(OPENSSL_STRING) *)sk_new(CHECKED_CAST( \
   3771       stack_cmp_func,                               \
   3772       int (*)(const OPENSSL_STRING *a, const OPENSSL_STRING *b), comp)))
   3773 
   3774 #define sk_OPENSSL_STRING_new_null() ((STACK_OF(OPENSSL_STRING) *)sk_new_null())
   3775 
   3776 #define sk_OPENSSL_STRING_num(sk) \
   3777   sk_num(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk))
   3778 
   3779 #define sk_OPENSSL_STRING_zero(sk) \
   3780   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk));
   3781 
   3782 #define sk_OPENSSL_STRING_value(sk, i) \
   3783   ((OPENSSL_STRING)sk_value(           \
   3784       CHECKED_CAST(_STACK *, const STACK_OF(OPENSSL_STRING) *, sk), (i)))
   3785 
   3786 #define sk_OPENSSL_STRING_set(sk, i, p)                            \
   3787   ((OPENSSL_STRING)sk_set(                                         \
   3788       CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk), (i), \
   3789       CHECKED_CAST(void *, OPENSSL_STRING, p)))
   3790 
   3791 #define sk_OPENSSL_STRING_free(sk) \
   3792   sk_free(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk))
   3793 
   3794 #define sk_OPENSSL_STRING_pop_free(sk, free_func)             \
   3795   sk_pop_free(                                                \
   3796       CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk), \
   3797       CHECKED_CAST(void (*)(void *), void (*)(OPENSSL_STRING), free_func))
   3798 
   3799 #define sk_OPENSSL_STRING_insert(sk, p, where)                      \
   3800   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk), \
   3801             CHECKED_CAST(void *, OPENSSL_STRING, p), (where))
   3802 
   3803 #define sk_OPENSSL_STRING_delete(sk, where) \
   3804   ((OPENSSL_STRING)sk_delete(               \
   3805       CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk), (where)))
   3806 
   3807 #define sk_OPENSSL_STRING_delete_ptr(sk, p)                   \
   3808   ((OPENSSL_STRING)sk_delete_ptr(                             \
   3809       CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk), \
   3810       CHECKED_CAST(void *, OPENSSL_STRING, p)))
   3811 
   3812 #define sk_OPENSSL_STRING_find(sk, out_index, p)                               \
   3813   sk_find(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk), (out_index), \
   3814           CHECKED_CAST(void *, OPENSSL_STRING, p))
   3815 
   3816 #define sk_OPENSSL_STRING_shift(sk) \
   3817   ((OPENSSL_STRING)sk_shift(        \
   3818       CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk)))
   3819 
   3820 #define sk_OPENSSL_STRING_push(sk, p)                             \
   3821   sk_push(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk), \
   3822           CHECKED_CAST(void *, OPENSSL_STRING, p))
   3823 
   3824 #define sk_OPENSSL_STRING_pop(sk) \
   3825   ((OPENSSL_STRING)sk_pop(        \
   3826       CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk)))
   3827 
   3828 #define sk_OPENSSL_STRING_dup(sk)      \
   3829   ((STACK_OF(OPENSSL_STRING) *)sk_dup( \
   3830       CHECKED_CAST(_STACK *, const STACK_OF(OPENSSL_STRING) *, sk)))
   3831 
   3832 #define sk_OPENSSL_STRING_sort(sk) \
   3833   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk))
   3834 
   3835 #define sk_OPENSSL_STRING_is_sorted(sk) \
   3836   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(OPENSSL_STRING) *, sk))
   3837 
   3838 #define sk_OPENSSL_STRING_set_cmp_func(sk, comp)                           \
   3839   ((int (*)(const OPENSSL_STRING **a, const OPENSSL_STRING **b))           \
   3840        sk_set_cmp_func(                                                    \
   3841            CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk),         \
   3842            CHECKED_CAST(stack_cmp_func, int (*)(const OPENSSL_STRING **a,  \
   3843                                                 const OPENSSL_STRING **b), \
   3844                         comp)))
   3845 
   3846 #define sk_OPENSSL_STRING_deep_copy(sk, copy_func, free_func)             \
   3847   ((STACK_OF(OPENSSL_STRING) *)sk_deep_copy(                              \
   3848       CHECKED_CAST(const _STACK *, const STACK_OF(OPENSSL_STRING) *, sk), \
   3849       CHECKED_CAST(void *(*)(void *), OPENSSL_STRING (*)(OPENSSL_STRING), \
   3850                    copy_func),                                            \
   3851       CHECKED_CAST(void (*)(void *), void (*)(OPENSSL_STRING), free_func)))
   3852 
   3853 /* OPENSSL_BLOCK */
   3854 #define sk_OPENSSL_BLOCK_new(comp)                                             \
   3855   ((STACK_OF(OPENSSL_BLOCK) *)sk_new(CHECKED_CAST(                             \
   3856       stack_cmp_func, int (*)(const OPENSSL_BLOCK *a, const OPENSSL_BLOCK *b), \
   3857       comp)))
   3858 
   3859 #define sk_OPENSSL_BLOCK_new_null() ((STACK_OF(OPENSSL_BLOCK) *)sk_new_null())
   3860 
   3861 #define sk_OPENSSL_BLOCK_num(sk) \
   3862   sk_num(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk))
   3863 
   3864 #define sk_OPENSSL_BLOCK_zero(sk) \
   3865   sk_zero(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk));
   3866 
   3867 #define sk_OPENSSL_BLOCK_value(sk, i) \
   3868   ((OPENSSL_BLOCK)sk_value(           \
   3869       CHECKED_CAST(_STACK *, const STACK_OF(OPENSSL_BLOCK) *, sk), (i)))
   3870 
   3871 #define sk_OPENSSL_BLOCK_set(sk, i, p)                            \
   3872   ((OPENSSL_BLOCK)sk_set(                                         \
   3873       CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk), (i), \
   3874       CHECKED_CAST(void *, OPENSSL_BLOCK, p)))
   3875 
   3876 #define sk_OPENSSL_BLOCK_free(sk) \
   3877   sk_free(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk))
   3878 
   3879 #define sk_OPENSSL_BLOCK_pop_free(sk, free_func)             \
   3880   sk_pop_free(                                               \
   3881       CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk), \
   3882       CHECKED_CAST(void (*)(void *), void (*)(OPENSSL_BLOCK), free_func))
   3883 
   3884 #define sk_OPENSSL_BLOCK_insert(sk, p, where)                      \
   3885   sk_insert(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk), \
   3886             CHECKED_CAST(void *, OPENSSL_BLOCK, p), (where))
   3887 
   3888 #define sk_OPENSSL_BLOCK_delete(sk, where) \
   3889   ((OPENSSL_BLOCK)sk_delete(               \
   3890       CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk), (where)))
   3891 
   3892 #define sk_OPENSSL_BLOCK_delete_ptr(sk, p)                   \
   3893   ((OPENSSL_BLOCK)sk_delete_ptr(                             \
   3894       CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk), \
   3895       CHECKED_CAST(void *, OPENSSL_BLOCK, p)))
   3896 
   3897 #define sk_OPENSSL_BLOCK_find(sk, out_index, p)                               \
   3898   sk_find(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk), (out_index), \
   3899           CHECKED_CAST(void *, OPENSSL_BLOCK, p))
   3900 
   3901 #define sk_OPENSSL_BLOCK_shift(sk) \
   3902   ((OPENSSL_BLOCK)sk_shift(        \
   3903       CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk)))
   3904 
   3905 #define sk_OPENSSL_BLOCK_push(sk, p)                             \
   3906   sk_push(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk), \
   3907           CHECKED_CAST(void *, OPENSSL_BLOCK, p))
   3908 
   3909 #define sk_OPENSSL_BLOCK_pop(sk) \
   3910   ((OPENSSL_BLOCK)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk)))
   3911 
   3912 #define sk_OPENSSL_BLOCK_dup(sk)      \
   3913   ((STACK_OF(OPENSSL_BLOCK) *)sk_dup( \
   3914       CHECKED_CAST(_STACK *, const STACK_OF(OPENSSL_BLOCK) *, sk)))
   3915 
   3916 #define sk_OPENSSL_BLOCK_sort(sk) \
   3917   sk_sort(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk))
   3918 
   3919 #define sk_OPENSSL_BLOCK_is_sorted(sk) \
   3920   sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(OPENSSL_BLOCK) *, sk))
   3921 
   3922 #define sk_OPENSSL_BLOCK_set_cmp_func(sk, comp)                                \
   3923   ((int (*)(const OPENSSL_BLOCK **a, const OPENSSL_BLOCK **b))sk_set_cmp_func( \
   3924       CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk),                   \
   3925       CHECKED_CAST(stack_cmp_func,                                             \
   3926                    int (*)(const OPENSSL_BLOCK **a, const OPENSSL_BLOCK **b),  \
   3927                    comp)))
   3928 
   3929 #define sk_OPENSSL_BLOCK_deep_copy(sk, copy_func, free_func)             \
   3930   ((STACK_OF(OPENSSL_BLOCK) *)sk_deep_copy(                              \
   3931       CHECKED_CAST(const _STACK *, const STACK_OF(OPENSSL_BLOCK) *, sk), \
   3932       CHECKED_CAST(void *(*)(void *), OPENSSL_BLOCK (*)(OPENSSL_BLOCK),  \
   3933                    copy_func),                                           \
   3934       CHECKED_CAST(void (*)(void *), void (*)(OPENSSL_BLOCK), free_func)))
   3935