From: Richard Levitte Date: Tue, 9 Jul 2019 05:27:27 +0000 (+0200) Subject: Make more use of OSSL_PARAM for ciphers X-Git-Tag: openssl-3.0.0-alpha1~1805 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=80942379c9fc66076b784cba6318ed6ca85ca3ea;p=oweals%2Fopenssl.git Make more use of OSSL_PARAM for ciphers A lot of the different numbers associated with ciphers are really algorithm parameters. Key length, block size, IV length, that sort of thing. Reviewed-by: Paul Dale Reviewed-by: Shane Lontis (Merged from https://github.com/openssl/openssl/pull/9328) --- diff --git a/crypto/include/internal/evp_int.h b/crypto/include/internal/evp_int.h index 732fad8d67..da4ae0f1fb 100644 --- a/crypto/include/internal/evp_int.h +++ b/crypto/include/internal/evp_int.h @@ -257,9 +257,6 @@ struct evp_cipher_st { OSSL_OP_cipher_cipher_fn *ccipher; OSSL_OP_cipher_freectx_fn *freectx; OSSL_OP_cipher_dupctx_fn *dupctx; - OSSL_OP_cipher_key_length_fn *key_length; - OSSL_OP_cipher_iv_length_fn *iv_length; - OSSL_OP_cipher_block_size_fn *blocksize; OSSL_OP_cipher_get_params_fn *get_params; OSSL_OP_cipher_ctx_get_params_fn *ctx_get_params; OSSL_OP_cipher_ctx_set_params_fn *ctx_set_params; diff --git a/include/openssl/core_names.h b/include/openssl/core_names.h index a9a3b448e5..e4dd733017 100644 --- a/include/openssl/core_names.h +++ b/include/openssl/core_names.h @@ -39,6 +39,12 @@ extern "C" { #define OSSL_CIPHER_PARAM_PADDING "padding" #define OSSL_CIPHER_PARAM_MODE "mode" +#define OSSL_CIPHER_PARAM_BLOCK_SIZE "blocksize" /* OSSL_PARAM_INTEGER */ +#define OSSL_CIPHER_PARAM_FLAGS "flags" /* OSSL_PARAM_UNSIGNED_INTEGER */ +#define OSSL_CIPHER_PARAM_KEYLEN "keylen" /* OSSL_PARAM_INTEGER */ +#define OSSL_CIPHER_PARAM_IVLEN "ivlen" /* OSSL_PARAM_INTEGER */ +#define OSSL_CIPHER_PARAM_IV "iv" /* OSSL_PARAM_OCTET_PTR */ +#define OSSL_CIPHER_PARAM_NUM "num" /* OSSL_PARAM_INTEGER */ /* digest parameters */ #define OSSL_DIGEST_PARAM_XOFLEN "xoflen" diff --git a/include/openssl/core_numbers.h b/include/openssl/core_numbers.h index ff50636ab5..0901ed376d 100644 --- a/include/openssl/core_numbers.h +++ b/include/openssl/core_numbers.h @@ -139,12 +139,9 @@ OSSL_CORE_MAKE_FUNC(int, OP_digest_get_params, # define OSSL_FUNC_CIPHER_CIPHER 6 # define OSSL_FUNC_CIPHER_FREECTX 7 # define OSSL_FUNC_CIPHER_DUPCTX 8 -# define OSSL_FUNC_CIPHER_KEY_LENGTH 9 -# define OSSL_FUNC_CIPHER_IV_LENGTH 10 -# define OSSL_FUNC_CIPHER_BLOCK_SIZE 11 -# define OSSL_FUNC_CIPHER_GET_PARAMS 12 -# define OSSL_FUNC_CIPHER_CTX_GET_PARAMS 13 -# define OSSL_FUNC_CIPHER_CTX_SET_PARAMS 14 +# define OSSL_FUNC_CIPHER_GET_PARAMS 9 +# define OSSL_FUNC_CIPHER_CTX_GET_PARAMS 10 +# define OSSL_FUNC_CIPHER_CTX_SET_PARAMS 11 OSSL_CORE_MAKE_FUNC(void *, OP_cipher_newctx, (void *provctx)) OSSL_CORE_MAKE_FUNC(int, OP_cipher_encrypt_init, (void *cctx, @@ -170,9 +167,6 @@ OSSL_CORE_MAKE_FUNC(int, OP_cipher_cipher, const unsigned char *in, size_t inl)) OSSL_CORE_MAKE_FUNC(void, OP_cipher_freectx, (void *cctx)) OSSL_CORE_MAKE_FUNC(void *, OP_cipher_dupctx, (void *cctx)) -OSSL_CORE_MAKE_FUNC(size_t, OP_cipher_key_length, (void)) -OSSL_CORE_MAKE_FUNC(size_t, OP_cipher_iv_length, (void)) -OSSL_CORE_MAKE_FUNC(size_t, OP_cipher_block_size, (void)) OSSL_CORE_MAKE_FUNC(int, OP_cipher_get_params, (OSSL_PARAM params[])) OSSL_CORE_MAKE_FUNC(int, OP_cipher_ctx_get_params, (void *cctx, OSSL_PARAM params[]))