epoc32/include/stdapis/openssl/x509_vfy.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 0 061f57f2323e
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
/* crypto/x509/x509_vfy.h */
williamr@2
     2
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
williamr@2
     3
 * All rights reserved.
williamr@2
     4
 *
williamr@2
     5
 * This package is an SSL implementation written
williamr@2
     6
 * by Eric Young (eay@cryptsoft.com).
williamr@2
     7
 * The implementation was written so as to conform with Netscapes SSL.
williamr@2
     8
 * 
williamr@2
     9
 * This library is free for commercial and non-commercial use as long as
williamr@2
    10
 * the following conditions are aheared to.  The following conditions
williamr@2
    11
 * apply to all code found in this distribution, be it the RC4, RSA,
williamr@2
    12
 * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
williamr@2
    13
 * included with this distribution is covered by the same copyright terms
williamr@2
    14
 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
williamr@2
    15
 * 
williamr@2
    16
 * Copyright remains Eric Young's, and as such any Copyright notices in
williamr@2
    17
 * the code are not to be removed.
williamr@2
    18
 * If this package is used in a product, Eric Young should be given attribution
williamr@2
    19
 * as the author of the parts of the library used.
williamr@2
    20
 * This can be in the form of a textual message at program startup or
williamr@2
    21
 * in documentation (online or textual) provided with the package.
williamr@2
    22
 * 
williamr@2
    23
 * Redistribution and use in source and binary forms, with or without
williamr@2
    24
 * modification, are permitted provided that the following conditions
williamr@2
    25
 * are met:
williamr@2
    26
 * 1. Redistributions of source code must retain the copyright
williamr@2
    27
 *    notice, this list of conditions and the following disclaimer.
williamr@2
    28
 * 2. Redistributions in binary form must reproduce the above copyright
williamr@2
    29
 *    notice, this list of conditions and the following disclaimer in the
williamr@2
    30
 *    documentation and/or other materials provided with the distribution.
williamr@2
    31
 * 3. All advertising materials mentioning features or use of this software
williamr@2
    32
 *    must display the following acknowledgement:
williamr@2
    33
 *    "This product includes cryptographic software written by
williamr@2
    34
 *     Eric Young (eay@cryptsoft.com)"
williamr@2
    35
 *    The word 'cryptographic' can be left out if the rouines from the library
williamr@2
    36
 *    being used are not cryptographic related :-).
williamr@2
    37
 * 4. If you include any Windows specific code (or a derivative thereof) from 
williamr@2
    38
 *    the apps directory (application code) you must include an acknowledgement:
williamr@2
    39
 *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
williamr@2
    40
 * 
williamr@2
    41
 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
williamr@2
    42
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
williamr@2
    43
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
williamr@2
    44
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
williamr@2
    45
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
williamr@2
    46
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
williamr@2
    47
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
williamr@2
    48
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
williamr@2
    49
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
williamr@2
    50
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
williamr@2
    51
 * SUCH DAMAGE.
williamr@2
    52
 * 
williamr@2
    53
 * The licence and distribution terms for any publically available version or
williamr@2
    54
 * derivative of this code cannot be changed.  i.e. this code cannot simply be
williamr@2
    55
 * copied and put under another distribution licence
williamr@2
    56
 * [including the GNU Public Licence.]
williamr@2
    57
 */
williamr@2
    58
/*
williamr@2
    59
 © Portions copyright (c) 2006 Nokia Corporation.  All rights reserved.
williamr@2
    60
 */
williamr@2
    61
williamr@2
    62
#ifndef HEADER_X509_H
williamr@2
    63
williamr@2
    64
#if (defined(__SYMBIAN32__) && !defined(SYMBIAN))
williamr@2
    65
#define SYMBIAN
williamr@2
    66
#endif
williamr@2
    67
williamr@2
    68
#ifdef SYMBIAN
williamr@2
    69
#include <e32def.h>
williamr@2
    70
#endif
williamr@2
    71
#include <openssl/x509.h>
williamr@2
    72
/* openssl/x509.h ends up #include-ing this file at about the only
williamr@2
    73
 * appropriate moment. */
williamr@2
    74
#endif
williamr@2
    75
williamr@2
    76
#ifndef HEADER_X509_VFY_H
williamr@2
    77
#define HEADER_X509_VFY_H
williamr@2
    78
williamr@2
    79
#include <openssl/opensslconf.h>
williamr@2
    80
#ifndef OPENSSL_NO_LHASH
williamr@2
    81
#include <openssl/lhash.h>
williamr@2
    82
