summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/x509/x509_vfy.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/x509/x509_vfy.h')
-rw-r--r--src/lib/libcrypto/x509/x509_vfy.h56
1 files changed, 42 insertions, 14 deletions
diff --git a/src/lib/libcrypto/x509/x509_vfy.h b/src/lib/libcrypto/x509/x509_vfy.h
index 4637aecedf..e289d5309a 100644
--- a/src/lib/libcrypto/x509/x509_vfy.h
+++ b/src/lib/libcrypto/x509/x509_vfy.h
@@ -65,13 +65,16 @@
65#ifndef HEADER_X509_VFY_H 65#ifndef HEADER_X509_VFY_H
66#define HEADER_X509_VFY_H 66#define HEADER_X509_VFY_H
67 67
68#ifdef __cplusplus 68#ifndef NO_LHASH
69extern "C" { 69#include <openssl/lhash.h>
70#endif 70#endif
71
72#include <openssl/bio.h> 71#include <openssl/bio.h>
73#include <openssl/crypto.h> 72#include <openssl/crypto.h>
74 73
74#ifdef __cplusplus
75extern "C" {
76#endif
77
75/* Outer object */ 78/* Outer object */
76typedef struct x509_hash_dir_st 79typedef struct x509_hash_dir_st
77 { 80 {
@@ -128,6 +131,7 @@ typedef struct x509_object_st
128typedef struct x509_lookup_st X509_LOOKUP; 131typedef struct x509_lookup_st X509_LOOKUP;
129 132
130DECLARE_STACK_OF(X509_LOOKUP) 133DECLARE_STACK_OF(X509_LOOKUP)
134DECLARE_STACK_OF(X509_OBJECT)
131 135
132/* This is a static that defines the function interface */ 136/* This is a static that defines the function interface */
133typedef struct x509_lookup_method_st 137typedef struct x509_lookup_method_st
@@ -150,7 +154,7 @@ typedef struct x509_lookup_method_st
150 X509_OBJECT *ret); 154 X509_OBJECT *ret);
151 } X509_LOOKUP_METHOD; 155 } X509_LOOKUP_METHOD;
152 156
153typedef struct x509_store_state_st X509_STORE_CTX; 157typedef struct x509_store_ctx_st X509_STORE_CTX;
154 158
155/* This is used to hold everything. It is used for all certificate 159/* This is used to hold everything. It is used for all certificate
156 * validation. Once we have a certificate chain, the 'verify' 160 * validation. Once we have a certificate chain, the 'verify'
@@ -159,11 +163,7 @@ typedef struct x509_store_st
159 { 163 {
160 /* The following is a cache of trusted certs */ 164 /* The following is a cache of trusted certs */
161 int cache; /* if true, stash any hits */ 165 int cache; /* if true, stash any hits */
162#ifdef HEADER_LHASH_H 166 STACK_OF(X509_OBJECT) *objs; /* Cache of all objects */
163 LHASH *certs; /* cached certs; */
164#else
165 char *certs;
166#endif
167 167
168 /* These are external lookup methods */ 168 /* These are external lookup methods */
169 STACK_OF(X509_LOOKUP) *get_cert_methods; 169 STACK_OF(X509_LOOKUP) *get_cert_methods;
@@ -191,10 +191,10 @@ struct x509_lookup_st
191 X509_STORE *store_ctx; /* who owns us */ 191 X509_STORE *store_ctx; /* who owns us */
192 }; 192 };
193 193
194/* This is a temporary used when processing cert chains. Since the 194/* This is a used when verifying cert chains. Since the
195 * gathering of the cert chain can take some time (and have to be 195 * gathering of the cert chain can take some time (and have to be
196 * 'retried', this needs to be kept and passed around. */ 196 * 'retried', this needs to be kept and passed around. */
197struct x509_store_state_st /* X509_STORE_CTX */ 197struct x509_store_ctx_st /* X509_STORE_CTX */
198 { 198 {
199 X509_STORE *ctx; 199 X509_STORE *ctx;
200 int current_method; /* used when looking up certs */ 200 int current_method; /* used when looking up certs */
@@ -204,6 +204,16 @@ struct x509_store_state_st /* X509_STORE_CTX */
204 STACK_OF(X509) *untrusted; /* chain of X509s - untrusted - passed in */ 204 STACK_OF(X509) *untrusted; /* chain of X509s - untrusted - passed in */
205 int purpose; /* purpose to check untrusted certificates */ 205 int purpose; /* purpose to check untrusted certificates */
206 int trust; /* trust setting to check */ 206 int trust; /* trust setting to check */
207 time_t check_time; /* time to make verify at */
208 unsigned long flags; /* Various verify flags */
209 void *other_ctx; /* Other info for use with get_issuer() */
210
211 /* Callbacks for various operations */
212 int (*verify)(X509_STORE_CTX *ctx); /* called to verify a certificate */
213 int (*verify_cb)(int ok,X509_STORE_CTX *ctx); /* error callback */
214 int (*get_issuer)(X509 **issuer, X509_STORE_CTX *ctx, X509 *x); /* get issuers cert from ctx */
215 int (*check_issued)(X509_STORE_CTX *ctx, X509 *x, X509 *issuer); /* check issued */
216 int (*cleanup)(X509_STORE_CTX *ctx);
207 217
208 /* The following is built up */ 218 /* The following is built up */
209 int depth; /* how far to go looking up certs */ 219 int depth; /* how far to go looking up certs */
@@ -215,6 +225,7 @@ struct x509_store_state_st /* X509_STORE_CTX */
215 int error_depth; 225 int error_depth;
216 int error; 226 int error;
217 X509 *current_cert; 227 X509 *current_cert;
228 X509 *current_issuer; /* cert currently being tested as valid issuer */
218 229
219 CRYPTO_EX_DATA ex_data; 230 CRYPTO_EX_DATA ex_data;
220 }; 231 };
@@ -265,10 +276,20 @@ struct x509_store_state_st /* X509_STORE_CTX */
265#define X509_V_ERR_INVALID_PURPOSE 26 276#define X509_V_ERR_INVALID_PURPOSE 26
266#define X509_V_ERR_CERT_UNTRUSTED 27 277#define X509_V_ERR_CERT_UNTRUSTED 27
267#define X509_V_ERR_CERT_REJECTED 28 278#define X509_V_ERR_CERT_REJECTED 28
279/* These are 'informational' when looking for issuer cert */
280#define X509_V_ERR_SUBJECT_ISSUER_MISMATCH 29
281#define X509_V_ERR_AKID_SKID_MISMATCH 30
282#define X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH 31
283#define X509_V_ERR_KEYUSAGE_NO_CERTSIGN 32
268 284
269/* The application is not happy */ 285/* The application is not happy */
270#define X509_V_ERR_APPLICATION_VERIFICATION 50 286#define X509_V_ERR_APPLICATION_VERIFICATION 50
271 287
288/* Certificate verify flags */
289
290#define X509_V_FLAG_CB_ISSUER_CHECK 0x1 /* Send issuer+subject checks to verify_cb */
291#define X509_V_FLAG_USE_CHECK_TIME 0x2 /* Use check time instead of current time */
292
272 /* These functions are being redefined in another directory, 293 /* These functions are being redefined in another directory,
273 and clash when the linker is case-insensitive, so let's 294 and clash when the linker is case-insensitive, so let's
274 hide them a little, by giving them an extra 'o' at the 295 hide them a little, by giving them an extra 'o' at the
@@ -284,18 +305,23 @@ struct x509_store_state_st /* X509_STORE_CTX */
284#define X509v3_add_standard_extensions oX509v3_add_standard_extensions 305#define X509v3_add_standard_extensions oX509v3_add_standard_extensions
285#endif 306#endif
286 307
287#ifdef HEADER_LHASH_H 308int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type,
288X509_OBJECT *X509_OBJECT_retrieve_by_subject(LHASH *h,int type,X509_NAME *name); 309 X509_NAME *name);
289#endif 310X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h,int type,X509_NAME *name);
311X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, X509_OBJECT *x);
290void X509_OBJECT_up_ref_count(X509_OBJECT *a); 312void X509_OBJECT_up_ref_count(X509_OBJECT *a);
291void X509_OBJECT_free_contents(X509_OBJECT *a); 313void X509_OBJECT_free_contents(X509_OBJECT *a);
292X509_STORE *X509_STORE_new(void ); 314X509_STORE *X509_STORE_new(void );
293void X509_STORE_free(X509_STORE *v); 315void X509_STORE_free(X509_STORE *v);
294 316
295X509_STORE_CTX *X509_STORE_CTX_new(void); 317X509_STORE_CTX *X509_STORE_CTX_new(void);
318
319int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x);
320
296void X509_STORE_CTX_free(X509_STORE_CTX *ctx); 321void X509_STORE_CTX_free(X509_STORE_CTX *ctx);
297void X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, 322void X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store,
298 X509 *x509, STACK_OF(X509) *chain); 323 X509 *x509, STACK_OF(X509) *chain);
324void X509_STORE_CTX_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk);
299void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx); 325void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx);
300 326
301X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m); 327X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m);
@@ -354,6 +380,8 @@ int X509_STORE_CTX_set_purpose(X509_STORE_CTX *ctx, int purpose);
354int X509_STORE_CTX_set_trust(X509_STORE_CTX *ctx, int trust); 380int X509_STORE_CTX_set_trust(X509_STORE_CTX *ctx, int trust);
355int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose, 381int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose,
356 int purpose, int trust); 382 int purpose, int trust);
383void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, long flags);
384void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, long flags, time_t t);
357 385
358#ifdef __cplusplus 386#ifdef __cplusplus
359} 387}