Skip to content

Commit 4eb729d

Browse files
committed
bitlk: Do not try to use empty password for password keyslots
Passing empty password means we want to try to open the device using the clear key so we can skip all other keyslots in this case. This also fixes unlocking a BitLocker device where recovery passphrase is in the first keyslot where we try to use the empty passhrase first, hoping for a clear key, and never actually prompt user for an actual (recovery) passphrase after. Fixes: #973
1 parent 3886646 commit 4eb729d

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

lib/bitlk/bitlk.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,6 +1300,17 @@ int BITLK_get_volume_key(struct crypt_device *cd,
13001300
next_vmk = params->vmks;
13011301
while (next_vmk) {
13021302
bool is_decrypted = false;
1303+
1304+
if (password == NULL && next_vmk->protection != BITLK_PROTECTION_CLEAR_KEY) {
1305+
/*
1306+
* Clearkey is the only slot that doesn't require password so no password
1307+
* means we are trying to use clearkey and we can skip all other key slots.
1308+
*/
1309+
r = -EPERM;
1310+
next_vmk = next_vmk->next;
1311+
continue;
1312+
}
1313+
13031314
if (next_vmk->protection == BITLK_PROTECTION_PASSPHRASE) {
13041315
r = bitlk_kdf(password, passwordLen, false, next_vmk->salt, &vmk_dec_key);
13051316
if (r) {

tests/bitlk-images.tar.xz

20.6 KB
Binary file not shown.

0 commit comments

Comments
 (0)