#endif
williamr@2
    83
#include <openssl/bio.h>
williamr@2
    84
#include <openssl/crypto.h>
williamr@2
    85
#include <openssl/symhacks.h>
williamr@2
    86
williamr@2
    87
#ifdef  __cplusplus
williamr@2
    88
extern "C" {
williamr@2
    89
#endif
williamr@2
    90
williamr@2
    91
/* Outer object */
williamr@2
    92
typedef struct x509_hash_dir_st
williamr@2
    93
	{
williamr@2
    94
	int num_dirs;
williamr@2
    95
	char **dirs;
williamr@2
    96
	int *dirs_type;
williamr@2
    97
	int num_dirs_alloced;
williamr@2
    98
	} X509_HASH_DIR_CTX;
williamr@2
    99
williamr@2
   100
typedef struct x509_file_st
williamr@2
   101
	{
williamr@2
   102
	int num_paths;	/* number of paths to files or directories */
williamr@2
   103
	int num_alloced;
williamr@2
   104
	char **paths;	/* the list of paths or directories */
williamr@2
   105
	int *path_type;
williamr@2
   106
	} X509_CERT_FILE_CTX;
williamr@2
   107
williamr@2
   108
/*******************************/
williamr@2
   109
/*
williamr@2
   110
SSL_CTX -> X509_STORE    
williamr@2
   111
		-> X509_LOOKUP
williamr@2
   112
			->X509_LOOKUP_METHOD
williamr@2
   113
		-> X509_LOOKUP
williamr@2
   114
			->X509_LOOKUP_METHOD
williamr@2
   115
 
williamr@2
   116
SSL	-> X509_STORE_CTX
williamr@2
   117
		->X509_STORE    
williamr@2
   118
williamr@2
   119
The X509_STORE holds the tables etc for verification stuff.
williamr@2
   120
A X509_STORE_CTX is used while validating a single certificate.
williamr@2
   121
The X509_STORE has X509_LOOKUPs for looking up certs.
williamr@2
   122
The X509_STORE then calls a function to actually verify the
williamr@2
   123
certificate chain.
williamr@2
   124
*/
williamr@2
   125
williamr@2
   126
#define X509_LU_RETRY		-1
williamr@2
   127
#define X509_LU_FAIL		0
williamr@2
   128
#define X509_LU_X509		1
williamr@2
   129
#define X509_LU_CRL		2
williamr@2
   130
#define X509_LU_PKEY		3
williamr@2
   131
williamr@2
   132
typedef struct x509_object_st
williamr@2
   133
	{
williamr@2
   134
	/* one of the above types */
williamr@2
   135
	int type;
williamr@2
   136
	union	{
williamr@2
   137
		char *ptr;
williamr@2
   138
		X509 *x509;
williamr@2
   139
		X509_CRL *crl;
williamr@2
   140
		EVP_PKEY *pkey;
williamr@2
   141
		} data;
williamr@2
   142
	} X509_OBJECT;
williamr@2
   143
williamr@2
   144
typedef struct x509_lookup_st X509_LOOKUP;
williamr@2
   145
williamr@2
   146
DECLARE_STACK_OF(X509_LOOKUP)
williamr@2
   147
DECLARE_STACK_OF(X509_OBJECT)
williamr@2
   148
williamr@2
   149
/* This is a static that defines the function interface */
williamr@2
   150
typedef struct x509_lookup_method_st
williamr@2
   151
	{
williamr@2
   152
	const char *name;
williamr@2
   153
	int (*new_item)(X509_LOOKUP *ctx);
williamr@2
   154
	void (*free)(X509_LOOKUP *ctx);
williamr@2
   155
	int (*init)(X509_LOOKUP *ctx);
williamr@2
   156
	int (*shutdown)(X509_LOOKUP *ctx);
williamr@2
   157
	int (*ctrl)(X509_LOOKUP *ctx,int cmd,const char *argc,long argl,
williamr@2
   158
			char **ret);
williamr@2
   159
	int (*get_by_subject)(X509_LOOKUP *ctx,int type,X509_NAME *name,
williamr@2
   160
			      X509_OBJECT *ret);
williamr@2
   161
	int (*get_by_issuer_serial)(X509_LOOKUP *ctx,int type,X509_NAME *name,
williamr@2
   162
				    ASN1_INTEGER *serial,X509_OBJECT *ret);
williamr@2
   163
	int (*get_by_fingerprint)(X509_LOOKUP *ctx,int type,
williamr@2
   164
				  unsigned char *bytes,int len,
williamr@2
   165
				  X509_OBJECT *ret);
williamr@2
   166
	int (*get_by_alias)(X509_LOOKUP *ctx,int type,char *str,int len,
williamr@2
   167
			    X509_OBJECT *ret);
williamr@2
   168
	} X509_LOOKUP_METHOD;
williamr@2
   169
williamr@2
   170
/* This structure hold all parameters associated with a verify operation
williamr@2
   171
 * by including an X509_VERIFY_PARAM structure in related structures the
williamr@2
   172
 * parameters used can be customized
williamr@2
   173
 */
williamr@2
   174
williamr@2
   175
typedef struct X509_VERIFY_PARAM_st
williamr@2
   176
	{
williamr@2
   177
	char *name;
williamr@2
   178
	time_t check_time;	/* Time to use */
williamr@2
   179
	unsigned long inh_flags; /* Inheritance flags */
williamr@2
   180
	unsigned long flags;	/* Various verify flags */
williamr@2
   181
	int purpose;		/* purpose to check untrusted certificates */
williamr@2
   182
	int trust;		/* trust setting to check */
williamr@2
   183
	int depth;		/* Verify depth */
williamr@2
   184
	STACK_OF(ASN1_OBJECT) *policies;	/* Permissible policies */
williamr@2
   185
	} X509_VERIFY_PARAM;
williamr@2
   186
williamr@2
   187
DECLARE_STACK_OF(X509_VERIFY_PARAM)
williamr@2
   188
williamr@2
   189
/* This is used to hold everything.  It is used for all certificate
williamr@2
   190
 * validation.  Once we have a certificate chain, the 'verify'
williamr@2
   191
 * function is then called to actually check the cert chain. */
williamr@2
   192
struct x509_store_st
williamr@2
   193
	{
williamr@2
   194
	/* The following is a cache of trusted certs */
williamr@2
   195
	int cache; 	/* if true, stash any hits */
williamr@2
   196
	STACK_OF(X509_OBJECT) *objs;	/* Cache of all objects */
williamr@2
   197
williamr@2
   198
	/* These are external lookup methods */
williamr@2
   199
	STACK_OF(X509_LOOKUP) *get_cert_methods;
williamr@2
   200
williamr@2
   201
	X509_VERIFY_PARAM *param;
williamr@2
   202
williamr@2
   203
	/* Callbacks for various operations */
williamr@2
   204
	int (*verify)(X509_STORE_CTX *ctx);	/* called to verify a certificate */
williamr@2
   205
	int (*verify_cb)(int ok,X509_STORE_CTX *ctx);	/* error callback */
williamr@2
   206
	int (*get_issuer)(X509 **issuer, X509_STORE_CTX *ctx, X509 *x);	/* get issuers cert from ctx */
williamr@2
   207
	int (*check_issued)(X509_STORE_CTX *ctx, X509 *x, X509 *issuer); /* check issued */
williamr@2
   208
	int (*check_revocation)(X509_STORE_CTX *ctx); /* Check revocation status of chain */
williamr@2
   209
	int (*get_crl)(X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x); /* retrieve CRL */
williamr@2
   210
	int (*check_crl)(X509_STORE_CTX *ctx, X509_CRL *crl); /* Check CRL validity */
williamr@2
   211
	int (*cert_crl)(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x); /* Check certificate against CRL */
williamr@2
   212
	int (*cleanup)(X509_STORE_CTX *ctx);
williamr@2
   213
williamr@2
   214
	CRYPTO_EX_DATA ex_data;
williamr@2
   215
	int references;
williamr@2
   216
	} /* X509_STORE */;
williamr@2
   217
williamr@2
   218
int X509_STORE_set_depth(X509_STORE *store, int depth);
williamr@2
   219
williamr@2
   220
#define X509_STORE_set_verify_cb_func(ctx,func) ((ctx)->verify_cb=(func))
williamr@2
   221
#define X509_STORE_set_verify_func(ctx,func)	((ctx)->verify=(func))
williamr@2
   222
williamr@2
   223
/* This is the functions plus an instance of the local variables. */
williamr@2
   224
struct x509_lookup_st
williamr@2
   225
	{
williamr@2
   226
	int init;			/* have we been started */
williamr@2
   227
	int skip;			/* don't use us. */
williamr@2
   228
	X509_LOOKUP_METHOD *method;	/* the functions */
williamr@2
   229
	char *method_data;		/* method data */
williamr@2
   230
williamr@2
   231
	X509_STORE *store_ctx;	/* who owns us */
williamr@2
   232
	} /* X509_LOOKUP */;
williamr@2
   233
williamr@2
   234
/* This is a used when verifying cert chains.  Since the
williamr@2
   235
 * gathering of the cert chain can take some time (and have to be
williamr@2
   236
 * 'retried', this needs to be kept and passed around. */
williamr@2
   237
struct x509_store_ctx_st      /* X509_STORE_CTX */
williamr@2
   238
	{
williamr@2
   239
	X509_STORE *ctx;
williamr@2
   240
	int current_method;	/* used when looking up certs */
williamr@2
   241
williamr@2
   242
	/* The following are set by the caller */
williamr@2
   243
	X509 *cert;		/* The cert to check */
williamr@2
   244
	STACK_OF(X509) *untrusted;	/* chain of X509s - untrusted - passed in */
williamr@2
   245
	STACK_OF(X509_CRL) *crls;	/* set of CRLs passed in */
williamr@2
   246
williamr@2
   247
	X509_VERIFY_PARAM *param;
williamr@2
   248
	void *other_ctx;	/* Other info for use with get_issuer() */
williamr@2
   249
williamr@2
   250
	/* Callbacks for various operations */
williamr@2
   251
	int (*verify)(X509_STORE_CTX *ctx);	/* called to verify a certificate */
williamr@2
   252
	int (*verify_cb)(int ok,X509_STORE_CTX *ctx);		/* error callback */
williamr@2
   253
	int (*get_issuer)(X509 **issuer, X509_STORE_CTX *ctx, X509 *x);	/* get issuers cert from ctx */
williamr@2
   254
	int (*check_issued)(X509_STORE_CTX *ctx, X509 *x, X509 *issuer); /* check issued */
williamr@2
   255
	int (*check_revocation)(X509_STORE_CTX *ctx); /* Check revocation status of chain */
williamr@2
   256
	int (*get_crl)(X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x); /* retrieve CRL */
williamr@2
   257
	int (*check_crl)(X509_STORE_CTX *ctx, X509_CRL *crl); /* Check CRL validity */
williamr@2
   258
	int (*cert_crl)(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x); /* Check certificate against CRL */
williamr@2
   259
	int (*check_policy)(X509_STORE_CTX *ctx);
williamr@2
   260
	int (*cleanup)(X509_STORE_CTX *ctx);
williamr@2
   261
williamr@2
   262
	/* The following is built up */
williamr@2
   263
	int valid;		/* if 0, rebuild chain */
williamr@2
   264
	int last_untrusted;	/* index of last untrusted cert */
williamr@2
   265
	STACK_OF(X509) *chain; 		/* chain of X509s - built up and trusted */
williamr@2
   266
	X509_POLICY_TREE *tree;	/* Valid policy tree */
williamr@2
   267
williamr@2
   268
	int explicit_policy;	/* Require explicit policy value */
williamr@2
   269
williamr@2
   270
	/* When something goes wrong, this is why */
williamr@2
   271
	int error_depth;
williamr@2
   272
	int error;
williamr@2
   273
	X509 *current_cert;
williamr@2
   274
	X509 *current_issuer;	/* cert currently being tested as valid issuer */
williamr@2
   275
	X509_CRL *current_crl;	/* current CRL */
williamr@2
   276
williamr@2
   277
	CRYPTO_EX_DATA ex_data;
williamr@2
   278
	} /* X509_STORE_CTX */;
williamr@2
   279
williamr@2
   280
IMPORT_C void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth);
williamr@2
   281
williamr@2
   282
#define X509_STORE_CTX_set_app_data(ctx,data) \
williamr@2
   283
	X509_STORE_CTX_set_ex_data(ctx,0,data)
williamr@2
   284
#define X509_STORE_CTX_get_app_data(ctx) \
williamr@2
   285
	X509_STORE_CTX_get_ex_data(ctx,0)
williamr@2
   286
williamr@2
   287
#define X509_L_FILE_LOAD	1
williamr@2
   288
#define X509_L_ADD_DIR		2
williamr@2
   289
williamr@2
   290
#define X509_LOOKUP_load_file(x,name,type) \
williamr@2
   291
		X509_LOOKUP_ctrl((x),X509_L_FILE_LOAD,(name),(long)(type),NULL)
williamr@2
   292
williamr@2
   293
#define X509_LOOKUP_add_dir(x,name,type) \
williamr@2
   294
		X509_LOOKUP_ctrl((x),X509_L_ADD_DIR,(name),(long)(type),NULL)
williamr@2
   295
williamr@2
   296
#define		X509_V_OK					0
williamr@2
   297
/* illegal error (for uninitialized values, to avoid X509_V_OK): 1 */
williamr@2
   298
williamr@2
   299
#define		X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT		2
williamr@2
   300
#define		X509_V_ERR_UNABLE_TO_GET_CRL			3
williamr@2
   301
