if (in->fetched_digest != NULL)
EVP_MD_up_ref(in->fetched_digest);
- out->provctx = in->digest->dupctx(in->provctx);
- if (out->provctx == NULL) {
- EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, EVP_R_NOT_ABLE_TO_COPY_CTX);
- return 0;
+ if (in->provctx != NULL) {
+ out->provctx = in->digest->dupctx(in->provctx);
+ if (out->provctx == NULL) {
+ EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, EVP_R_NOT_ABLE_TO_COPY_CTX);
+ return 0;
+ }
}
/* copied EVP_MD_CTX should free the copied EVP_PKEY_CTX */
{
EVP_PKEY_CTX *pctx = ctx->pctx;
- if (ctx->digest != NULL && ctx->digest->set_ctx_params != NULL)
- return ctx->digest->set_ctx_params(ctx->provctx, params);
-
+ /* If we have a pctx then we should try that first */
if (pctx != NULL
&& (pctx->operation == EVP_PKEY_OP_VERIFYCTX
|| pctx->operation == EVP_PKEY_OP_SIGNCTX)
&& pctx->op.sig.signature->set_ctx_md_params != NULL)
return pctx->op.sig.signature->set_ctx_md_params(pctx->op.sig.sigprovctx,
params);
+
+ if (ctx->digest != NULL && ctx->digest->set_ctx_params != NULL)
+ return ctx->digest->set_ctx_params(ctx->provctx, params);
+
return 0;
}
if (ctx == NULL)
return NULL;
- 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 we have a pctx then we should try that first */
pctx = ctx->pctx;
if (pctx != NULL
&& (pctx->operation == EVP_PKEY_OP_VERIFYCTX
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)));
+
return NULL;
}
{
EVP_PKEY_CTX *pctx = ctx->pctx;
- if (ctx->digest != NULL && ctx->digest->get_params != NULL)
- return ctx->digest->get_ctx_params(ctx->provctx, params);
-
+ /* If we have a pctx then we should try that first */
if (pctx != NULL
&& (pctx->operation == EVP_PKEY_OP_VERIFYCTX
|| pctx->operation == EVP_PKEY_OP_SIGNCTX)
return pctx->op.sig.signature->get_ctx_md_params(pctx->op.sig.sigprovctx,
params);
+ if (ctx->digest != NULL && ctx->digest->get_params != NULL)
+ return ctx->digest->get_ctx_params(ctx->provctx, params);
+
return 0;
}
if (ctx == NULL)
return NULL;
- 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 we have a pctx then we should try that first */
pctx = ctx->pctx;
if (pctx != NULL
&& (pctx->operation == EVP_PKEY_OP_VERIFYCTX
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)));
+
return NULL;
}