os/ossrv/ssl/libcrypto/src/crypto/store/store.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
/* crypto/store/store.h -*- mode:C; c-file-style: "eay" -*- */
sl@0
     2
/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
sl@0
     3
 * project 2003.
sl@0
     4
 */
sl@0
     5
/* ====================================================================
sl@0
     6
 * Copyright (c) 2003 The OpenSSL Project.  All rights reserved.
sl@0
     7
 *
sl@0
     8
 * Redistribution and use in source and binary forms, with or without
sl@0
     9
 * modification, are permitted provided that the following conditions
sl@0
    10
 * are met:
sl@0
    11
 *
sl@0
    12
 * 1. Redistributions of source code must retain the above copyright
sl@0
    13
 *    notice, this list of conditions and the following disclaimer. 
sl@0
    14
 *
sl@0
    15
 * 2. Redistributions in binary form must reproduce the above copyright
sl@0
    16
 *    notice, this list of conditions and the following disclaimer in
sl@0
    17
 *    the documentation and/or other materials provided with the
sl@0
    18
 *    distribution.
sl@0
    19
 *
sl@0
    20
 * 3. All advertising materials mentioning features or use of this
sl@0
    21
 *    software must display the following acknowledgment:
sl@0
    22
 *    "This product includes software developed by the OpenSSL Project
sl@0
    23
 *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
sl@0
    24
 *
sl@0
    25
 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
sl@0
    26
 *    endorse or promote products derived from this software without
sl@0
    27
 *    prior written permission. For written permission, please contact
sl@0
    28
 *    openssl-core@openssl.org.
sl@0
    29
 *
sl@0
    30
 * 5. Products derived from this software may not be called "OpenSSL"
sl@0
    31
 *    nor may "OpenSSL" appear in their names without prior written
sl@0
    32
 *    permission of the OpenSSL Project.
sl@0
    33
 *
sl@0
    34
 * 6. Redistributions of any form whatsoever must retain the following
sl@0
    35
 *    acknowledgment:
sl@0
    36
 *    "This product includes software developed by the OpenSSL Project
sl@0
    37
 *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
sl@0
    38
 *
sl@0
    39
 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
sl@0
    40
 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
sl@0
    41
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
sl@0
    42
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
sl@0
    43
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
sl@0
    44
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
sl@0
    45
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
sl@0
    46
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
sl@0
    47
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
sl@0
    48
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
sl@0
    49
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
sl@0
    50
 * OF THE POSSIBILITY OF SUCH DAMAGE.
sl@0
    51
 * ====================================================================
sl@0
    52
 *
sl@0
    53
 * This product includes cryptographic software written by Eric Young
sl@0
    54
 * (eay@cryptsoft.com).  This product includes software written by Tim
sl@0
    55
 * Hudson (tjh@cryptsoft.com).
sl@0
    56
 *
sl@0
    57
 */
sl@0
    58
/*
sl@0
    59
 © Portions copyright (c) 2006 Nokia Corporation.  All rights reserved.
sl@0
    60
 */
sl@0
    61
sl@0
    62
#ifndef HEADER_STORE_H
sl@0
    63
#define HEADER_STORE_H
sl@0
    64
#ifdef SYMBIAN
sl@0
    65
#include <e32def.h>
sl@0
    66
#endif
sl@0
    67
#include <openssl/ossl_typ.h>
sl@0
    68
#ifndef OPENSSL_NO_DEPRECATED
sl@0
    69
#include <openssl/evp.h>
sl@0
    70
#include <openssl/bn.h>
sl@0
    71
#include <openssl/x509.h>
sl@0
    72
#endif
sl@0
    73
sl@0
    74
#ifdef  __cplusplus
sl@0
    75
