android_kernel_xiaomi_sm8350/include/linux/pfk.h
Victor Zaharchuk 5e5e43c136 msm: ice: Add support for ICE-FDE full disk encryption
Porting the FDE functionality from msm-4.14 branch commit
<b8f1b6a6> (Add support for block disk encryption).
Modified to be compatible with the 5.4 Kernel.

Test:
1. Basic_SimpleEncryption.
2. ModifyEnforcedFiles_FileCreationWithinEnforcedFolder.
3. PIN, pattern, password.
4. Verified filename encryption.
5. Generate/set ICE keys.
6. Enable ICE state for userdata partition.
7. Format the userdata partition.
8. Check if partition is encrypted via ICE.

Change-Id: I307d75b7cdf25f7a9ad2b4f948e64d13278e6f03
Signed-off-by: Neeraj Soni <neersoni@codeaurora.org>
Signed-off-by: Victor Zaharchuk <vzaharch@codeaurora.org>
2021-03-10 16:08:21 +02:00

39 lines
901 B
C

/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
*/
#ifndef PFK_H_
#define PFK_H_
#include <linux/bio.h>
#ifdef CONFIG_PFK
/*
* Default key for inline encryption.
*
* For now only AES-256-XTS is supported, so this is a fixed length. But if
* ever needed, this should be made variable-length with a 'mode' and 'size'.
* (Remember to update pfk_allow_merge_bio() when doing so!)
*/
#define BLK_ENCRYPTION_KEY_SIZE_AES_256_XTS 64
struct blk_encryption_key {
u8 raw[BLK_ENCRYPTION_KEY_SIZE_AES_256_XTS];
};
int pfk_fbe_clear_key(const unsigned char *key, size_t key_size,
const unsigned char *salt, size_t salt_size);
#else
static inline int pfk_fbe_clear_key(const unsigned char *key, size_t key_size,
const unsigned char *salt, size_t salt_size)
{
return -ENODEV;
}
#endif /* CONFIG_PFK */
#endif /* PFK_H */