#define		X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE	4
williamr@2
   302
#define		X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE	5
williamr@2
   303
#define		X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY	6
williamr@2
   304
#define		X509_V_ERR_CERT_SIGNATURE_FAILURE		7
williamr@2
   305
#define		X509_V_ERR_CRL_SIGNATURE_FAILURE		8
williamr@2
   306
#define		X509_V_ERR_CERT_NOT_YET_VALID			9
williamr@2
   307
#define		X509_V_ERR_CERT_HAS_EXPIRED			10
williamr@2
   308
#define		X509_V_ERR_CRL_NOT_YET_VALID			11
williamr@2
   309
#define		X509_V_ERR_CRL_HAS_EXPIRED			12
williamr@2
   310
#define		X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD	13
williamr@2
   311
#define		X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD	14
williamr@2
   312
#define		X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD	15
williamr@2
   313
#define		X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD	16
williamr@2
   314
#define		X509_V_ERR_OUT_OF_MEM				17
williamr@2
   315
#define		X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT		18
williamr@2
   316
#define		X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN		19
williamr@2
   317
#define		X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY	20
williamr@2
   318
#define		X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE	21
williamr@2
   319
#define		X509_V_ERR_CERT_CHAIN_TOO_LONG			22
williamr@2
   320
#define		X509_V_ERR_CERT_REVOKED				23
williamr@2
   321
