]>
Commit | Line | Data |
---|---|---|
0f113f3e | 1 | /* |
e144fd36 MC |
2 | * {- join("\n * ", @autowarntext) -} |
3 | * | |
da1c088f | 4 | * Copyright 1999-2023 The OpenSSL Project Authors. All Rights Reserved. |
9aeaf1b4 | 5 | * |
48f4ad77 | 6 | * Licensed under the Apache License 2.0 (the "License"). You may not use |
21dcbebc RS |
7 | * this file except in compliance with the License. You can obtain a copy |
8 | * in the file LICENSE in the source distribution or at | |
9 | * https://www.openssl.org/source/license.html | |
58964a49 | 10 | */ |
21dcbebc | 11 | |
e144fd36 MC |
12 | {- |
13 | use OpenSSL::stackhash qw(generate_stack_macros); | |
14 | -} | |
15 | ||
ae4186b0 DMSP |
16 | #ifndef OPENSSL_X509V3_H |
17 | # define OPENSSL_X509V3_H | |
d86167ec DMSP |
18 | # pragma once |
19 | ||
20 | # include <openssl/macros.h> | |
936c2b9e | 21 | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
d86167ec DMSP |
22 | # define HEADER_X509V3_H |
23 | # endif | |
9aeaf1b4 | 24 | |
0f113f3e MC |
25 | # include <openssl/bio.h> |
26 | # include <openssl/x509.h> | |
27 | # include <openssl/conf.h> | |
52df25cf | 28 | # include <openssl/x509v3err.h> |
eab9dbbd NS |
29 | # ifndef OPENSSL_NO_STDIO |
30 | # include <stdio.h> | |
31 | # endif | |
9aeaf1b4 | 32 | |
82271cee RL |
33 | #ifdef __cplusplus |
34 | extern "C" { | |
35 | #endif | |
36 | ||
9aeaf1b4 DSH |
37 | /* Forward reference */ |
38 | struct v3_ext_method; | |
39 | struct v3_ext_ctx; | |
40 | ||
41 | /* Useful typedefs */ | |
42 | ||
0f113f3e MC |
43 | typedef void *(*X509V3_EXT_NEW)(void); |
44 | typedef void (*X509V3_EXT_FREE) (void *); | |
45 | typedef void *(*X509V3_EXT_D2I)(void *, const unsigned char **, long); | |
9fdcc21f | 46 | typedef int (*X509V3_EXT_I2D) (const void *, unsigned char **); |
babb3798 | 47 | typedef STACK_OF(CONF_VALUE) * |
0f113f3e MC |
48 | (*X509V3_EXT_I2V) (const struct v3_ext_method *method, void *ext, |
49 | STACK_OF(CONF_VALUE) *extlist); | |
50 | typedef void *(*X509V3_EXT_V2I)(const struct v3_ext_method *method, | |
51 | struct v3_ext_ctx *ctx, | |
52 | STACK_OF(CONF_VALUE) *values); | |
53 | typedef char *(*X509V3_EXT_I2S)(const struct v3_ext_method *method, | |
54 | void *ext); | |
55 | typedef void *(*X509V3_EXT_S2I)(const struct v3_ext_method *method, | |
56 | struct v3_ext_ctx *ctx, const char *str); | |
57 | typedef int (*X509V3_EXT_I2R) (const struct v3_ext_method *method, void *ext, | |
58 | BIO *out, int indent); | |
59 | typedef void *(*X509V3_EXT_R2I)(const struct v3_ext_method *method, | |
60 | struct v3_ext_ctx *ctx, const char *str); | |
9aeaf1b4 DSH |
61 | |
62 | /* V3 extension structure */ | |
63 | ||
64 | struct v3_ext_method { | |
0f113f3e MC |
65 | int ext_nid; |
66 | int ext_flags; | |
2aff7727 | 67 | /* If this is set the following four fields are ignored */ |
0f113f3e | 68 | ASN1_ITEM_EXP *it; |
2aff7727 | 69 | /* Old style ASN1 calls */ |
0f113f3e MC |
70 | X509V3_EXT_NEW ext_new; |
71 | X509V3_EXT_FREE ext_free; | |
72 | X509V3_EXT_D2I d2i; | |
73 | X509V3_EXT_I2D i2d; | |
9aeaf1b4 | 74 | /* The following pair is used for string extensions */ |
0f113f3e MC |
75 | X509V3_EXT_I2S i2s; |
76 | X509V3_EXT_S2I s2i; | |
9aeaf1b4 | 77 | /* The following pair is used for multi-valued extensions */ |
0f113f3e MC |
78 | X509V3_EXT_I2V i2v; |
79 | X509V3_EXT_V2I v2i; | |
79a474e8 | 80 | /* The following are used for raw extensions */ |
0f113f3e MC |
81 | X509V3_EXT_I2R i2r; |
82 | X509V3_EXT_R2I r2i; | |
83 | void *usr_data; /* Any extension specific data */ | |
9aeaf1b4 DSH |
84 | }; |
85 | ||
1d48dd00 | 86 | typedef struct X509V3_CONF_METHOD_st { |
34707951 F |
87 | char *(*get_string) (void *db, const char *section, const char *value); |
88 | STACK_OF(CONF_VALUE) *(*get_section) (void *db, const char *section); | |
0f113f3e MC |
89 | void (*free_string) (void *db, char *string); |
90 | void (*free_section) (void *db, STACK_OF(CONF_VALUE) *section); | |
1d48dd00 | 91 | } X509V3_CONF_METHOD; |
175b0942 | 92 | |
2ed63033 | 93 | /* Context specific info for producing X509 v3 extensions*/ |
f317aa4c | 94 | struct v3_ext_ctx { |
2ed63033 DDO |
95 | # define X509V3_CTX_TEST 0x1 |
96 | # ifndef OPENSSL_NO_DEPRECATED_3_0 | |
97 | # define CTX_TEST X509V3_CTX_TEST | |
98 | # endif | |
0f113f3e MC |
99 | # define X509V3_CTX_REPLACE 0x2 |
100 | int flags; | |
101 | X509 *issuer_cert; | |
102 | X509 *subject_cert; | |
103 | X509_REQ *subject_req; | |
104 | X509_CRL *crl; | |
105 | X509V3_CONF_METHOD *db_meth; | |
106 | void *db; | |
41e597a0 | 107 | EVP_PKEY *issuer_pkey; |
9aeaf1b4 DSH |
108 | /* Maybe more here */ |
109 | }; | |
110 | ||
111 | typedef struct v3_ext_method X509V3_EXT_METHOD; | |
9aeaf1b4 | 112 | |
e144fd36 MC |
113 | {- |
114 | generate_stack_macros("X509V3_EXT_METHOD"); | |
115 | -} | |
01659135 | 116 | |
9aeaf1b4 | 117 | /* ext_flags values */ |
0f113f3e MC |
118 | # define X509V3_EXT_DYNAMIC 0x1 |
119 | # define X509V3_EXT_CTX_DEP 0x2 | |
120 | # define X509V3_EXT_MULTILINE 0x4 | |
9aeaf1b4 | 121 | |
c74f1eb9 DSH |
122 | typedef BIT_STRING_BITNAME ENUMERATED_NAMES; |
123 | ||
0490a86d | 124 | typedef struct BASIC_CONSTRAINTS_st { |
0f113f3e MC |
125 | int ca; |
126 | ASN1_INTEGER *pathlen; | |
9aeaf1b4 DSH |
127 | } BASIC_CONSTRAINTS; |
128 | ||
0490a86d | 129 | typedef struct PKEY_USAGE_PERIOD_st { |
0f113f3e MC |
130 | ASN1_GENERALIZEDTIME *notBefore; |
131 | ASN1_GENERALIZEDTIME *notAfter; | |
0be9747b DSH |
132 | } PKEY_USAGE_PERIOD; |
133 | ||
a716d727 | 134 | typedef struct otherName_st { |
0f113f3e MC |
135 | ASN1_OBJECT *type_id; |
136 | ASN1_TYPE *value; | |
a716d727 DSH |
137 | } OTHERNAME; |
138 | ||
9d6b1ce6 | 139 | typedef struct EDIPartyName_st { |
0f113f3e MC |
140 | ASN1_STRING *nameAssigner; |
141 | ASN1_STRING *partyName; | |
9d6b1ce6 DSH |
142 | } EDIPARTYNAME; |
143 | ||
0490a86d | 144 | typedef struct GENERAL_NAME_st { |
0f113f3e MC |
145 | # define GEN_OTHERNAME 0 |
146 | # define GEN_EMAIL 1 | |
147 | # define GEN_DNS 2 | |
148 | # define GEN_X400 3 | |
149 | # define GEN_DIRNAME 4 | |
150 | # define GEN_EDIPARTY 5 | |
151 | # define GEN_URI 6 | |
152 | # define GEN_IPADD 7 | |
153 | # define GEN_RID 8 | |
154 | int type; | |
155 | union { | |
156 | char *ptr; | |
157 | OTHERNAME *otherName; /* otherName */ | |
158 | ASN1_IA5STRING *rfc822Name; | |
159 | ASN1_IA5STRING *dNSName; | |
7880536f | 160 | ASN1_STRING *x400Address; |
0f113f3e MC |
161 | X509_NAME *directoryName; |
162 | EDIPARTYNAME *ediPartyName; | |
163 | ASN1_IA5STRING *uniformResourceIdentifier; | |
164 | ASN1_OCTET_STRING *iPAddress; | |
165 | ASN1_OBJECT *registeredID; | |
166 | /* Old names */ | |
167 | ASN1_OCTET_STRING *ip; /* iPAddress */ | |
168 | X509_NAME *dirn; /* dirn */ | |
169 | ASN1_IA5STRING *ia5; /* rfc822Name, dNSName, | |
170 | * uniformResourceIdentifier */ | |
171 | ASN1_OBJECT *rid; /* registeredID */ | |
172 | ASN1_TYPE *other; /* x400Address */ | |
173 | } d; | |
142fcca8 DSH |
174 | } GENERAL_NAME; |
175 | ||
6d3724d3 | 176 | typedef struct ACCESS_DESCRIPTION_st { |
0f113f3e MC |
177 | ASN1_OBJECT *method; |
178 | GENERAL_NAME *location; | |
6d3724d3 DSH |
179 | } ACCESS_DESCRIPTION; |
180 | ||
40a200f9 DDO |
181 | int GENERAL_NAME_set1_X509_NAME(GENERAL_NAME **tgt, const X509_NAME *src); |
182 | ||
e144fd36 MC |
183 | {- |
184 | generate_stack_macros("ACCESS_DESCRIPTION") | |
185 | .generate_stack_macros("GENERAL_NAME"); | |
186 | -} | |
9d6b1ce6 | 187 | |
01659135 | 188 | typedef STACK_OF(ACCESS_DESCRIPTION) AUTHORITY_INFO_ACCESS; |
9d6b1ce6 | 189 | typedef STACK_OF(ASN1_OBJECT) EXTENDED_KEY_USAGE; |
ba67253d | 190 | typedef STACK_OF(ASN1_INTEGER) TLS_FEATURE; |
4a640fb6 | 191 | typedef STACK_OF(GENERAL_NAME) GENERAL_NAMES; |
6d3724d3 | 192 | |
e144fd36 MC |
193 | {- |
194 | generate_stack_macros("GENERAL_NAMES"); | |
195 | -} | |
01659135 | 196 | |
d943e372 | 197 | typedef struct DIST_POINT_NAME_st { |
0f113f3e MC |
198 | int type; |
199 | union { | |
200 | GENERAL_NAMES *fullname; | |
201 | STACK_OF(X509_NAME_ENTRY) *relativename; | |
202 | } name; | |
3e727a3b | 203 | /* If relativename then this contains the full distribution point name */ |
0f113f3e | 204 | X509_NAME *dpname; |
d943e372 | 205 | } DIST_POINT_NAME; |
40a200f9 | 206 | DECLARE_ASN1_DUP_FUNCTION(DIST_POINT_NAME) |
4b96839f | 207 | /* All existing reasons */ |
0f113f3e MC |
208 | # define CRLDP_ALL_REASONS 0x807f |
209 | ||
210 | # define CRL_REASON_NONE -1 | |
211 | # define CRL_REASON_UNSPECIFIED 0 | |
212 | # define CRL_REASON_KEY_COMPROMISE 1 | |
213 | # define CRL_REASON_CA_COMPROMISE 2 | |
214 | # define CRL_REASON_AFFILIATION_CHANGED 3 | |
215 | # define CRL_REASON_SUPERSEDED 4 | |
216 | # define CRL_REASON_CESSATION_OF_OPERATION 5 | |
217 | # define CRL_REASON_CERTIFICATE_HOLD 6 | |
218 | # define CRL_REASON_REMOVE_FROM_CRL 8 | |
219 | # define CRL_REASON_PRIVILEGE_WITHDRAWN 9 | |
220 | # define CRL_REASON_AA_COMPROMISE 10 | |
d43c4497 | 221 | |
edc54021 | 222 | struct DIST_POINT_st { |
0f113f3e MC |
223 | DIST_POINT_NAME *distpoint; |
224 | ASN1_BIT_STRING *reasons; | |
225 | GENERAL_NAMES *CRLissuer; | |
226 | int dp_reasons; | |
edc54021 | 227 | }; |
d943e372 | 228 | |
e144fd36 MC |
229 | {- |
230 | generate_stack_macros("DIST_POINT"); | |
231 | -} | |
01659135 | 232 | |
9d6b1ce6 DSH |
233 | typedef STACK_OF(DIST_POINT) CRL_DIST_POINTS; |
234 | ||
edc54021 | 235 | struct AUTHORITY_KEYID_st { |
0f113f3e MC |
236 | ASN1_OCTET_STRING *keyid; |
237 | GENERAL_NAMES *issuer; | |
238 | ASN1_INTEGER *serial; | |
edc54021 | 239 | }; |
f5fedc04 | 240 | |
785cdf20 | 241 | /* Strong extranet structures */ |
142fcca8 | 242 | |
0490a86d | 243 | typedef struct SXNET_ID_st { |
0f113f3e MC |
244 | ASN1_INTEGER *zone; |
245 | ASN1_OCTET_STRING *user; | |
785cdf20 | 246 | } SXNETID; |
142fcca8 | 247 | |
e144fd36 MC |
248 | {- |
249 | generate_stack_macros("SXNETID"); | |
250 | -} | |
251 | ||
01659135 | 252 | |
cfdcfede | 253 | typedef struct SXNET_st { |
0f113f3e MC |
254 | ASN1_INTEGER *version; |
255 | STACK_OF(SXNETID) *ids; | |
cfdcfede BL |
256 | } SXNET; |
257 | ||
71f85280 NM |
258 | typedef struct ISSUER_SIGN_TOOL_st { |
259 | ASN1_UTF8STRING *signTool; | |
260 | ASN1_UTF8STRING *cATool; | |
261 | ASN1_UTF8STRING *signToolCert; | |
262 | ASN1_UTF8STRING *cAToolCert; | |
263 | } ISSUER_SIGN_TOOL; | |
264 | ||
c83e523d | 265 | typedef struct NOTICEREF_st { |
0f113f3e MC |
266 | ASN1_STRING *organization; |
267 | STACK_OF(ASN1_INTEGER) *noticenos; | |
c83e523d DSH |
268 | } NOTICEREF; |
269 | ||
270 | typedef struct USERNOTICE_st { | |
0f113f3e MC |
271 | NOTICEREF *noticeref; |
272 | ASN1_STRING *exptext; | |
c83e523d DSH |
273 | } USERNOTICE; |
274 | ||
275 | typedef struct POLICYQUALINFO_st { | |
0f113f3e MC |
276 | ASN1_OBJECT *pqualid; |
277 | union { | |
278 | ASN1_IA5STRING *cpsuri; | |
279 | USERNOTICE *usernotice; | |
280 | ASN1_TYPE *other; | |
281 | } d; | |
c83e523d DSH |
282 | } POLICYQUALINFO; |
283 | ||
e144fd36 MC |
284 | {- |
285 | generate_stack_macros("POLICYQUALINFO"); | |
286 | -} | |
287 | ||
01659135 | 288 | |
c83e523d | 289 | typedef struct POLICYINFO_st { |
0f113f3e MC |
290 | ASN1_OBJECT *policyid; |
291 | STACK_OF(POLICYQUALINFO) *qualifiers; | |
c83e523d DSH |
292 | } POLICYINFO; |
293 | ||
e144fd36 MC |
294 | {- |
295 | generate_stack_macros("POLICYINFO"); | |
296 | -} | |
01659135 | 297 | |
9d6b1ce6 DSH |
298 | typedef STACK_OF(POLICYINFO) CERTIFICATEPOLICIES; |
299 | ||
a1d12dae | 300 | typedef struct POLICY_MAPPING_st { |
0f113f3e MC |
301 | ASN1_OBJECT *issuerDomainPolicy; |
302 | ASN1_OBJECT *subjectDomainPolicy; | |
a1d12dae DSH |
303 | } POLICY_MAPPING; |
304 | ||
e144fd36 MC |
305 | {- |
306 | generate_stack_macros("POLICY_MAPPING"); | |
307 | -} | |
01659135 | 308 | |
a1d12dae DSH |
309 | typedef STACK_OF(POLICY_MAPPING) POLICY_MAPPINGS; |
310 | ||
520b76ff | 311 | typedef struct GENERAL_SUBTREE_st { |
0f113f3e MC |
312 | GENERAL_NAME *base; |
313 | ASN1_INTEGER *minimum; | |
314 | ASN1_INTEGER *maximum; | |
520b76ff DSH |
315 | } GENERAL_SUBTREE; |
316 | ||
e144fd36 MC |
317 | {- |
318 | generate_stack_macros("GENERAL_SUBTREE"); | |
319 | -} | |
01659135 | 320 | |
e9746e03 | 321 | struct NAME_CONSTRAINTS_st { |
0f113f3e MC |
322 | STACK_OF(GENERAL_SUBTREE) *permittedSubtrees; |
323 | STACK_OF(GENERAL_SUBTREE) *excludedSubtrees; | |
e9746e03 | 324 | }; |
520b76ff | 325 | |
f80153e2 | 326 | typedef struct POLICY_CONSTRAINTS_st { |
0f113f3e MC |
327 | ASN1_INTEGER *requireExplicitPolicy; |
328 | ASN1_INTEGER *inhibitPolicyMapping; | |
f80153e2 DSH |
329 | } POLICY_CONSTRAINTS; |
330 | ||
6951c23a | 331 | /* Proxy certificate structures, see RFC 3820 */ |
0f113f3e MC |
332 | typedef struct PROXY_POLICY_st { |
333 | ASN1_OBJECT *policyLanguage; | |
334 | ASN1_OCTET_STRING *policy; | |
335 | } PROXY_POLICY; | |
336 | ||
337 | typedef struct PROXY_CERT_INFO_EXTENSION_st { | |
338 | ASN1_INTEGER *pcPathLengthConstraint; | |
339 | PROXY_POLICY *proxyPolicy; | |
340 | } PROXY_CERT_INFO_EXTENSION; | |
6951c23a RL |
341 | |
342 | DECLARE_ASN1_FUNCTIONS(PROXY_POLICY) | |
343 | DECLARE_ASN1_FUNCTIONS(PROXY_CERT_INFO_EXTENSION) | |
344 | ||
0f113f3e MC |
345 | struct ISSUING_DIST_POINT_st { |
346 | DIST_POINT_NAME *distpoint; | |
347 | int onlyuser; | |
348 | int onlyCA; | |
349 | ASN1_BIT_STRING *onlysomereasons; | |
350 | int indirectCRL; | |
351 | int onlyattr; | |
352 | }; | |
6951c23a | 353 | |
4d50a2b4 DSH |
354 | /* Values in idp_flags field */ |
355 | /* IDP present */ | |
0f113f3e | 356 | # define IDP_PRESENT 0x1 |
4d50a2b4 | 357 | /* IDP values inconsistent */ |
0f113f3e | 358 | # define IDP_INVALID 0x2 |
4d50a2b4 | 359 | /* onlyuser true */ |
0f113f3e | 360 | # define IDP_ONLYUSER 0x4 |
4d50a2b4 | 361 | /* onlyCA true */ |
0f113f3e | 362 | # define IDP_ONLYCA 0x8 |
4d50a2b4 | 363 | /* onlyattr true */ |
0f113f3e | 364 | # define IDP_ONLYATTR 0x10 |
4d50a2b4 | 365 | /* indirectCRL true */ |
0f113f3e | 366 | # define IDP_INDIRECT 0x20 |
4d50a2b4 | 367 | /* onlysomereasons present */ |
0f113f3e | 368 | # define IDP_REASONS 0x40 |
4d50a2b4 | 369 | |
37659ea4 BE |
370 | # define X509V3_conf_err(val) ERR_add_error_data(6, \ |
371 | "section:", (val)->section, \ | |
372 | ",name:", (val)->name, ",value:", (val)->value) | |
9aeaf1b4 | 373 | |
0f113f3e | 374 | # define X509V3_set_ctx_test(ctx) \ |
2ed63033 | 375 | X509V3_set_ctx(ctx, NULL, NULL, NULL, NULL, X509V3_CTX_TEST) |
0f113f3e | 376 | # define X509V3_set_ctx_nodb(ctx) (ctx)->db = NULL; |
41b731f2 | 377 | |
0f113f3e MC |
378 | # define EXT_BITSTRING(nid, table) { nid, 0, ASN1_ITEM_ref(ASN1_BIT_STRING), \ |
379 | 0,0,0,0, \ | |
380 | 0,0, \ | |
381 | (X509V3_EXT_I2V)i2v_ASN1_BIT_STRING, \ | |
382 | (X509V3_EXT_V2I)v2i_ASN1_BIT_STRING, \ | |
383 | NULL, NULL, \ | |
384 | table} | |
9aeaf1b4 | 385 | |
0f113f3e MC |
386 | # define EXT_IA5STRING(nid) { nid, 0, ASN1_ITEM_ref(ASN1_IA5STRING), \ |
387 | 0,0,0,0, \ | |
388 | (X509V3_EXT_I2S)i2s_ASN1_IA5STRING, \ | |
389 | (X509V3_EXT_S2I)s2i_ASN1_IA5STRING, \ | |
390 | 0,0,0,0, \ | |
391 | NULL} | |
9aeaf1b4 | 392 | |
41e597a0 DDO |
393 | #define EXT_UTF8STRING(nid) { nid, 0, ASN1_ITEM_ref(ASN1_UTF8STRING), \ |
394 | 0,0,0,0, \ | |
395 | (X509V3_EXT_I2S)i2s_ASN1_UTF8STRING, \ | |
396 | (X509V3_EXT_S2I)s2i_ASN1_UTF8STRING, \ | |
397 | 0,0,0,0, \ | |
398 | NULL} | |
399 | ||
0f113f3e | 400 | # define EXT_END { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} |
673b102c DSH |
401 | |
402 | /* X509_PURPOSE stuff */ | |
403 | ||
0f113f3e MC |
404 | # define EXFLAG_BCONS 0x1 |
405 | # define EXFLAG_KUSAGE 0x2 | |
406 | # define EXFLAG_XKUSAGE 0x4 | |
407 | # define EXFLAG_NSCERT 0x8 | |
673b102c | 408 | |
0f113f3e | 409 | # define EXFLAG_CA 0x10 |
8a639b9d | 410 | # define EXFLAG_SI 0x20 /* self-issued, maybe not self-signed */ |
0f113f3e MC |
411 | # define EXFLAG_V1 0x40 |
412 | # define EXFLAG_INVALID 0x80 | |
2d60c923 | 413 | /* EXFLAG_SET is set to indicate that some values have been precomputed */ |
0f113f3e MC |
414 | # define EXFLAG_SET 0x100 |
415 | # define EXFLAG_CRITICAL 0x200 | |
416 | # define EXFLAG_PROXY 0x400 | |
417 | ||
418 | # define EXFLAG_INVALID_POLICY 0x800 | |
419 | # define EXFLAG_FRESHEST 0x1000 | |
8a639b9d DDO |
420 | # define EXFLAG_SS 0x2000 /* cert is apparently self-signed */ |
421 | ||
422 | # define EXFLAG_BCONS_CRITICAL 0x10000 | |
89f13ca4 DDO |
423 | # define EXFLAG_AKID_CRITICAL 0x20000 |
424 | # define EXFLAG_SKID_CRITICAL 0x40000 | |
da6c691d | 425 | # define EXFLAG_SAN_CRITICAL 0x80000 |
f2a04587 | 426 | # define EXFLAG_NO_FINGERPRINT 0x100000 |
0f113f3e | 427 | |
14bed672 VD |
428 | /* https://datatracker.ietf.org/doc/html/rfc5280#section-4.2.1.3 */ |
429 | # define KU_DIGITAL_SIGNATURE X509v3_KU_DIGITAL_SIGNATURE | |
430 | # define KU_NON_REPUDIATION X509v3_KU_NON_REPUDIATION | |
431 | # define KU_KEY_ENCIPHERMENT X509v3_KU_KEY_ENCIPHERMENT | |
432 | # define KU_DATA_ENCIPHERMENT X509v3_KU_DATA_ENCIPHERMENT | |
433 | # define KU_KEY_AGREEMENT X509v3_KU_KEY_AGREEMENT | |
434 | # define KU_KEY_CERT_SIGN X509v3_KU_KEY_CERT_SIGN | |
435 | # define KU_CRL_SIGN X509v3_KU_CRL_SIGN | |
436 | # define KU_ENCIPHER_ONLY X509v3_KU_ENCIPHER_ONLY | |
437 | # define KU_DECIPHER_ONLY X509v3_KU_DECIPHER_ONLY | |
0f113f3e MC |
438 | |
439 | # define NS_SSL_CLIENT 0x80 | |
440 | # define NS_SSL_SERVER 0x40 | |
441 | # define NS_SMIME 0x20 | |
442 | # define NS_OBJSIGN 0x10 | |
443 | # define NS_SSL_CA 0x04 | |
444 | # define NS_SMIME_CA 0x02 | |
445 | # define NS_OBJSIGN_CA 0x01 | |
446 | # define NS_ANY_CA (NS_SSL_CA|NS_SMIME_CA|NS_OBJSIGN_CA) | |
447 | ||
448 | # define XKU_SSL_SERVER 0x1 | |
449 | # define XKU_SSL_CLIENT 0x2 | |
450 | # define XKU_SMIME 0x4 | |
451 | # define XKU_CODE_SIGN 0x8 | |
4ef70dbc | 452 | # define XKU_SGC 0x10 /* Netscape or MS Server-Gated Crypto */ |
0f113f3e MC |
453 | # define XKU_OCSP_SIGN 0x20 |
454 | # define XKU_TIMESTAMP 0x40 | |
455 | # define XKU_DVCS 0x80 | |
456 | # define XKU_ANYEKU 0x100 | |
457 | ||
458 | # define X509_PURPOSE_DYNAMIC 0x1 | |
459 | # define X509_PURPOSE_DYNAMIC_NAME 0x2 | |
79875776 | 460 | |
673b102c | 461 | typedef struct x509_purpose_st { |
0f113f3e MC |
462 | int purpose; |
463 | int trust; /* Default trust ID */ | |
464 | int flags; | |
465 | int (*check_purpose) (const struct x509_purpose_st *, const X509 *, int); | |
466 | char *name; | |
467 | char *sname; | |
468 | void *usr_data; | |
673b102c DSH |
469 | } X509_PURPOSE; |
470 | ||
e144fd36 MC |
471 | {- |
472 | generate_stack_macros("X509_PURPOSE"); | |
473 | -} | |
474 | ||
01659135 | 475 | |
0f113f3e MC |
476 | # define X509_PURPOSE_SSL_CLIENT 1 |
477 | # define X509_PURPOSE_SSL_SERVER 2 | |
478 | # define X509_PURPOSE_NS_SSL_SERVER 3 | |
479 | # define X509_PURPOSE_SMIME_SIGN 4 | |
480 | # define X509_PURPOSE_SMIME_ENCRYPT 5 | |
481 | # define X509_PURPOSE_CRL_SIGN 6 | |
482 | # define X509_PURPOSE_ANY 7 | |
483 | # define X509_PURPOSE_OCSP_HELPER 8 | |
484 | # define X509_PURPOSE_TIMESTAMP_SIGN 9 | |
178696d6 | 485 | # define X509_PURPOSE_CODE_SIGN 10 |
673b102c | 486 | |
0f113f3e | 487 | # define X509_PURPOSE_MIN 1 |
178696d6 | 488 | # define X509_PURPOSE_MAX 10 |
dd413410 | 489 | |
8ca533e3 DSH |
490 | /* Flags for X509V3_EXT_print() */ |
491 | ||
0f113f3e | 492 | # define X509V3_EXT_UNKNOWN_MASK (0xfL << 16) |
8ca533e3 | 493 | /* Return error for unknown extensions */ |
0f113f3e | 494 | # define X509V3_EXT_DEFAULT 0 |
8ca533e3 | 495 | /* Print error for unknown extensions */ |
0f113f3e | 496 | # define X509V3_EXT_ERROR_UNKNOWN (1L << 16) |
8ca533e3 | 497 | /* ASN1 parse unknown extensions */ |
0f113f3e | 498 | # define X509V3_EXT_PARSE_UNKNOWN (2L << 16) |
8ca533e3 | 499 | /* BIO_dump unknown extensions */ |
0f113f3e | 500 | # define X509V3_EXT_DUMP_UNKNOWN (3L << 16) |
8ca533e3 | 501 | |
57d2f217 DSH |
502 | /* Flags for X509V3_add1_i2d */ |
503 | ||
0f113f3e MC |
504 | # define X509V3_ADD_OP_MASK 0xfL |
505 | # define X509V3_ADD_DEFAULT 0L | |
506 | # define X509V3_ADD_APPEND 1L | |
507 | # define X509V3_ADD_REPLACE 2L | |
508 | # define X509V3_ADD_REPLACE_EXISTING 3L | |
509 | # define X509V3_ADD_KEEP_EXISTING 4L | |
510 | # define X509V3_ADD_DELETE 5L | |
511 | # define X509V3_ADD_SILENT 0x10 | |
57d2f217 | 512 | |
2aff7727 | 513 | DECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS) |
9aeaf1b4 | 514 | |
9d6b1ce6 DSH |
515 | DECLARE_ASN1_FUNCTIONS(SXNET) |
516 | DECLARE_ASN1_FUNCTIONS(SXNETID) | |
785cdf20 | 517 | |
71f85280 NM |
518 | DECLARE_ASN1_FUNCTIONS(ISSUER_SIGN_TOOL) |
519 | ||
0aa25a68 F |
520 | int SXNET_add_id_asc(SXNET **psx, const char *zone, const char *user, int userlen); |
521 | int SXNET_add_id_ulong(SXNET **psx, unsigned long lzone, const char *user, | |
0f113f3e | 522 | int userlen); |
0aa25a68 | 523 | int SXNET_add_id_INTEGER(SXNET **psx, ASN1_INTEGER *izone, const char *user, |
0f113f3e | 524 | int userlen); |
28a98809 | 525 | |
0aa25a68 | 526 | ASN1_OCTET_STRING *SXNET_get_id_asc(SXNET *sx, const char *zone); |
28a98809 DSH |
527 | ASN1_OCTET_STRING *SXNET_get_id_ulong(SXNET *sx, unsigned long lzone); |
528 | ASN1_OCTET_STRING *SXNET_get_id_INTEGER(SXNET *sx, ASN1_INTEGER *zone); | |
529 | ||
9d6b1ce6 DSH |
530 | DECLARE_ASN1_FUNCTIONS(AUTHORITY_KEYID) |
531 | ||
532 | DECLARE_ASN1_FUNCTIONS(PKEY_USAGE_PERIOD) | |
533 | ||
534 | DECLARE_ASN1_FUNCTIONS(GENERAL_NAME) | |
9fdcc21f | 535 | DECLARE_ASN1_DUP_FUNCTION(GENERAL_NAME) |
c7235be6 UM |
536 | int GENERAL_NAME_cmp(GENERAL_NAME *a, GENERAL_NAME *b); |
537 | ||
5d6383c8 | 538 | ASN1_BIT_STRING *v2i_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, |
0f113f3e MC |
539 | X509V3_CTX *ctx, |
540 | STACK_OF(CONF_VALUE) *nval); | |
5d6383c8 | 541 | STACK_OF(CONF_VALUE) *i2v_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, |
0f113f3e MC |
542 | ASN1_BIT_STRING *bits, |
543 | STACK_OF(CONF_VALUE) *extlist); | |
544 | char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, ASN1_IA5STRING *ia5); | |
6452a139 | 545 | ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method, |
13f74c66 | 546 | X509V3_CTX *ctx, const char *str); |
41e597a0 DDO |
547 | char *i2s_ASN1_UTF8STRING(X509V3_EXT_METHOD *method, ASN1_UTF8STRING *utf8); |
548 | ASN1_UTF8STRING *s2i_ASN1_UTF8STRING(X509V3_EXT_METHOD *method, | |
549 | X509V3_CTX *ctx, const char *str); | |
5d6383c8 | 550 | |
0f113f3e MC |
551 | STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method, |
552 | GENERAL_NAME *gen, | |
553 | STACK_OF(CONF_VALUE) *ret); | |
2c15d426 | 554 | int GENERAL_NAME_print(BIO *out, GENERAL_NAME *gen); |
175b0942 | 555 | |
9d6b1ce6 | 556 | DECLARE_ASN1_FUNCTIONS(GENERAL_NAMES) |
0be9747b | 557 | |
ba404b5e | 558 | STACK_OF(CONF_VALUE) *i2v_GENERAL_NAMES(X509V3_EXT_METHOD *method, |
0f113f3e MC |
559 | GENERAL_NAMES *gen, |
560 | STACK_OF(CONF_VALUE) *extlist); | |
babb3798 | 561 | GENERAL_NAMES *v2i_GENERAL_NAMES(const X509V3_EXT_METHOD *method, |
0f113f3e | 562 | X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval); |
142fcca8 | 563 | |
9d6b1ce6 DSH |
564 | DECLARE_ASN1_FUNCTIONS(OTHERNAME) |
565 | DECLARE_ASN1_FUNCTIONS(EDIPARTYNAME) | |
c7235be6 | 566 | int OTHERNAME_cmp(OTHERNAME *a, OTHERNAME *b); |
a5cdb7d5 | 567 | void GENERAL_NAME_set0_value(GENERAL_NAME *a, int type, void *value); |
5435a830 | 568 | void *GENERAL_NAME_get0_value(const GENERAL_NAME *a, int *ptype); |
a5cdb7d5 | 569 | int GENERAL_NAME_set0_othername(GENERAL_NAME *gen, |
0f113f3e | 570 | ASN1_OBJECT *oid, ASN1_TYPE *value); |
5435a830 | 571 | int GENERAL_NAME_get0_otherName(const GENERAL_NAME *gen, |
0f113f3e | 572 | ASN1_OBJECT **poid, ASN1_TYPE **pvalue); |
a716d727 | 573 | |
0f113f3e | 574 | char *i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, |
bf9d5e48 | 575 | const ASN1_OCTET_STRING *ia5); |
0f113f3e | 576 | ASN1_OCTET_STRING *s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, |
bf9d5e48 | 577 | X509V3_CTX *ctx, const char *str); |
142fcca8 | 578 | |
9d6b1ce6 | 579 | DECLARE_ASN1_FUNCTIONS(EXTENDED_KEY_USAGE) |
095d2f0f | 580 | int i2a_ACCESS_DESCRIPTION(BIO *bp, const ACCESS_DESCRIPTION *a); |
6d3724d3 | 581 | |
ba67253d RS |
582 | DECLARE_ASN1_ALLOC_FUNCTIONS(TLS_FEATURE) |
583 | ||
9d6b1ce6 DSH |
584 | DECLARE_ASN1_FUNCTIONS(CERTIFICATEPOLICIES) |
585 | DECLARE_ASN1_FUNCTIONS(POLICYINFO) | |
586 | DECLARE_ASN1_FUNCTIONS(POLICYQUALINFO) | |
587 | DECLARE_ASN1_FUNCTIONS(USERNOTICE) | |
588 | DECLARE_ASN1_FUNCTIONS(NOTICEREF) | |
6d3724d3 | 589 | |
9d6b1ce6 DSH |
590 | DECLARE_ASN1_FUNCTIONS(CRL_DIST_POINTS) |
591 | DECLARE_ASN1_FUNCTIONS(DIST_POINT) | |
592 | DECLARE_ASN1_FUNCTIONS(DIST_POINT_NAME) | |
8eb72175 | 593 | DECLARE_ASN1_FUNCTIONS(ISSUING_DIST_POINT) |
6d3724d3 | 594 | |
8cc86b81 | 595 | int DIST_POINT_set_dpname(DIST_POINT_NAME *dpn, const X509_NAME *iname); |
3e727a3b | 596 | |
e9746e03 | 597 | int NAME_CONSTRAINTS_check(X509 *x, NAME_CONSTRAINTS *nc); |
5bd5dcd4 | 598 | int NAME_CONSTRAINTS_check_CN(X509 *x, NAME_CONSTRAINTS *nc); |
e9746e03 | 599 | |
9d6b1ce6 DSH |
600 | DECLARE_ASN1_FUNCTIONS(ACCESS_DESCRIPTION) |
601 | DECLARE_ASN1_FUNCTIONS(AUTHORITY_INFO_ACCESS) | |
6d3724d3 | 602 | |
a1d12dae | 603 | DECLARE_ASN1_ITEM(POLICY_MAPPING) |
ea3675b5 | 604 | DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_MAPPING) |
a1d12dae DSH |
605 | DECLARE_ASN1_ITEM(POLICY_MAPPINGS) |
606 | ||
520b76ff DSH |
607 | DECLARE_ASN1_ITEM(GENERAL_SUBTREE) |
608 | DECLARE_ASN1_ALLOC_FUNCTIONS(GENERAL_SUBTREE) | |
609 | ||
610 | DECLARE_ASN1_ITEM(NAME_CONSTRAINTS) | |
611 | DECLARE_ASN1_ALLOC_FUNCTIONS(NAME_CONSTRAINTS) | |
612 | ||
f80153e2 DSH |
613 | DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_CONSTRAINTS) |
614 | DECLARE_ASN1_ITEM(POLICY_CONSTRAINTS) | |
615 | ||
be86c7fc | 616 | GENERAL_NAME *a2i_GENERAL_NAME(GENERAL_NAME *out, |
0f113f3e | 617 | const X509V3_EXT_METHOD *method, |
02e112a8 | 618 | X509V3_CTX *ctx, int gen_type, |
c8f717fe | 619 | const char *value, int is_nc); |
be86c7fc | 620 | |
ae4186b0 | 621 | # ifdef OPENSSL_CONF_H |
0f113f3e MC |
622 | GENERAL_NAME *v2i_GENERAL_NAME(const X509V3_EXT_METHOD *method, |
623 | X509V3_CTX *ctx, CONF_VALUE *cnf); | |
babb3798 | 624 | GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out, |
0f113f3e MC |
625 | const X509V3_EXT_METHOD *method, |
626 | X509V3_CTX *ctx, CONF_VALUE *cnf, | |
627 | int is_nc); | |
33328581 | 628 | |
9aeaf1b4 | 629 | void X509V3_conf_free(CONF_VALUE *val); |
b7a26e6d | 630 | |
0f113f3e | 631 | X509_EXTENSION *X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int ext_nid, |
34707951 F |
632 | const char *value); |
633 | X509_EXTENSION *X509V3_EXT_nconf(CONF *conf, X509V3_CTX *ctx, const char *name, | |
634 | const char *value); | |
635 | int X509V3_EXT_add_nconf_sk(CONF *conf, X509V3_CTX *ctx, const char *section, | |
0f113f3e | 636 | STACK_OF(X509_EXTENSION) **sk); |
34707951 | 637 | int X509V3_EXT_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section, |
0f113f3e | 638 | X509 *cert); |
34707951 | 639 | int X509V3_EXT_REQ_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section, |
0f113f3e | 640 | X509_REQ *req); |
34707951 | 641 | int X509V3_EXT_CRL_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section, |
0f113f3e MC |
642 | X509_CRL *crl); |
643 | ||
644 | X509_EXTENSION *X509V3_EXT_conf_nid(LHASH_OF(CONF_VALUE) *conf, | |
645 | X509V3_CTX *ctx, int ext_nid, | |
34707951 | 646 | const char *value); |
3c1d6bbc | 647 | X509_EXTENSION *X509V3_EXT_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, |
34707951 | 648 | const char *name, const char *value); |
3c1d6bbc | 649 | int X509V3_EXT_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, |
34707951 | 650 | const char *section, X509 *cert); |
3c1d6bbc | 651 | int X509V3_EXT_REQ_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, |
34707951 | 652 | const char *section, X509_REQ *req); |
3c1d6bbc | 653 | int X509V3_EXT_CRL_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, |
34707951 | 654 | const char *section, X509_CRL *crl); |
b7a26e6d | 655 | |
c8f717fe | 656 | int X509V3_add_value_bool_nf(const char *name, int asn1_bool, |
0f113f3e | 657 | STACK_OF(CONF_VALUE) **extlist); |
bf9d5e48 F |
658 | int X509V3_get_value_bool(const CONF_VALUE *value, int *asn1_bool); |
659 | int X509V3_get_value_int(const CONF_VALUE *value, ASN1_INTEGER **aint); | |
b7a26e6d | 660 | void X509V3_set_nconf(X509V3_CTX *ctx, CONF *conf); |
3c1d6bbc | 661 | void X509V3_set_conf_lhash(X509V3_CTX *ctx, LHASH_OF(CONF_VALUE) *lhash); |
0f113f3e | 662 | # endif |
9aeaf1b4 | 663 | |
c8f717fe F |
664 | char *X509V3_get_string(X509V3_CTX *ctx, const char *name, const char *section); |
665 | STACK_OF(CONF_VALUE) *X509V3_get_section(X509V3_CTX *ctx, const char *section); | |
41b731f2 | 666 | void X509V3_string_free(X509V3_CTX *ctx, char *str); |
0f113f3e | 667 | void X509V3_section_free(X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *section); |
1d48dd00 | 668 | void X509V3_set_ctx(X509V3_CTX *ctx, X509 *issuer, X509 *subject, |
0f113f3e | 669 | X509_REQ *req, X509_CRL *crl, int flags); |
41e597a0 DDO |
670 | /* For API backward compatibility, this is separate from X509V3_set_ctx(): */ |
671 | int X509V3_set_issuer_pkey(X509V3_CTX *ctx, EVP_PKEY *pkey); | |
1d48dd00 | 672 | |
ba404b5e | 673 | int X509V3_add_value(const char *name, const char *value, |
0f113f3e | 674 | STACK_OF(CONF_VALUE) **extlist); |
61f5b6f3 | 675 | int X509V3_add_value_uchar(const char *name, const unsigned char *value, |
0f113f3e | 676 | STACK_OF(CONF_VALUE) **extlist); |
ba404b5e | 677 | int X509V3_add_value_bool(const char *name, int asn1_bool, |
0f113f3e | 678 | STACK_OF(CONF_VALUE) **extlist); |
bf9d5e48 | 679 | int X509V3_add_value_int(const char *name, const ASN1_INTEGER *aint, |
0f113f3e | 680 | STACK_OF(CONF_VALUE) **extlist); |
a6a283b3 | 681 | char *i2s_ASN1_INTEGER(X509V3_EXT_METHOD *meth, const ASN1_INTEGER *aint); |
2b91da96 | 682 | ASN1_INTEGER *s2i_ASN1_INTEGER(X509V3_EXT_METHOD *meth, const char *value); |
bf9d5e48 | 683 | char *i2s_ASN1_ENUMERATED(X509V3_EXT_METHOD *meth, const ASN1_ENUMERATED *aint); |
0f113f3e | 684 | char *i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD *meth, |
bf9d5e48 | 685 | const ASN1_ENUMERATED *aint); |
9aeaf1b4 | 686 | int X509V3_EXT_add(X509V3_EXT_METHOD *ext); |
397f7038 | 687 | int X509V3_EXT_add_list(X509V3_EXT_METHOD *extlist); |
9aeaf1b4 DSH |
688 | int X509V3_EXT_add_alias(int nid_to, int nid_from); |
689 | void X509V3_EXT_cleanup(void); | |
690 | ||
babb3798 BL |
691 | const X509V3_EXT_METHOD *X509V3_EXT_get(X509_EXTENSION *ext); |
692 | const X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid); | |
9aeaf1b4 | 693 | int X509V3_add_standard_extensions(void); |
535d79da | 694 | STACK_OF(CONF_VALUE) *X509V3_parse_list(const char *line); |
f5fedc04 | 695 | void *X509V3_EXT_d2i(X509_EXTENSION *ext); |
84de54b9 | 696 | void *X509V3_get_d2i(const STACK_OF(X509_EXTENSION) *x, int nid, int *crit, |
0f113f3e | 697 | int *idx); |
57d2f217 | 698 | |
c8b41850 | 699 | X509_EXTENSION *X509V3_EXT_i2d(int ext_nid, int crit, void *ext_struc); |
0f113f3e MC |
700 | int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) **x, int nid, void *value, |
701 | int crit, unsigned long flags); | |
9aeaf1b4 | 702 | |
00db8c60 | 703 | #ifndef OPENSSL_NO_DEPRECATED_1_1_0 |
14f051a0 RS |
704 | /* The new declarations are in crypto.h, but the old ones were here. */ |
705 | # define hex_to_string OPENSSL_buf2hexstr | |
706 | # define string_to_hex OPENSSL_hexstr2buf | |
707 | #endif | |
175b0942 | 708 | |
ba404b5e | 709 | void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent, |
0f113f3e MC |
710 | int ml); |
711 | int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag, | |
712 | int indent); | |
984d6c60 | 713 | #ifndef OPENSSL_NO_STDIO |
785cdf20 | 714 | int X509V3_EXT_print_fp(FILE *out, X509_EXTENSION *ext, int flag, int indent); |
984d6c60 | 715 | #endif |
5e6089f0 MC |
716 | int X509V3_extensions_print(BIO *out, const char *title, |
717 | const STACK_OF(X509_EXTENSION) *exts, | |
0f113f3e | 718 | unsigned long flag, int indent); |
2c15d426 | 719 | |
30b415b0 | 720 | int X509_check_ca(X509 *x); |
673b102c | 721 | int X509_check_purpose(X509 *x, int id, int ca); |
f1558bb4 | 722 | int X509_supported_extension(X509_EXTENSION *ex); |
926a56bf | 723 | int X509_PURPOSE_set(int *p, int purpose); |
2f043896 | 724 | int X509_check_issued(X509 *issuer, X509 *subject); |
1337a3a9 | 725 | int X509_check_akid(const X509 *issuer, const AUTHORITY_KEYID *akid); |
9961cb77 | 726 | void X509_set_proxy_flag(X509 *x); |
fe0169b0 RL |
727 | void X509_set_proxy_pathlen(X509 *x, long l); |
728 | long X509_get_proxy_pathlen(X509 *x); | |
063f1f0c DSH |
729 | |
730 | uint32_t X509_get_extension_flags(X509 *x); | |
731 | uint32_t X509_get_key_usage(X509 *x); | |
732 | uint32_t X509_get_extended_key_usage(X509 *x); | |
d19a50c9 | 733 | const ASN1_OCTET_STRING *X509_get0_subject_key_id(X509 *x); |
b383aa20 | 734 | const ASN1_OCTET_STRING *X509_get0_authority_key_id(X509 *x); |
afdec13d DMSP |
735 | const GENERAL_NAMES *X509_get0_authority_issuer(X509 *x); |
736 | const ASN1_INTEGER *X509_get0_authority_serial(X509 *x); | |
063f1f0c | 737 | |
d4cec6a1 | 738 | int X509_PURPOSE_get_count(void); |
0f113f3e | 739 | X509_PURPOSE *X509_PURPOSE_get0(int idx); |
c8f717fe | 740 | int X509_PURPOSE_get_by_sname(const char *sname); |
d4cec6a1 | 741 | int X509_PURPOSE_get_by_id(int id); |
dd413410 | 742 | int X509_PURPOSE_add(int id, int trust, int flags, |
0f113f3e | 743 | int (*ck) (const X509_PURPOSE *, const X509 *, int), |
c8f717fe F |
744 | const char *name, const char *sname, void *arg); |
745 | char *X509_PURPOSE_get0_name(const X509_PURPOSE *xp); | |
746 | char *X509_PURPOSE_get0_sname(const X509_PURPOSE *xp); | |
747 | int X509_PURPOSE_get_trust(const X509_PURPOSE *xp); | |
79875776 | 748 | void X509_PURPOSE_cleanup(void); |
c8f717fe | 749 | int X509_PURPOSE_get_id(const X509_PURPOSE *); |
673b102c | 750 | |
c869da88 DSH |
751 | STACK_OF(OPENSSL_STRING) *X509_get1_email(X509 *x); |
752 | STACK_OF(OPENSSL_STRING) *X509_REQ_get1_email(X509_REQ *x); | |
753 | void X509_email_free(STACK_OF(OPENSSL_STRING) *sk); | |
754 | STACK_OF(OPENSSL_STRING) *X509_get1_ocsp(X509 *x); | |
a70da5b3 DSH |
755 | /* Flags for X509_check_* functions */ |
756 | ||
0f113f3e MC |
757 | /* |
758 | * Always check subject name for host match even if subject alt names present | |
759 | */ | |
760 | # define X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT 0x1 | |
397a8e74 | 761 | /* Disable wildcard matching for dnsName fields and common name. */ |
0f113f3e | 762 | # define X509_CHECK_FLAG_NO_WILDCARDS 0x2 |
397a8e74 | 763 | /* Wildcards must not match a partial label. */ |
0f113f3e | 764 | # define X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS 0x4 |
397a8e74 | 765 | /* Allow (non-partial) wildcards to match multiple labels. */ |
0f113f3e | 766 | # define X509_CHECK_FLAG_MULTI_LABEL_WILDCARDS 0x8 |
a09e4d24 | 767 | /* Constraint verifier subdomain patterns to match a single labels. */ |
0f113f3e | 768 | # define X509_CHECK_FLAG_SINGLE_LABEL_SUBDOMAINS 0x10 |
dd60efea VD |
769 | /* Never check the subject CN */ |
770 | # define X509_CHECK_FLAG_NEVER_CHECK_SUBJECT 0x20 | |
a09e4d24 VD |
771 | /* |
772 | * Match reference identifiers starting with "." to any sub-domain. | |
773 | * This is a non-public flag, turned on implicitly when the subject | |
774 | * reference identity is a DNS name. | |
775 | */ | |
0f113f3e | 776 | # define _X509_CHECK_FLAG_DOT_SUBDOMAINS 0x8000 |
a70da5b3 | 777 | |
297c67fc | 778 | int X509_check_host(X509 *x, const char *chk, size_t chklen, |
0f113f3e | 779 | unsigned int flags, char **peername); |
297c67fc | 780 | int X509_check_email(X509 *x, const char *chk, size_t chklen, |
0f113f3e | 781 | unsigned int flags); |
a70da5b3 | 782 | int X509_check_ip(X509 *x, const unsigned char *chk, size_t chklen, |
0f113f3e | 783 | unsigned int flags); |
a70da5b3 | 784 | int X509_check_ip_asc(X509 *x, const char *ipasc, unsigned int flags); |
a91dedca | 785 | |
4e5d3a7f | 786 | ASN1_OCTET_STRING *a2i_IPADDRESS(const char *ipasc); |
520b76ff | 787 | ASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc); |
a7b1eed5 | 788 | int X509V3_NAME_from_section(X509_NAME *nm, STACK_OF(CONF_VALUE) *dn_sk, |
0f113f3e | 789 | unsigned long chtype); |
a91dedca | 790 | |
ecf13991 | 791 | void X509_POLICY_NODE_print(BIO *out, X509_POLICY_NODE *node, int indent); |
e144fd36 MC |
792 | {- |
793 | generate_stack_macros("X509_POLICY_NODE"); | |
794 | -} | |
795 | ||
ecf13991 | 796 | |
47bbaa5b | 797 | #ifndef OPENSSL_NO_RFC3779 |
96ea4ae9 | 798 | typedef struct ASRange_st { |
0f113f3e | 799 | ASN1_INTEGER *min, *max; |
96ea4ae9 BL |
800 | } ASRange; |
801 | ||
c73ad690 RS |
802 | # define ASIdOrRange_id 0 |
803 | # define ASIdOrRange_range 1 | |
96ea4ae9 BL |
804 | |
805 | typedef struct ASIdOrRange_st { | |
0f113f3e MC |
806 | int type; |
807 | union { | |
808 | ASN1_INTEGER *id; | |
809 | ASRange *range; | |
810 | } u; | |
96ea4ae9 BL |
811 | } ASIdOrRange; |
812 | ||
e144fd36 MC |
813 | {- |
814 | generate_stack_macros("ASIdOrRange"); | |
815 | -} | |
01659135 | 816 | |
96ea4ae9 | 817 | typedef STACK_OF(ASIdOrRange) ASIdOrRanges; |
96ea4ae9 | 818 | |
c73ad690 RS |
819 | # define ASIdentifierChoice_inherit 0 |
820 | # define ASIdentifierChoice_asIdsOrRanges 1 | |
96ea4ae9 BL |
821 | |
822 | typedef struct ASIdentifierChoice_st { | |
0f113f3e MC |
823 | int type; |
824 | union { | |
825 | ASN1_NULL *inherit; | |
826 | ASIdOrRanges *asIdsOrRanges; | |
827 | } u; | |
96ea4ae9 BL |
828 | } ASIdentifierChoice; |
829 | ||
830 | typedef struct ASIdentifiers_st { | |
0f113f3e | 831 | ASIdentifierChoice *asnum, *rdi; |
96ea4ae9 BL |
832 | } ASIdentifiers; |
833 | ||
834 | DECLARE_ASN1_FUNCTIONS(ASRange) | |
835 | DECLARE_ASN1_FUNCTIONS(ASIdOrRange) | |
836 | DECLARE_ASN1_FUNCTIONS(ASIdentifierChoice) | |
837 | DECLARE_ASN1_FUNCTIONS(ASIdentifiers) | |
838 | ||
96ea4ae9 | 839 | typedef struct IPAddressRange_st { |
0f113f3e | 840 | ASN1_BIT_STRING *min, *max; |
96ea4ae9 BL |
841 | } IPAddressRange; |
842 | ||
c73ad690 RS |
843 | # define IPAddressOrRange_addressPrefix 0 |
844 | # define IPAddressOrRange_addressRange 1 | |
96ea4ae9 BL |
845 | |
846 | typedef struct IPAddressOrRange_st { | |
0f113f3e MC |
847 | int type; |
848 | union { | |
849 | ASN1_BIT_STRING *addressPrefix; | |
850 | IPAddressRange *addressRange; | |
851 | } u; | |
96ea4ae9 BL |
852 | } IPAddressOrRange; |
853 | ||
e144fd36 MC |
854 | {- |
855 | generate_stack_macros("IPAddressOrRange"); | |
856 | -} | |
01659135 | 857 | |
96ea4ae9 | 858 | typedef STACK_OF(IPAddressOrRange) IPAddressOrRanges; |
96ea4ae9 | 859 | |
c73ad690 RS |
860 | # define IPAddressChoice_inherit 0 |
861 | # define IPAddressChoice_addressesOrRanges 1 | |
96ea4ae9 BL |
862 | |
863 | typedef struct IPAddressChoice_st { | |
0f113f3e MC |
864 | int type; |
865 | union { | |
866 | ASN1_NULL *inherit; | |
867 | IPAddressOrRanges *addressesOrRanges; | |
868 | } u; | |
96ea4ae9 BL |
869 | } IPAddressChoice; |
870 | ||
871 | typedef struct IPAddressFamily_st { | |
0f113f3e MC |
872 | ASN1_OCTET_STRING *addressFamily; |
873 | IPAddressChoice *ipAddressChoice; | |
96ea4ae9 BL |
874 | } IPAddressFamily; |
875 | ||
e144fd36 MC |
876 | {- |
877 | generate_stack_macros("IPAddressFamily"); | |
878 | -} | |
879 | ||
01659135 | 880 | |
96ea4ae9 | 881 | typedef STACK_OF(IPAddressFamily) IPAddrBlocks; |
96ea4ae9 BL |
882 | |
883 | DECLARE_ASN1_FUNCTIONS(IPAddressRange) | |
884 | DECLARE_ASN1_FUNCTIONS(IPAddressOrRange) | |
885 | DECLARE_ASN1_FUNCTIONS(IPAddressChoice) | |
886 | DECLARE_ASN1_FUNCTIONS(IPAddressFamily) | |
887 | ||
888 | /* | |
889 | * API tag for elements of the ASIdentifer SEQUENCE. | |
890 | */ | |
c73ad690 RS |
891 | # define V3_ASID_ASNUM 0 |
892 | # define V3_ASID_RDI 1 | |
96ea4ae9 BL |
893 | |
894 | /* | |
895 | * AFI values, assigned by IANA. It'd be nice to make the AFI | |
896 | * handling code totally generic, but there are too many little things | |
897 | * that would need to be defined for other address families for it to | |
898 | * be worth the trouble. | |
899 | */ | |
c73ad690 RS |
900 | # define IANA_AFI_IPV4 1 |
901 | # define IANA_AFI_IPV6 2 | |
96ea4ae9 BL |
902 | |
903 | /* | |
904 | * Utilities to construct and extract values from RFC3779 extensions, | |
905 | * since some of the encodings (particularly for IP address prefixes | |
906 | * and ranges) are a bit tedious to work with directly. | |
907 | */ | |
9021a5df RS |
908 | int X509v3_asid_add_inherit(ASIdentifiers *asid, int which); |
909 | int X509v3_asid_add_id_or_range(ASIdentifiers *asid, int which, | |
910 | ASN1_INTEGER *min, ASN1_INTEGER *max); | |
911 | int X509v3_addr_add_inherit(IPAddrBlocks *addr, | |
912 | const unsigned afi, const unsigned *safi); | |
913 | int X509v3_addr_add_prefix(IPAddrBlocks *addr, | |
914 | const unsigned afi, const unsigned *safi, | |
915 | unsigned char *a, const int prefixlen); | |
916 | int X509v3_addr_add_range(IPAddrBlocks *addr, | |
917 | const unsigned afi, const unsigned *safi, | |
918 | unsigned char *min, unsigned char *max); | |
919 | unsigned X509v3_addr_get_afi(const IPAddressFamily *f); | |
920 | int X509v3_addr_get_range(IPAddressOrRange *aor, const unsigned afi, | |
921 | unsigned char *min, unsigned char *max, | |
922 | const int length); | |
96ea4ae9 BL |
923 | |
924 | /* | |
925 | * Canonical forms. | |
926 | */ | |
9021a5df RS |
927 | int X509v3_asid_is_canonical(ASIdentifiers *asid); |
928 | int X509v3_addr_is_canonical(IPAddrBlocks *addr); | |
929 | int X509v3_asid_canonize(ASIdentifiers *asid); | |
930 | int X509v3_addr_canonize(IPAddrBlocks *addr); | |
96ea4ae9 BL |
931 | |
932 | /* | |
933 | * Tests for inheritance and containment. | |
934 | */ | |
9021a5df RS |
935 | int X509v3_asid_inherits(ASIdentifiers *asid); |
936 | int X509v3_addr_inherits(IPAddrBlocks *addr); | |
937 | int X509v3_asid_subset(ASIdentifiers *a, ASIdentifiers *b); | |
938 | int X509v3_addr_subset(IPAddrBlocks *a, IPAddrBlocks *b); | |
96ea4ae9 BL |
939 | |
940 | /* | |
941 | * Check whether RFC 3779 extensions nest properly in chains. | |
942 | */ | |
9021a5df RS |
943 | int X509v3_asid_validate_path(X509_STORE_CTX *); |
944 | int X509v3_addr_validate_path(X509_STORE_CTX *); | |
945 | int X509v3_asid_validate_resource_set(STACK_OF(X509) *chain, | |
946 | ASIdentifiers *ext, | |
947 | int allow_inheritance); | |
948 | int X509v3_addr_validate_resource_set(STACK_OF(X509) *chain, | |
949 | IPAddrBlocks *ext, int allow_inheritance); | |
96ea4ae9 | 950 | |
47bbaa5b | 951 | #endif /* OPENSSL_NO_RFC3779 */ |
9021a5df | 952 | |
e144fd36 MC |
953 | {- |
954 | generate_stack_macros("ASN1_STRING"); | |
955 | -} | |
fa743582 RS |
956 | |
957 | /* | |
958 | * Admission Syntax | |
959 | */ | |
960 | typedef struct NamingAuthority_st NAMING_AUTHORITY; | |
961 | typedef struct ProfessionInfo_st PROFESSION_INFO; | |
962 | typedef struct Admissions_st ADMISSIONS; | |
963 | typedef struct AdmissionSyntax_st ADMISSION_SYNTAX; | |
964 | DECLARE_ASN1_FUNCTIONS(NAMING_AUTHORITY) | |
965 | DECLARE_ASN1_FUNCTIONS(PROFESSION_INFO) | |
966 | DECLARE_ASN1_FUNCTIONS(ADMISSIONS) | |
967 | DECLARE_ASN1_FUNCTIONS(ADMISSION_SYNTAX) | |
e144fd36 MC |
968 | {- |
969 | generate_stack_macros("PROFESSION_INFO") | |
970 | .generate_stack_macros("ADMISSIONS"); | |
971 | -} | |
fa743582 RS |
972 | typedef STACK_OF(PROFESSION_INFO) PROFESSION_INFOS; |
973 | ||
974 | const ASN1_OBJECT *NAMING_AUTHORITY_get0_authorityId( | |
975 | const NAMING_AUTHORITY *n); | |
976 | const ASN1_IA5STRING *NAMING_AUTHORITY_get0_authorityURL( | |
977 | const NAMING_AUTHORITY *n); | |
978 | const ASN1_STRING *NAMING_AUTHORITY_get0_authorityText( | |
979 | const NAMING_AUTHORITY *n); | |
980 | void NAMING_AUTHORITY_set0_authorityId(NAMING_AUTHORITY *n, | |
981 | ASN1_OBJECT* namingAuthorityId); | |
982 | void NAMING_AUTHORITY_set0_authorityURL(NAMING_AUTHORITY *n, | |
983 | ASN1_IA5STRING* namingAuthorityUrl); | |
984 | void NAMING_AUTHORITY_set0_authorityText(NAMING_AUTHORITY *n, | |
985 | ASN1_STRING* namingAuthorityText); | |
986 | ||
987 | const GENERAL_NAME *ADMISSION_SYNTAX_get0_admissionAuthority( | |
988 | const ADMISSION_SYNTAX *as); | |
989 | void ADMISSION_SYNTAX_set0_admissionAuthority( | |
990 | ADMISSION_SYNTAX *as, GENERAL_NAME *aa); | |
991 | const STACK_OF(ADMISSIONS) *ADMISSION_SYNTAX_get0_contentsOfAdmissions( | |
992 | const ADMISSION_SYNTAX *as); | |
993 | void ADMISSION_SYNTAX_set0_contentsOfAdmissions( | |
994 | ADMISSION_SYNTAX *as, STACK_OF(ADMISSIONS) *a); | |
995 | const GENERAL_NAME *ADMISSIONS_get0_admissionAuthority(const ADMISSIONS *a); | |
996 | void ADMISSIONS_set0_admissionAuthority(ADMISSIONS *a, GENERAL_NAME *aa); | |
997 | const NAMING_AUTHORITY *ADMISSIONS_get0_namingAuthority(const ADMISSIONS *a); | |
998 | void ADMISSIONS_set0_namingAuthority(ADMISSIONS *a, NAMING_AUTHORITY *na); | |
999 | const PROFESSION_INFOS *ADMISSIONS_get0_professionInfos(const ADMISSIONS *a); | |
1000 | void ADMISSIONS_set0_professionInfos(ADMISSIONS *a, PROFESSION_INFOS *pi); | |
1001 | const ASN1_OCTET_STRING *PROFESSION_INFO_get0_addProfessionInfo( | |
1002 | const PROFESSION_INFO *pi); | |
1003 | void PROFESSION_INFO_set0_addProfessionInfo( | |
1004 | PROFESSION_INFO *pi, ASN1_OCTET_STRING *aos); | |
1005 | const NAMING_AUTHORITY *PROFESSION_INFO_get0_namingAuthority( | |
1006 | const PROFESSION_INFO *pi); | |
1007 | void PROFESSION_INFO_set0_namingAuthority( | |
1008 | PROFESSION_INFO *pi, NAMING_AUTHORITY *na); | |
1009 | const STACK_OF(ASN1_STRING) *PROFESSION_INFO_get0_professionItems( | |
1010 | const PROFESSION_INFO *pi); | |
1011 | void PROFESSION_INFO_set0_professionItems( | |
1012 | PROFESSION_INFO *pi, STACK_OF(ASN1_STRING) *as); | |
1013 | const STACK_OF(ASN1_OBJECT) *PROFESSION_INFO_get0_professionOIDs( | |
1014 | const PROFESSION_INFO *pi); | |
1015 | void PROFESSION_INFO_set0_professionOIDs( | |
1016 | PROFESSION_INFO *pi, STACK_OF(ASN1_OBJECT) *po); | |
1017 | const ASN1_PRINTABLESTRING *PROFESSION_INFO_get0_registrationNumber( | |
1018 | const PROFESSION_INFO *pi); | |
1019 | void PROFESSION_INFO_set0_registrationNumber( | |
1020 | PROFESSION_INFO *pi, ASN1_PRINTABLESTRING *rn); | |
1021 | ||
0cd0a820 | 1022 | # ifdef __cplusplus |
9aeaf1b4 | 1023 | } |
0cd0a820 | 1024 | # endif |
9aeaf1b4 | 1025 | #endif |