BACKPORT: blk-crypto: rename blk_keyslot_manager to blk_crypto_profile
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.
Acked-by: Ulf Hansson <ulf.hansson@linaro.org> # For MMC
Reviewed-by: Mike Snitzer <snitzer@redhat.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Link: https://lore.kernel.org/r/20211018180453.40441-4-ebiggers@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
(cherry picked from commit cb77cb5abe1f4fae4a33b735606aae22f9eaa1c7)
Conflicts:
block/blk-crypto.c
drivers/scsi/ufs/ufshcd-crypto.c
include/linux/blk-mq.h
Bug: 160883801
Bug: 162257402
Bug: 207390665
Bug: 234653003
Change-Id: I787cdc0d74baf5e4c94d73d5c467122bcc472649
Signed-off-by: Eric Biggers <ebiggers@google.com>
This commit is contained in:
@@ -38,7 +38,7 @@ struct pr_ops;
|
||||
struct rq_qos;
|
||||
struct blk_queue_stats;
|
||||
struct blk_stat_callback;
|
||||
struct blk_keyslot_manager;
|
||||
struct blk_crypto_profile;
|
||||
|
||||
#define BLKDEV_MIN_RQ 4
|
||||
#define BLKDEV_MAX_RQ 128 /* Default maximum */
|
||||
@@ -212,7 +212,7 @@ struct request {
|
||||
|
||||
#ifdef CONFIG_BLK_INLINE_ENCRYPTION
|
||||
struct bio_crypt_ctx *crypt_ctx;
|
||||
struct blk_ksm_keyslot *crypt_keyslot;
|
||||
struct blk_crypto_keyslot *crypt_keyslot;
|
||||
#endif
|
||||
|
||||
unsigned short write_hint;
|
||||
@@ -457,8 +457,7 @@ struct request_queue {
|
||||
unsigned int dma_alignment;
|
||||
|
||||
#ifdef CONFIG_BLK_INLINE_ENCRYPTION
|
||||
/* Inline crypto capabilities */
|
||||
struct blk_keyslot_manager *ksm;
|
||||
struct blk_crypto_profile *crypto_profile;
|
||||
#endif
|
||||
|
||||
unsigned int rq_timeout;
|
||||
@@ -1830,19 +1829,20 @@ static inline struct bio_vec *rq_integrity_vec(struct request *rq)
|
||||
|
||||
#ifdef CONFIG_BLK_INLINE_ENCRYPTION
|
||||
|
||||
bool blk_ksm_register(struct blk_keyslot_manager *ksm, struct request_queue *q);
|
||||
bool blk_crypto_register(struct blk_crypto_profile *profile,
|
||||
struct request_queue *q);
|
||||
|
||||
void blk_ksm_unregister(struct request_queue *q);
|
||||
void blk_crypto_unregister(struct request_queue *q);
|
||||
|
||||
#else /* CONFIG_BLK_INLINE_ENCRYPTION */
|
||||
|
||||
static inline bool blk_ksm_register(struct blk_keyslot_manager *ksm,
|
||||
struct request_queue *q)
|
||||
static inline bool blk_crypto_register(struct blk_crypto_profile *profile,
|
||||
struct request_queue *q)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline void blk_ksm_unregister(struct request_queue *q) { }
|
||||
static inline void blk_crypto_unregister(struct request_queue *q) { }
|
||||
|
||||
#endif /* CONFIG_BLK_INLINE_ENCRYPTION */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user