kernel-fxtec-pro1x/block/blk-crypto-internal.h

68 lines
1.6 KiB
C
Raw Normal View History

File and metadata encryption changes from android-4.19.96-107 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: 1f876610fe ANDROID: dm: Add wrapped key support in dm-default-key b785dbcb87 ANDROID: dm: add support for passing through derive_raw_secret 66b3c81270 ANDROID: block: Prevent crypto fallback for wrapped keys 36500bffb9 fscrypt: support passing a keyring key to FS_IOC_ADD_ENCRYPTION_KEY b32863f17f ANDROID: dm: add dm-default-key target for metadata encryption 94706caf62 ANDROID: dm: enable may_passthrough_inline_crypto on some targets 44e1174c18 ANDROID: dm: add support for passing through inline crypto support e65d08ae68 ANDROID: block: Introduce passthrough keyslot manager 8f48f6657d ANDROID: ext4, f2fs: enable direct I/O with inline encryption bbee78199f FROMLIST: scsi: ufs: add program_key() variant op 0f1c72a2f5 ANDROID: block: export symbols needed for modules to use inline crypto 35b62551b9 ANDROID: block: fix some inline crypto bugs 23b81578bf ANDROID: fscrypt: add support for hardware-wrapped keys a076eebee0 ANDROID: block: add KSM op to derive software secret from wrapped key 3e8c41805f ANDROID: block: provide key size as input to inline crypto APIs bb7f6203fb ANDROID: ufshcd-crypto: export cap find API b01c73ea71 BACKPORT: 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>
2020-04-20 08:29:59 -06:00
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright 2019 Google LLC
*/
#ifndef __LINUX_BLK_CRYPTO_INTERNAL_H
#define __LINUX_BLK_CRYPTO_INTERNAL_H
#include <linux/bio.h>
/* Represents a crypto mode supported by blk-crypto */
struct blk_crypto_mode {
const char *cipher_str; /* crypto API name (for fallback case) */
unsigned int keysize; /* key size in bytes */
unsigned int ivsize; /* iv size in bytes */
};
extern const struct blk_crypto_mode blk_crypto_modes[];
#ifdef CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK
int blk_crypto_fallback_start_using_mode(enum blk_crypto_mode_num mode_num);
File and metadata encryption changes from android-4.19.96-107 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: 1f876610fe ANDROID: dm: Add wrapped key support in dm-default-key b785dbcb87 ANDROID: dm: add support for passing through derive_raw_secret 66b3c81270 ANDROID: block: Prevent crypto fallback for wrapped keys 36500bffb9 fscrypt: support passing a keyring key to FS_IOC_ADD_ENCRYPTION_KEY b32863f17f ANDROID: dm: add dm-default-key target for metadata encryption 94706caf62 ANDROID: dm: enable may_passthrough_inline_crypto on some targets 44e1174c18 ANDROID: dm: add support for passing through inline crypto support e65d08ae68 ANDROID: block: Introduce passthrough keyslot manager 8f48f6657d ANDROID: ext4, f2fs: enable direct I/O with inline encryption bbee78199f FROMLIST: scsi: ufs: add program_key() variant op 0f1c72a2f5 ANDROID: block: export symbols needed for modules to use inline crypto 35b62551b9 ANDROID: block: fix some inline crypto bugs 23b81578bf ANDROID: fscrypt: add support for hardware-wrapped keys a076eebee0 ANDROID: block: add KSM op to derive software secret from wrapped key 3e8c41805f ANDROID: block: provide key size as input to inline crypto APIs bb7f6203fb ANDROID: ufshcd-crypto: export cap find API b01c73ea71 BACKPORT: 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>
2020-04-20 08:29:59 -06:00
int blk_crypto_fallback_submit_bio(struct bio **bio_ptr);
bool blk_crypto_queue_decrypt_bio(struct bio *bio);
int blk_crypto_fallback_evict_key(const struct blk_crypto_key *key);
bool bio_crypt_fallback_crypted(const struct bio_crypt_ctx *bc);
#else /* CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK */
static inline int
blk_crypto_fallback_start_using_mode(enum blk_crypto_mode_num mode_num)
{
pr_warn_once("crypto API fallback is disabled\n");
return -ENOPKG;
}
File and metadata encryption changes from android-4.19.96-107 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: 1f876610fe ANDROID: dm: Add wrapped key support in dm-default-key b785dbcb87 ANDROID: dm: add support for passing through derive_raw_secret 66b3c81270 ANDROID: block: Prevent crypto fallback for wrapped keys 36500bffb9 fscrypt: support passing a keyring key to FS_IOC_ADD_ENCRYPTION_KEY b32863f17f ANDROID: dm: add dm-default-key target for metadata encryption 94706caf62 ANDROID: dm: enable may_passthrough_inline_crypto on some targets 44e1174c18 ANDROID: dm: add support for passing through inline crypto support e65d08ae68 ANDROID: block: Introduce passthrough keyslot manager 8f48f6657d ANDROID: ext4, f2fs: enable direct I/O with inline encryption bbee78199f FROMLIST: scsi: ufs: add program_key() variant op 0f1c72a2f5 ANDROID: block: export symbols needed for modules to use inline crypto 35b62551b9 ANDROID: block: fix some inline crypto bugs 23b81578bf ANDROID: fscrypt: add support for hardware-wrapped keys a076eebee0 ANDROID: block: add KSM op to derive software secret from wrapped key 3e8c41805f ANDROID: block: provide key size as input to inline crypto APIs bb7f6203fb ANDROID: ufshcd-crypto: export cap find API b01c73ea71 BACKPORT: 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>
2020-04-20 08:29:59 -06:00
static inline bool bio_crypt_fallback_crypted(const struct bio_crypt_ctx *bc)
{
return false;
}
static inline int blk_crypto_fallback_submit_bio(struct bio **bio_ptr)
{
pr_warn_once("crypto API fallback disabled; failing request\n");
(*bio_ptr)->bi_status = BLK_STS_NOTSUPP;
return -EIO;
}
static inline bool blk_crypto_queue_decrypt_bio(struct bio *bio)
{
WARN_ON(1);
return false;
}
static inline int
blk_crypto_fallback_evict_key(const struct blk_crypto_key *key)
{
return 0;
}
#endif /* CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK */
#endif /* __LINUX_BLK_CRYPTO_INTERNAL_H */