vold: rename from "ext4 encryption" to fscrypt
We support file-based encryption on both ext4 and f2fs now, and the
kernel API is the same. So rename things appropriately in vold:
e4crypt => fscrypt
ext4enc => fscrypt
Ext4Crypt => FsCrypt
EXT4_* => FS_*
ext4_encryption_key => fscrypt_key
Additionally, the common functions shared by 'vold' and 'init' are now
in libfscrypt rather than ext4_utils. So update vold to link to
libfscrypt and include the renamed headers.
Note: there's a chance of 'fscrypt' being confused with the dm-crypt
based encryption code in vold which is called 'cryptfs'. However,
fscrypt is the name used in the kernel for ext4/f2fs/ubifs encryption,
and it's preferable to use the same name in userspace.
Test: built, booted device with f2fs encryption
Change-Id: I2a46a49f30d9c0b73d6f6fe09e4a4904d4138ff6
diff --git a/cryptfs.cpp b/cryptfs.cpp
index 4a76fb7..6e449ac 100644
--- a/cryptfs.cpp
+++ b/cryptfs.cpp
@@ -26,7 +26,7 @@
#include "Checkpoint.h"
#include "EncryptInplace.h"
-#include "Ext4Crypt.h"
+#include "FsCrypt.h"
#include "Keymaster.h"
#include "Process.h"
#include "ScryptParameters.h"
@@ -38,10 +38,10 @@
#include <bootloader_message/bootloader_message.h>
#include <cutils/android_reboot.h>
#include <cutils/properties.h>
-#include <ext4_utils/ext4_crypt.h>
#include <ext4_utils/ext4_utils.h>
#include <f2fs_sparseblock.h>
#include <fs_mgr.h>
+#include <fscrypt/fscrypt.h>
#include <hardware_legacy/power.h>
#include <log/log.h>
#include <logwrap/logwrap.h>
@@ -1606,7 +1606,7 @@
int cryptfs_restart(void) {
SLOGI("cryptfs_restart");
- if (e4crypt_is_native()) {
+ if (fscrypt_is_native()) {
SLOGE("cryptfs_restart not valid for file encryption:");
return -1;
}
@@ -1627,7 +1627,7 @@
}
// crypto_complete is full disk encrypted status
- if (e4crypt_is_native()) {
+ if (fscrypt_is_native()) {
return CRYPTO_COMPLETE_NOT_ENCRYPTED;
}
@@ -1823,7 +1823,7 @@
strlcpy((char*)ext_crypt_ftr.crypto_type_name, cryptfs_get_crypto_name(),
MAX_CRYPTO_TYPE_NAME_LEN);
uint32_t flags = 0;
- if (e4crypt_is_native() &&
+ if (fscrypt_is_native() &&
android::base::GetBoolProperty("ro.crypto.allow_encrypt_override", false))
flags |= CREATE_CRYPTO_BLK_DEV_FLAGS_ALLOW_ENCRYPT_OVERRIDE;
@@ -1862,7 +1862,7 @@
int cryptfs_check_passwd(const char* passwd) {
SLOGI("cryptfs_check_passwd");
- if (e4crypt_is_native()) {
+ if (fscrypt_is_native()) {
SLOGE("cryptfs_check_passwd not valid for file encryption");
return -1;
}
@@ -2407,7 +2407,7 @@
}
int cryptfs_changepw(int crypt_type, const char* newpw) {
- if (e4crypt_is_native()) {
+ if (fscrypt_is_native()) {
SLOGE("cryptfs_changepw not valid for file encryption");
return -1;
}
@@ -2602,7 +2602,7 @@
/* Return the value of the specified field. */
int cryptfs_getfield(const char* fieldname, char* value, int len) {
- if (e4crypt_is_native()) {
+ if (fscrypt_is_native()) {
SLOGE("Cannot get field when file encrypted");
return -1;
}
@@ -2667,7 +2667,7 @@
/* Set the value of the specified field. */
int cryptfs_setfield(const char* fieldname, const char* value) {
- if (e4crypt_is_native()) {
+ if (fscrypt_is_native()) {
SLOGE("Cannot set field when file encrypted");
return -1;
}
@@ -2787,7 +2787,7 @@
/* Returns type of the password, default, pattern, pin or password.
*/
int cryptfs_get_password_type(void) {
- if (e4crypt_is_native()) {
+ if (fscrypt_is_native()) {
SLOGE("cryptfs_get_password_type not valid for file encryption");
return -1;
}
@@ -2807,7 +2807,7 @@
}
const char* cryptfs_get_password() {
- if (e4crypt_is_native()) {
+ if (fscrypt_is_native()) {
SLOGE("cryptfs_get_password not valid for file encryption");
return 0;
}