system/vold
Révision | 5830bf1db540f2cb5712a7f3db16a6d525b7ae9d (tree) |
---|---|
l'heure | 2017-10-21 20:57:46 |
Auteur | meijjaa <jjmeijer88@gmai...> |
Commiter | meijjaa |
Merge remote-tracking branch 'cm/cm-14.1' into cm-14.1-x86
@@ -2437,16 +2437,6 @@ int cryptfs_verify_passwd(char *passwd) | ||
2437 | 2437 | return -2; |
2438 | 2438 | } |
2439 | 2439 | |
2440 | - if (!master_key_saved) { | |
2441 | - SLOGE("encrypted fs not yet mounted, aborting"); | |
2442 | - return -1; | |
2443 | - } | |
2444 | - | |
2445 | - if (!saved_mount_point) { | |
2446 | - SLOGE("encrypted fs failed to save mount point, aborting"); | |
2447 | - return -1; | |
2448 | - } | |
2449 | - | |
2450 | 2440 | if (get_crypt_ftr_and_key(&crypt_ftr)) { |
2451 | 2441 | SLOGE("Error getting crypt footer and key\n"); |
2452 | 2442 | return -1; |
@@ -2463,6 +2453,17 @@ int cryptfs_verify_passwd(char *passwd) | ||
2463 | 2453 | else |
2464 | 2454 | rc = -1; |
2465 | 2455 | } else { |
2456 | +#endif | |
2457 | + if (!master_key_saved) { | |
2458 | + SLOGE("encrypted fs not yet mounted, aborting"); | |
2459 | + return -1; | |
2460 | + } | |
2461 | + | |
2462 | + if (!saved_mount_point) { | |
2463 | + SLOGE("encrypted fs failed to save mount point, aborting"); | |
2464 | + return -1; | |
2465 | + } | |
2466 | + | |
2466 | 2467 | decrypt_master_key(passwd, decrypted_master_key, &crypt_ftr, 0, 0); |
2467 | 2468 | if (!memcmp(decrypted_master_key, saved_master_key, crypt_ftr.keysize)) { |
2468 | 2469 | /* They match, the password is correct */ |
@@ -2472,16 +2473,7 @@ int cryptfs_verify_passwd(char *passwd) | ||
2472 | 2473 | sleep(1); |
2473 | 2474 | rc = 1; |
2474 | 2475 | } |
2475 | - } | |
2476 | -#else | |
2477 | - decrypt_master_key(passwd, decrypted_master_key, &crypt_ftr, 0, 0); | |
2478 | - if (!memcmp(decrypted_master_key, saved_master_key, crypt_ftr.keysize)) { | |
2479 | - /* They match, the password is correct */ | |
2480 | - rc = 0; | |
2481 | - } else { | |
2482 | - /* If incorrect, sleep for a bit to prevent dictionary attacks */ | |
2483 | - sleep(1); | |
2484 | - rc = 1; | |
2476 | +#ifdef CONFIG_HW_DISK_ENCRYPTION | |
2485 | 2477 | } |
2486 | 2478 | #endif |
2487 | 2479 | } |