diff options
author | Clemens Lang <cllang@redhat.com> | 2022-07-01 15:22:34 +0200 |
---|---|---|
committer | Dmitry Belyavskiy <beldmit@gmail.com> | 2022-08-17 09:20:41 +0200 |
commit | 2b8f687d7627a4b15bba6a820825944185980376 (patch) | |
tree | 16f50f0d928259e5242164fbfca9d1563b754903 /apps | |
parent | ae3c30acac17271693e91dcae42c804cd96e8f93 (diff) |
APPS: ecparam: Support setting properties
The -provider and -propquery options did not work on ecparam. Fix this
and add tests that check that operations that would usually fail with
the FIPS provider work when run with
| -provider default -propquery '?fips!=yes'
See also 30b2c3592e8511b60d44f93eb657a1ecb3662c08, which previously
fixed the same problem in dsaparam and gendsa. See also the initial
report in https://bugzilla.redhat.com/show_bug.cgi?id=2094956.
Signed-off-by: Clemens Lang <cllang@redhat.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/18717)
Diffstat (limited to 'apps')
-rw-r--r-- | apps/ecparam.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/apps/ecparam.c b/apps/ecparam.c index 608014be8f..5d66b65569 100644 --- a/apps/ecparam.c +++ b/apps/ecparam.c @@ -229,9 +229,11 @@ int ecparam_main(int argc, char **argv) *p = OSSL_PARAM_construct_end(); if (OPENSSL_strcasecmp(curve_name, "SM2") == 0) - gctx_params = EVP_PKEY_CTX_new_from_name(NULL, "sm2", NULL); + gctx_params = EVP_PKEY_CTX_new_from_name(app_get0_libctx(), "sm2", + app_get0_propq()); else - gctx_params = EVP_PKEY_CTX_new_from_name(NULL, "ec", NULL); + gctx_params = EVP_PKEY_CTX_new_from_name(app_get0_libctx(), "ec", + app_get0_propq()); if (gctx_params == NULL || EVP_PKEY_keygen_init(gctx_params) <= 0 || EVP_PKEY_CTX_set_params(gctx_params, params) <= 0 @@ -282,7 +284,8 @@ int ecparam_main(int argc, char **argv) BIO_printf(bio_err, "unable to set check_type\n"); goto end; } - pctx = EVP_PKEY_CTX_new_from_pkey(NULL, params_key, NULL); + pctx = EVP_PKEY_CTX_new_from_pkey(app_get0_libctx(), params_key, + app_get0_propq()); if (pctx == NULL || EVP_PKEY_param_check(pctx) <= 0) { BIO_printf(bio_err, "failed\n"); goto end; @@ -312,7 +315,8 @@ int ecparam_main(int argc, char **argv) * EVP_PKEY_CTX_set_group_name(gctx, curvename); * EVP_PKEY_keygen(gctx, &key) <= 0) */ - gctx_key = EVP_PKEY_CTX_new_from_pkey(NULL, params_key, NULL); + gctx_key = EVP_PKEY_CTX_new_from_pkey(app_get0_libctx(), params_key, + app_get0_propq()); if (EVP_PKEY_keygen_init(gctx_key) <= 0 || EVP_PKEY_keygen(gctx_key, &key) <= 0) { BIO_printf(bio_err, "unable to generate key\n"); |