summaryrefslogtreecommitdiffstats
path: root/providers/implementations/signature/ecdsa.c
diff options
context:
space:
mode:
Diffstat (limited to 'providers/implementations/signature/ecdsa.c')
-rw-r--r--providers/implementations/signature/ecdsa.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/providers/implementations/signature/ecdsa.c b/providers/implementations/signature/ecdsa.c
index 74717c9b56..0e99cb2a5d 100644
--- a/providers/implementations/signature/ecdsa.c
+++ b/providers/implementations/signature/ecdsa.c
@@ -433,7 +433,8 @@ static const OSSL_PARAM known_gettable_ctx_params[] = {
OSSL_PARAM_END
};
-static const OSSL_PARAM *ecdsa_gettable_ctx_params(ossl_unused void *provctx)
+static const OSSL_PARAM *ecdsa_gettable_ctx_params(ossl_unused void *vctx,
+ ossl_unused void *provctx)
{
return known_gettable_ctx_params;
}
@@ -481,17 +482,27 @@ static int ecdsa_set_ctx_params(void *vctx, const OSSL_PARAM params[])
return 1;
}
-static const OSSL_PARAM known_settable_ctx_params[] = {
- OSSL_PARAM_size_t(OSSL_SIGNATURE_PARAM_DIGEST_SIZE, NULL),
+static const OSSL_PARAM settable_ctx_params[] = {
OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_DIGEST, NULL, 0),
+ OSSL_PARAM_size_t(OSSL_SIGNATURE_PARAM_DIGEST_SIZE, NULL),
OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_PROPERTIES, NULL, 0),
OSSL_PARAM_uint(OSSL_SIGNATURE_PARAM_KAT, NULL),
OSSL_PARAM_END
};
-static const OSSL_PARAM *ecdsa_settable_ctx_params(ossl_unused void *provctx)
+static const OSSL_PARAM settable_ctx_params_no_digest[] = {
+ OSSL_PARAM_uint(OSSL_SIGNATURE_PARAM_KAT, NULL),
+ OSSL_PARAM_END
+};
+
+static const OSSL_PARAM *ecdsa_settable_ctx_params(void *vctx,
+ ossl_unused void *provctx)
{
- return known_settable_ctx_params;
+ PROV_ECDSA_CTX *ctx = (PROV_ECDSA_CTX *)vctx;
+
+ if (ctx != NULL && !ctx->flag_allow_md)
+ return settable_ctx_params_no_digest;
+ return settable_ctx_params;
}
static int ecdsa_get_ctx_md_params(void *vctx, OSSL_PARAM *params)