GNU bug report logs - #38920
[PATCH] file-systems: Handle v2 LUKS header

Previous Next

Package: guix-patches;

Reported by: David Trudgian <dave <at> trudgian.net>

Date: Sat, 4 Jan 2020 16:23:02 UTC

Severity: normal

Tags: patch

Done: Danny Milosavljevic <dannym <at> scratchpost.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 38920 in the body.
You can then email your comments to 38920 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#38920; Package guix-patches. (Sat, 04 Jan 2020 16:23:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to David Trudgian <dave <at> trudgian.net>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sat, 04 Jan 2020 16:23:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: David Trudgian <dave <at> trudgian.net>
To: guix-patches <at> gnu.org
Cc: dave <at> trudgian.net
Subject: [PATCH] file-systems: Handle v2 LUKS header
Date: Sat, 4 Jan 2020 09:19:17 -0600
Let luks-superblock? read a LUKS2 header. The binary header prior to
the JSON LUKS2 data is backward compatible with LUKS1, so the UUID
can be read from the same location, and we just need to accept
version=2.
---
 gnu/build/file-systems.scm | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm
index 9299cc2e4c..df06905c4e 100644
--- a/gnu/build/file-systems.scm
+++ b/gnu/build/file-systems.scm
@@ -4,6 +4,7 @@
 ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe <at> gmail.com>
 ;;; Copyright © 2019 Guillaume Le Vaillant <glv <at> posteo.net>
 ;;; Copyright © 2019 Tobias Geerinckx-Rice <me <at> tobias.gr>
+;;; Copyright © 2019 David C. Trudgian <dave <at> trudgian.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -343,6 +344,10 @@ if DEVICE does not contain a JFS file system."
 ;; <https://gitlab.com/cryptsetup/cryptsetup/wikis/Specification>.  We follow
 ;; version 1.2.1 of this document.
 
+;; The LUKS2 header format is described in "LUKS2 On-Disk Format Specification":
+;; <https://gitlab.com/cryptsetup/LUKS2-docs/blob/master/luks2_doc_wip.pdf>.
+;; This is a WIP document.
+
 (define-syntax %luks-endianness
   ;; Endianness of LUKS headers.
   (identifier-syntax (endianness big)))
@@ -356,12 +361,16 @@ if DEVICE does not contain a JFS file system."
   (let ((magic   (sub-bytevector sblock 0 6))
         (version (bytevector-u16-ref sblock 6 %luks-endianness)))
     (and (bytevector=? magic %luks-magic)
-         (= version 1))))
+         (or (= version 1) (= version 2)))))
 
 (define (read-luks-header file)
   "Read a LUKS header from FILE.  Return the raw header on success, and #f if
 not valid header was found."
-  ;; Size in bytes of the LUKS header, including key slots.
+  ;; Size in bytes of the LUKS binary header, which includes key slots in
+  ;; LUKS1.  In LUKS2 the binary header is partially backward compatible, so
+  ;; that UUID can be extracted as for LUKS1. Keyslots and other metadata are
+  ;; not part of this header in LUKS2, but are included in the JSON metadata
+  ;; area that follows.
   (read-superblock file 0 592 luks-superblock?))
 
 (define (luks-header-uuid header)
-- 
2.24.1







Reply sent to Danny Milosavljevic <dannym <at> scratchpost.org>:
You have taken responsibility. (Sun, 05 Jan 2020 10:16:01 GMT) Full text and rfc822 format available.

Notification sent to David Trudgian <dave <at> trudgian.net>:
bug acknowledged by developer. (Sun, 05 Jan 2020 10:16:01 GMT) Full text and rfc822 format available.

Message #10 received at 38920-done <at> debbugs.gnu.org (full text, mbox):

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: David Trudgian <dave <at> trudgian.net>
Cc: 38920-done <at> debbugs.gnu.org
Subject: Re: [bug#38920] [PATCH] file-systems: Handle v2 LUKS header
Date: Sun, 5 Jan 2020 11:15:36 +0100
[Message part 1 (text/plain, inline)]
Hi David,

thanks for the patch!

Pushed as commit 7aa28eb339dd667d07cfb8b5347e159d5da3ccd7 to guix master.
[Message part 2 (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 02 Feb 2020 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 56 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.