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