diff options
author | Richard Levitte <levitte@openssl.org> | 2020-05-09 10:11:14 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2020-05-12 11:32:40 +0200 |
commit | fdaad3f1b31df6827554c378dd8385695a1deed4 (patch) | |
tree | b75f090aa64d03744896e9abd4d64240aec2cec8 /providers/legacyprov.c | |
parent | b0f3c594083b22f082057719f7bb1aa575e7d5a1 (diff) |
Fix some misunderstandings in our providers' main modules
This started with adding forward declarations of all provider side
interface functions, and fixing all compiler errors.
Furthermore, diminish the faulty assumption that the provider context
is and always will be just a library context. That means adding a
teardown function in all providers that aren't necessarily built into
libcrypto.
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/11777)
Diffstat (limited to 'providers/legacyprov.c')
-rw-r--r-- | providers/legacyprov.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/providers/legacyprov.c b/providers/legacyprov.c index ca91093893..07b505a8ac 100644 --- a/providers/legacyprov.c +++ b/providers/legacyprov.c @@ -13,8 +13,17 @@ #include <openssl/core_numbers.h> #include <openssl/core_names.h> #include <openssl/params.h> +#include "prov/provider_ctx.h" #include "prov/implementations.h" +/* + * Forward declarations to ensure that interface functions are correctly + * defined. + */ +static OSSL_provider_gettable_params_fn legacy_gettable_params; +static OSSL_provider_get_params_fn legacy_get_params; +static OSSL_provider_query_operation_fn legacy_query; + #define ALG(NAMES, FUNC) { NAMES, "provider=legacy", FUNC } #ifdef STATIC_LEGACY @@ -27,19 +36,19 @@ static OSSL_core_gettable_params_fn *c_gettable_params = NULL; static OSSL_core_get_params_fn *c_get_params = NULL; /* Parameters we provide to the core */ -static const OSSL_ITEM legacy_param_types[] = { - { OSSL_PARAM_UTF8_PTR, OSSL_PROV_PARAM_NAME }, - { OSSL_PARAM_UTF8_PTR, OSSL_PROV_PARAM_VERSION }, - { OSSL_PARAM_UTF8_PTR, OSSL_PROV_PARAM_BUILDINFO }, - { 0, NULL } +static const OSSL_PARAM legacy_param_types[] = { + OSSL_PARAM_DEFN(OSSL_PROV_PARAM_NAME, OSSL_PARAM_UTF8_PTR, NULL, 0), + OSSL_PARAM_DEFN(OSSL_PROV_PARAM_VERSION, OSSL_PARAM_UTF8_PTR, NULL, 0), + OSSL_PARAM_DEFN(OSSL_PROV_PARAM_BUILDINFO, OSSL_PARAM_UTF8_PTR, NULL, 0), + OSSL_PARAM_END }; -static const OSSL_ITEM *legacy_gettable_params(const OSSL_PROVIDER *prov) +static const OSSL_PARAM *legacy_gettable_params(void *provctx) { return legacy_param_types; } -static int legacy_get_params(const OSSL_PROVIDER *prov, OSSL_PARAM params[]) +static int legacy_get_params(void *provctx, OSSL_PARAM params[]) { OSSL_PARAM *p; @@ -133,8 +142,7 @@ static const OSSL_ALGORITHM legacy_ciphers[] = { { NULL, NULL, NULL } }; -static const OSSL_ALGORITHM *legacy_query(OSSL_PROVIDER *prov, - int operation_id, +static const OSSL_ALGORITHM *legacy_query(void *provctx, int operation_id, int *no_cache) { *no_cache = 0; |