diff options
author | Pauli <ppzgs1@gmail.com> | 2021-02-22 03:06:48 +0100 |
---|---|---|
committer | Pauli <ppzgs1@gmail.com> | 2021-02-26 09:08:41 +0100 |
commit | 6de3a06dd45c68edd67b5ce1dbc94f3952a84a77 (patch) | |
tree | 98ef3cfe09750a91962445ada5275173cae081f7 /crypto/evp/digest.c | |
parent | core: update digest gettable/settable ctx params calls (diff) | |
download | openssl-6de3a06dd45c68edd67b5ce1dbc94f3952a84a77.tar.xz openssl-6de3a06dd45c68edd67b5ce1dbc94f3952a84a77.zip |
modify EVP to support digest gettable/settable calls
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14240)
Diffstat (limited to 'crypto/evp/digest.c')
-rw-r--r-- | crypto/evp/digest.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/crypto/evp/digest.c b/crypto/evp/digest.c index e322654241..858a9926cf 100644 --- a/crypto/evp/digest.c +++ b/crypto/evp/digest.c @@ -656,14 +656,19 @@ int EVP_MD_CTX_set_params(EVP_MD_CTX *ctx, const OSSL_PARAM params[]) const OSSL_PARAM *EVP_MD_settable_ctx_params(const EVP_MD *md) { - if (md != NULL && md->settable_ctx_params != NULL) - return md->settable_ctx_params(ossl_provider_ctx(EVP_MD_provider(md))); + void *alg; + + if (md != NULL && md->settable_ctx_params != NULL) { + alg = ossl_provider_ctx(EVP_MD_provider(md)); + return md->settable_ctx_params(NULL, alg); + } return NULL; } const OSSL_PARAM *EVP_MD_CTX_settable_params(EVP_MD_CTX *ctx) { EVP_PKEY_CTX *pctx; + void *alg; if (ctx == NULL) return NULL; @@ -678,9 +683,10 @@ const OSSL_PARAM *EVP_MD_CTX_settable_params(EVP_MD_CTX *ctx) return pctx->op.sig.signature->settable_ctx_md_params( pctx->op.sig.sigprovctx); - if (ctx->digest != NULL && ctx->digest->settable_ctx_params != NULL) - return ctx->digest->settable_ctx_params( - ossl_provider_ctx(EVP_MD_provider(ctx->digest))); + if (ctx->digest != NULL && ctx->digest->settable_ctx_params != NULL) { + alg = ossl_provider_ctx(EVP_MD_provider(ctx->digest)); + return ctx->digest->settable_ctx_params(ctx->provctx, alg); + } return NULL; } @@ -706,14 +712,19 @@ int EVP_MD_CTX_get_params(EVP_MD_CTX *ctx, OSSL_PARAM params[]) const OSSL_PARAM *EVP_MD_gettable_ctx_params(const EVP_MD *md) { - if (md != NULL && md->gettable_ctx_params != NULL) - return md->gettable_ctx_params(ossl_provider_ctx(EVP_MD_provider(md))); + void *alg; + + if (md != NULL && md->gettable_ctx_params != NULL) { + alg = ossl_provider_ctx(EVP_MD_provider(md)); + return md->gettable_ctx_params(NULL, alg); + } return NULL; } const OSSL_PARAM *EVP_MD_CTX_gettable_params(EVP_MD_CTX *ctx) { EVP_PKEY_CTX *pctx; + void *alg; if (ctx == NULL) return NULL; @@ -728,11 +739,10 @@ const OSSL_PARAM *EVP_MD_CTX_gettable_params(EVP_MD_CTX *ctx) return pctx->op.sig.signature->gettable_ctx_md_params( pctx->op.sig.sigprovctx); - if (ctx->digest != NULL - && ctx->digest->gettable_ctx_params != NULL) - return ctx->digest->gettable_ctx_params( - ossl_provider_ctx(EVP_MD_provider(ctx->digest))); - + if (ctx->digest != NULL && ctx->digest->gettable_ctx_params != NULL) { + alg = ossl_provider_ctx(EVP_MD_provider(ctx->digest)); + return ctx->digest->gettable_ctx_params(ctx->provctx, alg); + } return NULL; } |