All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: grub-devel@gnu.org
Cc: Patrick Steinhardt <ps@pks.im>, Daniel Kiper <daniel.kiper@oracle.com>
Subject: [PATCH 0/5] Support Argon2 KDF in LUKS2
Date: Thu,  6 Feb 2020 15:27:28 +0100	[thread overview]
Message-ID: <cover.1580998938.git.ps@pks.im> (raw)

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



             reply	other threads:[~2020-02-06 14:27 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-06 14:27 Patrick Steinhardt [this message]
2020-02-06 14:27 ` [PATCH 1/5] efi: Allocate half of available memory by default Patrick Steinhardt
2020-02-13 11:47   ` Leif Lindholm
2020-02-20 19:29     ` Patrick Steinhardt
2020-02-06 14:27 ` [PATCH 2/5] argon2: Import Argon2 from cryptsetup Patrick Steinhardt
2020-02-08 11:30   ` Milan Broz
2020-02-08 22:25     ` Patrick Steinhardt
2020-02-06 14:27 ` [PATCH 3/5] disk: luks2: Add missing newline to debug message Patrick Steinhardt
2020-02-11 21:36   ` Daniel Kiper
2020-02-12  7:48     ` Patrick Steinhardt
2020-02-06 14:27 ` [PATCH 4/5] disk: luks2: Discern Argon2i and Argon2id Patrick Steinhardt
2020-02-06 14:27 ` [PATCH 5/5] disk: luks2: Support key derival via Argon2 Patrick Steinhardt
2020-02-11 21:53 ` [PATCH 0/5] Support Argon2 KDF in LUKS2 Daniel Kiper
2020-02-12  7:18   ` Milan Broz
2020-02-20 19:34     ` Patrick Steinhardt
2020-02-12  7:47   ` Patrick Steinhardt
2020-02-13 11:42     ` Daniel Kiper
2020-02-20 14:50       ` Patrick Steinhardt
2020-02-20 18:00 ` [PATCH v2 0/6] " Patrick Steinhardt
2020-02-20 18:00   ` [PATCH v2 1/6] efi: Allocate half of available memory by default Patrick Steinhardt
2020-02-20 18:00   ` [PATCH v2 2/6] types.h: add UINT-related macros needed for Argon2 Patrick Steinhardt
2020-02-21 12:34     ` Daniel Kiper
2020-02-20 18:00   ` [PATCH v2 3/6] argon2: Import Argon2 from cryptsetup Patrick Steinhardt
2020-02-21 12:39     ` Daniel Kiper
2020-02-20 18:00   ` [PATCH v2 4/6] luks2: Add missing newline to debug message Patrick Steinhardt
2020-02-20 18:00   ` [PATCH v2 5/6] luks2: Discern Argon2i and Argon2id Patrick Steinhardt
2020-02-21 12:54     ` Daniel Kiper
2020-02-20 18:00   ` [PATCH v2 6/6] luks2: Support key derival via Argon2 Patrick Steinhardt
2020-02-21 13:03     ` Daniel Kiper
2020-02-20 18:38   ` [PATCH v2 0/6] Support Argon2 KDF in LUKS2 Leif Lindholm
2020-02-21 12:26   ` Daniel Kiper
2020-02-21 14:29     ` Patrick Steinhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1580998938.git.ps@pks.im \
    --to=ps@pks.im \
    --cc=daniel.kiper@oracle.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.