#define		X509_V_ERR_INVALID_CA				24
williamr@2
   322
#define		X509_V_ERR_PATH_LENGTH_EXCEEDED			25
williamr@2
   323
#define		X509_V_ERR_INVALID_PURPOSE			26
williamr@2
   324
#define		X509_V_ERR_CERT_UNTRUSTED			27
williamr@2
   325
#define		X509_V_ERR_CERT_REJECTED			28
williamr@2
   326
/* These are 'informational' when looking for issuer cert */
williamr@2
   327
#define		X509_V_ERR_SUBJECT_ISSUER_MISMATCH		29
williamr@2
   328
#define		X509_V_ERR_AKID_SKID_MISMATCH			30
williamr@2
   329
#define		X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH		31
williamr@2
   330
#define		X509_V_ERR_KEYUSAGE_NO_CERTSIGN			32
williamr@2
   331
williamr@2
   332
#define		X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER		33
williamr@2
   333
#define		X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION		34
williamr@2
   334
#define		X509_V_ERR_KEYUSAGE_NO_CRL_SIGN			35
williamr@2
   335
#define		X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION	36
williamr@2
   336
#define		X509_V_ERR_INVALID_NON_CA			37
williamr@2
   337
#define		X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED		38
williamr@2
   338
#define		X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE	39
williamr@2
   339
#define		X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED	40
williamr@2
   340
williamr@2
   341
#define		X509_V_ERR_INVALID_EXTENSION			41
williamr@2
   342
#define		X509_V_ERR_INVALID_POLICY_EXTENSION		42
williamr@2
   343
#define		X509_V_ERR_NO_EXPLICIT_POLICY			43
williamr@2
   344
williamr@2
   345
#define		X509_V_ERR_UNNESTED_RESOURCE			44
williamr@2
   346
williamr@2
   347
/* The application is not happy */
williamr@2
   348
#define		X509_V_ERR_APPLICATION_VERIFICATION		50
williamr@2
   349
williamr@2
   350
/* Certificate verify flags */
williamr@2
   351
williamr@2
   352
/* Send issuer+subject checks to verify_cb */
williamr@2
   353
#define	X509_V_FLAG_CB_ISSUER_CHECK		0x1
williamr@2
   354
/* Use check time instead of current time */
williamr@2
   355
#define	X509_V_FLAG_USE_CHECK_TIME		0x2
williamr@2
   356
/* Lookup CRLs */
williamr@2
   357
#define	X509_V_FLAG_CRL_CHECK			0x4
williamr@2
   358
/* Lookup CRLs for whole chain */
williamr@2
   359
#define	X509_V_FLAG_CRL_CHECK_ALL		0x8
williamr@2
   360
/* Ignore unhandled critical extensions */
williamr@2
   361
#define	X509_V_FLAG_IGNORE_CRITICAL		0x10
williamr@2
   362
/* Disable workarounds for broken certificates */
williamr@2
   363
