dm crypt: Implement Elephant diffuser for Bitlocker compatibility
authorMilan Broz <gmazyland@gmail.com>
Fri, 3 Jan 2020 08:20:22 +0000 (09:20 +0100)
committerMike Snitzer <snitzer@redhat.com>
Wed, 15 Jan 2020 01:22:46 +0000 (20:22 -0500)
commitbbb1658461ac85ef7e0563bb11283f94ea5eb651
treec09f75ff1b928ffd80b960234f8e5a839df853d3
parent4feaef830de7ffdd8352e1fe14ad3bf13c9688f8
dm crypt: Implement Elephant diffuser for Bitlocker compatibility

Add experimental support for BitLocker encryption with CBC mode and
additional Elephant diffuser.

The mode was used in older Windows systems and it is provided mainly
for compatibility reasons. The userspace support to activate these
devices is being added to cryptsetup utility.

Read-write activation of such a device is very simple, for example:
  echo <password> | cryptsetup bitlkOpen bitlk_image.img test

The Elephant diffuser uses two rotations in opposite direction for
data (Diffuser A and B) and also XOR operation with Sector key over
the sector data; Sector key is derived from additional key data. The
original public documentation is available here:
  http://download.microsoft.com/download/0/2/3/0238acaf-d3bf-4a6d-b3d6-0a0be4bbb36e/bitlockercipher200608.pdf

The dm-crypt implementation is embedded to "elephant" IV (similar to
tcw IV construction).

Because we cannot modify original bio data for write (before
encryption), an additional internal flag to pre-process data is
added.

Signed-off-by: Milan Broz <gmazyland@gmail.com>
Reviewed-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-crypt.c