Skip to content

nvme: fixup HKDF-Expand-Label implementation

Chris Leech linux-crypto linux-nvme 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest2 patches 4 repliesIn review

Changes in v2 from the cover letter

- 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.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2nvme-auth: add hkdf_expand_label()drivers/nvme/common/auth.c+53 -00 replies
2/2nvme-auth: use hkdf_expand_label()drivers/nvme/common/auth.c+13 -200 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/2] nvme: fixup HKDF-Expand-Label implementation

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(-)
Signature · 1 line
2.50.1