Skip to content

Support for LUKS2 disk encryption

Patrick Steinhardt grub-devel 7 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v7 Latest6 patches 1 replyIn review
  2. v66 patches 8 repliesSuperseded
  3. v56 patches 3 repliesSuperseded
Earlier versions · 4
VersionPostedPatchesRepliesStatus
v46 patches4 repliesSuperseded
v36 patches9 repliesSuperseded
v26 patches4 repliesSuperseded
v16 patches9 repliesSuperseded

Patches in v7 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6json: Import upstream jsmn-1.1.0docs/grub-dev.texi grub-core/Makefile.core.def grub-core/lib/json/jsmn.h +1 more+510 -00 replies
2/6json: Implement wrapping interfacegrub-core/lib/json/json.c grub-core/lib/json/json.h+366 -00 replies
3/6bootstrap: Add gnulib's base64 modulebootstrap.conf conf/Makefile.extra-dist grub-core/lib/gnulib-patches/fix-base64.patch+26 -10 replies
4/6afsplitter: Move into its own modulegrub-core/Makefile.core.def grub-core/disk/AFSplitter.c+8 -10 replies
5/6luks: Move configuration of ciphers into cryptodiskgrub-core/disk/cryptodisk.c grub-core/disk/luks.c include/grub/cryptodisk.h+181 -1750 replies
6/6disk: Implement support for LUKS2Makefile.util.def docs/grub.texi grub-core/Makefile.core.def +1 more+692 -30 replies

Reviews trailers per patch

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

PatchDaniel Kiper
1/6R-b
2/6R-b
3/6R-b
4/6R-b
5/6R-b
6/6

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

Read the v7 thread

Cover letter [PATCH v7 0/6] Support for LUKS2 disk encryption

Hi,

this is hopefully the last version of this patchset. The previous version was rejected due to compile issues on 32 bit platforms, which I didn't test before. Anyway, this version should fix these issues by

- using correct types where appropriate (grub_uint64_t instead of grub_size_t)

- using grub_divmod64() for 64 bit division

This got i386 working for me, but I didn't have any arm32 platform available. Chances are good it's fixed on both platforms, though. As always, the range-diff against v6 can be found below.

Patrick

Patrick Steinhardt (6):
json: Import upstream jsmn-1.1.0
json: Implement wrapping interface
bootstrap: Add gnulib's base64 module
afsplitter: Move into its own module
luks: Move configuration of ciphers into cryptodisk
disk: Implement support for LUKS2

 Makefile.util.def                             |   4 +-
 bootstrap.conf                                |   3 +-
 conf/Makefile.extra-dist                      |   1 +
 docs/grub-dev.texi                            |  14 +
 docs/grub.texi                                |   5 +-
 grub-core/Makefile.core.def                   |  19 +-
 grub-core/disk/AFSplitter.c                   |   3 +
 grub-core/disk/cryptodisk.c                   | 163 ++++-
 grub-core/disk/luks.c                         | 190 +----
 grub-core/disk/luks2.c                        | 678 ++++++++++++++++++
 grub-core/lib/gnulib-patches/fix-base64.patch |  23 +
 grub-core/lib/json/jsmn.h                     | 468 ++++++++++++
 grub-core/lib/json/json.c                     | 267 +++++++
 grub-core/lib/json/json.h                     | 122 ++++
 include/grub/cryptodisk.h                     |   3 +
 15 files changed, 1783 insertions(+), 180 deletions(-)
 create mode 100644 grub-core/disk/luks2.c
 create mode 100644 grub-core/lib/gnulib-patches/fix-base64.patch
 create mode 100644 grub-core/lib/json/jsmn.h
 create mode 100644 grub-core/lib/json/json.c
 create mode 100644 grub-core/lib/json/json.h

Range-diff against v6:

1:  2469e96f9 = 1:  2469e96f9 json: Import upstream jsmn-1.1.0
2:  88d2b083d ! 2:  c67fda9fb json: Implement wrapping interface

@@ Commit message
grub_json_t.

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

## grub-core/lib/json/json.c ##
@@

3:  411a822b4 = 3:  dcca930de bootstrap: Add gnulib's base64 module
4:  be0859313 = 4:  f922aabda afsplitter: Move into its own module
5:  8535bb34a = 5:  3d397ac30 luks: Move configuration of ciphers into cryptodisk
6:  f9b578487 ! 6:  59d36e0e9 disk: Implement support for LUKS2
    @@ grub-core/disk/luks2.c (new)
     +luks2_parse_digest (grub_luks2_digest_t *out, const grub_json_t *digest)
     +{
     +  grub_json_t segments, keyslots, o;
    ++  grub_size_t i, size;
    ++  grub_uint64_t bit;
     +  const char *type;
    -+  grub_size_t i, size, bit;
     +
     +  if (grub_json_getstring (&type, digest, "type"))
     +    return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid digest type");
    @@ grub-core/disk/luks2.c (new)
     +		   const grub_json_t *root, grub_size_t i)
     +{
     +  grub_json_t keyslots, keyslot, digests, digest, segments, segment;
    -+  grub_size_t j, idx, size;
    ++  grub_size_t j, size;
    ++  grub_uint64_t idx;
     +
     +  /* Get nth keyslot */
     +  if (grub_json_getvalue (&keyslots, root, "keyslots") ||
    @@ grub-core/disk/luks2.c (new)
     +      grub_dprintf ("luks2", "Trying keyslot %"PRIuGRUB_SIZE"\n", i);
     +
     +      /* Set up disk according to keyslot's segment. */
    -+      crypt->offset = segment.offset / segment.sector_size;
    ++      crypt->offset = grub_divmod64 (segment.offset, segment.sector_size, NULL);
     +      crypt->log_sector_size = sizeof (unsigned int) * 8
     +		- __builtin_clz ((unsigned int) segment.sector_size) - 1;
     +      if (grub_strcmp (segment.size, "dynamic") == 0)
Signature · 1 line
2.24.1