DivestOS/Patches/LineageOS-15.1/android_system_vold/0001-AES256.patch

60 lines
1.4 KiB
Diff
Raw Normal View History

2018-02-12 07:10:10 -05:00
From f97f345e14ab731b87c1f8330718db90d49061e7 Mon Sep 17 00:00:00 2001
2018-02-12 03:43:26 -05:00
From: Tad <tad@spotco.us>
2018-02-12 07:10:10 -05:00
Date: Mon, 12 Feb 2018 06:12:29 -0500
2018-02-12 03:43:26 -05:00
Subject: [PATCH] Build time variable for AES-256 encryption
2018-02-12 07:10:10 -05:00
Change-Id: I14efcfddabb6bd889b90cff59f26ca47c9883eb0
2018-02-12 03:43:26 -05:00
---
2018-02-12 07:10:10 -05:00
Android.mk | 4 ++++
cryptfs.cpp | 9 ++++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
2018-02-12 03:43:26 -05:00
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
2018-02-12 07:10:10 -05:00
index f01929a..7fb3ffa 100644
2018-02-12 03:43:26 -05:00
--- 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"
2018-02-12 07:10:10 -05:00
@@ -93,7 +101,6 @@ extern "C" {
2018-02-12 03:43:26 -05:00
#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