#define	X509_V_FLAG_X509_STRICT			0x20
williamr@2
   364
/* Enable proxy certificate validation */
williamr@2
   365
#define	X509_V_FLAG_ALLOW_PROXY_CERTS		0x40
williamr@2
   366
/* Enable policy checking */
williamr@2
   367
#define X509_V_FLAG_POLICY_CHECK		0x80
williamr@2
   368
/* Policy variable require-explicit-policy */
williamr@2
   369
#define X509_V_FLAG_EXPLICIT_POLICY		0x100
williamr@2
   370
/* Policy variable inhibit-any-policy */
williamr@2
   371
#define	X509_V_FLAG_INHIBIT_ANY			0x200
williamr@2
   372
/* Policy variable inhibit-policy-mapping */
williamr@2
   373
#define X509_V_FLAG_INHIBIT_MAP			0x400
williamr@2
   374
/* Notify callback that policy is OK */
williamr@2
   375
#define X509_V_FLAG_NOTIFY_POLICY		0x800
williamr@2
   376
williamr@2
   377
#define X509_VP_FLAG_DEFAULT			0x1
williamr@2
   378
#define X509_VP_FLAG_OVERWRITE			0x2
williamr@2
   379
#define X509_VP_FLAG_RESET_FLAGS		0x4
williamr@2
   380
#define X509_VP_FLAG_LOCKED			0x8
williamr@2
   381
#define X509_VP_FLAG_ONCE			0x10
williamr@2
   382
williamr@2
   383
/* Internal use: mask of policy related options */
williamr@2
   384
#define X509_V_FLAG_POLICY_MASK (X509_V_FLAG_POLICY_CHECK \
williamr@2
   385
				| X509_V_FLAG_EXPLICIT_POLICY \
williamr@2
   386
				| X509_V_FLAG_INHIBIT_ANY \
williamr@2
   387
				| X509_V_FLAG_INHIBIT_MAP)
williamr@2
   388
williamr@2
   389
IMPORT_C int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type,
williamr@2
   390
	     X509_NAME *name);
williamr@2
   391
IMPORT_C X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h,int type,X509_NAME *name);
williamr@2
   392
IMPORT_C X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, X509_OBJECT *x);
williamr@2
   393
IMPORT_C void X509_OBJECT_up_ref_count(X509_OBJECT *a);
williamr@2
   394
IMPORT_C void X509_OBJECT_free_contents(X509_OBJECT *a);
williamr@2
   395
IMPORT_C X509_STORE *X509_STORE_new(void );
williamr@2
   396
IMPORT_C void X509_STORE_free(X509_STORE *v);
williamr@2
   397
williamr@2
   398
IMPORT_C int X509_STORE_set_flags(X509_STORE *ctx, unsigned long flags);
williamr@2
   399
IMPORT_C int X509_STORE_set_purpose(X509_STORE *ctx, int purpose);
williamr@2
   400
IMPORT_C int X509_STORE_set_trust(X509_STORE *ctx, int trust);
williamr@2
   401
IMPORT_C int X509_STORE_set1_param(X509_STORE *ctx, X509_VERIFY_PARAM *pm);
williamr@2
   402
williamr@2
   403
IMPORT_C X509_STORE_CTX *X509_STORE_CTX_new(void);
williamr@2
   404
williamr@2
   405
IMPORT_C int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x);
williamr@2
   406
williamr@2
   407
IMPORT_C void X509_STORE_CTX_free(X509_STORE_CTX *ctx);
williamr@2
   408
IMPORT_C int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store,
williamr@2
   409
			 X509 *x509, STACK_OF(X509) *chain);
williamr@2
   410
IMPORT_C void X509_STORE_CTX_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk);
williamr@2
   411
IMPORT_C void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx);
williamr@2
   412
williamr@2
   413
IMPORT_C X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m);
williamr@2
   414
williamr@2
   415
IMPORT_C X509_LOOKUP_METHOD *X509_LOOKUP_hash_dir(void);
williamr@2
   416
IMPORT_C X509_LOOKUP_METHOD *X509_LOOKUP_file(void);
williamr@2
   417
williamr@2
   418
IMPORT_C int X509_STORE_add_cert(X509_STORE *ctx, X509 *x);
williamr@2
   419
IMPORT_C int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x);
williamr@2
   420
williamr@2
   421
IMPORT_C int X509_STORE_get_by_subject(X509_STORE_CTX *vs,int type,X509_NAME *name,
williamr@2
   422
	X509_OBJECT *ret);
williamr@2
   423
williamr@2
   424
