Skip to content

Commit 1d673f7

Browse files
onikombroz
authored andcommitted
Do not memlock test_key in LUKS2_check_cipher.
It's the test key only used to verify if the cipher can be properly initialized with provided key size parameter. Also do not force erase of test buffer, it contains encrypted zeroes.
1 parent ae7ca35 commit 1d673f7

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

lib/luks2/luks2_luks1_convert.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ int LUKS2_check_cipher(struct crypt_device *cd,
2323

2424
log_dbg(cd, "Checking if cipher %s-%s is usable (storage wrapper).", cipher, cipher_mode);
2525

26-
empty_key = crypt_safe_alloc(keylength);
26+
empty_key = malloc(keylength);
2727
if (!empty_key)
2828
return -ENOMEM;
2929

@@ -40,8 +40,7 @@ int LUKS2_check_cipher(struct crypt_device *cd,
4040
r = crypt_storage_decrypt(s, 0, sizeof(buf), buf);
4141
crypt_storage_destroy(s);
4242
out:
43-
crypt_safe_free(empty_key);
44-
crypt_safe_memzero(buf, sizeof(buf));
43+
free(empty_key);
4544
return r;
4645
}
4746

0 commit comments

Comments
 (0)