0

Section 2.4 What is the difference between "plain" and LUKS format? of the cryptsetup Frequently Asked Questions says the primary advantage of plain dm-crypt (no LUKS) is:

...high resilience to damage, as one damaged encrypted sector results in exactly one damaged decrypted sector.

I'm thinking of using LUKS, but I've got FUD about the effects of a damaged encrypted sector in LUKS, as i couldn't find this specified in the FAQ.

If I keep a backup of my LUKS header, will there still be an exact 1:1 mapping between damaged encrypted and decrypted sectors when using LUKS?

Tom Hale
  • 2,545
  • 3
  • 9
  • 11

1 Answers1

1

LUKS is built on dm-crypt. The format of LUKS is basically a header that precedes the encrypted data (the actual data being shifted by an "offset" (see man cryptsetup) to allow the header to be stored in frot of the data. The data is still encrypted with dm-crypt and it is possible (assuming knowledge of the key) to open a LUKS volume using only plain mode commands.

So LUKS only offsets the data - it does not change how the data is encrypted.

What LUKS gives you is a way to store up to eight copies of the encryption key securely in a header, with each copy encrypted by another key derived from a user-given passphrase.

The added strength of LUKS is it generates the master key and can therefore ensure that the key is stronger than one provided by the end-user. Also, it employs "PBKDF2" to derive the keys used to encrypt the data key from the passphrase and "anti-forensic key splitting" to more securely store that encrypted key material.

Furthermore, you can "detach" the LUKS header (i.e don't store it with the data) in which case the above-mentioned "offset" would be zero.

To settle your FUD, if the LUKS header is corrupted or lost then you will lose the encryption key for the data and, consequently, your ability to access that data. The solution to this is to take a backup of the header.

If the corruption is in the data itself then there will, as you say, be an exact 1:1 mapping between damaged encrypted and decrypted sectors.

starfry
  • 291
  • 2
  • 7
  • Thanks! Up to 8 copies are stored of which key? The master key? – Tom Hale Jun 29 '17 at 07:34
  • 1
    Yes - the master key is the key actually used to encrypt the data. It is stored in the header in one or more of eight "slots" in a stretched (elnarged) form (the anti-forensic key splitting) and each slot is then encrypted with anoter key derived (using PBKDF2) from a user-entered passphrase. Normally only one slot is used but up to eight are available so you can have up to eight separate passphrases which can be added/removed or changed without altering the underlying master key used to encrypt the data. – starfry Jun 29 '17 at 08:06