Hi, as promised back when LUKS2 support was merged, here's the code that enables decrypting LUKS2 partitions that use Argon2 as their key derival function. Most of this is simple legwork, but I expect two things to be potentially controversial:
- I've changed how EFI allocates memory. On my test systems, I was only able to allocate roughly 800MB, which isn't enough for the default of 1GB memory parameter that cryptsetup uses with Argon2. Instead of taking a quarter of available memory, we now take half of it, which amounts to ~1.6GB on 32 bit systems. - The import of Argon2 itself. I've imported code from the cryptsetup project, but I've modified it quite a bit to fit into GRUB's codebase. This included both stripping off unneeded functionality as well as converting the code to use our own coding style. While it makes importing upstream fixes harder, I'd argue the code is still very similar in its structure and thus backporting should be easy enough. Anyway. With these changes I'm able to successfully decrypt LUKS2 partitions making use of either PBKDF2, Argon2i or Argon2id. Regards Patrick Patrick Steinhardt (5): efi: Allocate half of available memory by default argon2: Import Argon2 from cryptsetup disk: luks2: Add missing newline to debug message disk: luks2: Discern Argon2i and Argon2id disk: luks2: Support key derival via Argon2 Makefile.util.def | 4 +- grub-core/Makefile.core.def | 8 +- grub-core/disk/luks2.c | 29 +- grub-core/kern/efi/mm.c | 4 +- grub-core/lib/argon2/argon2.c | 614 ++++++++++++++++++ grub-core/lib/argon2/argon2.h | 65 ++ grub-core/lib/argon2/blake2/blake2-impl.h | 143 ++++ grub-core/lib/argon2/blake2/blake2.h | 81 +++ grub-core/lib/argon2/blake2/blake2b.c | 384 +++++++++++ .../lib/argon2/blake2/blamka-round-ref.h | 56 ++ 10 files changed, 1376 insertions(+), 12 deletions(-) create mode 100644 grub-core/lib/argon2/argon2.c create mode 100644 grub-core/lib/argon2/argon2.h create mode 100644 grub-core/lib/argon2/blake2/blake2-impl.h create mode 100644 grub-core/lib/argon2/blake2/blake2.h create mode 100644 grub-core/lib/argon2/blake2/blake2b.c create mode 100644 grub-core/lib/argon2/blake2/blamka-round-ref.h -- 2.25.0 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel