From nobody Tue Jun 16 03:49:02 2026 Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC29119995E for ; Fri, 17 Apr 2026 00:51:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776387066; cv=none; b=B6P2yq8+eKvVRNxHhBkt3rdUHUlixjm3R6eZnCUOaYbFcF85QdruAWabxaWjnfL9sfa06lvmMj2FLatFPfWSvsVYKu9aR//wXK187Sb3zeMpwOUEjAv6if8v0uB7n+sxE9dwTq4c5c+/OVSosUI3gj9GbWiUbxwIs5IBSMcH1cQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776387066; c=relaxed/simple; bh=QQwkrPswrvCVcsOqMyyLCaBG7Z/M49iVZFv7gxB4pmM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=WUvZ5n6pCB68tQEoA1cXe8xWMf+5F25E3oJdm2kDnGJOKfDhlSQTnDAWv7XqqJo4QUjySQpIARQ/4H74aczfTkS4MWP0Bm5HSB0EsTHiReiFzXcvvLDU2/c6KK40SrHyCNC6AE3nbW6UvXKEBOTgBMTF3DUZaPr5UTfL0r4rGAU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WqmAR/Yv; arc=none smtp.client-ip=209.85.210.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WqmAR/Yv" Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-82f431c0ab6so76894b3a.0 for ; Thu, 16 Apr 2026 17:51:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776387064; x=1776991864; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=OnWo2Tuaq7Z+geKHmJANpC2Zz9+7IbUKXu6vHtPg40w=; b=WqmAR/YvAMivmgIgiFH/yqOslBxPq2d0qnhWh36H8VwjSr+OWfAaxEAOSH6p6TY50m MyzqLwVRLrYxNcIW5fZJBXcm/HhLRnNSOSoImjC/edjF0+JCdZ4PqIM8LPEmEDyGqmgq s4H8yq43a6rKuhM4JHg5g2WQXRO6JpfND6cnVD+owa8aXe1xYj41HuqxhJ0sSmHv14A6 JRlazqShRwvWdeN3PDUpDUYYWwwxYEW6dEH6LCs7uODjK3Q2/tSK1GtpFslnX+m6uKLR pVcaPJBpDBQxucG/RLVYVCisYPGzkmcCNxHESI2gp1bR9RJPcX0VpEK6pkHdgKKMzDIZ iKfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776387064; x=1776991864; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=OnWo2Tuaq7Z+geKHmJANpC2Zz9+7IbUKXu6vHtPg40w=; b=ZZ6zPXPHhu/ybS5xVCosDOQ2Ukg/a8O74cXom8IJazqSGmSNaeIuCpT7DeNgEhJfU1 67tzv1xNNAL3dJwYte61ZqjD4oYAbYRYE4HxC9Xq8EUwN70au+gTR8lKDSEbn7zjLv3/ Qmkc57s582ZFED74L+/47aVl9C6Af/XYJcNSHdJPqaESUFBhUWQibEZp44XVJXen2uWU aQZ+dX6JagBTWRdskRKB2TpKMSpU5072TM2Zl6ZN6rkE3nHcFAxLZ3DYb6Itu15lfqCS +u7yCs6Xu3OooANwE3biJFY4ID0xKTPfV9wUXwO/BAqCJAPXZ19hzBGF3O2BdkJHSGb3 cEwQ== X-Forwarded-Encrypted: i=1; AFNElJ/OwiqgEIh9UH8KpFtp3eCkzdj2DPvinYuA+XyjQi7WsMyM/xOG/FeMfBo8cw+ZJL1gq3DWq/obwBLCWtM=@vger.kernel.org X-Gm-Message-State: AOJu0Yy+QKCqMz+vjPLD6YKEAYGimaV5L8ehIzUgDqeU4e80sf+CIOFK aUtLEkab+bBS/aSvI+tPgp6PiXB6uzT3HToUOELnJfi7NQi1pfpGOA3L X-Gm-Gg: AeBDietmumGZorNA8NgrMrKoNBRsc3D75Kg12T+MBU5oRGLjr1UrZ22Rp+fnK5eeQJ5 RIAn5x8BxYKaPlAIay/GTQjaZ8vD0C3v7DEC3chgZs4Kt0F7q0OTH1GSqHzIKkiuZudgs4tsLiv dc2B6RXpgFZMXR9aNPnK3kwL9mazFfGyuc0NqVLK3rL+KF5ra2SFh3kf1qwdbs4htH9iVYFtPH+ 3WYNQ9IMjaw6hNOK0cV1bwoVTwVTLh97vWFjCWb9m/vCpMdl9w64C7PDYTxCNudoXdUpNnqZAp4 0f+e4pheR2Gf4sTXsDiWr8cMCjnJwD4Nod3mebK36cacH5HnxgloLAbgHoXegqX4to83rV+rV9x BN1Rz/1ML5G9bV/siCQ4oEBKMoGnwIaWeug6dGsXZYnuVIzbOGgCCsHUkkP0YYSdH1fRRloIyZo lZwDTsrkXiYma4qdRRu0TmEDD2AtxHRhDaIw1etr++Jyon8ySCZJo= X-Received: by 2002:a05:6a00:2d98:b0:82f:5c3f:94c6 with SMTP id d2e1a72fcca58-82f8c91b7d4mr502361b3a.28.1776387064055; Thu, 16 Apr 2026 17:51:04 -0700 (PDT) Received: from toolbx.alistair23.me ([2403:581e:fdf9:0:6209:4521:6813:45b7]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-82f8cbc05fcsm233782b3a.55.2026.04.16.17.50.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Apr 2026 17:51:03 -0700 (PDT) From: alistair23@gmail.com X-Google-Original-From: alistair.francis@wdc.com To: hare@suse.de, kbusch@kernel.org, axboe@kernel.dk, hch@lst.de, sagi@grimberg.me, kch@nvidia.com, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Cc: alistair23@gmail.com, Alistair Francis , Chris Leech Subject: [PATCH v3] nvme-auth: Include SC_C in RVAL controller hash Date: Fri, 17 Apr 2026 10:50:48 +1000 Message-ID: <20260417005048.2898121-1-alistair.francis@wdc.com> X-Mailer: git-send-email 2.53.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Alistair Francis 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 Reviewed-by: Chris Leech Reviewed-by: Hannes Reinecke --- 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(struc= t nvme_ctrl *ctrl, put_unaligned_le16(chap->transaction, buf); nvme_auth_hmac_update(&hmac, buf, 2); =20 - memset(buf, 0, 4); + *buf =3D 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 *r= esponse, put_unaligned_le16(req->sq->dhchap_tid, buf); nvme_auth_hmac_update(&hmac, buf, 2); =20 - memset(buf, 0, 4); + *buf =3D 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); --=20 2.53.0