1295016Sjkim/* crypto/store/str_locl.h */
2280304Sjkim/*
3280304Sjkim * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project
4280304Sjkim * 2003.
5160814Ssimon */
6160814Ssimon/* ====================================================================
7160814Ssimon * Copyright (c) 2003 The OpenSSL Project.  All rights reserved.
8160814Ssimon *
9160814Ssimon * Redistribution and use in source and binary forms, with or without
10160814Ssimon * modification, are permitted provided that the following conditions
11160814Ssimon * are met:
12160814Ssimon *
13160814Ssimon * 1. Redistributions of source code must retain the above copyright
14280304Sjkim *    notice, this list of conditions and the following disclaimer.
15160814Ssimon *
16160814Ssimon * 2. Redistributions in binary form must reproduce the above copyright
17160814Ssimon *    notice, this list of conditions and the following disclaimer in
18160814Ssimon *    the documentation and/or other materials provided with the
19160814Ssimon *    distribution.
20160814Ssimon *
21160814Ssimon * 3. All advertising materials mentioning features or use of this
22160814Ssimon *    software must display the following acknowledgment:
23160814Ssimon *    "This product includes software developed by the OpenSSL Project
24160814Ssimon *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
25160814Ssimon *
26160814Ssimon * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
27160814Ssimon *    endorse or promote products derived from this software without
28160814Ssimon *    prior written permission. For written permission, please contact
29160814Ssimon *    openssl-core@openssl.org.
30160814Ssimon *
31160814Ssimon * 5. Products derived from this software may not be called "OpenSSL"
32160814Ssimon *    nor may "OpenSSL" appear in their names without prior written
33160814Ssimon *    permission of the OpenSSL Project.
34160814Ssimon *
35160814Ssimon * 6. Redistributions of any form whatsoever must retain the following
36160814Ssimon *    acknowledgment:
37160814Ssimon *    "This product includes software developed by the OpenSSL Project
38160814Ssimon *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
39160814Ssimon *
40160814Ssimon * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
41160814Ssimon * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42160814Ssimon * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
43160814Ssimon * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
44160814Ssimon * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45160814Ssimon * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
46160814Ssimon * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
47160814Ssimon * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48160814Ssimon * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
49160814Ssimon * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
50160814Ssimon * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51160814Ssimon * OF THE POSSIBILITY OF SUCH DAMAGE.
52160814Ssimon * ====================================================================
53160814Ssimon *
54160814Ssimon * This product includes cryptographic software written by Eric Young
55160814Ssimon * (eay@cryptsoft.com).  This product includes software written by Tim
56160814Ssimon * Hudson (tjh@cryptsoft.com).
57160814Ssimon *
58160814Ssimon */
59160814Ssimon
60160814Ssimon#ifndef HEADER_STORE_LOCL_H
61280304Sjkim# define HEADER_STORE_LOCL_H
62160814Ssimon
63280304Sjkim# include <openssl/crypto.h>
64280304Sjkim# include <openssl/store.h>
65160814Ssimon
66160814Ssimon#ifdef  __cplusplus
67160814Ssimonextern "C" {
68160814Ssimon#endif
69160814Ssimon
70280304Sjkimstruct store_method_st {
71280304Sjkim    char *name;
72280304Sjkim    /*
73280304Sjkim     * All the functions return a positive integer or non-NULL for success
74280304Sjkim     * and 0, a negative integer or NULL for failure
75280304Sjkim     */
76280304Sjkim    /* Initialise the STORE with private data */
77280304Sjkim    STORE_INITIALISE_FUNC_PTR init;
78280304Sjkim    /* Initialise the STORE with private data */
79280304Sjkim    STORE_CLEANUP_FUNC_PTR clean;
80280304Sjkim    /* Generate an object of a given type */
81280304Sjkim    STORE_GENERATE_OBJECT_FUNC_PTR generate_object;
82280304Sjkim    /*
83280304Sjkim     * Get an object of a given type.  This function isn't really very useful
84280304Sjkim     * since the listing functions (below) can be used for the same purpose
85280304Sjkim     * and are much more general.
86280304Sjkim     */
87280304Sjkim    STORE_GET_OBJECT_FUNC_PTR get_object;
88280304Sjkim    /* Store an object of a given type. */
89280304Sjkim    STORE_STORE_OBJECT_FUNC_PTR store_object;
90280304Sjkim    /* Modify the attributes bound to an object of a given type. */
91280304Sjkim    STORE_MODIFY_OBJECT_FUNC_PTR modify_object;
92280304Sjkim    /* Revoke an object of a given type. */
93280304Sjkim    STORE_HANDLE_OBJECT_FUNC_PTR revoke_object;
94280304Sjkim    /* Delete an object of a given type. */
95280304Sjkim    STORE_HANDLE_OBJECT_FUNC_PTR delete_object;
96280304Sjkim    /*
97280304Sjkim     * List a bunch of objects of a given type and with the associated
98280304Sjkim     * attributes.
99280304Sjkim     */
100280304Sjkim    STORE_START_OBJECT_FUNC_PTR list_object_start;
101280304Sjkim    STORE_NEXT_OBJECT_FUNC_PTR list_object_next;
102280304Sjkim    STORE_END_OBJECT_FUNC_PTR list_object_end;
103280304Sjkim    STORE_END_OBJECT_FUNC_PTR list_object_endp;
104280304Sjkim    /* Store-level function to make any necessary update operations. */
105280304Sjkim    STORE_GENERIC_FUNC_PTR update_store;
106280304Sjkim    /* Store-level function to get exclusive access to the store. */
107280304Sjkim    STORE_GENERIC_FUNC_PTR lock_store;
108280304Sjkim    /* Store-level function to release exclusive access to the store. */
109280304Sjkim    STORE_GENERIC_FUNC_PTR unlock_store;
110280304Sjkim    /* Generic control function */
111280304Sjkim    STORE_CTRL_FUNC_PTR ctrl;
112280304Sjkim};
113160814Ssimon
114280304Sjkimstruct store_st {
115280304Sjkim    const STORE_METHOD *meth;
116280304Sjkim    /* functional reference if 'meth' is ENGINE-provided */
117280304Sjkim    ENGINE *engine;
118280304Sjkim    CRYPTO_EX_DATA ex_data;
119280304Sjkim    int references;
120280304Sjkim};
121160814Ssimon#ifdef  __cplusplus
122160814Ssimon}
123160814Ssimon#endif
124160814Ssimon
125160814Ssimon#endif
126