2 * Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
10 #include "internal/thread_once.h"
11 #include <openssl/dsa.h>
12 #include <openssl/engine.h>
13 #include <openssl/evp.h>
14 #include <openssl/lhash.h>
15 #include <openssl/x509.h>
16 #include <openssl/store.h>
19 * OSSL_STORE_INFO stuff
20 * ---------------------
23 struct ossl_store_info_st {
26 void *data; /* used internally as generic pointer */
31 } embedded; /* when type == OSSL_STORE_INFO_EMBEDDED */
36 } name; /* when type == OSSL_STORE_INFO_NAME */
38 EVP_PKEY *params; /* when type == OSSL_STORE_INFO_PARAMS */
39 EVP_PKEY *pkey; /* when type == OSSL_STORE_INFO_PKEY */
40 X509 *x509; /* when type == OSSL_STORE_INFO_CERT */
41 X509_CRL *crl; /* when type == OSSL_STORE_INFO_CRL */
45 DEFINE_STACK_OF(OSSL_STORE_INFO)
48 * EMBEDDED is a special type of OSSL_STORE_INFO, specially for the file
49 * handlers. It should never reach a calling application or any engine.
50 * However, it can be used by a FILE_HANDLER's try_decode function to signal
51 * that it has decoded the incoming blob into a new blob, and that the
52 * attempted decoding should be immediately restarted with the new blob, using
56 * Because this is an internal type, we don't make it public.
58 #define OSSL_STORE_INFO_EMBEDDED -1
59 OSSL_STORE_INFO *ossl_store_info_new_EMBEDDED(const char *new_pem_name,
61 BUF_MEM *ossl_store_info_get0_EMBEDDED_buffer(OSSL_STORE_INFO *info);
62 char *ossl_store_info_get0_EMBEDDED_pem_name(OSSL_STORE_INFO *info);
65 * OSSL_STORE_SEARCH stuff
66 * -----------------------
69 struct ossl_store_search_st {
73 * Used by OSSL_STORE_SEARCH_BY_NAME and
74 * OSSL_STORE_SEARCH_BY_ISSUER_SERIAL
76 X509_NAME *name; /* TODO constify this; leads to API incompatibility */
78 /* Used by OSSL_STORE_SEARCH_BY_ISSUER_SERIAL */
79 const ASN1_INTEGER *serial;
81 /* Used by OSSL_STORE_SEARCH_BY_KEY_FINGERPRINT */
85 * Used by OSSL_STORE_SEARCH_BY_KEY_FINGERPRINT and
86 * OSSL_STORE_SEARCH_BY_ALIAS
88 const unsigned char *string;
93 * OSSL_STORE_LOADER stuff
94 * -----------------------
97 int ossl_store_register_loader_int(OSSL_STORE_LOADER *loader);
98 OSSL_STORE_LOADER *ossl_store_unregister_loader_int(const char *scheme);
101 struct ossl_store_loader_st {
104 OSSL_STORE_open_fn open;
105 OSSL_STORE_attach_fn attach;
106 OSSL_STORE_ctrl_fn ctrl;
107 OSSL_STORE_expect_fn expect;
108 OSSL_STORE_find_fn find;
109 OSSL_STORE_load_fn load;
110 OSSL_STORE_eof_fn eof;
111 OSSL_STORE_error_fn error;
112 OSSL_STORE_close_fn close;
114 DEFINE_LHASH_OF(OSSL_STORE_LOADER);
116 const OSSL_STORE_LOADER *ossl_store_get0_loader_int(const char *scheme);
117 void ossl_store_destroy_loaders_int(void);
120 * OSSL_STORE init stuff
121 * ---------------------
124 int ossl_store_init_once(void);
125 int ossl_store_file_loader_init(void);