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

69 lines
1.7 KiB
Diff
Raw Normal View History

2018-04-28 19:25:42 +00:00
From 2865dba2a7b981a275b183c1c47079cc88044e15 Mon Sep 17 00:00:00 2001
2018-02-12 08:43:26 +00:00
From: Tad <tad@spotco.us>
2018-04-28 19:25:42 +00:00
Date: Sat, 28 Apr 2018 13:45:42 -0400
Subject: [PATCH] Build time variable for AES 192/256 encryption
2018-02-12 08:43:26 +00:00
2018-04-28 19:25:42 +00:00
Change-Id: I194deffbabbfb3dadd3d1af90924b99e7fd54552
2018-02-12 08:43:26 +00:00
---
2018-04-28 19:25:42 +00:00
Android.mk | 8 ++++++++
cryptfs.cpp | 14 +++++++++++++-
2 files changed, 21 insertions(+), 1 deletion(-)
2018-02-12 08:43:26 +00:00
diff --git a/Android.mk b/Android.mk
2018-04-28 19:25:42 +00:00
index 2beae28..4f310c1 100644
2018-02-12 08:43:26 +00:00
--- a/Android.mk
+++ b/Android.mk
2018-04-28 19:25:42 +00:00
@@ -115,6 +115,14 @@ ifeq ($(TARGET_HW_DISK_ENCRYPTION),true)
2018-02-12 08:43:26 +00:00
vold_cflags += -DCONFIG_HW_DISK_ENCRYPTION
endif
2018-04-28 19:25:42 +00:00
+ifeq ($(TARGET_WANTS_AES192_ENCRYPTION),true)
+LOCAL_CFLAGS += -DCONFIG_AES192_ENCRYPTION
+endif
+
+ifeq ($(TARGET_WANTS_AES256_ENCRYPTION),true)
+LOCAL_CFLAGS += -DCONFIG_AES256_ENCRYPTION
2018-02-12 08:43:26 +00:00
+endif
+
2018-02-28 13:22:35 +00:00
ifneq ($(TARGET_EXFAT_DRIVER),)
vold_cflags += -DCONFIG_EXFAT_DRIVER=\"$(TARGET_EXFAT_DRIVER)\"
mini_src_files += fs/Exfat.cpp
2018-02-12 08:43:26 +00:00
diff --git a/cryptfs.cpp b/cryptfs.cpp
2018-04-28 19:25:42 +00:00
index f01929a..af65601 100644
2018-02-12 08:43:26 +00:00
--- a/cryptfs.cpp
+++ b/cryptfs.cpp
2018-04-28 19:25:42 +00:00
@@ -75,9 +75,22 @@ extern "C" {
2018-02-12 08:43:26 +00:00
#define DM_CRYPT_BUF_SIZE 4096
2018-04-28 19:25:42 +00:00
+#ifdef CONFIG_AES256_ENCRYPTION
2018-02-12 08:43:26 +00:00
+#define HASH_COUNT 6000
+#define KEY_LEN_BYTES 32
+#define IV_LEN_BYTES 32
+#define RSA_KEY_SIZE 4096
2018-04-28 19:25:42 +00:00
+#else ifdef CONFIG_AES192_ENCRYPTION
+#define HASH_COUNT 6000
+#define KEY_LEN_BYTES 24
+#define IV_LEN_BYTES 24
+#define RSA_KEY_SIZE 4096
2018-02-12 08:43:26 +00:00
+#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-04-28 19:25:42 +00:00
@@ -93,7 +106,6 @@ extern "C" {
2018-02-12 08:43:26 +00: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
--
2018-04-28 19:25:42 +00:00
2.17.0
2018-02-12 08:43:26 +00:00