On 6/17/24 02:51, Gaurav Kashyap wrote:
Block crypto allows storage controllers like UFS to
register an op derive a software secret from wrapped
keys added to the kernel.
Wrapped keys in most cases will have vendor specific
implementations, which means this op would need to have
a corresponding UFS variant op.
This change adds hooks in UFS core to support this variant
ops and tie them to the blk crypto op.
Tested-by: Neil Armstrong <neil.armstrong@xxxxxxxxxx>
Reviewed-by: Om Prakash Singh <quic_omprsing@xxxxxxxxxxx>
Signed-off-by: Gaurav Kashyap <quic_gaurkash@xxxxxxxxxxx>
---
drivers/ufs/core/ufshcd-crypto.c | 15 +++++++++++++++
include/ufs/ufshcd.h | 4 ++++
2 files changed, 19 insertions(+)
diff --git a/drivers/ufs/core/ufshcd-crypto.c b/drivers/ufs/core/ufshcd-crypto.c
index 399b55d67b3b..c14800eac1ff 100644
--- a/drivers/ufs/core/ufshcd-crypto.c
+++ b/drivers/ufs/core/ufshcd-crypto.c
@@ -119,6 +119,20 @@ static int ufshcd_crypto_keyslot_evict(struct blk_crypto_profile *profile,
return ufshcd_clear_keyslot(hba, slot);
}
+static int ufshcd_crypto_derive_sw_secret(struct blk_crypto_profile *profile,
+ const u8 wkey[], size_t wkey_size,
+ u8 sw_secret[BLK_CRYPTO_SW_SECRET_SIZE])
+{
+ struct ufs_hba *hba =
+ container_of(profile, struct ufs_hba, crypto_profile);
+
+ if (hba->vops && hba->vops->derive_sw_secret)
+ return hba->vops->derive_sw_secret(hba, wkey, wkey_size,
Double space
Konrad