Added required changes to fit properly android-4.19.79-95 crypto content into msm-4.19 branch. Modifications in abi_gki_aarch64.xml are discarded completely. The order of applying is bottom to top:1f876610feANDROID: dm: Add wrapped key support in dm-default-keyb785dbcb87ANDROID: dm: add support for passing through derive_raw_secret66b3c81270ANDROID: block: Prevent crypto fallback for wrapped keys36500bffb9fscrypt: support passing a keyring key to FS_IOC_ADD_ENCRYPTION_KEYb32863f17fANDROID: dm: add dm-default-key target for metadata encryption94706caf62ANDROID: dm: enable may_passthrough_inline_crypto on some targets44e1174c18ANDROID: dm: add support for passing through inline crypto supporte65d08ae68ANDROID: block: Introduce passthrough keyslot manager8f48f6657dANDROID: ext4, f2fs: enable direct I/O with inline encryptionbbee78199fFROMLIST: scsi: ufs: add program_key() variant op0f1c72a2f5ANDROID: block: export symbols needed for modules to use inline crypto35b62551b9ANDROID: block: fix some inline crypto bugs23b81578bfANDROID: fscrypt: add support for hardware-wrapped keysa076eebee0ANDROID: block: add KSM op to derive software secret from wrapped key3e8c41805fANDROID: block: provide key size as input to inline crypto APIsbb7f6203fbANDROID: ufshcd-crypto: export cap find APIb01c73ea71BACKPORT: FROMLIST: Update Inline Encryption from v5 to v6 of patch series Change-Id: Ic741913aa478500da94a52eace02bb9192e581b9 Git-repo: https://android.googlesource.com/kernel/common/+/refs/heads/android-4.19 Signed-off-by: Blagovest Kolenichev <bkolenichev@codeaurora.org> Signed-off-by: Neeraj Soni <neersoni@codeaurora.org>
85 lines
2.9 KiB
C
85 lines
2.9 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* Copyright 2019 Google LLC
|
|
*/
|
|
|
|
#ifndef __LINUX_KEYSLOT_MANAGER_H
|
|
#define __LINUX_KEYSLOT_MANAGER_H
|
|
|
|
#include <linux/bio.h>
|
|
|
|
#ifdef CONFIG_BLK_INLINE_ENCRYPTION
|
|
|
|
struct keyslot_manager;
|
|
|
|
/**
|
|
* struct keyslot_mgmt_ll_ops - functions to manage keyslots in hardware
|
|
* @keyslot_program: Program the specified key into the specified slot in the
|
|
* inline encryption hardware.
|
|
* @keyslot_evict: Evict key from the specified keyslot in the hardware.
|
|
* The key is provided so that e.g. dm layers can evict
|
|
* keys from the devices that they map over.
|
|
* Returns 0 on success, -errno otherwise.
|
|
* @derive_raw_secret: (Optional) Derive a software secret from a
|
|
* hardware-wrapped key. Returns 0 on success, -EOPNOTSUPP
|
|
* if unsupported on the hardware, or another -errno code.
|
|
*
|
|
* This structure should be provided by storage device drivers when they set up
|
|
* a keyslot manager - this structure holds the function ptrs that the keyslot
|
|
* manager will use to manipulate keyslots in the hardware.
|
|
*/
|
|
struct keyslot_mgmt_ll_ops {
|
|
int (*keyslot_program)(struct keyslot_manager *ksm,
|
|
const struct blk_crypto_key *key,
|
|
unsigned int slot);
|
|
int (*keyslot_evict)(struct keyslot_manager *ksm,
|
|
const struct blk_crypto_key *key,
|
|
unsigned int slot);
|
|
int (*derive_raw_secret)(struct keyslot_manager *ksm,
|
|
const u8 *wrapped_key,
|
|
unsigned int wrapped_key_size,
|
|
u8 *secret, unsigned int secret_size);
|
|
};
|
|
|
|
struct keyslot_manager *keyslot_manager_create(unsigned int num_slots,
|
|
const struct keyslot_mgmt_ll_ops *ksm_ops,
|
|
const unsigned int crypto_mode_supported[BLK_ENCRYPTION_MODE_MAX],
|
|
void *ll_priv_data);
|
|
|
|
int keyslot_manager_get_slot_for_key(struct keyslot_manager *ksm,
|
|
const struct blk_crypto_key *key);
|
|
|
|
void keyslot_manager_get_slot(struct keyslot_manager *ksm, unsigned int slot);
|
|
|
|
void keyslot_manager_put_slot(struct keyslot_manager *ksm, unsigned int slot);
|
|
|
|
bool keyslot_manager_crypto_mode_supported(struct keyslot_manager *ksm,
|
|
enum blk_crypto_mode_num crypto_mode,
|
|
unsigned int data_unit_size);
|
|
|
|
int keyslot_manager_evict_key(struct keyslot_manager *ksm,
|
|
const struct blk_crypto_key *key);
|
|
|
|
void keyslot_manager_reprogram_all_keys(struct keyslot_manager *ksm);
|
|
|
|
void *keyslot_manager_private(struct keyslot_manager *ksm);
|
|
|
|
void keyslot_manager_destroy(struct keyslot_manager *ksm);
|
|
|
|
struct keyslot_manager *keyslot_manager_create_passthrough(
|
|
const struct keyslot_mgmt_ll_ops *ksm_ops,
|
|
const unsigned int crypto_mode_supported[BLK_ENCRYPTION_MODE_MAX],
|
|
void *ll_priv_data);
|
|
|
|
void keyslot_manager_intersect_modes(struct keyslot_manager *parent,
|
|
const struct keyslot_manager *child);
|
|
|
|
int keyslot_manager_derive_raw_secret(struct keyslot_manager *ksm,
|
|
const u8 *wrapped_key,
|
|
unsigned int wrapped_key_size,
|
|
u8 *secret, unsigned int secret_size);
|
|
|
|
#endif /* CONFIG_BLK_INLINE_ENCRYPTION */
|
|
|
|
#endif /* __LINUX_KEYSLOT_MANAGER_H */
|