store.h

Go to the documentation of this file.
00001 /* crypto/store/store.h -*- mode:C; c-file-style: "eay" -*- */
00002 /* Written by Richard Levitte ([email protected]) for the OpenSSL
00003  * project 2003.
00004  */
00005 /* ====================================================================
00006  * Copyright (c) 2003 The OpenSSL Project.  All rights reserved.
00007  *
00008  * Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted provided that the following conditions
00010  * are met:
00011  *
00012  * 1. Redistributions of source code must retain the above copyright
00013  *    notice, this list of conditions and the following disclaimer. 
00014  *
00015  * 2. Redistributions in binary form must reproduce the above copyright
00016  *    notice, this list of conditions and the following disclaimer in
00017  *    the documentation and/or other materials provided with the
00018  *    distribution.
00019  *
00020  * 3. All advertising materials mentioning features or use of this
00021  *    software must display the following acknowledgment:
00022  *    "This product includes software developed by the OpenSSL Project
00023  *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
00024  *
00025  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
00026  *    endorse or promote products derived from this software without
00027  *    prior written permission. For written permission, please contact
00028  *    [email protected]
00029  *
00030  * 5. Products derived from this software may not be called "OpenSSL"
00031  *    nor may "OpenSSL" appear in their names without prior written
00032  *    permission of the OpenSSL Project.
00033  *
00034  * 6. Redistributions of any form whatsoever must retain the following
00035  *    acknowledgment:
00036  *    "This product includes software developed by the OpenSSL Project
00037  *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
00038  *
00039  * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
00040  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00041  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00042  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
00043  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00044  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
00045  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00046  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00047  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
00048  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00049  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
00050  * OF THE POSSIBILITY OF SUCH DAMAGE.
00051  * ====================================================================
00052  *
00053  * This product includes cryptographic software written by Eric Young
00054  * ([email protected]).  This product includes software written by Tim
00055  * Hudson ([email protected]).
00056  *
00057  */
00058 /*
00059  © Portions copyright (c) 2006 Nokia Corporation.  All rights reserved.
00060  */
00061 
00062 #ifndef HEADER_STORE_H
00063 #define HEADER_STORE_H
00064 
00065 #if (defined(__SYMBIAN32__) && !defined(SYMBIAN))
00066 #define SYMBIAN
00067 #endif
00068 
00069 #ifdef SYMBIAN
00070 #include <e32def.h>
00071 #endif
00072 #include <openssl/ossl_typ.h>
00073 #ifndef OPENSSL_NO_DEPRECATED
00074 #include <openssl/evp.h>
00075 #include <openssl/bn.h>
00076 #include <openssl/x509.h>
00077 #endif
00078 
00079 #ifdef  __cplusplus
00080 extern "C" {
00081 #endif
00082 
00083 /* Already defined in ossl_typ.h */
00084 /* typedef struct store_st STORE; */
00085 /* typedef struct store_method_st STORE_METHOD; */
00086 
00087 
00088 /* All the following functions return 0, a negative number or NULL on error.
00089    When everything is fine, they return a positive value or a non-NULL
00090    pointer, all depending on their purpose. */
00091 
00092 /* Creators and destructor.   */
00093 IMPORT_C STORE *STORE_new_method(const STORE_METHOD *method);
00094 IMPORT_C STORE *STORE_new_engine(ENGINE *engine);
00095 IMPORT_C void STORE_free(STORE *ui);
00096 
00097 
00098 /* Give a user interface parametrised control commands.  This can be used to
00099    send down an integer, a data pointer or a function pointer, as well as
00100    be used to get information from a STORE. */
00101 IMPORT_C int STORE_ctrl(STORE *store, int cmd, long i, void *p, void (*f)(void));
00102 
00103 /* A control to set the directory with keys and certificates.  Used by the
00104    built-in directory level method. */
00105 #define STORE_CTRL_SET_DIRECTORY        0x0001
00106 /* A control to set a file to load.  Used by the built-in file level method. */
00107 #define STORE_CTRL_SET_FILE             0x0002
00108 /* A control to set a configuration file to load.  Can be used by any method
00109    that wishes to load a configuration file. */
00110 #define STORE_CTRL_SET_CONF_FILE        0x0003
00111 /* A control to set a the section of the loaded configuration file.  Can be
00112    used by any method that wishes to load a configuration file. */
00113 #define STORE_CTRL_SET_CONF_SECTION     0x0004
00114 
00115 
00116 /* Some methods may use extra data */
00117 #define STORE_set_app_data(s,arg)       STORE_set_ex_data(s,0,arg)
00118 #define STORE_get_app_data(s)           STORE_get_ex_data(s,0)
00119 IMPORT_C int STORE_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
00120         CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
00121 IMPORT_C int STORE_set_ex_data(STORE *r,int idx,void *arg);
00122 IMPORT_C void *STORE_get_ex_data(STORE *r, int idx);
00123 
00124 /* Use specific methods instead of the built-in one */
00125 IMPORT_C const STORE_METHOD *STORE_get_method(STORE *store);
00126 IMPORT_C const STORE_METHOD *STORE_set_method(STORE *store, const STORE_METHOD *meth);
00127 
00128 /* The standard OpenSSL methods. */
00129 /* This is the in-memory method.  It does everything except revoking and updating,
00130    and is of course volatile.  It's used by other methods that have an in-memory
00131    cache. */
00132 IMPORT_C const STORE_METHOD *STORE_Memory(void);
00133 #if 0 /* Not yet implemented */
00134 /* This is the directory store.  It does everything except revoking and updating,
00135    and uses STORE_Memory() to cache things in memory. */
00136 IMPORT_C const STORE_METHOD *STORE_Directory(void);
00137 /* This is the file store.  It does everything except revoking and updating,
00138    and uses STORE_Memory() to cache things in memory.  Certificates are added
00139    to it with the store operation, and it will only get cached certificates. */
00140 IMPORT_C const STORE_METHOD *STORE_File(void);
00141 #endif
00142 
00143 /* Store functions take a type code for the type of data they should store
00144    or fetch */
00145 typedef enum STORE_object_types
00146         {
00147         STORE_OBJECT_TYPE_X509_CERTIFICATE=     0x01, /* X509 * */
00148         STORE_OBJECT_TYPE_X509_CRL=             0x02, /* X509_CRL * */
00149         STORE_OBJECT_TYPE_PRIVATE_KEY=          0x03, /* EVP_PKEY * */
00150         STORE_OBJECT_TYPE_PUBLIC_KEY=           0x04, /* EVP_PKEY * */
00151         STORE_OBJECT_TYPE_NUMBER=               0x05, /* BIGNUM * */
00152         STORE_OBJECT_TYPE_ARBITRARY=            0x06, /* BUF_MEM * */
00153         STORE_OBJECT_TYPE_NUM=                  0x06  /* The amount of known
00154                                                          object types */
00155         } STORE_OBJECT_TYPES;
00156 /* List of text strings corresponding to the object types. */
00157 extern const char * const STORE_object_type_string[STORE_OBJECT_TYPE_NUM+1];
00158 
00159 /* Some store functions take a parameter list.  Those parameters come with
00160    one of the following codes. The comments following the codes below indicate
00161    what type the value should be a pointer to. */
00162 typedef enum STORE_params
00163         {
00164         STORE_PARAM_EVP_TYPE=                   0x01, /* int */
00165         STORE_PARAM_BITS=                       0x02, /* size_t */
00166         STORE_PARAM_KEY_PARAMETERS=             0x03, /* ??? */
00167         STORE_PARAM_KEY_NO_PARAMETERS=          0x04, /* N/A */
00168         STORE_PARAM_AUTH_PASSPHRASE=            0x05, /* char * */
00169         STORE_PARAM_AUTH_KRB5_TICKET=           0x06, /* void * */
00170         STORE_PARAM_TYPE_NUM=                   0x06  /* The amount of known
00171                                                          parameter types */
00172         } STORE_PARAM_TYPES;
00173 /* Parameter value sizes.  -1 means unknown, anything else is the required size. */
00174 extern const int STORE_param_sizes[STORE_PARAM_TYPE_NUM+1];
00175 
00176 /* Store functions take attribute lists.  Those attributes come with codes.
00177    The comments following the codes below indicate what type the value should
00178    be a pointer to. */
00179 typedef enum STORE_attribs
00180         {
00181         STORE_ATTR_END=                         0x00,
00182         STORE_ATTR_FRIENDLYNAME=                0x01, /* C string */
00183         STORE_ATTR_KEYID=                       0x02, /* 160 bit string (SHA1) */
00184         STORE_ATTR_ISSUERKEYID=                 0x03, /* 160 bit string (SHA1) */
00185         STORE_ATTR_SUBJECTKEYID=                0x04, /* 160 bit string (SHA1) */
00186         STORE_ATTR_ISSUERSERIALHASH=            0x05, /* 160 bit string (SHA1) */
00187         STORE_ATTR_ISSUER=                      0x06, /* X509_NAME * */
00188         STORE_ATTR_SERIAL=                      0x07, /* BIGNUM * */
00189         STORE_ATTR_SUBJECT=                     0x08, /* X509_NAME * */
00190         STORE_ATTR_CERTHASH=                    0x09, /* 160 bit string (SHA1) */
00191         STORE_ATTR_EMAIL=                       0x0a, /* C string */
00192         STORE_ATTR_FILENAME=                    0x0b, /* C string */
00193         STORE_ATTR_TYPE_NUM=                    0x0b, /* The amount of known
00194                                                          attribute types */
00195         STORE_ATTR_OR=                          0xff  /* This is a special
00196                                                          separator, which
00197                                                          expresses the OR
00198                                                          operation.  */
00199         } STORE_ATTR_TYPES;
00200 /* Attribute value sizes.  -1 means unknown, anything else is the required size. */
00201 extern const int STORE_attr_sizes[STORE_ATTR_TYPE_NUM+1];
00202 
00203 typedef enum STORE_certificate_status
00204         {
00205         STORE_X509_VALID=                       0x00,
00206         STORE_X509_EXPIRED=                     0x01,
00207         STORE_X509_SUSPENDED=                   0x02,
00208         STORE_X509_REVOKED=                     0x03
00209         } STORE_CERTIFICATE_STATUS;
00210 
00211 /* Engine store functions will return a structure that contains all the necessary
00212  * information, including revokation status for certificates.  This is really not
00213  * needed for application authors, as the ENGINE framework functions will extract
00214  * the OpenSSL-specific information when at all possible.  However, for engine
00215  * authors, it's crucial to know this structure.  */
00216 typedef struct STORE_OBJECT_st
00217         {
00218         STORE_OBJECT_TYPES type;
00219         union
00220                 {
00221                 struct
00222                         {
00223                         STORE_CERTIFICATE_STATUS status;
00224                         X509 *certificate;
00225                         } x509;
00226                 X509_CRL *crl;
00227                 EVP_PKEY *key;
00228                 BIGNUM *number;
00229                 BUF_MEM *arbitrary;
00230                 } data;
00231         } STORE_OBJECT;
00232 DECLARE_STACK_OF(STORE_OBJECT)
00233 STORE_OBJECT *STORE_OBJECT_new(void);
00234 void STORE_OBJECT_free(STORE_OBJECT *data);
00235 
00236 
00237 
00238 /* The following functions handle the storage. They return 0, a negative number
00239    or NULL on error, anything else on success. */
00240 IMPORT_C X509 *STORE_get_certificate(STORE *e, OPENSSL_ITEM attributes[],
00241         OPENSSL_ITEM parameters[]);
00242 IMPORT_C int STORE_store_certificate(STORE *e, X509 *data, OPENSSL_ITEM attributes[],
00243         OPENSSL_ITEM parameters[]);
00244 IMPORT_C int STORE_modify_certificate(STORE *e, OPENSSL_ITEM search_attributes[],
00245         OPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[],
00246         OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
00247 IMPORT_C int STORE_revoke_certificate(STORE *e, OPENSSL_ITEM attributes[],
00248         OPENSSL_ITEM parameters[]);
00249 IMPORT_C int STORE_delete_certificate(STORE *e, OPENSSL_ITEM attributes[],
00250         OPENSSL_ITEM parameters[]);
00251 IMPORT_C void *STORE_list_certificate_start(STORE *e, OPENSSL_ITEM attributes[],
00252         OPENSSL_ITEM parameters[]);
00253 IMPORT_C X509 *STORE_list_certificate_next(STORE *e, void *handle);
00254 IMPORT_C int STORE_list_certificate_end(STORE *e, void *handle);
00255 IMPORT_C int STORE_list_certificate_endp(STORE *e, void *handle);
00256 IMPORT_C EVP_PKEY *STORE_generate_key(STORE *e, OPENSSL_ITEM attributes[],
00257         OPENSSL_ITEM parameters[]);
00258 IMPORT_C EVP_PKEY *STORE_get_private_key(STORE *e, OPENSSL_ITEM attributes[],
00259         OPENSSL_ITEM parameters[]);
00260 IMPORT_C int STORE_store_private_key(STORE *e, EVP_PKEY *data,
00261         OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
00262 IMPORT_C int STORE_modify_private_key(STORE *e, OPENSSL_ITEM search_attributes[],
00263         OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],
00264         OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
00265 IMPORT_C int STORE_revoke_private_key(STORE *e, OPENSSL_ITEM attributes[],
00266         OPENSSL_ITEM parameters[]);
00267 IMPORT_C int STORE_delete_private_key(STORE *e, OPENSSL_ITEM attributes[],
00268         OPENSSL_ITEM parameters[]);
00269 IMPORT_C void *STORE_list_private_key_start(STORE *e, OPENSSL_ITEM attributes[],
00270         OPENSSL_ITEM parameters[]);
00271 IMPORT_C EVP_PKEY *STORE_list_private_key_next(STORE *e, void *handle);
00272 IMPORT_C int STORE_list_private_key_end(STORE *e, void *handle);
00273 IMPORT_C int STORE_list_private_key_endp(STORE *e, void *handle);
00274 IMPORT_C EVP_PKEY *STORE_get_public_key(STORE *e, OPENSSL_ITEM attributes[],
00275         OPENSSL_ITEM parameters[]);
00276 IMPORT_C int STORE_store_public_key(STORE *e, EVP_PKEY *data, OPENSSL_ITEM attributes[],
00277         OPENSSL_ITEM parameters[]);
00278 IMPORT_C int STORE_modify_public_key(STORE *e, OPENSSL_ITEM search_attributes[],
00279         OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],
00280         OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
00281 IMPORT_C int STORE_revoke_public_key(STORE *e, OPENSSL_ITEM attributes[],
00282         OPENSSL_ITEM parameters[]);
00283 IMPORT_C int STORE_delete_public_key(STORE *e, OPENSSL_ITEM attributes[],
00284         OPENSSL_ITEM parameters[]);
00285 IMPORT_C void *STORE_list_public_key_start(STORE *e, OPENSSL_ITEM attributes[],
00286         OPENSSL_ITEM parameters[]);
00287 IMPORT_C EVP_PKEY *STORE_list_public_key_next(STORE *e, void *handle);
00288 IMPORT_C int STORE_list_public_key_end(STORE *e, void *handle);
00289 IMPORT_C int STORE_list_public_key_endp(STORE *e, void *handle);
00290 IMPORT_C X509_CRL *STORE_generate_crl(STORE *e, OPENSSL_ITEM attributes[],
00291         OPENSSL_ITEM parameters[]);
00292 IMPORT_C X509_CRL *STORE_get_crl(STORE *e, OPENSSL_ITEM attributes[],
00293         OPENSSL_ITEM parameters[]);
00294 IMPORT_C int STORE_store_crl(STORE *e, X509_CRL *data, OPENSSL_ITEM attributes[],
00295         OPENSSL_ITEM parameters[]);
00296 IMPORT_C int STORE_modify_crl(STORE *e, OPENSSL_ITEM search_attributes[],
00297         OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],
00298         OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
00299 IMPORT_C int STORE_delete_crl(STORE *e, OPENSSL_ITEM attributes[],
00300         OPENSSL_ITEM parameters[]);
00301 IMPORT_C void *STORE_list_crl_start(STORE *e, OPENSSL_ITEM attributes[],
00302         OPENSSL_ITEM parameters[]);
00303 IMPORT_C X509_CRL *STORE_list_crl_next(STORE *e, void *handle);
00304 IMPORT_C int STORE_list_crl_end(STORE *e, void *handle);
00305 IMPORT_C int STORE_list_crl_endp(STORE *e, void *handle);
00306 IMPORT_C int STORE_store_number(STORE *e, BIGNUM *data, OPENSSL_ITEM attributes[],
00307         OPENSSL_ITEM parameters[]);
00308 IMPORT_C int STORE_modify_number(STORE *e, OPENSSL_ITEM search_attributes[],
00309         OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],
00310         OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
00311 IMPORT_C BIGNUM *STORE_get_number(STORE *e, OPENSSL_ITEM attributes[],
00312         OPENSSL_ITEM parameters[]);
00313 IMPORT_C int STORE_delete_number(STORE *e, OPENSSL_ITEM attributes[],
00314         OPENSSL_ITEM parameters[]);
00315 IMPORT_C int STORE_store_arbitrary(STORE *e, BUF_MEM *data, OPENSSL_ITEM attributes[],
00316         OPENSSL_ITEM parameters[]);
00317 IMPORT_C int STORE_modify_arbitrary(STORE *e, OPENSSL_ITEM search_attributes[],
00318         OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],
00319         OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
00320 IMPORT_C BUF_MEM *STORE_get_arbitrary(STORE *e, OPENSSL_ITEM attributes[],
00321         OPENSSL_ITEM parameters[]);
00322 IMPORT_C int STORE_delete_arbitrary(STORE *e, OPENSSL_ITEM attributes[],
00323         OPENSSL_ITEM parameters[]);
00324 
00325 
00326 /* Create and manipulate methods */
00327 IMPORT_C STORE_METHOD *STORE_create_method(char *name);
00328 IMPORT_C void STORE_destroy_method(STORE_METHOD *store_method);
00329 
00330 /* These callback types are use for store handlers */
00331 typedef int (*STORE_INITIALISE_FUNC_PTR)(STORE *);
00332 typedef void (*STORE_CLEANUP_FUNC_PTR)(STORE *);
00333 typedef STORE_OBJECT *(*STORE_GENERATE_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
00334 typedef STORE_OBJECT *(*STORE_GET_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
00335 typedef void *(*STORE_START_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
00336 typedef STORE_OBJECT *(*STORE_NEXT_OBJECT_FUNC_PTR)(STORE *, void *handle);
00337 typedef int (*STORE_END_OBJECT_FUNC_PTR)(STORE *, void *handle);
00338 typedef int (*STORE_HANDLE_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
00339 typedef int (*STORE_STORE_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, STORE_OBJECT *data, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
00340 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[]);
00341 typedef int (*STORE_GENERIC_FUNC_PTR)(STORE *, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
00342 typedef int (*STORE_CTRL_FUNC_PTR)(STORE *, int cmd, long l, void *p, void (*f)(void));
00343 
00344 IMPORT_C int STORE_method_set_initialise_function(STORE_METHOD *sm, STORE_INITIALISE_FUNC_PTR init_f);
00345 IMPORT_C int STORE_method_set_cleanup_function(STORE_METHOD *sm, STORE_CLEANUP_FUNC_PTR clean_f);
00346 IMPORT_C int STORE_method_set_generate_function(STORE_METHOD *sm, STORE_GENERATE_OBJECT_FUNC_PTR generate_f);
00347 IMPORT_C int STORE_method_set_get_function(STORE_METHOD *sm, STORE_GET_OBJECT_FUNC_PTR get_f);
00348 IMPORT_C int STORE_method_set_store_function(STORE_METHOD *sm, STORE_STORE_OBJECT_FUNC_PTR store_f);
00349 IMPORT_C int STORE_method_set_modify_function(STORE_METHOD *sm, STORE_MODIFY_OBJECT_FUNC_PTR store_f);
00350 IMPORT_C int STORE_method_set_revoke_function(STORE_METHOD *sm, STORE_HANDLE_OBJECT_FUNC_PTR revoke_f);
00351 IMPORT_C int STORE_method_set_delete_function(STORE_METHOD *sm, STORE_HANDLE_OBJECT_FUNC_PTR delete_f);
00352 IMPORT_C int STORE_method_set_list_start_function(STORE_METHOD *sm, STORE_START_OBJECT_FUNC_PTR list_start_f);
00353 IMPORT_C int STORE_method_set_list_next_function(STORE_METHOD *sm, STORE_NEXT_OBJECT_FUNC_PTR list_next_f);
00354 IMPORT_C int STORE_method_set_list_end_function(STORE_METHOD *sm, STORE_END_OBJECT_FUNC_PTR list_end_f);
00355 IMPORT_C int STORE_method_set_update_store_function(STORE_METHOD *sm, STORE_GENERIC_FUNC_PTR);
00356 IMPORT_C int STORE_method_set_lock_store_function(STORE_METHOD *sm, STORE_GENERIC_FUNC_PTR);
00357 IMPORT_C int STORE_method_set_unlock_store_function(STORE_METHOD *sm, STORE_GENERIC_FUNC_PTR);
00358 IMPORT_C int STORE_method_set_ctrl_function(STORE_METHOD *sm, STORE_CTRL_FUNC_PTR ctrl_f);
00359 
00360 IMPORT_C STORE_INITIALISE_FUNC_PTR STORE_method_get_initialise_function(STORE_METHOD *sm);
00361 IMPORT_C STORE_CLEANUP_FUNC_PTR STORE_method_get_cleanup_function(STORE_METHOD *sm);
00362 IMPORT_C STORE_GENERATE_OBJECT_FUNC_PTR STORE_method_get_generate_function(STORE_METHOD *sm);
00363 IMPORT_C STORE_GET_OBJECT_FUNC_PTR STORE_method_get_get_function(STORE_METHOD *sm);
00364 IMPORT_C STORE_STORE_OBJECT_FUNC_PTR STORE_method_get_store_function(STORE_METHOD *sm);
00365 IMPORT_C STORE_MODIFY_OBJECT_FUNC_PTR STORE_method_get_modify_function(STORE_METHOD *sm);
00366 IMPORT_C STORE_HANDLE_OBJECT_FUNC_PTR STORE_method_get_revoke_function(STORE_METHOD *sm);
00367 IMPORT_C STORE_HANDLE_OBJECT_FUNC_PTR STORE_method_get_delete_function(STORE_METHOD *sm);
00368 IMPORT_C STORE_START_OBJECT_FUNC_PTR STORE_method_get_list_start_function(STORE_METHOD *sm);
00369 IMPORT_C STORE_NEXT_OBJECT_FUNC_PTR STORE_method_get_list_next_function(STORE_METHOD *sm);
00370 IMPORT_C STORE_END_OBJECT_FUNC_PTR STORE_method_get_list_end_function(STORE_METHOD *sm);
00371 IMPORT_C STORE_GENERIC_FUNC_PTR STORE_method_get_update_store_function(STORE_METHOD *sm);
00372 IMPORT_C STORE_GENERIC_FUNC_PTR STORE_method_get_lock_store_function(STORE_METHOD *sm);
00373 IMPORT_C STORE_GENERIC_FUNC_PTR STORE_method_get_unlock_store_function(STORE_METHOD *sm);
00374 IMPORT_C STORE_CTRL_FUNC_PTR STORE_method_get_ctrl_function(STORE_METHOD *sm);
00375 
00376 /* Method helper structures and functions. */
00377 
00378 /* This structure is the result of parsing through the information in a list
00379    of OPENSSL_ITEMs.  It stores all the necessary information in a structured
00380    way.*/
00381 typedef struct STORE_attr_info_st STORE_ATTR_INFO;
00382 
00383 /* Parse a list of OPENSSL_ITEMs and return a pointer to a STORE_ATTR_INFO.
00384    Note that we do this in the list form, since the list of OPENSSL_ITEMs can
00385    come in blocks separated with STORE_ATTR_OR.  Note that the value returned
00386    by STORE_parse_attrs_next() must be freed with STORE_ATTR_INFO_free(). */
00387 IMPORT_C void *STORE_parse_attrs_start(OPENSSL_ITEM *attributes);
00388 IMPORT_C STORE_ATTR_INFO *STORE_parse_attrs_next(void *handle);
00389 IMPORT_C int STORE_parse_attrs_end(void *handle);
00390 IMPORT_C int STORE_parse_attrs_endp(void *handle);
00391 
00392 /* Creator and destructor */
00393 IMPORT_C STORE_ATTR_INFO *STORE_ATTR_INFO_new(void);
00394 IMPORT_C int STORE_ATTR_INFO_free(STORE_ATTR_INFO *attrs);
00395 
00396 /* Manipulators */
00397 IMPORT_C char *STORE_ATTR_INFO_get0_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code);
00398 IMPORT_C unsigned char *STORE_ATTR_INFO_get0_sha1str(STORE_ATTR_INFO *attrs,
00399         STORE_ATTR_TYPES code);
00400 IMPORT_C X509_NAME *STORE_ATTR_INFO_get0_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code);
00401 IMPORT_C BIGNUM *STORE_ATTR_INFO_get0_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code);
00402 IMPORT_C int STORE_ATTR_INFO_set_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
00403         char *cstr, size_t cstr_size);
00404 IMPORT_C int STORE_ATTR_INFO_set_sha1str(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
00405         unsigned char *sha1str, size_t sha1str_size);
00406 IMPORT_C int STORE_ATTR_INFO_set_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
00407         X509_NAME *dn);
00408 IMPORT_C int STORE_ATTR_INFO_set_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
00409         BIGNUM *number);
00410 IMPORT_C int STORE_ATTR_INFO_modify_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
00411         char *cstr, size_t cstr_size);
00412 IMPORT_C int STORE_ATTR_INFO_modify_sha1str(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
00413         unsigned char *sha1str, size_t sha1str_size);
00414 IMPORT_C int STORE_ATTR_INFO_modify_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
00415         X509_NAME *dn);
00416 IMPORT_C int STORE_ATTR_INFO_modify_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
00417         BIGNUM *number);
00418 
00419 /* Compare on basis of a bit pattern formed by the STORE_ATTR_TYPES values
00420    in each contained attribute. */
00421 IMPORT_C int STORE_ATTR_INFO_compare(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b);
00422 /* Check if the set of attributes in a is within the range of attributes
00423    set in b. */
00424 IMPORT_C int STORE_ATTR_INFO_in_range(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b);
00425 /* Check if the set of attributes in a are also set in b. */
00426 IMPORT_C int STORE_ATTR_INFO_in(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b);
00427 /* Same as STORE_ATTR_INFO_in(), but also checks the attribute values. */
00428 IMPORT_C int STORE_ATTR_INFO_in_ex(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b);
00429 
00430 
00431 /* BEGIN ERROR CODES */
00432 /* The following lines are auto generated by the script mkerr.pl. Any changes
00433  * made after this point may be overwritten when the script is next run.
00434  */
00435 IMPORT_C void ERR_load_STORE_strings(void);
00436 
00437 /* Error codes for the STORE functions. */
00438 
00439 /* Function codes. */
00440 #define STORE_F_MEM_DELETE                               134
00441 #define STORE_F_MEM_GENERATE                             135
00442 #define STORE_F_MEM_LIST_END                             168
00443 #define STORE_F_MEM_LIST_NEXT                            136
00444 #define STORE_F_MEM_LIST_START                           137
00445 #define STORE_F_MEM_MODIFY                               169
00446 #define STORE_F_MEM_STORE                                138
00447 #define STORE_F_STORE_ATTR_INFO_GET0_CSTR                139
00448 #define STORE_F_STORE_ATTR_INFO_GET0_DN                  140
00449 #define STORE_F_STORE_ATTR_INFO_GET0_NUMBER              141
00450 #define STORE_F_STORE_ATTR_INFO_GET0_SHA1STR             142
00451 #define STORE_F_STORE_ATTR_INFO_MODIFY_CSTR              143
00452 #define STORE_F_STORE_ATTR_INFO_MODIFY_DN                144
00453 #define STORE_F_STORE_ATTR_INFO_MODIFY_NUMBER            145
00454 #define STORE_F_STORE_ATTR_INFO_MODIFY_SHA1STR           146
00455 #define STORE_F_STORE_ATTR_INFO_SET_CSTR                 147
00456 #define STORE_F_STORE_ATTR_INFO_SET_DN                   148
00457 #define STORE_F_STORE_ATTR_INFO_SET_NUMBER               149
00458 #define STORE_F_STORE_ATTR_INFO_SET_SHA1STR              150
00459 #define STORE_F_STORE_CERTIFICATE                        170
00460 #define STORE_F_STORE_CTRL                               161
00461 #define STORE_F_STORE_DELETE_ARBITRARY                   158
00462 #define STORE_F_STORE_DELETE_CERTIFICATE                 102
00463 #define STORE_F_STORE_DELETE_CRL                         103
00464 #define STORE_F_STORE_DELETE_NUMBER                      104
00465 #define STORE_F_STORE_DELETE_PRIVATE_KEY                 105
00466 #define STORE_F_STORE_DELETE_PUBLIC_KEY                  106
00467 #define STORE_F_STORE_GENERATE_CRL                       107
00468 #define STORE_F_STORE_GENERATE_KEY                       108
00469 #define STORE_F_STORE_GET_ARBITRARY                      159
00470 #define STORE_F_STORE_GET_CERTIFICATE                    109
00471 #define STORE_F_STORE_GET_CRL                            110
00472 #define STORE_F_STORE_GET_NUMBER                         111
00473 #define STORE_F_STORE_GET_PRIVATE_KEY                    112
00474 #define STORE_F_STORE_GET_PUBLIC_KEY                     113
00475 #define STORE_F_STORE_LIST_CERTIFICATE_END               114
00476 #define STORE_F_STORE_LIST_CERTIFICATE_ENDP              153
00477 #define STORE_F_STORE_LIST_CERTIFICATE_NEXT              115
00478 #define STORE_F_STORE_LIST_CERTIFICATE_START             116
00479 #define STORE_F_STORE_LIST_CRL_END                       117
00480 #define STORE_F_STORE_LIST_CRL_ENDP                      154
00481 #define STORE_F_STORE_LIST_CRL_NEXT                      118
00482 #define STORE_F_STORE_LIST_CRL_START                     119
00483 #define STORE_F_STORE_LIST_PRIVATE_KEY_END               120
00484 #define STORE_F_STORE_LIST_PRIVATE_KEY_ENDP              155
00485 #define STORE_F_STORE_LIST_PRIVATE_KEY_NEXT              121
00486 #define STORE_F_STORE_LIST_PRIVATE_KEY_START             122
00487 #define STORE_F_STORE_LIST_PUBLIC_KEY_END                123
00488 #define STORE_F_STORE_LIST_PUBLIC_KEY_ENDP               156
00489 #define STORE_F_STORE_LIST_PUBLIC_KEY_NEXT               124
00490 #define STORE_F_STORE_LIST_PUBLIC_KEY_START              125
00491 #define STORE_F_STORE_MODIFY_ARBITRARY                   162
00492 #define STORE_F_STORE_MODIFY_CERTIFICATE                 163
00493 #define STORE_F_STORE_MODIFY_CRL                         164
00494 #define STORE_F_STORE_MODIFY_NUMBER                      165
00495 #define STORE_F_STORE_MODIFY_PRIVATE_KEY                 166
00496 #define STORE_F_STORE_MODIFY_PUBLIC_KEY                  167
00497 #define STORE_F_STORE_NEW_ENGINE                         133
00498 #define STORE_F_STORE_NEW_METHOD                         132
00499 #define STORE_F_STORE_PARSE_ATTRS_END                    151
00500 #define STORE_F_STORE_PARSE_ATTRS_ENDP                   172
00501 #define STORE_F_STORE_PARSE_ATTRS_NEXT                   152
00502 #define STORE_F_STORE_PARSE_ATTRS_START                  171
00503 #define STORE_F_STORE_REVOKE_CERTIFICATE                 129
00504 #define STORE_F_STORE_REVOKE_PRIVATE_KEY                 130
00505 #define STORE_F_STORE_REVOKE_PUBLIC_KEY                  131
00506 #define STORE_F_STORE_STORE_ARBITRARY                    157
00507 #define STORE_F_STORE_STORE_CERTIFICATE                  100
00508 #define STORE_F_STORE_STORE_CRL                          101
00509 #define STORE_F_STORE_STORE_NUMBER                       126
00510 #define STORE_F_STORE_STORE_PRIVATE_KEY                  127
00511 #define STORE_F_STORE_STORE_PUBLIC_KEY                   128
00512 
00513 /* Reason codes. */
00514 #define STORE_R_ALREADY_HAS_A_VALUE                      127
00515 #define STORE_R_FAILED_DELETING_ARBITRARY                132
00516 #define STORE_R_FAILED_DELETING_CERTIFICATE              100
00517 #define STORE_R_FAILED_DELETING_KEY                      101
00518 #define STORE_R_FAILED_DELETING_NUMBER                   102
00519 #define STORE_R_FAILED_GENERATING_CRL                    103
00520 #define STORE_R_FAILED_GENERATING_KEY                    104
00521 #define STORE_R_FAILED_GETTING_ARBITRARY                 133
00522 #define STORE_R_FAILED_GETTING_CERTIFICATE               105
00523 #define STORE_R_FAILED_GETTING_KEY                       106
00524 #define STORE_R_FAILED_GETTING_NUMBER                    107
00525 #define STORE_R_FAILED_LISTING_CERTIFICATES              108
00526 #define STORE_R_FAILED_LISTING_KEYS                      109
00527 #define STORE_R_FAILED_MODIFYING_ARBITRARY               138
00528 #define STORE_R_FAILED_MODIFYING_CERTIFICATE             139
00529 #define STORE_R_FAILED_MODIFYING_CRL                     140
00530 #define STORE_R_FAILED_MODIFYING_NUMBER                  141
00531 #define STORE_R_FAILED_MODIFYING_PRIVATE_KEY             142
00532 #define STORE_R_FAILED_MODIFYING_PUBLIC_KEY              143
00533 #define STORE_R_FAILED_REVOKING_CERTIFICATE              110
00534 #define STORE_R_FAILED_REVOKING_KEY                      111
00535 #define STORE_R_FAILED_STORING_ARBITRARY                 134
00536 #define STORE_R_FAILED_STORING_CERTIFICATE               112
00537 #define STORE_R_FAILED_STORING_KEY                       113
00538 #define STORE_R_FAILED_STORING_NUMBER                    114
00539 #define STORE_R_NOT_IMPLEMENTED                          128
00540 #define STORE_R_NO_CONTROL_FUNCTION                      144
00541 #define STORE_R_NO_DELETE_ARBITRARY_FUNCTION             135
00542 #define STORE_R_NO_DELETE_NUMBER_FUNCTION                115
00543 #define STORE_R_NO_DELETE_OBJECT_FUNCTION                116
00544 #define STORE_R_NO_GENERATE_CRL_FUNCTION                 117
00545 #define STORE_R_NO_GENERATE_OBJECT_FUNCTION              118
00546 #define STORE_R_NO_GET_OBJECT_ARBITRARY_FUNCTION         136
00547 #define STORE_R_NO_GET_OBJECT_FUNCTION                   119
00548 #define STORE_R_NO_GET_OBJECT_NUMBER_FUNCTION            120
00549 #define STORE_R_NO_LIST_OBJECT_ENDP_FUNCTION             131
00550 #define STORE_R_NO_LIST_OBJECT_END_FUNCTION              121
00551 #define STORE_R_NO_LIST_OBJECT_NEXT_FUNCTION             122
00552 #define STORE_R_NO_LIST_OBJECT_START_FUNCTION            123
00553 #define STORE_R_NO_MODIFY_OBJECT_FUNCTION                145
00554 #define STORE_R_NO_REVOKE_OBJECT_FUNCTION                124
00555 #define STORE_R_NO_STORE                                 129
00556 #define STORE_R_NO_STORE_OBJECT_ARBITRARY_FUNCTION       137
00557 #define STORE_R_NO_STORE_OBJECT_FUNCTION                 125
00558 #define STORE_R_NO_STORE_OBJECT_NUMBER_FUNCTION          126
00559 #define STORE_R_NO_VALUE                                 130
00560 
00561 #ifdef  __cplusplus
00562 }
00563 #endif
00564 #endif

Copyright © Nokia Corporation 2001-2008
Back to top