tcrypt: use hash values as substring if limiting KDF check.

This allows to specify --hash sha or --hash blake2 to limit
KDF without need to specify full algorithm name
(similar to cipher where we already use substring match).
This commit is contained in:
Milan Broz
2023-06-06 12:24:33 +02:00
parent 53aa5f6c4f
commit 33a3d1ba7b

View File

@@ -572,7 +572,7 @@ static int TCRYPT_init_hdr(struct crypt_device *cd,
pwd[i] += params->passphrase[i];
for (i = 0; tcrypt_kdf[i].name; i++) {
if (params->hash_name && strcmp(params->hash_name, tcrypt_kdf[i].hash))
if (params->hash_name && !strstr(tcrypt_kdf[i].hash, params->hash_name))
continue;
if (!(params->flags & CRYPT_TCRYPT_LEGACY_MODES) && tcrypt_kdf[i].legacy)
continue;