0

I created luks2 device with default options which used aes-xts with 512b key size.I figured out that 256b is somewhat faster than 512b from benchmarks. So, I just want to use 256b but not sure if it's possible or not using cryptsetup command.

benchmarks

#     Algorithm |       Key |      Encryption |      Decryption
        aes-cbc        128b       840.9 MiB/s      2431.5 MiB/s
    serpent-cbc        128b        69.9 MiB/s       407.6 MiB/s
    twofish-cbc        128b       173.5 MiB/s       222.9 MiB/s
        aes-cbc        256b       569.1 MiB/s      1810.9 MiB/s
    serpent-cbc        256b        58.9 MiB/s       523.8 MiB/s
    twofish-cbc        256b       195.1 MiB/s       305.6 MiB/s
        aes-xts        256b      2608.6 MiB/s      2475.1 MiB/s
    serpent-xts        256b       434.8 MiB/s       377.3 MiB/s
    twofish-xts        256b       233.9 MiB/s       223.7 MiB/s
        aes-xts        512b      2016.4 MiB/s      1995.0 MiB/s
    serpent-xts        512b       456.8 MiB/s       441.8 MiB/s
    twofish-xts        512b       219.4 MiB/s       230.0 MiB/s

luksDump my_device

Keyslots:
  0: luks2
    Key:        512 bits
    Priority:   normal
    Cipher:     aes-xts-plain64
    Cipher key: 512 bits
    PBKDF:      argon2id
    Time cost:  4
    Memory:     1044590
    Threads:    4
    Salt:       bf c9 25 b6 dd 5d 67 b4 68 5c 0a 85 18 6c 07 50
                dc 5d a1 9a 13 08 11 6f cb f7 86 9e 6e be 04 31
    AF stripes: 4000
    AF hash:    sha256
    Area offset:32768 [bytes]
    Area length:258048 [bytes]
    Digest ID:  0
2
  • 1
    Should be possible according to cryptsetup reencrypt: "For re-encryption it is possible to change the #Encryption options for LUKS mode" and these modes include key size, cipher ... Oct 30, 2021 at 14:03
  • @SteffenUllrich thanks. but I am not certain if it re-encrypts all the data on disk again or just update the LUKS headers. because re-encrypting all the data on huge HDD's takes days.
    – Akhil
    Oct 30, 2021 at 18:16

1 Answer 1

1

This is not possible without re-encrypting all the data. AES-XTS uses a key that's twice the size of the AES key. So a 256-bit AES-XTS key uses 128-bit AES and a 512-bit AES-XTS key uses 256-bit AES. AES with different key sizes uses different numbers of rounds as well as different key sizes, so there won't be a way to transform one into the other without re-encrypting the entire drive.

If you still want to do this, there is cryptsetup reencrypt. Having said that, the speed is still very good and, depending on the drive, may still be faster than your physical drive can actually read or write, so you may decide that you don't really care that much.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .