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.h67
1 files changed, 42 insertions, 25 deletions
diff --git a/src/lib/libcrypto/x509/x509_vfy.h b/src/lib/libcrypto/x509/x509_vfy.h
index e289d5309a..f0be21f452 100644
--- a/src/lib/libcrypto/x509/x509_vfy.h
+++ b/src/lib/libcrypto/x509/x509_vfy.h
@@ -65,11 +65,12 @@
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#ifndef NO_LHASH 68#ifndef OPENSSL_NO_LHASH
69#include <openssl/lhash.h> 69#include <openssl/lhash.h>
70#endif 70#endif
71#include <openssl/bio.h> 71#include <openssl/bio.h>
72#include <openssl/crypto.h> 72#include <openssl/crypto.h>
73#include <openssl/symhacks.h>
73 74
74#ifdef __cplusplus 75#ifdef __cplusplus
75extern "C" { 76extern "C" {
@@ -154,12 +155,10 @@ typedef struct x509_lookup_method_st
154 X509_OBJECT *ret); 155 X509_OBJECT *ret);
155 } X509_LOOKUP_METHOD; 156 } X509_LOOKUP_METHOD;
156 157
157typedef struct x509_store_ctx_st X509_STORE_CTX;
158
159/* This is used to hold everything. It is used for all certificate 158/* This is used to hold everything. It is used for all certificate
160 * validation. Once we have a certificate chain, the 'verify' 159 * validation. Once we have a certificate chain, the 'verify'
161 * function is then called to actually check the cert chain. */ 160 * function is then called to actually check the cert chain. */
162typedef struct x509_store_st 161struct x509_store_st
163 { 162 {
164 /* The following is a cache of trusted certs */ 163 /* The following is a cache of trusted certs */
165 int cache; /* if true, stash any hits */ 164 int cache; /* if true, stash any hits */
@@ -167,13 +166,29 @@ typedef struct x509_store_st
167 166
168 /* These are external lookup methods */ 167 /* These are external lookup methods */
169 STACK_OF(X509_LOOKUP) *get_cert_methods; 168 STACK_OF(X509_LOOKUP) *get_cert_methods;
169
170 /* The following fields are not used by X509_STORE but are
171 * inherited by X509_STORE_CTX when it is initialised.
172 */
173
174 unsigned long flags; /* Various verify flags */
175 int purpose;
176 int trust;
177 /* Callbacks for various operations */
170 int (*verify)(X509_STORE_CTX *ctx); /* called to verify a certificate */ 178 int (*verify)(X509_STORE_CTX *ctx); /* called to verify a certificate */
171 int (*verify_cb)(int ok,X509_STORE_CTX *ctx); /* error callback */ 179 int (*verify_cb)(int ok,X509_STORE_CTX *ctx); /* error callback */
180 int (*get_issuer)(X509 **issuer, X509_STORE_CTX *ctx, X509 *x); /* get issuers cert from ctx */
181 int (*check_issued)(X509_STORE_CTX *ctx, X509 *x, X509 *issuer); /* check issued */
182 int (*check_revocation)(X509_STORE_CTX *ctx); /* Check revocation status of chain */
183 int (*get_crl)(X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x); /* retrieve CRL */
184 int (*check_crl)(X509_STORE_CTX *ctx, X509_CRL *crl); /* Check CRL validity */
185 int (*cert_crl)(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x); /* Check certificate against CRL */
186 int (*cleanup)(X509_STORE_CTX *ctx);
172 187
173 CRYPTO_EX_DATA ex_data; 188 CRYPTO_EX_DATA ex_data;
174 int references; 189 int references;
175 int depth; /* how deep to look (still unused -- X509_STORE_CTX's depth is used) */ 190 int depth; /* how deep to look (still unused -- X509_STORE_CTX's depth is used) */
176 } X509_STORE; 191 } /* X509_STORE */;
177 192
178#define X509_STORE_set_depth(ctx,d) ((ctx)->depth=(d)) 193#define X509_STORE_set_depth(ctx,d) ((ctx)->depth=(d))
179 194
@@ -189,7 +204,7 @@ struct x509_lookup_st
189 char *method_data; /* method data */ 204 char *method_data; /* method data */
190 205
191 X509_STORE *store_ctx; /* who owns us */ 206 X509_STORE *store_ctx; /* who owns us */
192 }; 207 } /* X509_LOOKUP */;
193 208
194/* This is a used when verifying cert chains. Since the 209/* This is a used when verifying cert chains. Since the
195 * gathering of the cert chain can take some time (and have to be 210 * gathering of the cert chain can take some time (and have to be
@@ -213,6 +228,10 @@ struct x509_store_ctx_st /* X509_STORE_CTX */
213 int (*verify_cb)(int ok,X509_STORE_CTX *ctx); /* error callback */ 228 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 */ 229 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 */ 230 int (*check_issued)(X509_STORE_CTX *ctx, X509 *x, X509 *issuer); /* check issued */
231 int (*check_revocation)(X509_STORE_CTX *ctx); /* Check revocation status of chain */
232 int (*get_crl)(X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x); /* retrieve CRL */
233 int (*check_crl)(X509_STORE_CTX *ctx, X509_CRL *crl); /* Check CRL validity */
234 int (*cert_crl)(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x); /* Check certificate against CRL */
216 int (*cleanup)(X509_STORE_CTX *ctx); 235 int (*cleanup)(X509_STORE_CTX *ctx);
217 236
218 /* The following is built up */ 237 /* The following is built up */
@@ -226,9 +245,10 @@ struct x509_store_ctx_st /* X509_STORE_CTX */
226 int error; 245 int error;
227 X509 *current_cert; 246 X509 *current_cert;
228 X509 *current_issuer; /* cert currently being tested as valid issuer */ 247 X509 *current_issuer; /* cert currently being tested as valid issuer */
248 X509_CRL *current_crl; /* current CRL */
229 249
230 CRYPTO_EX_DATA ex_data; 250 CRYPTO_EX_DATA ex_data;
231 }; 251 } /* X509_STORE_CTX */;
232 252
233#define X509_STORE_CTX_set_depth(ctx,d) ((ctx)->depth=(d)) 253#define X509_STORE_CTX_set_depth(ctx,d) ((ctx)->depth=(d))
234 254
@@ -282,6 +302,9 @@ struct x509_store_ctx_st /* X509_STORE_CTX */
282#define X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH 31 302#define X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH 31
283#define X509_V_ERR_KEYUSAGE_NO_CERTSIGN 32 303#define X509_V_ERR_KEYUSAGE_NO_CERTSIGN 32
284 304
305#define X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER 33
306#define X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION 34
307
285/* The application is not happy */ 308/* The application is not happy */
286#define X509_V_ERR_APPLICATION_VERIFICATION 50 309#define X509_V_ERR_APPLICATION_VERIFICATION 50
287 310
@@ -289,21 +312,9 @@ struct x509_store_ctx_st /* X509_STORE_CTX */
289 312
290#define X509_V_FLAG_CB_ISSUER_CHECK 0x1 /* Send issuer+subject checks to verify_cb */ 313#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 */ 314#define X509_V_FLAG_USE_CHECK_TIME 0x2 /* Use check time instead of current time */
292 315#define X509_V_FLAG_CRL_CHECK 0x4 /* Lookup CRLs */
293 /* These functions are being redefined in another directory, 316#define X509_V_FLAG_CRL_CHECK_ALL 0x8 /* Lookup CRLs for whole chain */
294 and clash when the linker is case-insensitive, so let's 317#define X509_V_FLAG_IGNORE_CRITICAL 0x10 /* Ignore unhandled critical extensions */
295 hide them a little, by giving them an extra 'o' at the
296 beginning of the name... */
297#ifdef VMS
298#undef X509v3_cleanup_extensions
299#define X509v3_cleanup_extensions oX509v3_cleanup_extensions
300#undef X509v3_add_extension
301#define X509v3_add_extension oX509v3_add_extension
302#undef X509v3_add_netscape_extensions
303#define X509v3_add_netscape_extensions oX509v3_add_netscape_extensions
304#undef X509v3_add_standard_extensions
305#define X509v3_add_standard_extensions oX509v3_add_standard_extensions
306#endif
307 318
308int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type, 319int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type,
309 X509_NAME *name); 320 X509_NAME *name);
@@ -314,12 +325,16 @@ void X509_OBJECT_free_contents(X509_OBJECT *a);
314X509_STORE *X509_STORE_new(void ); 325X509_STORE *X509_STORE_new(void );
315void X509_STORE_free(X509_STORE *v); 326void X509_STORE_free(X509_STORE *v);
316 327
328void X509_STORE_set_flags(X509_STORE *ctx, long flags);
329int X509_STORE_set_purpose(X509_STORE *ctx, int purpose);
330int X509_STORE_set_trust(X509_STORE *ctx, int trust);
331
317X509_STORE_CTX *X509_STORE_CTX_new(void); 332X509_STORE_CTX *X509_STORE_CTX_new(void);
318 333
319int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x); 334int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x);
320 335
321void X509_STORE_CTX_free(X509_STORE_CTX *ctx); 336void X509_STORE_CTX_free(X509_STORE_CTX *ctx);
322void X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, 337int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store,
323 X509 *x509, STACK_OF(X509) *chain); 338 X509 *x509, STACK_OF(X509) *chain);
324void X509_STORE_CTX_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk); 339void X509_STORE_CTX_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk);
325void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx); 340void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx);
@@ -338,7 +353,7 @@ int X509_STORE_get_by_subject(X509_STORE_CTX *vs,int type,X509_NAME *name,
338int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, 353int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc,
339 long argl, char **ret); 354 long argl, char **ret);
340 355
341#ifndef NO_STDIO 356#ifndef OPENSSL_NO_STDIO
342int X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type); 357int X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type);
343int X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type); 358int X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type);
344int X509_load_cert_crl_file(X509_LOOKUP *ctx, const char *file, int type); 359int X509_load_cert_crl_file(X509_LOOKUP *ctx, const char *file, int type);
@@ -358,7 +373,7 @@ int X509_LOOKUP_by_alias(X509_LOOKUP *ctx, int type, char *str,
358 int len, X509_OBJECT *ret); 373 int len, X509_OBJECT *ret);
359int X509_LOOKUP_shutdown(X509_LOOKUP *ctx); 374int X509_LOOKUP_shutdown(X509_LOOKUP *ctx);
360 375
361#ifndef NO_STDIO 376#ifndef OPENSSL_NO_STDIO
362int X509_STORE_load_locations (X509_STORE *ctx, 377int X509_STORE_load_locations (X509_STORE *ctx,
363 const char *file, const char *dir); 378 const char *file, const char *dir);
364int X509_STORE_set_default_paths(X509_STORE *ctx); 379int X509_STORE_set_default_paths(X509_STORE *ctx);
@@ -382,6 +397,8 @@ int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose,
382 int purpose, int trust); 397 int purpose, int trust);
383void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, long flags); 398void 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); 399void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, long flags, time_t t);
400void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx,
401 int (*verify_cb)(int, X509_STORE_CTX *));
385 402
386#ifdef __cplusplus 403#ifdef __cplusplus
387} 404}