]> git.proxmox.com Git - grub2.git/commit
disk: Implement support for LUKS2
authorPatrick Steinhardt <ps@pks.im>
Fri, 27 Dec 2019 15:18:39 +0000 (16:18 +0100)
committerDaniel Kiper <daniel.kiper@oracle.com>
Fri, 10 Jan 2020 13:30:24 +0000 (14:30 +0100)
commit365e0cc3e7e44151c14dd29514c2f870b49f9755
treebac76ba865cd92be83a2077a22a660b059806c8e
parentdd3f49b106497416d4da557e8d583e1e9d6f2357
disk: Implement support for LUKS2

With cryptsetup 2.0, a new version of LUKS was introduced that breaks
compatibility with the previous version due to various reasons. GRUB
currently lacks any support for LUKS2, making it impossible to decrypt
disks encrypted with that version. This commit implements support for
this new format.

Note that LUKS1 and LUKS2 are quite different data formats. While they
do share the same disk signature in the first few bytes, representation
of encryption parameters is completely different between both versions.
While the former version one relied on a single binary header, only,
LUKS2 uses the binary header only in order to locate the actual metadata
which is encoded in JSON. Furthermore, the new data format is a lot more
complex to allow for more flexible setups, like e.g. having multiple
encrypted segments and other features that weren't previously possible.
Because of this, it was decided that it doesn't make sense to keep both
LUKS1 and LUKS2 support in the same module and instead to implement it
in two different modules luks and luks2.

The proposed support for LUKS2 is able to make use of the metadata to
decrypt such disks. Note though that in the current version, only the
PBKDF2 key derival function is supported. This can mostly attributed to
the fact that the libgcrypt library currently has no support for either
Argon2i or Argon2id, which are the remaining KDFs supported by LUKS2. It
wouldn't have been much of a problem to bundle those algorithms with
GRUB itself, but it was decided against that in order to keep down the
number of patches required for initial LUKS2 support. Adding it in the
future would be trivial, given that the code structure is already in
place.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Makefile.util.def
docs/grub.texi
grub-core/Makefile.core.def
grub-core/disk/luks2.c [new file with mode: 0644]