diff options
author | Shane Lontis <shane.lontis@oracle.com> | 2020-08-21 11:14:34 +1000 |
---|---|---|
committer | Shane Lontis <shane.lontis@oracle.com> | 2020-08-30 16:17:17 +1000 |
commit | 81fca0e7c1f4e874f860ac66415546fe8fc5ad18 (patch) | |
tree | db0a96affdcd15cf882a6ae7b6b1004e4d43cf33 /providers/implementations/encode_decode | |
parent | 3fab56631f597b969bb5849bd890e354d4062178 (diff) |
Fix DSA serializer import calls to use correct selection flags.
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12698)
Diffstat (limited to 'providers/implementations/encode_decode')
3 files changed, 15 insertions, 10 deletions
diff --git a/providers/implementations/encode_decode/encoder_dsa_param.c b/providers/implementations/encode_decode/encoder_dsa_param.c index 87abde7212..0438b14cc8 100644 --- a/providers/implementations/encode_decode/encoder_dsa_param.c +++ b/providers/implementations/encode_decode/encoder_dsa_param.c @@ -63,7 +63,7 @@ static int dsa_param_der_data(void *ctx, const OSSL_PARAM params[], /* ctx == provctx */ if ((dsa = dsa_new(ctx)) != NULL - && dsa_import(dsa, OSSL_KEYMGMT_SELECT_ALL_PARAMETERS, params) + && dsa_import(dsa, OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS, params) && dsa_param_der(ctx, dsa, out, cb, cbarg)) ok = 1; dsa_free(dsa); @@ -101,7 +101,7 @@ static int dsa_param_pem_data(void *ctx, const OSSL_PARAM params[], /* ctx == provctx */ if ((dsa = dsa_new(ctx)) != NULL - && dsa_import(dsa, OSSL_KEYMGMT_SELECT_ALL_PARAMETERS, params) + && dsa_import(dsa, OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS, params) && dsa_param_pem(ctx, dsa, out, cb, cbarg)) ok = 1; dsa_free(dsa); @@ -138,7 +138,7 @@ static int dsa_param_print_data(void *ctx, const OSSL_PARAM params[], /* ctx == provctx */ if ((dsa = dsa_new(ctx)) != NULL - && dsa_import(dsa, OSSL_KEYMGMT_SELECT_ALL_PARAMETERS, params) + && dsa_import(dsa, OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS, params) && dsa_param_print(ctx, dsa, out, cb, cbarg)) ok = 1; dsa_free(dsa); diff --git a/providers/implementations/encode_decode/encoder_dsa_priv.c b/providers/implementations/encode_decode/encoder_dsa_priv.c index c37c9f9f3c..be5b7ee326 100644 --- a/providers/implementations/encode_decode/encoder_dsa_priv.c +++ b/providers/implementations/encode_decode/encoder_dsa_priv.c @@ -25,6 +25,9 @@ #include "prov/provider_ctx.h" #include "encoder_local.h" +#define DSA_SELECT_PRIVATE_IMPORTABLE \ + (OSSL_KEYMGMT_SELECT_KEYPAIR | OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) + static OSSL_FUNC_encoder_newctx_fn dsa_priv_newctx; static OSSL_FUNC_encoder_freectx_fn dsa_priv_freectx; static OSSL_FUNC_encoder_set_ctx_params_fn dsa_priv_set_ctx_params; @@ -132,7 +135,7 @@ static int dsa_priv_der_data(void *vctx, const OSSL_PARAM params[], DSA *dsa; if ((dsa = dsa_new(ctx->provctx)) != NULL - && dsa_import(dsa, OSSL_KEYMGMT_SELECT_KEYPAIR, params) + && dsa_import(dsa, DSA_SELECT_PRIVATE_IMPORTABLE, params) && dsa_priv_der(ctx, dsa, out, cb, cbarg)) ok = 1; dsa_free(dsa); @@ -177,7 +180,7 @@ static int dsa_pem_priv_data(void *vctx, const OSSL_PARAM params[], DSA *dsa; if ((dsa = dsa_new(ctx->provctx)) != NULL - && dsa_import(dsa, OSSL_KEYMGMT_SELECT_KEYPAIR, params) + && dsa_import(dsa, DSA_SELECT_PRIVATE_IMPORTABLE, params) && dsa_pem_priv(ctx, dsa, out, cb, cbarg)) ok = 1; dsa_free(dsa); @@ -233,7 +236,7 @@ static int dsa_priv_print_data(void *vctx, const OSSL_PARAM params[], DSA *dsa; if ((dsa = dsa_new(ctx->provctx)) != NULL - && dsa_import(dsa, OSSL_KEYMGMT_SELECT_KEYPAIR, params) + && dsa_import(dsa, DSA_SELECT_PRIVATE_IMPORTABLE, params) && dsa_priv_print(ctx, dsa, out, cb, cbarg)) ok = 1; dsa_free(dsa); diff --git a/providers/implementations/encode_decode/encoder_dsa_pub.c b/providers/implementations/encode_decode/encoder_dsa_pub.c index ca7dd4bf1e..f99388e150 100644 --- a/providers/implementations/encode_decode/encoder_dsa_pub.c +++ b/providers/implementations/encode_decode/encoder_dsa_pub.c @@ -24,13 +24,15 @@ #include "prov/provider_ctx.h" #include "encoder_local.h" +#define DSA_SELECT_PUBLIC_IMPORTABLE \ + (OSSL_KEYMGMT_SELECT_PUBLIC_KEY | OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) + static OSSL_FUNC_encoder_newctx_fn dsa_pub_newctx; static OSSL_FUNC_encoder_freectx_fn dsa_pub_freectx; static OSSL_FUNC_encoder_encode_data_fn dsa_pub_der_data; static OSSL_FUNC_encoder_encode_object_fn dsa_pub_der; static OSSL_FUNC_encoder_encode_data_fn dsa_pub_pem_data; static OSSL_FUNC_encoder_encode_object_fn dsa_pub_pem; - static OSSL_FUNC_encoder_encode_data_fn dsa_pub_print_data; static OSSL_FUNC_encoder_encode_object_fn dsa_pub_print; @@ -63,7 +65,7 @@ static int dsa_pub_der_data(void *ctx, const OSSL_PARAM params[], /* ctx == provctx */ if ((dsa = dsa_new(ctx)) != NULL - && dsa_import(dsa, OSSL_KEYMGMT_SELECT_KEYPAIR, params) + && dsa_import(dsa, DSA_SELECT_PUBLIC_IMPORTABLE, params) && dsa_pub_der(ctx, dsa, out, cb, cbarg)) ok = 1; dsa_free(dsa); @@ -114,7 +116,7 @@ static int dsa_pub_pem_data(void *ctx, const OSSL_PARAM params[], /* ctx == provctx */ if ((dsa = dsa_new(ctx)) != NULL - && dsa_import(dsa, OSSL_KEYMGMT_SELECT_KEYPAIR, params) + && dsa_import(dsa, DSA_SELECT_PUBLIC_IMPORTABLE, params) && dsa_pub_pem(ctx, dsa, out, cb, cbarg)) ok = 1; dsa_free(dsa); @@ -154,7 +156,7 @@ static int dsa_pub_print_data(void *ctx, const OSSL_PARAM params[], /* ctx == provctx */ if ((dsa = dsa_new(ctx)) != NULL - && dsa_import(dsa, OSSL_KEYMGMT_SELECT_KEYPAIR, params) + && dsa_import(dsa, DSA_SELECT_PUBLIC_IMPORTABLE, params) && dsa_pub_print(ctx, dsa, out, cb, cbarg)) ok = 1; dsa_free(dsa); |