From eefd2e900634975517c441b7bec8ce50b8a34c68 Mon Sep 17 00:00:00 2001 From: Greg Kaiser Date: Mon, 3 Dec 2018 12:30:42 -0800 Subject: [PATCH] fs_mgr_fstab: Add Adiantum support Adiantum is a crypto method Android is supporting for devices which don't have AES CPU instructions. See the paper "Adiantum: length-preserving encryption for entry-level processors" (https://eprint.iacr.org/2018/720.pdf) for more details. We add Adiantum to our list of supported encryption modes. Bug: 112010205 Test: Tested on a device Change-Id: I14a400164803a1e217d378ad9bd8b67a61b8b7d0 --- fs_mgr/fs_mgr_fstab.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs_mgr/fs_mgr_fstab.cpp b/fs_mgr/fs_mgr_fstab.cpp index 0fde22e2c..f00983af4 100644 --- a/fs_mgr/fs_mgr_fstab.cpp +++ b/fs_mgr/fs_mgr_fstab.cpp @@ -120,9 +120,11 @@ static struct flag_list fs_mgr_flags[] = { #define EM_ICE 2 #define EM_AES_256_CTS 3 #define EM_AES_256_HEH 4 +#define EM_ADIANTUM 5 static const struct flag_list file_contents_encryption_modes[] = { {"aes-256-xts", EM_AES_256_XTS}, + {"adiantum", EM_ADIANTUM}, {"software", EM_AES_256_XTS}, /* alias for backwards compatibility */ {"ice", EM_ICE}, /* hardware-specific inline cryptographic engine */ {0, 0}, @@ -131,6 +133,7 @@ static const struct flag_list file_contents_encryption_modes[] = { static const struct flag_list file_names_encryption_modes[] = { {"aes-256-cts", EM_AES_256_CTS}, {"aes-256-heh", EM_AES_256_HEH}, + {"adiantum", EM_ADIANTUM}, {0, 0}, }; @@ -271,6 +274,8 @@ static int parse_flags(char *flags, struct flag_list *fl, flag_vals->file_names_mode = encryption_mode_to_flag(file_names_encryption_modes, colon + 1, "file names"); + } else if (flag_vals->file_contents_mode == EM_ADIANTUM) { + flag_vals->file_names_mode = EM_ADIANTUM; } else { flag_vals->file_names_mode = EM_AES_256_CTS; }