lib/crypto: add HKDF and convert fscrypt and NVMe
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest5 patches 2 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/5 | lib/crypto: add HKDF-SHA{256,384,512}include/ lib/ lib/ +2 more | +286 | 0 replies | |
| 2/5 | lib/crypto: tests: add HKDF KUnit testslib/ lib/ lib/ +1 more | +286 | 0 replies | |
| 3/5 | fscrypt: use HKDF library functionsfs/ | +13 | 0 replies | |
| 4/5 | nvme-auth: use HKDF library functions for TLS PSK derivationdrivers/ | +68 | 0 replies | |
| 5/5 | ovpn: use HKDF library functions for epoch key derivationdrivers/ drivers/ drivers/ +1 more | +60 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/5] lib/crypto: add HKDF and convert fscrypt and NVMe
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
Signature · 1 line
2.43.0