]> git.ipfire.org Git - thirdparty/linux.git/commit
blk-crypto: add basic hardware-wrapped key support
authorEric Biggers <ebiggers@google.com>
Tue, 4 Feb 2025 06:00:35 +0000 (22:00 -0800)
committerJens Axboe <axboe@kernel.dk>
Mon, 10 Feb 2025 16:54:19 +0000 (09:54 -0700)
commitebc4176551cdd021d02f4d2ed734e7b65e44442a
tree51418b58655dc4f2b4a86d8cdce3004ae2181664
parenta64dcfb451e254085a7daee5fe51bf22959d52d3
blk-crypto: add basic hardware-wrapped key support

To prevent keys from being compromised if an attacker acquires read
access to kernel memory, some inline encryption hardware can accept keys
which are wrapped by a per-boot hardware-internal key.  This avoids
needing to keep the raw keys in kernel memory, without limiting the
number of keys that can be used.  Such hardware also supports deriving a
"software secret" for cryptographic tasks that can't be handled by
inline encryption; this is needed for fscrypt to work properly.

To support this hardware, allow struct blk_crypto_key to represent a
hardware-wrapped key as an alternative to a raw key, and make drivers
set flags in struct blk_crypto_profile to indicate which types of keys
they support.  Also add the ->derive_sw_secret() low-level operation,
which drivers supporting wrapped keys must implement.

For more information, see the detailed documentation which this patch
adds to Documentation/block/inline-encryption.rst.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Tested-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> # sm8650
Link: https://lore.kernel.org/r/20250204060041.409950-2-ebiggers@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
14 files changed:
Documentation/block/inline-encryption.rst
block/blk-crypto-fallback.c
block/blk-crypto-internal.h
block/blk-crypto-profile.c
block/blk-crypto.c
drivers/md/dm-table.c
drivers/mmc/host/cqhci-crypto.c
drivers/mmc/host/sdhci-msm.c
drivers/ufs/core/ufshcd-crypto.c
drivers/ufs/host/ufs-exynos.c
drivers/ufs/host/ufs-qcom.c
fs/crypto/inline_crypt.c
include/linux/blk-crypto-profile.h
include/linux/blk-crypto.h