1 /* 2 * WARNING: do not edit! 3 * Generated by Makefile from include/openssl/x509v3.h.in 4 * 5 * Copyright 1999-2023 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 14 15 #ifndef OPENSSL_X509V3_H 16 # define OPENSSL_X509V3_H 17 # pragma once 18 19 # include <openssl/macros.h> 20 # ifndef OPENSSL_NO_DEPRECATED_3_0 21 # define HEADER_X509V3_H 22 # endif 23 24 # include <openssl/bio.h> 25 # include <openssl/x509.h> 26 # include <openssl/conf.h> 27 # include <openssl/x509v3err.h> 28 29 #ifdef __cplusplus 30 extern "C" { 31 #endif 32 33 /* Forward reference */ 34 struct v3_ext_method; 35 struct v3_ext_ctx; 36 37 /* Useful typedefs */ 38 39 typedef void *(*X509V3_EXT_NEW)(void); 40 typedef void (*X509V3_EXT_FREE) (void *); 41 typedef void *(*X509V3_EXT_D2I)(void *, const unsigned char **, long); 42 typedef int (*X509V3_EXT_I2D) (const void *, unsigned char **); 43 typedef STACK_OF(CONF_VALUE) * 44 (*X509V3_EXT_I2V) (const struct v3_ext_method *method, void *ext, 45 STACK_OF(CONF_VALUE) *extlist); 46 typedef void *(*X509V3_EXT_V2I)(const struct v3_ext_method *method, 47 struct v3_ext_ctx *ctx, 48 STACK_OF(CONF_VALUE) *values); 49 typedef char *(*X509V3_EXT_I2S)(const struct v3_ext_method *method, 50 void *ext); 51 typedef void *(*X509V3_EXT_S2I)(const struct v3_ext_method *method, 52 struct v3_ext_ctx *ctx, const char *str); 53 typedef int (*X509V3_EXT_I2R) (const struct v3_ext_method *method, void *ext, 54 BIO *out, int indent); 55 typedef void *(*X509V3_EXT_R2I)(const struct v3_ext_method *method, 56 struct v3_ext_ctx *ctx, const char *str); 57 58 /* V3 extension structure */ 59 60 struct v3_ext_method { 61 int ext_nid; 62 int ext_flags; 63 /* If this is set the following four fields are ignored */ 64 ASN1_ITEM_EXP *it; 65 /* Old style ASN1 calls */ 66 X509V3_EXT_NEW ext_new; 67 X509V3_EXT_FREE ext_free; 68 X509V3_EXT_D2I d2i; 69 X509V3_EXT_I2D i2d; 70 /* The following pair is used for string extensions */ 71 X509V3_EXT_I2S i2s; 72 X509V3_EXT_S2I s2i; 73 /* The following pair is used for multi-valued extensions */ 74 X509V3_EXT_I2V i2v; 75 X509V3_EXT_V2I v2i; 76 /* The following are used for raw extensions */ 77 X509V3_EXT_I2R i2r; 78 X509V3_EXT_R2I r2i; 79 void *usr_data; /* Any extension specific data */ 80 }; 81 82 typedef struct X509V3_CONF_METHOD_st { 83 char *(*get_string) (void *db, const char *section, const char *value); 84 STACK_OF(CONF_VALUE) *(*get_section) (void *db, const char *section); 85 void (*free_string) (void *db, char *string); 86 void (*free_section) (void *db, STACK_OF(CONF_VALUE) *section); 87 } X509V3_CONF_METHOD; 88 89 /* Context specific info for producing X509 v3 extensions*/ 90 struct v3_ext_ctx { 91 # define X509V3_CTX_TEST 0x1 92 # ifndef OPENSSL_NO_DEPRECATED_3_0 93 # define CTX_TEST X509V3_CTX_TEST 94 # endif 95 # define X509V3_CTX_REPLACE 0x2 96 int flags; 97 X509 *issuer_cert; 98 X509 *subject_cert; 99 X509_REQ *subject_req; 100 X509_CRL *crl; 101 X509V3_CONF_METHOD *db_meth; 102 void *db; 103 EVP_PKEY *issuer_pkey; 104 /* Maybe more here */ 105 }; 106 107 typedef struct v3_ext_method X509V3_EXT_METHOD; 108 109 SKM_DEFINE_STACK_OF_INTERNAL(X509V3_EXT_METHOD, X509V3_EXT_METHOD, X509V3_EXT_METHOD) 110 #define sk_X509V3_EXT_METHOD_num(sk) OPENSSL_sk_num(ossl_check_const_X509V3_EXT_METHOD_sk_type(sk)) 111 #define sk_X509V3_EXT_METHOD_value(sk, idx) ((X509V3_EXT_METHOD *)OPENSSL_sk_value(ossl_check_const_X509V3_EXT_METHOD_sk_type(sk), (idx))) 112 #define sk_X509V3_EXT_METHOD_new(cmp) ((STACK_OF(X509V3_EXT_METHOD) *)OPENSSL_sk_new(ossl_check_X509V3_EXT_METHOD_compfunc_type(cmp))) 113 #define sk_X509V3_EXT_METHOD_new_null() ((STACK_OF(X509V3_EXT_METHOD) *)OPENSSL_sk_new_null()) 114 #define sk_X509V3_EXT_METHOD_new_reserve(cmp, n) ((STACK_OF(X509V3_EXT_METHOD) *)OPENSSL_sk_new_reserve(ossl_check_X509V3_EXT_METHOD_compfunc_type(cmp), (n))) 115 #define sk_X509V3_EXT_METHOD_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509V3_EXT_METHOD_sk_type(sk), (n)) 116 #define sk_X509V3_EXT_METHOD_free(sk) OPENSSL_sk_free(ossl_check_X509V3_EXT_METHOD_sk_type(sk)) 117 #define sk_X509V3_EXT_METHOD_zero(sk) OPENSSL_sk_zero(ossl_check_X509V3_EXT_METHOD_sk_type(sk)) 118 #define sk_X509V3_EXT_METHOD_delete(sk, i) ((X509V3_EXT_METHOD *)OPENSSL_sk_delete(ossl_check_X509V3_EXT_METHOD_sk_type(sk), (i))) 119 #define sk_X509V3_EXT_METHOD_delete_ptr(sk, ptr) ((X509V3_EXT_METHOD *)OPENSSL_sk_delete_ptr(ossl_check_X509V3_EXT_METHOD_sk_type(sk), ossl_check_X509V3_EXT_METHOD_type(ptr))) 120 #define sk_X509V3_EXT_METHOD_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509V3_EXT_METHOD_sk_type(sk), ossl_check_X509V3_EXT_METHOD_type(ptr)) 121 #define sk_X509V3_EXT_METHOD_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509V3_EXT_METHOD_sk_type(sk), ossl_check_X509V3_EXT_METHOD_type(ptr)) 122 #define sk_X509V3_EXT_METHOD_pop(sk) ((X509V3_EXT_METHOD *)OPENSSL_sk_pop(ossl_check_X509V3_EXT_METHOD_sk_type(sk))) 123 #define sk_X509V3_EXT_METHOD_shift(sk) ((X509V3_EXT_METHOD *)OPENSSL_sk_shift(ossl_check_X509V3_EXT_METHOD_sk_type(sk))) 124 #define sk_X509V3_EXT_METHOD_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509V3_EXT_METHOD_sk_type(sk),ossl_check_X509V3_EXT_METHOD_freefunc_type(freefunc)) 125 #define sk_X509V3_EXT_METHOD_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509V3_EXT_METHOD_sk_type(sk), ossl_check_X509V3_EXT_METHOD_type(ptr), (idx)) 126 #define sk_X509V3_EXT_METHOD_set(sk, idx, ptr) ((X509V3_EXT_METHOD *)OPENSSL_sk_set(ossl_check_X509V3_EXT_METHOD_sk_type(sk), (idx), ossl_check_X509V3_EXT_METHOD_type(ptr))) 127 #define sk_X509V3_EXT_METHOD_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509V3_EXT_METHOD_sk_type(sk), ossl_check_X509V3_EXT_METHOD_type(ptr)) 128 #define sk_X509V3_EXT_METHOD_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509V3_EXT_METHOD_sk_type(sk), ossl_check_X509V3_EXT_METHOD_type(ptr)) 129 #define sk_X509V3_EXT_METHOD_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509V3_EXT_METHOD_sk_type(sk), ossl_check_X509V3_EXT_METHOD_type(ptr), pnum) 130 #define sk_X509V3_EXT_METHOD_sort(sk) OPENSSL_sk_sort(ossl_check_X509V3_EXT_METHOD_sk_type(sk)) 131 #define sk_X509V3_EXT_METHOD_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509V3_EXT_METHOD_sk_type(sk)) 132 #define sk_X509V3_EXT_METHOD_dup(sk) ((STACK_OF(X509V3_EXT_METHOD) *)OPENSSL_sk_dup(ossl_check_const_X509V3_EXT_METHOD_sk_type(sk))) 133 #define sk_X509V3_EXT_METHOD_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509V3_EXT_METHOD) *)OPENSSL_sk_deep_copy(ossl_check_const_X509V3_EXT_METHOD_sk_type(sk), ossl_check_X509V3_EXT_METHOD_copyfunc_type(copyfunc), ossl_check_X509V3_EXT_METHOD_freefunc_type(freefunc))) 134 #define sk_X509V3_EXT_METHOD_set_cmp_func(sk, cmp) ((sk_X509V3_EXT_METHOD_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509V3_EXT_METHOD_sk_type(sk), ossl_check_X509V3_EXT_METHOD_compfunc_type(cmp))) 135 136 137 /* ext_flags values */ 138 # define X509V3_EXT_DYNAMIC 0x1 139 # define X509V3_EXT_CTX_DEP 0x2 140 # define X509V3_EXT_MULTILINE 0x4 141 142 typedef BIT_STRING_BITNAME ENUMERATED_NAMES; 143 144 typedef struct BASIC_CONSTRAINTS_st { 145 int ca; 146 ASN1_INTEGER *pathlen; 147 } BASIC_CONSTRAINTS; 148 149 typedef struct PKEY_USAGE_PERIOD_st { 150 ASN1_GENERALIZEDTIME *notBefore; 151 ASN1_GENERALIZEDTIME *notAfter; 152 } PKEY_USAGE_PERIOD; 153 154 typedef struct otherName_st { 155 ASN1_OBJECT *type_id; 156 ASN1_TYPE *value; 157 } OTHERNAME; 158 159 typedef struct EDIPartyName_st { 160 ASN1_STRING *nameAssigner; 161 ASN1_STRING *partyName; 162 } EDIPARTYNAME; 163 164 typedef struct GENERAL_NAME_st { 165 # define GEN_OTHERNAME 0 166 # define GEN_EMAIL 1 167 # define GEN_DNS 2 168 # define GEN_X400 3 169 # define GEN_DIRNAME 4 170 # define GEN_EDIPARTY 5 171 # define GEN_URI 6 172 # define GEN_IPADD 7 173 # define GEN_RID 8 174 int type; 175 union { 176 char *ptr; 177 OTHERNAME *otherName; /* otherName */ 178 ASN1_IA5STRING *rfc822Name; 179 ASN1_IA5STRING *dNSName; 180 ASN1_STRING *x400Address; 181 X509_NAME *directoryName; 182 EDIPARTYNAME *ediPartyName; 183 ASN1_IA5STRING *uniformResourceIdentifier; 184 ASN1_OCTET_STRING *iPAddress; 185 ASN1_OBJECT *registeredID; 186 /* Old names */ 187 ASN1_OCTET_STRING *ip; /* iPAddress */ 188 X509_NAME *dirn; /* dirn */ 189 ASN1_IA5STRING *ia5; /* rfc822Name, dNSName, 190 * uniformResourceIdentifier */ 191 ASN1_OBJECT *rid; /* registeredID */ 192 ASN1_TYPE *other; /* x400Address */ 193 } d; 194 } GENERAL_NAME; 195 196 typedef struct ACCESS_DESCRIPTION_st { 197 ASN1_OBJECT *method; 198 GENERAL_NAME *location; 199 } ACCESS_DESCRIPTION; 200 201 SKM_DEFINE_STACK_OF_INTERNAL(ACCESS_DESCRIPTION, ACCESS_DESCRIPTION, ACCESS_DESCRIPTION) 202 #define sk_ACCESS_DESCRIPTION_num(sk) OPENSSL_sk_num(ossl_check_const_ACCESS_DESCRIPTION_sk_type(sk)) 203 #define sk_ACCESS_DESCRIPTION_value(sk, idx) ((ACCESS_DESCRIPTION *)OPENSSL_sk_value(ossl_check_const_ACCESS_DESCRIPTION_sk_type(sk), (idx))) 204 #define sk_ACCESS_DESCRIPTION_new(cmp) ((STACK_OF(ACCESS_DESCRIPTION) *)OPENSSL_sk_new(ossl_check_ACCESS_DESCRIPTION_compfunc_type(cmp))) 205 #define sk_ACCESS_DESCRIPTION_new_null() ((STACK_OF(ACCESS_DESCRIPTION) *)OPENSSL_sk_new_null()) 206 #define sk_ACCESS_DESCRIPTION_new_reserve(cmp, n) ((STACK_OF(ACCESS_DESCRIPTION) *)OPENSSL_sk_new_reserve(ossl_check_ACCESS_DESCRIPTION_compfunc_type(cmp), (n))) 207 #define sk_ACCESS_DESCRIPTION_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_ACCESS_DESCRIPTION_sk_type(sk), (n)) 208 #define sk_ACCESS_DESCRIPTION_free(sk) OPENSSL_sk_free(ossl_check_ACCESS_DESCRIPTION_sk_type(sk)) 209 #define sk_ACCESS_DESCRIPTION_zero(sk) OPENSSL_sk_zero(ossl_check_ACCESS_DESCRIPTION_sk_type(sk)) 210 #define sk_ACCESS_DESCRIPTION_delete(sk, i) ((ACCESS_DESCRIPTION *)OPENSSL_sk_delete(ossl_check_ACCESS_DESCRIPTION_sk_type(sk), (i))) 211 #define sk_ACCESS_DESCRIPTION_delete_ptr(sk, ptr) ((ACCESS_DESCRIPTION *)OPENSSL_sk_delete_ptr(ossl_check_ACCESS_DESCRIPTION_sk_type(sk), ossl_check_ACCESS_DESCRIPTION_type(ptr))) 212 #define sk_ACCESS_DESCRIPTION_push(sk, ptr) OPENSSL_sk_push(ossl_check_ACCESS_DESCRIPTION_sk_type(sk), ossl_check_ACCESS_DESCRIPTION_type(ptr)) 213 #define sk_ACCESS_DESCRIPTION_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_ACCESS_DESCRIPTION_sk_type(sk), ossl_check_ACCESS_DESCRIPTION_type(ptr)) 214 #define sk_ACCESS_DESCRIPTION_pop(sk) ((ACCESS_DESCRIPTION *)OPENSSL_sk_pop(ossl_check_ACCESS_DESCRIPTION_sk_type(sk))) 215 #define sk_ACCESS_DESCRIPTION_shift(sk) ((ACCESS_DESCRIPTION *)OPENSSL_sk_shift(ossl_check_ACCESS_DESCRIPTION_sk_type(sk))) 216 #define sk_ACCESS_DESCRIPTION_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_ACCESS_DESCRIPTION_sk_type(sk),ossl_check_ACCESS_DESCRIPTION_freefunc_type(freefunc)) 217 #define sk_ACCESS_DESCRIPTION_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_ACCESS_DESCRIPTION_sk_type(sk), ossl_check_ACCESS_DESCRIPTION_type(ptr), (idx)) 218 #define sk_ACCESS_DESCRIPTION_set(sk, idx, ptr) ((ACCESS_DESCRIPTION *)OPENSSL_sk_set(ossl_check_ACCESS_DESCRIPTION_sk_type(sk), (idx), ossl_check_ACCESS_DESCRIPTION_type(ptr))) 219 #define sk_ACCESS_DESCRIPTION_find(sk, ptr) OPENSSL_sk_find(ossl_check_ACCESS_DESCRIPTION_sk_type(sk), ossl_check_ACCESS_DESCRIPTION_type(ptr)) 220 #define sk_ACCESS_DESCRIPTION_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_ACCESS_DESCRIPTION_sk_type(sk), ossl_check_ACCESS_DESCRIPTION_type(ptr)) 221 #define sk_ACCESS_DESCRIPTION_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_ACCESS_DESCRIPTION_sk_type(sk), ossl_check_ACCESS_DESCRIPTION_type(ptr), pnum) 222 #define sk_ACCESS_DESCRIPTION_sort(sk) OPENSSL_sk_sort(ossl_check_ACCESS_DESCRIPTION_sk_type(sk)) 223 #define sk_ACCESS_DESCRIPTION_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_ACCESS_DESCRIPTION_sk_type(sk)) 224 #define sk_ACCESS_DESCRIPTION_dup(sk) ((STACK_OF(ACCESS_DESCRIPTION) *)OPENSSL_sk_dup(ossl_check_const_ACCESS_DESCRIPTION_sk_type(sk))) 225 #define sk_ACCESS_DESCRIPTION_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(ACCESS_DESCRIPTION) *)OPENSSL_sk_deep_copy(ossl_check_const_ACCESS_DESCRIPTION_sk_type(sk), ossl_check_ACCESS_DESCRIPTION_copyfunc_type(copyfunc), ossl_check_ACCESS_DESCRIPTION_freefunc_type(freefunc))) 226 #define sk_ACCESS_DESCRIPTION_set_cmp_func(sk, cmp) ((sk_ACCESS_DESCRIPTION_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_ACCESS_DESCRIPTION_sk_type(sk), ossl_check_ACCESS_DESCRIPTION_compfunc_type(cmp))) 227 SKM_DEFINE_STACK_OF_INTERNAL(GENERAL_NAME, GENERAL_NAME, GENERAL_NAME) 228 #define sk_GENERAL_NAME_num(sk) OPENSSL_sk_num(ossl_check_const_GENERAL_NAME_sk_type(sk)) 229 #define sk_GENERAL_NAME_value(sk, idx) ((GENERAL_NAME *)OPENSSL_sk_value(ossl_check_const_GENERAL_NAME_sk_type(sk), (idx))) 230 #define sk_GENERAL_NAME_new(cmp) ((STACK_OF(GENERAL_NAME) *)OPENSSL_sk_new(ossl_check_GENERAL_NAME_compfunc_type(cmp))) 231 #define sk_GENERAL_NAME_new_null() ((STACK_OF(GENERAL_NAME) *)OPENSSL_sk_new_null()) 232 #define sk_GENERAL_NAME_new_reserve(cmp, n) ((STACK_OF(GENERAL_NAME) *)OPENSSL_sk_new_reserve(ossl_check_GENERAL_NAME_compfunc_type(cmp), (n))) 233 #define sk_GENERAL_NAME_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_GENERAL_NAME_sk_type(sk), (n)) 234 #define sk_GENERAL_NAME_free(sk) OPENSSL_sk_free(ossl_check_GENERAL_NAME_sk_type(sk)) 235 #define sk_GENERAL_NAME_zero(sk) OPENSSL_sk_zero(ossl_check_GENERAL_NAME_sk_type(sk)) 236 #define sk_GENERAL_NAME_delete(sk, i) ((GENERAL_NAME *)OPENSSL_sk_delete(ossl_check_GENERAL_NAME_sk_type(sk), (i))) 237 #define sk_GENERAL_NAME_delete_ptr(sk, ptr) ((GENERAL_NAME *)OPENSSL_sk_delete_ptr(ossl_check_GENERAL_NAME_sk_type(sk), ossl_check_GENERAL_NAME_type(ptr))) 238 #define sk_GENERAL_NAME_push(sk, ptr) OPENSSL_sk_push(ossl_check_GENERAL_NAME_sk_type(sk), ossl_check_GENERAL_NAME_type(ptr)) 239 #define sk_GENERAL_NAME_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_GENERAL_NAME_sk_type(sk), ossl_check_GENERAL_NAME_type(ptr)) 240 #define sk_GENERAL_NAME_pop(sk) ((GENERAL_NAME *)OPENSSL_sk_pop(ossl_check_GENERAL_NAME_sk_type(sk))) 241 #define sk_GENERAL_NAME_shift(sk) ((GENERAL_NAME *)OPENSSL_sk_shift(ossl_check_GENERAL_NAME_sk_type(sk))) 242 #define sk_GENERAL_NAME_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_GENERAL_NAME_sk_type(sk),ossl_check_GENERAL_NAME_freefunc_type(freefunc)) 243 #define sk_GENERAL_NAME_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_GENERAL_NAME_sk_type(sk), ossl_check_GENERAL_NAME_type(ptr), (idx)) 244 #define sk_GENERAL_NAME_set(sk, idx, ptr) ((GENERAL_NAME *)OPENSSL_sk_set(ossl_check_GENERAL_NAME_sk_type(sk), (idx), ossl_check_GENERAL_NAME_type(ptr))) 245 #define sk_GENERAL_NAME_find(sk, ptr) OPENSSL_sk_find(ossl_check_GENERAL_NAME_sk_type(sk), ossl_check_GENERAL_NAME_type(ptr)) 246 #define sk_GENERAL_NAME_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_GENERAL_NAME_sk_type(sk), ossl_check_GENERAL_NAME_type(ptr)) 247 #define sk_GENERAL_NAME_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_GENERAL_NAME_sk_type(sk), ossl_check_GENERAL_NAME_type(ptr), pnum) 248 #define sk_GENERAL_NAME_sort(sk) OPENSSL_sk_sort(ossl_check_GENERAL_NAME_sk_type(sk)) 249 #define sk_GENERAL_NAME_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_GENERAL_NAME_sk_type(sk)) 250 #define sk_GENERAL_NAME_dup(sk) ((STACK_OF(GENERAL_NAME) *)OPENSSL_sk_dup(ossl_check_const_GENERAL_NAME_sk_type(sk))) 251 #define sk_GENERAL_NAME_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(GENERAL_NAME) *)OPENSSL_sk_deep_copy(ossl_check_const_GENERAL_NAME_sk_type(sk), ossl_check_GENERAL_NAME_copyfunc_type(copyfunc), ossl_check_GENERAL_NAME_freefunc_type(freefunc))) 252 #define sk_GENERAL_NAME_set_cmp_func(sk, cmp) ((sk_GENERAL_NAME_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_GENERAL_NAME_sk_type(sk), ossl_check_GENERAL_NAME_compfunc_type(cmp))) 253 254 255 typedef STACK_OF(ACCESS_DESCRIPTION) AUTHORITY_INFO_ACCESS; 256 typedef STACK_OF(ASN1_OBJECT) EXTENDED_KEY_USAGE; 257 typedef STACK_OF(ASN1_INTEGER) TLS_FEATURE; 258 typedef STACK_OF(GENERAL_NAME) GENERAL_NAMES; 259 260 SKM_DEFINE_STACK_OF_INTERNAL(GENERAL_NAMES, GENERAL_NAMES, GENERAL_NAMES) 261 #define sk_GENERAL_NAMES_num(sk) OPENSSL_sk_num(ossl_check_const_GENERAL_NAMES_sk_type(sk)) 262 #define sk_GENERAL_NAMES_value(sk, idx) ((GENERAL_NAMES *)OPENSSL_sk_value(ossl_check_const_GENERAL_NAMES_sk_type(sk), (idx))) 263 #define sk_GENERAL_NAMES_new(cmp) ((STACK_OF(GENERAL_NAMES) *)OPENSSL_sk_new(ossl_check_GENERAL_NAMES_compfunc_type(cmp))) 264 #define sk_GENERAL_NAMES_new_null() ((STACK_OF(GENERAL_NAMES) *)OPENSSL_sk_new_null()) 265 #define sk_GENERAL_NAMES_new_reserve(cmp, n) ((STACK_OF(GENERAL_NAMES) *)OPENSSL_sk_new_reserve(ossl_check_GENERAL_NAMES_compfunc_type(cmp), (n))) 266 #define sk_GENERAL_NAMES_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_GENERAL_NAMES_sk_type(sk), (n)) 267 #define sk_GENERAL_NAMES_free(sk) OPENSSL_sk_free(ossl_check_GENERAL_NAMES_sk_type(sk)) 268 #define sk_GENERAL_NAMES_zero(sk) OPENSSL_sk_zero(ossl_check_GENERAL_NAMES_sk_type(sk)) 269 #define sk_GENERAL_NAMES_delete(sk, i) ((GENERAL_NAMES *)OPENSSL_sk_delete(ossl_check_GENERAL_NAMES_sk_type(sk), (i))) 270 #define sk_GENERAL_NAMES_delete_ptr(sk, ptr) ((GENERAL_NAMES *)OPENSSL_sk_delete_ptr(ossl_check_GENERAL_NAMES_sk_type(sk), ossl_check_GENERAL_NAMES_type(ptr))) 271 #define sk_GENERAL_NAMES_push(sk, ptr) OPENSSL_sk_push(ossl_check_GENERAL_NAMES_sk_type(sk), ossl_check_GENERAL_NAMES_type(ptr)) 272 #define sk_GENERAL_NAMES_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_GENERAL_NAMES_sk_type(sk), ossl_check_GENERAL_NAMES_type(ptr)) 273 #define sk_GENERAL_NAMES_pop(sk) ((GENERAL_NAMES *)OPENSSL_sk_pop(ossl_check_GENERAL_NAMES_sk_type(sk))) 274 #define sk_GENERAL_NAMES_shift(sk) ((GENERAL_NAMES *)OPENSSL_sk_shift(ossl_check_GENERAL_NAMES_sk_type(sk))) 275 #define sk_GENERAL_NAMES_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_GENERAL_NAMES_sk_type(sk),ossl_check_GENERAL_NAMES_freefunc_type(freefunc)) 276 #define sk_GENERAL_NAMES_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_GENERAL_NAMES_sk_type(sk), ossl_check_GENERAL_NAMES_type(ptr), (idx)) 277 #define sk_GENERAL_NAMES_set(sk, idx, ptr) ((GENERAL_NAMES *)OPENSSL_sk_set(ossl_check_GENERAL_NAMES_sk_type(sk), (idx), ossl_check_GENERAL_NAMES_type(ptr))) 278 #define sk_GENERAL_NAMES_find(sk, ptr) OPENSSL_sk_find(ossl_check_GENERAL_NAMES_sk_type(sk), ossl_check_GENERAL_NAMES_type(ptr)) 279 #define sk_GENERAL_NAMES_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_GENERAL_NAMES_sk_type(sk), ossl_check_GENERAL_NAMES_type(ptr)) 280 #define sk_GENERAL_NAMES_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_GENERAL_NAMES_sk_type(sk), ossl_check_GENERAL_NAMES_type(ptr), pnum) 281 #define sk_GENERAL_NAMES_sort(sk) OPENSSL_sk_sort(ossl_check_GENERAL_NAMES_sk_type(sk)) 282 #define sk_GENERAL_NAMES_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_GENERAL_NAMES_sk_type(sk)) 283 #define sk_GENERAL_NAMES_dup(sk) ((STACK_OF(GENERAL_NAMES) *)OPENSSL_sk_dup(ossl_check_const_GENERAL_NAMES_sk_type(sk))) 284 #define sk_GENERAL_NAMES_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(GENERAL_NAMES) *)OPENSSL_sk_deep_copy(ossl_check_const_GENERAL_NAMES_sk_type(sk), ossl_check_GENERAL_NAMES_copyfunc_type(copyfunc), ossl_check_GENERAL_NAMES_freefunc_type(freefunc))) 285 #define sk_GENERAL_NAMES_set_cmp_func(sk, cmp) ((sk_GENERAL_NAMES_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_GENERAL_NAMES_sk_type(sk), ossl_check_GENERAL_NAMES_compfunc_type(cmp))) 286 287 288 typedef struct DIST_POINT_NAME_st { 289 int type; 290 union { 291 GENERAL_NAMES *fullname; 292 STACK_OF(X509_NAME_ENTRY) *relativename; 293 } name; 294 /* If relativename then this contains the full distribution point name */ 295 X509_NAME *dpname; 296 } DIST_POINT_NAME; 297 /* All existing reasons */ 298 # define CRLDP_ALL_REASONS 0x807f 299 300 # define CRL_REASON_NONE -1 301 # define CRL_REASON_UNSPECIFIED 0 302 # define CRL_REASON_KEY_COMPROMISE 1 303 # define CRL_REASON_CA_COMPROMISE 2 304 # define CRL_REASON_AFFILIATION_CHANGED 3 305 # define CRL_REASON_SUPERSEDED 4 306 # define CRL_REASON_CESSATION_OF_OPERATION 5 307 # define CRL_REASON_CERTIFICATE_HOLD 6 308 # define CRL_REASON_REMOVE_FROM_CRL 8 309 # define CRL_REASON_PRIVILEGE_WITHDRAWN 9 310 # define CRL_REASON_AA_COMPROMISE 10 311 312 struct DIST_POINT_st { 313 DIST_POINT_NAME *distpoint; 314 ASN1_BIT_STRING *reasons; 315 GENERAL_NAMES *CRLissuer; 316 int dp_reasons; 317 }; 318 319 SKM_DEFINE_STACK_OF_INTERNAL(DIST_POINT, DIST_POINT, DIST_POINT) 320 #define sk_DIST_POINT_num(sk) OPENSSL_sk_num(ossl_check_const_DIST_POINT_sk_type(sk)) 321 #define sk_DIST_POINT_value(sk, idx) ((DIST_POINT *)OPENSSL_sk_value(ossl_check_const_DIST_POINT_sk_type(sk), (idx))) 322 #define sk_DIST_POINT_new(cmp) ((STACK_OF(DIST_POINT) *)OPENSSL_sk_new(ossl_check_DIST_POINT_compfunc_type(cmp))) 323 #define sk_DIST_POINT_new_null() ((STACK_OF(DIST_POINT) *)OPENSSL_sk_new_null()) 324 #define sk_DIST_POINT_new_reserve(cmp, n) ((STACK_OF(DIST_POINT) *)OPENSSL_sk_new_reserve(ossl_check_DIST_POINT_compfunc_type(cmp), (n))) 325 #define sk_DIST_POINT_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_DIST_POINT_sk_type(sk), (n)) 326 #define sk_DIST_POINT_free(sk) OPENSSL_sk_free(ossl_check_DIST_POINT_sk_type(sk)) 327 #define sk_DIST_POINT_zero(sk) OPENSSL_sk_zero(ossl_check_DIST_POINT_sk_type(sk)) 328 #define sk_DIST_POINT_delete(sk, i) ((DIST_POINT *)OPENSSL_sk_delete(ossl_check_DIST_POINT_sk_type(sk), (i))) 329 #define sk_DIST_POINT_delete_ptr(sk, ptr) ((DIST_POINT *)OPENSSL_sk_delete_ptr(ossl_check_DIST_POINT_sk_type(sk), ossl_check_DIST_POINT_type(ptr))) 330 #define sk_DIST_POINT_push(sk, ptr) OPENSSL_sk_push(ossl_check_DIST_POINT_sk_type(sk), ossl_check_DIST_POINT_type(ptr)) 331 #define sk_DIST_POINT_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_DIST_POINT_sk_type(sk), ossl_check_DIST_POINT_type(ptr)) 332 #define sk_DIST_POINT_pop(sk) ((DIST_POINT *)OPENSSL_sk_pop(ossl_check_DIST_POINT_sk_type(sk))) 333 #define sk_DIST_POINT_shift(sk) ((DIST_POINT *)OPENSSL_sk_shift(ossl_check_DIST_POINT_sk_type(sk))) 334 #define sk_DIST_POINT_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_DIST_POINT_sk_type(sk),ossl_check_DIST_POINT_freefunc_type(freefunc)) 335 #define sk_DIST_POINT_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_DIST_POINT_sk_type(sk), ossl_check_DIST_POINT_type(ptr), (idx)) 336 #define sk_DIST_POINT_set(sk, idx, ptr) ((DIST_POINT *)OPENSSL_sk_set(ossl_check_DIST_POINT_sk_type(sk), (idx), ossl_check_DIST_POINT_type(ptr))) 337 #define sk_DIST_POINT_find(sk, ptr) OPENSSL_sk_find(ossl_check_DIST_POINT_sk_type(sk), ossl_check_DIST_POINT_type(ptr)) 338 #define sk_DIST_POINT_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_DIST_POINT_sk_type(sk), ossl_check_DIST_POINT_type(ptr)) 339 #define sk_DIST_POINT_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_DIST_POINT_sk_type(sk), ossl_check_DIST_POINT_type(ptr), pnum) 340 #define sk_DIST_POINT_sort(sk) OPENSSL_sk_sort(ossl_check_DIST_POINT_sk_type(sk)) 341 #define sk_DIST_POINT_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_DIST_POINT_sk_type(sk)) 342 #define sk_DIST_POINT_dup(sk) ((STACK_OF(DIST_POINT) *)OPENSSL_sk_dup(ossl_check_const_DIST_POINT_sk_type(sk))) 343 #define sk_DIST_POINT_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(DIST_POINT) *)OPENSSL_sk_deep_copy(ossl_check_const_DIST_POINT_sk_type(sk), ossl_check_DIST_POINT_copyfunc_type(copyfunc), ossl_check_DIST_POINT_freefunc_type(freefunc))) 344 #define sk_DIST_POINT_set_cmp_func(sk, cmp) ((sk_DIST_POINT_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_DIST_POINT_sk_type(sk), ossl_check_DIST_POINT_compfunc_type(cmp))) 345 346 347 typedef STACK_OF(DIST_POINT) CRL_DIST_POINTS; 348 349 struct AUTHORITY_KEYID_st { 350 ASN1_OCTET_STRING *keyid; 351 GENERAL_NAMES *issuer; 352 ASN1_INTEGER *serial; 353 }; 354 355 /* Strong extranet structures */ 356 357 typedef struct SXNET_ID_st { 358 ASN1_INTEGER *zone; 359 ASN1_OCTET_STRING *user; 360 } SXNETID; 361 362 SKM_DEFINE_STACK_OF_INTERNAL(SXNETID, SXNETID, SXNETID) 363 #define sk_SXNETID_num(sk) OPENSSL_sk_num(ossl_check_const_SXNETID_sk_type(sk)) 364 #define sk_SXNETID_value(sk, idx) ((SXNETID *)OPENSSL_sk_value(ossl_check_const_SXNETID_sk_type(sk), (idx))) 365 #define sk_SXNETID_new(cmp) ((STACK_OF(SXNETID) *)OPENSSL_sk_new(ossl_check_SXNETID_compfunc_type(cmp))) 366 #define sk_SXNETID_new_null() ((STACK_OF(SXNETID) *)OPENSSL_sk_new_null()) 367 #define sk_SXNETID_new_reserve(cmp, n) ((STACK_OF(SXNETID) *)OPENSSL_sk_new_reserve(ossl_check_SXNETID_compfunc_type(cmp), (n))) 368 #define sk_SXNETID_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_SXNETID_sk_type(sk), (n)) 369 #define sk_SXNETID_free(sk) OPENSSL_sk_free(ossl_check_SXNETID_sk_type(sk)) 370 #define sk_SXNETID_zero(sk) OPENSSL_sk_zero(ossl_check_SXNETID_sk_type(sk)) 371 #define sk_SXNETID_delete(sk, i) ((SXNETID *)OPENSSL_sk_delete(ossl_check_SXNETID_sk_type(sk), (i))) 372 #define sk_SXNETID_delete_ptr(sk, ptr) ((SXNETID *)OPENSSL_sk_delete_ptr(ossl_check_SXNETID_sk_type(sk), ossl_check_SXNETID_type(ptr))) 373 #define sk_SXNETID_push(sk, ptr) OPENSSL_sk_push(ossl_check_SXNETID_sk_type(sk), ossl_check_SXNETID_type(ptr)) 374 #define sk_SXNETID_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_SXNETID_sk_type(sk), ossl_check_SXNETID_type(ptr)) 375 #define sk_SXNETID_pop(sk) ((SXNETID *)OPENSSL_sk_pop(ossl_check_SXNETID_sk_type(sk))) 376 #define sk_SXNETID_shift(sk) ((SXNETID *)OPENSSL_sk_shift(ossl_check_SXNETID_sk_type(sk))) 377 #define sk_SXNETID_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_SXNETID_sk_type(sk),ossl_check_SXNETID_freefunc_type(freefunc)) 378 #define sk_SXNETID_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_SXNETID_sk_type(sk), ossl_check_SXNETID_type(ptr), (idx)) 379 #define sk_SXNETID_set(sk, idx, ptr) ((SXNETID *)OPENSSL_sk_set(ossl_check_SXNETID_sk_type(sk), (idx), ossl_check_SXNETID_type(ptr))) 380 #define sk_SXNETID_find(sk, ptr) OPENSSL_sk_find(ossl_check_SXNETID_sk_type(sk), ossl_check_SXNETID_type(ptr)) 381 #define sk_SXNETID_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_SXNETID_sk_type(sk), ossl_check_SXNETID_type(ptr)) 382 #define sk_SXNETID_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_SXNETID_sk_type(sk), ossl_check_SXNETID_type(ptr), pnum) 383 #define sk_SXNETID_sort(sk) OPENSSL_sk_sort(ossl_check_SXNETID_sk_type(sk)) 384 #define sk_SXNETID_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_SXNETID_sk_type(sk)) 385 #define sk_SXNETID_dup(sk) ((STACK_OF(SXNETID) *)OPENSSL_sk_dup(ossl_check_const_SXNETID_sk_type(sk))) 386 #define sk_SXNETID_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(SXNETID) *)OPENSSL_sk_deep_copy(ossl_check_const_SXNETID_sk_type(sk), ossl_check_SXNETID_copyfunc_type(copyfunc), ossl_check_SXNETID_freefunc_type(freefunc))) 387 #define sk_SXNETID_set_cmp_func(sk, cmp) ((sk_SXNETID_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_SXNETID_sk_type(sk), ossl_check_SXNETID_compfunc_type(cmp))) 388 389 390 391 typedef struct SXNET_st { 392 ASN1_INTEGER *version; 393 STACK_OF(SXNETID) *ids; 394 } SXNET; 395 396 typedef struct ISSUER_SIGN_TOOL_st { 397 ASN1_UTF8STRING *signTool; 398 ASN1_UTF8STRING *cATool; 399 ASN1_UTF8STRING *signToolCert; 400 ASN1_UTF8STRING *cAToolCert; 401 } ISSUER_SIGN_TOOL; 402 403 typedef struct NOTICEREF_st { 404 ASN1_STRING *organization; 405 STACK_OF(ASN1_INTEGER) *noticenos; 406 } NOTICEREF; 407 408 typedef struct USERNOTICE_st { 409 NOTICEREF *noticeref; 410 ASN1_STRING *exptext; 411 } USERNOTICE; 412 413 typedef struct POLICYQUALINFO_st { 414 ASN1_OBJECT *pqualid; 415 union { 416 ASN1_IA5STRING *cpsuri; 417 USERNOTICE *usernotice; 418 ASN1_TYPE *other; 419 } d; 420 } POLICYQUALINFO; 421 422 SKM_DEFINE_STACK_OF_INTERNAL(POLICYQUALINFO, POLICYQUALINFO, POLICYQUALINFO) 423 #define sk_POLICYQUALINFO_num(sk) OPENSSL_sk_num(ossl_check_const_POLICYQUALINFO_sk_type(sk)) 424 #define sk_POLICYQUALINFO_value(sk, idx) ((POLICYQUALINFO *)OPENSSL_sk_value(ossl_check_const_POLICYQUALINFO_sk_type(sk), (idx))) 425 #define sk_POLICYQUALINFO_new(cmp) ((STACK_OF(POLICYQUALINFO) *)OPENSSL_sk_new(ossl_check_POLICYQUALINFO_compfunc_type(cmp))) 426 #define sk_POLICYQUALINFO_new_null() ((STACK_OF(POLICYQUALINFO) *)OPENSSL_sk_new_null()) 427 #define sk_POLICYQUALINFO_new_reserve(cmp, n) ((STACK_OF(POLICYQUALINFO) *)OPENSSL_sk_new_reserve(ossl_check_POLICYQUALINFO_compfunc_type(cmp), (n))) 428 #define sk_POLICYQUALINFO_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_POLICYQUALINFO_sk_type(sk), (n)) 429 #define sk_POLICYQUALINFO_free(sk) OPENSSL_sk_free(ossl_check_POLICYQUALINFO_sk_type(sk)) 430 #define sk_POLICYQUALINFO_zero(sk) OPENSSL_sk_zero(ossl_check_POLICYQUALINFO_sk_type(sk)) 431 #define sk_POLICYQUALINFO_delete(sk, i) ((POLICYQUALINFO *)OPENSSL_sk_delete(ossl_check_POLICYQUALINFO_sk_type(sk), (i))) 432 #define sk_POLICYQUALINFO_delete_ptr(sk, ptr) ((POLICYQUALINFO *)OPENSSL_sk_delete_ptr(ossl_check_POLICYQUALINFO_sk_type(sk), ossl_check_POLICYQUALINFO_type(ptr))) 433 #define sk_POLICYQUALINFO_push(sk, ptr) OPENSSL_sk_push(ossl_check_POLICYQUALINFO_sk_type(sk), ossl_check_POLICYQUALINFO_type(ptr)) 434 #define sk_POLICYQUALINFO_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_POLICYQUALINFO_sk_type(sk), ossl_check_POLICYQUALINFO_type(ptr)) 435 #define sk_POLICYQUALINFO_pop(sk) ((POLICYQUALINFO *)OPENSSL_sk_pop(ossl_check_POLICYQUALINFO_sk_type(sk))) 436 #define sk_POLICYQUALINFO_shift(sk) ((POLICYQUALINFO *)OPENSSL_sk_shift(ossl_check_POLICYQUALINFO_sk_type(sk))) 437 #define sk_POLICYQUALINFO_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_POLICYQUALINFO_sk_type(sk),ossl_check_POLICYQUALINFO_freefunc_type(freefunc)) 438 #define sk_POLICYQUALINFO_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_POLICYQUALINFO_sk_type(sk), ossl_check_POLICYQUALINFO_type(ptr), (idx)) 439 #define sk_POLICYQUALINFO_set(sk, idx, ptr) ((POLICYQUALINFO *)OPENSSL_sk_set(ossl_check_POLICYQUALINFO_sk_type(sk), (idx), ossl_check_POLICYQUALINFO_type(ptr))) 440 #define sk_POLICYQUALINFO_find(sk, ptr) OPENSSL_sk_find(ossl_check_POLICYQUALINFO_sk_type(sk), ossl_check_POLICYQUALINFO_type(ptr)) 441 #define sk_POLICYQUALINFO_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_POLICYQUALINFO_sk_type(sk), ossl_check_POLICYQUALINFO_type(ptr)) 442 #define sk_POLICYQUALINFO_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_POLICYQUALINFO_sk_type(sk), ossl_check_POLICYQUALINFO_type(ptr), pnum) 443 #define sk_POLICYQUALINFO_sort(sk) OPENSSL_sk_sort(ossl_check_POLICYQUALINFO_sk_type(sk)) 444 #define sk_POLICYQUALINFO_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_POLICYQUALINFO_sk_type(sk)) 445 #define sk_POLICYQUALINFO_dup(sk) ((STACK_OF(POLICYQUALINFO) *)OPENSSL_sk_dup(ossl_check_const_POLICYQUALINFO_sk_type(sk))) 446 #define sk_POLICYQUALINFO_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(POLICYQUALINFO) *)OPENSSL_sk_deep_copy(ossl_check_const_POLICYQUALINFO_sk_type(sk), ossl_check_POLICYQUALINFO_copyfunc_type(copyfunc), ossl_check_POLICYQUALINFO_freefunc_type(freefunc))) 447 #define sk_POLICYQUALINFO_set_cmp_func(sk, cmp) ((sk_POLICYQUALINFO_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_POLICYQUALINFO_sk_type(sk), ossl_check_POLICYQUALINFO_compfunc_type(cmp))) 448 449 450 451 typedef struct POLICYINFO_st { 452 ASN1_OBJECT *policyid; 453 STACK_OF(POLICYQUALINFO) *qualifiers; 454 } POLICYINFO; 455 456 SKM_DEFINE_STACK_OF_INTERNAL(POLICYINFO, POLICYINFO, POLICYINFO) 457 #define sk_POLICYINFO_num(sk) OPENSSL_sk_num(ossl_check_const_POLICYINFO_sk_type(sk)) 458 #define sk_POLICYINFO_value(sk, idx) ((POLICYINFO *)OPENSSL_sk_value(ossl_check_const_POLICYINFO_sk_type(sk), (idx))) 459 #define sk_POLICYINFO_new(cmp) ((STACK_OF(POLICYINFO) *)OPENSSL_sk_new(ossl_check_POLICYINFO_compfunc_type(cmp))) 460 #define sk_POLICYINFO_new_null() ((STACK_OF(POLICYINFO) *)OPENSSL_sk_new_null()) 461 #define sk_POLICYINFO_new_reserve(cmp, n) ((STACK_OF(POLICYINFO) *)OPENSSL_sk_new_reserve(ossl_check_POLICYINFO_compfunc_type(cmp), (n))) 462 #define sk_POLICYINFO_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_POLICYINFO_sk_type(sk), (n)) 463 #define sk_POLICYINFO_free(sk) OPENSSL_sk_free(ossl_check_POLICYINFO_sk_type(sk)) 464 #define sk_POLICYINFO_zero(sk) OPENSSL_sk_zero(ossl_check_POLICYINFO_sk_type(sk)) 465 #define sk_POLICYINFO_delete(sk, i) ((POLICYINFO *)OPENSSL_sk_delete(ossl_check_POLICYINFO_sk_type(sk), (i))) 466 #define sk_POLICYINFO_delete_ptr(sk, ptr) ((POLICYINFO *)OPENSSL_sk_delete_ptr(ossl_check_POLICYINFO_sk_type(sk), ossl_check_POLICYINFO_type(ptr))) 467 #define sk_POLICYINFO_push(sk, ptr) OPENSSL_sk_push(ossl_check_POLICYINFO_sk_type(sk), ossl_check_POLICYINFO_type(ptr)) 468 #define sk_POLICYINFO_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_POLICYINFO_sk_type(sk), ossl_check_POLICYINFO_type(ptr)) 469 #define sk_POLICYINFO_pop(sk) ((POLICYINFO *)OPENSSL_sk_pop(ossl_check_POLICYINFO_sk_type(sk))) 470 #define sk_POLICYINFO_shift(sk) ((POLICYINFO *)OPENSSL_sk_shift(ossl_check_POLICYINFO_sk_type(sk))) 471 #define sk_POLICYINFO_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_POLICYINFO_sk_type(sk),ossl_check_POLICYINFO_freefunc_type(freefunc)) 472 #define sk_POLICYINFO_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_POLICYINFO_sk_type(sk), ossl_check_POLICYINFO_type(ptr), (idx)) 473 #define sk_POLICYINFO_set(sk, idx, ptr) ((POLICYINFO *)OPENSSL_sk_set(ossl_check_POLICYINFO_sk_type(sk), (idx), ossl_check_POLICYINFO_type(ptr))) 474 #define sk_POLICYINFO_find(sk, ptr) OPENSSL_sk_find(ossl_check_POLICYINFO_sk_type(sk), ossl_check_POLICYINFO_type(ptr)) 475 #define sk_POLICYINFO_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_POLICYINFO_sk_type(sk), ossl_check_POLICYINFO_type(ptr)) 476 #define sk_POLICYINFO_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_POLICYINFO_sk_type(sk), ossl_check_POLICYINFO_type(ptr), pnum) 477 #define sk_POLICYINFO_sort(sk) OPENSSL_sk_sort(ossl_check_POLICYINFO_sk_type(sk)) 478 #define sk_POLICYINFO_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_POLICYINFO_sk_type(sk)) 479 #define sk_POLICYINFO_dup(sk) ((STACK_OF(POLICYINFO) *)OPENSSL_sk_dup(ossl_check_const_POLICYINFO_sk_type(sk))) 480 #define sk_POLICYINFO_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(POLICYINFO) *)OPENSSL_sk_deep_copy(ossl_check_const_POLICYINFO_sk_type(sk), ossl_check_POLICYINFO_copyfunc_type(copyfunc), ossl_check_POLICYINFO_freefunc_type(freefunc))) 481 #define sk_POLICYINFO_set_cmp_func(sk, cmp) ((sk_POLICYINFO_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_POLICYINFO_sk_type(sk), ossl_check_POLICYINFO_compfunc_type(cmp))) 482 483 484 typedef STACK_OF(POLICYINFO) CERTIFICATEPOLICIES; 485 486 typedef struct POLICY_MAPPING_st { 487 ASN1_OBJECT *issuerDomainPolicy; 488 ASN1_OBJECT *subjectDomainPolicy; 489 } POLICY_MAPPING; 490 491 SKM_DEFINE_STACK_OF_INTERNAL(POLICY_MAPPING, POLICY_MAPPING, POLICY_MAPPING) 492 #define sk_POLICY_MAPPING_num(sk) OPENSSL_sk_num(ossl_check_const_POLICY_MAPPING_sk_type(sk)) 493 #define sk_POLICY_MAPPING_value(sk, idx) ((POLICY_MAPPING *)OPENSSL_sk_value(ossl_check_const_POLICY_MAPPING_sk_type(sk), (idx))) 494 #define sk_POLICY_MAPPING_new(cmp) ((STACK_OF(POLICY_MAPPING) *)OPENSSL_sk_new(ossl_check_POLICY_MAPPING_compfunc_type(cmp))) 495 #define sk_POLICY_MAPPING_new_null() ((STACK_OF(POLICY_MAPPING) *)OPENSSL_sk_new_null()) 496 #define sk_POLICY_MAPPING_new_reserve(cmp, n) ((STACK_OF(POLICY_MAPPING) *)OPENSSL_sk_new_reserve(ossl_check_POLICY_MAPPING_compfunc_type(cmp), (n))) 497 #define sk_POLICY_MAPPING_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_POLICY_MAPPING_sk_type(sk), (n)) 498 #define sk_POLICY_MAPPING_free(sk) OPENSSL_sk_free(ossl_check_POLICY_MAPPING_sk_type(sk)) 499 #define sk_POLICY_MAPPING_zero(sk) OPENSSL_sk_zero(ossl_check_POLICY_MAPPING_sk_type(sk)) 500 #define sk_POLICY_MAPPING_delete(sk, i) ((POLICY_MAPPING *)OPENSSL_sk_delete(ossl_check_POLICY_MAPPING_sk_type(sk), (i))) 501 #define sk_POLICY_MAPPING_delete_ptr(sk, ptr) ((POLICY_MAPPING *)OPENSSL_sk_delete_ptr(ossl_check_POLICY_MAPPING_sk_type(sk), ossl_check_POLICY_MAPPING_type(ptr))) 502 #define sk_POLICY_MAPPING_push(sk, ptr) OPENSSL_sk_push(ossl_check_POLICY_MAPPING_sk_type(sk), ossl_check_POLICY_MAPPING_type(ptr)) 503 #define sk_POLICY_MAPPING_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_POLICY_MAPPING_sk_type(sk), ossl_check_POLICY_MAPPING_type(ptr)) 504 #define sk_POLICY_MAPPING_pop(sk) ((POLICY_MAPPING *)OPENSSL_sk_pop(ossl_check_POLICY_MAPPING_sk_type(sk))) 505 #define sk_POLICY_MAPPING_shift(sk) ((POLICY_MAPPING *)OPENSSL_sk_shift(ossl_check_POLICY_MAPPING_sk_type(sk))) 506 #define sk_POLICY_MAPPING_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_POLICY_MAPPING_sk_type(sk),ossl_check_POLICY_MAPPING_freefunc_type(freefunc)) 507 #define sk_POLICY_MAPPING_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_POLICY_MAPPING_sk_type(sk), ossl_check_POLICY_MAPPING_type(ptr), (idx)) 508 #define sk_POLICY_MAPPING_set(sk, idx, ptr) ((POLICY_MAPPING *)OPENSSL_sk_set(ossl_check_POLICY_MAPPING_sk_type(sk), (idx), ossl_check_POLICY_MAPPING_type(ptr))) 509 #define sk_POLICY_MAPPING_find(sk, ptr) OPENSSL_sk_find(ossl_check_POLICY_MAPPING_sk_type(sk), ossl_check_POLICY_MAPPING_type(ptr)) 510 #define sk_POLICY_MAPPING_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_POLICY_MAPPING_sk_type(sk), ossl_check_POLICY_MAPPING_type(ptr)) 511 #define sk_POLICY_MAPPING_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_POLICY_MAPPING_sk_type(sk), ossl_check_POLICY_MAPPING_type(ptr), pnum) 512 #define sk_POLICY_MAPPING_sort(sk) OPENSSL_sk_sort(ossl_check_POLICY_MAPPING_sk_type(sk)) 513 #define sk_POLICY_MAPPING_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_POLICY_MAPPING_sk_type(sk)) 514 #define sk_POLICY_MAPPING_dup(sk) ((STACK_OF(POLICY_MAPPING) *)OPENSSL_sk_dup(ossl_check_const_POLICY_MAPPING_sk_type(sk))) 515 #define sk_POLICY_MAPPING_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(POLICY_MAPPING) *)OPENSSL_sk_deep_copy(ossl_check_const_POLICY_MAPPING_sk_type(sk), ossl_check_POLICY_MAPPING_copyfunc_type(copyfunc), ossl_check_POLICY_MAPPING_freefunc_type(freefunc))) 516 #define sk_POLICY_MAPPING_set_cmp_func(sk, cmp) ((sk_POLICY_MAPPING_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_POLICY_MAPPING_sk_type(sk), ossl_check_POLICY_MAPPING_compfunc_type(cmp))) 517 518 519 typedef STACK_OF(POLICY_MAPPING) POLICY_MAPPINGS; 520 521 typedef struct GENERAL_SUBTREE_st { 522 GENERAL_NAME *base; 523 ASN1_INTEGER *minimum; 524 ASN1_INTEGER *maximum; 525 } GENERAL_SUBTREE; 526 527 SKM_DEFINE_STACK_OF_INTERNAL(GENERAL_SUBTREE, GENERAL_SUBTREE, GENERAL_SUBTREE) 528 #define sk_GENERAL_SUBTREE_num(sk) OPENSSL_sk_num(ossl_check_const_GENERAL_SUBTREE_sk_type(sk)) 529 #define sk_GENERAL_SUBTREE_value(sk, idx) ((GENERAL_SUBTREE *)OPENSSL_sk_value(ossl_check_const_GENERAL_SUBTREE_sk_type(sk), (idx))) 530 #define sk_GENERAL_SUBTREE_new(cmp) ((STACK_OF(GENERAL_SUBTREE) *)OPENSSL_sk_new(ossl_check_GENERAL_SUBTREE_compfunc_type(cmp))) 531 #define sk_GENERAL_SUBTREE_new_null() ((STACK_OF(GENERAL_SUBTREE) *)OPENSSL_sk_new_null()) 532 #define sk_GENERAL_SUBTREE_new_reserve(cmp, n) ((STACK_OF(GENERAL_SUBTREE) *)OPENSSL_sk_new_reserve(ossl_check_GENERAL_SUBTREE_compfunc_type(cmp), (n))) 533 #define sk_GENERAL_SUBTREE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_GENERAL_SUBTREE_sk_type(sk), (n)) 534 #define sk_GENERAL_SUBTREE_free(sk) OPENSSL_sk_free(ossl_check_GENERAL_SUBTREE_sk_type(sk)) 535 #define sk_GENERAL_SUBTREE_zero(sk) OPENSSL_sk_zero(ossl_check_GENERAL_SUBTREE_sk_type(sk)) 536 #define sk_GENERAL_SUBTREE_delete(sk, i) ((GENERAL_SUBTREE *)OPENSSL_sk_delete(ossl_check_GENERAL_SUBTREE_sk_type(sk), (i))) 537 #define sk_GENERAL_SUBTREE_delete_ptr(sk, ptr) ((GENERAL_SUBTREE *)OPENSSL_sk_delete_ptr(ossl_check_GENERAL_SUBTREE_sk_type(sk), ossl_check_GENERAL_SUBTREE_type(ptr))) 538 #define sk_GENERAL_SUBTREE_push(sk, ptr) OPENSSL_sk_push(ossl_check_GENERAL_SUBTREE_sk_type(sk), ossl_check_GENERAL_SUBTREE_type(ptr)) 539 #define sk_GENERAL_SUBTREE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_GENERAL_SUBTREE_sk_type(sk), ossl_check_GENERAL_SUBTREE_type(ptr)) 540 #define sk_GENERAL_SUBTREE_pop(sk) ((GENERAL_SUBTREE *)OPENSSL_sk_pop(ossl_check_GENERAL_SUBTREE_sk_type(sk))) 541 #define sk_GENERAL_SUBTREE_shift(sk) ((GENERAL_SUBTREE *)OPENSSL_sk_shift(ossl_check_GENERAL_SUBTREE_sk_type(sk))) 542 #define sk_GENERAL_SUBTREE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_GENERAL_SUBTREE_sk_type(sk),ossl_check_GENERAL_SUBTREE_freefunc_type(freefunc)) 543 #define sk_GENERAL_SUBTREE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_GENERAL_SUBTREE_sk_type(sk), ossl_check_GENERAL_SUBTREE_type(ptr), (idx)) 544 #define sk_GENERAL_SUBTREE_set(sk, idx, ptr) ((GENERAL_SUBTREE *)OPENSSL_sk_set(ossl_check_GENERAL_SUBTREE_sk_type(sk), (idx), ossl_check_GENERAL_SUBTREE_type(ptr))) 545 #define sk_GENERAL_SUBTREE_find(sk, ptr) OPENSSL_sk_find(ossl_check_GENERAL_SUBTREE_sk_type(sk), ossl_check_GENERAL_SUBTREE_type(ptr)) 546 #define sk_GENERAL_SUBTREE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_GENERAL_SUBTREE_sk_type(sk), ossl_check_GENERAL_SUBTREE_type(ptr)) 547 #define sk_GENERAL_SUBTREE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_GENERAL_SUBTREE_sk_type(sk), ossl_check_GENERAL_SUBTREE_type(ptr), pnum) 548 #define sk_GENERAL_SUBTREE_sort(sk) OPENSSL_sk_sort(ossl_check_GENERAL_SUBTREE_sk_type(sk)) 549 #define sk_GENERAL_SUBTREE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_GENERAL_SUBTREE_sk_type(sk)) 550 #define sk_GENERAL_SUBTREE_dup(sk) ((STACK_OF(GENERAL_SUBTREE) *)OPENSSL_sk_dup(ossl_check_const_GENERAL_SUBTREE_sk_type(sk))) 551 #define sk_GENERAL_SUBTREE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(GENERAL_SUBTREE) *)OPENSSL_sk_deep_copy(ossl_check_const_GENERAL_SUBTREE_sk_type(sk), ossl_check_GENERAL_SUBTREE_copyfunc_type(copyfunc), ossl_check_GENERAL_SUBTREE_freefunc_type(freefunc))) 552 #define sk_GENERAL_SUBTREE_set_cmp_func(sk, cmp) ((sk_GENERAL_SUBTREE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_GENERAL_SUBTREE_sk_type(sk), ossl_check_GENERAL_SUBTREE_compfunc_type(cmp))) 553 554 555 struct NAME_CONSTRAINTS_st { 556 STACK_OF(GENERAL_SUBTREE) *permittedSubtrees; 557 STACK_OF(GENERAL_SUBTREE) *excludedSubtrees; 558 }; 559 560 typedef struct POLICY_CONSTRAINTS_st { 561 ASN1_INTEGER *requireExplicitPolicy; 562 ASN1_INTEGER *inhibitPolicyMapping; 563 } POLICY_CONSTRAINTS; 564 565 /* Proxy certificate structures, see RFC 3820 */ 566 typedef struct PROXY_POLICY_st { 567 ASN1_OBJECT *policyLanguage; 568 ASN1_OCTET_STRING *policy; 569 } PROXY_POLICY; 570 571 typedef struct PROXY_CERT_INFO_EXTENSION_st { 572 ASN1_INTEGER *pcPathLengthConstraint; 573 PROXY_POLICY *proxyPolicy; 574 } PROXY_CERT_INFO_EXTENSION; 575 576 DECLARE_ASN1_FUNCTIONS(PROXY_POLICY) 577 DECLARE_ASN1_FUNCTIONS(PROXY_CERT_INFO_EXTENSION) 578 579 struct ISSUING_DIST_POINT_st { 580 DIST_POINT_NAME *distpoint; 581 int onlyuser; 582 int onlyCA; 583 ASN1_BIT_STRING *onlysomereasons; 584 int indirectCRL; 585 int onlyattr; 586 }; 587 588 /* Values in idp_flags field */ 589 /* IDP present */ 590 # define IDP_PRESENT 0x1 591 /* IDP values inconsistent */ 592 # define IDP_INVALID 0x2 593 /* onlyuser true */ 594 # define IDP_ONLYUSER 0x4 595 /* onlyCA true */ 596 # define IDP_ONLYCA 0x8 597 /* onlyattr true */ 598 # define IDP_ONLYATTR 0x10 599 /* indirectCRL true */ 600 # define IDP_INDIRECT 0x20 601 /* onlysomereasons present */ 602 # define IDP_REASONS 0x40 603 604 # define X509V3_conf_err(val) ERR_add_error_data(6, \ 605 "section:", (val)->section, \ 606 ",name:", (val)->name, ",value:", (val)->value) 607 608 # define X509V3_set_ctx_test(ctx) \ 609 X509V3_set_ctx(ctx, NULL, NULL, NULL, NULL, X509V3_CTX_TEST) 610 # define X509V3_set_ctx_nodb(ctx) (ctx)->db = NULL; 611 612 # define EXT_BITSTRING(nid, table) { nid, 0, ASN1_ITEM_ref(ASN1_BIT_STRING), \ 613 0,0,0,0, \ 614 0,0, \ 615 (X509V3_EXT_I2V)i2v_ASN1_BIT_STRING, \ 616 (X509V3_EXT_V2I)v2i_ASN1_BIT_STRING, \ 617 NULL, NULL, \ 618 table} 619 620 # define EXT_IA5STRING(nid) { nid, 0, ASN1_ITEM_ref(ASN1_IA5STRING), \ 621 0,0,0,0, \ 622 (X509V3_EXT_I2S)i2s_ASN1_IA5STRING, \ 623 (X509V3_EXT_S2I)s2i_ASN1_IA5STRING, \ 624 0,0,0,0, \ 625 NULL} 626 627 #define EXT_UTF8STRING(nid) { nid, 0, ASN1_ITEM_ref(ASN1_UTF8STRING), \ 628 0,0,0,0, \ 629 (X509V3_EXT_I2S)i2s_ASN1_UTF8STRING, \ 630 (X509V3_EXT_S2I)s2i_ASN1_UTF8STRING, \ 631 0,0,0,0, \ 632 NULL} 633 634 # define EXT_END { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} 635 636 /* X509_PURPOSE stuff */ 637 638 # define EXFLAG_BCONS 0x1 639 # define EXFLAG_KUSAGE 0x2 640 # define EXFLAG_XKUSAGE 0x4 641 # define EXFLAG_NSCERT 0x8 642 643 # define EXFLAG_CA 0x10 644 # define EXFLAG_SI 0x20 /* self-issued, maybe not self-signed */ 645 # define EXFLAG_V1 0x40 646 # define EXFLAG_INVALID 0x80 647 /* EXFLAG_SET is set to indicate that some values have been precomputed */ 648 # define EXFLAG_SET 0x100 649 # define EXFLAG_CRITICAL 0x200 650 # define EXFLAG_PROXY 0x400 651 652 # define EXFLAG_INVALID_POLICY 0x800 653 # define EXFLAG_FRESHEST 0x1000 654 # define EXFLAG_SS 0x2000 /* cert is apparently self-signed */ 655 656 # define EXFLAG_BCONS_CRITICAL 0x10000 657 # define EXFLAG_AKID_CRITICAL 0x20000 658 # define EXFLAG_SKID_CRITICAL 0x40000 659 # define EXFLAG_SAN_CRITICAL 0x80000 660 # define EXFLAG_NO_FINGERPRINT 0x100000 661 662 # define KU_DIGITAL_SIGNATURE 0x0080 663 # define KU_NON_REPUDIATION 0x0040 664 # define KU_KEY_ENCIPHERMENT 0x0020 665 # define KU_DATA_ENCIPHERMENT 0x0010 666 # define KU_KEY_AGREEMENT 0x0008 667 # define KU_KEY_CERT_SIGN 0x0004 668 # define KU_CRL_SIGN 0x0002 669 # define KU_ENCIPHER_ONLY 0x0001 670 # define KU_DECIPHER_ONLY 0x8000 671 672 # define NS_SSL_CLIENT 0x80 673 # define NS_SSL_SERVER 0x40 674 # define NS_SMIME 0x20 675 # define NS_OBJSIGN 0x10 676 # define NS_SSL_CA 0x04 677 # define NS_SMIME_CA 0x02 678 # define NS_OBJSIGN_CA 0x01 679 # define NS_ANY_CA (NS_SSL_CA|NS_SMIME_CA|NS_OBJSIGN_CA) 680 681 # define XKU_SSL_SERVER 0x1 682 # define XKU_SSL_CLIENT 0x2 683 # define XKU_SMIME 0x4 684 # define XKU_CODE_SIGN 0x8 685 # define XKU_SGC 0x10 /* Netscape or MS Server-Gated Crypto */ 686 # define XKU_OCSP_SIGN 0x20 687 # define XKU_TIMESTAMP 0x40 688 # define XKU_DVCS 0x80 689 # define XKU_ANYEKU 0x100 690 691 # define X509_PURPOSE_DYNAMIC 0x1 692 # define X509_PURPOSE_DYNAMIC_NAME 0x2 693 694 typedef struct x509_purpose_st { 695 int purpose; 696 int trust; /* Default trust ID */ 697 int flags; 698 int (*check_purpose) (const struct x509_purpose_st *, const X509 *, int); 699 char *name; 700 char *sname; 701 void *usr_data; 702 } X509_PURPOSE; 703 704 SKM_DEFINE_STACK_OF_INTERNAL(X509_PURPOSE, X509_PURPOSE, X509_PURPOSE) 705 #define sk_X509_PURPOSE_num(sk) OPENSSL_sk_num(ossl_check_const_X509_PURPOSE_sk_type(sk)) 706 #define sk_X509_PURPOSE_value(sk, idx) ((X509_PURPOSE *)OPENSSL_sk_value(ossl_check_const_X509_PURPOSE_sk_type(sk), (idx))) 707 #define sk_X509_PURPOSE_new(cmp) ((STACK_OF(X509_PURPOSE) *)OPENSSL_sk_new(ossl_check_X509_PURPOSE_compfunc_type(cmp))) 708 #define sk_X509_PURPOSE_new_null() ((STACK_OF(X509_PURPOSE) *)OPENSSL_sk_new_null()) 709 #define sk_X509_PURPOSE_new_reserve(cmp, n) ((STACK_OF(X509_PURPOSE) *)OPENSSL_sk_new_reserve(ossl_check_X509_PURPOSE_compfunc_type(cmp), (n))) 710 #define sk_X509_PURPOSE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_PURPOSE_sk_type(sk), (n)) 711 #define sk_X509_PURPOSE_free(sk) OPENSSL_sk_free(ossl_check_X509_PURPOSE_sk_type(sk)) 712 #define sk_X509_PURPOSE_zero(sk) OPENSSL_sk_zero(ossl_check_X509_PURPOSE_sk_type(sk)) 713 #define sk_X509_PURPOSE_delete(sk, i) ((X509_PURPOSE *)OPENSSL_sk_delete(ossl_check_X509_PURPOSE_sk_type(sk), (i))) 714 #define sk_X509_PURPOSE_delete_ptr(sk, ptr) ((X509_PURPOSE *)OPENSSL_sk_delete_ptr(ossl_check_X509_PURPOSE_sk_type(sk), ossl_check_X509_PURPOSE_type(ptr))) 715 #define sk_X509_PURPOSE_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_PURPOSE_sk_type(sk), ossl_check_X509_PURPOSE_type(ptr)) 716 #define sk_X509_PURPOSE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_PURPOSE_sk_type(sk), ossl_check_X509_PURPOSE_type(ptr)) 717 #define sk_X509_PURPOSE_pop(sk) ((X509_PURPOSE *)OPENSSL_sk_pop(ossl_check_X509_PURPOSE_sk_type(sk))) 718 #define sk_X509_PURPOSE_shift(sk) ((X509_PURPOSE *)OPENSSL_sk_shift(ossl_check_X509_PURPOSE_sk_type(sk))) 719 #define sk_X509_PURPOSE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_PURPOSE_sk_type(sk),ossl_check_X509_PURPOSE_freefunc_type(freefunc)) 720 #define sk_X509_PURPOSE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_PURPOSE_sk_type(sk), ossl_check_X509_PURPOSE_type(ptr), (idx)) 721 #define sk_X509_PURPOSE_set(sk, idx, ptr) ((X509_PURPOSE *)OPENSSL_sk_set(ossl_check_X509_PURPOSE_sk_type(sk), (idx), ossl_check_X509_PURPOSE_type(ptr))) 722 #define sk_X509_PURPOSE_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_PURPOSE_sk_type(sk), ossl_check_X509_PURPOSE_type(ptr)) 723 #define sk_X509_PURPOSE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_PURPOSE_sk_type(sk), ossl_check_X509_PURPOSE_type(ptr)) 724 #define sk_X509_PURPOSE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_PURPOSE_sk_type(sk), ossl_check_X509_PURPOSE_type(ptr), pnum) 725 #define sk_X509_PURPOSE_sort(sk) OPENSSL_sk_sort(ossl_check_X509_PURPOSE_sk_type(sk)) 726 #define sk_X509_PURPOSE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_PURPOSE_sk_type(sk)) 727 #define sk_X509_PURPOSE_dup(sk) ((STACK_OF(X509_PURPOSE) *)OPENSSL_sk_dup(ossl_check_const_X509_PURPOSE_sk_type(sk))) 728 #define sk_X509_PURPOSE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509_PURPOSE) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_PURPOSE_sk_type(sk), ossl_check_X509_PURPOSE_copyfunc_type(copyfunc), ossl_check_X509_PURPOSE_freefunc_type(freefunc))) 729 #define sk_X509_PURPOSE_set_cmp_func(sk, cmp) ((sk_X509_PURPOSE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_PURPOSE_sk_type(sk), ossl_check_X509_PURPOSE_compfunc_type(cmp))) 730 731 732 733 # define X509_PURPOSE_SSL_CLIENT 1 734 # define X509_PURPOSE_SSL_SERVER 2 735 # define X509_PURPOSE_NS_SSL_SERVER 3 736 # define X509_PURPOSE_SMIME_SIGN 4 737 # define X509_PURPOSE_SMIME_ENCRYPT 5 738 # define X509_PURPOSE_CRL_SIGN 6 739 # define X509_PURPOSE_ANY 7 740 # define X509_PURPOSE_OCSP_HELPER 8 741 # define X509_PURPOSE_TIMESTAMP_SIGN 9 742 743 # define X509_PURPOSE_MIN 1 744 # define X509_PURPOSE_MAX 9 745 746 /* Flags for X509V3_EXT_print() */ 747 748 # define X509V3_EXT_UNKNOWN_MASK (0xfL << 16) 749 /* Return error for unknown extensions */ 750 # define X509V3_EXT_DEFAULT 0 751 /* Print error for unknown extensions */ 752 # define X509V3_EXT_ERROR_UNKNOWN (1L << 16) 753 /* ASN1 parse unknown extensions */ 754 # define X509V3_EXT_PARSE_UNKNOWN (2L << 16) 755 /* BIO_dump unknown extensions */ 756 # define X509V3_EXT_DUMP_UNKNOWN (3L << 16) 757 758 /* Flags for X509V3_add1_i2d */ 759 760 # define X509V3_ADD_OP_MASK 0xfL 761 # define X509V3_ADD_DEFAULT 0L 762 # define X509V3_ADD_APPEND 1L 763 # define X509V3_ADD_REPLACE 2L 764 # define X509V3_ADD_REPLACE_EXISTING 3L 765 # define X509V3_ADD_KEEP_EXISTING 4L 766 # define X509V3_ADD_DELETE 5L 767 # define X509V3_ADD_SILENT 0x10 768 769 DECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS) 770 771 DECLARE_ASN1_FUNCTIONS(SXNET) 772 DECLARE_ASN1_FUNCTIONS(SXNETID) 773 774 DECLARE_ASN1_FUNCTIONS(ISSUER_SIGN_TOOL) 775 776 int SXNET_add_id_asc(SXNET **psx, const char *zone, const char *user, int userlen); 777 int SXNET_add_id_ulong(SXNET **psx, unsigned long lzone, const char *user, 778 int userlen); 779 int SXNET_add_id_INTEGER(SXNET **psx, ASN1_INTEGER *izone, const char *user, 780 int userlen); 781 782 ASN1_OCTET_STRING *SXNET_get_id_asc(SXNET *sx, const char *zone); 783 ASN1_OCTET_STRING *SXNET_get_id_ulong(SXNET *sx, unsigned long lzone); 784 ASN1_OCTET_STRING *SXNET_get_id_INTEGER(SXNET *sx, ASN1_INTEGER *zone); 785 786 DECLARE_ASN1_FUNCTIONS(AUTHORITY_KEYID) 787 788 DECLARE_ASN1_FUNCTIONS(PKEY_USAGE_PERIOD) 789 790 DECLARE_ASN1_FUNCTIONS(GENERAL_NAME) 791 DECLARE_ASN1_DUP_FUNCTION(GENERAL_NAME) 792 int GENERAL_NAME_cmp(GENERAL_NAME *a, GENERAL_NAME *b); 793 794 ASN1_BIT_STRING *v2i_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, 795 X509V3_CTX *ctx, 796 STACK_OF(CONF_VALUE) *nval); 797 STACK_OF(CONF_VALUE) *i2v_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, 798 ASN1_BIT_STRING *bits, 799 STACK_OF(CONF_VALUE) *extlist); 800 char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, ASN1_IA5STRING *ia5); 801 ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method, 802 X509V3_CTX *ctx, const char *str); 803 char *i2s_ASN1_UTF8STRING(X509V3_EXT_METHOD *method, ASN1_UTF8STRING *utf8); 804 ASN1_UTF8STRING *s2i_ASN1_UTF8STRING(X509V3_EXT_METHOD *method, 805 X509V3_CTX *ctx, const char *str); 806 807 STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method, 808 GENERAL_NAME *gen, 809 STACK_OF(CONF_VALUE) *ret); 810 int GENERAL_NAME_print(BIO *out, GENERAL_NAME *gen); 811 812 DECLARE_ASN1_FUNCTIONS(GENERAL_NAMES) 813 814 STACK_OF(CONF_VALUE) *i2v_GENERAL_NAMES(X509V3_EXT_METHOD *method, 815 GENERAL_NAMES *gen, 816 STACK_OF(CONF_VALUE) *extlist); 817 GENERAL_NAMES *v2i_GENERAL_NAMES(const X509V3_EXT_METHOD *method, 818 X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval); 819 820 DECLARE_ASN1_FUNCTIONS(OTHERNAME) 821 DECLARE_ASN1_FUNCTIONS(EDIPARTYNAME) 822 int OTHERNAME_cmp(OTHERNAME *a, OTHERNAME *b); 823 void GENERAL_NAME_set0_value(GENERAL_NAME *a, int type, void *value); 824 void *GENERAL_NAME_get0_value(const GENERAL_NAME *a, int *ptype); 825 int GENERAL_NAME_set0_othername(GENERAL_NAME *gen, 826 ASN1_OBJECT *oid, ASN1_TYPE *value); 827 int GENERAL_NAME_get0_otherName(const GENERAL_NAME *gen, 828 ASN1_OBJECT **poid, ASN1_TYPE **pvalue); 829 830 char *i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, 831 const ASN1_OCTET_STRING *ia5); 832 ASN1_OCTET_STRING *s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, 833 X509V3_CTX *ctx, const char *str); 834 835 DECLARE_ASN1_FUNCTIONS(EXTENDED_KEY_USAGE) 836 int i2a_ACCESS_DESCRIPTION(BIO *bp, const ACCESS_DESCRIPTION *a); 837 838 DECLARE_ASN1_ALLOC_FUNCTIONS(TLS_FEATURE) 839 840 DECLARE_ASN1_FUNCTIONS(CERTIFICATEPOLICIES) 841 DECLARE_ASN1_FUNCTIONS(POLICYINFO) 842 DECLARE_ASN1_FUNCTIONS(POLICYQUALINFO) 843 DECLARE_ASN1_FUNCTIONS(USERNOTICE) 844 DECLARE_ASN1_FUNCTIONS(NOTICEREF) 845 846 DECLARE_ASN1_FUNCTIONS(CRL_DIST_POINTS) 847 DECLARE_ASN1_FUNCTIONS(DIST_POINT) 848 DECLARE_ASN1_FUNCTIONS(DIST_POINT_NAME) 849 DECLARE_ASN1_FUNCTIONS(ISSUING_DIST_POINT) 850 851 int DIST_POINT_set_dpname(DIST_POINT_NAME *dpn, const X509_NAME *iname); 852 853 int NAME_CONSTRAINTS_check(X509 *x, NAME_CONSTRAINTS *nc); 854 int NAME_CONSTRAINTS_check_CN(X509 *x, NAME_CONSTRAINTS *nc); 855 856 DECLARE_ASN1_FUNCTIONS(ACCESS_DESCRIPTION) 857 DECLARE_ASN1_FUNCTIONS(AUTHORITY_INFO_ACCESS) 858 859 DECLARE_ASN1_ITEM(POLICY_MAPPING) 860 DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_MAPPING) 861 DECLARE_ASN1_ITEM(POLICY_MAPPINGS) 862 863 DECLARE_ASN1_ITEM(GENERAL_SUBTREE) 864 DECLARE_ASN1_ALLOC_FUNCTIONS(GENERAL_SUBTREE) 865 866 DECLARE_ASN1_ITEM(NAME_CONSTRAINTS) 867 DECLARE_ASN1_ALLOC_FUNCTIONS(NAME_CONSTRAINTS) 868 869 DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_CONSTRAINTS) 870 DECLARE_ASN1_ITEM(POLICY_CONSTRAINTS) 871 872 GENERAL_NAME *a2i_GENERAL_NAME(GENERAL_NAME *out, 873 const X509V3_EXT_METHOD *method, 874 X509V3_CTX *ctx, int gen_type, 875 const char *value, int is_nc); 876 877 # ifdef OPENSSL_CONF_H 878 GENERAL_NAME *v2i_GENERAL_NAME(const X509V3_EXT_METHOD *method, 879 X509V3_CTX *ctx, CONF_VALUE *cnf); 880 GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out, 881 const X509V3_EXT_METHOD *method, 882 X509V3_CTX *ctx, CONF_VALUE *cnf, 883 int is_nc); 884 885 void X509V3_conf_free(CONF_VALUE *val); 886 887 X509_EXTENSION *X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int ext_nid, 888 const char *value); 889 X509_EXTENSION *X509V3_EXT_nconf(CONF *conf, X509V3_CTX *ctx, const char *name, 890 const char *value); 891 int X509V3_EXT_add_nconf_sk(CONF *conf, X509V3_CTX *ctx, const char *section, 892 STACK_OF(X509_EXTENSION) **sk); 893 int X509V3_EXT_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section, 894 X509 *cert); 895 int X509V3_EXT_REQ_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section, 896 X509_REQ *req); 897 int X509V3_EXT_CRL_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section, 898 X509_CRL *crl); 899 900 X509_EXTENSION *X509V3_EXT_conf_nid(LHASH_OF(CONF_VALUE) *conf, 901 X509V3_CTX *ctx, int ext_nid, 902 const char *value); 903 X509_EXTENSION *X509V3_EXT_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, 904 const char *name, const char *value); 905 int X509V3_EXT_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, 906 const char *section, X509 *cert); 907 int X509V3_EXT_REQ_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, 908 const char *section, X509_REQ *req); 909 int X509V3_EXT_CRL_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, 910 const char *section, X509_CRL *crl); 911 912 int X509V3_add_value_bool_nf(const char *name, int asn1_bool, 913 STACK_OF(CONF_VALUE) **extlist); 914 int X509V3_get_value_bool(const CONF_VALUE *value, int *asn1_bool); 915 int X509V3_get_value_int(const CONF_VALUE *value, ASN1_INTEGER **aint); 916 void X509V3_set_nconf(X509V3_CTX *ctx, CONF *conf); 917 void X509V3_set_conf_lhash(X509V3_CTX *ctx, LHASH_OF(CONF_VALUE) *lhash); 918 # endif 919 920 char *X509V3_get_string(X509V3_CTX *ctx, const char *name, const char *section); 921 STACK_OF(CONF_VALUE) *X509V3_get_section(X509V3_CTX *ctx, const char *section); 922 void X509V3_string_free(X509V3_CTX *ctx, char *str); 923 void X509V3_section_free(X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *section); 924 void X509V3_set_ctx(X509V3_CTX *ctx, X509 *issuer, X509 *subject, 925 X509_REQ *req, X509_CRL *crl, int flags); 926 /* For API backward compatibility, this is separate from X509V3_set_ctx(): */ 927 int X509V3_set_issuer_pkey(X509V3_CTX *ctx, EVP_PKEY *pkey); 928 929 int X509V3_add_value(const char *name, const char *value, 930 STACK_OF(CONF_VALUE) **extlist); 931 int X509V3_add_value_uchar(const char *name, const unsigned char *value, 932 STACK_OF(CONF_VALUE) **extlist); 933 int X509V3_add_value_bool(const char *name, int asn1_bool, 934 STACK_OF(CONF_VALUE) **extlist); 935 int X509V3_add_value_int(const char *name, const ASN1_INTEGER *aint, 936 STACK_OF(CONF_VALUE) **extlist); 937 char *i2s_ASN1_INTEGER(X509V3_EXT_METHOD *meth, const ASN1_INTEGER *aint); 938 ASN1_INTEGER *s2i_ASN1_INTEGER(X509V3_EXT_METHOD *meth, const char *value); 939 char *i2s_ASN1_ENUMERATED(X509V3_EXT_METHOD *meth, const ASN1_ENUMERATED *aint); 940 char *i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD *meth, 941 const ASN1_ENUMERATED *aint); 942 int X509V3_EXT_add(X509V3_EXT_METHOD *ext); 943 int X509V3_EXT_add_list(X509V3_EXT_METHOD *extlist); 944 int X509V3_EXT_add_alias(int nid_to, int nid_from); 945 void X509V3_EXT_cleanup(void); 946 947 const X509V3_EXT_METHOD *X509V3_EXT_get(X509_EXTENSION *ext); 948 const X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid); 949 int X509V3_add_standard_extensions(void); 950 STACK_OF(CONF_VALUE) *X509V3_parse_list(const char *line); 951 void *X509V3_EXT_d2i(X509_EXTENSION *ext); 952 void *X509V3_get_d2i(const STACK_OF(X509_EXTENSION) *x, int nid, int *crit, 953 int *idx); 954 955 X509_EXTENSION *X509V3_EXT_i2d(int ext_nid, int crit, void *ext_struc); 956 int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) **x, int nid, void *value, 957 int crit, unsigned long flags); 958 959 #ifndef OPENSSL_NO_DEPRECATED_1_1_0 960 /* The new declarations are in crypto.h, but the old ones were here. */ 961 # define hex_to_string OPENSSL_buf2hexstr 962 # define string_to_hex OPENSSL_hexstr2buf 963 #endif 964 965 void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent, 966 int ml); 967 int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag, 968 int indent); 969 #ifndef OPENSSL_NO_STDIO 970 int X509V3_EXT_print_fp(FILE *out, X509_EXTENSION *ext, int flag, int indent); 971 #endif 972 int X509V3_extensions_print(BIO *out, const char *title, 973 const STACK_OF(X509_EXTENSION) *exts, 974 unsigned long flag, int indent); 975 976 int X509_check_ca(X509 *x); 977 int X509_check_purpose(X509 *x, int id, int ca); 978 int X509_supported_extension(X509_EXTENSION *ex); 979 int X509_PURPOSE_set(int *p, int purpose); 980 int X509_check_issued(X509 *issuer, X509 *subject); 981 int X509_check_akid(const X509 *issuer, const AUTHORITY_KEYID *akid); 982 void X509_set_proxy_flag(X509 *x); 983 void X509_set_proxy_pathlen(X509 *x, long l); 984 long X509_get_proxy_pathlen(X509 *x); 985 986 uint32_t X509_get_extension_flags(X509 *x); 987 uint32_t X509_get_key_usage(X509 *x); 988 uint32_t X509_get_extended_key_usage(X509 *x); 989 const ASN1_OCTET_STRING *X509_get0_subject_key_id(X509 *x); 990 const ASN1_OCTET_STRING *X509_get0_authority_key_id(X509 *x); 991 const GENERAL_NAMES *X509_get0_authority_issuer(X509 *x); 992 const ASN1_INTEGER *X509_get0_authority_serial(X509 *x); 993 994 int X509_PURPOSE_get_count(void); 995 X509_PURPOSE *X509_PURPOSE_get0(int idx); 996 int X509_PURPOSE_get_by_sname(const char *sname); 997 int X509_PURPOSE_get_by_id(int id); 998 int X509_PURPOSE_add(int id, int trust, int flags, 999 int (*ck) (const X509_PURPOSE *, const X509 *, int), 1000 const char *name, const char *sname, void *arg); 1001 char *X509_PURPOSE_get0_name(const X509_PURPOSE *xp); 1002 char *X509_PURPOSE_get0_sname(const X509_PURPOSE *xp); 1003 int X509_PURPOSE_get_trust(const X509_PURPOSE *xp); 1004 void X509_PURPOSE_cleanup(void); 1005 int X509_PURPOSE_get_id(const X509_PURPOSE *); 1006 1007 STACK_OF(OPENSSL_STRING) *X509_get1_email(X509 *x); 1008 STACK_OF(OPENSSL_STRING) *X509_REQ_get1_email(X509_REQ *x); 1009 void X509_email_free(STACK_OF(OPENSSL_STRING) *sk); 1010 STACK_OF(OPENSSL_STRING) *X509_get1_ocsp(X509 *x); 1011 /* Flags for X509_check_* functions */ 1012 1013 /* 1014 * Always check subject name for host match even if subject alt names present 1015 */ 1016 # define X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT 0x1 1017 /* Disable wildcard matching for dnsName fields and common name. */ 1018 # define X509_CHECK_FLAG_NO_WILDCARDS 0x2 1019 /* Wildcards must not match a partial label. */ 1020 # define X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS 0x4 1021 /* Allow (non-partial) wildcards to match multiple labels. */ 1022 # define X509_CHECK_FLAG_MULTI_LABEL_WILDCARDS 0x8 1023 /* Constraint verifier subdomain patterns to match a single labels. */ 1024 # define X509_CHECK_FLAG_SINGLE_LABEL_SUBDOMAINS 0x10 1025 /* Never check the subject CN */ 1026 # define X509_CHECK_FLAG_NEVER_CHECK_SUBJECT 0x20 1027 /* 1028 * Match reference identifiers starting with "." to any sub-domain. 1029 * This is a non-public flag, turned on implicitly when the subject 1030 * reference identity is a DNS name. 1031 */ 1032 # define _X509_CHECK_FLAG_DOT_SUBDOMAINS 0x8000 1033 1034 int X509_check_host(X509 *x, const char *chk, size_t chklen, 1035 unsigned int flags, char **peername); 1036 int X509_check_email(X509 *x, const char *chk, size_t chklen, 1037 unsigned int flags); 1038 int X509_check_ip(X509 *x, const unsigned char *chk, size_t chklen, 1039 unsigned int flags); 1040 int X509_check_ip_asc(X509 *x, const char *ipasc, unsigned int flags); 1041 1042 ASN1_OCTET_STRING *a2i_IPADDRESS(const char *ipasc); 1043 ASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc); 1044 int X509V3_NAME_from_section(X509_NAME *nm, STACK_OF(CONF_VALUE) *dn_sk, 1045 unsigned long chtype); 1046 1047 void X509_POLICY_NODE_print(BIO *out, X509_POLICY_NODE *node, int indent); 1048 SKM_DEFINE_STACK_OF_INTERNAL(X509_POLICY_NODE, X509_POLICY_NODE, X509_POLICY_NODE) 1049 #define sk_X509_POLICY_NODE_num(sk) OPENSSL_sk_num(ossl_check_const_X509_POLICY_NODE_sk_type(sk)) 1050 #define sk_X509_POLICY_NODE_value(sk, idx) ((X509_POLICY_NODE *)OPENSSL_sk_value(ossl_check_const_X509_POLICY_NODE_sk_type(sk), (idx))) 1051 #define sk_X509_POLICY_NODE_new(cmp) ((STACK_OF(X509_POLICY_NODE) *)OPENSSL_sk_new(ossl_check_X509_POLICY_NODE_compfunc_type(cmp))) 1052 #define sk_X509_POLICY_NODE_new_null() ((STACK_OF(X509_POLICY_NODE) *)OPENSSL_sk_new_null()) 1053 #define sk_X509_POLICY_NODE_new_reserve(cmp, n) ((STACK_OF(X509_POLICY_NODE) *)OPENSSL_sk_new_reserve(ossl_check_X509_POLICY_NODE_compfunc_type(cmp), (n))) 1054 #define sk_X509_POLICY_NODE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_POLICY_NODE_sk_type(sk), (n)) 1055 #define sk_X509_POLICY_NODE_free(sk) OPENSSL_sk_free(ossl_check_X509_POLICY_NODE_sk_type(sk)) 1056 #define sk_X509_POLICY_NODE_zero(sk) OPENSSL_sk_zero(ossl_check_X509_POLICY_NODE_sk_type(sk)) 1057 #define sk_X509_POLICY_NODE_delete(sk, i) ((X509_POLICY_NODE *)OPENSSL_sk_delete(ossl_check_X509_POLICY_NODE_sk_type(sk), (i))) 1058 #define sk_X509_POLICY_NODE_delete_ptr(sk, ptr) ((X509_POLICY_NODE *)OPENSSL_sk_delete_ptr(ossl_check_X509_POLICY_NODE_sk_type(sk), ossl_check_X509_POLICY_NODE_type(ptr))) 1059 #define sk_X509_POLICY_NODE_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_POLICY_NODE_sk_type(sk), ossl_check_X509_POLICY_NODE_type(ptr)) 1060 #define sk_X509_POLICY_NODE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_POLICY_NODE_sk_type(sk), ossl_check_X509_POLICY_NODE_type(ptr)) 1061 #define sk_X509_POLICY_NODE_pop(sk) ((X509_POLICY_NODE *)OPENSSL_sk_pop(ossl_check_X509_POLICY_NODE_sk_type(sk))) 1062 #define sk_X509_POLICY_NODE_shift(sk) ((X509_POLICY_NODE *)OPENSSL_sk_shift(ossl_check_X509_POLICY_NODE_sk_type(sk))) 1063 #define sk_X509_POLICY_NODE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_POLICY_NODE_sk_type(sk),ossl_check_X509_POLICY_NODE_freefunc_type(freefunc)) 1064 #define sk_X509_POLICY_NODE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_POLICY_NODE_sk_type(sk), ossl_check_X509_POLICY_NODE_type(ptr), (idx)) 1065 #define sk_X509_POLICY_NODE_set(sk, idx, ptr) ((X509_POLICY_NODE *)OPENSSL_sk_set(ossl_check_X509_POLICY_NODE_sk_type(sk), (idx), ossl_check_X509_POLICY_NODE_type(ptr))) 1066 #define sk_X509_POLICY_NODE_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_POLICY_NODE_sk_type(sk), ossl_check_X509_POLICY_NODE_type(ptr)) 1067 #define sk_X509_POLICY_NODE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_POLICY_NODE_sk_type(sk), ossl_check_X509_POLICY_NODE_type(ptr)) 1068 #define sk_X509_POLICY_NODE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_POLICY_NODE_sk_type(sk), ossl_check_X509_POLICY_NODE_type(ptr), pnum) 1069 #define sk_X509_POLICY_NODE_sort(sk) OPENSSL_sk_sort(ossl_check_X509_POLICY_NODE_sk_type(sk)) 1070 #define sk_X509_POLICY_NODE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_POLICY_NODE_sk_type(sk)) 1071 #define sk_X509_POLICY_NODE_dup(sk) ((STACK_OF(X509_POLICY_NODE) *)OPENSSL_sk_dup(ossl_check_const_X509_POLICY_NODE_sk_type(sk))) 1072 #define sk_X509_POLICY_NODE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509_POLICY_NODE) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_POLICY_NODE_sk_type(sk), ossl_check_X509_POLICY_NODE_copyfunc_type(copyfunc), ossl_check_X509_POLICY_NODE_freefunc_type(freefunc))) 1073 #define sk_X509_POLICY_NODE_set_cmp_func(sk, cmp) ((sk_X509_POLICY_NODE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_POLICY_NODE_sk_type(sk), ossl_check_X509_POLICY_NODE_compfunc_type(cmp))) 1074 1075 1076 1077 #ifndef OPENSSL_NO_RFC3779 1078 typedef struct ASRange_st { 1079 ASN1_INTEGER *min, *max; 1080 } ASRange; 1081 1082 # define ASIdOrRange_id 0 1083 # define ASIdOrRange_range 1 1084 1085 typedef struct ASIdOrRange_st { 1086 int type; 1087 union { 1088 ASN1_INTEGER *id; 1089 ASRange *range; 1090 } u; 1091 } ASIdOrRange; 1092 1093 SKM_DEFINE_STACK_OF_INTERNAL(ASIdOrRange, ASIdOrRange, ASIdOrRange) 1094 #define sk_ASIdOrRange_num(sk) OPENSSL_sk_num(ossl_check_const_ASIdOrRange_sk_type(sk)) 1095 #define sk_ASIdOrRange_value(sk, idx) ((ASIdOrRange *)OPENSSL_sk_value(ossl_check_const_ASIdOrRange_sk_type(sk), (idx))) 1096 #define sk_ASIdOrRange_new(cmp) ((STACK_OF(ASIdOrRange) *)OPENSSL_sk_new(ossl_check_ASIdOrRange_compfunc_type(cmp))) 1097 #define sk_ASIdOrRange_new_null() ((STACK_OF(ASIdOrRange) *)OPENSSL_sk_new_null()) 1098 #define sk_ASIdOrRange_new_reserve(cmp, n) ((STACK_OF(ASIdOrRange) *)OPENSSL_sk_new_reserve(ossl_check_ASIdOrRange_compfunc_type(cmp), (n))) 1099 #define sk_ASIdOrRange_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_ASIdOrRange_sk_type(sk), (n)) 1100 #define sk_ASIdOrRange_free(sk) OPENSSL_sk_free(ossl_check_ASIdOrRange_sk_type(sk)) 1101 #define sk_ASIdOrRange_zero(sk) OPENSSL_sk_zero(ossl_check_ASIdOrRange_sk_type(sk)) 1102 #define sk_ASIdOrRange_delete(sk, i) ((ASIdOrRange *)OPENSSL_sk_delete(ossl_check_ASIdOrRange_sk_type(sk), (i))) 1103 #define sk_ASIdOrRange_delete_ptr(sk, ptr) ((ASIdOrRange *)OPENSSL_sk_delete_ptr(ossl_check_ASIdOrRange_sk_type(sk), ossl_check_ASIdOrRange_type(ptr))) 1104 #define sk_ASIdOrRange_push(sk, ptr) OPENSSL_sk_push(ossl_check_ASIdOrRange_sk_type(sk), ossl_check_ASIdOrRange_type(ptr)) 1105 #define sk_ASIdOrRange_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_ASIdOrRange_sk_type(sk), ossl_check_ASIdOrRange_type(ptr)) 1106 #define sk_ASIdOrRange_pop(sk) ((ASIdOrRange *)OPENSSL_sk_pop(ossl_check_ASIdOrRange_sk_type(sk))) 1107 #define sk_ASIdOrRange_shift(sk) ((ASIdOrRange *)OPENSSL_sk_shift(ossl_check_ASIdOrRange_sk_type(sk))) 1108 #define sk_ASIdOrRange_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_ASIdOrRange_sk_type(sk),ossl_check_ASIdOrRange_freefunc_type(freefunc)) 1109 #define sk_ASIdOrRange_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_ASIdOrRange_sk_type(sk), ossl_check_ASIdOrRange_type(ptr), (idx)) 1110 #define sk_ASIdOrRange_set(sk, idx, ptr) ((ASIdOrRange *)OPENSSL_sk_set(ossl_check_ASIdOrRange_sk_type(sk), (idx), ossl_check_ASIdOrRange_type(ptr))) 1111 #define sk_ASIdOrRange_find(sk, ptr) OPENSSL_sk_find(ossl_check_ASIdOrRange_sk_type(sk), ossl_check_ASIdOrRange_type(ptr)) 1112 #define sk_ASIdOrRange_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_ASIdOrRange_sk_type(sk), ossl_check_ASIdOrRange_type(ptr)) 1113 #define sk_ASIdOrRange_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_ASIdOrRange_sk_type(sk), ossl_check_ASIdOrRange_type(ptr), pnum) 1114 #define sk_ASIdOrRange_sort(sk) OPENSSL_sk_sort(ossl_check_ASIdOrRange_sk_type(sk)) 1115 #define sk_ASIdOrRange_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_ASIdOrRange_sk_type(sk)) 1116 #define sk_ASIdOrRange_dup(sk) ((STACK_OF(ASIdOrRange) *)OPENSSL_sk_dup(ossl_check_const_ASIdOrRange_sk_type(sk))) 1117 #define sk_ASIdOrRange_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(ASIdOrRange) *)OPENSSL_sk_deep_copy(ossl_check_const_ASIdOrRange_sk_type(sk), ossl_check_ASIdOrRange_copyfunc_type(copyfunc), ossl_check_ASIdOrRange_freefunc_type(freefunc))) 1118 #define sk_ASIdOrRange_set_cmp_func(sk, cmp) ((sk_ASIdOrRange_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_ASIdOrRange_sk_type(sk), ossl_check_ASIdOrRange_compfunc_type(cmp))) 1119 1120 1121 typedef STACK_OF(ASIdOrRange) ASIdOrRanges; 1122 1123 # define ASIdentifierChoice_inherit 0 1124 # define ASIdentifierChoice_asIdsOrRanges 1 1125 1126 typedef struct ASIdentifierChoice_st { 1127 int type; 1128 union { 1129 ASN1_NULL *inherit; 1130 ASIdOrRanges *asIdsOrRanges; 1131 } u; 1132 } ASIdentifierChoice; 1133 1134 typedef struct ASIdentifiers_st { 1135 ASIdentifierChoice *asnum, *rdi; 1136 } ASIdentifiers; 1137 1138 DECLARE_ASN1_FUNCTIONS(ASRange) 1139 DECLARE_ASN1_FUNCTIONS(ASIdOrRange) 1140 DECLARE_ASN1_FUNCTIONS(ASIdentifierChoice) 1141 DECLARE_ASN1_FUNCTIONS(ASIdentifiers) 1142 1143 typedef struct IPAddressRange_st { 1144 ASN1_BIT_STRING *min, *max; 1145 } IPAddressRange; 1146 1147 # define IPAddressOrRange_addressPrefix 0 1148 # define IPAddressOrRange_addressRange 1 1149 1150 typedef struct IPAddressOrRange_st { 1151 int type; 1152 union { 1153 ASN1_BIT_STRING *addressPrefix; 1154 IPAddressRange *addressRange; 1155 } u; 1156 } IPAddressOrRange; 1157 1158 SKM_DEFINE_STACK_OF_INTERNAL(IPAddressOrRange, IPAddressOrRange, IPAddressOrRange) 1159 #define sk_IPAddressOrRange_num(sk) OPENSSL_sk_num(ossl_check_const_IPAddressOrRange_sk_type(sk)) 1160 #define sk_IPAddressOrRange_value(sk, idx) ((IPAddressOrRange *)OPENSSL_sk_value(ossl_check_const_IPAddressOrRange_sk_type(sk), (idx))) 1161 #define sk_IPAddressOrRange_new(cmp) ((STACK_OF(IPAddressOrRange) *)OPENSSL_sk_new(ossl_check_IPAddressOrRange_compfunc_type(cmp))) 1162 #define sk_IPAddressOrRange_new_null() ((STACK_OF(IPAddressOrRange) *)OPENSSL_sk_new_null()) 1163 #define sk_IPAddressOrRange_new_reserve(cmp, n) ((STACK_OF(IPAddressOrRange) *)OPENSSL_sk_new_reserve(ossl_check_IPAddressOrRange_compfunc_type(cmp), (n))) 1164 #define sk_IPAddressOrRange_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_IPAddressOrRange_sk_type(sk), (n)) 1165 #define sk_IPAddressOrRange_free(sk) OPENSSL_sk_free(ossl_check_IPAddressOrRange_sk_type(sk)) 1166 #define sk_IPAddressOrRange_zero(sk) OPENSSL_sk_zero(ossl_check_IPAddressOrRange_sk_type(sk)) 1167 #define sk_IPAddressOrRange_delete(sk, i) ((IPAddressOrRange *)OPENSSL_sk_delete(ossl_check_IPAddressOrRange_sk_type(sk), (i))) 1168 #define sk_IPAddressOrRange_delete_ptr(sk, ptr) ((IPAddressOrRange *)OPENSSL_sk_delete_ptr(ossl_check_IPAddressOrRange_sk_type(sk), ossl_check_IPAddressOrRange_type(ptr))) 1169 #define sk_IPAddressOrRange_push(sk, ptr) OPENSSL_sk_push(ossl_check_IPAddressOrRange_sk_type(sk), ossl_check_IPAddressOrRange_type(ptr)) 1170 #define sk_IPAddressOrRange_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_IPAddressOrRange_sk_type(sk), ossl_check_IPAddressOrRange_type(ptr)) 1171 #define sk_IPAddressOrRange_pop(sk) ((IPAddressOrRange *)OPENSSL_sk_pop(ossl_check_IPAddressOrRange_sk_type(sk))) 1172 #define sk_IPAddressOrRange_shift(sk) ((IPAddressOrRange *)OPENSSL_sk_shift(ossl_check_IPAddressOrRange_sk_type(sk))) 1173 #define sk_IPAddressOrRange_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_IPAddressOrRange_sk_type(sk),ossl_check_IPAddressOrRange_freefunc_type(freefunc)) 1174 #define sk_IPAddressOrRange_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_IPAddressOrRange_sk_type(sk), ossl_check_IPAddressOrRange_type(ptr), (idx)) 1175 #define sk_IPAddressOrRange_set(sk, idx, ptr) ((IPAddressOrRange *)OPENSSL_sk_set(ossl_check_IPAddressOrRange_sk_type(sk), (idx), ossl_check_IPAddressOrRange_type(ptr))) 1176 #define sk_IPAddressOrRange_find(sk, ptr) OPENSSL_sk_find(ossl_check_IPAddressOrRange_sk_type(sk), ossl_check_IPAddressOrRange_type(ptr)) 1177 #define sk_IPAddressOrRange_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_IPAddressOrRange_sk_type(sk), ossl_check_IPAddressOrRange_type(ptr)) 1178 #define sk_IPAddressOrRange_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_IPAddressOrRange_sk_type(sk), ossl_check_IPAddressOrRange_type(ptr), pnum) 1179 #define sk_IPAddressOrRange_sort(sk) OPENSSL_sk_sort(ossl_check_IPAddressOrRange_sk_type(sk)) 1180 #define sk_IPAddressOrRange_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_IPAddressOrRange_sk_type(sk)) 1181 #define sk_IPAddressOrRange_dup(sk) ((STACK_OF(IPAddressOrRange) *)OPENSSL_sk_dup(ossl_check_const_IPAddressOrRange_sk_type(sk))) 1182 #define sk_IPAddressOrRange_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(IPAddressOrRange) *)OPENSSL_sk_deep_copy(ossl_check_const_IPAddressOrRange_sk_type(sk), ossl_check_IPAddressOrRange_copyfunc_type(copyfunc), ossl_check_IPAddressOrRange_freefunc_type(freefunc))) 1183 #define sk_IPAddressOrRange_set_cmp_func(sk, cmp) ((sk_IPAddressOrRange_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_IPAddressOrRange_sk_type(sk), ossl_check_IPAddressOrRange_compfunc_type(cmp))) 1184 1185 1186 typedef STACK_OF(IPAddressOrRange) IPAddressOrRanges; 1187 1188 # define IPAddressChoice_inherit 0 1189 # define IPAddressChoice_addressesOrRanges 1 1190 1191 typedef struct IPAddressChoice_st { 1192 int type; 1193 union { 1194 ASN1_NULL *inherit; 1195 IPAddressOrRanges *addressesOrRanges; 1196 } u; 1197 } IPAddressChoice; 1198 1199 typedef struct IPAddressFamily_st { 1200 ASN1_OCTET_STRING *addressFamily; 1201 IPAddressChoice *ipAddressChoice; 1202 } IPAddressFamily; 1203 1204 SKM_DEFINE_STACK_OF_INTERNAL(IPAddressFamily, IPAddressFamily, IPAddressFamily) 1205 #define sk_IPAddressFamily_num(sk) OPENSSL_sk_num(ossl_check_const_IPAddressFamily_sk_type(sk)) 1206 #define sk_IPAddressFamily_value(sk, idx) ((IPAddressFamily *)OPENSSL_sk_value(ossl_check_const_IPAddressFamily_sk_type(sk), (idx))) 1207 #define sk_IPAddressFamily_new(cmp) ((STACK_OF(IPAddressFamily) *)OPENSSL_sk_new(ossl_check_IPAddressFamily_compfunc_type(cmp))) 1208 #define sk_IPAddressFamily_new_null() ((STACK_OF(IPAddressFamily) *)OPENSSL_sk_new_null()) 1209 #define sk_IPAddressFamily_new_reserve(cmp, n) ((STACK_OF(IPAddressFamily) *)OPENSSL_sk_new_reserve(ossl_check_IPAddressFamily_compfunc_type(cmp), (n))) 1210 #define sk_IPAddressFamily_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_IPAddressFamily_sk_type(sk), (n)) 1211 #define sk_IPAddressFamily_free(sk) OPENSSL_sk_free(ossl_check_IPAddressFamily_sk_type(sk)) 1212 #define sk_IPAddressFamily_zero(sk) OPENSSL_sk_zero(ossl_check_IPAddressFamily_sk_type(sk)) 1213 #define sk_IPAddressFamily_delete(sk, i) ((IPAddressFamily *)OPENSSL_sk_delete(ossl_check_IPAddressFamily_sk_type(sk), (i))) 1214 #define sk_IPAddressFamily_delete_ptr(sk, ptr) ((IPAddressFamily *)OPENSSL_sk_delete_ptr(ossl_check_IPAddressFamily_sk_type(sk), ossl_check_IPAddressFamily_type(ptr))) 1215 #define sk_IPAddressFamily_push(sk, ptr) OPENSSL_sk_push(ossl_check_IPAddressFamily_sk_type(sk), ossl_check_IPAddressFamily_type(ptr)) 1216 #define sk_IPAddressFamily_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_IPAddressFamily_sk_type(sk), ossl_check_IPAddressFamily_type(ptr)) 1217 #define sk_IPAddressFamily_pop(sk) ((IPAddressFamily *)OPENSSL_sk_pop(ossl_check_IPAddressFamily_sk_type(sk))) 1218 #define sk_IPAddressFamily_shift(sk) ((IPAddressFamily *)OPENSSL_sk_shift(ossl_check_IPAddressFamily_sk_type(sk))) 1219 #define sk_IPAddressFamily_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_IPAddressFamily_sk_type(sk),ossl_check_IPAddressFamily_freefunc_type(freefunc)) 1220 #define sk_IPAddressFamily_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_IPAddressFamily_sk_type(sk), ossl_check_IPAddressFamily_type(ptr), (idx)) 1221 #define sk_IPAddressFamily_set(sk, idx, ptr) ((IPAddressFamily *)OPENSSL_sk_set(ossl_check_IPAddressFamily_sk_type(sk), (idx), ossl_check_IPAddressFamily_type(ptr))) 1222 #define sk_IPAddressFamily_find(sk, ptr) OPENSSL_sk_find(ossl_check_IPAddressFamily_sk_type(sk), ossl_check_IPAddressFamily_type(ptr)) 1223 #define sk_IPAddressFamily_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_IPAddressFamily_sk_type(sk), ossl_check_IPAddressFamily_type(ptr)) 1224 #define sk_IPAddressFamily_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_IPAddressFamily_sk_type(sk), ossl_check_IPAddressFamily_type(ptr), pnum) 1225 #define sk_IPAddressFamily_sort(sk) OPENSSL_sk_sort(ossl_check_IPAddressFamily_sk_type(sk)) 1226 #define sk_IPAddressFamily_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_IPAddressFamily_sk_type(sk)) 1227 #define sk_IPAddressFamily_dup(sk) ((STACK_OF(IPAddressFamily) *)OPENSSL_sk_dup(ossl_check_const_IPAddressFamily_sk_type(sk))) 1228 #define sk_IPAddressFamily_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(IPAddressFamily) *)OPENSSL_sk_deep_copy(ossl_check_const_IPAddressFamily_sk_type(sk), ossl_check_IPAddressFamily_copyfunc_type(copyfunc), ossl_check_IPAddressFamily_freefunc_type(freefunc))) 1229 #define sk_IPAddressFamily_set_cmp_func(sk, cmp) ((sk_IPAddressFamily_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_IPAddressFamily_sk_type(sk), ossl_check_IPAddressFamily_compfunc_type(cmp))) 1230 1231 1232 1233 typedef STACK_OF(IPAddressFamily) IPAddrBlocks; 1234 1235 DECLARE_ASN1_FUNCTIONS(IPAddressRange) 1236 DECLARE_ASN1_FUNCTIONS(IPAddressOrRange) 1237 DECLARE_ASN1_FUNCTIONS(IPAddressChoice) 1238 DECLARE_ASN1_FUNCTIONS(IPAddressFamily) 1239 1240 /* 1241 * API tag for elements of the ASIdentifer SEQUENCE. 1242 */ 1243 # define V3_ASID_ASNUM 0 1244 # define V3_ASID_RDI 1 1245 1246 /* 1247 * AFI values, assigned by IANA. It'd be nice to make the AFI 1248 * handling code totally generic, but there are too many little things 1249 * that would need to be defined for other address families for it to 1250 * be worth the trouble. 1251 */ 1252 # define IANA_AFI_IPV4 1 1253 # define IANA_AFI_IPV6 2 1254 1255 /* 1256 * Utilities to construct and extract values from RFC3779 extensions, 1257 * since some of the encodings (particularly for IP address prefixes 1258 * and ranges) are a bit tedious to work with directly. 1259 */ 1260 int X509v3_asid_add_inherit(ASIdentifiers *asid, int which); 1261 int X509v3_asid_add_id_or_range(ASIdentifiers *asid, int which, 1262 ASN1_INTEGER *min, ASN1_INTEGER *max); 1263 int X509v3_addr_add_inherit(IPAddrBlocks *addr, 1264 const unsigned afi, const unsigned *safi); 1265 int X509v3_addr_add_prefix(IPAddrBlocks *addr, 1266 const unsigned afi, const unsigned *safi, 1267 unsigned char *a, const int prefixlen); 1268 int X509v3_addr_add_range(IPAddrBlocks *addr, 1269 const unsigned afi, const unsigned *safi, 1270 unsigned char *min, unsigned char *max); 1271 unsigned X509v3_addr_get_afi(const IPAddressFamily *f); 1272 int X509v3_addr_get_range(IPAddressOrRange *aor, const unsigned afi, 1273 unsigned char *min, unsigned char *max, 1274 const int length); 1275 1276 /* 1277 * Canonical forms. 1278 */ 1279 int X509v3_asid_is_canonical(ASIdentifiers *asid); 1280 int X509v3_addr_is_canonical(IPAddrBlocks *addr); 1281 int X509v3_asid_canonize(ASIdentifiers *asid); 1282 int X509v3_addr_canonize(IPAddrBlocks *addr); 1283 1284 /* 1285 * Tests for inheritance and containment. 1286 */ 1287 int X509v3_asid_inherits(ASIdentifiers *asid); 1288 int X509v3_addr_inherits(IPAddrBlocks *addr); 1289 int X509v3_asid_subset(ASIdentifiers *a, ASIdentifiers *b); 1290 int X509v3_addr_subset(IPAddrBlocks *a, IPAddrBlocks *b); 1291 1292 /* 1293 * Check whether RFC 3779 extensions nest properly in chains. 1294 */ 1295 int X509v3_asid_validate_path(X509_STORE_CTX *); 1296 int X509v3_addr_validate_path(X509_STORE_CTX *); 1297 int X509v3_asid_validate_resource_set(STACK_OF(X509) *chain, 1298 ASIdentifiers *ext, 1299 int allow_inheritance); 1300 int X509v3_addr_validate_resource_set(STACK_OF(X509) *chain, 1301 IPAddrBlocks *ext, int allow_inheritance); 1302 1303 #endif /* OPENSSL_NO_RFC3779 */ 1304 1305 SKM_DEFINE_STACK_OF_INTERNAL(ASN1_STRING, ASN1_STRING, ASN1_STRING) 1306 #define sk_ASN1_STRING_num(sk) OPENSSL_sk_num(ossl_check_const_ASN1_STRING_sk_type(sk)) 1307 #define sk_ASN1_STRING_value(sk, idx) ((ASN1_STRING *)OPENSSL_sk_value(ossl_check_const_ASN1_STRING_sk_type(sk), (idx))) 1308 #define sk_ASN1_STRING_new(cmp) ((STACK_OF(ASN1_STRING) *)OPENSSL_sk_new(ossl_check_ASN1_STRING_compfunc_type(cmp))) 1309 #define sk_ASN1_STRING_new_null() ((STACK_OF(ASN1_STRING) *)OPENSSL_sk_new_null()) 1310 #define sk_ASN1_STRING_new_reserve(cmp, n) ((STACK_OF(ASN1_STRING) *)OPENSSL_sk_new_reserve(ossl_check_ASN1_STRING_compfunc_type(cmp), (n))) 1311 #define sk_ASN1_STRING_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_ASN1_STRING_sk_type(sk), (n)) 1312 #define sk_ASN1_STRING_free(sk) OPENSSL_sk_free(ossl_check_ASN1_STRING_sk_type(sk)) 1313 #define sk_ASN1_STRING_zero(sk) OPENSSL_sk_zero(ossl_check_ASN1_STRING_sk_type(sk)) 1314 #define sk_ASN1_STRING_delete(sk, i) ((ASN1_STRING *)OPENSSL_sk_delete(ossl_check_ASN1_STRING_sk_type(sk), (i))) 1315 #define sk_ASN1_STRING_delete_ptr(sk, ptr) ((ASN1_STRING *)OPENSSL_sk_delete_ptr(ossl_check_ASN1_STRING_sk_type(sk), ossl_check_ASN1_STRING_type(ptr))) 1316 #define sk_ASN1_STRING_push(sk, ptr) OPENSSL_sk_push(ossl_check_ASN1_STRING_sk_type(sk), ossl_check_ASN1_STRING_type(ptr)) 1317 #define sk_ASN1_STRING_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_ASN1_STRING_sk_type(sk), ossl_check_ASN1_STRING_type(ptr)) 1318 #define sk_ASN1_STRING_pop(sk) ((ASN1_STRING *)OPENSSL_sk_pop(ossl_check_ASN1_STRING_sk_type(sk))) 1319 #define sk_ASN1_STRING_shift(sk) ((ASN1_STRING *)OPENSSL_sk_shift(ossl_check_ASN1_STRING_sk_type(sk))) 1320 #define sk_ASN1_STRING_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_ASN1_STRING_sk_type(sk),ossl_check_ASN1_STRING_freefunc_type(freefunc)) 1321 #define sk_ASN1_STRING_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_ASN1_STRING_sk_type(sk), ossl_check_ASN1_STRING_type(ptr), (idx)) 1322 #define sk_ASN1_STRING_set(sk, idx, ptr) ((ASN1_STRING *)OPENSSL_sk_set(ossl_check_ASN1_STRING_sk_type(sk), (idx), ossl_check_ASN1_STRING_type(ptr))) 1323 #define sk_ASN1_STRING_find(sk, ptr) OPENSSL_sk_find(ossl_check_ASN1_STRING_sk_type(sk), ossl_check_ASN1_STRING_type(ptr)) 1324 #define sk_ASN1_STRING_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_ASN1_STRING_sk_type(sk), ossl_check_ASN1_STRING_type(ptr)) 1325 #define sk_ASN1_STRING_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_ASN1_STRING_sk_type(sk), ossl_check_ASN1_STRING_type(ptr), pnum) 1326 #define sk_ASN1_STRING_sort(sk) OPENSSL_sk_sort(ossl_check_ASN1_STRING_sk_type(sk)) 1327 #define sk_ASN1_STRING_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_ASN1_STRING_sk_type(sk)) 1328 #define sk_ASN1_STRING_dup(sk) ((STACK_OF(ASN1_STRING) *)OPENSSL_sk_dup(ossl_check_const_ASN1_STRING_sk_type(sk))) 1329 #define sk_ASN1_STRING_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(ASN1_STRING) *)OPENSSL_sk_deep_copy(ossl_check_const_ASN1_STRING_sk_type(sk), ossl_check_ASN1_STRING_copyfunc_type(copyfunc), ossl_check_ASN1_STRING_freefunc_type(freefunc))) 1330 #define sk_ASN1_STRING_set_cmp_func(sk, cmp) ((sk_ASN1_STRING_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_ASN1_STRING_sk_type(sk), ossl_check_ASN1_STRING_compfunc_type(cmp))) 1331 1332 1333 /* 1334 * Admission Syntax 1335 */ 1336 typedef struct NamingAuthority_st NAMING_AUTHORITY; 1337 typedef struct ProfessionInfo_st PROFESSION_INFO; 1338 typedef struct Admissions_st ADMISSIONS; 1339 typedef struct AdmissionSyntax_st ADMISSION_SYNTAX; 1340 DECLARE_ASN1_FUNCTIONS(NAMING_AUTHORITY) 1341 DECLARE_ASN1_FUNCTIONS(PROFESSION_INFO) 1342 DECLARE_ASN1_FUNCTIONS(ADMISSIONS) 1343 DECLARE_ASN1_FUNCTIONS(ADMISSION_SYNTAX) 1344 SKM_DEFINE_STACK_OF_INTERNAL(PROFESSION_INFO, PROFESSION_INFO, PROFESSION_INFO) 1345 #define sk_PROFESSION_INFO_num(sk) OPENSSL_sk_num(ossl_check_const_PROFESSION_INFO_sk_type(sk)) 1346 #define sk_PROFESSION_INFO_value(sk, idx) ((PROFESSION_INFO *)OPENSSL_sk_value(ossl_check_const_PROFESSION_INFO_sk_type(sk), (idx))) 1347 #define sk_PROFESSION_INFO_new(cmp) ((STACK_OF(PROFESSION_INFO) *)OPENSSL_sk_new(ossl_check_PROFESSION_INFO_compfunc_type(cmp))) 1348 #define sk_PROFESSION_INFO_new_null() ((STACK_OF(PROFESSION_INFO) *)OPENSSL_sk_new_null()) 1349 #define sk_PROFESSION_INFO_new_reserve(cmp, n) ((STACK_OF(PROFESSION_INFO) *)OPENSSL_sk_new_reserve(ossl_check_PROFESSION_INFO_compfunc_type(cmp), (n))) 1350 #define sk_PROFESSION_INFO_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_PROFESSION_INFO_sk_type(sk), (n)) 1351 #define sk_PROFESSION_INFO_free(sk) OPENSSL_sk_free(ossl_check_PROFESSION_INFO_sk_type(sk)) 1352 #define sk_PROFESSION_INFO_zero(sk) OPENSSL_sk_zero(ossl_check_PROFESSION_INFO_sk_type(sk)) 1353 #define sk_PROFESSION_INFO_delete(sk, i) ((PROFESSION_INFO *)OPENSSL_sk_delete(ossl_check_PROFESSION_INFO_sk_type(sk), (i))) 1354 #define sk_PROFESSION_INFO_delete_ptr(sk, ptr) ((PROFESSION_INFO *)OPENSSL_sk_delete_ptr(ossl_check_PROFESSION_INFO_sk_type(sk), ossl_check_PROFESSION_INFO_type(ptr))) 1355 #define sk_PROFESSION_INFO_push(sk, ptr) OPENSSL_sk_push(ossl_check_PROFESSION_INFO_sk_type(sk), ossl_check_PROFESSION_INFO_type(ptr)) 1356 #define sk_PROFESSION_INFO_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_PROFESSION_INFO_sk_type(sk), ossl_check_PROFESSION_INFO_type(ptr)) 1357 #define sk_PROFESSION_INFO_pop(sk) ((PROFESSION_INFO *)OPENSSL_sk_pop(ossl_check_PROFESSION_INFO_sk_type(sk))) 1358 #define sk_PROFESSION_INFO_shift(sk) ((PROFESSION_INFO *)OPENSSL_sk_shift(ossl_check_PROFESSION_INFO_sk_type(sk))) 1359 #define sk_PROFESSION_INFO_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_PROFESSION_INFO_sk_type(sk),ossl_check_PROFESSION_INFO_freefunc_type(freefunc)) 1360 #define sk_PROFESSION_INFO_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_PROFESSION_INFO_sk_type(sk), ossl_check_PROFESSION_INFO_type(ptr), (idx)) 1361 #define sk_PROFESSION_INFO_set(sk, idx, ptr) ((PROFESSION_INFO *)OPENSSL_sk_set(ossl_check_PROFESSION_INFO_sk_type(sk), (idx), ossl_check_PROFESSION_INFO_type(ptr))) 1362 #define sk_PROFESSION_INFO_find(sk, ptr) OPENSSL_sk_find(ossl_check_PROFESSION_INFO_sk_type(sk), ossl_check_PROFESSION_INFO_type(ptr)) 1363 #define sk_PROFESSION_INFO_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_PROFESSION_INFO_sk_type(sk), ossl_check_PROFESSION_INFO_type(ptr)) 1364 #define sk_PROFESSION_INFO_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_PROFESSION_INFO_sk_type(sk), ossl_check_PROFESSION_INFO_type(ptr), pnum) 1365 #define sk_PROFESSION_INFO_sort(sk) OPENSSL_sk_sort(ossl_check_PROFESSION_INFO_sk_type(sk)) 1366 #define sk_PROFESSION_INFO_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_PROFESSION_INFO_sk_type(sk)) 1367 #define sk_PROFESSION_INFO_dup(sk) ((STACK_OF(PROFESSION_INFO) *)OPENSSL_sk_dup(ossl_check_const_PROFESSION_INFO_sk_type(sk))) 1368 #define sk_PROFESSION_INFO_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(PROFESSION_INFO) *)OPENSSL_sk_deep_copy(ossl_check_const_PROFESSION_INFO_sk_type(sk), ossl_check_PROFESSION_INFO_copyfunc_type(copyfunc), ossl_check_PROFESSION_INFO_freefunc_type(freefunc))) 1369 #define sk_PROFESSION_INFO_set_cmp_func(sk, cmp) ((sk_PROFESSION_INFO_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_PROFESSION_INFO_sk_type(sk), ossl_check_PROFESSION_INFO_compfunc_type(cmp))) 1370 SKM_DEFINE_STACK_OF_INTERNAL(ADMISSIONS, ADMISSIONS, ADMISSIONS) 1371 #define sk_ADMISSIONS_num(sk) OPENSSL_sk_num(ossl_check_const_ADMISSIONS_sk_type(sk)) 1372 #define sk_ADMISSIONS_value(sk, idx) ((ADMISSIONS *)OPENSSL_sk_value(ossl_check_const_ADMISSIONS_sk_type(sk), (idx))) 1373 #define sk_ADMISSIONS_new(cmp) ((STACK_OF(ADMISSIONS) *)OPENSSL_sk_new(ossl_check_ADMISSIONS_compfunc_type(cmp))) 1374 #define sk_ADMISSIONS_new_null() ((STACK_OF(ADMISSIONS) *)OPENSSL_sk_new_null()) 1375 #define sk_ADMISSIONS_new_reserve(cmp, n) ((STACK_OF(ADMISSIONS) *)OPENSSL_sk_new_reserve(ossl_check_ADMISSIONS_compfunc_type(cmp), (n))) 1376 #define sk_ADMISSIONS_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_ADMISSIONS_sk_type(sk), (n)) 1377 #define sk_ADMISSIONS_free(sk) OPENSSL_sk_free(ossl_check_ADMISSIONS_sk_type(sk)) 1378 #define sk_ADMISSIONS_zero(sk) OPENSSL_sk_zero(ossl_check_ADMISSIONS_sk_type(sk)) 1379 #define sk_ADMISSIONS_delete(sk, i) ((ADMISSIONS *)OPENSSL_sk_delete(ossl_check_ADMISSIONS_sk_type(sk), (i))) 1380 #define sk_ADMISSIONS_delete_ptr(sk, ptr) ((ADMISSIONS *)OPENSSL_sk_delete_ptr(ossl_check_ADMISSIONS_sk_type(sk), ossl_check_ADMISSIONS_type(ptr))) 1381 #define sk_ADMISSIONS_push(sk, ptr) OPENSSL_sk_push(ossl_check_ADMISSIONS_sk_type(sk), ossl_check_ADMISSIONS_type(ptr)) 1382 #define sk_ADMISSIONS_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_ADMISSIONS_sk_type(sk), ossl_check_ADMISSIONS_type(ptr)) 1383 #define sk_ADMISSIONS_pop(sk) ((ADMISSIONS *)OPENSSL_sk_pop(ossl_check_ADMISSIONS_sk_type(sk))) 1384 #define sk_ADMISSIONS_shift(sk) ((ADMISSIONS *)OPENSSL_sk_shift(ossl_check_ADMISSIONS_sk_type(sk))) 1385 #define sk_ADMISSIONS_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_ADMISSIONS_sk_type(sk),ossl_check_ADMISSIONS_freefunc_type(freefunc)) 1386 #define sk_ADMISSIONS_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_ADMISSIONS_sk_type(sk), ossl_check_ADMISSIONS_type(ptr), (idx)) 1387 #define sk_ADMISSIONS_set(sk, idx, ptr) ((ADMISSIONS *)OPENSSL_sk_set(ossl_check_ADMISSIONS_sk_type(sk), (idx), ossl_check_ADMISSIONS_type(ptr))) 1388 #define sk_ADMISSIONS_find(sk, ptr) OPENSSL_sk_find(ossl_check_ADMISSIONS_sk_type(sk), ossl_check_ADMISSIONS_type(ptr)) 1389 #define sk_ADMISSIONS_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_ADMISSIONS_sk_type(sk), ossl_check_ADMISSIONS_type(ptr)) 1390 #define sk_ADMISSIONS_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_ADMISSIONS_sk_type(sk), ossl_check_ADMISSIONS_type(ptr), pnum) 1391 #define sk_ADMISSIONS_sort(sk) OPENSSL_sk_sort(ossl_check_ADMISSIONS_sk_type(sk)) 1392 #define sk_ADMISSIONS_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_ADMISSIONS_sk_type(sk)) 1393 #define sk_ADMISSIONS_dup(sk) ((STACK_OF(ADMISSIONS) *)OPENSSL_sk_dup(ossl_check_const_ADMISSIONS_sk_type(sk))) 1394 #define sk_ADMISSIONS_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(ADMISSIONS) *)OPENSSL_sk_deep_copy(ossl_check_const_ADMISSIONS_sk_type(sk), ossl_check_ADMISSIONS_copyfunc_type(copyfunc), ossl_check_ADMISSIONS_freefunc_type(freefunc))) 1395 #define sk_ADMISSIONS_set_cmp_func(sk, cmp) ((sk_ADMISSIONS_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_ADMISSIONS_sk_type(sk), ossl_check_ADMISSIONS_compfunc_type(cmp))) 1396 1397 typedef STACK_OF(PROFESSION_INFO) PROFESSION_INFOS; 1398 1399 const ASN1_OBJECT *NAMING_AUTHORITY_get0_authorityId( 1400 const NAMING_AUTHORITY *n); 1401 const ASN1_IA5STRING *NAMING_AUTHORITY_get0_authorityURL( 1402 const NAMING_AUTHORITY *n); 1403 const ASN1_STRING *NAMING_AUTHORITY_get0_authorityText( 1404 const NAMING_AUTHORITY *n); 1405 void NAMING_AUTHORITY_set0_authorityId(NAMING_AUTHORITY *n, 1406 ASN1_OBJECT* namingAuthorityId); 1407 void NAMING_AUTHORITY_set0_authorityURL(NAMING_AUTHORITY *n, 1408 ASN1_IA5STRING* namingAuthorityUrl); 1409 void NAMING_AUTHORITY_set0_authorityText(NAMING_AUTHORITY *n, 1410 ASN1_STRING* namingAuthorityText); 1411 1412 const GENERAL_NAME *ADMISSION_SYNTAX_get0_admissionAuthority( 1413 const ADMISSION_SYNTAX *as); 1414 void ADMISSION_SYNTAX_set0_admissionAuthority( 1415 ADMISSION_SYNTAX *as, GENERAL_NAME *aa); 1416 const STACK_OF(ADMISSIONS) *ADMISSION_SYNTAX_get0_contentsOfAdmissions( 1417 const ADMISSION_SYNTAX *as); 1418 void ADMISSION_SYNTAX_set0_contentsOfAdmissions( 1419 ADMISSION_SYNTAX *as, STACK_OF(ADMISSIONS) *a); 1420 const GENERAL_NAME *ADMISSIONS_get0_admissionAuthority(const ADMISSIONS *a); 1421 void ADMISSIONS_set0_admissionAuthority(ADMISSIONS *a, GENERAL_NAME *aa); 1422 const NAMING_AUTHORITY *ADMISSIONS_get0_namingAuthority(const ADMISSIONS *a); 1423 void ADMISSIONS_set0_namingAuthority(ADMISSIONS *a, NAMING_AUTHORITY *na); 1424 const PROFESSION_INFOS *ADMISSIONS_get0_professionInfos(const ADMISSIONS *a); 1425 void ADMISSIONS_set0_professionInfos(ADMISSIONS *a, PROFESSION_INFOS *pi); 1426 const ASN1_OCTET_STRING *PROFESSION_INFO_get0_addProfessionInfo( 1427 const PROFESSION_INFO *pi); 1428 void PROFESSION_INFO_set0_addProfessionInfo( 1429 PROFESSION_INFO *pi, ASN1_OCTET_STRING *aos); 1430 const NAMING_AUTHORITY *PROFESSION_INFO_get0_namingAuthority( 1431 const PROFESSION_INFO *pi); 1432 void PROFESSION_INFO_set0_namingAuthority( 1433 PROFESSION_INFO *pi, NAMING_AUTHORITY *na); 1434 const STACK_OF(ASN1_STRING) *PROFESSION_INFO_get0_professionItems( 1435 const PROFESSION_INFO *pi); 1436 void PROFESSION_INFO_set0_professionItems( 1437 PROFESSION_INFO *pi, STACK_OF(ASN1_STRING) *as); 1438 const STACK_OF(ASN1_OBJECT) *PROFESSION_INFO_get0_professionOIDs( 1439 const PROFESSION_INFO *pi); 1440 void PROFESSION_INFO_set0_professionOIDs( 1441 PROFESSION_INFO *pi, STACK_OF(ASN1_OBJECT) *po); 1442 const ASN1_PRINTABLESTRING *PROFESSION_INFO_get0_registrationNumber( 1443 const PROFESSION_INFO *pi); 1444 void PROFESSION_INFO_set0_registrationNumber( 1445 PROFESSION_INFO *pi, ASN1_PRINTABLESTRING *rn); 1446 1447 # ifdef __cplusplus 1448 } 1449 # endif 1450 #endif 1451