diff options
author | Richard Levitte <levitte@openssl.org> | 2020-10-17 08:17:41 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2020-11-11 12:43:27 +0100 |
commit | cd861ab73d57ea21dd7342b13f4a733da229e15e (patch) | |
tree | 2053867e039904f8dfad6794ac775d668e34796a /crypto | |
parent | 8a98a507fb9a06254c79af4d9c9104f5f300a032 (diff) |
ENCODER: Add support for OSSL_FUNC_encoder_does_selection()
OSSL_FUNC_encoder_does_selection() is a dispatchable encoder implementation
function that should return 1 if the given |selection| is supported by an
encoder implementation and 0 if not. This can be used by libcrypto
functionality to figure out if an encoder implementation should be
considered or not.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13167)
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/encode_decode/encoder_local.h | 1 | ||||
-rw-r--r-- | crypto/encode_decode/encoder_meth.c | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/crypto/encode_decode/encoder_local.h b/crypto/encode_decode/encoder_local.h index be4cba3783..2ff1853b9f 100644 --- a/crypto/encode_decode/encoder_local.h +++ b/crypto/encode_decode/encoder_local.h @@ -33,6 +33,7 @@ struct ossl_encoder_st { OSSL_FUNC_encoder_gettable_params_fn *gettable_params; OSSL_FUNC_encoder_set_ctx_params_fn *set_ctx_params; OSSL_FUNC_encoder_settable_ctx_params_fn *settable_ctx_params; + OSSL_FUNC_encoder_does_selection_fn *does_selection; OSSL_FUNC_encoder_encode_fn *encode; OSSL_FUNC_encoder_import_object_fn *import_object; OSSL_FUNC_encoder_free_object_fn *free_object; diff --git a/crypto/encode_decode/encoder_meth.c b/crypto/encode_decode/encoder_meth.c index adff759bd4..99c4a119d3 100644 --- a/crypto/encode_decode/encoder_meth.c +++ b/crypto/encode_decode/encoder_meth.c @@ -200,6 +200,11 @@ static void *encoder_from_dispatch(int id, const OSSL_ALGORITHM *algodef, encoder->settable_ctx_params = OSSL_FUNC_encoder_settable_ctx_params(fns); break; + case OSSL_FUNC_ENCODER_DOES_SELECTION: + if (encoder->does_selection == NULL) + encoder->does_selection = + OSSL_FUNC_encoder_does_selection(fns); + break; case OSSL_FUNC_ENCODER_ENCODE: if (encoder->encode == NULL) encoder->encode = OSSL_FUNC_encoder_encode(fns); |