| 1 | /* |
| 2 | * WARNING: do not edit! |
| 3 | * Generated by Makefile from include/openssl/asn1.h.in |
| 4 | * |
| 5 | * Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved. |
| 6 | * |
| 7 | * Licensed under the Apache License 2.0 (the "License"). You may not use |
| 8 | * this file except in compliance with the License. You can obtain a copy |
| 9 | * in the file LICENSE in the source distribution or at |
| 10 | * https://www.openssl.org/source/license.html |
| 11 | */ |
| 12 | |
| 13 | /* clang-format off */ |
| 14 | |
| 15 | /* clang-format on */ |
| 16 | |
| 17 | #ifndef OPENSSL_ASN1_H |
| 18 | #define OPENSSL_ASN1_H |
| 19 | #pragma once |
| 20 | |
| 21 | #include <openssl/macros.h> |
| 22 | #ifndef OPENSSL_NO_DEPRECATED_3_0 |
| 23 | #define |
| 24 | #endif |
| 25 | |
| 26 | #ifndef OPENSSL_NO_STDIO |
| 27 | #include <stdio.h> |
| 28 | #endif |
| 29 | #include <time.h> |
| 30 | #include <openssl/e_os2.h> |
| 31 | #include <openssl/opensslconf.h> |
| 32 | #include <openssl/bio.h> |
| 33 | #include <openssl/safestack.h> |
| 34 | #include <openssl/asn1err.h> |
| 35 | #include <openssl/symhacks.h> |
| 36 | |
| 37 | #include <openssl/types.h> |
| 38 | #include <openssl/bn.h> |
| 39 | |
| 40 | #ifdef OPENSSL_BUILD_SHLIBCRYPTO |
| 41 | #undef OPENSSL_EXTERN |
| 42 | #define OPENSSL_EXTERN OPENSSL_EXPORT |
| 43 | #endif |
| 44 | |
| 45 | #ifdef __cplusplus |
| 46 | extern "C" { |
| 47 | #endif |
| 48 | |
| 49 | #define V_ASN1_UNIVERSAL 0x00 |
| 50 | #define V_ASN1_APPLICATION 0x40 |
| 51 | #define V_ASN1_CONTEXT_SPECIFIC 0x80 |
| 52 | #define V_ASN1_PRIVATE 0xc0 |
| 53 | |
| 54 | #define V_ASN1_CONSTRUCTED 0x20 |
| 55 | #define V_ASN1_PRIMITIVE_TAG 0x1f |
| 56 | #define V_ASN1_PRIMATIVE_TAG /*compat*/ V_ASN1_PRIMITIVE_TAG |
| 57 | |
| 58 | #define V_ASN1_APP_CHOOSE -2 /* let the recipient choose */ |
| 59 | #define V_ASN1_OTHER -3 /* used in ASN1_TYPE */ |
| 60 | #define V_ASN1_ANY -4 /* used in ASN1 template code */ |
| 61 | |
| 62 | #define V_ASN1_UNDEF -1 |
| 63 | /* ASN.1 tag values */ |
| 64 | #define V_ASN1_EOC 0 |
| 65 | #define V_ASN1_BOOLEAN 1 |
| 66 | #define V_ASN1_INTEGER 2 |
| 67 | #define V_ASN1_BIT_STRING 3 |
| 68 | #define V_ASN1_OCTET_STRING 4 |
| 69 | #define V_ASN1_NULL 5 |
| 70 | #define V_ASN1_OBJECT 6 |
| 71 | #define V_ASN1_OBJECT_DESCRIPTOR 7 |
| 72 | #define V_ASN1_EXTERNAL 8 |
| 73 | #define V_ASN1_REAL 9 |
| 74 | #define V_ASN1_ENUMERATED 10 |
| 75 | #define V_ASN1_UTF8STRING 12 |
| 76 | #define V_ASN1_SEQUENCE 16 |
| 77 | #define V_ASN1_SET 17 |
| 78 | #define V_ASN1_NUMERICSTRING 18 |
| 79 | #define V_ASN1_PRINTABLESTRING 19 |
| 80 | #define V_ASN1_T61STRING 20 |
| 81 | #define V_ASN1_TELETEXSTRING 20 /* alias */ |
| 82 | #define V_ASN1_VIDEOTEXSTRING 21 |
| 83 | #define V_ASN1_IA5STRING 22 |
| 84 | #define V_ASN1_UTCTIME 23 |
| 85 | #define V_ASN1_GENERALIZEDTIME 24 |
| 86 | #define V_ASN1_GRAPHICSTRING 25 |
| 87 | #define V_ASN1_ISO64STRING 26 |
| 88 | #define V_ASN1_VISIBLESTRING 26 /* alias */ |
| 89 | #define V_ASN1_GENERALSTRING 27 |
| 90 | #define V_ASN1_UNIVERSALSTRING 28 |
| 91 | #define V_ASN1_BMPSTRING 30 |
| 92 | |
| 93 | /* |
| 94 | * NB the constants below are used internally by ASN1_INTEGER |
| 95 | * and ASN1_ENUMERATED to indicate the sign. They are *not* on |
| 96 | * the wire tag values. |
| 97 | */ |
| 98 | |
| 99 | #define V_ASN1_NEG 0x100 |
| 100 | #define V_ASN1_NEG_INTEGER (2 | V_ASN1_NEG) |
| 101 | #define V_ASN1_NEG_ENUMERATED (10 | V_ASN1_NEG) |
| 102 | |
| 103 | /* For use with d2i_ASN1_type_bytes() */ |
| 104 | #define B_ASN1_NUMERICSTRING 0x0001 |
| 105 | #define B_ASN1_PRINTABLESTRING 0x0002 |
| 106 | #define B_ASN1_T61STRING 0x0004 |
| 107 | #define B_ASN1_TELETEXSTRING 0x0004 |
| 108 | #define B_ASN1_VIDEOTEXSTRING 0x0008 |
| 109 | #define B_ASN1_IA5STRING 0x0010 |
| 110 | #define B_ASN1_GRAPHICSTRING 0x0020 |
| 111 | #define B_ASN1_ISO64STRING 0x0040 |
| 112 | #define B_ASN1_VISIBLESTRING 0x0040 |
| 113 | #define B_ASN1_GENERALSTRING 0x0080 |
| 114 | #define B_ASN1_UNIVERSALSTRING 0x0100 |
| 115 | #define B_ASN1_OCTET_STRING 0x0200 |
| 116 | #define B_ASN1_BIT_STRING 0x0400 |
| 117 | #define B_ASN1_BMPSTRING 0x0800 |
| 118 | #define B_ASN1_UNKNOWN 0x1000 |
| 119 | #define B_ASN1_UTF8STRING 0x2000 |
| 120 | #define B_ASN1_UTCTIME 0x4000 |
| 121 | #define B_ASN1_GENERALIZEDTIME 0x8000 |
| 122 | #define B_ASN1_SEQUENCE 0x10000 |
| 123 | /* For use with ASN1_mbstring_copy() */ |
| 124 | #define MBSTRING_FLAG 0x1000 |
| 125 | #define MBSTRING_UTF8 (MBSTRING_FLAG) |
| 126 | #define MBSTRING_ASC (MBSTRING_FLAG | 1) |
| 127 | #define MBSTRING_BMP (MBSTRING_FLAG | 2) |
| 128 | #define MBSTRING_UNIV (MBSTRING_FLAG | 4) |
| 129 | #define SMIME_OLDMIME 0x400 |
| 130 | #define SMIME_CRLFEOL 0x800 |
| 131 | #define SMIME_STREAM 0x1000 |
| 132 | |
| 133 | /* Stacks for types not otherwise defined in this header */ |
| 134 | /* clang-format off */ |
| 135 | SKM_DEFINE_STACK_OF_INTERNAL(X509_ALGOR, X509_ALGOR, X509_ALGOR) |
| 136 | #define sk_X509_ALGOR_num(sk) OPENSSL_sk_num(ossl_check_const_X509_ALGOR_sk_type(sk)) |
| 137 | #define sk_X509_ALGOR_value(sk, idx) ((X509_ALGOR *)OPENSSL_sk_value(ossl_check_const_X509_ALGOR_sk_type(sk), (idx))) |
| 138 | #define sk_X509_ALGOR_new(cmp) ((STACK_OF(X509_ALGOR) *)OPENSSL_sk_new(ossl_check_X509_ALGOR_compfunc_type(cmp))) |
| 139 | #define sk_X509_ALGOR_new_null() ((STACK_OF(X509_ALGOR) *)OPENSSL_sk_new_null()) |
| 140 | #define sk_X509_ALGOR_new_reserve(cmp, n) ((STACK_OF(X509_ALGOR) *)OPENSSL_sk_new_reserve(ossl_check_X509_ALGOR_compfunc_type(cmp), (n))) |
| 141 | #define sk_X509_ALGOR_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_ALGOR_sk_type(sk), (n)) |
| 142 | #define sk_X509_ALGOR_free(sk) OPENSSL_sk_free(ossl_check_X509_ALGOR_sk_type(sk)) |
| 143 | #define sk_X509_ALGOR_zero(sk) OPENSSL_sk_zero(ossl_check_X509_ALGOR_sk_type(sk)) |
| 144 | #define sk_X509_ALGOR_delete(sk, i) ((X509_ALGOR *)OPENSSL_sk_delete(ossl_check_X509_ALGOR_sk_type(sk), (i))) |
| 145 | #define sk_X509_ALGOR_delete_ptr(sk, ptr) ((X509_ALGOR *)OPENSSL_sk_delete_ptr(ossl_check_X509_ALGOR_sk_type(sk), ossl_check_X509_ALGOR_type(ptr))) |
| 146 | #define sk_X509_ALGOR_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_ALGOR_sk_type(sk), ossl_check_X509_ALGOR_type(ptr)) |
| 147 | #define sk_X509_ALGOR_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_ALGOR_sk_type(sk), ossl_check_X509_ALGOR_type(ptr)) |
| 148 | #define sk_X509_ALGOR_pop(sk) ((X509_ALGOR *)OPENSSL_sk_pop(ossl_check_X509_ALGOR_sk_type(sk))) |
| 149 | #define sk_X509_ALGOR_shift(sk) ((X509_ALGOR *)OPENSSL_sk_shift(ossl_check_X509_ALGOR_sk_type(sk))) |
| 150 | #define sk_X509_ALGOR_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_ALGOR_sk_type(sk), ossl_check_X509_ALGOR_freefunc_type(freefunc)) |
| 151 | #define sk_X509_ALGOR_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_ALGOR_sk_type(sk), ossl_check_X509_ALGOR_type(ptr), (idx)) |
| 152 | #define sk_X509_ALGOR_set(sk, idx, ptr) ((X509_ALGOR *)OPENSSL_sk_set(ossl_check_X509_ALGOR_sk_type(sk), (idx), ossl_check_X509_ALGOR_type(ptr))) |
| 153 | #define sk_X509_ALGOR_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_ALGOR_sk_type(sk), ossl_check_X509_ALGOR_type(ptr)) |
| 154 | #define sk_X509_ALGOR_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_ALGOR_sk_type(sk), ossl_check_X509_ALGOR_type(ptr)) |
| 155 | #define sk_X509_ALGOR_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_ALGOR_sk_type(sk), ossl_check_X509_ALGOR_type(ptr), pnum) |
| 156 | #define sk_X509_ALGOR_sort(sk) OPENSSL_sk_sort(ossl_check_X509_ALGOR_sk_type(sk)) |
| 157 | #define sk_X509_ALGOR_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_ALGOR_sk_type(sk)) |
| 158 | #define sk_X509_ALGOR_dup(sk) ((STACK_OF(X509_ALGOR) *)OPENSSL_sk_dup(ossl_check_const_X509_ALGOR_sk_type(sk))) |
| 159 | #define sk_X509_ALGOR_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509_ALGOR) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_ALGOR_sk_type(sk), ossl_check_X509_ALGOR_copyfunc_type(copyfunc), ossl_check_X509_ALGOR_freefunc_type(freefunc))) |
| 160 | #define sk_X509_ALGOR_set_cmp_func(sk, cmp) ((sk_X509_ALGOR_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_ALGOR_sk_type(sk), ossl_check_X509_ALGOR_compfunc_type(cmp))) |
| 161 | |
| 162 | /* clang-format on */ |
| 163 | |
| 164 | #define ASN1_STRING_FLAG_BITS_LEFT 0x08 /* Set if 0x07 has bits left value */ |
| 165 | /* |
| 166 | * This indicates that the ASN1_STRING is not a real value but just a place |
| 167 | * holder for the location where indefinite length constructed data should be |
| 168 | * inserted in the memory buffer |
| 169 | */ |
| 170 | #define ASN1_STRING_FLAG_NDEF 0x010 |
| 171 | |
| 172 | /* |
| 173 | * This flag is used by the CMS code to indicate that a string is not |
| 174 | * complete and is a place holder for content when it had all been accessed. |
| 175 | * The flag will be reset when content has been written to it. |
| 176 | */ |
| 177 | |
| 178 | #define ASN1_STRING_FLAG_CONT 0x020 |
| 179 | /* |
| 180 | * This flag is used by ASN1 code to indicate an ASN1_STRING is an MSTRING |
| 181 | * type. |
| 182 | */ |
| 183 | #define ASN1_STRING_FLAG_MSTRING 0x040 |
| 184 | /* String is embedded and only content should be freed */ |
| 185 | #define ASN1_STRING_FLAG_EMBED 0x080 |
| 186 | /* String should be parsed in RFC 5280's time format */ |
| 187 | #define ASN1_STRING_FLAG_X509_TIME 0x100 |
| 188 | /* This is the base type that holds just about everything :-) */ |
| 189 | struct asn1_string_st { |
| 190 | int length; |
| 191 | int type; |
| 192 | unsigned char *data; |
| 193 | /* |
| 194 | * The value of the following field depends on the type being held. It |
| 195 | * is mostly being used for BIT_STRING so if the input data has a |
| 196 | * non-zero 'unused bits' value, it will be handled correctly |
| 197 | */ |
| 198 | long flags; |
| 199 | }; |
| 200 | |
| 201 | /* |
| 202 | * ASN1_ENCODING structure: this is used to save the received encoding of an |
| 203 | * ASN1 type. This is useful to get round problems with invalid encodings |
| 204 | * which can break signatures. |
| 205 | */ |
| 206 | |
| 207 | typedef struct ASN1_ENCODING_st { |
| 208 | unsigned char *enc; /* DER encoding */ |
| 209 | long len; /* Length of encoding */ |
| 210 | int modified; /* set to 1 if 'enc' is invalid */ |
| 211 | } ASN1_ENCODING; |
| 212 | |
| 213 | /* Used with ASN1 LONG type: if a long is set to this it is omitted */ |
| 214 | #define ASN1_LONG_UNDEF 0x7fffffffL |
| 215 | |
| 216 | #define STABLE_FLAGS_MALLOC 0x01 |
| 217 | /* |
| 218 | * A zero passed to ASN1_STRING_TABLE_new_add for the flags is interpreted |
| 219 | * as "don't change" and STABLE_FLAGS_MALLOC is always set. By setting |
| 220 | * STABLE_FLAGS_MALLOC only we can clear the existing value. Use the alias |
| 221 | * STABLE_FLAGS_CLEAR to reflect this. |
| 222 | */ |
| 223 | #define STABLE_FLAGS_CLEAR STABLE_FLAGS_MALLOC |
| 224 | #define STABLE_NO_MASK 0x02 |
| 225 | #define DIRSTRING_TYPE \ |
| 226 | (B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | B_ASN1_BMPSTRING | B_ASN1_UTF8STRING) |
| 227 | #define PKCS9STRING_TYPE (DIRSTRING_TYPE | B_ASN1_IA5STRING) |
| 228 | |
| 229 | struct asn1_string_table_st { |
| 230 | int nid; |
| 231 | long minsize; |
| 232 | long maxsize; |
| 233 | unsigned long mask; |
| 234 | unsigned long flags; |
| 235 | }; |
| 236 | |
| 237 | /* clang-format off */ |
| 238 | SKM_DEFINE_STACK_OF_INTERNAL(ASN1_STRING_TABLE, ASN1_STRING_TABLE, ASN1_STRING_TABLE) |
| 239 | #define sk_ASN1_STRING_TABLE_num(sk) OPENSSL_sk_num(ossl_check_const_ASN1_STRING_TABLE_sk_type(sk)) |
| 240 | #define sk_ASN1_STRING_TABLE_value(sk, idx) ((ASN1_STRING_TABLE *)OPENSSL_sk_value(ossl_check_const_ASN1_STRING_TABLE_sk_type(sk), (idx))) |
| 241 | #define sk_ASN1_STRING_TABLE_new(cmp) ((STACK_OF(ASN1_STRING_TABLE) *)OPENSSL_sk_new(ossl_check_ASN1_STRING_TABLE_compfunc_type(cmp))) |
| 242 | #define sk_ASN1_STRING_TABLE_new_null() ((STACK_OF(ASN1_STRING_TABLE) *)OPENSSL_sk_new_null()) |
| 243 | #define sk_ASN1_STRING_TABLE_new_reserve(cmp, n) ((STACK_OF(ASN1_STRING_TABLE) *)OPENSSL_sk_new_reserve(ossl_check_ASN1_STRING_TABLE_compfunc_type(cmp), (n))) |
| 244 | #define sk_ASN1_STRING_TABLE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_ASN1_STRING_TABLE_sk_type(sk), (n)) |
| 245 | #define sk_ASN1_STRING_TABLE_free(sk) OPENSSL_sk_free(ossl_check_ASN1_STRING_TABLE_sk_type(sk)) |
| 246 | #define sk_ASN1_STRING_TABLE_zero(sk) OPENSSL_sk_zero(ossl_check_ASN1_STRING_TABLE_sk_type(sk)) |
| 247 | #define sk_ASN1_STRING_TABLE_delete(sk, i) ((ASN1_STRING_TABLE *)OPENSSL_sk_delete(ossl_check_ASN1_STRING_TABLE_sk_type(sk), (i))) |
| 248 | #define sk_ASN1_STRING_TABLE_delete_ptr(sk, ptr) ((ASN1_STRING_TABLE *)OPENSSL_sk_delete_ptr(ossl_check_ASN1_STRING_TABLE_sk_type(sk), ossl_check_ASN1_STRING_TABLE_type(ptr))) |
| 249 | #define sk_ASN1_STRING_TABLE_push(sk, ptr) OPENSSL_sk_push(ossl_check_ASN1_STRING_TABLE_sk_type(sk), ossl_check_ASN1_STRING_TABLE_type(ptr)) |
| 250 | #define sk_ASN1_STRING_TABLE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_ASN1_STRING_TABLE_sk_type(sk), ossl_check_ASN1_STRING_TABLE_type(ptr)) |
| 251 | #define sk_ASN1_STRING_TABLE_pop(sk) ((ASN1_STRING_TABLE *)OPENSSL_sk_pop(ossl_check_ASN1_STRING_TABLE_sk_type(sk))) |
| 252 | #define sk_ASN1_STRING_TABLE_shift(sk) ((ASN1_STRING_TABLE *)OPENSSL_sk_shift(ossl_check_ASN1_STRING_TABLE_sk_type(sk))) |
| 253 | #define sk_ASN1_STRING_TABLE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_ASN1_STRING_TABLE_sk_type(sk), ossl_check_ASN1_STRING_TABLE_freefunc_type(freefunc)) |
| 254 | #define sk_ASN1_STRING_TABLE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_ASN1_STRING_TABLE_sk_type(sk), ossl_check_ASN1_STRING_TABLE_type(ptr), (idx)) |
| 255 | #define sk_ASN1_STRING_TABLE_set(sk, idx, ptr) ((ASN1_STRING_TABLE *)OPENSSL_sk_set(ossl_check_ASN1_STRING_TABLE_sk_type(sk), (idx), ossl_check_ASN1_STRING_TABLE_type(ptr))) |
| 256 | #define sk_ASN1_STRING_TABLE_find(sk, ptr) OPENSSL_sk_find(ossl_check_ASN1_STRING_TABLE_sk_type(sk), ossl_check_ASN1_STRING_TABLE_type(ptr)) |
| 257 | #define sk_ASN1_STRING_TABLE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_ASN1_STRING_TABLE_sk_type(sk), ossl_check_ASN1_STRING_TABLE_type(ptr)) |
| 258 | #define sk_ASN1_STRING_TABLE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_ASN1_STRING_TABLE_sk_type(sk), ossl_check_ASN1_STRING_TABLE_type(ptr), pnum) |
| 259 | #define sk_ASN1_STRING_TABLE_sort(sk) OPENSSL_sk_sort(ossl_check_ASN1_STRING_TABLE_sk_type(sk)) |
| 260 | #define sk_ASN1_STRING_TABLE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_ASN1_STRING_TABLE_sk_type(sk)) |
| 261 | #define sk_ASN1_STRING_TABLE_dup(sk) ((STACK_OF(ASN1_STRING_TABLE) *)OPENSSL_sk_dup(ossl_check_const_ASN1_STRING_TABLE_sk_type(sk))) |
| 262 | #define sk_ASN1_STRING_TABLE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(ASN1_STRING_TABLE) *)OPENSSL_sk_deep_copy(ossl_check_const_ASN1_STRING_TABLE_sk_type(sk), ossl_check_ASN1_STRING_TABLE_copyfunc_type(copyfunc), ossl_check_ASN1_STRING_TABLE_freefunc_type(freefunc))) |
| 263 | #define sk_ASN1_STRING_TABLE_set_cmp_func(sk, cmp) ((sk_ASN1_STRING_TABLE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_ASN1_STRING_TABLE_sk_type(sk), ossl_check_ASN1_STRING_TABLE_compfunc_type(cmp))) |
| 264 | |
| 265 | /* clang-format on */ |
| 266 | |
| 267 | /* size limits: this stuff is taken straight from RFC 5280 */ |
| 268 | |
| 269 | #define ub_name 32768 |
| 270 | #define ub_common_name 64 |
| 271 | #define ub_locality_name 128 |
| 272 | #define ub_state_name 128 |
| 273 | #define ub_organization_name 64 |
| 274 | #define ub_organization_unit_name 64 |
| 275 | #define ub_title 64 |
| 276 | #define ub_email_address 128 |
| 277 | |
| 278 | /* |
| 279 | * Declarations for template structures: for full definitions see asn1t.h |
| 280 | */ |
| 281 | typedef struct ASN1_TEMPLATE_st ASN1_TEMPLATE; |
| 282 | typedef struct ASN1_TLC_st ASN1_TLC; |
| 283 | /* This is just an opaque pointer */ |
| 284 | typedef struct ASN1_VALUE_st ASN1_VALUE; |
| 285 | |
| 286 | /* Declare ASN1 functions: the implement macro is in asn1t.h */ |
| 287 | |
| 288 | /* |
| 289 | * The mysterious 'extern' that's passed to some macros is innocuous, |
| 290 | * and is there to quiet pre-C99 compilers that may complain about empty |
| 291 | * arguments in macro calls. |
| 292 | */ |
| 293 | |
| 294 | #define DECLARE_ASN1_FUNCTIONS_attr(attr, type) \ |
| 295 | DECLARE_ASN1_FUNCTIONS_name_attr(attr, type, type) |
| 296 | #define DECLARE_ASN1_FUNCTIONS(type) \ |
| 297 | DECLARE_ASN1_FUNCTIONS_attr(extern, type) |
| 298 | |
| 299 | #define DECLARE_ASN1_ALLOC_FUNCTIONS_attr(attr, type) \ |
| 300 | DECLARE_ASN1_ALLOC_FUNCTIONS_name_attr(attr, type, type) |
| 301 | #define DECLARE_ASN1_ALLOC_FUNCTIONS(type) \ |
| 302 | DECLARE_ASN1_ALLOC_FUNCTIONS_attr(extern, type) |
| 303 | |
| 304 | #define DECLARE_ASN1_FUNCTIONS_name_attr(attr, type, name) \ |
| 305 | DECLARE_ASN1_ALLOC_FUNCTIONS_name_attr(attr, type, name) \ |
| 306 | DECLARE_ASN1_ENCODE_FUNCTIONS_name_attr(attr, type, name) |
| 307 | #define DECLARE_ASN1_FUNCTIONS_name(type, name) \ |
| 308 | DECLARE_ASN1_FUNCTIONS_name_attr(extern, type, name) |
| 309 | |
| 310 | #define DECLARE_ASN1_ENCODE_FUNCTIONS_attr(attr, type, itname, name) \ |
| 311 | DECLARE_ASN1_ENCODE_FUNCTIONS_only_attr(attr, type, name) \ |
| 312 | DECLARE_ASN1_ITEM_attr(attr, itname) |
| 313 | #define DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \ |
| 314 | DECLARE_ASN1_ENCODE_FUNCTIONS_attr(extern, type, itname, name) |
| 315 | |
| 316 | #define DECLARE_ASN1_ENCODE_FUNCTIONS_name_attr(attr, type, name) \ |
| 317 | DECLARE_ASN1_ENCODE_FUNCTIONS_attr(attr, type, name, name) |
| 318 | #define DECLARE_ASN1_ENCODE_FUNCTIONS_name(type, name) \ |
| 319 | DECLARE_ASN1_ENCODE_FUNCTIONS_name_attr(extern, type, name) |
| 320 | |
| 321 | #define DECLARE_ASN1_ENCODE_FUNCTIONS_only_attr(attr, type, name) \ |
| 322 | attr type *d2i_##name(type **a, const unsigned char **in, long len); \ |
| 323 | attr int i2d_##name(const type *a, unsigned char **out); |
| 324 | #define DECLARE_ASN1_ENCODE_FUNCTIONS_only(type, name) \ |
| 325 | DECLARE_ASN1_ENCODE_FUNCTIONS_only_attr(extern, type, name) |
| 326 | |
| 327 | #define DECLARE_ASN1_NDEF_FUNCTION_attr(attr, name) \ |
| 328 | attr int i2d_##name##_NDEF(const name *a, unsigned char **out); |
| 329 | #define DECLARE_ASN1_NDEF_FUNCTION(name) \ |
| 330 | DECLARE_ASN1_NDEF_FUNCTION_attr(extern, name) |
| 331 | |
| 332 | #define DECLARE_ASN1_ALLOC_FUNCTIONS_name_attr(attr, type, name) \ |
| 333 | attr type *name##_new(void); \ |
| 334 | attr void name##_free(type *a); |
| 335 | #define DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ |
| 336 | DECLARE_ASN1_ALLOC_FUNCTIONS_name_attr(extern, type, name) |
| 337 | |
| 338 | #define DECLARE_ASN1_DUP_FUNCTION_attr(attr, type) \ |
| 339 | DECLARE_ASN1_DUP_FUNCTION_name_attr(attr, type, type) |
| 340 | #define DECLARE_ASN1_DUP_FUNCTION(type) \ |
| 341 | DECLARE_ASN1_DUP_FUNCTION_attr(extern, type) |
| 342 | |
| 343 | #define DECLARE_ASN1_DUP_FUNCTION_name_attr(attr, type, name) \ |
| 344 | attr type *name##_dup(const type *a); |
| 345 | #define DECLARE_ASN1_DUP_FUNCTION_name(type, name) \ |
| 346 | DECLARE_ASN1_DUP_FUNCTION_name_attr(extern, type, name) |
| 347 | |
| 348 | #define DECLARE_ASN1_PRINT_FUNCTION_attr(attr, stname) \ |
| 349 | DECLARE_ASN1_PRINT_FUNCTION_fname_attr(attr, stname, stname) |
| 350 | #define DECLARE_ASN1_PRINT_FUNCTION(stname) \ |
| 351 | DECLARE_ASN1_PRINT_FUNCTION_attr(extern, stname) |
| 352 | |
| 353 | #define DECLARE_ASN1_PRINT_FUNCTION_fname_attr(attr, stname, fname) \ |
| 354 | attr int fname##_print_ctx(BIO *out, const stname *x, int indent, \ |
| 355 | const ASN1_PCTX *pctx); |
| 356 | #define DECLARE_ASN1_PRINT_FUNCTION_fname(stname, fname) \ |
| 357 | DECLARE_ASN1_PRINT_FUNCTION_fname_attr(extern, stname, fname) |
| 358 | |
| 359 | #define D2I_OF(type) type *(*)(type **, const unsigned char **, long) |
| 360 | #define I2D_OF(type) int (*)(const type *, unsigned char **) |
| 361 | |
| 362 | #define CHECKED_D2I_OF(type, d2i) \ |
| 363 | ((d2i_of_void *)(1 ? d2i : ((D2I_OF(type))0))) |
| 364 | #define CHECKED_I2D_OF(type, i2d) \ |
| 365 | ((i2d_of_void *)(1 ? i2d : ((I2D_OF(type))0))) |
| 366 | #define CHECKED_NEW_OF(type, xnew) \ |
| 367 | ((void *(*)(void))(1 ? xnew : ((type * (*)(void))0))) |
| 368 | #define CHECKED_PTR_OF(type, p) \ |
| 369 | ((void *)(1 ? p : (type *)0)) |
| 370 | #define CHECKED_PPTR_OF(type, p) \ |
| 371 | ((void **)(1 ? p : (type **)0)) |
| 372 | |
| 373 | #define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **, const unsigned char **, long) |
| 374 | #define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type(const type *, unsigned char **) |
| 375 | #define TYPEDEF_D2I2D_OF(type) \ |
| 376 | TYPEDEF_D2I_OF(type); \ |
| 377 | TYPEDEF_I2D_OF(type) |
| 378 | |
| 379 | typedef void *d2i_of_void(void **, const unsigned char **, long); |
| 380 | typedef int i2d_of_void(const void *, unsigned char **); |
| 381 | typedef int OSSL_i2d_of_void_ctx(const void *, unsigned char **, void *vctx); |
| 382 | |
| 383 | /*- |
| 384 | * The following macros and typedefs allow an ASN1_ITEM |
| 385 | * to be embedded in a structure and referenced. Since |
| 386 | * the ASN1_ITEM pointers need to be globally accessible |
| 387 | * (possibly from shared libraries) they may exist in |
| 388 | * different forms. On platforms that support it the |
| 389 | * ASN1_ITEM structure itself will be globally exported. |
| 390 | * Other platforms will export a function that returns |
| 391 | * an ASN1_ITEM pointer. |
| 392 | * |
| 393 | * To handle both cases transparently the macros below |
| 394 | * should be used instead of hard coding an ASN1_ITEM |
| 395 | * pointer in a structure. |
| 396 | * |
| 397 | * The structure will look like this: |
| 398 | * |
| 399 | * typedef struct SOMETHING_st { |
| 400 | * ... |
| 401 | * ASN1_ITEM_EXP *iptr; |
| 402 | * ... |
| 403 | * } SOMETHING; |
| 404 | * |
| 405 | * It would be initialised as e.g.: |
| 406 | * |
| 407 | * SOMETHING somevar = {...,ASN1_ITEM_ref(X509),...}; |
| 408 | * |
| 409 | * and the actual pointer extracted with: |
| 410 | * |
| 411 | * const ASN1_ITEM *it = ASN1_ITEM_ptr(somevar.iptr); |
| 412 | * |
| 413 | * Finally an ASN1_ITEM pointer can be extracted from an |
| 414 | * appropriate reference with: ASN1_ITEM_rptr(X509). This |
| 415 | * would be used when a function takes an ASN1_ITEM * argument. |
| 416 | * |
| 417 | */ |
| 418 | |
| 419 | /* |
| 420 | * Platforms that can't easily handle shared global variables are declared as |
| 421 | * functions returning ASN1_ITEM pointers. |
| 422 | */ |
| 423 | |
| 424 | /* ASN1_ITEM pointer exported type */ |
| 425 | typedef const ASN1_ITEM *ASN1_ITEM_EXP(void); |
| 426 | |
| 427 | /* Macro to obtain ASN1_ITEM pointer from exported type */ |
| 428 | #define ASN1_ITEM_ptr(iptr) (iptr()) |
| 429 | |
| 430 | /* Macro to include ASN1_ITEM pointer from base type */ |
| 431 | #define ASN1_ITEM_ref(iptr) (iptr##_it) |
| 432 | |
| 433 | #define ASN1_ITEM_rptr(ref) (ref##_it()) |
| 434 | |
| 435 | #define DECLARE_ASN1_ITEM_attr(attr, name) \ |
| 436 | attr const ASN1_ITEM *name##_it(void); |
| 437 | #define DECLARE_ASN1_ITEM(name) \ |
| 438 | DECLARE_ASN1_ITEM_attr(extern, name) |
| 439 | |
| 440 | /* Parameters used by ASN1_STRING_print_ex() */ |
| 441 | |
| 442 | /* |
| 443 | * These determine which characters to escape: RFC2253 special characters, |
| 444 | * control characters and MSB set characters |
| 445 | */ |
| 446 | |
| 447 | #define ASN1_STRFLGS_ESC_2253 1 |
| 448 | #define ASN1_STRFLGS_ESC_CTRL 2 |
| 449 | #define ASN1_STRFLGS_ESC_MSB 4 |
| 450 | |
| 451 | /* Lower 8 bits are reserved as an output type specifier */ |
| 452 | #define ASN1_DTFLGS_TYPE_MASK 0x0FUL |
| 453 | #define ASN1_DTFLGS_RFC822 0x00UL |
| 454 | #define ASN1_DTFLGS_ISO8601 0x01UL |
| 455 | |
| 456 | /* |
| 457 | * This flag determines how we do escaping: normally RC2253 backslash only, |
| 458 | * set this to use backslash and quote. |
| 459 | */ |
| 460 | |
| 461 | #define ASN1_STRFLGS_ESC_QUOTE 8 |
| 462 | |
| 463 | /* These three flags are internal use only. */ |
| 464 | |
| 465 | /* Character is a valid PrintableString character */ |
| 466 | #define CHARTYPE_PRINTABLESTRING 0x10 |
| 467 | /* Character needs escaping if it is the first character */ |
| 468 | #define CHARTYPE_FIRST_ESC_2253 0x20 |
| 469 | /* Character needs escaping if it is the last character */ |
| 470 | #define CHARTYPE_LAST_ESC_2253 0x40 |
| 471 | |
| 472 | /* |
| 473 | * NB the internal flags are safely reused below by flags handled at the top |
| 474 | * level. |
| 475 | */ |
| 476 | |
| 477 | /* |
| 478 | * If this is set we convert all character strings to UTF8 first |
| 479 | */ |
| 480 | |
| 481 | #define ASN1_STRFLGS_UTF8_CONVERT 0x10 |
| 482 | |
| 483 | /* |
| 484 | * If this is set we don't attempt to interpret content: just assume all |
| 485 | * strings are 1 byte per character. This will produce some pretty odd |
| 486 | * looking output! |
| 487 | */ |
| 488 | |
| 489 | #define ASN1_STRFLGS_IGNORE_TYPE 0x20 |
| 490 | |
| 491 | /* If this is set we include the string type in the output */ |
| 492 | #define ASN1_STRFLGS_SHOW_TYPE 0x40 |
| 493 | |
| 494 | /* |
| 495 | * This determines which strings to display and which to 'dump' (hex dump of |
| 496 | * content octets or DER encoding). We can only dump non character strings or |
| 497 | * everything. If we don't dump 'unknown' they are interpreted as character |
| 498 | * strings with 1 octet per character and are subject to the usual escaping |
| 499 | * options. |
| 500 | */ |
| 501 | |
| 502 | #define ASN1_STRFLGS_DUMP_ALL 0x80 |
| 503 | #define ASN1_STRFLGS_DUMP_UNKNOWN 0x100 |
| 504 | |
| 505 | /* |
| 506 | * These determine what 'dumping' does, we can dump the content octets or the |
| 507 | * DER encoding: both use the RFC2253 #XXXXX notation. |
| 508 | */ |
| 509 | |
| 510 | #define ASN1_STRFLGS_DUMP_DER 0x200 |
| 511 | |
| 512 | /* |
| 513 | * This flag specifies that RC2254 escaping shall be performed. |
| 514 | */ |
| 515 | #define ASN1_STRFLGS_ESC_2254 0x400 |
| 516 | |
| 517 | /* |
| 518 | * All the string flags consistent with RFC2253, escaping control characters |
| 519 | * isn't essential in RFC2253 but it is advisable anyway. |
| 520 | */ |
| 521 | |
| 522 | #define ASN1_STRFLGS_RFC2253 (ASN1_STRFLGS_ESC_2253 | ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | ASN1_STRFLGS_UTF8_CONVERT | ASN1_STRFLGS_DUMP_UNKNOWN | ASN1_STRFLGS_DUMP_DER) |
| 523 | |
| 524 | struct asn1_type_st { |
| 525 | int type; |
| 526 | union { |
| 527 | char *ptr; |
| 528 | ASN1_BOOLEAN boolean; |
| 529 | ASN1_STRING *asn1_string; |
| 530 | ASN1_OBJECT *object; |
| 531 | ASN1_INTEGER *integer; |
| 532 | ASN1_ENUMERATED *enumerated; |
| 533 | ASN1_BIT_STRING *bit_string; |
| 534 | ASN1_OCTET_STRING *octet_string; |
| 535 | ASN1_PRINTABLESTRING *printablestring; |
| 536 | ASN1_T61STRING *t61string; |
| 537 | ASN1_IA5STRING *ia5string; |
| 538 | ASN1_GENERALSTRING *generalstring; |
| 539 | ASN1_BMPSTRING *bmpstring; |
| 540 | ASN1_UNIVERSALSTRING *universalstring; |
| 541 | ASN1_UTCTIME *utctime; |
| 542 | ASN1_GENERALIZEDTIME *generalizedtime; |
| 543 | ASN1_VISIBLESTRING *visiblestring; |
| 544 | ASN1_UTF8STRING *utf8string; |
| 545 | /* |
| 546 | * set and sequence are left complete and still contain the set or |
| 547 | * sequence bytes |
| 548 | */ |
| 549 | ASN1_STRING *set; |
| 550 | ASN1_STRING *sequence; |
| 551 | ASN1_VALUE *asn1_value; |
| 552 | } value; |
| 553 | }; |
| 554 | |
| 555 | /* clang-format off */ |
| 556 | SKM_DEFINE_STACK_OF_INTERNAL(ASN1_TYPE, ASN1_TYPE, ASN1_TYPE) |
| 557 | #define sk_ASN1_TYPE_num(sk) OPENSSL_sk_num(ossl_check_const_ASN1_TYPE_sk_type(sk)) |
| 558 | #define sk_ASN1_TYPE_value(sk, idx) ((ASN1_TYPE *)OPENSSL_sk_value(ossl_check_const_ASN1_TYPE_sk_type(sk), (idx))) |
| 559 | #define sk_ASN1_TYPE_new(cmp) ((STACK_OF(ASN1_TYPE) *)OPENSSL_sk_new(ossl_check_ASN1_TYPE_compfunc_type(cmp))) |
| 560 | #define sk_ASN1_TYPE_new_null() ((STACK_OF(ASN1_TYPE) *)OPENSSL_sk_new_null()) |
| 561 | #define sk_ASN1_TYPE_new_reserve(cmp, n) ((STACK_OF(ASN1_TYPE) *)OPENSSL_sk_new_reserve(ossl_check_ASN1_TYPE_compfunc_type(cmp), (n))) |
| 562 | #define sk_ASN1_TYPE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_ASN1_TYPE_sk_type(sk), (n)) |
| 563 | #define sk_ASN1_TYPE_free(sk) OPENSSL_sk_free(ossl_check_ASN1_TYPE_sk_type(sk)) |
| 564 | #define sk_ASN1_TYPE_zero(sk) OPENSSL_sk_zero(ossl_check_ASN1_TYPE_sk_type(sk)) |
| 565 | #define sk_ASN1_TYPE_delete(sk, i) ((ASN1_TYPE *)OPENSSL_sk_delete(ossl_check_ASN1_TYPE_sk_type(sk), (i))) |
| 566 | #define sk_ASN1_TYPE_delete_ptr(sk, ptr) ((ASN1_TYPE *)OPENSSL_sk_delete_ptr(ossl_check_ASN1_TYPE_sk_type(sk), ossl_check_ASN1_TYPE_type(ptr))) |
| 567 | #define sk_ASN1_TYPE_push(sk, ptr) OPENSSL_sk_push(ossl_check_ASN1_TYPE_sk_type(sk), ossl_check_ASN1_TYPE_type(ptr)) |
| 568 | #define sk_ASN1_TYPE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_ASN1_TYPE_sk_type(sk), ossl_check_ASN1_TYPE_type(ptr)) |
| 569 | #define sk_ASN1_TYPE_pop(sk) ((ASN1_TYPE *)OPENSSL_sk_pop(ossl_check_ASN1_TYPE_sk_type(sk))) |
| 570 | #define sk_ASN1_TYPE_shift(sk) ((ASN1_TYPE *)OPENSSL_sk_shift(ossl_check_ASN1_TYPE_sk_type(sk))) |
| 571 | #define sk_ASN1_TYPE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_ASN1_TYPE_sk_type(sk), ossl_check_ASN1_TYPE_freefunc_type(freefunc)) |
| 572 | #define sk_ASN1_TYPE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_ASN1_TYPE_sk_type(sk), ossl_check_ASN1_TYPE_type(ptr), (idx)) |
| 573 | #define sk_ASN1_TYPE_set(sk, idx, ptr) ((ASN1_TYPE *)OPENSSL_sk_set(ossl_check_ASN1_TYPE_sk_type(sk), (idx), ossl_check_ASN1_TYPE_type(ptr))) |
| 574 | #define sk_ASN1_TYPE_find(sk, ptr) OPENSSL_sk_find(ossl_check_ASN1_TYPE_sk_type(sk), ossl_check_ASN1_TYPE_type(ptr)) |
| 575 | #define sk_ASN1_TYPE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_ASN1_TYPE_sk_type(sk), ossl_check_ASN1_TYPE_type(ptr)) |
| 576 | #define sk_ASN1_TYPE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_ASN1_TYPE_sk_type(sk), ossl_check_ASN1_TYPE_type(ptr), pnum) |
| 577 | #define sk_ASN1_TYPE_sort(sk) OPENSSL_sk_sort(ossl_check_ASN1_TYPE_sk_type(sk)) |
| 578 | #define sk_ASN1_TYPE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_ASN1_TYPE_sk_type(sk)) |
| 579 | #define sk_ASN1_TYPE_dup(sk) ((STACK_OF(ASN1_TYPE) *)OPENSSL_sk_dup(ossl_check_const_ASN1_TYPE_sk_type(sk))) |
| 580 | #define sk_ASN1_TYPE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(ASN1_TYPE) *)OPENSSL_sk_deep_copy(ossl_check_const_ASN1_TYPE_sk_type(sk), ossl_check_ASN1_TYPE_copyfunc_type(copyfunc), ossl_check_ASN1_TYPE_freefunc_type(freefunc))) |
| 581 | #define sk_ASN1_TYPE_set_cmp_func(sk, cmp) ((sk_ASN1_TYPE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_ASN1_TYPE_sk_type(sk), ossl_check_ASN1_TYPE_compfunc_type(cmp))) |
| 582 | |
| 583 | /* clang-format on */ |
| 584 | |
| 585 | typedef STACK_OF(ASN1_TYPE) ASN1_SEQUENCE_ANY; |
| 586 | |
| 587 | DECLARE_ASN1_ENCODE_FUNCTIONS_name(ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY) |
| 588 | DECLARE_ASN1_ENCODE_FUNCTIONS_name(ASN1_SEQUENCE_ANY, ASN1_SET_ANY) |
| 589 | |
| 590 | /* This is used to contain a list of bit names */ |
| 591 | typedef struct BIT_STRING_BITNAME_st { |
| 592 | int bitnum; |
| 593 | const char *lname; |
| 594 | const char *sname; |
| 595 | } BIT_STRING_BITNAME; |
| 596 | |
| 597 | #define B_ASN1_TIME \ |
| 598 | B_ASN1_UTCTIME | B_ASN1_GENERALIZEDTIME |
| 599 | |
| 600 | #define B_ASN1_PRINTABLE \ |
| 601 | B_ASN1_NUMERICSTRING | B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | B_ASN1_IA5STRING | B_ASN1_BIT_STRING | B_ASN1_UNIVERSALSTRING | B_ASN1_BMPSTRING | B_ASN1_UTF8STRING | B_ASN1_SEQUENCE | B_ASN1_UNKNOWN |
| 602 | |
| 603 | #define B_ASN1_DIRECTORYSTRING \ |
| 604 | B_ASN1_PRINTABLESTRING | B_ASN1_TELETEXSTRING | B_ASN1_BMPSTRING | B_ASN1_UNIVERSALSTRING | B_ASN1_UTF8STRING |
| 605 | |
| 606 | #define B_ASN1_DISPLAYTEXT \ |
| 607 | B_ASN1_IA5STRING | B_ASN1_VISIBLESTRING | B_ASN1_BMPSTRING | B_ASN1_UTF8STRING |
| 608 | |
| 609 | DECLARE_ASN1_ALLOC_FUNCTIONS_name(ASN1_TYPE, ASN1_TYPE) |
| 610 | DECLARE_ASN1_ENCODE_FUNCTIONS(ASN1_TYPE, ASN1_ANY, ASN1_TYPE) |
| 611 | |
| 612 | int ASN1_TYPE_get(const ASN1_TYPE *a); |
| 613 | void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value); |
| 614 | int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value); |
| 615 | int ASN1_TYPE_cmp(const ASN1_TYPE *a, const ASN1_TYPE *b); |
| 616 | |
| 617 | ASN1_TYPE *ASN1_TYPE_pack_sequence(const ASN1_ITEM *it, void *s, ASN1_TYPE **t); |
| 618 | void *ASN1_TYPE_unpack_sequence(const ASN1_ITEM *it, const ASN1_TYPE *t); |
| 619 | |
| 620 | /* clang-format off */ |
| 621 | SKM_DEFINE_STACK_OF_INTERNAL(ASN1_OBJECT, ASN1_OBJECT, ASN1_OBJECT) |
| 622 | #define sk_ASN1_OBJECT_num(sk) OPENSSL_sk_num(ossl_check_const_ASN1_OBJECT_sk_type(sk)) |
| 623 | #define sk_ASN1_OBJECT_value(sk, idx) ((ASN1_OBJECT *)OPENSSL_sk_value(ossl_check_const_ASN1_OBJECT_sk_type(sk), (idx))) |
| 624 | #define sk_ASN1_OBJECT_new(cmp) ((STACK_OF(ASN1_OBJECT) *)OPENSSL_sk_new(ossl_check_ASN1_OBJECT_compfunc_type(cmp))) |
| 625 | #define sk_ASN1_OBJECT_new_null() ((STACK_OF(ASN1_OBJECT) *)OPENSSL_sk_new_null()) |
| 626 | #define sk_ASN1_OBJECT_new_reserve(cmp, n) ((STACK_OF(ASN1_OBJECT) *)OPENSSL_sk_new_reserve(ossl_check_ASN1_OBJECT_compfunc_type(cmp), (n))) |
| 627 | #define sk_ASN1_OBJECT_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_ASN1_OBJECT_sk_type(sk), (n)) |
| 628 | #define sk_ASN1_OBJECT_free(sk) OPENSSL_sk_free(ossl_check_ASN1_OBJECT_sk_type(sk)) |
| 629 | #define sk_ASN1_OBJECT_zero(sk) OPENSSL_sk_zero(ossl_check_ASN1_OBJECT_sk_type(sk)) |
| 630 | #define sk_ASN1_OBJECT_delete(sk, i) ((ASN1_OBJECT *)OPENSSL_sk_delete(ossl_check_ASN1_OBJECT_sk_type(sk), (i))) |
| 631 | #define sk_ASN1_OBJECT_delete_ptr(sk, ptr) ((ASN1_OBJECT *)OPENSSL_sk_delete_ptr(ossl_check_ASN1_OBJECT_sk_type(sk), ossl_check_ASN1_OBJECT_type(ptr))) |
| 632 | #define sk_ASN1_OBJECT_push(sk, ptr) OPENSSL_sk_push(ossl_check_ASN1_OBJECT_sk_type(sk), ossl_check_ASN1_OBJECT_type(ptr)) |
| 633 | #define sk_ASN1_OBJECT_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_ASN1_OBJECT_sk_type(sk), ossl_check_ASN1_OBJECT_type(ptr)) |
| 634 | #define sk_ASN1_OBJECT_pop(sk) ((ASN1_OBJECT *)OPENSSL_sk_pop(ossl_check_ASN1_OBJECT_sk_type(sk))) |
| 635 | #define sk_ASN1_OBJECT_shift(sk) ((ASN1_OBJECT *)OPENSSL_sk_shift(ossl_check_ASN1_OBJECT_sk_type(sk))) |
| 636 | #define sk_ASN1_OBJECT_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_ASN1_OBJECT_sk_type(sk), ossl_check_ASN1_OBJECT_freefunc_type(freefunc)) |
| 637 | #define sk_ASN1_OBJECT_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_ASN1_OBJECT_sk_type(sk), ossl_check_ASN1_OBJECT_type(ptr), (idx)) |
| 638 | #define sk_ASN1_OBJECT_set(sk, idx, ptr) ((ASN1_OBJECT *)OPENSSL_sk_set(ossl_check_ASN1_OBJECT_sk_type(sk), (idx), ossl_check_ASN1_OBJECT_type(ptr))) |
| 639 | #define sk_ASN1_OBJECT_find(sk, ptr) OPENSSL_sk_find(ossl_check_ASN1_OBJECT_sk_type(sk), ossl_check_ASN1_OBJECT_type(ptr)) |
| 640 | #define sk_ASN1_OBJECT_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_ASN1_OBJECT_sk_type(sk), ossl_check_ASN1_OBJECT_type(ptr)) |
| 641 | #define sk_ASN1_OBJECT_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_ASN1_OBJECT_sk_type(sk), ossl_check_ASN1_OBJECT_type(ptr), pnum) |
| 642 | #define sk_ASN1_OBJECT_sort(sk) OPENSSL_sk_sort(ossl_check_ASN1_OBJECT_sk_type(sk)) |
| 643 | #define sk_ASN1_OBJECT_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_ASN1_OBJECT_sk_type(sk)) |
| 644 | #define sk_ASN1_OBJECT_dup(sk) ((STACK_OF(ASN1_OBJECT) *)OPENSSL_sk_dup(ossl_check_const_ASN1_OBJECT_sk_type(sk))) |
| 645 | #define sk_ASN1_OBJECT_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(ASN1_OBJECT) *)OPENSSL_sk_deep_copy(ossl_check_const_ASN1_OBJECT_sk_type(sk), ossl_check_ASN1_OBJECT_copyfunc_type(copyfunc), ossl_check_ASN1_OBJECT_freefunc_type(freefunc))) |
| 646 | #define sk_ASN1_OBJECT_set_cmp_func(sk, cmp) ((sk_ASN1_OBJECT_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_ASN1_OBJECT_sk_type(sk), ossl_check_ASN1_OBJECT_compfunc_type(cmp))) |
| 647 | |
| 648 | /* clang-format on */ |
| 649 | |
| 650 | DECLARE_ASN1_FUNCTIONS(ASN1_OBJECT) |
| 651 | |
| 652 | ASN1_STRING *ASN1_STRING_new(void); |
| 653 | void ASN1_STRING_free(ASN1_STRING *a); |
| 654 | void ASN1_STRING_clear_free(ASN1_STRING *a); |
| 655 | int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str); |
| 656 | DECLARE_ASN1_DUP_FUNCTION(ASN1_STRING) |
| 657 | ASN1_STRING *ASN1_STRING_type_new(int type); |
| 658 | int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b); |
| 659 | /* |
| 660 | * Since this is used to store all sorts of things, via macros, for now, |
| 661 | * make its data void * |
| 662 | */ |
| 663 | int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len); |
| 664 | void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len); |
| 665 | int ASN1_STRING_length(const ASN1_STRING *x); |
| 666 | #ifndef OPENSSL_NO_DEPRECATED_3_0 |
| 667 | OSSL_DEPRECATEDIN_3_0 void ASN1_STRING_length_set(ASN1_STRING *x, int n); |
| 668 | #endif |
| 669 | int ASN1_STRING_type(const ASN1_STRING *x); |
| 670 | #ifndef OPENSSL_NO_DEPRECATED_1_1_0 |
| 671 | OSSL_DEPRECATEDIN_1_1_0 unsigned char *ASN1_STRING_data(ASN1_STRING *x); |
| 672 | #endif |
| 673 | const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *x); |
| 674 | |
| 675 | DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING) |
| 676 | int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d, int length); |
| 677 | int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value); |
| 678 | int ASN1_BIT_STRING_get_bit(const ASN1_BIT_STRING *a, int n); |
| 679 | int ASN1_BIT_STRING_check(const ASN1_BIT_STRING *a, |
| 680 | const unsigned char *flags, int flags_len); |
| 681 | |
| 682 | int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs, |
| 683 | BIT_STRING_BITNAME *tbl, int indent); |
| 684 | int ASN1_BIT_STRING_num_asc(const char *name, BIT_STRING_BITNAME *tbl); |
| 685 | int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, const char *name, int value, |
| 686 | BIT_STRING_BITNAME *tbl); |
| 687 | |
| 688 | /* clang-format off */ |
| 689 | SKM_DEFINE_STACK_OF_INTERNAL(ASN1_INTEGER, ASN1_INTEGER, ASN1_INTEGER) |
| 690 | #define sk_ASN1_INTEGER_num(sk) OPENSSL_sk_num(ossl_check_const_ASN1_INTEGER_sk_type(sk)) |
| 691 | #define sk_ASN1_INTEGER_value(sk, idx) ((ASN1_INTEGER *)OPENSSL_sk_value(ossl_check_const_ASN1_INTEGER_sk_type(sk), (idx))) |
| 692 | #define sk_ASN1_INTEGER_new(cmp) ((STACK_OF(ASN1_INTEGER) *)OPENSSL_sk_new(ossl_check_ASN1_INTEGER_compfunc_type(cmp))) |
| 693 | #define sk_ASN1_INTEGER_new_null() ((STACK_OF(ASN1_INTEGER) *)OPENSSL_sk_new_null()) |
| 694 | #define sk_ASN1_INTEGER_new_reserve(cmp, n) ((STACK_OF(ASN1_INTEGER) *)OPENSSL_sk_new_reserve(ossl_check_ASN1_INTEGER_compfunc_type(cmp), (n))) |
| 695 | #define sk_ASN1_INTEGER_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_ASN1_INTEGER_sk_type(sk), (n)) |
| 696 | #define sk_ASN1_INTEGER_free(sk) OPENSSL_sk_free(ossl_check_ASN1_INTEGER_sk_type(sk)) |
| 697 | #define sk_ASN1_INTEGER_zero(sk) OPENSSL_sk_zero(ossl_check_ASN1_INTEGER_sk_type(sk)) |
| 698 | #define sk_ASN1_INTEGER_delete(sk, i) ((ASN1_INTEGER *)OPENSSL_sk_delete(ossl_check_ASN1_INTEGER_sk_type(sk), (i))) |
| 699 | #define sk_ASN1_INTEGER_delete_ptr(sk, ptr) ((ASN1_INTEGER *)OPENSSL_sk_delete_ptr(ossl_check_ASN1_INTEGER_sk_type(sk), ossl_check_ASN1_INTEGER_type(ptr))) |
| 700 | #define sk_ASN1_INTEGER_push(sk, ptr) OPENSSL_sk_push(ossl_check_ASN1_INTEGER_sk_type(sk), ossl_check_ASN1_INTEGER_type(ptr)) |
| 701 | #define sk_ASN1_INTEGER_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_ASN1_INTEGER_sk_type(sk), ossl_check_ASN1_INTEGER_type(ptr)) |
| 702 | #define sk_ASN1_INTEGER_pop(sk) ((ASN1_INTEGER *)OPENSSL_sk_pop(ossl_check_ASN1_INTEGER_sk_type(sk))) |
| 703 | #define sk_ASN1_INTEGER_shift(sk) ((ASN1_INTEGER *)OPENSSL_sk_shift(ossl_check_ASN1_INTEGER_sk_type(sk))) |
| 704 | #define sk_ASN1_INTEGER_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_ASN1_INTEGER_sk_type(sk), ossl_check_ASN1_INTEGER_freefunc_type(freefunc)) |
| 705 | #define sk_ASN1_INTEGER_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_ASN1_INTEGER_sk_type(sk), ossl_check_ASN1_INTEGER_type(ptr), (idx)) |
| 706 | #define sk_ASN1_INTEGER_set(sk, idx, ptr) ((ASN1_INTEGER *)OPENSSL_sk_set(ossl_check_ASN1_INTEGER_sk_type(sk), (idx), ossl_check_ASN1_INTEGER_type(ptr))) |
| 707 | #define sk_ASN1_INTEGER_find(sk, ptr) OPENSSL_sk_find(ossl_check_ASN1_INTEGER_sk_type(sk), ossl_check_ASN1_INTEGER_type(ptr)) |
| 708 | #define sk_ASN1_INTEGER_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_ASN1_INTEGER_sk_type(sk), ossl_check_ASN1_INTEGER_type(ptr)) |
| 709 | #define sk_ASN1_INTEGER_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_ASN1_INTEGER_sk_type(sk), ossl_check_ASN1_INTEGER_type(ptr), pnum) |
| 710 | #define sk_ASN1_INTEGER_sort(sk) OPENSSL_sk_sort(ossl_check_ASN1_INTEGER_sk_type(sk)) |
| 711 | #define sk_ASN1_INTEGER_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_ASN1_INTEGER_sk_type(sk)) |
| 712 | #define sk_ASN1_INTEGER_dup(sk) ((STACK_OF(ASN1_INTEGER) *)OPENSSL_sk_dup(ossl_check_const_ASN1_INTEGER_sk_type(sk))) |
| 713 | #define sk_ASN1_INTEGER_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(ASN1_INTEGER) *)OPENSSL_sk_deep_copy(ossl_check_const_ASN1_INTEGER_sk_type(sk), ossl_check_ASN1_INTEGER_copyfunc_type(copyfunc), ossl_check_ASN1_INTEGER_freefunc_type(freefunc))) |
| 714 | #define sk_ASN1_INTEGER_set_cmp_func(sk, cmp) ((sk_ASN1_INTEGER_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_ASN1_INTEGER_sk_type(sk), ossl_check_ASN1_INTEGER_compfunc_type(cmp))) |
| 715 | |
| 716 | /* clang-format on */ |
| 717 | |
| 718 | DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER) |
| 719 | ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp, |
| 720 | long length); |
| 721 | DECLARE_ASN1_DUP_FUNCTION(ASN1_INTEGER) |
| 722 | int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y); |
| 723 | |
| 724 | DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED) |
| 725 | |
| 726 | int ASN1_UTCTIME_check(const ASN1_UTCTIME *a); |
| 727 | ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t); |
| 728 | ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t, |
| 729 | int offset_day, long offset_sec); |
| 730 | int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str); |
| 731 | int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t); |
| 732 | |
| 733 | int ASN1_GENERALIZEDTIME_check(const ASN1_GENERALIZEDTIME *a); |
| 734 | ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s, |
| 735 | time_t t); |
| 736 | ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s, |
| 737 | time_t t, int offset_day, |
| 738 | long offset_sec); |
| 739 | int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str); |
| 740 | |
| 741 | int ASN1_TIME_diff(int *pday, int *psec, |
| 742 | const ASN1_TIME *from, const ASN1_TIME *to); |
| 743 | |
| 744 | DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING) |
| 745 | DECLARE_ASN1_DUP_FUNCTION(ASN1_OCTET_STRING) |
| 746 | int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a, |
| 747 | const ASN1_OCTET_STRING *b); |
| 748 | int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data, |
| 749 | int len); |
| 750 | |
| 751 | /* clang-format off */ |
| 752 | SKM_DEFINE_STACK_OF_INTERNAL(ASN1_UTF8STRING, ASN1_UTF8STRING, ASN1_UTF8STRING) |
| 753 | #define sk_ASN1_UTF8STRING_num(sk) OPENSSL_sk_num(ossl_check_const_ASN1_UTF8STRING_sk_type(sk)) |
| 754 | #define sk_ASN1_UTF8STRING_value(sk, idx) ((ASN1_UTF8STRING *)OPENSSL_sk_value(ossl_check_const_ASN1_UTF8STRING_sk_type(sk), (idx))) |
| 755 | #define sk_ASN1_UTF8STRING_new(cmp) ((STACK_OF(ASN1_UTF8STRING) *)OPENSSL_sk_new(ossl_check_ASN1_UTF8STRING_compfunc_type(cmp))) |
| 756 | #define sk_ASN1_UTF8STRING_new_null() ((STACK_OF(ASN1_UTF8STRING) *)OPENSSL_sk_new_null()) |
| 757 | #define sk_ASN1_UTF8STRING_new_reserve(cmp, n) ((STACK_OF(ASN1_UTF8STRING) *)OPENSSL_sk_new_reserve(ossl_check_ASN1_UTF8STRING_compfunc_type(cmp), (n))) |
| 758 | #define sk_ASN1_UTF8STRING_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_ASN1_UTF8STRING_sk_type(sk), (n)) |
| 759 | #define sk_ASN1_UTF8STRING_free(sk) OPENSSL_sk_free(ossl_check_ASN1_UTF8STRING_sk_type(sk)) |
| 760 | #define sk_ASN1_UTF8STRING_zero(sk) OPENSSL_sk_zero(ossl_check_ASN1_UTF8STRING_sk_type(sk)) |
| 761 | #define sk_ASN1_UTF8STRING_delete(sk, i) ((ASN1_UTF8STRING *)OPENSSL_sk_delete(ossl_check_ASN1_UTF8STRING_sk_type(sk), (i))) |
| 762 | #define sk_ASN1_UTF8STRING_delete_ptr(sk, ptr) ((ASN1_UTF8STRING *)OPENSSL_sk_delete_ptr(ossl_check_ASN1_UTF8STRING_sk_type(sk), ossl_check_ASN1_UTF8STRING_type(ptr))) |
| 763 | #define sk_ASN1_UTF8STRING_push(sk, ptr) OPENSSL_sk_push(ossl_check_ASN1_UTF8STRING_sk_type(sk), ossl_check_ASN1_UTF8STRING_type(ptr)) |
| 764 | #define sk_ASN1_UTF8STRING_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_ASN1_UTF8STRING_sk_type(sk), ossl_check_ASN1_UTF8STRING_type(ptr)) |
| 765 | #define sk_ASN1_UTF8STRING_pop(sk) ((ASN1_UTF8STRING *)OPENSSL_sk_pop(ossl_check_ASN1_UTF8STRING_sk_type(sk))) |
| 766 | #define sk_ASN1_UTF8STRING_shift(sk) ((ASN1_UTF8STRING *)OPENSSL_sk_shift(ossl_check_ASN1_UTF8STRING_sk_type(sk))) |
| 767 | #define sk_ASN1_UTF8STRING_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_ASN1_UTF8STRING_sk_type(sk), ossl_check_ASN1_UTF8STRING_freefunc_type(freefunc)) |
| 768 | #define sk_ASN1_UTF8STRING_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_ASN1_UTF8STRING_sk_type(sk), ossl_check_ASN1_UTF8STRING_type(ptr), (idx)) |
| 769 | #define sk_ASN1_UTF8STRING_set(sk, idx, ptr) ((ASN1_UTF8STRING *)OPENSSL_sk_set(ossl_check_ASN1_UTF8STRING_sk_type(sk), (idx), ossl_check_ASN1_UTF8STRING_type(ptr))) |
| 770 | #define sk_ASN1_UTF8STRING_find(sk, ptr) OPENSSL_sk_find(ossl_check_ASN1_UTF8STRING_sk_type(sk), ossl_check_ASN1_UTF8STRING_type(ptr)) |
| 771 | #define sk_ASN1_UTF8STRING_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_ASN1_UTF8STRING_sk_type(sk), ossl_check_ASN1_UTF8STRING_type(ptr)) |
| 772 | #define sk_ASN1_UTF8STRING_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_ASN1_UTF8STRING_sk_type(sk), ossl_check_ASN1_UTF8STRING_type(ptr), pnum) |
| 773 | #define sk_ASN1_UTF8STRING_sort(sk) OPENSSL_sk_sort(ossl_check_ASN1_UTF8STRING_sk_type(sk)) |
| 774 | #define sk_ASN1_UTF8STRING_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_ASN1_UTF8STRING_sk_type(sk)) |
| 775 | #define sk_ASN1_UTF8STRING_dup(sk) ((STACK_OF(ASN1_UTF8STRING) *)OPENSSL_sk_dup(ossl_check_const_ASN1_UTF8STRING_sk_type(sk))) |
| 776 | #define sk_ASN1_UTF8STRING_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(ASN1_UTF8STRING) *)OPENSSL_sk_deep_copy(ossl_check_const_ASN1_UTF8STRING_sk_type(sk), ossl_check_ASN1_UTF8STRING_copyfunc_type(copyfunc), ossl_check_ASN1_UTF8STRING_freefunc_type(freefunc))) |
| 777 | #define sk_ASN1_UTF8STRING_set_cmp_func(sk, cmp) ((sk_ASN1_UTF8STRING_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_ASN1_UTF8STRING_sk_type(sk), ossl_check_ASN1_UTF8STRING_compfunc_type(cmp))) |
| 778 | |
| 779 | /* clang-format on */ |
| 780 | |
| 781 | DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING) |
| 782 | DECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING) |
| 783 | DECLARE_ASN1_FUNCTIONS(ASN1_UTF8STRING) |
| 784 | DECLARE_ASN1_FUNCTIONS(ASN1_NULL) |
| 785 | DECLARE_ASN1_FUNCTIONS(ASN1_BMPSTRING) |
| 786 | |
| 787 | int UTF8_getc(const unsigned char *str, int len, unsigned long *val); |
| 788 | int UTF8_putc(unsigned char *str, int len, unsigned long value); |
| 789 | |
| 790 | /* clang-format off */ |
| 791 | SKM_DEFINE_STACK_OF_INTERNAL(ASN1_GENERALSTRING, ASN1_GENERALSTRING, ASN1_GENERALSTRING) |
| 792 | #define sk_ASN1_GENERALSTRING_num(sk) OPENSSL_sk_num(ossl_check_const_ASN1_GENERALSTRING_sk_type(sk)) |
| 793 | #define sk_ASN1_GENERALSTRING_value(sk, idx) ((ASN1_GENERALSTRING *)OPENSSL_sk_value(ossl_check_const_ASN1_GENERALSTRING_sk_type(sk), (idx))) |
| 794 | #define sk_ASN1_GENERALSTRING_new(cmp) ((STACK_OF(ASN1_GENERALSTRING) *)OPENSSL_sk_new(ossl_check_ASN1_GENERALSTRING_compfunc_type(cmp))) |
| 795 | #define sk_ASN1_GENERALSTRING_new_null() ((STACK_OF(ASN1_GENERALSTRING) *)OPENSSL_sk_new_null()) |
| 796 | #define sk_ASN1_GENERALSTRING_new_reserve(cmp, n) ((STACK_OF(ASN1_GENERALSTRING) *)OPENSSL_sk_new_reserve(ossl_check_ASN1_GENERALSTRING_compfunc_type(cmp), (n))) |
| 797 | #define sk_ASN1_GENERALSTRING_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_ASN1_GENERALSTRING_sk_type(sk), (n)) |
| 798 | #define sk_ASN1_GENERALSTRING_free(sk) OPENSSL_sk_free(ossl_check_ASN1_GENERALSTRING_sk_type(sk)) |
| 799 | #define sk_ASN1_GENERALSTRING_zero(sk) OPENSSL_sk_zero(ossl_check_ASN1_GENERALSTRING_sk_type(sk)) |
| 800 | #define sk_ASN1_GENERALSTRING_delete(sk, i) ((ASN1_GENERALSTRING *)OPENSSL_sk_delete(ossl_check_ASN1_GENERALSTRING_sk_type(sk), (i))) |
| 801 | #define sk_ASN1_GENERALSTRING_delete_ptr(sk, ptr) ((ASN1_GENERALSTRING *)OPENSSL_sk_delete_ptr(ossl_check_ASN1_GENERALSTRING_sk_type(sk), ossl_check_ASN1_GENERALSTRING_type(ptr))) |
| 802 | #define sk_ASN1_GENERALSTRING_push(sk, ptr) OPENSSL_sk_push(ossl_check_ASN1_GENERALSTRING_sk_type(sk), ossl_check_ASN1_GENERALSTRING_type(ptr)) |
| 803 | #define sk_ASN1_GENERALSTRING_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_ASN1_GENERALSTRING_sk_type(sk), ossl_check_ASN1_GENERALSTRING_type(ptr)) |
| 804 | #define sk_ASN1_GENERALSTRING_pop(sk) ((ASN1_GENERALSTRING *)OPENSSL_sk_pop(ossl_check_ASN1_GENERALSTRING_sk_type(sk))) |
| 805 | #define sk_ASN1_GENERALSTRING_shift(sk) ((ASN1_GENERALSTRING *)OPENSSL_sk_shift(ossl_check_ASN1_GENERALSTRING_sk_type(sk))) |
| 806 | #define sk_ASN1_GENERALSTRING_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_ASN1_GENERALSTRING_sk_type(sk), ossl_check_ASN1_GENERALSTRING_freefunc_type(freefunc)) |
| 807 | #define sk_ASN1_GENERALSTRING_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_ASN1_GENERALSTRING_sk_type(sk), ossl_check_ASN1_GENERALSTRING_type(ptr), (idx)) |
| 808 | #define sk_ASN1_GENERALSTRING_set(sk, idx, ptr) ((ASN1_GENERALSTRING *)OPENSSL_sk_set(ossl_check_ASN1_GENERALSTRING_sk_type(sk), (idx), ossl_check_ASN1_GENERALSTRING_type(ptr))) |
| 809 | #define sk_ASN1_GENERALSTRING_find(sk, ptr) OPENSSL_sk_find(ossl_check_ASN1_GENERALSTRING_sk_type(sk), ossl_check_ASN1_GENERALSTRING_type(ptr)) |
| 810 | #define sk_ASN1_GENERALSTRING_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_ASN1_GENERALSTRING_sk_type(sk), ossl_check_ASN1_GENERALSTRING_type(ptr)) |
| 811 | #define sk_ASN1_GENERALSTRING_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_ASN1_GENERALSTRING_sk_type(sk), ossl_check_ASN1_GENERALSTRING_type(ptr), pnum) |
| 812 | #define sk_ASN1_GENERALSTRING_sort(sk) OPENSSL_sk_sort(ossl_check_ASN1_GENERALSTRING_sk_type(sk)) |
| 813 | #define sk_ASN1_GENERALSTRING_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_ASN1_GENERALSTRING_sk_type(sk)) |
| 814 | #define sk_ASN1_GENERALSTRING_dup(sk) ((STACK_OF(ASN1_GENERALSTRING) *)OPENSSL_sk_dup(ossl_check_const_ASN1_GENERALSTRING_sk_type(sk))) |
| 815 | #define sk_ASN1_GENERALSTRING_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(ASN1_GENERALSTRING) *)OPENSSL_sk_deep_copy(ossl_check_const_ASN1_GENERALSTRING_sk_type(sk), ossl_check_ASN1_GENERALSTRING_copyfunc_type(copyfunc), ossl_check_ASN1_GENERALSTRING_freefunc_type(freefunc))) |
| 816 | #define sk_ASN1_GENERALSTRING_set_cmp_func(sk, cmp) ((sk_ASN1_GENERALSTRING_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_ASN1_GENERALSTRING_sk_type(sk), ossl_check_ASN1_GENERALSTRING_compfunc_type(cmp))) |
| 817 | |
| 818 | /* clang-format on */ |
| 819 | |
| 820 | DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, ASN1_PRINTABLE) |
| 821 | |
| 822 | DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DIRECTORYSTRING) |
| 823 | DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DISPLAYTEXT) |
| 824 | DECLARE_ASN1_FUNCTIONS(ASN1_PRINTABLESTRING) |
| 825 | DECLARE_ASN1_FUNCTIONS(ASN1_T61STRING) |
| 826 | DECLARE_ASN1_FUNCTIONS(ASN1_IA5STRING) |
| 827 | DECLARE_ASN1_FUNCTIONS(ASN1_GENERALSTRING) |
| 828 | DECLARE_ASN1_FUNCTIONS(ASN1_UTCTIME) |
| 829 | DECLARE_ASN1_FUNCTIONS(ASN1_GENERALIZEDTIME) |
| 830 | DECLARE_ASN1_FUNCTIONS(ASN1_TIME) |
| 831 | |
| 832 | DECLARE_ASN1_DUP_FUNCTION(ASN1_TIME) |
| 833 | DECLARE_ASN1_DUP_FUNCTION(ASN1_UTCTIME) |
| 834 | DECLARE_ASN1_DUP_FUNCTION(ASN1_GENERALIZEDTIME) |
| 835 | |
| 836 | DECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF) |
| 837 | |
| 838 | ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t); |
| 839 | ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s, time_t t, |
| 840 | int offset_day, long offset_sec); |
| 841 | int ASN1_TIME_check(const ASN1_TIME *t); |
| 842 | ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(const ASN1_TIME *t, |
| 843 | ASN1_GENERALIZEDTIME **out); |
| 844 | int ASN1_TIME_set_string(ASN1_TIME *s, const char *str); |
| 845 | int ASN1_TIME_set_string_X509(ASN1_TIME *s, const char *str); |
| 846 | int ASN1_TIME_to_tm(const ASN1_TIME *s, struct tm *tm); |
| 847 | int ASN1_TIME_normalize(ASN1_TIME *s); |
| 848 | int ASN1_TIME_cmp_time_t(const ASN1_TIME *s, time_t t); |
| 849 | int ASN1_TIME_compare(const ASN1_TIME *a, const ASN1_TIME *b); |
| 850 | |
| 851 | int i2a_ASN1_INTEGER(BIO *bp, const ASN1_INTEGER *a); |
| 852 | int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size); |
| 853 | int i2a_ASN1_ENUMERATED(BIO *bp, const ASN1_ENUMERATED *a); |
| 854 | int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size); |
| 855 | int i2a_ASN1_OBJECT(BIO *bp, const ASN1_OBJECT *a); |
| 856 | int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size); |
| 857 | int i2a_ASN1_STRING(BIO *bp, const ASN1_STRING *a, int type); |
| 858 | int i2t_ASN1_OBJECT(char *buf, int buf_len, const ASN1_OBJECT *a); |
| 859 | |
| 860 | int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num); |
| 861 | ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len, |
| 862 | const char *sn, const char *ln); |
| 863 | |
| 864 | int ASN1_INTEGER_get_int64(int64_t *pr, const ASN1_INTEGER *a); |
| 865 | int ASN1_INTEGER_set_int64(ASN1_INTEGER *a, int64_t r); |
| 866 | int ASN1_INTEGER_get_uint64(uint64_t *pr, const ASN1_INTEGER *a); |
| 867 | int ASN1_INTEGER_set_uint64(ASN1_INTEGER *a, uint64_t r); |
| 868 | |
| 869 | int ASN1_INTEGER_set(ASN1_INTEGER *a, long v); |
| 870 | long ASN1_INTEGER_get(const ASN1_INTEGER *a); |
| 871 | ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai); |
| 872 | BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai, BIGNUM *bn); |
| 873 | |
| 874 | int ASN1_ENUMERATED_get_int64(int64_t *pr, const ASN1_ENUMERATED *a); |
| 875 | int ASN1_ENUMERATED_set_int64(ASN1_ENUMERATED *a, int64_t r); |
| 876 | |
| 877 | int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v); |
| 878 | long ASN1_ENUMERATED_get(const ASN1_ENUMERATED *a); |
| 879 | ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(const BIGNUM *bn, ASN1_ENUMERATED *ai); |
| 880 | BIGNUM *ASN1_ENUMERATED_to_BN(const ASN1_ENUMERATED *ai, BIGNUM *bn); |
| 881 | |
| 882 | /* General */ |
| 883 | /* given a string, return the correct type, max is the maximum length */ |
| 884 | int ASN1_PRINTABLE_type(const unsigned char *s, int max); |
| 885 | |
| 886 | unsigned long ASN1_tag2bit(int tag); |
| 887 | |
| 888 | /* SPECIALS */ |
| 889 | int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, |
| 890 | int *pclass, long omax); |
| 891 | int ASN1_check_infinite_end(unsigned char **p, long len); |
| 892 | int ASN1_const_check_infinite_end(const unsigned char **p, long len); |
| 893 | void ASN1_put_object(unsigned char **pp, int constructed, int length, |
| 894 | int tag, int xclass); |
| 895 | int ASN1_put_eoc(unsigned char **pp); |
| 896 | int ASN1_object_size(int constructed, int length, int tag); |
| 897 | |
| 898 | /* Used to implement other functions */ |
| 899 | void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, const void *x); |
| 900 | |
| 901 | #define ASN1_dup_of(type, i2d, d2i, x) \ |
| 902 | ((type *)ASN1_dup(CHECKED_I2D_OF(type, i2d), \ |
| 903 | CHECKED_D2I_OF(type, d2i), \ |
| 904 | CHECKED_PTR_OF(const type, x))) |
| 905 | |
| 906 | void *ASN1_item_dup(const ASN1_ITEM *it, const void *x); |
| 907 | int ASN1_item_sign_ex(const ASN1_ITEM *it, X509_ALGOR *algor1, |
| 908 | X509_ALGOR *algor2, ASN1_BIT_STRING *signature, |
| 909 | const void *data, const ASN1_OCTET_STRING *id, |
| 910 | EVP_PKEY *pkey, const EVP_MD *md, OSSL_LIB_CTX *libctx, |
| 911 | const char *propq); |
| 912 | int ASN1_item_verify_ex(const ASN1_ITEM *it, const X509_ALGOR *alg, |
| 913 | const ASN1_BIT_STRING *signature, const void *data, |
| 914 | const ASN1_OCTET_STRING *id, EVP_PKEY *pkey, |
| 915 | OSSL_LIB_CTX *libctx, const char *propq); |
| 916 | |
| 917 | /* ASN1 alloc/free macros for when a type is only used internally */ |
| 918 | |
| 919 | #define M_ASN1_new_of(type) (type *)ASN1_item_new(ASN1_ITEM_rptr(type)) |
| 920 | #define M_ASN1_free_of(x, type) \ |
| 921 | ASN1_item_free(CHECKED_PTR_OF(type, x), ASN1_ITEM_rptr(type)) |
| 922 | |
| 923 | #ifndef OPENSSL_NO_STDIO |
| 924 | void *ASN1_d2i_fp(void *(*xnew)(void), d2i_of_void *d2i, FILE *in, void **x); |
| 925 | |
| 926 | #define ASN1_d2i_fp_of(type, xnew, d2i, in, x) \ |
| 927 | ((type *)ASN1_d2i_fp(CHECKED_NEW_OF(type, xnew), \ |
| 928 | CHECKED_D2I_OF(type, d2i), \ |
| 929 | in, \ |
| 930 | CHECKED_PPTR_OF(type, x))) |
| 931 | |
| 932 | void *ASN1_item_d2i_fp_ex(const ASN1_ITEM *it, FILE *in, void *x, |
| 933 | OSSL_LIB_CTX *libctx, const char *propq); |
| 934 | void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x); |
| 935 | int ASN1_i2d_fp(i2d_of_void *i2d, FILE *out, const void *x); |
| 936 | |
| 937 | #define ASN1_i2d_fp_of(type, i2d, out, x) \ |
| 938 | (ASN1_i2d_fp(CHECKED_I2D_OF(type, i2d), \ |
| 939 | out, \ |
| 940 | CHECKED_PTR_OF(const type, x))) |
| 941 | |
| 942 | int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, const void *x); |
| 943 | int ASN1_STRING_print_ex_fp(FILE *fp, const ASN1_STRING *str, unsigned long flags); |
| 944 | #endif |
| 945 | |
| 946 | int ASN1_STRING_to_UTF8(unsigned char **out, const ASN1_STRING *in); |
| 947 | |
| 948 | void *ASN1_d2i_bio(void *(*xnew)(void), d2i_of_void *d2i, BIO *in, void **x); |
| 949 | |
| 950 | #define ASN1_d2i_bio_of(type, xnew, d2i, in, x) \ |
| 951 | ((type *)ASN1_d2i_bio(CHECKED_NEW_OF(type, xnew), \ |
| 952 | CHECKED_D2I_OF(type, d2i), \ |
| 953 | in, \ |
| 954 | CHECKED_PPTR_OF(type, x))) |
| 955 | |
| 956 | void *ASN1_item_d2i_bio_ex(const ASN1_ITEM *it, BIO *in, void *pval, |
| 957 | OSSL_LIB_CTX *libctx, const char *propq); |
| 958 | void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *pval); |
| 959 | int ASN1_i2d_bio(i2d_of_void *i2d, BIO *out, const void *x); |
| 960 | |
| 961 | #define ASN1_i2d_bio_of(type, i2d, out, x) \ |
| 962 | (ASN1_i2d_bio(CHECKED_I2D_OF(type, i2d), \ |
| 963 | out, \ |
| 964 | CHECKED_PTR_OF(const type, x))) |
| 965 | |
| 966 | int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, const void *x); |
| 967 | BIO *ASN1_item_i2d_mem_bio(const ASN1_ITEM *it, const ASN1_VALUE *val); |
| 968 | int ASN1_UTCTIME_print(BIO *fp, const ASN1_UTCTIME *a); |
| 969 | int ASN1_GENERALIZEDTIME_print(BIO *fp, const ASN1_GENERALIZEDTIME *a); |
| 970 | int ASN1_TIME_print(BIO *bp, const ASN1_TIME *tm); |
| 971 | int ASN1_TIME_print_ex(BIO *bp, const ASN1_TIME *tm, unsigned long flags); |
| 972 | int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v); |
| 973 | int ASN1_STRING_print_ex(BIO *out, const ASN1_STRING *str, unsigned long flags); |
| 974 | int ASN1_buf_print(BIO *bp, const unsigned char *buf, size_t buflen, int off); |
| 975 | int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num, |
| 976 | unsigned char *buf, int off); |
| 977 | int ASN1_parse(BIO *bp, const unsigned char *pp, long len, int indent); |
| 978 | int ASN1_parse_dump(BIO *bp, const unsigned char *pp, long len, int indent, |
| 979 | int dump); |
| 980 | const char *ASN1_tag2str(int tag); |
| 981 | |
| 982 | /* Used to load and write Netscape format cert */ |
| 983 | |
| 984 | int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s); |
| 985 | |
| 986 | int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, int len); |
| 987 | int ASN1_TYPE_get_octetstring(const ASN1_TYPE *a, unsigned char *data, int max_len); |
| 988 | int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, |
| 989 | unsigned char *data, int len); |
| 990 | int ASN1_TYPE_get_int_octetstring(const ASN1_TYPE *a, long *num, |
| 991 | unsigned char *data, int max_len); |
| 992 | |
| 993 | void *ASN1_item_unpack(const ASN1_STRING *oct, const ASN1_ITEM *it); |
| 994 | void *ASN1_item_unpack_ex(const ASN1_STRING *oct, const ASN1_ITEM *it, |
| 995 | OSSL_LIB_CTX *libctx, const char *propq); |
| 996 | |
| 997 | ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, |
| 998 | ASN1_OCTET_STRING **oct); |
| 999 | |
| 1000 | void ASN1_STRING_set_default_mask(unsigned long mask); |
| 1001 | int ASN1_STRING_set_default_mask_asc(const char *p); |
| 1002 | unsigned long ASN1_STRING_get_default_mask(void); |
| 1003 | int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len, |
| 1004 | int inform, unsigned long mask); |
| 1005 | int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len, |
| 1006 | int inform, unsigned long mask, |
| 1007 | long minsize, long maxsize); |
| 1008 | |
| 1009 | ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, |
| 1010 | const unsigned char *in, int inlen, |
| 1011 | int inform, int nid); |
| 1012 | ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid); |
| 1013 | int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long); |
| 1014 | void ASN1_STRING_TABLE_cleanup(void); |
| 1015 | |
| 1016 | /* ASN1 template functions */ |
| 1017 | |
| 1018 | /* Old API compatible functions */ |
| 1019 | ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it); |
| 1020 | ASN1_VALUE *ASN1_item_new_ex(const ASN1_ITEM *it, OSSL_LIB_CTX *libctx, |
| 1021 | const char *propq); |
| 1022 | void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it); |
| 1023 | ASN1_VALUE *ASN1_item_d2i_ex(ASN1_VALUE **val, const unsigned char **in, |
| 1024 | long len, const ASN1_ITEM *it, |
| 1025 | OSSL_LIB_CTX *libctx, const char *propq); |
| 1026 | ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in, |
| 1027 | long len, const ASN1_ITEM *it); |
| 1028 | int ASN1_item_i2d(const ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it); |
| 1029 | int ASN1_item_ndef_i2d(const ASN1_VALUE *val, unsigned char **out, |
| 1030 | const ASN1_ITEM *it); |
| 1031 | |
| 1032 | void ASN1_add_oid_module(void); |
| 1033 | void ASN1_add_stable_module(void); |
| 1034 | |
| 1035 | ASN1_TYPE *ASN1_generate_nconf(const char *str, CONF *nconf); |
| 1036 | ASN1_TYPE *ASN1_generate_v3(const char *str, X509V3_CTX *cnf); |
| 1037 | int ASN1_str2mask(const char *str, unsigned long *pmask); |
| 1038 | |
| 1039 | /* ASN1 Print flags */ |
| 1040 | |
| 1041 | /* Indicate missing OPTIONAL fields */ |
| 1042 | #define ASN1_PCTX_FLAGS_SHOW_ABSENT 0x001 |
| 1043 | /* Mark start and end of SEQUENCE */ |
| 1044 | #define ASN1_PCTX_FLAGS_SHOW_SEQUENCE 0x002 |
| 1045 | /* Mark start and end of SEQUENCE/SET OF */ |
| 1046 | #define ASN1_PCTX_FLAGS_SHOW_SSOF 0x004 |
| 1047 | /* Show the ASN1 type of primitives */ |
| 1048 | #define ASN1_PCTX_FLAGS_SHOW_TYPE 0x008 |
| 1049 | /* Don't show ASN1 type of ANY */ |
| 1050 | #define ASN1_PCTX_FLAGS_NO_ANY_TYPE 0x010 |
| 1051 | /* Don't show ASN1 type of MSTRINGs */ |
| 1052 | #define ASN1_PCTX_FLAGS_NO_MSTRING_TYPE 0x020 |
| 1053 | /* Don't show field names in SEQUENCE */ |
| 1054 | #define ASN1_PCTX_FLAGS_NO_FIELD_NAME 0x040 |
| 1055 | /* Show structure names of each SEQUENCE field */ |
| 1056 | #define ASN1_PCTX_FLAGS_SHOW_FIELD_STRUCT_NAME 0x080 |
| 1057 | /* Don't show structure name even at top level */ |
| 1058 | #define ASN1_PCTX_FLAGS_NO_STRUCT_NAME 0x100 |
| 1059 | |
| 1060 | int ASN1_item_print(BIO *out, const ASN1_VALUE *ifld, int indent, |
| 1061 | const ASN1_ITEM *it, const ASN1_PCTX *pctx); |
| 1062 | ASN1_PCTX *ASN1_PCTX_new(void); |
| 1063 | void ASN1_PCTX_free(ASN1_PCTX *p); |
| 1064 | unsigned long ASN1_PCTX_get_flags(const ASN1_PCTX *p); |
| 1065 | void ASN1_PCTX_set_flags(ASN1_PCTX *p, unsigned long flags); |
| 1066 | unsigned long ASN1_PCTX_get_nm_flags(const ASN1_PCTX *p); |
| 1067 | void ASN1_PCTX_set_nm_flags(ASN1_PCTX *p, unsigned long flags); |
| 1068 | unsigned long ASN1_PCTX_get_cert_flags(const ASN1_PCTX *p); |
| 1069 | void ASN1_PCTX_set_cert_flags(ASN1_PCTX *p, unsigned long flags); |
| 1070 | unsigned long ASN1_PCTX_get_oid_flags(const ASN1_PCTX *p); |
| 1071 | void ASN1_PCTX_set_oid_flags(ASN1_PCTX *p, unsigned long flags); |
| 1072 | unsigned long ASN1_PCTX_get_str_flags(const ASN1_PCTX *p); |
| 1073 | void ASN1_PCTX_set_str_flags(ASN1_PCTX *p, unsigned long flags); |
| 1074 | |
| 1075 | ASN1_SCTX *ASN1_SCTX_new(int (*scan_cb)(ASN1_SCTX *ctx)); |
| 1076 | void ASN1_SCTX_free(ASN1_SCTX *p); |
| 1077 | const ASN1_ITEM *ASN1_SCTX_get_item(ASN1_SCTX *p); |
| 1078 | const ASN1_TEMPLATE *ASN1_SCTX_get_template(ASN1_SCTX *p); |
| 1079 | unsigned long ASN1_SCTX_get_flags(ASN1_SCTX *p); |
| 1080 | void ASN1_SCTX_set_app_data(ASN1_SCTX *p, void *data); |
| 1081 | void *ASN1_SCTX_get_app_data(ASN1_SCTX *p); |
| 1082 | |
| 1083 | const BIO_METHOD *BIO_f_asn1(void); |
| 1084 | |
| 1085 | /* cannot constify val because of CMS_stream() */ |
| 1086 | BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it); |
| 1087 | |
| 1088 | int i2d_ASN1_bio_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags, |
| 1089 | const ASN1_ITEM *it); |
| 1090 | int PEM_write_bio_ASN1_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags, |
| 1091 | const char *hdr, const ASN1_ITEM *it); |
| 1092 | /* cannot constify val because of CMS_dataFinal() */ |
| 1093 | int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags, |
| 1094 | int ctype_nid, int econt_nid, |
| 1095 | STACK_OF(X509_ALGOR) *mdalgs, const ASN1_ITEM *it); |
| 1096 | int SMIME_write_ASN1_ex(BIO *bio, ASN1_VALUE *val, BIO *data, int flags, |
| 1097 | int ctype_nid, int econt_nid, |
| 1098 | STACK_OF(X509_ALGOR) *mdalgs, const ASN1_ITEM *it, |
| 1099 | OSSL_LIB_CTX *libctx, const char *propq); |
| 1100 | ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it); |
| 1101 | ASN1_VALUE *SMIME_read_ASN1_ex(BIO *bio, int flags, BIO **bcont, |
| 1102 | const ASN1_ITEM *it, ASN1_VALUE **x, |
| 1103 | OSSL_LIB_CTX *libctx, const char *propq); |
| 1104 | int SMIME_crlf_copy(BIO *in, BIO *out, int flags); |
| 1105 | int SMIME_text(BIO *in, BIO *out); |
| 1106 | |
| 1107 | const ASN1_ITEM *ASN1_ITEM_lookup(const char *name); |
| 1108 | const ASN1_ITEM *ASN1_ITEM_get(size_t i); |
| 1109 | |
| 1110 | /* Legacy compatibility */ |
| 1111 | #define DECLARE_ASN1_FUNCTIONS_fname(type, itname, name) \ |
| 1112 | DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ |
| 1113 | DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) |
| 1114 | #define DECLARE_ASN1_FUNCTIONS_const(type) DECLARE_ASN1_FUNCTIONS(type) |
| 1115 | #define DECLARE_ASN1_ENCODE_FUNCTIONS_const(type, name) \ |
| 1116 | DECLARE_ASN1_ENCODE_FUNCTIONS(type, name) |
| 1117 | #define I2D_OF_const(type) I2D_OF(type) |
| 1118 | #define ASN1_dup_of_const(type, i2d, d2i, x) ASN1_dup_of(type, i2d, d2i, x) |
| 1119 | #define ASN1_i2d_fp_of_const(type, i2d, out, x) ASN1_i2d_fp_of(type, i2d, out, x) |
| 1120 | #define ASN1_i2d_bio_of_const(type, i2d, out, x) ASN1_i2d_bio_of(type, i2d, out, x) |
| 1121 | |
| 1122 | #ifdef __cplusplus |
| 1123 | } |
| 1124 | #endif |
| 1125 | #endif |
| 1126 | |