| 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | /* |
| 3 | * Copyright (c) 2023, Linaro Limited |
| 4 | */ |
| 5 | |
| 6 | #ifndef __QCOM_ICE_H__ |
| 7 | #define __QCOM_ICE_H__ |
| 8 | |
| 9 | #include <linux/blk-crypto.h> |
| 10 | #include <linux/types.h> |
| 11 | |
| 12 | struct qcom_ice; |
| 13 | |
| 14 | int qcom_ice_enable(struct qcom_ice *ice); |
| 15 | int qcom_ice_resume(struct qcom_ice *ice); |
| 16 | int qcom_ice_suspend(struct qcom_ice *ice); |
| 17 | int qcom_ice_program_key(struct qcom_ice *ice, unsigned int slot, |
| 18 | const struct blk_crypto_key *blk_key); |
| 19 | int qcom_ice_evict_key(struct qcom_ice *ice, int slot); |
| 20 | enum blk_crypto_key_type qcom_ice_get_supported_key_type(struct qcom_ice *ice); |
| 21 | int qcom_ice_derive_sw_secret(struct qcom_ice *ice, |
| 22 | const u8 *eph_key, size_t eph_key_size, |
| 23 | u8 sw_secret[BLK_CRYPTO_SW_SECRET_SIZE]); |
| 24 | int qcom_ice_generate_key(struct qcom_ice *ice, |
| 25 | u8 lt_key[BLK_CRYPTO_MAX_HW_WRAPPED_KEY_SIZE]); |
| 26 | int qcom_ice_prepare_key(struct qcom_ice *ice, |
| 27 | const u8 *lt_key, size_t lt_key_size, |
| 28 | u8 eph_key[BLK_CRYPTO_MAX_HW_WRAPPED_KEY_SIZE]); |
| 29 | int qcom_ice_import_key(struct qcom_ice *ice, |
| 30 | const u8 *raw_key, size_t raw_key_size, |
| 31 | u8 lt_key[BLK_CRYPTO_MAX_HW_WRAPPED_KEY_SIZE]); |
| 32 | struct qcom_ice *devm_of_qcom_ice_get(struct device *dev); |
| 33 | |
| 34 | #endif /* __QCOM_ICE_H__ */ |
| 35 | |