summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorDees_Troy <dees_troy@teamw.in>2013-08-24 14:42:03 +0200
committerGerrit Code Review <gerrit@198.50.184.117>2013-08-24 14:42:03 +0200
commit728630d9e445b47e50758c3daccc3b97b0307bd7 (patch)
tree722816ff9ba9b99d8b515433505f184c8cfbb706 /crypto
parentMerge "graphics: update BOARD_HAS_FLIPPED_SCREEN function to work with 16bpp or 32bpp" into twrp2.5 (diff)
parentFix AOSP decrypt when TouchWiz code is present (diff)
downloadandroid_bootable_recovery-728630d9e445b47e50758c3daccc3b97b0307bd7.tar
android_bootable_recovery-728630d9e445b47e50758c3daccc3b97b0307bd7.tar.gz
android_bootable_recovery-728630d9e445b47e50758c3daccc3b97b0307bd7.tar.bz2
android_bootable_recovery-728630d9e445b47e50758c3daccc3b97b0307bd7.tar.lz
android_bootable_recovery-728630d9e445b47e50758c3daccc3b97b0307bd7.tar.xz
android_bootable_recovery-728630d9e445b47e50758c3daccc3b97b0307bd7.tar.zst
android_bootable_recovery-728630d9e445b47e50758c3daccc3b97b0307bd7.zip
Diffstat (limited to 'crypto')
-rw-r--r--crypto/ics/cryptfs.c14
-rw-r--r--crypto/ics/cryptfs.h4
2 files changed, 11 insertions, 7 deletions
diff --git a/crypto/ics/cryptfs.c b/crypto/ics/cryptfs.c
index d994449c1..193339ec9 100644
--- a/crypto/ics/cryptfs.c
+++ b/crypto/ics/cryptfs.c
@@ -75,6 +75,7 @@ static int master_key_saved = 0;
static int using_samsung_encryption = 0;
//static edk_t saved_master_key;
static unsigned char saved_master_key[KEY_LEN_BYTES_SAMSUNG];
+edk_payload_t edk_payload;
#else
static unsigned char saved_master_key[KEY_LEN_BYTES];
#endif
@@ -187,8 +188,15 @@ static int get_crypt_ftr_and_key(char *real_blk_name, struct crypt_mnt_ftr *cryp
} else {
printf("Using Samsung encryption.\n");
using_samsung_encryption = 1;
- memcpy(key, &crypt_ftr->edk_payload, sizeof(edk_payload_t));
-
+ if ( (cnt = read(fd, &edk_payload, sizeof(edk_payload_t))) != sizeof(edk_payload_t)) {
+ printf("Cannot read EDK payload from real block device footer\n");
+ goto errout;
+ }
+ if (lseek64(fd, sizeof(__le32), SEEK_CUR) == -1) {
+ printf("Cannot seek past unknown data from real block device footer\n");
+ goto errout;
+ }
+ memcpy(key, &edk_payload, sizeof(edk_payload_t));
}
#else
printf("Bad magic for real block device %s\n", fname);
@@ -217,7 +225,7 @@ static int get_crypt_ftr_and_key(char *real_blk_name, struct crypt_mnt_ftr *cryp
}
}
- if (crypt_ftr->keysize != sizeof(saved_master_key)) {
+ if (crypt_ftr->keysize > sizeof(saved_master_key)) {
printf("Keysize of %d bits not supported for real block device %s\n",
crypt_ftr->keysize * 8, fname);
goto errout;
diff --git a/crypto/ics/cryptfs.h b/crypto/ics/cryptfs.h
index e2fb7a7f3..eee43b3bc 100644
--- a/crypto/ics/cryptfs.h
+++ b/crypto/ics/cryptfs.h
@@ -68,10 +68,6 @@ struct crypt_mnt_ftr {
char crypto_type_name[MAX_CRYPTO_TYPE_NAME_LEN]; /* The type of encryption
needed to decrypt this
partition, null terminated */
-#ifdef TW_INCLUDE_CRYPTO_SAMSUNG
- edk_payload_t edk_payload;
- __le32 unknown_end;
-#endif
};
#pragma pack()