IMPORT_C int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc,
williamr@2
   425
	long argl, char **ret);
williamr@2
   426
williamr@2
   427
#ifndef OPENSSL_NO_STDIO
williamr@2
   428
IMPORT_C int X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type);
williamr@2
   429
IMPORT_C int X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type);
williamr@2
   430
IMPORT_C int X509_load_cert_crl_file(X509_LOOKUP *ctx, const char *file, int type);
williamr@2
   431
#endif
williamr@2
   432
williamr@2
   433
williamr@2
   434
IMPORT_C X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method);
williamr@2
   435
IMPORT_C void X509_LOOKUP_free(X509_LOOKUP *ctx);
williamr@2
   436
IMPORT_C int X509_LOOKUP_init(X509_LOOKUP *ctx);
williamr@2
   437
IMPORT_C int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, int type, X509_NAME *name,
williamr@2
   438
	X509_OBJECT *ret);
williamr@2
   439
IMPORT_C int X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, int type, X509_NAME *name,
williamr@2
   440
	ASN1_INTEGER *serial, X509_OBJECT *ret);
williamr@2
   441
IMPORT_C int X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, int type,
williamr@2
   442
	unsigned char *bytes, int len, X509_OBJECT *ret);
williamr@2
   443
IMPORT_C int X509_LOOKUP_by_alias(X509_LOOKUP *ctx, int type, char *str,
williamr@2
   444
	int len, X509_OBJECT *ret);
williamr@2
   445
IMPORT_C int X509_LOOKUP_shutdown(X509_LOOKUP *ctx);
williamr@2
   446
williamr@2
   447
#ifndef OPENSSL_NO_STDIO
williamr@2
   448
IMPORT_C int	X509_STORE_load_locations (X509_STORE *ctx,
williamr@2
   449
		const char *file, const char *dir);
williamr@2
   450
IMPORT_C int	X509_STORE_set_default_paths(X509_STORE *ctx);
williamr@2
   451
#endif
williamr@2
   452
williamr@2
   453
IMPORT_C int X509_STORE_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
williamr@2
   454
	CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
williamr@2
   455
IMPORT_C int	X509_STORE_CTX_set_ex_data(X509_STORE_CTX *ctx,int idx,void *data);
williamr@2
   456
IMPORT_C void *	X509_STORE_CTX_get_ex_data(X509_STORE_CTX *ctx,int idx);
williamr@2
   457
IMPORT_C int	X509_STORE_CTX_get_error(X509_STORE_CTX *ctx);
williamr@2
   458
IMPORT_C void	X509_STORE_CTX_set_error(X509_STORE_CTX *ctx,int s);
williamr@2
   459
IMPORT_C int	X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx);
williamr@2
   460
IMPORT_C X509 *	X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx);
williamr@2
   461
IMPORT_C STACK_OF(X509) *X509_STORE_CTX_get_chain(X509_STORE_CTX *ctx);
williamr@2
   462
IMPORT_C STACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx);
williamr@2
   463
IMPORT_C void	X509_STORE_CTX_set_cert(X509_STORE_CTX *c,X509 *x);
williamr@2
   464
IMPORT_C void	X509_STORE_CTX_set_chain(X509_STORE_CTX *c,STACK_OF(X509) *sk);
williamr@2
   465
IMPORT_C void	X509_STORE_CTX_set0_crls(X509_STORE_CTX *c,STACK_OF(X509_CRL) *sk);
williamr@2
   466
IMPORT_C int X509_STORE_CTX_set_purpose(X509_STORE_CTX *ctx, int purpose);
williamr@2
   467
IMPORT_C int X509_STORE_CTX_set_trust(X509_STORE_CTX *ctx, int trust);
williamr@2
   468
IMPORT_C int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose,
williamr@2
   469
				int purpose, int trust);
williamr@2
   470
IMPORT_C void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, unsigned long flags);
williamr@2
   471
IMPORT_C void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, unsigned long flags,
williamr@2
   472
								time_t t);
williamr@2
   473
IMPORT_C void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx,
williamr@2
   474
				  int (*verify_cb)(int, X509_STORE_CTX *));
williamr@2
   475
  
williamr@2
   476
IMPORT_C X509_POLICY_TREE *X509_STORE_CTX_get0_policy_tree(X509_STORE_CTX *ctx);
williamr@2
   477
IMPORT_C int X509_STORE_CTX_get_explicit_policy(X509_STORE_CTX *ctx);
williamr@2
   478
williamr@2
   479
