diff options
Diffstat (limited to 'src/lib/libcrypto/x509/x509.h')
-rw-r--r-- | src/lib/libcrypto/x509/x509.h | 216 |
1 files changed, 7 insertions, 209 deletions
diff --git a/src/lib/libcrypto/x509/x509.h b/src/lib/libcrypto/x509/x509.h index 9a44bf30aa..4624628bf8 100644 --- a/src/lib/libcrypto/x509/x509.h +++ b/src/lib/libcrypto/x509/x509.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: x509.h,v 1.86 2021/11/01 08:14:36 tb Exp $ */ | 1 | /* $OpenBSD: x509.h,v 1.87 2021/11/01 20:53:08 tb Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -139,171 +139,33 @@ typedef struct X509_val_st { | |||
139 | ASN1_TIME *notAfter; | 139 | ASN1_TIME *notAfter; |
140 | } X509_VAL; | 140 | } X509_VAL; |
141 | 141 | ||
142 | #if defined(LIBRESSL_CRYPTO_INTERNAL) || !defined(LIBRESSL_OPAQUE_X509) | ||
143 | struct X509_pubkey_st { | ||
144 | X509_ALGOR *algor; | ||
145 | ASN1_BIT_STRING *public_key; | ||
146 | EVP_PKEY *pkey; | ||
147 | }; | ||
148 | |||
149 | typedef struct X509_sig_st { | ||
150 | X509_ALGOR *algor; | ||
151 | ASN1_OCTET_STRING *digest; | ||
152 | } X509_SIG; | ||
153 | |||
154 | typedef struct X509_name_entry_st { | ||
155 | ASN1_OBJECT *object; | ||
156 | ASN1_STRING *value; | ||
157 | int set; | ||
158 | int size; /* temp variable */ | ||
159 | } X509_NAME_ENTRY; | ||
160 | #else | ||
161 | typedef struct X509_sig_st X509_SIG; | 142 | typedef struct X509_sig_st X509_SIG; |
143 | |||
162 | typedef struct X509_name_entry_st X509_NAME_ENTRY; | 144 | typedef struct X509_name_entry_st X509_NAME_ENTRY; |
163 | #endif | ||
164 | 145 | ||
165 | DECLARE_STACK_OF(X509_NAME_ENTRY) | 146 | DECLARE_STACK_OF(X509_NAME_ENTRY) |
166 | 147 | ||
167 | #if defined(LIBRESSL_CRYPTO_INTERNAL) || !defined(LIBRESSL_OPAQUE_X509) | ||
168 | /* we always keep X509_NAMEs in 2 forms. */ | ||
169 | struct X509_name_st { | ||
170 | STACK_OF(X509_NAME_ENTRY) *entries; | ||
171 | int modified; /* true if 'bytes' needs to be built */ | ||
172 | #ifndef OPENSSL_NO_BUFFER | ||
173 | BUF_MEM *bytes; | ||
174 | #else | ||
175 | char *bytes; | ||
176 | #endif | ||
177 | /* unsigned long hash; Keep the hash around for lookups */ | ||
178 | unsigned char *canon_enc; | ||
179 | int canon_enclen; | ||
180 | } /* X509_NAME */; | ||
181 | #endif | ||
182 | |||
183 | DECLARE_STACK_OF(X509_NAME) | 148 | DECLARE_STACK_OF(X509_NAME) |
184 | 149 | ||
185 | #define X509_EX_V_NETSCAPE_HACK 0x8000 | 150 | #define X509_EX_V_NETSCAPE_HACK 0x8000 |
186 | #define X509_EX_V_INIT 0x0001 | 151 | #define X509_EX_V_INIT 0x0001 |
187 | #if defined(LIBRESSL_CRYPTO_INTERNAL) || !defined(LIBRESSL_OPAQUE_X509) | ||
188 | typedef struct X509_extension_st { | ||
189 | ASN1_OBJECT *object; | ||
190 | ASN1_BOOLEAN critical; | ||
191 | ASN1_OCTET_STRING *value; | ||
192 | } X509_EXTENSION; | ||
193 | #else | ||
194 | typedef struct X509_extension_st X509_EXTENSION; | 152 | typedef struct X509_extension_st X509_EXTENSION; |
195 | #endif | ||
196 | 153 | ||
197 | typedef STACK_OF(X509_EXTENSION) X509_EXTENSIONS; | 154 | typedef STACK_OF(X509_EXTENSION) X509_EXTENSIONS; |
198 | 155 | ||
199 | DECLARE_STACK_OF(X509_EXTENSION) | 156 | DECLARE_STACK_OF(X509_EXTENSION) |
200 | 157 | ||
201 | /* a sequence of these are used */ | ||
202 | #if defined(LIBRESSL_CRYPTO_INTERNAL) || !defined(LIBRESSL_OPAQUE_X509) | ||
203 | typedef struct x509_attributes_st { | ||
204 | ASN1_OBJECT *object; | ||
205 | int single; /* 0 for a set, 1 for a single item (which is wrong) */ | ||
206 | union { | ||
207 | char *ptr; | ||
208 | /* 0 */ STACK_OF(ASN1_TYPE) *set; | ||
209 | /* 1 */ ASN1_TYPE *single; | ||
210 | } value; | ||
211 | } X509_ATTRIBUTE; | ||
212 | #else | ||
213 | typedef struct x509_attributes_st X509_ATTRIBUTE; | 158 | typedef struct x509_attributes_st X509_ATTRIBUTE; |
214 | #endif | ||
215 | 159 | ||
216 | DECLARE_STACK_OF(X509_ATTRIBUTE) | 160 | DECLARE_STACK_OF(X509_ATTRIBUTE) |
217 | 161 | ||
218 | |||
219 | #if defined(LIBRESSL_CRYPTO_INTERNAL) || !defined(LIBRESSL_OPAQUE_X509) | ||
220 | typedef struct X509_req_info_st { | ||
221 | ASN1_ENCODING enc; | ||
222 | ASN1_INTEGER *version; | ||
223 | X509_NAME *subject; | ||
224 | X509_PUBKEY *pubkey; | ||
225 | /* d=2 hl=2 l= 0 cons: cont: 00 */ | ||
226 | STACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */ | ||
227 | } X509_REQ_INFO; | ||
228 | |||
229 | typedef struct X509_req_st { | ||
230 | X509_REQ_INFO *req_info; | ||
231 | X509_ALGOR *sig_alg; | ||
232 | ASN1_BIT_STRING *signature; | ||
233 | int references; | ||
234 | } X509_REQ; | ||
235 | |||
236 | typedef struct x509_cinf_st { | ||
237 | ASN1_INTEGER *version; /* [ 0 ] default of v1 */ | ||
238 | ASN1_INTEGER *serialNumber; | ||
239 | X509_ALGOR *signature; | ||
240 | X509_NAME *issuer; | ||
241 | X509_VAL *validity; | ||
242 | X509_NAME *subject; | ||
243 | X509_PUBKEY *key; | ||
244 | ASN1_BIT_STRING *issuerUID; /* [ 1 ] optional in v2 */ | ||
245 | ASN1_BIT_STRING *subjectUID; /* [ 2 ] optional in v2 */ | ||
246 | STACK_OF(X509_EXTENSION) *extensions; /* [ 3 ] optional in v3 */ | ||
247 | ASN1_ENCODING enc; | ||
248 | } X509_CINF; | ||
249 | #else | ||
250 | typedef struct X509_req_info_st X509_REQ_INFO; | 162 | typedef struct X509_req_info_st X509_REQ_INFO; |
251 | typedef struct X509_req_st X509_REQ; | ||
252 | typedef struct x509_cinf_st X509_CINF; | ||
253 | #endif | ||
254 | 163 | ||
255 | /* This stuff is certificate "auxiliary info" | 164 | typedef struct X509_req_st X509_REQ; |
256 | * it contains details which are useful in certificate | ||
257 | * stores and databases. When used this is tagged onto | ||
258 | * the end of the certificate itself | ||
259 | */ | ||
260 | 165 | ||
261 | #if defined(LIBRESSL_CRYPTO_INTERNAL) || !defined(LIBRESSL_OPAQUE_X509) | ||
262 | typedef struct x509_cert_aux_st { | ||
263 | STACK_OF(ASN1_OBJECT) *trust; /* trusted uses */ | ||
264 | STACK_OF(ASN1_OBJECT) *reject; /* rejected uses */ | ||
265 | ASN1_UTF8STRING *alias; /* "friendly name" */ | ||
266 | ASN1_OCTET_STRING *keyid; /* key id of private key */ | ||
267 | STACK_OF(X509_ALGOR) *other; /* other unspecified info */ | ||
268 | } X509_CERT_AUX; | ||
269 | #else | ||
270 | typedef struct x509_cert_aux_st X509_CERT_AUX; | 166 | typedef struct x509_cert_aux_st X509_CERT_AUX; |
271 | #endif | ||
272 | 167 | ||
273 | struct x509_st; | 168 | typedef struct x509_cinf_st X509_CINF; |
274 | |||
275 | #if defined(LIBRESSL_CRYPTO_INTERNAL) || !defined(LIBRESSL_OPAQUE_X509) | ||
276 | struct x509_st { | ||
277 | X509_CINF *cert_info; | ||
278 | X509_ALGOR *sig_alg; | ||
279 | ASN1_BIT_STRING *signature; | ||
280 | int valid; | ||
281 | int references; | ||
282 | char *name; | ||
283 | CRYPTO_EX_DATA ex_data; | ||
284 | /* These contain copies of various extension values */ | ||
285 | long ex_pathlen; | ||
286 | long ex_pcpathlen; | ||
287 | unsigned long ex_flags; | ||
288 | unsigned long ex_kusage; | ||
289 | unsigned long ex_xkusage; | ||
290 | unsigned long ex_nscert; | ||
291 | ASN1_OCTET_STRING *skid; | ||
292 | AUTHORITY_KEYID *akid; | ||
293 | X509_POLICY_CACHE *policy_cache; | ||
294 | STACK_OF(DIST_POINT) *crldp; | ||
295 | STACK_OF(GENERAL_NAME) *altname; | ||
296 | NAME_CONSTRAINTS *nc; | ||
297 | #ifndef OPENSSL_NO_RFC3779 | ||
298 | STACK_OF(IPAddressFamily) *rfc3779_addr; | ||
299 | struct ASIdentifiers_st *rfc3779_asid; | ||
300 | #endif | ||
301 | #ifndef OPENSSL_NO_SHA | ||
302 | unsigned char sha1_hash[SHA_DIGEST_LENGTH]; | ||
303 | #endif | ||
304 | X509_CERT_AUX *aux; | ||
305 | } /* X509 */; | ||
306 | #endif | ||
307 | 169 | ||
308 | DECLARE_STACK_OF(X509) | 170 | DECLARE_STACK_OF(X509) |
309 | 171 | ||
@@ -322,6 +184,7 @@ DECLARE_STACK_OF(X509_TRUST) | |||
322 | 184 | ||
323 | /* standard trust ids */ | 185 | /* standard trust ids */ |
324 | 186 | ||
187 | /* OpenSSL changed this to 0 */ | ||
325 | #define X509_TRUST_DEFAULT -1 /* Only valid in purpose settings */ | 188 | #define X509_TRUST_DEFAULT -1 /* Only valid in purpose settings */ |
326 | 189 | ||
327 | #define X509_TRUST_COMPAT 1 | 190 | #define X509_TRUST_COMPAT 1 |
@@ -422,66 +285,13 @@ DECLARE_STACK_OF(X509_TRUST) | |||
422 | XN_FLAG_FN_LN | \ | 285 | XN_FLAG_FN_LN | \ |
423 | XN_FLAG_FN_ALIGN) | 286 | XN_FLAG_FN_ALIGN) |
424 | 287 | ||
425 | #if defined(LIBRESSL_CRYPTO_INTERNAL) || !defined(LIBRESSL_OPAQUE_X509) | ||
426 | struct x509_revoked_st { | ||
427 | ASN1_INTEGER *serialNumber; | ||
428 | ASN1_TIME *revocationDate; | ||
429 | STACK_OF(X509_EXTENSION) /* optional */ *extensions; | ||
430 | /* Set up if indirect CRL */ | ||
431 | STACK_OF(GENERAL_NAME) *issuer; | ||
432 | /* Revocation reason */ | ||
433 | int reason; | ||
434 | int sequence; /* load sequence */ | ||
435 | }; | ||
436 | #endif | ||
437 | |||
438 | DECLARE_STACK_OF(X509_REVOKED) | 288 | DECLARE_STACK_OF(X509_REVOKED) |
439 | 289 | ||
440 | #if defined(LIBRESSL_CRYPTO_INTERNAL) || !defined(LIBRESSL_OPAQUE_X509) | ||
441 | typedef struct X509_crl_info_st { | ||
442 | ASN1_INTEGER *version; | ||
443 | X509_ALGOR *sig_alg; | ||
444 | X509_NAME *issuer; | ||
445 | ASN1_TIME *lastUpdate; | ||
446 | ASN1_TIME *nextUpdate; | ||
447 | STACK_OF(X509_REVOKED) *revoked; | ||
448 | STACK_OF(X509_EXTENSION) /* [0] */ *extensions; | ||
449 | ASN1_ENCODING enc; | ||
450 | } X509_CRL_INFO; | ||
451 | #else | ||
452 | typedef struct X509_crl_info_st X509_CRL_INFO; | 290 | typedef struct X509_crl_info_st X509_CRL_INFO; |
453 | #endif | ||
454 | |||
455 | #if defined(LIBRESSL_CRYPTO_INTERNAL) || !defined(LIBRESSL_OPAQUE_X509) | ||
456 | struct X509_crl_st { | ||
457 | /* actual signature */ | ||
458 | X509_CRL_INFO *crl; | ||
459 | X509_ALGOR *sig_alg; | ||
460 | ASN1_BIT_STRING *signature; | ||
461 | int references; | ||
462 | int flags; | ||
463 | /* Copies of various extensions */ | ||
464 | AUTHORITY_KEYID *akid; | ||
465 | ISSUING_DIST_POINT *idp; | ||
466 | /* Convenient breakdown of IDP */ | ||
467 | int idp_flags; | ||
468 | int idp_reasons; | ||
469 | /* CRL and base CRL numbers for delta processing */ | ||
470 | ASN1_INTEGER *crl_number; | ||
471 | ASN1_INTEGER *base_crl_number; | ||
472 | #ifndef OPENSSL_NO_SHA | ||
473 | unsigned char sha1_hash[SHA_DIGEST_LENGTH]; | ||
474 | #endif | ||
475 | STACK_OF(GENERAL_NAMES) *issuers; | ||
476 | const X509_CRL_METHOD *meth; | ||
477 | void *meth_data; | ||
478 | } /* X509_CRL */; | ||
479 | #endif | ||
480 | 291 | ||
481 | DECLARE_STACK_OF(X509_CRL) | 292 | DECLARE_STACK_OF(X509_CRL) |
482 | 293 | ||
483 | typedef struct private_key_st | 294 | typedef struct private_key_st { |
484 | { | ||
485 | int version; | 295 | int version; |
486 | /* The PKCS#8 data types */ | 296 | /* The PKCS#8 data types */ |
487 | X509_ALGOR *enc_algor; | 297 | X509_ALGOR *enc_algor; |
@@ -499,7 +309,7 @@ typedef struct private_key_st | |||
499 | EVP_CIPHER_INFO cipher; | 309 | EVP_CIPHER_INFO cipher; |
500 | 310 | ||
501 | int references; | 311 | int references; |
502 | } X509_PKEY; | 312 | } X509_PKEY; |
503 | 313 | ||
504 | #ifndef OPENSSL_NO_EVP | 314 | #ifndef OPENSSL_NO_EVP |
505 | typedef struct X509_info_st { | 315 | typedef struct X509_info_st { |
@@ -561,18 +371,6 @@ typedef struct PBKDF2PARAM_st { | |||
561 | X509_ALGOR *prf; | 371 | X509_ALGOR *prf; |
562 | } PBKDF2PARAM; | 372 | } PBKDF2PARAM; |
563 | 373 | ||
564 | |||
565 | /* PKCS#8 private key info structure */ | ||
566 | |||
567 | #if defined(LIBRESSL_CRYPTO_INTERNAL) || !defined(LIBRESSL_OPAQUE_X509) | ||
568 | struct pkcs8_priv_key_info_st { | ||
569 | ASN1_INTEGER *version; | ||
570 | X509_ALGOR *pkeyalg; | ||
571 | ASN1_OCTET_STRING *pkey; | ||
572 | STACK_OF(X509_ATTRIBUTE) *attributes; | ||
573 | }; | ||
574 | #endif | ||
575 | |||
576 | #ifdef __cplusplus | 374 | #ifdef __cplusplus |
577 | } | 375 | } |
578 | #endif | 376 | #endif |