1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/ssl/libcrypto/src/crypto/store/store.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,559 @@
1.4 +/* crypto/store/store.h -*- mode:C; c-file-style: "eay" -*- */
1.5 +/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
1.6 + * project 2003.
1.7 + */
1.8 +/* ====================================================================
1.9 + * Copyright (c) 2003 The OpenSSL Project. All rights reserved.
1.10 + *
1.11 + * Redistribution and use in source and binary forms, with or without
1.12 + * modification, are permitted provided that the following conditions
1.13 + * are met:
1.14 + *
1.15 + * 1. Redistributions of source code must retain the above copyright
1.16 + * notice, this list of conditions and the following disclaimer.
1.17 + *
1.18 + * 2. Redistributions in binary form must reproduce the above copyright
1.19 + * notice, this list of conditions and the following disclaimer in
1.20 + * the documentation and/or other materials provided with the
1.21 + * distribution.
1.22 + *
1.23 + * 3. All advertising materials mentioning features or use of this
1.24 + * software must display the following acknowledgment:
1.25 + * "This product includes software developed by the OpenSSL Project
1.26 + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
1.27 + *
1.28 + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
1.29 + * endorse or promote products derived from this software without
1.30 + * prior written permission. For written permission, please contact
1.31 + * openssl-core@openssl.org.
1.32 + *
1.33 + * 5. Products derived from this software may not be called "OpenSSL"
1.34 + * nor may "OpenSSL" appear in their names without prior written
1.35 + * permission of the OpenSSL Project.
1.36 + *
1.37 + * 6. Redistributions of any form whatsoever must retain the following
1.38 + * acknowledgment:
1.39 + * "This product includes software developed by the OpenSSL Project
1.40 + * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
1.41 + *
1.42 + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
1.43 + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1.44 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1.45 + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
1.46 + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1.47 + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1.48 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
1.49 + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1.50 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
1.51 + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
1.52 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
1.53 + * OF THE POSSIBILITY OF SUCH DAMAGE.
1.54 + * ====================================================================
1.55 + *
1.56 + * This product includes cryptographic software written by Eric Young
1.57 + * (eay@cryptsoft.com). This product includes software written by Tim
1.58 + * Hudson (tjh@cryptsoft.com).
1.59 + *
1.60 + */
1.61 +/*
1.62 + © Portions copyright (c) 2006 Nokia Corporation. All rights reserved.
1.63 + */
1.64 +
1.65 +#ifndef HEADER_STORE_H
1.66 +#define HEADER_STORE_H
1.67 +#ifdef SYMBIAN
1.68 +#include <e32def.h>
1.69 +#endif
1.70 +#include <openssl/ossl_typ.h>
1.71 +#ifndef OPENSSL_NO_DEPRECATED
1.72 +#include <openssl/evp.h>
1.73 +#include <openssl/bn.h>
1.74 +#include <openssl/x509.h>
1.75 +#endif
1.76 +
1.77 +#ifdef __cplusplus
1.78 +extern "C" {
1.79 +#endif
1.80 +
1.81 +/* Already defined in ossl_typ.h */
1.82 +/* typedef struct store_st STORE; */
1.83 +/* typedef struct store_method_st STORE_METHOD; */
1.84 +
1.85 +
1.86 +/* All the following functions return 0, a negative number or NULL on error.
1.87 + When everything is fine, they return a positive value or a non-NULL
1.88 + pointer, all depending on their purpose. */
1.89 +
1.90 +/* Creators and destructor. */
1.91 +IMPORT_C STORE *STORE_new_method(const STORE_METHOD *method);
1.92 +IMPORT_C STORE *STORE_new_engine(ENGINE *engine);
1.93 +IMPORT_C void STORE_free(STORE *ui);
1.94 +
1.95 +
1.96 +/* Give a user interface parametrised control commands. This can be used to
1.97 + send down an integer, a data pointer or a function pointer, as well as
1.98 + be used to get information from a STORE. */
1.99 +IMPORT_C int STORE_ctrl(STORE *store, int cmd, long i, void *p, void (*f)(void));
1.100 +
1.101 +/* A control to set the directory with keys and certificates. Used by the
1.102 + built-in directory level method. */
1.103 +#define STORE_CTRL_SET_DIRECTORY 0x0001
1.104 +/* A control to set a file to load. Used by the built-in file level method. */
1.105 +#define STORE_CTRL_SET_FILE 0x0002
1.106 +/* A control to set a configuration file to load. Can be used by any method
1.107 + that wishes to load a configuration file. */
1.108 +#define STORE_CTRL_SET_CONF_FILE 0x0003
1.109 +/* A control to set a the section of the loaded configuration file. Can be
1.110 + used by any method that wishes to load a configuration file. */
1.111 +#define STORE_CTRL_SET_CONF_SECTION 0x0004
1.112 +
1.113 +
1.114 +/* Some methods may use extra data */
1.115 +#define STORE_set_app_data(s,arg) STORE_set_ex_data(s,0,arg)
1.116 +#define STORE_get_app_data(s) STORE_get_ex_data(s,0)
1.117 +IMPORT_C int STORE_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
1.118 + CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
1.119 +IMPORT_C int STORE_set_ex_data(STORE *r,int idx,void *arg);
1.120 +IMPORT_C void *STORE_get_ex_data(STORE *r, int idx);
1.121 +
1.122 +/* Use specific methods instead of the built-in one */
1.123 +IMPORT_C const STORE_METHOD *STORE_get_method(STORE *store);
1.124 +IMPORT_C const STORE_METHOD *STORE_set_method(STORE *store, const STORE_METHOD *meth);
1.125 +
1.126 +/* The standard OpenSSL methods. */
1.127 +/* This is the in-memory method. It does everything except revoking and updating,
1.128 + and is of course volatile. It's used by other methods that have an in-memory
1.129 + cache. */
1.130 +IMPORT_C const STORE_METHOD *STORE_Memory(void);
1.131 +#if 0 /* Not yet implemented */
1.132 +/* This is the directory store. It does everything except revoking and updating,
1.133 + and uses STORE_Memory() to cache things in memory. */
1.134 +IMPORT_C const STORE_METHOD *STORE_Directory(void);
1.135 +/* This is the file store. It does everything except revoking and updating,
1.136 + and uses STORE_Memory() to cache things in memory. Certificates are added
1.137 + to it with the store operation, and it will only get cached certificates. */
1.138 +IMPORT_C const STORE_METHOD *STORE_File(void);
1.139 +#endif
1.140 +
1.141 +/* Store functions take a type code for the type of data they should store
1.142 + or fetch */
1.143 +typedef enum STORE_object_types
1.144 + {
1.145 + STORE_OBJECT_TYPE_X509_CERTIFICATE= 0x01, /* X509 * */
1.146 + STORE_OBJECT_TYPE_X509_CRL= 0x02, /* X509_CRL * */
1.147 + STORE_OBJECT_TYPE_PRIVATE_KEY= 0x03, /* EVP_PKEY * */
1.148 + STORE_OBJECT_TYPE_PUBLIC_KEY= 0x04, /* EVP_PKEY * */
1.149 + STORE_OBJECT_TYPE_NUMBER= 0x05, /* BIGNUM * */
1.150 + STORE_OBJECT_TYPE_ARBITRARY= 0x06, /* BUF_MEM * */
1.151 + STORE_OBJECT_TYPE_NUM= 0x06 /* The amount of known
1.152 + object types */
1.153 + } STORE_OBJECT_TYPES;
1.154 +/* List of text strings corresponding to the object types. */
1.155 +extern const char * const STORE_object_type_string[STORE_OBJECT_TYPE_NUM+1];
1.156 +
1.157 +/* Some store functions take a parameter list. Those parameters come with
1.158 + one of the following codes. The comments following the codes below indicate
1.159 + what type the value should be a pointer to. */
1.160 +typedef enum STORE_params
1.161 + {
1.162 + STORE_PARAM_EVP_TYPE= 0x01, /* int */
1.163 + STORE_PARAM_BITS= 0x02, /* size_t */
1.164 + STORE_PARAM_KEY_PARAMETERS= 0x03, /* ??? */
1.165 + STORE_PARAM_KEY_NO_PARAMETERS= 0x04, /* N/A */
1.166 + STORE_PARAM_AUTH_PASSPHRASE= 0x05, /* char * */
1.167 + STORE_PARAM_AUTH_KRB5_TICKET= 0x06, /* void * */
1.168 + STORE_PARAM_TYPE_NUM= 0x06 /* The amount of known
1.169 + parameter types */
1.170 + } STORE_PARAM_TYPES;
1.171 +/* Parameter value sizes. -1 means unknown, anything else is the required size. */
1.172 +extern const int STORE_param_sizes[STORE_PARAM_TYPE_NUM+1];
1.173 +
1.174 +/* Store functions take attribute lists. Those attributes come with codes.
1.175 + The comments following the codes below indicate what type the value should
1.176 + be a pointer to. */
1.177 +typedef enum STORE_attribs
1.178 + {
1.179 + STORE_ATTR_END= 0x00,
1.180 + STORE_ATTR_FRIENDLYNAME= 0x01, /* C string */
1.181 + STORE_ATTR_KEYID= 0x02, /* 160 bit string (SHA1) */
1.182 + STORE_ATTR_ISSUERKEYID= 0x03, /* 160 bit string (SHA1) */
1.183 + STORE_ATTR_SUBJECTKEYID= 0x04, /* 160 bit string (SHA1) */
1.184 + STORE_ATTR_ISSUERSERIALHASH= 0x05, /* 160 bit string (SHA1) */
1.185 + STORE_ATTR_ISSUER= 0x06, /* X509_NAME * */
1.186 + STORE_ATTR_SERIAL= 0x07, /* BIGNUM * */
1.187 + STORE_ATTR_SUBJECT= 0x08, /* X509_NAME * */
1.188 + STORE_ATTR_CERTHASH= 0x09, /* 160 bit string (SHA1) */
1.189 + STORE_ATTR_EMAIL= 0x0a, /* C string */
1.190 + STORE_ATTR_FILENAME= 0x0b, /* C string */
1.191 + STORE_ATTR_TYPE_NUM= 0x0b, /* The amount of known
1.192 + attribute types */
1.193 + STORE_ATTR_OR= 0xff /* This is a special
1.194 + separator, which
1.195 + expresses the OR
1.196 + operation. */
1.197 + } STORE_ATTR_TYPES;
1.198 +/* Attribute value sizes. -1 means unknown, anything else is the required size. */
1.199 +extern const int STORE_attr_sizes[STORE_ATTR_TYPE_NUM+1];
1.200 +
1.201 +typedef enum STORE_certificate_status
1.202 + {
1.203 + STORE_X509_VALID= 0x00,
1.204 + STORE_X509_EXPIRED= 0x01,
1.205 + STORE_X509_SUSPENDED= 0x02,
1.206 + STORE_X509_REVOKED= 0x03
1.207 + } STORE_CERTIFICATE_STATUS;
1.208 +
1.209 +/* Engine store functions will return a structure that contains all the necessary
1.210 + * information, including revokation status for certificates. This is really not
1.211 + * needed for application authors, as the ENGINE framework functions will extract
1.212 + * the OpenSSL-specific information when at all possible. However, for engine
1.213 + * authors, it's crucial to know this structure. */
1.214 +typedef struct STORE_OBJECT_st
1.215 + {
1.216 + STORE_OBJECT_TYPES type;
1.217 + union
1.218 + {
1.219 + struct
1.220 + {
1.221 + STORE_CERTIFICATE_STATUS status;
1.222 + X509 *certificate;
1.223 + } x509;
1.224 + X509_CRL *crl;
1.225 + EVP_PKEY *key;
1.226 + BIGNUM *number;
1.227 + BUF_MEM *arbitrary;
1.228 + } data;
1.229 + } STORE_OBJECT;
1.230 +DECLARE_STACK_OF(STORE_OBJECT)
1.231 +STORE_OBJECT *STORE_OBJECT_new(void);
1.232 +void STORE_OBJECT_free(STORE_OBJECT *data);
1.233 +
1.234 +
1.235 +
1.236 +/* The following functions handle the storage. They return 0, a negative number
1.237 + or NULL on error, anything else on success. */
1.238 +IMPORT_C X509 *STORE_get_certificate(STORE *e, OPENSSL_ITEM attributes[],
1.239 + OPENSSL_ITEM parameters[]);
1.240 +IMPORT_C int STORE_store_certificate(STORE *e, X509 *data, OPENSSL_ITEM attributes[],
1.241 + OPENSSL_ITEM parameters[]);
1.242 +IMPORT_C int STORE_modify_certificate(STORE *e, OPENSSL_ITEM search_attributes[],
1.243 + OPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[],
1.244 + OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
1.245 +IMPORT_C int STORE_revoke_certificate(STORE *e, OPENSSL_ITEM attributes[],
1.246 + OPENSSL_ITEM parameters[]);
1.247 +IMPORT_C int STORE_delete_certificate(STORE *e, OPENSSL_ITEM attributes[],
1.248 + OPENSSL_ITEM parameters[]);
1.249 +IMPORT_C void *STORE_list_certificate_start(STORE *e, OPENSSL_ITEM attributes[],
1.250 + OPENSSL_ITEM parameters[]);
1.251 +IMPORT_C X509 *STORE_list_certificate_next(STORE *e, void *handle);
1.252 +IMPORT_C int STORE_list_certificate_end(STORE *e, void *handle);
1.253 +IMPORT_C int STORE_list_certificate_endp(STORE *e, void *handle);
1.254 +IMPORT_C EVP_PKEY *STORE_generate_key(STORE *e, OPENSSL_ITEM attributes[],
1.255 + OPENSSL_ITEM parameters[]);
1.256 +IMPORT_C EVP_PKEY *STORE_get_private_key(STORE *e, OPENSSL_ITEM attributes[],
1.257 + OPENSSL_ITEM parameters[]);
1.258 +IMPORT_C int STORE_store_private_key(STORE *e, EVP_PKEY *data,
1.259 + OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
1.260 +IMPORT_C int STORE_modify_private_key(STORE *e, OPENSSL_ITEM search_attributes[],
1.261 + OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],
1.262 + OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
1.263 +IMPORT_C int STORE_revoke_private_key(STORE *e, OPENSSL_ITEM attributes[],
1.264 + OPENSSL_ITEM parameters[]);
1.265 +IMPORT_C int STORE_delete_private_key(STORE *e, OPENSSL_ITEM attributes[],
1.266 + OPENSSL_ITEM parameters[]);
1.267 +IMPORT_C void *STORE_list_private_key_start(STORE *e, OPENSSL_ITEM attributes[],
1.268 + OPENSSL_ITEM parameters[]);
1.269 +IMPORT_C EVP_PKEY *STORE_list_private_key_next(STORE *e, void *handle);
1.270 +IMPORT_C int STORE_list_private_key_end(STORE *e, void *handle);
1.271 +IMPORT_C int STORE_list_private_key_endp(STORE *e, void *handle);
1.272 +IMPORT_C EVP_PKEY *STORE_get_public_key(STORE *e, OPENSSL_ITEM attributes[],
1.273 + OPENSSL_ITEM parameters[]);
1.274 +IMPORT_C int STORE_store_public_key(STORE *e, EVP_PKEY *data, OPENSSL_ITEM attributes[],
1.275 + OPENSSL_ITEM parameters[]);
1.276 +IMPORT_C int STORE_modify_public_key(STORE *e, OPENSSL_ITEM search_attributes[],
1.277 + OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],
1.278 + OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
1.279 +IMPORT_C int STORE_revoke_public_key(STORE *e, OPENSSL_ITEM attributes[],
1.280 + OPENSSL_ITEM parameters[]);
1.281 +IMPORT_C int STORE_delete_public_key(STORE *e, OPENSSL_ITEM attributes[],
1.282 + OPENSSL_ITEM parameters[]);
1.283 +IMPORT_C void *STORE_list_public_key_start(STORE *e, OPENSSL_ITEM attributes[],
1.284 + OPENSSL_ITEM parameters[]);
1.285 +IMPORT_C EVP_PKEY *STORE_list_public_key_next(STORE *e, void *handle);
1.286 +IMPORT_C int STORE_list_public_key_end(STORE *e, void *handle);
1.287 +IMPORT_C int STORE_list_public_key_endp(STORE *e, void *handle);
1.288 +IMPORT_C X509_CRL *STORE_generate_crl(STORE *e, OPENSSL_ITEM attributes[],
1.289 + OPENSSL_ITEM parameters[]);
1.290 +IMPORT_C X509_CRL *STORE_get_crl(STORE *e, OPENSSL_ITEM attributes[],
1.291 + OPENSSL_ITEM parameters[]);
1.292 +IMPORT_C int STORE_store_crl(STORE *e, X509_CRL *data, OPENSSL_ITEM attributes[],
1.293 + OPENSSL_ITEM parameters[]);
1.294 +IMPORT_C int STORE_modify_crl(STORE *e, OPENSSL_ITEM search_attributes[],
1.295 + OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],
1.296 + OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
1.297 +IMPORT_C int STORE_delete_crl(STORE *e, OPENSSL_ITEM attributes[],
1.298 + OPENSSL_ITEM parameters[]);
1.299 +IMPORT_C void *STORE_list_crl_start(STORE *e, OPENSSL_ITEM attributes[],
1.300 + OPENSSL_ITEM parameters[]);
1.301 +IMPORT_C X509_CRL *STORE_list_crl_next(STORE *e, void *handle);
1.302 +IMPORT_C int STORE_list_crl_end(STORE *e, void *handle);
1.303 +IMPORT_C int STORE_list_crl_endp(STORE *e, void *handle);
1.304 +IMPORT_C int STORE_store_number(STORE *e, BIGNUM *data, OPENSSL_ITEM attributes[],
1.305 + OPENSSL_ITEM parameters[]);
1.306 +IMPORT_C int STORE_modify_number(STORE *e, OPENSSL_ITEM search_attributes[],
1.307 + OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],
1.308 + OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
1.309 +IMPORT_C BIGNUM *STORE_get_number(STORE *e, OPENSSL_ITEM attributes[],
1.310 + OPENSSL_ITEM parameters[]);
1.311 +IMPORT_C int STORE_delete_number(STORE *e, OPENSSL_ITEM attributes[],
1.312 + OPENSSL_ITEM parameters[]);
1.313 +IMPORT_C int STORE_store_arbitrary(STORE *e, BUF_MEM *data, OPENSSL_ITEM attributes[],
1.314 + OPENSSL_ITEM parameters[]);
1.315 +IMPORT_C int STORE_modify_arbitrary(STORE *e, OPENSSL_ITEM search_attributes[],
1.316 + OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],
1.317 + OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
1.318 +IMPORT_C BUF_MEM *STORE_get_arbitrary(STORE *e, OPENSSL_ITEM attributes[],
1.319 + OPENSSL_ITEM parameters[]);
1.320 +IMPORT_C int STORE_delete_arbitrary(STORE *e, OPENSSL_ITEM attributes[],
1.321 + OPENSSL_ITEM parameters[]);
1.322 +
1.323 +
1.324 +/* Create and manipulate methods */
1.325 +IMPORT_C STORE_METHOD *STORE_create_method(char *name);
1.326 +IMPORT_C void STORE_destroy_method(STORE_METHOD *store_method);
1.327 +
1.328 +/* These callback types are use for store handlers */
1.329 +typedef int (*STORE_INITIALISE_FUNC_PTR)(STORE *);
1.330 +typedef void (*STORE_CLEANUP_FUNC_PTR)(STORE *);
1.331 +typedef STORE_OBJECT *(*STORE_GENERATE_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
1.332 +typedef STORE_OBJECT *(*STORE_GET_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
1.333 +typedef void *(*STORE_START_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
1.334 +typedef STORE_OBJECT *(*STORE_NEXT_OBJECT_FUNC_PTR)(STORE *, void *handle);
1.335 +typedef int (*STORE_END_OBJECT_FUNC_PTR)(STORE *, void *handle);
1.336 +typedef int (*STORE_HANDLE_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
1.337 +typedef int (*STORE_STORE_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, STORE_OBJECT *data, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
1.338 +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[]);
1.339 +typedef int (*STORE_GENERIC_FUNC_PTR)(STORE *, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
1.340 +typedef int (*STORE_CTRL_FUNC_PTR)(STORE *, int cmd, long l, void *p, void (*f)(void));
1.341 +
1.342 +IMPORT_C int STORE_method_set_initialise_function(STORE_METHOD *sm, STORE_INITIALISE_FUNC_PTR init_f);
1.343 +IMPORT_C int STORE_method_set_cleanup_function(STORE_METHOD *sm, STORE_CLEANUP_FUNC_PTR clean_f);
1.344 +IMPORT_C int STORE_method_set_generate_function(STORE_METHOD *sm, STORE_GENERATE_OBJECT_FUNC_PTR generate_f);
1.345 +IMPORT_C int STORE_method_set_get_function(STORE_METHOD *sm, STORE_GET_OBJECT_FUNC_PTR get_f);
1.346 +IMPORT_C int STORE_method_set_store_function(STORE_METHOD *sm, STORE_STORE_OBJECT_FUNC_PTR store_f);
1.347 +IMPORT_C int STORE_method_set_modify_function(STORE_METHOD *sm, STORE_MODIFY_OBJECT_FUNC_PTR store_f);
1.348 +IMPORT_C int STORE_method_set_revoke_function(STORE_METHOD *sm, STORE_HANDLE_OBJECT_FUNC_PTR revoke_f);
1.349 +IMPORT_C int STORE_method_set_delete_function(STORE_METHOD *sm, STORE_HANDLE_OBJECT_FUNC_PTR delete_f);
1.350 +IMPORT_C int STORE_method_set_list_start_function(STORE_METHOD *sm, STORE_START_OBJECT_FUNC_PTR list_start_f);
1.351 +IMPORT_C int STORE_method_set_list_next_function(STORE_METHOD *sm, STORE_NEXT_OBJECT_FUNC_PTR list_next_f);
1.352 +IMPORT_C int STORE_method_set_list_end_function(STORE_METHOD *sm, STORE_END_OBJECT_FUNC_PTR list_end_f);
1.353 +IMPORT_C int STORE_method_set_update_store_function(STORE_METHOD *sm, STORE_GENERIC_FUNC_PTR);
1.354 +IMPORT_C int STORE_method_set_lock_store_function(STORE_METHOD *sm, STORE_GENERIC_FUNC_PTR);
1.355 +IMPORT_C int STORE_method_set_unlock_store_function(STORE_METHOD *sm, STORE_GENERIC_FUNC_PTR);
1.356 +IMPORT_C int STORE_method_set_ctrl_function(STORE_METHOD *sm, STORE_CTRL_FUNC_PTR ctrl_f);
1.357 +
1.358 +IMPORT_C STORE_INITIALISE_FUNC_PTR STORE_method_get_initialise_function(STORE_METHOD *sm);
1.359 +IMPORT_C STORE_CLEANUP_FUNC_PTR STORE_method_get_cleanup_function(STORE_METHOD *sm);
1.360 +IMPORT_C STORE_GENERATE_OBJECT_FUNC_PTR STORE_method_get_generate_function(STORE_METHOD *sm);
1.361 +IMPORT_C STORE_GET_OBJECT_FUNC_PTR STORE_method_get_get_function(STORE_METHOD *sm);
1.362 +IMPORT_C STORE_STORE_OBJECT_FUNC_PTR STORE_method_get_store_function(STORE_METHOD *sm);
1.363 +IMPORT_C STORE_MODIFY_OBJECT_FUNC_PTR STORE_method_get_modify_function(STORE_METHOD *sm);
1.364 +IMPORT_C STORE_HANDLE_OBJECT_FUNC_PTR STORE_method_get_revoke_function(STORE_METHOD *sm);
1.365 +IMPORT_C STORE_HANDLE_OBJECT_FUNC_PTR STORE_method_get_delete_function(STORE_METHOD *sm);
1.366 +IMPORT_C STORE_START_OBJECT_FUNC_PTR STORE_method_get_list_start_function(STORE_METHOD *sm);
1.367 +IMPORT_C STORE_NEXT_OBJECT_FUNC_PTR STORE_method_get_list_next_function(STORE_METHOD *sm);
1.368 +IMPORT_C STORE_END_OBJECT_FUNC_PTR STORE_method_get_list_end_function(STORE_METHOD *sm);
1.369 +IMPORT_C STORE_GENERIC_FUNC_PTR STORE_method_get_update_store_function(STORE_METHOD *sm);
1.370 +IMPORT_C STORE_GENERIC_FUNC_PTR STORE_method_get_lock_store_function(STORE_METHOD *sm);
1.371 +IMPORT_C STORE_GENERIC_FUNC_PTR STORE_method_get_unlock_store_function(STORE_METHOD *sm);
1.372 +IMPORT_C STORE_CTRL_FUNC_PTR STORE_method_get_ctrl_function(STORE_METHOD *sm);
1.373 +
1.374 +/* Method helper structures and functions. */
1.375 +
1.376 +/* This structure is the result of parsing through the information in a list
1.377 + of OPENSSL_ITEMs. It stores all the necessary information in a structured
1.378 + way.*/
1.379 +typedef struct STORE_attr_info_st STORE_ATTR_INFO;
1.380 +
1.381 +/* Parse a list of OPENSSL_ITEMs and return a pointer to a STORE_ATTR_INFO.
1.382 + Note that we do this in the list form, since the list of OPENSSL_ITEMs can
1.383 + come in blocks separated with STORE_ATTR_OR. Note that the value returned
1.384 + by STORE_parse_attrs_next() must be freed with STORE_ATTR_INFO_free(). */
1.385 +IMPORT_C void *STORE_parse_attrs_start(OPENSSL_ITEM *attributes);
1.386 +IMPORT_C STORE_ATTR_INFO *STORE_parse_attrs_next(void *handle);
1.387 +IMPORT_C int STORE_parse_attrs_end(void *handle);
1.388 +IMPORT_C int STORE_parse_attrs_endp(void *handle);
1.389 +
1.390 +/* Creator and destructor */
1.391 +IMPORT_C STORE_ATTR_INFO *STORE_ATTR_INFO_new(void);
1.392 +IMPORT_C int STORE_ATTR_INFO_free(STORE_ATTR_INFO *attrs);
1.393 +
1.394 +/* Manipulators */
1.395 +IMPORT_C char *STORE_ATTR_INFO_get0_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code);
1.396 +IMPORT_C unsigned char *STORE_ATTR_INFO_get0_sha1str(STORE_ATTR_INFO *attrs,
1.397 + STORE_ATTR_TYPES code);
1.398 +IMPORT_C X509_NAME *STORE_ATTR_INFO_get0_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code);
1.399 +IMPORT_C BIGNUM *STORE_ATTR_INFO_get0_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code);
1.400 +IMPORT_C int STORE_ATTR_INFO_set_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
1.401 + char *cstr, size_t cstr_size);
1.402 +IMPORT_C int STORE_ATTR_INFO_set_sha1str(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
1.403 + unsigned char *sha1str, size_t sha1str_size);
1.404 +IMPORT_C int STORE_ATTR_INFO_set_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
1.405 + X509_NAME *dn);
1.406 +IMPORT_C int STORE_ATTR_INFO_set_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
1.407 + BIGNUM *number);
1.408 +IMPORT_C int STORE_ATTR_INFO_modify_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
1.409 + char *cstr, size_t cstr_size);
1.410 +IMPORT_C int STORE_ATTR_INFO_modify_sha1str(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
1.411 + unsigned char *sha1str, size_t sha1str_size);
1.412 +IMPORT_C int STORE_ATTR_INFO_modify_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
1.413 + X509_NAME *dn);
1.414 +IMPORT_C int STORE_ATTR_INFO_modify_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
1.415 + BIGNUM *number);
1.416 +
1.417 +/* Compare on basis of a bit pattern formed by the STORE_ATTR_TYPES values
1.418 + in each contained attribute. */
1.419 +IMPORT_C int STORE_ATTR_INFO_compare(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b);
1.420 +/* Check if the set of attributes in a is within the range of attributes
1.421 + set in b. */
1.422 +IMPORT_C int STORE_ATTR_INFO_in_range(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b);
1.423 +/* Check if the set of attributes in a are also set in b. */
1.424 +IMPORT_C int STORE_ATTR_INFO_in(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b);
1.425 +/* Same as STORE_ATTR_INFO_in(), but also checks the attribute values. */
1.426 +IMPORT_C int STORE_ATTR_INFO_in_ex(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b);
1.427 +
1.428 +
1.429 +/* BEGIN ERROR CODES */
1.430 +/* The following lines are auto generated by the script mkerr.pl. Any changes
1.431 + * made after this point may be overwritten when the script is next run.
1.432 + */
1.433 +IMPORT_C void ERR_load_STORE_strings(void);
1.434 +
1.435 +/* Error codes for the STORE functions. */
1.436 +
1.437 +/* Function codes. */
1.438 +#define STORE_F_MEM_DELETE 134
1.439 +#define STORE_F_MEM_GENERATE 135
1.440 +#define STORE_F_MEM_LIST_END 168
1.441 +#define STORE_F_MEM_LIST_NEXT 136
1.442 +#define STORE_F_MEM_LIST_START 137
1.443 +#define STORE_F_MEM_MODIFY 169
1.444 +#define STORE_F_MEM_STORE 138
1.445 +#define STORE_F_STORE_ATTR_INFO_GET0_CSTR 139
1.446 +#define STORE_F_STORE_ATTR_INFO_GET0_DN 140
1.447 +#define STORE_F_STORE_ATTR_INFO_GET0_NUMBER 141
1.448 +#define STORE_F_STORE_ATTR_INFO_GET0_SHA1STR 142
1.449 +#define STORE_F_STORE_ATTR_INFO_MODIFY_CSTR 143
1.450 +#define STORE_F_STORE_ATTR_INFO_MODIFY_DN 144
1.451 +#define STORE_F_STORE_ATTR_INFO_MODIFY_NUMBER 145
1.452 +#define STORE_F_STORE_ATTR_INFO_MODIFY_SHA1STR 146
1.453 +#define STORE_F_STORE_ATTR_INFO_SET_CSTR 147
1.454 +#define STORE_F_STORE_ATTR_INFO_SET_DN 148
1.455 +#define STORE_F_STORE_ATTR_INFO_SET_NUMBER 149
1.456 +#define STORE_F_STORE_ATTR_INFO_SET_SHA1STR 150
1.457 +#define STORE_F_STORE_CERTIFICATE 170
1.458 +#define STORE_F_STORE_CTRL 161
1.459 +#define STORE_F_STORE_DELETE_ARBITRARY 158
1.460 +#define STORE_F_STORE_DELETE_CERTIFICATE 102
1.461 +#define STORE_F_STORE_DELETE_CRL 103
1.462 +#define STORE_F_STORE_DELETE_NUMBER 104
1.463 +#define STORE_F_STORE_DELETE_PRIVATE_KEY 105
1.464 +#define STORE_F_STORE_DELETE_PUBLIC_KEY 106
1.465 +#define STORE_F_STORE_GENERATE_CRL 107
1.466 +#define STORE_F_STORE_GENERATE_KEY 108
1.467 +#define STORE_F_STORE_GET_ARBITRARY 159
1.468 +#define STORE_F_STORE_GET_CERTIFICATE 109
1.469 +#define STORE_F_STORE_GET_CRL 110
1.470 +#define STORE_F_STORE_GET_NUMBER 111
1.471 +#define STORE_F_STORE_GET_PRIVATE_KEY 112
1.472 +#define STORE_F_STORE_GET_PUBLIC_KEY 113
1.473 +#define STORE_F_STORE_LIST_CERTIFICATE_END 114
1.474 +#define STORE_F_STORE_LIST_CERTIFICATE_ENDP 153
1.475 +#define STORE_F_STORE_LIST_CERTIFICATE_NEXT 115
1.476 +#define STORE_F_STORE_LIST_CERTIFICATE_START 116
1.477 +#define STORE_F_STORE_LIST_CRL_END 117
1.478 +#define STORE_F_STORE_LIST_CRL_ENDP 154
1.479 +#define STORE_F_STORE_LIST_CRL_NEXT 118
1.480 +#define STORE_F_STORE_LIST_CRL_START 119
1.481 +#define STORE_F_STORE_LIST_PRIVATE_KEY_END 120
1.482 +#define STORE_F_STORE_LIST_PRIVATE_KEY_ENDP 155
1.483 +#define STORE_F_STORE_LIST_PRIVATE_KEY_NEXT 121
1.484 +#define STORE_F_STORE_LIST_PRIVATE_KEY_START 122
1.485 +#define STORE_F_STORE_LIST_PUBLIC_KEY_END 123
1.486 +#define STORE_F_STORE_LIST_PUBLIC_KEY_ENDP 156
1.487 +#define STORE_F_STORE_LIST_PUBLIC_KEY_NEXT 124
1.488 +#define STORE_F_STORE_LIST_PUBLIC_KEY_START 125
1.489 +#define STORE_F_STORE_MODIFY_ARBITRARY 162
1.490 +#define STORE_F_STORE_MODIFY_CERTIFICATE 163
1.491 +#define STORE_F_STORE_MODIFY_CRL 164
1.492 +#define STORE_F_STORE_MODIFY_NUMBER 165
1.493 +#define STORE_F_STORE_MODIFY_PRIVATE_KEY 166
1.494 +#define STORE_F_STORE_MODIFY_PUBLIC_KEY 167
1.495 +#define STORE_F_STORE_NEW_ENGINE 133
1.496 +#define STORE_F_STORE_NEW_METHOD 132
1.497 +#define STORE_F_STORE_PARSE_ATTRS_END 151
1.498 +#define STORE_F_STORE_PARSE_ATTRS_ENDP 172
1.499 +#define STORE_F_STORE_PARSE_ATTRS_NEXT 152
1.500 +#define STORE_F_STORE_PARSE_ATTRS_START 171
1.501 +#define STORE_F_STORE_REVOKE_CERTIFICATE 129
1.502 +#define STORE_F_STORE_REVOKE_PRIVATE_KEY 130
1.503 +#define STORE_F_STORE_REVOKE_PUBLIC_KEY 131
1.504 +#define STORE_F_STORE_STORE_ARBITRARY 157
1.505 +#define STORE_F_STORE_STORE_CERTIFICATE 100
1.506 +#define STORE_F_STORE_STORE_CRL 101
1.507 +#define STORE_F_STORE_STORE_NUMBER 126
1.508 +#define STORE_F_STORE_STORE_PRIVATE_KEY 127
1.509 +#define STORE_F_STORE_STORE_PUBLIC_KEY 128
1.510 +
1.511 +/* Reason codes. */
1.512 +#define STORE_R_ALREADY_HAS_A_VALUE 127
1.513 +#define STORE_R_FAILED_DELETING_ARBITRARY 132
1.514 +#define STORE_R_FAILED_DELETING_CERTIFICATE 100
1.515 +#define STORE_R_FAILED_DELETING_KEY 101
1.516 +#define STORE_R_FAILED_DELETING_NUMBER 102
1.517 +#define STORE_R_FAILED_GENERATING_CRL 103
1.518 +#define STORE_R_FAILED_GENERATING_KEY 104
1.519 +#define STORE_R_FAILED_GETTING_ARBITRARY 133
1.520 +#define STORE_R_FAILED_GETTING_CERTIFICATE 105
1.521 +#define STORE_R_FAILED_GETTING_KEY 106
1.522 +#define STORE_R_FAILED_GETTING_NUMBER 107
1.523 +#define STORE_R_FAILED_LISTING_CERTIFICATES 108
1.524 +#define STORE_R_FAILED_LISTING_KEYS 109
1.525 +#define STORE_R_FAILED_MODIFYING_ARBITRARY 138
1.526 +#define STORE_R_FAILED_MODIFYING_CERTIFICATE 139
1.527 +#define STORE_R_FAILED_MODIFYING_CRL 140
1.528 +#define STORE_R_FAILED_MODIFYING_NUMBER 141
1.529 +#define STORE_R_FAILED_MODIFYING_PRIVATE_KEY 142
1.530 +#define STORE_R_FAILED_MODIFYING_PUBLIC_KEY 143
1.531 +#define STORE_R_FAILED_REVOKING_CERTIFICATE 110
1.532 +#define STORE_R_FAILED_REVOKING_KEY 111
1.533 +#define STORE_R_FAILED_STORING_ARBITRARY 134
1.534 +#define STORE_R_FAILED_STORING_CERTIFICATE 112
1.535 +#define STORE_R_FAILED_STORING_KEY 113
1.536 +#define STORE_R_FAILED_STORING_NUMBER 114
1.537 +#define STORE_R_NOT_IMPLEMENTED 128
1.538 +#define STORE_R_NO_CONTROL_FUNCTION 144
1.539 +#define STORE_R_NO_DELETE_ARBITRARY_FUNCTION 135
1.540 +#define STORE_R_NO_DELETE_NUMBER_FUNCTION 115
1.541 +#define STORE_R_NO_DELETE_OBJECT_FUNCTION 116
1.542 +#define STORE_R_NO_GENERATE_CRL_FUNCTION 117
1.543 +#define STORE_R_NO_GENERATE_OBJECT_FUNCTION 118
1.544 +#define STORE_R_NO_GET_OBJECT_ARBITRARY_FUNCTION 136
1.545 +#define STORE_R_NO_GET_OBJECT_FUNCTION 119
1.546 +#define STORE_R_NO_GET_OBJECT_NUMBER_FUNCTION 120
1.547 +#define STORE_R_NO_LIST_OBJECT_ENDP_FUNCTION 131
1.548 +#define STORE_R_NO_LIST_OBJECT_END_FUNCTION 121
1.549 +#define STORE_R_NO_LIST_OBJECT_NEXT_FUNCTION 122
1.550 +#define STORE_R_NO_LIST_OBJECT_START_FUNCTION 123
1.551 +#define STORE_R_NO_MODIFY_OBJECT_FUNCTION 145
1.552 +#define STORE_R_NO_REVOKE_OBJECT_FUNCTION 124
1.553 +#define STORE_R_NO_STORE 129
1.554 +#define STORE_R_NO_STORE_OBJECT_ARBITRARY_FUNCTION 137
1.555 +#define STORE_R_NO_STORE_OBJECT_FUNCTION 125
1.556 +#define STORE_R_NO_STORE_OBJECT_NUMBER_FUNCTION 126
1.557 +#define STORE_R_NO_VALUE 130
1.558 +
1.559 +#ifdef __cplusplus
1.560 +}
1.561 +#endif
1.562 +#endif