Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] lib/crypto: add HKDF and convert fscrypt and NVMe
@ 2026-07-21 14:06 Marco Baffo
  2026-07-21 14:06 ` [PATCH 1/5] lib/crypto: add HKDF-SHA{256,384,512} Marco Baffo
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Marco Baffo @ 2026-07-21 14:06 UTC (permalink / raw)
  To: linux-crypto
  Cc: herbert, davem, ebiggers, Jason, ardb, tytso, jaegeuk,
	linux-fscrypt, kbusch, axboe, hch, sagi, hare, linux-nvme,
	andrew+netdev, edumazet, kuba, pabeni, antonio, sd, linux-kernel,
	Marco Baffo

fscrypt and NVMe authentication each carry private HKDF
implementations. Add HKDF-SHA256, HKDF-SHA384, and HKDF-SHA512
functions to lib/crypto and convert both users.

Patches 1-4 are intended for review and inclusion.

Patch 5 is RFC only and is not intended to be applied. It shows how
the OVPN epoch-key code currently under development can use the new
HKDF API. That patch has an additional dependency on the OVPN epoch
series. It is included here to allow the API to be reviewed against
a third user. The OVPN conversion will be submitted separately once
its prerequisite code is ready.

HKDF-Expand accepts info as an array of segments and processes them as
if concatenated. This preserves the byte ordering used by fscrypt and
allows NVMe to encode HkdfLabel without allocating a temporary buffer.

HKDF-Extract produces a prepared HMAC key, avoiding repeated key setup
when the same PRK is expanded more than once. The implementation uses
the direct HMAC library functions and neither allocates memory nor
returns errors.

The series is intended for the libcrypto tree. Patches 3 and 4 need
review from the fscrypt and NVMe maintainers, respectively.

Tested with:

- HKDF KUnit tests
- NVMe authentication KUnit tests
- kvm-xfstests smoketest on ext4
- kvm-xfstests generic/582, generic/583, and generic/584 on ext4 and f2fs
- kvm-xfstests encrypt group on ext4 and f2fs

The following shortlog and diffstat refers only to the first 4 patches.

Marco Baffo (4):
  lib/crypto: add HKDF-SHA{256,384,512}
  lib/crypto: tests: add HKDF KUnit tests
  fscrypt: use HKDF library functions
  nvme-auth: use HKDF library functions for TLS PSK derivation

 drivers/nvme/common/auth.c    | 120 ++++++++-------
 fs/crypto/hkdf.c              |  56 ++-----
 include/crypto/hkdf.h         | 131 ++++++++++++++++
 lib/crypto/.kunitconfig       |   1 +
 lib/crypto/Makefile           |   4 +-
 lib/crypto/hkdf-sha256.c      |  22 +++
 lib/crypto/hkdf-sha512.c      |  34 +++++
 lib/crypto/hkdf-template.h    |  97 ++++++++++++
 lib/crypto/tests/Kconfig      |   8 +
 lib/crypto/tests/Makefile     |   1 +
 lib/crypto/tests/hkdf_kunit.c | 276 ++++++++++++++++++++++++++++++++++
 11 files changed, 653 insertions(+), 97 deletions(-)
 create mode 100644 include/crypto/hkdf.h
 create mode 100644 lib/crypto/hkdf-sha256.c
 create mode 100644 lib/crypto/hkdf-sha512.c
 create mode 100644 lib/crypto/hkdf-template.h
 create mode 100644 lib/crypto/tests/hkdf_kunit.c


base-commit: e4f23159c8d09b6b15d47f2c95e0a3e7c62f52a2
-- 
2.43.0



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-07-21 15:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-21 14:06 [PATCH 0/5] lib/crypto: add HKDF and convert fscrypt and NVMe Marco Baffo
2026-07-21 14:06 ` [PATCH 1/5] lib/crypto: add HKDF-SHA{256,384,512} Marco Baffo
2026-07-21 14:06 ` [PATCH 2/5] lib/crypto: tests: add HKDF KUnit tests Marco Baffo
2026-07-21 14:06 ` [PATCH 3/5] fscrypt: use HKDF library functions Marco Baffo
2026-07-21 14:06 ` [PATCH 4/5] nvme-auth: use HKDF library functions for TLS PSK derivation Marco Baffo
2026-07-21 14:06 ` [RFC PATCH 5/5] ovpn: use HKDF library functions for epoch key derivation Marco Baffo
2026-07-21 15:06 ` [PATCH 0/5] lib/crypto: add HKDF and convert fscrypt and NVMe Eric Biggers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox