Merge AOSP android-9.0.0_r3
Fix conflicts and make it build in 5.1, 6.0, 7.1, 8.1, and 9.0
Change-Id: Ida0a64c29ff27d339b7f42a18d820930964ac6e4
diff --git a/crypto/lollipop/Android.mk b/crypto/lollipop/Android.mk
index 6dc386a..1be4121 100644
--- a/crypto/lollipop/Android.mk
+++ b/crypto/lollipop/Android.mk
@@ -24,6 +24,8 @@
LOCAL_C_INCLUDES += external/boringssl/src/include
endif
+LOCAL_CFLAGS += -Wno-unused-function
+
LOCAL_WHOLE_STATIC_LIBRARIES += libscrypttwrp_static
include $(BUILD_SHARED_LIBRARY)
diff --git a/crypto/lollipop/cryptfs.c b/crypto/lollipop/cryptfs.c
index 80f433b..d3bf629 100644
--- a/crypto/lollipop/cryptfs.c
+++ b/crypto/lollipop/cryptfs.c
@@ -89,10 +89,7 @@
char *me = "cryptfs";
-static unsigned char saved_master_key[KEY_LEN_BYTES];
-static char *saved_mount_point;
static int master_key_saved = 0;
-static struct crypt_persist_data *persist_data = NULL;
static char key_fname[PROPERTY_VALUE_MAX] = "";
static char real_blkdev[PROPERTY_VALUE_MAX] = "";
static char file_system[PROPERTY_VALUE_MAX] = "";
@@ -629,24 +626,6 @@
}
#endif //#ifndef TW_CRYPTO_HAVE_KEYMASTERX
-/* Store password when userdata is successfully decrypted and mounted.
- * Cleared by cryptfs_clear_password
- *
- * To avoid a double prompt at boot, we need to store the CryptKeeper
- * password and pass it to KeyGuard, which uses it to unlock KeyStore.
- * Since the entire framework is torn down and rebuilt after encryption,
- * we have to use a daemon or similar to store the password. Since vold
- * is secured against IPC except from system processes, it seems a reasonable
- * place to store this.
- *
- * password should be cleared once it has been used.
- *
- * password is aged out after password_max_age_seconds seconds.
- */
-static char* password = 0;
-static int password_expiry_time = 0;
-static const int password_max_age_seconds = 60;
-
static void ioctl_init(struct dm_ioctl *io, size_t dataSize, const char *name, unsigned flags)
{
memset(io, 0, dataSize);
@@ -774,7 +753,7 @@
static int get_crypt_ftr_and_key(struct crypt_mnt_ftr *crypt_ftr)
{
int fd;
- unsigned int nr_sec, cnt;
+ unsigned int cnt;
off64_t starting_off;
int rc = -1;
char *fname = NULL;
@@ -979,8 +958,6 @@
char buffer[DM_CRYPT_BUF_SIZE];
struct dm_ioctl *io;
struct dm_target_versions *v;
- int flag;
- int i;
io = (struct dm_ioctl *) buffer;
@@ -996,6 +973,7 @@
v = (struct dm_target_versions *) &buffer[sizeof(struct dm_ioctl)];
while (v->next) {
#ifdef CONFIG_HW_DISK_ENCRYPTION
+ int flag;
if (is_hw_fde_enabled()) {
flag = (!strcmp(v->name, "crypt") || !strcmp(v->name, "req-crypt"));
} else {
@@ -1022,13 +1000,9 @@
const char *real_blk_name, char *crypto_blk_name, const char *name)
{
char buffer[DM_CRYPT_BUF_SIZE];
- char master_key_ascii[129]; /* Large enough to hold 512 bit key and null */
- char *crypt_params;
struct dm_ioctl *io;
- struct dm_target_spec *tgt;
unsigned int minor;
int fd=0;
- int i;
int retval = -1;
int version[3];
char *extra_params;
@@ -1223,7 +1197,7 @@
unsigned char* master_key = convert_hex_ascii_to_key(passwd, &key_size);
if (!master_key) {
printf("Failed to convert passwd from hex, using passwd instead\n");
- master_key = strdup(passwd);
+ master_key = (unsigned char*)strdup(passwd);
}
rc = crypto_scrypt(master_key, key_size, salt, SALT_LEN,
@@ -1365,10 +1339,6 @@
char crypto_blkdev[MAXPATHLEN];
char tmp_mount_point[64];
int rc = 0;
- kdf_func kdf;
- void *kdf_params;
- int use_keymaster = 0;
- int upgrade = 0;
unsigned char* intermediate_key = 0;
size_t intermediate_key_size = 0;