From 9f57e2184de330e83d0636586e88a8524c513b8e Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Thu, 22 Aug 2019 12:08:55 +0200 Subject: [PATCH] Remove MAC cruft A few declarations and static functions / arrays that are no longer used were left behind when MACs moved to be implemented by providers. Reviewed-by: Shane Lontis (Merged from https://github.com/openssl/openssl/pull/9667) --- crypto/evp/m_sha3.c | 30 ------------------------------ crypto/include/internal/evp_int.h | 7 ------- 2 files changed, 37 deletions(-) diff --git a/crypto/evp/m_sha3.c b/crypto/evp/m_sha3.c index f3266ebec2..1e71eed948 100644 --- a/crypto/evp/m_sha3.c +++ b/crypto/evp/m_sha3.c @@ -36,12 +36,6 @@ static int shake_init(EVP_MD_CTX *ctx) return sha3_init(EVP_MD_CTX_md_data(ctx), '\x1f', ctx->digest->md_size * 8); } -static int kmac_init(EVP_MD_CTX *ctx) -{ - return keccak_kmac_init(EVP_MD_CTX_md_data(ctx), '\x04', - ctx->digest->md_size * 8 / 2); -} - static int shake_ctrl(EVP_MD_CTX *evp_ctx, int cmd, int p1, void *p2) { KECCAK1600_CTX *ctx = evp_ctx->md_data; @@ -323,27 +317,3 @@ EVP_MD_SHA3(512) EVP_MD_SHAKE(128) EVP_MD_SHAKE(256) - - -# define EVP_MD_KECCAK_KMAC(bitlen) \ -const EVP_MD *evp_keccak_kmac##bitlen(void) \ -{ \ - static const EVP_MD kmac_##bitlen##_md = { \ - NID_kmac##bitlen, \ - 0, \ - 2 * bitlen / 8, \ - EVP_MD_FLAG_XOF, \ - kmac_init, \ - update, \ - final, \ - NULL, \ - NULL, \ - (KECCAK1600_WIDTH - bitlen * 2) / 8, \ - sizeof(KECCAK1600_CTX), \ - shake_ctrl \ - }; \ - return &kmac_##bitlen##_md; \ -} - -EVP_MD_KECCAK_KMAC(128) -EVP_MD_KECCAK_KMAC(256) diff --git a/crypto/include/internal/evp_int.h b/crypto/include/internal/evp_int.h index 7b1c6aa9c2..b86b1d1af0 100644 --- a/crypto/include/internal/evp_int.h +++ b/crypto/include/internal/evp_int.h @@ -118,8 +118,6 @@ extern const EVP_PKEY_METHOD hkdf_pkey_meth; extern const EVP_PKEY_METHOD poly1305_pkey_meth; extern const EVP_PKEY_METHOD siphash_pkey_meth; -/* struct evp_mac_impl_st is defined by the implementation */ -typedef struct evp_mac_impl_st EVP_MAC_IMPL; struct evp_mac_st { OSSL_PROVIDER *prov; char *name; @@ -142,10 +140,6 @@ struct evp_mac_st { OSSL_OP_mac_set_ctx_params_fn *set_ctx_params; }; -/* Internal keccak algorithms used for KMAC */ -const EVP_MD *evp_keccak_kmac128(void); -const EVP_MD *evp_keccak_kmac256(void); - /* * This function is internal for now, but can be made external when needed. * The documentation would read: @@ -153,7 +147,6 @@ const EVP_MD *evp_keccak_kmac256(void); * EVP_add_mac() adds the MAC implementation C to the internal * object database. */ -int EVP_add_mac(const EVP_MAC *mac); int EVP_add_kdf(const EVP_KDF *kdf); /* struct evp_kdf_impl_st is defined by the implementation */ -- 2.25.1