[PATCH 19/21] nvme-auth: common: remove nvme_auth_digest_name()

Eric Biggers
2026-03-02T08:01:38Z

Since nvme_auth_digest_name() is no longer used, remove it and the
associated data from the hash_map array.

Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---
drivers/nvme/common/auth.c | 12 ------------
include/linux/nvme-auth.h | 1 -
2 files changed, 13 deletions(-)

diff --git a/drivers/nvme/common/auth.c b/drivers/nvme/common/auth.c
index 5be86629c2d41..2d325fb930836 100644
--- a/drivers/nvme/common/auth.c
+++ b/drivers/nvme/common/auth.c
@@ -87,26 +87,22 @@ u8 nvme_auth_dhgroup_id(const char *dhgroup_name)
EXPORT_SYMBOL_GPL(nvme_auth_dhgroup_id);

static const struct nvme_dhchap_hash_map {
int len;
char hmac[15];
- char digest[8];
} hash_map[] = {
[NVME_AUTH_HASH_SHA256] = {
.len = 32,
.hmac = "hmac(sha256)",
- .digest = "sha256",
},
[NVME_AUTH_HASH_SHA384] = {
.len = 48,
.hmac = "hmac(sha384)",
- .digest = "sha384",
},
[NVME_AUTH_HASH_SHA512] = {
.len = 64,
.hmac = "hmac(sha512)",
- .digest = "sha512",
},
};

const char *nvme_auth_hmac_name(u8 hmac_id)
{
@@ -114,18 +110,10 @@ const char *nvme_auth_hmac_name(u8 hmac_id)
return NULL;
return hash_map[hmac_id].hmac;
}
EXPORT_SYMBOL_GPL(nvme_auth_hmac_name);

-const char *nvme_auth_digest_name(u8 hmac_id)
-{
- if (hmac_id >= ARRAY_SIZE(hash_map))
- return NULL;
- return hash_map[hmac_id].digest;
-}
-EXPORT_SYMBOL_GPL(nvme_auth_digest_name);
-
u8 nvme_auth_hmac_id(const char *hmac_name)
{
int i;

if (!hmac_name || !strlen(hmac_name))
diff --git a/include/linux/nvme-auth.h b/include/linux/nvme-auth.h
index 940d0703eb1df..184a1f9510fad 100644
--- a/include/linux/nvme-auth.h
+++ b/include/linux/nvme-auth.h
@@ -19,11 +19,10 @@ u32 nvme_auth_get_seqnum(void);
const char *nvme_auth_dhgroup_name(u8 dhgroup_id);
const char *nvme_auth_dhgroup_kpp(u8 dhgroup_id);
u8 nvme_auth_dhgroup_id(const char *dhgroup_name);

const char *nvme_auth_hmac_name(u8 hmac_id);
-const char *nvme_auth_digest_name(u8 hmac_id);
size_t nvme_auth_hmac_hash_len(u8 hmac_id);
u8 nvme_auth_hmac_id(const char *hmac_name);
struct nvme_auth_hmac_ctx {
u8 hmac_id;
union {
--
2.53.0