* [PATCH] nvmet-auth: update sc_c in host response
@ 2025-10-22 7:59 Hannes Reinecke
2025-10-23 0:38 ` Keith Busch
0 siblings, 1 reply; 2+ messages in thread
From: Hannes Reinecke @ 2025-10-22 7:59 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Keith Busch, Sagi Grimberg, linux-nvme, Hannes Reinecke
From: Hannes Reinecke <hare@suse.de>
The target code should set the sc_c bit in calculating the host response
based on the status of the 'concat' setting, otherwise we'll get an
authentication mismatch for hosts setting that bit correctly.
Fixes: 7e091add9c43 ("nvme-auth: update sc_c in host response")
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
drivers/nvme/target/auth.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/target/auth.c b/drivers/nvme/target/auth.c
index b340380f3892..ceba21684e82 100644
--- a/drivers/nvme/target/auth.c
+++ b/drivers/nvme/target/auth.c
@@ -298,7 +298,7 @@ int nvmet_auth_host_hash(struct nvmet_req *req, u8 *response,
const char *hash_name;
u8 *challenge = req->sq->dhchap_c1;
struct nvme_dhchap_key *transformed_key;
- u8 buf[4];
+ u8 buf[4], sc_c = ctrl->concat ? 1 : 0;
int ret;
hash_name = nvme_auth_hmac_name(ctrl->shash_id);
@@ -367,13 +367,14 @@ int nvmet_auth_host_hash(struct nvmet_req *req, u8 *response,
ret = crypto_shash_update(shash, buf, 2);
if (ret)
goto out;
- memset(buf, 0, 4);
+ *buf = sc_c;
ret = crypto_shash_update(shash, buf, 1);
if (ret)
goto out;
ret = crypto_shash_update(shash, "HostHost", 8);
if (ret)
goto out;
+ memset(buf, 0, 4);
ret = crypto_shash_update(shash, ctrl->hostnqn, strlen(ctrl->hostnqn));
if (ret)
goto out;
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] nvmet-auth: update sc_c in host response
2025-10-22 7:59 [PATCH] nvmet-auth: update sc_c in host response Hannes Reinecke
@ 2025-10-23 0:38 ` Keith Busch
0 siblings, 0 replies; 2+ messages in thread
From: Keith Busch @ 2025-10-23 0:38 UTC (permalink / raw)
To: Hannes Reinecke
Cc: Christoph Hellwig, Sagi Grimberg, linux-nvme, Hannes Reinecke
On Wed, Oct 22, 2025 at 09:59:24AM +0200, Hannes Reinecke wrote:
> From: Hannes Reinecke <hare@suse.de>
>
> The target code should set the sc_c bit in calculating the host response
> based on the status of the 'concat' setting, otherwise we'll get an
> authentication mismatch for hosts setting that bit correctly.
Thanks, applied to nvme-6.18.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-10-23 0:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-22 7:59 [PATCH] nvmet-auth: update sc_c in host response Hannes Reinecke
2025-10-23 0:38 ` Keith Busch
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).