From f97f345e14ab731b87c1f8330718db90d49061e7 Mon Sep 17 00:00:00 2001 From: Tad Date: Mon, 12 Feb 2018 06:12:29 -0500 Subject: [PATCH] Build time variable for AES-256 encryption Change-Id: I14efcfddabb6bd889b90cff59f26ca47c9883eb0 --- Android.mk | 4 ++++ cryptfs.cpp | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Android.mk b/Android.mk index 29a7852..2962180 100644 --- a/Android.mk +++ b/Android.mk @@ -114,6 +114,10 @@ ifeq ($(TARGET_HW_DISK_ENCRYPTION),true) vold_cflags += -DCONFIG_HW_DISK_ENCRYPTION endif +ifeq ($(TARGET_WANTS_STRONG_ENCRYPTION),true) +LOCAL_CFLAGS += -DCONFIG_STRONG_ENCRYPTION +endif + ifeq ($(TARGET_KERNEL_HAVE_EXFAT),true) vold_cflags += -DCONFIG_KERNEL_HAVE_EXFAT endif diff --git a/cryptfs.cpp b/cryptfs.cpp index f01929a..7fb3ffa 100644 --- a/cryptfs.cpp +++ b/cryptfs.cpp @@ -75,9 +75,17 @@ extern "C" { #define DM_CRYPT_BUF_SIZE 4096 +#ifdef CONFIG_STRONG_ENCRYPTION +#define HASH_COUNT 6000 +#define KEY_LEN_BYTES 32 +#define IV_LEN_BYTES 32 +#define RSA_KEY_SIZE 4096 +#else #define HASH_COUNT 2000 #define KEY_LEN_BYTES 16 #define IV_LEN_BYTES 16 +#define RSA_KEY_SIZE 2048 +#endif #define KEY_IN_FOOTER "footer" @@ -93,7 +101,6 @@ extern "C" { #define TABLE_LOAD_RETRIES 10 -#define RSA_KEY_SIZE 2048 #define RSA_KEY_SIZE_BYTES (RSA_KEY_SIZE / 8) #define RSA_EXPONENT 0x10001 #define KEYMASTER_CRYPTFS_RATE_LIMIT 1 // Maximum one try per second -- 2.16.1