From: Richard Levitte Date: Tue, 2 Feb 2021 12:42:55 +0000 (+0100) Subject: CORE & PROV: clean away OSSL_FUNC_mac_size() X-Git-Tag: openssl-3.0.0-alpha12~150 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8ce04db808dd1799a4051d938112b7d591fc5fc2;p=thirdparty%2Fopenssl.git CORE & PROV: clean away OSSL_FUNC_mac_size() There was a remaining function signature declaration, but no OSSL_DISPATCH number for it nor any way it's ever used. It did exist once, but was replaced with an OSSL_PARAM item to retrieve. Reviewed-by: Tomas Mraz Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/14048) --- diff --git a/include/crypto/evp.h b/include/crypto/evp.h index bed75f406cc..8e86bb94dfb 100644 --- a/include/crypto/evp.h +++ b/include/crypto/evp.h @@ -196,7 +196,6 @@ struct evp_mac_st { OSSL_FUNC_mac_newctx_fn *newctx; OSSL_FUNC_mac_dupctx_fn *dupctx; OSSL_FUNC_mac_freectx_fn *freectx; - OSSL_FUNC_mac_size_fn *size; OSSL_FUNC_mac_init_fn *init; OSSL_FUNC_mac_update_fn *update; OSSL_FUNC_mac_final_fn *final; diff --git a/include/openssl/core_dispatch.h b/include/openssl/core_dispatch.h index bbd04297188..a8e9e521512 100644 --- a/include/openssl/core_dispatch.h +++ b/include/openssl/core_dispatch.h @@ -331,7 +331,6 @@ OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, cipher_gettable_ctx_params, OSSL_CORE_MAKE_FUNC(void *, mac_newctx, (void *provctx)) OSSL_CORE_MAKE_FUNC(void *, mac_dupctx, (void *src)) OSSL_CORE_MAKE_FUNC(void, mac_freectx, (void *mctx)) -OSSL_CORE_MAKE_FUNC(size_t, mac_size, (void *mctx)) OSSL_CORE_MAKE_FUNC(int, mac_init, (void *mctx)) OSSL_CORE_MAKE_FUNC(int, mac_update, (void *mctx, const unsigned char *in, size_t inl)) diff --git a/providers/implementations/macs/blake2_mac_impl.c b/providers/implementations/macs/blake2_mac_impl.c index f7b6bd3e4f0..542595efa1f 100644 --- a/providers/implementations/macs/blake2_mac_impl.c +++ b/providers/implementations/macs/blake2_mac_impl.c @@ -39,8 +39,6 @@ struct blake2_mac_data_st { unsigned char key[BLAKE2_KEYBYTES]; }; -static size_t blake2_mac_size(void *vmacctx); - static void *blake2_mac_new(void *unused_provctx) { struct blake2_mac_data_st *macctx; @@ -82,6 +80,13 @@ static void blake2_mac_free(void *vmacctx) } } +static size_t blake2_mac_size(void *vmacctx) +{ + struct blake2_mac_data_st *macctx = vmacctx; + + return macctx->params.digest_length; +} + static int blake2_mac_init(void *vmacctx) { struct blake2_mac_data_st *macctx = vmacctx; @@ -214,13 +219,6 @@ static int blake2_mac_set_ctx_params(void *vmacctx, const OSSL_PARAM params[]) return 1; } -static size_t blake2_mac_size(void *vmacctx) -{ - struct blake2_mac_data_st *macctx = vmacctx; - - return macctx->params.digest_length; -} - const OSSL_DISPATCH BLAKE2_FUNCTIONS[] = { { OSSL_FUNC_MAC_NEWCTX, (void (*)(void))blake2_mac_new }, { OSSL_FUNC_MAC_DUPCTX, (void (*)(void))blake2_mac_dup }, diff --git a/providers/implementations/macs/gmac_prov.c b/providers/implementations/macs/gmac_prov.c index d9790dcd6ce..fe4d2c3c8a1 100644 --- a/providers/implementations/macs/gmac_prov.c +++ b/providers/implementations/macs/gmac_prov.c @@ -45,8 +45,6 @@ struct gmac_data_st { PROV_CIPHER cipher; }; -static size_t gmac_size(void); - static void gmac_free(void *vmacctx) { struct gmac_data_st *macctx = vmacctx; @@ -95,6 +93,11 @@ static void *gmac_dup(void *vsrc) return dst; } +static size_t gmac_size(void) +{ + return EVP_GCM_TLS_TAG_LEN; +} + static int gmac_init(void *vmacctx) { return ossl_prov_is_running(); @@ -141,11 +144,6 @@ static int gmac_final(void *vmacctx, unsigned char *out, size_t *outl, return 1; } -static size_t gmac_size(void) -{ - return EVP_GCM_TLS_TAG_LEN; -} - static const OSSL_PARAM known_gettable_params[] = { OSSL_PARAM_size_t(OSSL_MAC_PARAM_SIZE, NULL), OSSL_PARAM_END diff --git a/providers/implementations/macs/hmac_prov.c b/providers/implementations/macs/hmac_prov.c index b5d3f110f41..993e36ae343 100644 --- a/providers/implementations/macs/hmac_prov.c +++ b/providers/implementations/macs/hmac_prov.c @@ -71,8 +71,6 @@ int ssl3_cbc_digest_record(const EVP_MD *md, const unsigned char *mac_secret, size_t mac_secret_length, char is_sslv3); -static size_t hmac_size(void *vmacctx); - static void *hmac_new(void *provctx) { struct hmac_data_st *macctx; diff --git a/providers/implementations/macs/kmac_prov.c b/providers/implementations/macs/kmac_prov.c index 940fe7eb3d1..b9a6318e122 100644 --- a/providers/implementations/macs/kmac_prov.c +++ b/providers/implementations/macs/kmac_prov.c @@ -73,7 +73,6 @@ static OSSL_FUNC_mac_gettable_ctx_params_fn kmac_gettable_ctx_params; static OSSL_FUNC_mac_get_ctx_params_fn kmac_get_ctx_params; static OSSL_FUNC_mac_settable_ctx_params_fn kmac_settable_ctx_params; static OSSL_FUNC_mac_set_ctx_params_fn kmac_set_ctx_params; -static OSSL_FUNC_mac_size_fn kmac_size; static OSSL_FUNC_mac_init_fn kmac_init; static OSSL_FUNC_mac_update_fn kmac_update; static OSSL_FUNC_mac_final_fn kmac_final; @@ -235,6 +234,13 @@ static void *kmac_dup(void *vsrc) return dst; } +static size_t kmac_size(void *vmacctx) +{ + struct kmac_data_st *kctx = vmacctx; + + return kctx->out_len; +} + /* * The init() assumes that any ctrl methods are set beforehand for * md, key and custom. Setting the fields afterwards will have no @@ -278,13 +284,6 @@ static int kmac_init(void *vmacctx) && EVP_DigestUpdate(ctx, kctx->key, kctx->key_len); } -static size_t kmac_size(void *vmacctx) -{ - struct kmac_data_st *kctx = vmacctx; - - return kctx->out_len; -} - static int kmac_update(void *vmacctx, const unsigned char *data, size_t datalen) { diff --git a/providers/implementations/macs/poly1305_prov.c b/providers/implementations/macs/poly1305_prov.c index 1b248f141e1..a3bc47253cf 100644 --- a/providers/implementations/macs/poly1305_prov.c +++ b/providers/implementations/macs/poly1305_prov.c @@ -40,8 +40,6 @@ struct poly1305_data_st { POLY1305 poly1305; /* Poly1305 data */ }; -static size_t poly1305_size(void); - static void *poly1305_new(void *provctx) { struct poly1305_data_st *ctx; diff --git a/providers/implementations/macs/siphash_prov.c b/providers/implementations/macs/siphash_prov.c index 01100b51d6c..1a79ae0c6a3 100644 --- a/providers/implementations/macs/siphash_prov.c +++ b/providers/implementations/macs/siphash_prov.c @@ -38,7 +38,6 @@ static OSSL_FUNC_mac_gettable_ctx_params_fn siphash_gettable_ctx_params; static OSSL_FUNC_mac_get_ctx_params_fn siphash_get_ctx_params; static OSSL_FUNC_mac_settable_ctx_params_fn siphash_settable_params; static OSSL_FUNC_mac_set_ctx_params_fn siphash_set_params; -static OSSL_FUNC_mac_size_fn siphash_size; static OSSL_FUNC_mac_init_fn siphash_init; static OSSL_FUNC_mac_update_fn siphash_update; static OSSL_FUNC_mac_final_fn siphash_final; @@ -94,7 +93,7 @@ static int siphash_init(void *vmacctx) } static int siphash_update(void *vmacctx, const unsigned char *data, - size_t datalen) + size_t datalen) { struct siphash_data_st *ctx = vmacctx;