xref: /freebsd-src/crypto/openssl/include/openssl/store.h (revision b077aed33b7b6aefca7b17ddb250cf521f938613)
1e71b7053SJung-uk Kim /*
2*b077aed3SPierre Pronchery  * Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
3e71b7053SJung-uk Kim  *
4*b077aed3SPierre Pronchery  * Licensed under the Apache License 2.0 (the "License").  You may not use
5e71b7053SJung-uk Kim  * this file except in compliance with the License.  You can obtain a copy
6e71b7053SJung-uk Kim  * in the file LICENSE in the source distribution or at
7e71b7053SJung-uk Kim  * https://www.openssl.org/source/license.html
8e71b7053SJung-uk Kim  */
9e71b7053SJung-uk Kim 
10*b077aed3SPierre Pronchery #ifndef OPENSSL_STORE_H
11*b077aed3SPierre Pronchery # define OPENSSL_STORE_H
12*b077aed3SPierre Pronchery # pragma once
13*b077aed3SPierre Pronchery 
14*b077aed3SPierre Pronchery # include <openssl/macros.h>
15*b077aed3SPierre Pronchery # ifndef OPENSSL_NO_DEPRECATED_3_0
16e71b7053SJung-uk Kim #  define HEADER_OSSL_STORE_H
17*b077aed3SPierre Pronchery # endif
18e71b7053SJung-uk Kim 
19e71b7053SJung-uk Kim # include <stdarg.h>
20*b077aed3SPierre Pronchery # include <openssl/types.h>
21e71b7053SJung-uk Kim # include <openssl/pem.h>
22e71b7053SJung-uk Kim # include <openssl/storeerr.h>
23e71b7053SJung-uk Kim 
24e71b7053SJung-uk Kim # ifdef  __cplusplus
25e71b7053SJung-uk Kim extern "C" {
26e71b7053SJung-uk Kim # endif
27e71b7053SJung-uk Kim 
28e71b7053SJung-uk Kim /*-
29e71b7053SJung-uk Kim  *  The main OSSL_STORE functions.
30e71b7053SJung-uk Kim  *  ------------------------------
31e71b7053SJung-uk Kim  *
32e71b7053SJung-uk Kim  *  These allow applications to open a channel to a resource with supported
33e71b7053SJung-uk Kim  *  data (keys, certs, crls, ...), read the data a piece at a time and decide
34e71b7053SJung-uk Kim  *  what to do with it, and finally close.
35e71b7053SJung-uk Kim  */
36e71b7053SJung-uk Kim 
37e71b7053SJung-uk Kim typedef struct ossl_store_ctx_st OSSL_STORE_CTX;
38e71b7053SJung-uk Kim 
39e71b7053SJung-uk Kim /*
40e71b7053SJung-uk Kim  * Typedef for the OSSL_STORE_INFO post processing callback.  This can be used
41e71b7053SJung-uk Kim  * to massage the given OSSL_STORE_INFO, or to drop it entirely (by returning
42e71b7053SJung-uk Kim  * NULL).
43e71b7053SJung-uk Kim  */
44e71b7053SJung-uk Kim typedef OSSL_STORE_INFO *(*OSSL_STORE_post_process_info_fn)(OSSL_STORE_INFO *,
45e71b7053SJung-uk Kim                                                             void *);
46e71b7053SJung-uk Kim 
47e71b7053SJung-uk Kim /*
48e71b7053SJung-uk Kim  * Open a channel given a URI.  The given UI method will be used any time the
49e71b7053SJung-uk Kim  * loader needs extra input, for example when a password or pin is needed, and
50e71b7053SJung-uk Kim  * will be passed the same user data every time it's needed in this context.
51e71b7053SJung-uk Kim  *
52e71b7053SJung-uk Kim  * Returns a context reference which represents the channel to communicate
53e71b7053SJung-uk Kim  * through.
54e71b7053SJung-uk Kim  */
55*b077aed3SPierre Pronchery OSSL_STORE_CTX *
56*b077aed3SPierre Pronchery OSSL_STORE_open(const char *uri, const UI_METHOD *ui_method, void *ui_data,
57*b077aed3SPierre Pronchery                 OSSL_STORE_post_process_info_fn post_process,
58*b077aed3SPierre Pronchery                 void *post_process_data);
59*b077aed3SPierre Pronchery OSSL_STORE_CTX *
60*b077aed3SPierre Pronchery OSSL_STORE_open_ex(const char *uri, OSSL_LIB_CTX *libctx, const char *propq,
61*b077aed3SPierre Pronchery                    const UI_METHOD *ui_method, void *ui_data,
62*b077aed3SPierre Pronchery                    const OSSL_PARAM params[],
63e71b7053SJung-uk Kim                    OSSL_STORE_post_process_info_fn post_process,
64e71b7053SJung-uk Kim                    void *post_process_data);
65e71b7053SJung-uk Kim 
66e71b7053SJung-uk Kim /*
67e71b7053SJung-uk Kim  * Control / fine tune the OSSL_STORE channel.  |cmd| determines what is to be
68e71b7053SJung-uk Kim  * done, and depends on the underlying loader (use OSSL_STORE_get0_scheme to
69e71b7053SJung-uk Kim  * determine which loader is used), except for common commands (see below).
70e71b7053SJung-uk Kim  * Each command takes different arguments.
71e71b7053SJung-uk Kim  */
72*b077aed3SPierre Pronchery # ifndef OPENSSL_NO_DEPRECATED_3_0
73*b077aed3SPierre Pronchery OSSL_DEPRECATEDIN_3_0 int OSSL_STORE_ctrl(OSSL_STORE_CTX *ctx, int cmd,
74*b077aed3SPierre Pronchery                                           ... /* args */);
75*b077aed3SPierre Pronchery OSSL_DEPRECATEDIN_3_0 int OSSL_STORE_vctrl(OSSL_STORE_CTX *ctx, int cmd,
76*b077aed3SPierre Pronchery                                            va_list args);
77*b077aed3SPierre Pronchery # endif
78*b077aed3SPierre Pronchery 
79*b077aed3SPierre Pronchery # ifndef OPENSSL_NO_DEPRECATED_3_0
80e71b7053SJung-uk Kim 
81e71b7053SJung-uk Kim /*
82e71b7053SJung-uk Kim  * Common ctrl commands that different loaders may choose to support.
83e71b7053SJung-uk Kim  */
84e71b7053SJung-uk Kim /* int on = 0 or 1; STORE_ctrl(ctx, STORE_C_USE_SECMEM, &on); */
85e71b7053SJung-uk Kim # define OSSL_STORE_C_USE_SECMEM      1
86e71b7053SJung-uk Kim /* Where custom commands start */
87e71b7053SJung-uk Kim # define OSSL_STORE_C_CUSTOM_START    100
88e71b7053SJung-uk Kim 
89*b077aed3SPierre Pronchery # endif
90*b077aed3SPierre Pronchery 
91e71b7053SJung-uk Kim /*
92e71b7053SJung-uk Kim  * Read one data item (a key, a cert, a CRL) that is supported by the OSSL_STORE
93e71b7053SJung-uk Kim  * functionality, given a context.
94e71b7053SJung-uk Kim  * Returns a OSSL_STORE_INFO pointer, from which OpenSSL typed data can be
95e71b7053SJung-uk Kim  * extracted with OSSL_STORE_INFO_get0_PKEY(), OSSL_STORE_INFO_get0_CERT(), ...
96e71b7053SJung-uk Kim  * NULL is returned on error, which may include that the data found at the URI
97e71b7053SJung-uk Kim  * can't be figured out for certain or is ambiguous.
98e71b7053SJung-uk Kim  */
99e71b7053SJung-uk Kim OSSL_STORE_INFO *OSSL_STORE_load(OSSL_STORE_CTX *ctx);
100e71b7053SJung-uk Kim 
101e71b7053SJung-uk Kim /*
102e71b7053SJung-uk Kim  * Check if end of data (end of file) is reached
103e71b7053SJung-uk Kim  * Returns 1 on end, 0 otherwise.
104e71b7053SJung-uk Kim  */
105e71b7053SJung-uk Kim int OSSL_STORE_eof(OSSL_STORE_CTX *ctx);
106e71b7053SJung-uk Kim 
107e71b7053SJung-uk Kim /*
108da327cd2SJung-uk Kim  * Check if an error occurred
109e71b7053SJung-uk Kim  * Returns 1 if it did, 0 otherwise.
110e71b7053SJung-uk Kim  */
111e71b7053SJung-uk Kim int OSSL_STORE_error(OSSL_STORE_CTX *ctx);
112e71b7053SJung-uk Kim 
113e71b7053SJung-uk Kim /*
114e71b7053SJung-uk Kim  * Close the channel
115e71b7053SJung-uk Kim  * Returns 1 on success, 0 on error.
116e71b7053SJung-uk Kim  */
117e71b7053SJung-uk Kim int OSSL_STORE_close(OSSL_STORE_CTX *ctx);
118e71b7053SJung-uk Kim 
119*b077aed3SPierre Pronchery /*
120*b077aed3SPierre Pronchery  * Attach to a BIO.  This works like OSSL_STORE_open() except it takes a
121*b077aed3SPierre Pronchery  * BIO instead of a uri, along with a scheme to use when reading.
122*b077aed3SPierre Pronchery  * The given UI method will be used any time the loader needs extra input,
123*b077aed3SPierre Pronchery  * for example when a password or pin is needed, and will be passed the
124*b077aed3SPierre Pronchery  * same user data every time it's needed in this context.
125*b077aed3SPierre Pronchery  *
126*b077aed3SPierre Pronchery  * Returns a context reference which represents the channel to communicate
127*b077aed3SPierre Pronchery  * through.
128*b077aed3SPierre Pronchery  *
129*b077aed3SPierre Pronchery  * Note that this function is considered unsafe, all depending on what the
130*b077aed3SPierre Pronchery  * BIO actually reads.
131*b077aed3SPierre Pronchery  */
132*b077aed3SPierre Pronchery OSSL_STORE_CTX *OSSL_STORE_attach(BIO *bio, const char *scheme,
133*b077aed3SPierre Pronchery                                   OSSL_LIB_CTX *libctx, const char *propq,
134*b077aed3SPierre Pronchery                                   const UI_METHOD *ui_method, void *ui_data,
135*b077aed3SPierre Pronchery                                   const OSSL_PARAM params[],
136*b077aed3SPierre Pronchery                                   OSSL_STORE_post_process_info_fn post_process,
137*b077aed3SPierre Pronchery                                   void *post_process_data);
138e71b7053SJung-uk Kim 
139e71b7053SJung-uk Kim /*-
140e71b7053SJung-uk Kim  *  Extracting OpenSSL types from and creating new OSSL_STORE_INFOs
141e71b7053SJung-uk Kim  *  ---------------------------------------------------------------
142e71b7053SJung-uk Kim  */
143e71b7053SJung-uk Kim 
144e71b7053SJung-uk Kim /*
145e71b7053SJung-uk Kim  * Types of data that can be ossl_stored in a OSSL_STORE_INFO.
146e71b7053SJung-uk Kim  * OSSL_STORE_INFO_NAME is typically found when getting a listing of
147e71b7053SJung-uk Kim  * available "files" / "tokens" / what have you.
148e71b7053SJung-uk Kim  */
149e71b7053SJung-uk Kim # define OSSL_STORE_INFO_NAME           1   /* char * */
150e71b7053SJung-uk Kim # define OSSL_STORE_INFO_PARAMS         2   /* EVP_PKEY * */
151*b077aed3SPierre Pronchery # define OSSL_STORE_INFO_PUBKEY         3   /* EVP_PKEY * */
152*b077aed3SPierre Pronchery # define OSSL_STORE_INFO_PKEY           4   /* EVP_PKEY * */
153*b077aed3SPierre Pronchery # define OSSL_STORE_INFO_CERT           5   /* X509 * */
154*b077aed3SPierre Pronchery # define OSSL_STORE_INFO_CRL            6   /* X509_CRL * */
155e71b7053SJung-uk Kim 
156e71b7053SJung-uk Kim /*
157e71b7053SJung-uk Kim  * Functions to generate OSSL_STORE_INFOs, one function for each type we
158e71b7053SJung-uk Kim  * support having in them, as well as a generic constructor.
159e71b7053SJung-uk Kim  *
160da327cd2SJung-uk Kim  * In all cases, ownership of the object is transferred to the OSSL_STORE_INFO
161e71b7053SJung-uk Kim  * and will therefore be freed when the OSSL_STORE_INFO is freed.
162e71b7053SJung-uk Kim  */
163*b077aed3SPierre Pronchery OSSL_STORE_INFO *OSSL_STORE_INFO_new(int type, void *data);
164e71b7053SJung-uk Kim OSSL_STORE_INFO *OSSL_STORE_INFO_new_NAME(char *name);
165e71b7053SJung-uk Kim int OSSL_STORE_INFO_set0_NAME_description(OSSL_STORE_INFO *info, char *desc);
166e71b7053SJung-uk Kim OSSL_STORE_INFO *OSSL_STORE_INFO_new_PARAMS(EVP_PKEY *params);
167*b077aed3SPierre Pronchery OSSL_STORE_INFO *OSSL_STORE_INFO_new_PUBKEY(EVP_PKEY *pubkey);
168e71b7053SJung-uk Kim OSSL_STORE_INFO *OSSL_STORE_INFO_new_PKEY(EVP_PKEY *pkey);
169e71b7053SJung-uk Kim OSSL_STORE_INFO *OSSL_STORE_INFO_new_CERT(X509 *x509);
170e71b7053SJung-uk Kim OSSL_STORE_INFO *OSSL_STORE_INFO_new_CRL(X509_CRL *crl);
171e71b7053SJung-uk Kim 
172e71b7053SJung-uk Kim /*
173e71b7053SJung-uk Kim  * Functions to try to extract data from a OSSL_STORE_INFO.
174e71b7053SJung-uk Kim  */
175e71b7053SJung-uk Kim int OSSL_STORE_INFO_get_type(const OSSL_STORE_INFO *info);
176*b077aed3SPierre Pronchery void *OSSL_STORE_INFO_get0_data(int type, const OSSL_STORE_INFO *info);
177e71b7053SJung-uk Kim const char *OSSL_STORE_INFO_get0_NAME(const OSSL_STORE_INFO *info);
178e71b7053SJung-uk Kim char *OSSL_STORE_INFO_get1_NAME(const OSSL_STORE_INFO *info);
179e71b7053SJung-uk Kim const char *OSSL_STORE_INFO_get0_NAME_description(const OSSL_STORE_INFO *info);
180e71b7053SJung-uk Kim char *OSSL_STORE_INFO_get1_NAME_description(const OSSL_STORE_INFO *info);
181e71b7053SJung-uk Kim EVP_PKEY *OSSL_STORE_INFO_get0_PARAMS(const OSSL_STORE_INFO *info);
182e71b7053SJung-uk Kim EVP_PKEY *OSSL_STORE_INFO_get1_PARAMS(const OSSL_STORE_INFO *info);
183*b077aed3SPierre Pronchery EVP_PKEY *OSSL_STORE_INFO_get0_PUBKEY(const OSSL_STORE_INFO *info);
184*b077aed3SPierre Pronchery EVP_PKEY *OSSL_STORE_INFO_get1_PUBKEY(const OSSL_STORE_INFO *info);
185e71b7053SJung-uk Kim EVP_PKEY *OSSL_STORE_INFO_get0_PKEY(const OSSL_STORE_INFO *info);
186e71b7053SJung-uk Kim EVP_PKEY *OSSL_STORE_INFO_get1_PKEY(const OSSL_STORE_INFO *info);
187e71b7053SJung-uk Kim X509 *OSSL_STORE_INFO_get0_CERT(const OSSL_STORE_INFO *info);
188e71b7053SJung-uk Kim X509 *OSSL_STORE_INFO_get1_CERT(const OSSL_STORE_INFO *info);
189e71b7053SJung-uk Kim X509_CRL *OSSL_STORE_INFO_get0_CRL(const OSSL_STORE_INFO *info);
190e71b7053SJung-uk Kim X509_CRL *OSSL_STORE_INFO_get1_CRL(const OSSL_STORE_INFO *info);
191e71b7053SJung-uk Kim 
192e71b7053SJung-uk Kim const char *OSSL_STORE_INFO_type_string(int type);
193e71b7053SJung-uk Kim 
194e71b7053SJung-uk Kim /*
195e71b7053SJung-uk Kim  * Free the OSSL_STORE_INFO
196e71b7053SJung-uk Kim  */
197e71b7053SJung-uk Kim void OSSL_STORE_INFO_free(OSSL_STORE_INFO *info);
198e71b7053SJung-uk Kim 
199e71b7053SJung-uk Kim 
200e71b7053SJung-uk Kim /*-
201e71b7053SJung-uk Kim  *  Functions to construct a search URI from a base URI and search criteria
202e71b7053SJung-uk Kim  *  -----------------------------------------------------------------------
203e71b7053SJung-uk Kim  */
204e71b7053SJung-uk Kim 
205e71b7053SJung-uk Kim /* OSSL_STORE search types */
206e71b7053SJung-uk Kim # define OSSL_STORE_SEARCH_BY_NAME              1 /* subject in certs, issuer in CRLs */
207e71b7053SJung-uk Kim # define OSSL_STORE_SEARCH_BY_ISSUER_SERIAL     2
208e71b7053SJung-uk Kim # define OSSL_STORE_SEARCH_BY_KEY_FINGERPRINT   3
209e71b7053SJung-uk Kim # define OSSL_STORE_SEARCH_BY_ALIAS             4
210e71b7053SJung-uk Kim 
211e71b7053SJung-uk Kim /* To check what search types the scheme handler supports */
212e71b7053SJung-uk Kim int OSSL_STORE_supports_search(OSSL_STORE_CTX *ctx, int search_type);
213e71b7053SJung-uk Kim 
214e71b7053SJung-uk Kim /* Search term constructors */
215e71b7053SJung-uk Kim /*
216e71b7053SJung-uk Kim  * The input is considered to be owned by the caller, and must therefore
217e71b7053SJung-uk Kim  * remain present throughout the lifetime of the returned OSSL_STORE_SEARCH
218e71b7053SJung-uk Kim  */
219e71b7053SJung-uk Kim OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_name(X509_NAME *name);
220e71b7053SJung-uk Kim OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_issuer_serial(X509_NAME *name,
221e71b7053SJung-uk Kim                                                       const ASN1_INTEGER
222e71b7053SJung-uk Kim                                                       *serial);
223e71b7053SJung-uk Kim OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_key_fingerprint(const EVP_MD *digest,
224e71b7053SJung-uk Kim                                                         const unsigned char
225e71b7053SJung-uk Kim                                                         *bytes, size_t len);
226e71b7053SJung-uk Kim OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_alias(const char *alias);
227e71b7053SJung-uk Kim 
228e71b7053SJung-uk Kim /* Search term destructor */
229e71b7053SJung-uk Kim void OSSL_STORE_SEARCH_free(OSSL_STORE_SEARCH *search);
230e71b7053SJung-uk Kim 
231e71b7053SJung-uk Kim /* Search term accessors */
232e71b7053SJung-uk Kim int OSSL_STORE_SEARCH_get_type(const OSSL_STORE_SEARCH *criterion);
233*b077aed3SPierre Pronchery X509_NAME *OSSL_STORE_SEARCH_get0_name(const OSSL_STORE_SEARCH *criterion);
234e71b7053SJung-uk Kim const ASN1_INTEGER *OSSL_STORE_SEARCH_get0_serial(const OSSL_STORE_SEARCH
235e71b7053SJung-uk Kim                                                   *criterion);
236e71b7053SJung-uk Kim const unsigned char *OSSL_STORE_SEARCH_get0_bytes(const OSSL_STORE_SEARCH
237e71b7053SJung-uk Kim                                                   *criterion, size_t *length);
238e71b7053SJung-uk Kim const char *OSSL_STORE_SEARCH_get0_string(const OSSL_STORE_SEARCH *criterion);
239e71b7053SJung-uk Kim const EVP_MD *OSSL_STORE_SEARCH_get0_digest(const OSSL_STORE_SEARCH *criterion);
240e71b7053SJung-uk Kim 
241e71b7053SJung-uk Kim /*
242e71b7053SJung-uk Kim  * Add search criterion and expected return type (which can be unspecified)
243e71b7053SJung-uk Kim  * to the loading channel.  This MUST happen before the first OSSL_STORE_load().
244e71b7053SJung-uk Kim  */
245e71b7053SJung-uk Kim int OSSL_STORE_expect(OSSL_STORE_CTX *ctx, int expected_type);
246*b077aed3SPierre Pronchery int OSSL_STORE_find(OSSL_STORE_CTX *ctx, const OSSL_STORE_SEARCH *search);
247e71b7053SJung-uk Kim 
248e71b7053SJung-uk Kim 
249e71b7053SJung-uk Kim /*-
250*b077aed3SPierre Pronchery  *  Function to fetch a loader and extract data from it
251*b077aed3SPierre Pronchery  *  ---------------------------------------------------
252*b077aed3SPierre Pronchery  */
253*b077aed3SPierre Pronchery 
254*b077aed3SPierre Pronchery typedef struct ossl_store_loader_st OSSL_STORE_LOADER;
255*b077aed3SPierre Pronchery 
256*b077aed3SPierre Pronchery OSSL_STORE_LOADER *OSSL_STORE_LOADER_fetch(OSSL_LIB_CTX *libctx,
257*b077aed3SPierre Pronchery                                            const char *scheme,
258*b077aed3SPierre Pronchery                                            const char *properties);
259*b077aed3SPierre Pronchery int OSSL_STORE_LOADER_up_ref(OSSL_STORE_LOADER *loader);
260*b077aed3SPierre Pronchery void OSSL_STORE_LOADER_free(OSSL_STORE_LOADER *loader);
261*b077aed3SPierre Pronchery const OSSL_PROVIDER *OSSL_STORE_LOADER_get0_provider(const OSSL_STORE_LOADER *
262*b077aed3SPierre Pronchery                                                 loader);
263*b077aed3SPierre Pronchery const char *OSSL_STORE_LOADER_get0_properties(const OSSL_STORE_LOADER *loader);
264*b077aed3SPierre Pronchery const char *OSSL_STORE_LOADER_get0_description(const OSSL_STORE_LOADER *loader);
265*b077aed3SPierre Pronchery int OSSL_STORE_LOADER_is_a(const OSSL_STORE_LOADER *loader,
266*b077aed3SPierre Pronchery                            const char *scheme);
267*b077aed3SPierre Pronchery void OSSL_STORE_LOADER_do_all_provided(OSSL_LIB_CTX *libctx,
268*b077aed3SPierre Pronchery                                        void (*fn)(OSSL_STORE_LOADER *loader,
269*b077aed3SPierre Pronchery                                                   void *arg),
270*b077aed3SPierre Pronchery                                        void *arg);
271*b077aed3SPierre Pronchery int OSSL_STORE_LOADER_names_do_all(const OSSL_STORE_LOADER *loader,
272*b077aed3SPierre Pronchery                                    void (*fn)(const char *name, void *data),
273*b077aed3SPierre Pronchery                                    void *data);
274*b077aed3SPierre Pronchery 
275*b077aed3SPierre Pronchery /*-
276e71b7053SJung-uk Kim  *  Function to register a loader for the given URI scheme.
277e71b7053SJung-uk Kim  *  -------------------------------------------------------
278e71b7053SJung-uk Kim  *
279e71b7053SJung-uk Kim  *  The loader receives all the main components of an URI except for the
280e71b7053SJung-uk Kim  *  scheme.
281e71b7053SJung-uk Kim  */
282e71b7053SJung-uk Kim 
283*b077aed3SPierre Pronchery # ifndef OPENSSL_NO_DEPRECATED_3_0
284*b077aed3SPierre Pronchery 
285e71b7053SJung-uk Kim /* struct ossl_store_loader_ctx_st is defined differently by each loader */
286e71b7053SJung-uk Kim typedef struct ossl_store_loader_ctx_st OSSL_STORE_LOADER_CTX;
287*b077aed3SPierre Pronchery typedef OSSL_STORE_LOADER_CTX *(*OSSL_STORE_open_fn)
288*b077aed3SPierre Pronchery     (const OSSL_STORE_LOADER *loader, const char *uri,
289*b077aed3SPierre Pronchery      const UI_METHOD *ui_method, void *ui_data);
290*b077aed3SPierre Pronchery typedef OSSL_STORE_LOADER_CTX *(*OSSL_STORE_open_ex_fn)
291*b077aed3SPierre Pronchery     (const OSSL_STORE_LOADER *loader,
292*b077aed3SPierre Pronchery      const char *uri, OSSL_LIB_CTX *libctx, const char *propq,
293*b077aed3SPierre Pronchery      const UI_METHOD *ui_method, void *ui_data);
294*b077aed3SPierre Pronchery 
295*b077aed3SPierre Pronchery typedef OSSL_STORE_LOADER_CTX *(*OSSL_STORE_attach_fn)
296*b077aed3SPierre Pronchery     (const OSSL_STORE_LOADER *loader, BIO *bio,
297*b077aed3SPierre Pronchery      OSSL_LIB_CTX *libctx, const char *propq,
298*b077aed3SPierre Pronchery      const UI_METHOD *ui_method, void *ui_data);
299*b077aed3SPierre Pronchery typedef int (*OSSL_STORE_ctrl_fn)
300*b077aed3SPierre Pronchery     (OSSL_STORE_LOADER_CTX *ctx, int cmd, va_list args);
301*b077aed3SPierre Pronchery typedef int (*OSSL_STORE_expect_fn)
302*b077aed3SPierre Pronchery     (OSSL_STORE_LOADER_CTX *ctx, int expected);
303*b077aed3SPierre Pronchery typedef int (*OSSL_STORE_find_fn)
304*b077aed3SPierre Pronchery     (OSSL_STORE_LOADER_CTX *ctx, const OSSL_STORE_SEARCH *criteria);
305*b077aed3SPierre Pronchery typedef OSSL_STORE_INFO *(*OSSL_STORE_load_fn)
306*b077aed3SPierre Pronchery     (OSSL_STORE_LOADER_CTX *ctx, const UI_METHOD *ui_method, void *ui_data);
307*b077aed3SPierre Pronchery typedef int (*OSSL_STORE_eof_fn)(OSSL_STORE_LOADER_CTX *ctx);
308*b077aed3SPierre Pronchery typedef int (*OSSL_STORE_error_fn)(OSSL_STORE_LOADER_CTX *ctx);
309*b077aed3SPierre Pronchery typedef int (*OSSL_STORE_close_fn)(OSSL_STORE_LOADER_CTX *ctx);
310*b077aed3SPierre Pronchery 
311*b077aed3SPierre Pronchery # endif
312*b077aed3SPierre Pronchery # ifndef OPENSSL_NO_DEPRECATED_3_0
313*b077aed3SPierre Pronchery OSSL_DEPRECATEDIN_3_0
314*b077aed3SPierre Pronchery OSSL_STORE_LOADER *OSSL_STORE_LOADER_new(ENGINE *e, const char *scheme);
315*b077aed3SPierre Pronchery OSSL_DEPRECATEDIN_3_0
316e71b7053SJung-uk Kim int OSSL_STORE_LOADER_set_open(OSSL_STORE_LOADER *loader,
317e71b7053SJung-uk Kim                                OSSL_STORE_open_fn open_function);
318*b077aed3SPierre Pronchery OSSL_DEPRECATEDIN_3_0
319*b077aed3SPierre Pronchery int OSSL_STORE_LOADER_set_open_ex(OSSL_STORE_LOADER *loader,
320*b077aed3SPierre Pronchery                                   OSSL_STORE_open_ex_fn open_ex_function);
321*b077aed3SPierre Pronchery OSSL_DEPRECATEDIN_3_0
322*b077aed3SPierre Pronchery int OSSL_STORE_LOADER_set_attach(OSSL_STORE_LOADER *loader,
323*b077aed3SPierre Pronchery                                  OSSL_STORE_attach_fn attach_function);
324*b077aed3SPierre Pronchery OSSL_DEPRECATEDIN_3_0
325e71b7053SJung-uk Kim int OSSL_STORE_LOADER_set_ctrl(OSSL_STORE_LOADER *loader,
326e71b7053SJung-uk Kim                                OSSL_STORE_ctrl_fn ctrl_function);
327*b077aed3SPierre Pronchery OSSL_DEPRECATEDIN_3_0
328e71b7053SJung-uk Kim int OSSL_STORE_LOADER_set_expect(OSSL_STORE_LOADER *loader,
329e71b7053SJung-uk Kim                                  OSSL_STORE_expect_fn expect_function);
330*b077aed3SPierre Pronchery OSSL_DEPRECATEDIN_3_0
331e71b7053SJung-uk Kim int OSSL_STORE_LOADER_set_find(OSSL_STORE_LOADER *loader,
332e71b7053SJung-uk Kim                                OSSL_STORE_find_fn find_function);
333*b077aed3SPierre Pronchery OSSL_DEPRECATEDIN_3_0
334e71b7053SJung-uk Kim int OSSL_STORE_LOADER_set_load(OSSL_STORE_LOADER *loader,
335e71b7053SJung-uk Kim                                OSSL_STORE_load_fn load_function);
336*b077aed3SPierre Pronchery OSSL_DEPRECATEDIN_3_0
337e71b7053SJung-uk Kim int OSSL_STORE_LOADER_set_eof(OSSL_STORE_LOADER *loader,
338e71b7053SJung-uk Kim                               OSSL_STORE_eof_fn eof_function);
339*b077aed3SPierre Pronchery OSSL_DEPRECATEDIN_3_0
340e71b7053SJung-uk Kim int OSSL_STORE_LOADER_set_error(OSSL_STORE_LOADER *loader,
341e71b7053SJung-uk Kim                                 OSSL_STORE_error_fn error_function);
342*b077aed3SPierre Pronchery OSSL_DEPRECATEDIN_3_0
343e71b7053SJung-uk Kim int OSSL_STORE_LOADER_set_close(OSSL_STORE_LOADER *loader,
344e71b7053SJung-uk Kim                                 OSSL_STORE_close_fn close_function);
345*b077aed3SPierre Pronchery OSSL_DEPRECATEDIN_3_0
346*b077aed3SPierre Pronchery const ENGINE *OSSL_STORE_LOADER_get0_engine(const OSSL_STORE_LOADER *loader);
347*b077aed3SPierre Pronchery OSSL_DEPRECATEDIN_3_0
348*b077aed3SPierre Pronchery const char * OSSL_STORE_LOADER_get0_scheme(const OSSL_STORE_LOADER *loader);
349*b077aed3SPierre Pronchery OSSL_DEPRECATEDIN_3_0
350e71b7053SJung-uk Kim int OSSL_STORE_register_loader(OSSL_STORE_LOADER *loader);
351*b077aed3SPierre Pronchery OSSL_DEPRECATEDIN_3_0
352e71b7053SJung-uk Kim OSSL_STORE_LOADER *OSSL_STORE_unregister_loader(const char *scheme);
353*b077aed3SPierre Pronchery # endif
354e71b7053SJung-uk Kim 
355e71b7053SJung-uk Kim /*-
356e71b7053SJung-uk Kim  *  Functions to list STORE loaders
357e71b7053SJung-uk Kim  *  -------------------------------
358e71b7053SJung-uk Kim  */
359*b077aed3SPierre Pronchery # ifndef OPENSSL_NO_DEPRECATED_3_0
360*b077aed3SPierre Pronchery OSSL_DEPRECATEDIN_3_0
361*b077aed3SPierre Pronchery int OSSL_STORE_do_all_loaders(void (*do_function)(const OSSL_STORE_LOADER *loader,
362*b077aed3SPierre Pronchery                                                   void *do_arg),
363e71b7053SJung-uk Kim                               void *do_arg);
364*b077aed3SPierre Pronchery # endif
365e71b7053SJung-uk Kim 
366e71b7053SJung-uk Kim # ifdef  __cplusplus
367e71b7053SJung-uk Kim }
368e71b7053SJung-uk Kim # endif
369e71b7053SJung-uk Kim #endif
370