IMPORT_C X509_VERIFY_PARAM *X509_STORE_CTX_get0_param(X509_STORE_CTX *ctx);
williamr@2
   480
IMPORT_C void X509_STORE_CTX_set0_param(X509_STORE_CTX *ctx, X509_VERIFY_PARAM *param);
williamr@2
   481
IMPORT_C int X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name);
williamr@2
   482
williamr@2
   483
/* X509_VERIFY_PARAM functions */
williamr@2
   484
williamr@2
   485
IMPORT_C X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void);
williamr@2
   486
IMPORT_C void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param);
williamr@2
   487
IMPORT_C int X509_VERIFY_PARAM_inherit(X509_VERIFY_PARAM *to,
williamr@2
   488
						const X509_VERIFY_PARAM *from);
williamr@2
   489
IMPORT_C int X509_VERIFY_PARAM_set1(X509_VERIFY_PARAM *to, 
williamr@2
   490
						const X509_VERIFY_PARAM *from);
williamr@2
   491
IMPORT_C int X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name);
williamr@2
   492
IMPORT_C int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, unsigned long flags);
williamr@2
   493
IMPORT_C int X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param,
williamr@2
   494
							unsigned long flags);
williamr@2
   495
IMPORT_C unsigned long X509_VERIFY_PARAM_get_flags(X509_VERIFY_PARAM *param);
williamr@2
   496
IMPORT_C int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose);
williamr@2
   497
IMPORT_C int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust);
williamr@2
   498
IMPORT_C void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth);
williamr@2
   499
IMPORT_C void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t);
williamr@2
   500
IMPORT_C int X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param,
williamr@2
   501
						ASN1_OBJECT *policy);
williamr@2
   502
IMPORT_C int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param, 
williamr@2
   503
					STACK_OF(ASN1_OBJECT) *policies);
williamr@2
   504
IMPORT_C int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param);
williamr@2
   505
williamr@2
   506
IMPORT_C int X509_VERIFY_PARAM_add0_table(X509_VERIFY_PARAM *param);
williamr@2
   507
IMPORT_C const X509_VERIFY_PARAM *X509_VERIFY_PARAM_lookup(const char *name);
williamr@2
   508
IMPORT_C void X509_VERIFY_PARAM_table_cleanup(void);
williamr@2
   509
williamr@2
   510
IMPORT_C int X509_policy_check(X509_POLICY_TREE **ptree, int *pexplicit_policy,
williamr@2
   511
			STACK_OF(X509) *certs,
williamr@2
   512
			STACK_OF(ASN1_OBJECT) *policy_oids,
williamr@2
   513
			unsigned int flags);
williamr@2
   514
williamr@2
   515
IMPORT_C void X509_policy_tree_free(X509_POLICY_TREE *tree);
williamr@2
   516
williamr@2
   517
IMPORT_C int X509_policy_tree_level_count(const X509_POLICY_TREE *tree);
williamr@2
   518
IMPORT_C X509_POLICY_LEVEL *
williamr@2
   519
	X509_policy_tree_get0_level(const X509_POLICY_TREE *tree, int i);
williamr@2
   520
williamr@2
   521
IMPORT_C STACK_OF(X509_POLICY_NODE) *
williamr@2
   522
	X509_policy_tree_get0_policies(const X509_POLICY_TREE *tree);
williamr@2
   523
williamr@2
   524
IMPORT_C STACK_OF(X509_POLICY_NODE) *
williamr@2
   525
	X509_policy_tree_get0_user_policies(const X509_POLICY_TREE *tree);
williamr@2
   526
williamr@2
   527
IMPORT_C int X509_policy_level_node_count(X509_POLICY_LEVEL *level);
williamr@2
   528
williamr@2
   529
IMPORT_C X509_POLICY_NODE *X509_policy_level_get0_node(X509_POLICY_LEVEL *level, int i);
williamr@2
   530
williamr@2
   531
IMPORT_C const ASN1_OBJECT *X509_policy_node_get0_policy(const X509_POLICY_NODE *node);
williamr@2
   532
williamr@2
   533
IMPORT_C STACK_OF(POLICYQUALINFO) *
williamr@2
   534
	X509_policy_node_get0_qualifiers(const X509_POLICY_NODE *node);
williamr@2
   535
IMPORT_C const X509_POLICY_NODE *
williamr@2
   536
	X509_policy_node_get0_parent(const X509_POLICY_NODE *node);
williamr@2
   537
williamr@2
   538
#ifdef  __cplusplus
williamr@2
   539
}
williamr@2
   540
#endif
williamr@2
   541
#endif
williamr@2
   542