mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-05 16:00:05 +01:00
Fix Veracrypt compatible support for longer passphrases.
Previous fix for longer passhphrases increased maximal passphrase length even if it was not needed, for example if used with SHA256 hash in combination with keyfiles. This patch tries to fix the problem, so some older volumes can be opened again. Also some test images are added for regression testing. Fixes: #542.
This commit is contained in:
@@ -535,13 +535,11 @@ static int TCRYPT_init_hdr(struct crypt_device *cd,
|
||||
if (posix_memalign((void*)&key, crypt_getpagesize(), TCRYPT_HDR_KEY_LEN))
|
||||
return -ENOMEM;
|
||||
|
||||
if (params->flags & CRYPT_TCRYPT_VERA_MODES) {
|
||||
max_passphrase_size = VCRYPT_KEY_POOL_LEN;
|
||||
if (params->flags & CRYPT_TCRYPT_VERA_MODES &&
|
||||
params->passphrase_size > TCRYPT_KEY_POOL_LEN) {
|
||||
/* Really. Keyfile pool length depends on passphrase size in Veracrypt. */
|
||||
if (params->passphrase_size > TCRYPT_KEY_POOL_LEN)
|
||||
max_passphrase_size = VCRYPT_KEY_POOL_LEN;
|
||||
keyfiles_pool_length = VCRYPT_KEY_POOL_LEN;
|
||||
else
|
||||
keyfiles_pool_length = TCRYPT_KEY_POOL_LEN;
|
||||
} else {
|
||||
max_passphrase_size = TCRYPT_KEY_POOL_LEN;
|
||||
keyfiles_pool_length = TCRYPT_KEY_POOL_LEN;
|
||||
|
||||
@@ -8,6 +8,7 @@ TST_DIR=tcrypt-images
|
||||
MAP=tctst
|
||||
PASSWORD="aaaaaaaaaaaa"
|
||||
PASSWORD_HIDDEN="bbbbbbbbbbbb"
|
||||
PASSWORD_72C="aaaaaaaaaaaabbbbbbbbbbbbccccccccccccddddddddddddeeeeeeeeeeeeffffffffffff"
|
||||
PIM=1234
|
||||
|
||||
[ -z "$srcdir" ] && srcdir="."
|
||||
@@ -123,7 +124,10 @@ done
|
||||
echo "HEADER KEYFILES CHECK"
|
||||
for file in $(ls $TST_DIR/[tv]ck_*) ; do
|
||||
echo -n " $file"
|
||||
echo $PASSWORD | $CRYPTSETUP tcryptDump --veracrypt -d $TST_DIR/keyfile1 -d $TST_DIR/keyfile2 $file >/dev/null || fail
|
||||
PWD=$PASSWORD
|
||||
[[ $file =~ vck_1_nopw.* ]] && PWD=""
|
||||
[[ $file =~ vck_1_pw72.* ]] && PWD=$PASSWORD_72C
|
||||
echo $PWD | $CRYPTSETUP tcryptDump --veracrypt -d $TST_DIR/keyfile1 -d $TST_DIR/keyfile2 $file >/dev/null || fail
|
||||
echo " [OK]"
|
||||
done
|
||||
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user