linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Chris Leech <cleech@redhat.com>
To: linux-nvme@lists.infradead.org, Hannes Reinecke <hare@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>, Keith Busch <kbusch@kernel.org>,
	Sagi Grimberg <sagi@grimberg.me>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S . Miller" <davem@davemloft.net>,
	linux-crypto@vger.kernel.org, Eric Biggers <ebiggers@kernel.org>
Subject: [PATCH v2 0/2] nvme: fixup HKDF-Expand-Label implementation
Date: Thu, 21 Aug 2025 13:48:14 -0700	[thread overview]
Message-ID: <20250821204816.2091293-1-cleech@redhat.com> (raw)

As per RFC 8446 (TLS 1.3) the HKDF-Expand-Label function is using vectors
for the 'label' and 'context' field, but defines these vectors as a string
prefixed with the string length (in binary). The implementation in nvme
is missing the length prefix which was causing interoperability issues
with spec-conformant implementations.

This patchset adds a function 'hkdf_expand_label()' to correctly implement
the HKDF-Expand-Label functionality and modifies the nvme driver to utilize
this function instead of the open-coded implementation.

As usual, comments and reviews are welcome.

Changes from v1:
 - Moved hkdf_expand_label() from crypto/hkdf.c to nvme/common/auth.c.
   It's not really an RFC 5869 HKDF function, it's defined for TLS but
   currently only used by nvme in-kernel.
 - Fixed kdoc label_len -> labellen
 - Replaced "static const char []" with "const char *", it's just
   clearer and generates the same code with a string literal assignment.

(I've left the crypto emails on this version, mostly to make it known
that hkdf_expand_label() has been moved as Eric asked.)

Chris Leech (2):
  nvme-auth: add hkdf_expand_label()
  nvme-auth: use hkdf_expand_label()

 drivers/nvme/common/auth.c | 86 +++++++++++++++++++++++++++++---------
 1 file changed, 66 insertions(+), 20 deletions(-)

-- 
2.50.1



             reply	other threads:[~2025-08-22  3:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-21 20:48 Chris Leech [this message]
2025-08-21 20:48 ` [PATCH v2 1/2] nvme-auth: add hkdf_expand_label() Chris Leech
2025-08-21 20:48 ` [PATCH v2 2/2] nvme-auth: use hkdf_expand_label() Chris Leech
2025-08-22  1:09 ` [PATCH v2 0/2] nvme: fixup HKDF-Expand-Label implementation Eric Biggers
2025-08-22  6:08   ` Hannes Reinecke

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=20250821204816.2091293-1-cleech@redhat.com \
    --to=cleech@redhat.com \
    --cc=davem@davemloft.net \
    --cc=ebiggers@kernel.org \
    --cc=hare@kernel.org \
    --cc=hch@lst.de \
    --cc=herbert@gondor.apana.org.au \
    --cc=kbusch@kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /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;
as well as URLs for NNTP newsgroup(s).