diff options
Diffstat (limited to 'providers/implementations/signature/dsa.c')
-rw-r--r-- | providers/implementations/signature/dsa.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/providers/implementations/signature/dsa.c b/providers/implementations/signature/dsa.c index eadf62361a..214238e7cc 100644 --- a/providers/implementations/signature/dsa.c +++ b/providers/implementations/signature/dsa.c @@ -434,7 +434,8 @@ static const OSSL_PARAM known_gettable_ctx_params[] = { OSSL_PARAM_END }; -static const OSSL_PARAM *dsa_gettable_ctx_params(ossl_unused void *vctx) +static const OSSL_PARAM *dsa_gettable_ctx_params(ossl_unused void *ctx, + ossl_unused void *provctx) { return known_gettable_ctx_params; } @@ -470,27 +471,24 @@ static int dsa_set_ctx_params(void *vpdsactx, const OSSL_PARAM params[]) return 1; } -static const OSSL_PARAM known_settable_ctx_params[] = { +static const OSSL_PARAM settable_ctx_params[] = { OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_DIGEST, NULL, 0), OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_PROPERTIES, NULL, 0), OSSL_PARAM_END }; -static const OSSL_PARAM *dsa_settable_ctx_params(ossl_unused void *provctx) +static const OSSL_PARAM settable_ctx_params_no_digest[] = { + OSSL_PARAM_END +}; + +static const OSSL_PARAM *dsa_settable_ctx_params(void *vpdsactx, + ossl_unused void *provctx) { - /* - * TODO(3.0): Should this function return a different set of settable ctx - * params if the ctx is being used for a DigestSign/DigestVerify? In that - * case it is not allowed to set the digest size/digest name because the - * digest is explicitly set as part of the init. - * NOTE: Ideally we would check pdsactx->flag_allow_md, but this is - * problematic because there is no nice way of passing the - * PROV_DSA_CTX down to this function... - * Because we have API's that dont know about their parent.. - * e.g: EVP_SIGNATURE_gettable_ctx_params(const EVP_SIGNATURE *sig). - * We could pass NULL for that case (but then how useful is the check?). - */ - return known_settable_ctx_params; + PROV_DSA_CTX *pdsactx = (PROV_DSA_CTX *)vpdsactx; + + if (pdsactx != NULL && !pdsactx->flag_allow_md) + return settable_ctx_params_no_digest; + return settable_ctx_params; } static int dsa_get_ctx_md_params(void *vpdsactx, OSSL_PARAM *params) |