Re: [PATCH 4/5] blk-crypto: rename blk_keyslot_manager to blk_crypto_profile
From: Ulf Hansson <hidden>
Date: 2021-09-14 09:04:59
Also in:
dm-devel, linux-mmc, linux-scsi
On Mon, 13 Sept 2021 at 03:35, Eric Biggers [off-list ref] wrote:
From: Eric Biggers <redacted>
blk_keyslot_manager is misnamed because it doesn't necessarily manage
keyslots. It actually does several different things:
- Contains the crypto capabilities of the device.
- Provides functions to control the inline encryption hardware.
Originally these were just for programming/evicting keyslots;
however, new functionality (hardware-wrapped keys) will require new
functions here which are unrelated to keyslots. Moreover,
device-mapper devices already (ab)use "keyslot_evict" to pass key
eviction requests to their underlying devices even though
device-mapper devices don't have any keyslots themselves (so it
really should be "evict_key", not "keyslot_evict").
- Sometimes (but not always!) it manages keyslots. Originally it
always did, but device-mapper devices don't have keyslots
themselves, so they use a "passthrough keyslot manager" which
doesn't actually manage keyslots. This hack works, but the
terminology is unnatural. Also, some hardware doesn't have keyslots
and thus also uses a "passthrough keyslot manager" (support for such
hardware is yet to be upstreamed, but it will happen eventually).
Let's stop having keyslot managers which don't actually manage keyslots.
Instead, rename blk_keyslot_manager to blk_crypto_profile.
This is a fairly big change, since for consistency it also has to update
keyslot manager-related function names, variable names, and comments --
not just the actual struct name. However it's still a fairly
straightforward change, as it doesn't change any actual functionality.
Signed-off-by: Eric Biggers <redacted>
---
block/blk-crypto-fallback.c | 60 ++--
block/blk-crypto-profile.c | 518 ++++++++++++++---------------
block/blk-crypto.c | 25 +-
block/blk-integrity.c | 2 +-
drivers/md/dm-core.h | 2 +-
drivers/md/dm-table.c | 168 +++++-----
drivers/md/dm.c | 8 +-
drivers/mmc/core/crypto.c | 11 +-
drivers/mmc/host/cqhci-crypto.c | 31 +-
drivers/scsi/ufs/ufshcd-crypto.c | 32 +-
drivers/scsi/ufs/ufshcd-crypto.h | 9 +-
drivers/scsi/ufs/ufshcd.c | 2 +-
drivers/scsi/ufs/ufshcd.h | 4 +-
include/linux/blk-crypto-profile.h | 164 +++++----
include/linux/blkdev.h | 18 +-
include/linux/device-mapper.h | 4 +-
include/linux/mmc/host.h | 2 +-
17 files changed, 548 insertions(+), 512 deletions(-)Acked-by: Ulf Hansson <redacted> # For MMC [...] Kind regards Uffe