[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251105132023.GC19044@lst.de>
Date: Wed, 5 Nov 2025 14:20:24 +0100
From: Christoph Hellwig <hch@....de>
To: alistair23@...il.com
Cc: hare@...e.de, kbusch@...nel.org, axboe@...nel.dk, hch@....de,
sagi@...mberg.me, kch@...dia.com, linux-nvme@...ts.infradead.org,
linux-kernel@...r.kernel.org,
Alistair Francis <alistair.francis@....com>
Subject: Re: [PATCH v2] nvmet-auth: update sc_c in target host hash
calculation
> 4 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/nvme/host/auth.c b/drivers/nvme/host/auth.c
> index a01178caf15b..19980122d3d5 100644
> --- a/drivers/nvme/host/auth.c
> +++ b/drivers/nvme/host/auth.c
> @@ -492,6 +492,7 @@ static int nvme_auth_dhchap_setup_host_response(struct nvme_ctrl *ctrl,
> ret = crypto_shash_update(shash, buf, 2);
> if (ret)
> goto out;
> + memset(buf, 0, sizeof(buf));
> *buf = chap->sc_c;
> ret = crypto_shash_update(shash, buf, 1);
I'm really confused about both the existing code and this fixup.
Why isn't chap->sc_c directly passed to crypto_shash_update here?
Why do we need to memset buf when only a single byte is passed to
crypto_shash_update?
> ret = crypto_shash_update(shash, buf, 2);
> if (ret)
> goto out;
> - *buf = sc_c;
> + *buf = req->sq->sc_c;
> ret = crypto_shash_update(shash, buf, 1);
Just pass it directly here?
> if (ret)
> goto out;
> @@ -378,6 +378,7 @@ int nvmet_auth_host_hash(struct nvmet_req *req, u8 *response,
> ret = crypto_shash_update(shash, ctrl->hostnqn, strlen(ctrl->hostnqn));
> if (ret)
> goto out;
> + memset(buf, 0, sizeof(buf));
> ret = crypto_shash_update(shash, buf, 1);
just have a
sttic const u8 zero = 0;
and use that here instead of the memset?
Powered by blists - more mailing lists