OSDN Git Service

ext4 crypt: enable ICE with FBE encryption
authorAndrey Markovytch <andreym@codeaurora.org>
Wed, 19 Oct 2016 12:22:28 +0000 (15:22 +0300)
committerAndrey Markovytch <andreym@codeaurora.org>
Wed, 19 Oct 2016 12:22:28 +0000 (15:22 +0300)
updated encryption policy for HW support with FBE

Change-Id: Ib1d3ec57240045db5dc42cf8afea11af313ba8f1

ext4_utils/ext4_crypt.cpp

index be77b79..3a7280c 100644 (file)
@@ -48,6 +48,7 @@ struct ext4_encryption_policy {
 
 #define EXT4_ENCRYPTION_MODE_AES_256_XTS    1
 #define EXT4_ENCRYPTION_MODE_AES_256_CTS    4
+#define EXT4_ENCRYPTION_MODE_PRIVATE      127
 
 // ext4enc:TODO Get value from somewhere sensible
 #define EXT4_IOC_SET_ENCRYPTION_POLICY _IOR('f', 19, struct ext4_encryption_policy)
@@ -112,7 +113,7 @@ static bool e4crypt_policy_set(const char *directory, const char *policy, size_t
 
     ext4_encryption_policy eep;
     eep.version = 0;
-    eep.contents_encryption_mode = EXT4_ENCRYPTION_MODE_AES_256_XTS;
+    eep.contents_encryption_mode = EXT4_ENCRYPTION_MODE_PRIVATE;
     eep.filenames_encryption_mode = EXT4_ENCRYPTION_MODE_AES_256_CTS;
     eep.flags = 0;
     memcpy(eep.master_key_descriptor, policy, EXT4_KEY_DESCRIPTOR_SIZE);
@@ -151,7 +152,7 @@ static bool e4crypt_policy_get(const char *directory, char *policy, size_t polic
     close(fd);
 
     if ((eep.version != 0)
-            || (eep.contents_encryption_mode != EXT4_ENCRYPTION_MODE_AES_256_XTS)
+            || (eep.contents_encryption_mode != EXT4_ENCRYPTION_MODE_PRIVATE)
             || (eep.filenames_encryption_mode != EXT4_ENCRYPTION_MODE_AES_256_CTS)
             || (eep.flags != 0)) {
         LOG(ERROR) << "Failed to find matching encryption policy for " << directory;