diff options
author | Richard Levitte <levitte@openssl.org> | 2021-06-01 20:10:45 +0200 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2021-06-05 20:30:35 +1000 |
commit | 6462a4f0508e451f0411e88b2f465f27f1db6cc7 (patch) | |
tree | 1beb544241c95e6ca7d7cd18121883af984e19a4 | |
parent | 9379bf943a12090de6280e88fb0d246e73658116 (diff) |
PROV: drop get_params() and gettable_params() from all decoder implementations
They aren't needed at all any more, since the properties contain the
same information.
This also drops the parameter names OSSL_DECODER_PARAM_INPUT_TYPE
and OSSL_DECODER_PARAM_INPUT_STRUCTURE.
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15570)
6 files changed, 1 insertions, 161 deletions
diff --git a/include/openssl/core_names.h b/include/openssl/core_names.h index 5ecde3c994..5bb284d658 100644 --- a/include/openssl/core_names.h +++ b/include/openssl/core_names.h @@ -476,8 +476,6 @@ extern "C" { #define OSSL_ENCODER_PARAM_SAVE_PARAMETERS "save-parameters" /* integer */ #define OSSL_DECODER_PARAM_PROPERTIES OSSL_ALG_PARAM_PROPERTIES -#define OSSL_DECODER_PARAM_INPUT_TYPE "input-type" -#define OSSL_DECODER_PARAM_INPUT_STRUCTURE "input-structure" /* Passphrase callback parameters */ #define OSSL_PASSPHRASE_PARAM_INFO "info" diff --git a/providers/implementations/encode_decode/decode_der2key.c b/providers/implementations/encode_decode/decode_der2key.c index b3fd87ca05..22ee075b19 100644 --- a/providers/implementations/encode_decode/decode_der2key.c +++ b/providers/implementations/encode_decode/decode_der2key.c @@ -177,39 +177,6 @@ static void der2key_freectx(void *vctx) OPENSSL_free(ctx); } -static const OSSL_PARAM * -der2key_gettable_params(void *provctx, const struct keytype_desc_st *desc) -{ - static const OSSL_PARAM gettables[] = { - { OSSL_DECODER_PARAM_INPUT_TYPE, OSSL_PARAM_UTF8_PTR, NULL, 0, 0 }, - OSSL_PARAM_END, - }; - static const OSSL_PARAM gettables_w_structure[] = { - { OSSL_DECODER_PARAM_INPUT_TYPE, OSSL_PARAM_UTF8_PTR, NULL, 0, 0 }, - { OSSL_DECODER_PARAM_INPUT_STRUCTURE, OSSL_PARAM_UTF8_PTR, NULL, 0, 0 }, - OSSL_PARAM_END, - }; - - return desc->structure_name != NULL ? gettables_w_structure : gettables; -} - -static int der2key_get_params(OSSL_PARAM params[], - const struct keytype_desc_st *desc) -{ - OSSL_PARAM *p; - - p = OSSL_PARAM_locate(params, OSSL_DECODER_PARAM_INPUT_TYPE); - if (p != NULL && !OSSL_PARAM_set_utf8_ptr(p, "DER")) - return 0; - if (desc->structure_name != NULL) { - p = OSSL_PARAM_locate(params, OSSL_DECODER_PARAM_INPUT_STRUCTURE); - if (p != NULL && !OSSL_PARAM_set_utf8_ptr(p, desc->structure_name)) - return 0; - } - - return 1; -} - static int der2key_check_selection(int selection, const struct keytype_desc_st *desc) { @@ -791,25 +758,11 @@ static void rsa_adjust(void *key, struct der2key_ctx_st *ctx) DO_##kind(keytype) }; \ \ static OSSL_FUNC_decoder_newctx_fn kind##_der2##keytype##_newctx; \ - static OSSL_FUNC_decoder_gettable_params_fn \ - kind##_der2##keytype##_gettable_params; \ - static OSSL_FUNC_decoder_get_params_fn \ - kind##_der2##keytype##_get_params; \ \ static void *kind##_der2##keytype##_newctx(void *provctx) \ { \ return der2key_newctx(provctx, &kind##_##keytype##_desc); \ } \ - static const OSSL_PARAM * \ - kind##_der2##keytype##_gettable_params(void *provctx) \ - { \ - return \ - der2key_gettable_params(provctx, &kind##_##keytype##_desc); \ - } \ - static int kind##_der2##keytype##_get_params(OSSL_PARAM params[]) \ - { \ - return der2key_get_params(params, &kind##_##keytype##_desc); \ - } \ static int kind##_der2##keytype##_does_selection(void *provctx, \ int selection) \ { \ @@ -822,10 +775,6 @@ static void rsa_adjust(void *key, struct der2key_ctx_st *ctx) (void (*)(void))kind##_der2##keytype##_newctx }, \ { OSSL_FUNC_DECODER_FREECTX, \ (void (*)(void))der2key_freectx }, \ - { OSSL_FUNC_DECODER_GETTABLE_PARAMS, \ - (void (*)(void))kind##_der2##keytype##_gettable_params }, \ - { OSSL_FUNC_DECODER_GET_PARAMS, \ - (void (*)(void))kind##_der2##keytype##_get_params }, \ { OSSL_FUNC_DECODER_DOES_SELECTION, \ (void (*)(void))kind##_der2##keytype##_does_selection }, \ { OSSL_FUNC_DECODER_DECODE, \ diff --git a/providers/implementations/encode_decode/decode_msblob2key.c b/providers/implementations/encode_decode/decode_msblob2key.c index 84b259591b..15dc8b05a7 100644 --- a/providers/implementations/encode_decode/decode_msblob2key.c +++ b/providers/implementations/encode_decode/decode_msblob2key.c @@ -47,8 +47,6 @@ struct keytype_desc_st { }; static OSSL_FUNC_decoder_freectx_fn msblob2key_freectx; -static OSSL_FUNC_decoder_gettable_params_fn msblob2key_gettable_params; -static OSSL_FUNC_decoder_get_params_fn msblob2key_get_params; static OSSL_FUNC_decoder_decode_fn msblob2key_decode; static OSSL_FUNC_decoder_export_object_fn msblob2key_export_object; @@ -79,27 +77,6 @@ static void msblob2key_freectx(void *vctx) OPENSSL_free(ctx); } -static const OSSL_PARAM *msblob2key_gettable_params(ossl_unused void *provctx) -{ - static const OSSL_PARAM gettables[] = { - { OSSL_DECODER_PARAM_INPUT_TYPE, OSSL_PARAM_UTF8_PTR, NULL, 0, 0 }, - OSSL_PARAM_END, - }; - - return gettables; -} - -static int msblob2key_get_params(OSSL_PARAM params[]) -{ - OSSL_PARAM *p; - - p = OSSL_PARAM_locate(params, OSSL_DECODER_PARAM_INPUT_TYPE); - if (p != NULL && !OSSL_PARAM_set_utf8_ptr(p, "MSBLOB")) - return 0; - - return 1; -} - static int msblob2key_decode(void *vctx, OSSL_CORE_BIO *cin, int selection, OSSL_CALLBACK *data_cb, void *data_cbarg, OSSL_PASSPHRASE_CALLBACK *pw_cb, void *pw_cbarg) @@ -278,10 +255,6 @@ static void rsa_adjust(void *key, struct msblob2key_ctx_st *ctx) (void (*)(void))msblob2##keytype##_newctx }, \ { OSSL_FUNC_DECODER_FREECTX, \ (void (*)(void))msblob2key_freectx }, \ - { OSSL_FUNC_DECODER_GETTABLE_PARAMS, \ - (void (*)(void))msblob2key_gettable_params }, \ - { OSSL_FUNC_DECODER_GET_PARAMS, \ - (void (*)(void))msblob2key_get_params }, \ { OSSL_FUNC_DECODER_DECODE, \ (void (*)(void))msblob2key_decode }, \ { OSSL_FUNC_DECODER_EXPORT_OBJECT, \ diff --git a/providers/implementations/encode_decode/decode_pem2der.c b/providers/implementations/encode_decode/decode_pem2der.c index 4249ce9cc7..318efcc6af 100644 --- a/providers/implementations/encode_decode/decode_pem2der.c +++ b/providers/implementations/encode_decode/decode_pem2der.c @@ -41,8 +41,6 @@ static int read_pem(PROV_CTX *provctx, OSSL_CORE_BIO *cin, static OSSL_FUNC_decoder_newctx_fn pem2der_newctx; static OSSL_FUNC_decoder_freectx_fn pem2der_freectx; -static OSSL_FUNC_decoder_gettable_params_fn pem2der_gettable_params; -static OSSL_FUNC_decoder_get_params_fn pem2der_get_params; static OSSL_FUNC_decoder_decode_fn pem2der_decode; /* @@ -68,27 +66,6 @@ static void pem2der_freectx(void *vctx) OPENSSL_free(ctx); } -static const OSSL_PARAM *pem2der_gettable_params(void *provctx) -{ - static const OSSL_PARAM gettables[] = { - { OSSL_DECODER_PARAM_INPUT_TYPE, OSSL_PARAM_UTF8_PTR, NULL, 0, 0 }, - OSSL_PARAM_END, - }; - - return gettables; -} - -static int pem2der_get_params(OSSL_PARAM params[]) -{ - OSSL_PARAM *p; - - p = OSSL_PARAM_locate(params, OSSL_DECODER_PARAM_INPUT_TYPE); - if (p != NULL && !OSSL_PARAM_set_utf8_ptr(p, "PEM")) - return 0; - - return 1; -} - /* pem_password_cb compatible function */ struct pem2der_pass_data_st { OSSL_PASSPHRASE_CALLBACK *cb; @@ -262,10 +239,6 @@ static int pem2der_decode(void *vctx, OSSL_CORE_BIO *cin, int selection, const OSSL_DISPATCH ossl_pem_to_der_decoder_functions[] = { { OSSL_FUNC_DECODER_NEWCTX, (void (*)(void))pem2der_newctx }, { OSSL_FUNC_DECODER_FREECTX, (void (*)(void))pem2der_freectx }, - { OSSL_FUNC_DECODER_GETTABLE_PARAMS, - (void (*)(void))pem2der_gettable_params }, - { OSSL_FUNC_DECODER_GET_PARAMS, - (void (*)(void))pem2der_get_params }, { OSSL_FUNC_DECODER_DECODE, (void (*)(void))pem2der_decode }, { 0, NULL } }; diff --git a/providers/implementations/encode_decode/decode_pvk2key.c b/providers/implementations/encode_decode/decode_pvk2key.c index b69b2416a5..5c26bfb908 100644 --- a/providers/implementations/encode_decode/decode_pvk2key.c +++ b/providers/implementations/encode_decode/decode_pvk2key.c @@ -47,8 +47,6 @@ struct keytype_desc_st { }; static OSSL_FUNC_decoder_freectx_fn pvk2key_freectx; -static OSSL_FUNC_decoder_gettable_params_fn pvk2key_gettable_params; -static OSSL_FUNC_decoder_get_params_fn pvk2key_get_params; static OSSL_FUNC_decoder_decode_fn pvk2key_decode; static OSSL_FUNC_decoder_export_object_fn pvk2key_export_object; @@ -79,27 +77,6 @@ static void pvk2key_freectx(void *vctx) OPENSSL_free(ctx); } -static const OSSL_PARAM *pvk2key_gettable_params(ossl_unused void *provctx) -{ - static const OSSL_PARAM gettables[] = { - { OSSL_DECODER_PARAM_INPUT_TYPE, OSSL_PARAM_UTF8_PTR, NULL, 0, 0 }, - OSSL_PARAM_END, - }; - - return gettables; -} - -static int pvk2key_get_params(OSSL_PARAM params[]) -{ - OSSL_PARAM *p; - - p = OSSL_PARAM_locate(params, OSSL_DECODER_PARAM_INPUT_TYPE); - if (p != NULL && !OSSL_PARAM_set_utf8_ptr(p, "PVK")) - return 0; - - return 1; -} - static int pvk2key_decode(void *vctx, OSSL_CORE_BIO *cin, int selection, OSSL_CALLBACK *data_cb, void *data_cbarg, OSSL_PASSPHRASE_CALLBACK *pw_cb, void *pw_cbarg) @@ -243,10 +220,6 @@ static void rsa_adjust(void *key, struct pvk2key_ctx_st *ctx) (void (*)(void))pvk2##keytype##_newctx }, \ { OSSL_FUNC_DECODER_FREECTX, \ (void (*)(void))pvk2key_freectx }, \ - { OSSL_FUNC_DECODER_GETTABLE_PARAMS, \ - (void (*)(void))pvk2key_gettable_params }, \ - { OSSL_FUNC_DECODER_GET_PARAMS, \ - (void (*)(void))pvk2key_get_params }, \ { OSSL_FUNC_DECODER_DECODE, \ (void (*)(void))pvk2key_decode }, \ { OSSL_FUNC_DECODER_EXPORT_OBJECT, \ diff --git a/providers/implementations/storemgmt/file_store_der2obj.c b/providers/implementations/storemgmt/file_store_der2obj.c index 4f90535842..5f71ea500d 100644 --- a/providers/implementations/storemgmt/file_store_der2obj.c +++ b/providers/implementations/storemgmt/file_store_der2obj.c @@ -52,31 +52,8 @@ static void der2obj_freectx(void *vctx) { } -static OSSL_FUNC_decoder_gettable_params_fn der2obj_gettable_params; -static OSSL_FUNC_decoder_get_params_fn der2obj_get_params; static OSSL_FUNC_decoder_decode_fn der2obj_decode; -static const OSSL_PARAM *der2obj_gettable_params(void *provctx) -{ - static const OSSL_PARAM gettables[] = { - { OSSL_DECODER_PARAM_INPUT_TYPE, OSSL_PARAM_UTF8_PTR, NULL, 0, 0 }, - OSSL_PARAM_END, - }; - - return gettables; -} - -static int der2obj_get_params(OSSL_PARAM params[]) -{ - OSSL_PARAM *p; - - p = OSSL_PARAM_locate(params, OSSL_DECODER_PARAM_INPUT_TYPE); - if (p != NULL && !OSSL_PARAM_set_utf8_ptr(p, "DER")) - return 0; - - return 1; -} - static int der2obj_decode(void *provctx, OSSL_CORE_BIO *cin, int selection, OSSL_CALLBACK *data_cb, void *data_cbarg, OSSL_PASSPHRASE_CALLBACK *pw_cb, void *pw_cbarg) @@ -124,12 +101,9 @@ static int der2obj_decode(void *provctx, OSSL_CORE_BIO *cin, int selection, static const OSSL_DISPATCH der_to_obj_decoder_functions[] = { { OSSL_FUNC_DECODER_NEWCTX, (void (*)(void))der2obj_newctx }, { OSSL_FUNC_DECODER_FREECTX, (void (*)(void))der2obj_freectx }, - { OSSL_FUNC_DECODER_GETTABLE_PARAMS, - (void (*)(void))der2obj_gettable_params }, - { OSSL_FUNC_DECODER_GET_PARAMS, (void (*)(void))der2obj_get_params }, { OSSL_FUNC_DECODER_DECODE, (void (*)(void))der2obj_decode }, { 0, NULL } }; const OSSL_ALGORITHM ossl_der_to_obj_algorithm = - { "obj", NULL, der_to_obj_decoder_functions }; + { "obj", "input=DER", der_to_obj_decoder_functions }; |