@@ -1914,11 +1914,6 @@ static int sdhci_msm_ice_init(struct sdhci_msm_host *msm_host,
19141914 if (IS_ERR_OR_NULL (ice ))
19151915 return PTR_ERR_OR_ZERO (ice );
19161916
1917- if (qcom_ice_get_supported_key_type (ice ) != BLK_CRYPTO_KEY_TYPE_RAW ) {
1918- dev_warn (dev , "Wrapped keys not supported. Disabling inline encryption support.\n" );
1919- return 0 ;
1920- }
1921-
19221917 msm_host -> ice = ice ;
19231918
19241919 /* Initialize the blk_crypto_profile */
@@ -1932,7 +1927,7 @@ static int sdhci_msm_ice_init(struct sdhci_msm_host *msm_host,
19321927
19331928 profile -> ll_ops = sdhci_msm_crypto_ops ;
19341929 profile -> max_dun_bytes_supported = 4 ;
1935- profile -> key_types_supported = BLK_CRYPTO_KEY_TYPE_RAW ;
1930+ profile -> key_types_supported = qcom_ice_get_supported_key_type ( ice ) ;
19361931 profile -> dev = dev ;
19371932
19381933 /*
@@ -2013,9 +2008,49 @@ static int sdhci_msm_ice_keyslot_evict(struct blk_crypto_profile *profile,
20132008 return qcom_ice_evict_key (msm_host -> ice , slot );
20142009}
20152010
2011+ static int sdhci_msm_ice_derive_sw_secret (struct blk_crypto_profile * profile ,
2012+ const u8 * eph_key , size_t eph_key_size ,
2013+ u8 sw_secret [BLK_CRYPTO_SW_SECRET_SIZE ])
2014+ {
2015+ struct sdhci_msm_host * msm_host = sdhci_msm_host_from_crypto_profile (profile );
2016+
2017+ return qcom_ice_derive_sw_secret (msm_host -> ice , eph_key , eph_key_size ,
2018+ sw_secret );
2019+ }
2020+
2021+ static int sdhci_msm_ice_import_key (struct blk_crypto_profile * profile ,
2022+ const u8 * raw_key , size_t raw_key_size ,
2023+ u8 lt_key [BLK_CRYPTO_MAX_HW_WRAPPED_KEY_SIZE ])
2024+ {
2025+ struct sdhci_msm_host * msm_host = sdhci_msm_host_from_crypto_profile (profile );
2026+
2027+ return qcom_ice_import_key (msm_host -> ice , raw_key , raw_key_size , lt_key );
2028+ }
2029+
2030+ static int sdhci_msm_ice_generate_key (struct blk_crypto_profile * profile ,
2031+ u8 lt_key [BLK_CRYPTO_MAX_HW_WRAPPED_KEY_SIZE ])
2032+ {
2033+ struct sdhci_msm_host * msm_host = sdhci_msm_host_from_crypto_profile (profile );
2034+
2035+ return qcom_ice_generate_key (msm_host -> ice , lt_key );
2036+ }
2037+
2038+ static int sdhci_msm_ice_prepare_key (struct blk_crypto_profile * profile ,
2039+ const u8 * lt_key , size_t lt_key_size ,
2040+ u8 eph_key [BLK_CRYPTO_MAX_HW_WRAPPED_KEY_SIZE ])
2041+ {
2042+ struct sdhci_msm_host * msm_host = sdhci_msm_host_from_crypto_profile (profile );
2043+
2044+ return qcom_ice_prepare_key (msm_host -> ice , lt_key , lt_key_size , eph_key );
2045+ }
2046+
20162047static const struct blk_crypto_ll_ops sdhci_msm_crypto_ops = {
20172048 .keyslot_program = sdhci_msm_ice_keyslot_program ,
20182049 .keyslot_evict = sdhci_msm_ice_keyslot_evict ,
2050+ .derive_sw_secret = sdhci_msm_ice_derive_sw_secret ,
2051+ .import_key = sdhci_msm_ice_import_key ,
2052+ .generate_key = sdhci_msm_ice_generate_key ,
2053+ .prepare_key = sdhci_msm_ice_prepare_key ,
20192054};
20202055
20212056#else /* CONFIG_MMC_CRYPTO */
0 commit comments