From: Hannes Reinecke <hare@suse.de>
To: Mark O'Donovan <shiftee@posteo.net>, linux-kernel@vger.kernel.org
Cc: linux-nvme@lists.infradead.org, sagi@grimberg.me, hch@lst.de,
axboe@kernel.dk, kbusch@kernel.org,
Akash Appaiah <Akash.Appaiah@dell.com>
Subject: Re: [PATCH v2 1/2] nvme-auth: use transformed key size to create resp
Date: Mon, 16 Oct 2023 11:14:38 +0200 [thread overview]
Message-ID: <4fb894c2-653b-48c7-be48-5eeb3978063c@suse.de> (raw)
In-Reply-To: <20231016085715.3068974-2-shiftee@posteo.net>
On 10/16/23 10:57, Mark O'Donovan wrote:
> This does not change current behaviour as the driver currently
> verifies that the secret size is the same size as the length of
> the transformation hash.
>
> Co-developed-by: Akash Appaiah <Akash.Appaiah@dell.com>
> Signed-off-by: Akash Appaiah <Akash.Appaiah@dell.com>
> Signed-off-by: Mark O'Donovan <shiftee@posteo.net>
> ---
> V1 -> V2: support target implementation and controller secrets also
>
> drivers/nvme/common/auth.c | 6 +++++-
> drivers/nvme/host/auth.c | 4 ++--
> drivers/nvme/target/auth.c | 4 ++--
> include/linux/nvme-auth.h | 3 ++-
> 4 files changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/nvme/common/auth.c b/drivers/nvme/common/auth.c
> index d90e4f0c08b7..26a7fbdf4d55 100644
> --- a/drivers/nvme/common/auth.c
> +++ b/drivers/nvme/common/auth.c
> @@ -243,6 +243,8 @@ u8 *nvme_auth_transform_key(struct nvme_dhchap_key *key, char *nqn)
> }
> if (key->hash == 0) {
> transformed_key = kmemdup(key->key, key->len, GFP_KERNEL);
> + if (transformed_key)
> + key->transformed_len = key->len;
> return transformed_key ? transformed_key : ERR_PTR(-ENOMEM);
Hmm. But now we're inconsistent.
The input structure 'key' doesn't know (nor does care) if the key has
been transformed; the transformation itself is returned in a different
structure.
If we were to go that way the it'll be better to return a 'struct
nvme_dhchap_key' from nvme_auth_transform_key(), which will then
encapsulate the data and the correct length.
Which probably is not a bad idea, seeing that a key transform really
should generate a new key.
Hmm?
Cheers,
Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare@suse.de +49 911 74053 688
SUSE Software Solutions Germany GmbH, Frankenstr. 146, 90461 Nürnberg
Managing Directors: I. Totev, A. Myers, A. McDonald, M. B. Moerman
(HRB 36809, AG Nürnberg)
next prev parent reply other threads:[~2023-10-16 9:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-16 8:57 [PATCH v2 0/2] Remove secret-size restrictions for hashes Mark O'Donovan
2023-10-16 8:57 ` [PATCH v2 1/2] nvme-auth: use transformed key size to create resp Mark O'Donovan
2023-10-16 9:14 ` Hannes Reinecke [this message]
2023-10-16 8:57 ` [PATCH v2 2/2] nvme-auth: allow mixing of secret and hash lengths Mark O'Donovan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4fb894c2-653b-48c7-be48-5eeb3978063c@suse.de \
--to=hare@suse.de \
--cc=Akash.Appaiah@dell.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
--cc=shiftee@posteo.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®