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