extern "C" {
sl@0
    76
#endif
sl@0
    77
sl@0
    78
/* Already defined in ossl_typ.h */
sl@0
    79
/* typedef struct store_st STORE; */
sl@0
    80
/* typedef struct store_method_st STORE_METHOD; */
sl@0
    81
sl@0
    82
sl@0
    83
/* All the following functions return 0, a negative number or NULL on error.
sl@0
    84
   When everything is fine, they return a positive value or a non-NULL
sl@0
    85
   pointer, all depending on their purpose. */
sl@0
    86
sl@0
    87
/* Creators and destructor.   */
sl@0
    88
IMPORT_C STORE *STORE_new_method(const STORE_METHOD *method);
sl@0
    89
IMPORT_C STORE *STORE_new_engine(ENGINE *engine);
sl@0
    90
IMPORT_C void STORE_free(STORE *ui);
sl@0
    91
sl@0
    92
sl@0
    93
/* Give a user interface parametrised control commands.  This can be used to
sl@0
    94
   send down an integer, a data pointer or a function pointer, as well as
sl@0
    95
   be used to get information from a STORE. */
sl@0
    96
IMPORT_C int STORE_ctrl(STORE *store, int cmd, long i, void *p, void (*f)(void));
sl@0
    97
sl@0
    98
/* A control to set the directory with keys and certificates.  Used by the
sl@0
    99
   built-in directory level method. */
sl@0
   100
#define STORE_CTRL_SET_DIRECTORY	0x0001
sl@0
   101
/* A control to set a file to load.  Used by the built-in file level method. */
sl@0
   102
#define STORE_CTRL_SET_FILE		0x0002
sl@0
   103
/* A control to set a configuration file to load.  Can be used by any method
sl@0
   104
   that wishes to load a configuration file. */
sl@0
   105
#define STORE_CTRL_SET_CONF_FILE	0x0003
sl@0
   106
/* A control to set a the section of the loaded configuration file.  Can be
sl@0
   107
   used by any method that wishes to load a configuration file. */
sl@0
   108
#define STORE_CTRL_SET_CONF_SECTION	0x0004
sl@0
   109
sl@0
   110
sl@0
   111
/* Some methods may use extra data */
sl@0
   112
#define STORE_set_app_data(s,arg)	STORE_set_ex_data(s,0,arg)
sl@0
   113
#define STORE_get_app_data(s)		STORE_get_ex_data(s,0)
sl@0
   114
IMPORT_C int STORE_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
sl@0
   115
	CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
sl@0
   116
IMPORT_C int STORE_set_ex_data(STORE *r,int idx,void *arg);
sl@0
   117
IMPORT_C void *STORE_get_ex_data(STORE *r, int idx);
sl@0
   118
sl@0
   119
/* Use specific methods instead of the built-in one */
sl@0
   120
IMPORT_C const STORE_METHOD *STORE_get_method(STORE *store);
sl@0
   121
IMPORT_C const STORE_METHOD *STORE_set_method(STORE *store, const STORE_METHOD *meth);
sl@0
   122
sl@0
   123
/* The standard OpenSSL methods. */
sl@0
   124
/* This is the in-memory method.  It does everything except revoking and updating,
sl@0
   125
   and is of course volatile.  It's used by other methods that have an in-memory
sl@0
   126
   cache. */
sl@0
   127
IMPORT_C const STORE_METHOD *STORE_Memory(void);
sl@0
   128
#if 0 /* Not yet implemented */
sl@0
   129
/* This is the directory store.  It does everything except revoking and updating,
sl@0
   130
   and uses STORE_Memory() to cache things in memory. */
sl@0
   131
IMPORT_C const STORE_METHOD *STORE_Directory(void);
sl@0
   132
/* This is the file store.  It does everything except revoking and updating,
sl@0
   133
   and uses STORE_Memory() to cache things in memory.  Certificates are added
sl@0
   134
   to it with the store operation, and it will only get cached certificates. */
sl@0
   135
IMPORT_C const STORE_METHOD *STORE_File(void);
sl@0
   136
#endif
sl@0
   137
sl@0
   138
/* Store functions take a type code for the type of data they should store
sl@0
   139
   or fetch */
sl@0
   140
typedef enum STORE_object_types
sl@0
   141
	{
sl@0
   142
	STORE_OBJECT_TYPE_X509_CERTIFICATE=	0x01, /* X509 * */
sl@0
   143
	STORE_OBJECT_TYPE_X509_CRL=		0x02, /* X509_CRL * */
sl@0
   144
	STORE_OBJECT_TYPE_PRIVATE_KEY=		0x03, /* EVP_PKEY * */
sl@0
   145
	STORE_OBJECT_TYPE_PUBLIC_KEY=		0x04, /* EVP_PKEY * */
sl@0
   146
	STORE_OBJECT_TYPE_NUMBER=		0x05, /* BIGNUM * */
sl@0
   147
	STORE_OBJECT_TYPE_ARBITRARY=		0x06, /* BUF_MEM * */
sl@0
   148
	STORE_OBJECT_TYPE_NUM=			0x06  /* The amount of known
sl@0
   149
							 object types */
sl@0
   150
	} STORE_OBJECT_TYPES;
sl@0
   151
/* List of text strings corresponding to the object types. */
sl@0
   152
extern const char * const STORE_object_type_string[STORE_OBJECT_TYPE_NUM+1];
sl@0
   153
sl@0
   154
/* Some store functions take a parameter list.  Those parameters come with
sl@0
   155
   one of the following codes. The comments following the codes below indicate
sl@0
   156
   what type the value should be a pointer to. */
sl@0
   157
typedef enum STORE_params
sl@0
   158
	{
sl@0
   159
	STORE_PARAM_EVP_TYPE=			0x01, /* int */
sl@0
   160
	STORE_PARAM_BITS=			0x02, /* size_t */
sl@0
   161
	STORE_PARAM_KEY_PARAMETERS=		0x03, /* ??? */
sl@0
   162
	STORE_PARAM_KEY_NO_PARAMETERS=		0x04, /* N/A */
sl@0
   163
	STORE_PARAM_AUTH_PASSPHRASE=		0x05, /* char * */
sl@0
   164
	STORE_PARAM_AUTH_KRB5_TICKET=		0x06, /* void * */
sl@0
   165
	STORE_PARAM_TYPE_NUM=			0x06  /* The amount of known
sl@0
   166
							 parameter types */
sl@0
   167
	} STORE_PARAM_TYPES;
sl@0
   168
/* Parameter value sizes.  -1 means unknown, anything else is the required size. */
sl@0
   169
extern const int STORE_param_sizes[STORE_PARAM_TYPE_NUM+1];
sl@0
   170
sl@0
   171
/* Store functions take attribute lists.  Those attributes come with codes.
sl@0
   172
   The comments following the codes below indicate what type the value should
sl@0
   173
   be a pointer to. */
sl@0
   174
typedef enum STORE_attribs
sl@0
   175
	{
sl@0
   176
	STORE_ATTR_END=				0x00,
sl@0
   177
	STORE_ATTR_FRIENDLYNAME=		0x01, /* C string */
sl@0
   178
	STORE_ATTR_KEYID=			0x02, /* 160 bit string (SHA1) */
sl@0
   179
	STORE_ATTR_ISSUERKEYID=			0x03, /* 160 bit string (SHA1) */
sl@0
   180
	STORE_ATTR_SUBJECTKEYID=		0x04, /* 160 bit string (SHA1) */
sl@0
   181
	STORE_ATTR_ISSUERSERIALHASH=		0x05, /* 160 bit string (SHA1) */
sl@0
   182
	STORE_ATTR_ISSUER=			0x06, /* X509_NAME * */
sl@0
   183
	STORE_ATTR_SERIAL=			0x07, /* BIGNUM * */
sl@0
   184
	STORE_ATTR_SUBJECT=			0x08, /* X509_NAME * */
sl@0
   185
	STORE_ATTR_CERTHASH=			0x09, /* 160 bit string (SHA1) */
sl@0
   186
	STORE_ATTR_EMAIL=			0x0a, /* C string */
sl@0
   187
	STORE_ATTR_FILENAME=			0x0b, /* C string */
sl@0
   188
	STORE_ATTR_TYPE_NUM=			0x0b, /* The amount of known
sl@0
   189
							 attribute types */
sl@0
   190
	STORE_ATTR_OR=				0xff  /* This is a special
sl@0
   191
							 separator, which
sl@0
   192
							 expresses the OR
sl@0
   193
							 operation.  */
sl@0
   194
	} STORE_ATTR_TYPES;
sl@0
   195
/* Attribute value sizes.  -1 means unknown, anything else is the required size. */
sl@0
   196
extern const int STORE_attr_sizes[STORE_ATTR_TYPE_NUM+1];
sl@0
   197
sl@0
   198
typedef enum STORE_certificate_status
sl@0
   199
	{
sl@0
   200
	STORE_X509_VALID=			0x00,
sl@0
   201
	STORE_X509_EXPIRED=			0x01,
sl@0
   202
	STORE_X509_SUSPENDED=			0x02,
sl@0
   203
	STORE_X509_REVOKED=			0x03
sl@0
   204
	} STORE_CERTIFICATE_STATUS;
sl@0
   205
sl@0
   206
/* Engine store functions will return a structure that contains all the necessary
sl@0
   207
 * information, including revokation status for certificates.  This is really not
sl@0
   208
 * needed for application authors, as the ENGINE framework functions will extract
sl@0
   209
 * the OpenSSL-specific information when at all possible.  However, for engine
sl@0
   210
 * authors, it's crucial to know this structure.  */
sl@0
   211
typedef struct STORE_OBJECT_st
sl@0
   212
	{
sl@0
   213
	STORE_OBJECT_TYPES type;
sl@0
   214
	union
sl@0
   215
		{
sl@0
   216
		struct
sl@0
   217
			{
sl@0
   218
			STORE_CERTIFICATE_STATUS status;
sl@0
   219
			X509 *certificate;
sl@0
   220
			} x509;
sl@0
   221
		X509_CRL *crl;
sl@0
   222
		EVP_PKEY *key;
sl@0
   223
		BIGNUM *number;
sl@0
   224
		BUF_MEM *arbitrary;
sl@0
   225
		} data;
sl@0
   226
	} STORE_OBJECT;
sl@0
   227
DECLARE_STACK_OF(STORE_OBJECT)
sl@0
   228
STORE_OBJECT *STORE_OBJECT_new(void);
sl@0
   229
void STORE_OBJECT_free(STORE_OBJECT *data);
sl@0
   230
sl@0
   231
sl@0
   232
sl@0
   233
/* The following functions handle the storage. They return 0, a negative number
sl@0
   234
   or NULL on error, anything else on success. */
sl@0
   235
IMPORT_C X509 *STORE_get_certificate(STORE *e, OPENSSL_ITEM attributes[],
sl@0
   236
	OPENSSL_ITEM parameters[]);
sl@0
   237
IMPORT_C int STORE_store_certificate(STORE *e, X509 *data, OPENSSL_ITEM attributes[],
sl@0
   238
	OPENSSL_ITEM parameters[]);
sl@0
   239
IMPORT_C int STORE_modify_certificate(STORE *e, OPENSSL_ITEM search_attributes[],
sl@0
   240
	OPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[],
sl@0
   241
	OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
sl@0
   242
IMPORT_C int STORE_revoke_certificate(STORE *e, OPENSSL_ITEM attributes[],
sl@0
   243
	OPENSSL_ITEM parameters[]);
sl@0
   244
IMPORT_C int STORE_delete_certificate(STORE *e, OPENSSL_ITEM attributes[],
sl@0
   245
	OPENSSL_ITEM parameters[]);
sl@0
   246
IMPORT_C void *STORE_list_certificate_start(STORE *e, OPENSSL_ITEM attributes[],
sl@0
   247
	OPENSSL_ITEM parameters[]);
sl@0
   248
IMPORT_C X509 *STORE_list_certificate_next(STORE *e, void *handle);
sl@0
   249
IMPORT_C int STORE_list_certificate_end(STORE *e, void *handle);
sl@0
   250
IMPORT_C int STORE_list_certificate_endp(STORE *e, void *handle);
sl@0
   251
IMPORT_C EVP_PKEY *STORE_generate_key(STORE *e, OPENSSL_ITEM attributes[],
sl@0
   252
	OPENSSL_ITEM parameters[]);
sl@0
   253
IMPORT_C EVP_PKEY *STORE_get_private_key(STORE *e, OPENSSL_ITEM attributes[],
sl@0
   254
	OPENSSL_ITEM parameters[]);
sl@0
   255
IMPORT_C int STORE_store_private_key(STORE *e, EVP_PKEY *data,
sl@0
   256
	OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
sl@0
   257
IMPORT_C int STORE_modify_private_key(STORE *e, OPENSSL_ITEM search_attributes[],
sl@0
   258
	OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],
sl@0
   259
	OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
sl@0
   260
IMPORT_C int STORE_revoke_private_key(STORE *e, OPENSSL_ITEM attributes[],
sl@0
   261
	OPENSSL_ITEM parameters[]);
sl@0
   262
IMPORT_C int STORE_delete_private_key(STORE *e, OPENSSL_ITEM attributes[],
sl@0
   263
	OPENSSL_ITEM parameters[]);
sl@0
   264
IMPORT_C void *STORE_list_private_key_start(STORE *e, OPENSSL_ITEM attributes[],
sl@0
   265
	OPENSSL_ITEM parameters[]);
sl@0
   266
IMPORT_C EVP_PKEY *STORE_list_private_key_next(STORE *e, void *handle);
sl@0
   267
IMPORT_C int STORE_list_private_key_end(STORE *e, void *handle);
sl@0
   268
IMPORT_C int STORE_list_private_key_endp(STORE *e, void *handle);
sl@0
   269
IMPORT_C EVP_PKEY *STORE_get_public_key(STORE *e, OPENSSL_ITEM attributes[],
sl@0
   270
	OPENSSL_ITEM parameters[]);
sl@0
   271
IMPORT_C int STORE_store_public_key(STORE *e, EVP_PKEY *data, OPENSSL_ITEM attributes[],
sl@0
   272
	OPENSSL_ITEM parameters[]);
sl@0
   273
IMPORT_C int STORE_modify_public_key(STORE *e, OPENSSL_ITEM search_attributes[],
sl@0
   274
	OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],
sl@0
   275
	OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
sl@0
   276
IMPORT_C int STORE_revoke_public_key(STORE *e, OPENSSL_ITEM attributes[],
sl@0
   277
	OPENSSL_ITEM parameters[]);
sl@0
   278
IMPORT_C int STORE_delete_public_key(STORE *e, OPENSSL_ITEM attributes[],
sl@0
   279
	OPENSSL_ITEM parameters[]);
sl@0
   280
IMPORT_C void *STORE_list_public_key_start(STORE *e, OPENSSL_ITEM attributes[],
sl@0
   281
	OPENSSL_ITEM parameters[]);
sl@0
   282
IMPORT_C EVP_PKEY *STORE_list_public_key_next(STORE *e, void *handle);
sl@0
   283
IMPORT_C int STORE_list_public_key_end(STORE *e, void *handle);
sl@0
   284
IMPORT_C int STORE_list_public_key_endp(STORE *e, void *handle);
sl@0
   285
IMPORT_C X509_CRL *STORE_generate_crl(STORE *e, OPENSSL_ITEM attributes[],
sl@0
   286
	OPENSSL_ITEM parameters[]);
sl@0
   287
IMPORT_C X509_CRL *STORE_get_crl(STORE *e, OPENSSL_ITEM attributes[],
sl@0
   288
	OPENSSL_ITEM parameters[]);
sl@0
   289
IMPORT_C int STORE_store_crl(STORE *e, X509_CRL *data, OPENSSL_ITEM attributes[],
sl@0
   290
	OPENSSL_ITEM parameters[]);
sl@0
   291
IMPORT_C int STORE_modify_crl(STORE *e, OPENSSL_ITEM search_attributes[],
sl@0
   292
	OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],
sl@0
   293
	OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
sl@0
   294
IMPORT_C int STORE_delete_crl(STORE *e, OPENSSL_ITEM attributes[],
sl@0
   295
	OPENSSL_ITEM parameters[]);
sl@0
   296
IMPORT_C void *STORE_list_crl_start(STORE *e, OPENSSL_ITEM attributes[],
sl@0
   297
	OPENSSL_ITEM parameters[]);
sl@0
   298
IMPORT_C X509_CRL *STORE_list_crl_next(STORE *e, void *handle);
sl@0
   299
IMPORT_C int STORE_list_crl_end(STORE *e, void *handle);
sl@0
   300
IMPORT_C int STORE_list_crl_endp(STORE *e, void *handle);
sl@0
   301
IMPORT_C int STORE_store_number(STORE *e, BIGNUM *data, OPENSSL_ITEM attributes[],
sl@0
   302
	OPENSSL_ITEM parameters[]);
sl@0
   303
IMPORT_C int STORE_modify_number(STORE *e, OPENSSL_ITEM search_attributes[],
sl@0
   304
	OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],
sl@0
   305
	OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
sl@0
   306
IMPORT_C BIGNUM *STORE_get_number(STORE *e, OPENSSL_ITEM attributes[],
sl@0
   307
	OPENSSL_ITEM parameters[]);
sl@0
   308
IMPORT_C int STORE_delete_number(STORE *e, OPENSSL_ITEM attributes[],
sl@0
   309
	OPENSSL_ITEM parameters[]);
sl@0
   310
IMPORT_C int STORE_store_arbitrary(STORE *e, BUF_MEM *data, OPENSSL_ITEM attributes[],
sl@0
   311
	OPENSSL_ITEM parameters[]);
sl@0
   312
IMPORT_C int STORE_modify_arbitrary(STORE *e, OPENSSL_ITEM search_attributes[],
sl@0
   313
	OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],
sl@0
   314
	OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
sl@0
   315
IMPORT_C BUF_MEM *STORE_get_arbitrary(STORE *e, OPENSSL_ITEM attributes[],
sl@0
   316
	OPENSSL_ITEM parameters[]);
sl@0
   317
IMPORT_C int STORE_delete_arbitrary(STORE *e, OPENSSL_ITEM attributes[],
sl@0
   318
	OPENSSL_ITEM parameters[]);
sl@0
   319
sl@0
   320
sl@0
   321
/* Create and manipulate methods */
sl@0
   322
IMPORT_C STORE_METHOD *STORE_create_method(char *name);
sl@0
   323
IMPORT_C void STORE_destroy_method(STORE_METHOD *store_method);
sl@0
   324
sl@0
   325
/* These callback types are use for store handlers */
sl@0
   326
typedef int (*STORE_INITIALISE_FUNC_PTR)(STORE *);
sl@0
   327
typedef void (*STORE_CLEANUP_FUNC_PTR)(STORE *);
sl@0
   328
typedef STORE_OBJECT *(*STORE_GENERATE_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
sl@0
   329
typedef STORE_OBJECT *(*STORE_GET_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
sl@0
   330
typedef void *(*STORE_START_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
sl@0
   331
typedef STORE_OBJECT *(*STORE_NEXT_OBJECT_FUNC_PTR)(STORE *, void *handle);
sl@0
   332
typedef int (*STORE_END_OBJECT_FUNC_PTR)(STORE *, void *handle);
sl@0
   333
typedef int (*STORE_HANDLE_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
sl@0
   334
typedef int (*STORE_STORE_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, STORE_OBJECT *data, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
sl@0
   335
typedef int (*STORE_MODIFY_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM search_attributes[], OPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[], OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
sl@0
   336
typedef int (*STORE_GENERIC_FUNC_PTR)(STORE *, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
sl@0
   337
typedef int (*STORE_CTRL_FUNC_PTR)(STORE *, int cmd, long l, void *p, void (*f)(void));
sl@0
   338
sl@0
   339
IMPORT_C int STORE_method_set_initialise_function(STORE_METHOD *sm, STORE_INITIALISE_FUNC_PTR init_f);
sl@0
   340
IMPORT_C int STORE_method_set_cleanup_function(STORE_METHOD *sm, STORE_CLEANUP_FUNC_PTR clean_f);
sl@0
   341
IMPORT_C int STORE_method_set_generate_function(STORE_METHOD *sm, STORE_GENERATE_OBJECT_FUNC_PTR generate_f);
sl@0
   342
IMPORT_C int STORE_method_set_get_function(STORE_METHOD *sm, STORE_GET_OBJECT_FUNC_PTR get_f);
sl@0
   343
IMPORT_C int STORE_method_set_store_function(STORE_METHOD *sm, STORE_STORE_OBJECT_FUNC_PTR store_f);
sl@0
   344
IMPORT_C int STORE_method_set_modify_function(STORE_METHOD *sm, STORE_MODIFY_OBJECT_FUNC_PTR store_f);
sl@0
   345
IMPORT_C int STORE_method_set_revoke_function(STORE_METHOD *sm, STORE_HANDLE_OBJECT_FUNC_PTR revoke_f);
sl@0
   346
IMPORT_C int STORE_method_set_delete_function(STORE_METHOD *sm, STORE_HANDLE_OBJECT_FUNC_PTR delete_f);
sl@0
   347
IMPORT_C int STORE_method_set_list_start_function(STORE_METHOD *sm, STORE_START_OBJECT_FUNC_PTR list_start_f);
sl@0
   348
IMPORT_C int STORE_method_set_list_next_function(STORE_METHOD *sm, STORE_NEXT_OBJECT_FUNC_PTR list_next_f);
sl@0
   349
IMPORT_C int STORE_method_set_list_end_function(STORE_METHOD *sm, STORE_END_OBJECT_FUNC_PTR list_end_f);
sl@0
   350
IMPORT_C int STORE_method_set_update_store_function(STORE_METHOD *sm, STORE_GENERIC_FUNC_PTR);
sl@0
   351
IMPORT_C int STORE_method_set_lock_store_function(STORE_METHOD *sm, STORE_GENERIC_FUNC_PTR);
sl@0
   352
IMPORT_C int STORE_method_set_unlock_store_function(STORE_METHOD *sm, STORE_GENERIC_FUNC_PTR);
sl@0
   353
IMPORT_C int STORE_method_set_ctrl_function(STORE_METHOD *sm, STORE_CTRL_FUNC_PTR ctrl_f);
sl@0
   354
sl@0
   355
IMPORT_C STORE_INITIALISE_FUNC_PTR STORE_method_get_initialise_function(STORE_METHOD *sm);
sl@0
   356
IMPORT_C STORE_CLEANUP_FUNC_PTR STORE_method_get_cleanup_function(STORE_METHOD *sm);
sl@0
   357
IMPORT_C STORE_GENERATE_OBJECT_FUNC_PTR STORE_method_get_generate_function(STORE_METHOD *sm);
sl@0
   358
IMPORT_C STORE_GET_OBJECT_FUNC_PTR STORE_method_get_get_function(STORE_METHOD *sm);
sl@0
   359
IMPORT_C STORE_STORE_OBJECT_FUNC_PTR STORE_method_get_store_function(STORE_METHOD *sm);
sl@0
   360
IMPORT_C STORE_MODIFY_OBJECT_FUNC_PTR STORE_method_get_modify_function(STORE_METHOD *sm);
sl@0
   361
IMPORT_C STORE_HANDLE_OBJECT_FUNC_PTR STORE_method_get_revoke_function(STORE_METHOD *sm);
sl@0
   362
IMPORT_C STORE_HANDLE_OBJECT_FUNC_PTR STORE_method_get_delete_function(STORE_METHOD *sm);
sl@0
   363
IMPORT_C STORE_START_OBJECT_FUNC_PTR STORE_method_get_list_start_function(STORE_METHOD *sm);
sl@0
   364
IMPORT_C STORE_NEXT_OBJECT_FUNC_PTR STORE_method_get_list_next_function(STORE_METHOD *sm);
sl@0
   365
IMPORT_C STORE_END_OBJECT_FUNC_PTR STORE_method_get_list_end_function(STORE_METHOD *sm);
sl@0
   366
IMPORT_C STORE_GENERIC_FUNC_PTR STORE_method_get_update_store_function(STORE_METHOD *sm);
sl@0
   367
IMPORT_C STORE_GENERIC_FUNC_PTR STORE_method_get_lock_store_function(STORE_METHOD *sm);
sl@0
   368
IMPORT_C STORE_GENERIC_FUNC_PTR STORE_method_get_unlock_store_function(STORE_METHOD *sm);
sl@0
   369
IMPORT_C STORE_CTRL_FUNC_PTR STORE_method_get_ctrl_function(STORE_METHOD *sm);
sl@0
   370
sl@0
   371
/* Method helper structures and functions. */
sl@0
   372
sl@0
   373
/* This structure is the result of parsing through the information in a list
sl@0
   374
   of OPENSSL_ITEMs.  It stores all the necessary information in a structured
sl@0
   375
   way.*/
sl@0
   376
typedef struct STORE_attr_info_st STORE_ATTR_INFO;
sl@0
   377
sl@0
   378
/* Parse a list of OPENSSL_ITEMs and return a pointer to a STORE_ATTR_INFO.
sl@0
   379
   Note that we do this in the list form, since the list of OPENSSL_ITEMs can
sl@0
   380
   come in blocks separated with STORE_ATTR_OR.  Note that the value returned
sl@0
   381
   by STORE_parse_attrs_next() must be freed with STORE_ATTR_INFO_free(). */
sl@0
   382
IMPORT_C void *STORE_parse_attrs_start(OPENSSL_ITEM *attributes);
sl@0
   383
IMPORT_C STORE_ATTR_INFO *STORE_parse_attrs_next(void *handle);
sl@0
   384
IMPORT_C int STORE_parse_attrs_end(void *handle);
sl@0
   385
IMPORT_C int STORE_parse_attrs_endp(void *handle);
sl@0
   386
sl@0
   387
/* Creator and destructor */
sl@0
   388
IMPORT_C STORE_ATTR_INFO *STORE_ATTR_INFO_new(void);
sl@0
   389
IMPORT_C int STORE_ATTR_INFO_free(STORE_ATTR_INFO *attrs);
sl@0
   390
sl@0
   391
/* Manipulators */
sl@0
   392
IMPORT_C char *STORE_ATTR_INFO_get0_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code);
sl@0
   393
IMPORT_C unsigned char *STORE_ATTR_INFO_get0_sha1str(STORE_ATTR_INFO *attrs,
sl@0
   394
	STORE_ATTR_TYPES code);
sl@0
   395
IMPORT_C X509_NAME *STORE_ATTR_INFO_get0_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code);
sl@0
   396
IMPORT_C BIGNUM *STORE_ATTR_INFO_get0_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code);
sl@0
   397
IMPORT_C int STORE_ATTR_INFO_set_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
sl@0
   398
	char *cstr, size_t cstr_size);
sl@0
   399
IMPORT_C int STORE_ATTR_INFO_set_sha1str(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
sl@0
   400
	unsigned char *sha1str, size_t sha1str_size);
sl@0
   401
IMPORT_C int STORE_ATTR_INFO_set_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
sl@0
   402
	X509_NAME *dn);
sl@0
   403
IMPORT_C int STORE_ATTR_INFO_set_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
sl@0
   404
	BIGNUM *number);
sl@0
   405
IMPORT_C int STORE_ATTR_INFO_modify_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
sl@0
   406
	char *cstr, size_t cstr_size);
sl@0
   407
IMPORT_C int STORE_ATTR_INFO_modify_sha1str(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
sl@0
   408
	unsigned char *sha1str, size_t sha1str_size);
sl@0
   409
IMPORT_C int STORE_ATTR_INFO_modify_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
sl@0
   410
	X509_NAME *dn);
sl@0
   411
IMPORT_C int STORE_ATTR_INFO_modify_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
sl@0
   412
	BIGNUM *number);
sl@0
   413
sl@0
   414
/* Compare on basis of a bit pattern formed by the STORE_ATTR_TYPES values
sl@0
   415
   in each contained attribute. */
sl@0
   416
IMPORT_C int STORE_ATTR_INFO_compare(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b);
sl@0
   417
/* Check if the set of attributes in a is within the range of attributes
sl@0
   418
   set in b. */
sl@0
   419
IMPORT_C int STORE_ATTR_INFO_in_range(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b);
sl@0
   420
/* Check if the set of attributes in a are also set in b. */
sl@0
   421
IMPORT_C int STORE_ATTR_INFO_in(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b);
sl@0
   422
/* Same as STORE_ATTR_INFO_in(), but also checks the attribute values. */
sl@0
   423
IMPORT_C int STORE_ATTR_INFO_in_ex(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b);
sl@0
   424
sl@0
   425
sl@0
   426
/* BEGIN ERROR CODES */
sl@0
   427
/* The following lines are auto generated by the script mkerr.pl. Any changes
sl@0
   428
 * made after this point may be overwritten when the script is next run.
sl@0
   429
 */
sl@0
   430
IMPORT_C void ERR_load_STORE_strings(void);
sl@0
   431
sl@0
   432
/* Error codes for the STORE functions. */
sl@0
   433
sl@0
   434
/* Function codes. */
sl@0
   435
#define STORE_F_MEM_DELETE				 134
sl@0
   436
#define STORE_F_MEM_GENERATE				 135
sl@0
   437
#define STORE_F_MEM_LIST_END				 168
sl@0
   438
#define STORE_F_MEM_LIST_NEXT				 136
sl@0
   439
#define STORE_F_MEM_LIST_START				 137
sl@0
   440
#define STORE_F_MEM_MODIFY				 169
sl@0
   441
#define STORE_F_MEM_STORE				 138
sl@0
   442
#define STORE_F_STORE_ATTR_INFO_GET0_CSTR		 139
sl@0
   443
#define STORE_F_STORE_ATTR_INFO_GET0_DN			 140
sl@0
   444
#define STORE_F_STORE_ATTR_INFO_GET0_NUMBER		 141
sl@0
   445
#define STORE_F_STORE_ATTR_INFO_GET0_SHA1STR		 142
sl@0
   446
#define STORE_F_STORE_ATTR_INFO_MODIFY_CSTR		 143
sl@0
   447
#define STORE_F_STORE_ATTR_INFO_MODIFY_DN		 144
sl@0
   448
#define STORE_F_STORE_ATTR_INFO_MODIFY_NUMBER		 145
sl@0
   449
#define STORE_F_STORE_ATTR_INFO_MODIFY_SHA1STR		 146
sl@0
   450
#define STORE_F_STORE_ATTR_INFO_SET_CSTR		 147
sl@0
   451
#define STORE_F_STORE_ATTR_INFO_SET_DN			 148
sl@0
   452
#define STORE_F_STORE_ATTR_INFO_SET_NUMBER		 149
sl@0
   453
#define STORE_F_STORE_ATTR_INFO_SET_SHA1STR		 150
sl@0
   454
#define STORE_F_STORE_CERTIFICATE			 170
sl@0
   455
#define STORE_F_STORE_CTRL				 161
sl@0
   456
#define STORE_F_STORE_DELETE_ARBITRARY			 158
sl@0
   457
#define STORE_F_STORE_DELETE_CERTIFICATE		 102
sl@0
   458
#define STORE_F_STORE_DELETE_CRL			 103
sl@0
   459
#define STORE_F_STORE_DELETE_NUMBER			 104
sl@0
   460
#define STORE_F_STORE_DELETE_PRIVATE_KEY		 105
sl@0
   461
#define STORE_F_STORE_DELETE_PUBLIC_KEY			 106
sl@0
   462
#define STORE_F_STORE_GENERATE_CRL			 107
sl@0
   463
#define STORE_F_STORE_GENERATE_KEY			 108
sl@0
   464
#define STORE_F_STORE_GET_ARBITRARY			 159
sl@0
   465
#define STORE_F_STORE_GET_CERTIFICATE			 109
sl@0
   466
#define STORE_F_STORE_GET_CRL				 110
sl@0
   467
#define STORE_F_STORE_GET_NUMBER			 111
sl@0
   468
#define STORE_F_STORE_GET_PRIVATE_KEY			 112
sl@0
   469
#define STORE_F_STORE_GET_PUBLIC_KEY			 113
sl@0
   470
#define STORE_F_STORE_LIST_CERTIFICATE_END		 114
sl@0
   471
#define STORE_F_STORE_LIST_CERTIFICATE_ENDP		 153
sl@0
   472
#define STORE_F_STORE_LIST_CERTIFICATE_NEXT		 115
sl@0
   473
#define STORE_F_STORE_LIST_CERTIFICATE_START		 116
sl@0
   474
#define STORE_F_STORE_LIST_CRL_END			 117
sl@0
   475
#define STORE_F_STORE_LIST_CRL_ENDP			 154
sl@0
   476
#define STORE_F_STORE_LIST_CRL_NEXT			 118
sl@0
   477
#define STORE_F_STORE_LIST_CRL_START			 119
sl@0
   478
#define STORE_F_STORE_LIST_PRIVATE_KEY_END		 120
sl@0
   479
#define STORE_F_STORE_LIST_PRIVATE_KEY_ENDP		 155
sl@0
   480
#define STORE_F_STORE_LIST_PRIVATE_KEY_NEXT		 121
sl@0
   481
#define STORE_F_STORE_LIST_PRIVATE_KEY_START		 122
sl@0
   482
#define STORE_F_STORE_LIST_PUBLIC_KEY_END		 123
sl@0
   483
#define STORE_F_STORE_LIST_PUBLIC_KEY_ENDP		 156
sl@0
   484
#define STORE_F_STORE_LIST_PUBLIC_KEY_NEXT		 124
sl@0
   485
#define STORE_F_STORE_LIST_PUBLIC_KEY_START		 125
sl@0
   486
#define STORE_F_STORE_MODIFY_ARBITRARY			 162
sl@0
   487
#define STORE_F_STORE_MODIFY_CERTIFICATE		 163
sl@0
   488
#define STORE_F_STORE_MODIFY_CRL			 164
sl@0
   489
#define STORE_F_STORE_MODIFY_NUMBER			 165
sl@0
   490
#define STORE_F_STORE_MODIFY_PRIVATE_KEY		 166
sl@0
   491
#define STORE_F_STORE_MODIFY_PUBLIC_KEY			 167
sl@0
   492
#define STORE_F_STORE_NEW_ENGINE			 133
sl@0
   493
#define STORE_F_STORE_NEW_METHOD			 132
sl@0
   494
#define STORE_F_STORE_PARSE_ATTRS_END			 151
sl@0
   495
#define STORE_F_STORE_PARSE_ATTRS_ENDP			 172
sl@0
   496
#define STORE_F_STORE_PARSE_ATTRS_NEXT			 152
sl@0
   497
#define STORE_F_STORE_PARSE_ATTRS_START			 171
sl@0
   498
#define STORE_F_STORE_REVOKE_CERTIFICATE		 129
sl@0
   499
#define STORE_F_STORE_REVOKE_PRIVATE_KEY		 130
sl@0
   500
#define STORE_F_STORE_REVOKE_PUBLIC_KEY			 131
sl@0
   501
#define STORE_F_STORE_STORE_ARBITRARY			 157
sl@0
   502
#define STORE_F_STORE_STORE_CERTIFICATE			 100
sl@0
   503
#define STORE_F_STORE_STORE_CRL				 101
sl@0
   504
#define STORE_F_STORE_STORE_NUMBER			 126
sl@0
   505
#define STORE_F_STORE_STORE_PRIVATE_KEY			 127
sl@0
   506
#define STORE_F_STORE_STORE_PUBLIC_KEY			 128
sl@0
   507
sl@0
   508
/* Reason codes. */
sl@0
   509
#define STORE_R_ALREADY_HAS_A_VALUE			 127
sl@0
   510
#define STORE_R_FAILED_DELETING_ARBITRARY		 132
sl@0
   511
#define STORE_R_FAILED_DELETING_CERTIFICATE		 100
sl@0
   512
#define STORE_R_FAILED_DELETING_KEY			 101
sl@0
   513
#define STORE_R_FAILED_DELETING_NUMBER			 102
sl@0
   514
#define STORE_R_FAILED_GENERATING_CRL			 103
sl@0
   515
#define STORE_R_FAILED_GENERATING_KEY			 104
sl@0
   516
#define STORE_R_FAILED_GETTING_ARBITRARY		 133
sl@0
   517
#define STORE_R_FAILED_GETTING_CERTIFICATE		 105
sl@0
   518
#define STORE_R_FAILED_GETTING_KEY			 106
sl@0
   519
#define STORE_R_FAILED_GETTING_NUMBER			 107
sl@0
   520
#define STORE_R_FAILED_LISTING_CERTIFICATES		 108
sl@0
   521
#define STORE_R_FAILED_LISTING_KEYS			 109
sl@0
   522
#define STORE_R_FAILED_MODIFYING_ARBITRARY		 138
sl@0
   523
#define STORE_R_FAILED_MODIFYING_CERTIFICATE		 139
sl@0
   524
#define STORE_R_FAILED_MODIFYING_CRL			 140
sl@0
   525
#define STORE_R_FAILED_MODIFYING_NUMBER			 141
sl@0
   526
#define STORE_R_FAILED_MODIFYING_PRIVATE_KEY		 142
sl@0
   527
#define STORE_R_FAILED_MODIFYING_PUBLIC_KEY		 143
sl@0
   528
#define STORE_R_FAILED_REVOKING_CERTIFICATE		 110
sl@0
   529
#define STORE_R_FAILED_REVOKING_KEY			 111
sl@0
   530
#define STORE_R_FAILED_STORING_ARBITRARY		 134
sl@0
   531
#define STORE_R_FAILED_STORING_CERTIFICATE		 112
sl@0
   532
#define STORE_R_FAILED_STORING_KEY			 113
sl@0
   533
#define STORE_R_FAILED_STORING_NUMBER			 114
sl@0
   534
#define STORE_R_NOT_IMPLEMENTED				 128
sl@0
   535
#define STORE_R_NO_CONTROL_FUNCTION			 144
sl@0
   536
#define STORE_R_NO_DELETE_ARBITRARY_FUNCTION		 135
sl@0
   537
#define STORE_R_NO_DELETE_NUMBER_FUNCTION		 115
sl@0
   538
#define STORE_R_NO_DELETE_OBJECT_FUNCTION		 116
sl@0
   539
#define STORE_R_NO_GENERATE_CRL_FUNCTION		 117
sl@0
   540
#define STORE_R_NO_GENERATE_OBJECT_FUNCTION		 118
sl@0
   541
#define STORE_R_NO_GET_OBJECT_ARBITRARY_FUNCTION	 136
sl@0
   542
#define STORE_R_NO_GET_OBJECT_FUNCTION			 119
sl@0
   543
#define STORE_R_NO_GET_OBJECT_NUMBER_FUNCTION		 120
sl@0
   544
#define STORE_R_NO_LIST_OBJECT_ENDP_FUNCTION		 131
sl@0
   545
#define STORE_R_NO_LIST_OBJECT_END_FUNCTION		 121
sl@0
   546
#define STORE_R_NO_LIST_OBJECT_NEXT_FUNCTION		 122
sl@0
   547
#define STORE_R_NO_LIST_OBJECT_START_FUNCTION		 123
sl@0
   548
#define STORE_R_NO_MODIFY_OBJECT_FUNCTION		 145
sl@0
   549
#define STORE_R_NO_REVOKE_OBJECT_FUNCTION		 124
sl@0
   550
#define STORE_R_NO_STORE				 129
sl@0
   551
#define STORE_R_NO_STORE_OBJECT_ARBITRARY_FUNCTION	 137
sl@0
   552
#define STORE_R_NO_STORE_OBJECT_FUNCTION		 125
sl@0
   553
#define STORE_R_NO_STORE_OBJECT_NUMBER_FUNCTION		 126
sl@0
   554
#define STORE_R_NO_VALUE				 130
sl@0
   555
sl@0
   556
#ifdef  __cplusplus
sl@0
   557
}
sl@0
   558
#endif
sl@0
   559
#endif