mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
blk-crypto: Fold __blk_crypto_cfg_supported() into its caller
__blk_crypto_cfg_supported() is called only by blk_crypto_config_supported_natively(), so fold it in. Reviewed-by: Christoph Hellwig <hch@lst.de> Link: https://patch.msgid.link/20260713023708.9245-3-ebiggers@kernel.org Signed-off-by: Eric Biggers <ebiggers@kernel.org>
This commit is contained in:
@@ -80,9 +80,6 @@ void blk_crypto_put_keyslot(struct blk_crypto_keyslot *slot);
|
||||
int __blk_crypto_evict_key(struct blk_crypto_profile *profile,
|
||||
const struct blk_crypto_key *key);
|
||||
|
||||
bool __blk_crypto_cfg_supported(struct blk_crypto_profile *profile,
|
||||
const struct blk_crypto_config *cfg);
|
||||
|
||||
int blk_crypto_ioctl(struct block_device *bdev, unsigned int cmd,
|
||||
void __user *argp);
|
||||
|
||||
|
||||
@@ -335,28 +335,6 @@ void blk_crypto_put_keyslot(struct blk_crypto_keyslot *slot)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* __blk_crypto_cfg_supported() - Check whether the given crypto profile
|
||||
* supports the given crypto configuration.
|
||||
* @profile: the crypto profile to check
|
||||
* @cfg: the crypto configuration to check for
|
||||
*
|
||||
* Return: %true if @profile supports the given @cfg.
|
||||
*/
|
||||
bool __blk_crypto_cfg_supported(struct blk_crypto_profile *profile,
|
||||
const struct blk_crypto_config *cfg)
|
||||
{
|
||||
if (!profile)
|
||||
return false;
|
||||
if (!(profile->modes_supported[cfg->crypto_mode] & cfg->data_unit_size))
|
||||
return false;
|
||||
if (profile->max_dun_bytes_supported < cfg->dun_bytes)
|
||||
return false;
|
||||
if (!(profile->key_types_supported & cfg->key_type))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is an internal function that evicts a key from an inline encryption
|
||||
* device that can be either a real device or the blk-crypto-fallback "device".
|
||||
|
||||
+21
-2
@@ -351,11 +351,30 @@ int blk_crypto_init_key(struct blk_crypto_key *blk_key,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(blk_crypto_init_key);
|
||||
|
||||
/**
|
||||
* blk_crypto_config_supported_natively() - Check whether a block device
|
||||
* supports hardware inline encryption
|
||||
* with the given configuration.
|
||||
* @bdev: the block device
|
||||
* @cfg: the crypto configuration to check for
|
||||
*
|
||||
* Return: %true if @bdev supports hardware inline encryption with @cfg.
|
||||
*/
|
||||
bool blk_crypto_config_supported_natively(struct block_device *bdev,
|
||||
const struct blk_crypto_config *cfg)
|
||||
{
|
||||
return __blk_crypto_cfg_supported(bdev_get_queue(bdev)->crypto_profile,
|
||||
cfg);
|
||||
struct blk_crypto_profile *profile =
|
||||
bdev_get_queue(bdev)->crypto_profile;
|
||||
|
||||
if (!profile)
|
||||
return false;
|
||||
if (!(profile->modes_supported[cfg->crypto_mode] & cfg->data_unit_size))
|
||||
return false;
|
||||
if (profile->max_dun_bytes_supported < cfg->dun_bytes)
|
||||
return false;
|
||||
if (!(profile->key_types_supported & cfg->key_type))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user