Skip to content

Support Argon2 KDF in LUKS2

Patrick Steinhardt grub-devel 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest5 patches 28 repliesIn review
  2. v26 patches 7 repliesSuperseded
  3. v15 patches 12 repliesSuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5efi: Always try to allocate heap size of 1.6GBgrub-core/kern/efi/mm.c+11 -106 replies
2/5types.h: add UINT-related macros needed for Argon2include/grub/types.h+8 -01 reply
3/5argon2: Import Argon2 from cryptsetupdocs/grub-dev.texi grub-core/Makefile.core.def grub-core/lib/argon2/argon2.c +8 more+2195 -027 replies
4/5luks2: Discern Argon2i and Argon2idgrub-core/disk/luks2.c+8 -50 replies
5/5luks2: Support key derival via Argon2Makefile.util.def grub-core/Makefile.core.def grub-core/disk/luks2.c+17 -40 replies

Reviews trailers per patch

4 of 5 patches have a Reviewed-by or Acked-by.

PatchDaniel KiperPetr Vorel
1/5
2/5R-b
3/5R-b
4/5R-b
5/5R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/5] Support Argon2 KDF in LUKS2

Hi,

this is the third version of my patchset to support the Argon2 KDF in LUKS2. The following things have changed in comparison to v2:

- Improved the GRUB_UINT_C macros to not use elif 1 and fixed indentation.

- Dropped the upstreamed patch to fix a missing newline.

- Reworked how we allocate memory on EFI. Previously, we always targeted to acquire 1/4 of available memory. Now we're always trying to allocate MAX_HEAP_SIZE (1.6GB) but clamp it to at most 1/2 of available memory and at least MIN_HEAP_SIZE (100MB).

So especially the last part is the interesting one. I _think_ that it's roughly what Leif had in mind, but please do correct me if I'm wrong.

Regards
Patrick

Patrick Steinhardt (5):
efi: Always try to allocate heap size of 1.6GB types.h: add UINT-related macros needed for Argon2
argon2: Import Argon2 from cryptsetup
luks2: Discern Argon2i and Argon2id
luks2: Support key derival via Argon2

 Makefile.util.def                             |   6 +-
 docs/grub-dev.texi                            |  64 +++
 grub-core/Makefile.core.def                   |  10 +-
 grub-core/disk/luks2.c                        |  26 +-
 grub-core/kern/efi/mm.c                       |  21 +-
 grub-core/lib/argon2/argon2.c                 | 232 ++++++++
 grub-core/lib/argon2/argon2.h                 | 264 +++++++++
 grub-core/lib/argon2/blake2/blake2-impl.h     | 151 +++++
 grub-core/lib/argon2/blake2/blake2.h          |  89 +++
 grub-core/lib/argon2/blake2/blake2b.c         | 388 +++++++++++++
 .../lib/argon2/blake2/blamka-round-ref.h      |  56 ++
 grub-core/lib/argon2/core.c                   | 525 ++++++++++++++++++
 grub-core/lib/argon2/core.h                   | 228 ++++++++
 grub-core/lib/argon2/ref.c                    | 190 +++++++
 include/grub/types.h                          |   8 +
 15 files changed, 2239 insertions(+), 19 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
 create mode 100644 grub-core/lib/argon2/core.c
 create mode 100644 grub-core/lib/argon2/core.h
 create mode 100644 grub-core/lib/argon2/ref.c

Range-diff against v2:

1:  15bdf830e < -:  --------- efi: Allocate half of available memory by default
-:  --------- > 1:  c783f34d7 efi: Always try to allocate heap size of 1.6GB
2:  e81db7d95 ! 2:  724713a8b types.h: add UINT-related macros needed for Argon2
    @@ include/grub/types.h: typedef grub_int32_t	grub_ssize_t;
      #endif
      # define GRUB_LONG_MIN (-GRUB_LONG_MAX - 1)
      
    -+# define GRUB_UINT32_C(x) x ## U
    -+# if GRUB_ULONG_MAX >> 31 >> 31 >> 1 == 1
    -+#  define GRUB_UINT64_C(x) x##UL
    -+# elif 1
    -+#  define GRUB_UINT64_C(x) x##ULL
    -+# endif
    ++#define GRUB_UINT32_C(x) x ## U
    ++#if GRUB_ULONG_MAX >> 31 >> 31 >> 1 == 1
    ++# define GRUB_UINT64_C(x) x##UL
    ++#else
    ++# define GRUB_UINT64_C(x) x##ULL
    ++#endif
     +
      typedef grub_uint64_t grub_properly_aligned_t;

3: 50aff9670 ! 3: eadc4bcd8 argon2: Import Argon2 from cryptsetup
@@ docs/grub-dev.texi: GRUB includes some code from other projects, and it is somet
+* Argon2::
* Gnulib::
* jsmn::
+ * minilzo::
@end menu

+@node Argon2

4:  af3f85665 < -:  --------- luks2: Add missing newline to debug message
5:  89abe827b ! 4:  61bc6c0e5 luks2: Discern Argon2i and Argon2id

@@ Commit message
accordingly.

+ Reviewed-by: Daniel Kiper <[email protected]>

## grub-core/disk/luks2.c ##
@@ grub-core/disk/luks2.c: GRUB_MOD_LICENSE ("GPLv3+");
6: 70a354e0b ! 5: 012e3d442 luks2: Support key derival via Argon2
@@ Commit message
now trivial.

+ Reviewed-by: Daniel Kiper <[email protected]>

## Makefile.util.def ##
@@ Makefile.util.def: AutoGen definitions Makefile.tpl;

Signature · 1 line
2.25.1