Support aes-hctr2 mode.

The HCTR2 encryption was added to Linux kernel for fscrypt,
but as it is length-preserving mode (with sector tweak) it
can be easily used for disk encryption too.

As it need larger IV of size 32 bytes, we need to add exception
for aes-hctr2[-plain64] to be accepted in cryptsetup commands.

Fixes: #883
This commit is contained in:
Milan Broz
2024-05-09 14:09:36 +02:00
parent 1a6a611dff
commit d590c74a0e
2 changed files with 5 additions and 0 deletions

View File

@@ -62,6 +62,9 @@ int crypt_cipher_ivsize(const char *name, const char *mode)
if (!ca)
return -EINVAL;
if (mode && !strcasecmp(mode, "hctr2"))
return 32;
if (mode && !strcasecmp(mode, "ecb"))
return 0;