* [PATCH v3] nvme-auth: Include SC_C in RVAL controller hash
@ 2026-04-17 0:50 alistair23
2026-04-17 5:32 ` Hannes Reinecke
2026-04-20 16:31 ` Keith Busch
0 siblings, 2 replies; 3+ messages in thread
From: alistair23 @ 2026-04-17 0:50 UTC (permalink / raw)
To: hare, kbusch, axboe, hch, sagi, kch, linux-nvme, linux-kernel
Cc: alistair23, Alistair Francis, Chris Leech
From: Alistair Francis <alistair.francis@wdc.com>
Section 8.3.4.5.5 of the NVMe Base Specification 2.1 describes what is
included in the Response Value (RVAL) hash and SC_C should be included.
Currently we are hardcoding 0 instead of using the correct SC_C value.
Update the host and target code to use the SC_C when calculating the
RVAL instead of using 0.
Fixes: e88a7595b57f2 ("nvme-tcp: request secure channel concatenation")
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Chris Leech <cleech@redhat.com>
---
v3:
- Update Fixes tag
v2:
- Rebase using new nvme_auth_hmac_update() functions
drivers/nvme/host/auth.c | 3 ++-
drivers/nvme/target/auth.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/host/auth.c b/drivers/nvme/host/auth.c
index bbedbe181c8a6..63f543e809985 100644
--- a/drivers/nvme/host/auth.c
+++ b/drivers/nvme/host/auth.c
@@ -535,11 +535,12 @@ static int nvme_auth_dhchap_setup_ctrl_response(struct nvme_ctrl *ctrl,
put_unaligned_le16(chap->transaction, buf);
nvme_auth_hmac_update(&hmac, buf, 2);
- memset(buf, 0, 4);
+ *buf = chap->sc_c;
nvme_auth_hmac_update(&hmac, buf, 1);
nvme_auth_hmac_update(&hmac, "Controller", 10);
nvme_auth_hmac_update(&hmac, ctrl->opts->subsysnqn,
strlen(ctrl->opts->subsysnqn));
+ memset(buf, 0, 4);
nvme_auth_hmac_update(&hmac, buf, 1);
nvme_auth_hmac_update(&hmac, ctrl->opts->host->nqn,
strlen(ctrl->opts->host->nqn));
diff --git a/drivers/nvme/target/auth.c b/drivers/nvme/target/auth.c
index b34610e2f19d4..f032855b21477 100644
--- a/drivers/nvme/target/auth.c
+++ b/drivers/nvme/target/auth.c
@@ -402,11 +402,12 @@ int nvmet_auth_ctrl_hash(struct nvmet_req *req, u8 *response,
put_unaligned_le16(req->sq->dhchap_tid, buf);
nvme_auth_hmac_update(&hmac, buf, 2);
- memset(buf, 0, 4);
+ *buf = req->sq->sc_c;
nvme_auth_hmac_update(&hmac, buf, 1);
nvme_auth_hmac_update(&hmac, "Controller", 10);
nvme_auth_hmac_update(&hmac, ctrl->subsys->subsysnqn,
strlen(ctrl->subsys->subsysnqn));
+ memset(buf, 0, 4);
nvme_auth_hmac_update(&hmac, buf, 1);
nvme_auth_hmac_update(&hmac, ctrl->hostnqn, strlen(ctrl->hostnqn));
nvme_auth_hmac_final(&hmac, response);
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v3] nvme-auth: Include SC_C in RVAL controller hash
2026-04-17 0:50 [PATCH v3] nvme-auth: Include SC_C in RVAL controller hash alistair23
@ 2026-04-17 5:32 ` Hannes Reinecke
2026-04-20 16:31 ` Keith Busch
1 sibling, 0 replies; 3+ messages in thread
From: Hannes Reinecke @ 2026-04-17 5:32 UTC (permalink / raw)
To: alistair23, kbusch, axboe, hch, sagi, kch, linux-nvme,
linux-kernel
Cc: Alistair Francis, Chris Leech
On 4/17/26 02:50, alistair23@gmail.com wrote:
> From: Alistair Francis <alistair.francis@wdc.com>
>
> Section 8.3.4.5.5 of the NVMe Base Specification 2.1 describes what is
> included in the Response Value (RVAL) hash and SC_C should be included.
> Currently we are hardcoding 0 instead of using the correct SC_C value.
>
> Update the host and target code to use the SC_C when calculating the
> RVAL instead of using 0.
>
> Fixes: e88a7595b57f2 ("nvme-tcp: request secure channel concatenation")
> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> Reviewed-by: Chris Leech <cleech@redhat.com>
> ---
> v3:
> - Update Fixes tag
> v2:
> - Rebase using new nvme_auth_hmac_update() functions
>
> drivers/nvme/host/auth.c | 3 ++-
> drivers/nvme/target/auth.c | 3 ++-
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Cheers,
Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare@suse.de +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] nvme-auth: Include SC_C in RVAL controller hash
2026-04-17 0:50 [PATCH v3] nvme-auth: Include SC_C in RVAL controller hash alistair23
2026-04-17 5:32 ` Hannes Reinecke
@ 2026-04-20 16:31 ` Keith Busch
1 sibling, 0 replies; 3+ messages in thread
From: Keith Busch @ 2026-04-20 16:31 UTC (permalink / raw)
To: alistair23
Cc: hare, axboe, hch, sagi, kch, linux-nvme, linux-kernel,
Alistair Francis, Chris Leech
On Fri, Apr 17, 2026 at 10:50:48AM +1000, alistair23@gmail.com wrote:
> From: Alistair Francis <alistair.francis@wdc.com>
>
> Section 8.3.4.5.5 of the NVMe Base Specification 2.1 describes what is
> included in the Response Value (RVAL) hash and SC_C should be included.
> Currently we are hardcoding 0 instead of using the correct SC_C value.
>
> Update the host and target code to use the SC_C when calculating the
> RVAL instead of using 0.
Thanks, applied to nvme-7.1.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-04-20 16:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-17 0:50 [PATCH v3] nvme-auth: Include SC_C in RVAL controller hash alistair23
2026-04-17 5:32 ` Hannes Reinecke
2026-04-20 16:31 ` Keith Busch
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox