diff options
author | Richard Levitte <levitte@openssl.org> | 2020-07-22 22:55:00 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2020-08-24 10:02:26 +0200 |
commit | 34b80d0622924d112b145fd36bfaad18616f2546 (patch) | |
tree | f80e34178246e6114674817080d9dbff149a8a03 /crypto/store/store_local.h | |
parent | 4fd397821139723fd4e51a03e92df33e9a9fadcc (diff) |
STORE: Modify to support loading with provider based loaders
This adds the needed code to make the OSSL_STORE API functions handle
provided STORE implementations.
This also modifies OSSL_STORE_attach() for have the URI, the
library context and the properties in the same order as
OSSL_STORE_open_with_libctx().
The most notable change, though, is how this creates a division of
labor between libcrypto and any storemgmt implementation that wants to
pass X.509, X.509 CRL, etc structures back to libcrypto. Since those
structures aren't directly supported in the libcrypto <-> provider
interface (asymmetric keys being the only exception so far), we resort
to a libcrypto object callback that can handle passed data in DER form
and does its part of figuring out what the DER content actually is.
This also adds the internal x509_crl_set0_libctx(), which works just
like x509_set0_libctx(), but for X509_CRL.
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/12512)
Diffstat (limited to 'crypto/store/store_local.h')
-rw-r--r-- | crypto/store/store_local.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/crypto/store/store_local.h b/crypto/store/store_local.h index 15d4022856..619e547aae 100644 --- a/crypto/store/store_local.h +++ b/crypto/store/store_local.h @@ -16,6 +16,7 @@ #include <openssl/lhash.h> #include <openssl/x509.h> #include <openssl/store.h> +#include "internal/passphrase.h" /*- * OSSL_STORE_INFO stuff @@ -139,6 +140,35 @@ const OSSL_STORE_LOADER *ossl_store_get0_loader_int(const char *scheme); void ossl_store_destroy_loaders_int(void); /*- + * OSSL_STORE_CTX stuff + * --------------------- + */ + +struct ossl_store_ctx_st { + const OSSL_STORE_LOADER *loader; /* legacy */ + OSSL_STORE_LOADER *fetched_loader; + OSSL_STORE_LOADER_CTX *loader_ctx; + OSSL_STORE_post_process_info_fn post_process; + void *post_process_data; + int expected_type; + + char *properties; + + /* 0 before the first STORE_load(), 1 otherwise */ + int loading; + /* 1 on load error, only valid for fetched loaders */ + int error_flag; + + /* + * Cache of stuff, to be able to return the contents of a PKCS#12 + * blob, one object at a time. + */ + STACK_OF(OSSL_STORE_INFO) *cached_info; + + struct ossl_passphrase_data_st pwdata; +}; + +/*- * OSSL_STORE init stuff * --------------------- */ @@ -164,3 +194,10 @@ OSSL_STORE_LOADER *ossl_store_loader_fetch(OPENSSL_CTX *libctx, OSSL_STORE_LOADER *ossl_store_loader_fetch_by_number(OPENSSL_CTX *libctx, int scheme_id, const char *properties); + +/* Standard function to handle the result from OSSL_FUNC_store_load() */ +struct ossl_load_result_data_st { + OSSL_STORE_INFO *v; /* To be filled in */ + OSSL_STORE_CTX *ctx; +}; +OSSL_CALLBACK ossl_store_handle_load_result; |