Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1oHWAs-00029x-Ay for mharc-grub-devel@gnu.org; Fri, 29 Jul 2022 16:01:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49110) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oHWAl-00028Q-T9 for grub-devel@gnu.org; Fri, 29 Jul 2022 16:01:23 -0400 Received: from msg-2.mailo.com ([213.182.54.12]:59474) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oHWAj-0006sP-4x for grub-devel@gnu.org; Fri, 29 Jul 2022 16:01:23 -0400 Received: by www.mailo.com with http webmail; Fri, 29 Jul 2022 22:01:17 +0200 (CEST) X-EA-Auth: 9hJbJGidNAWW+rd0q70nL1lV9cesOUgKEDVSuIKBWEfJM9JJxNPhAfwybABc2o4zFt944+Gln/SlsizhuXVYspNIxI4lXR7v From: brutser@perso.be To: grub-devel@gnu.org Cc: dkiper@net-space.pl, ps@pks.im Date: Fri, 29 Jul 2022 22:01:17 +0200 (CEST) Subject: Re: [PATCH v3 0/3] Cryptomount detached headers X-Priority: 3 MIME-Version: 1.0 X-Mailer: COMS/EA22.05/r20220615 Message-ID: Content-Type: multipart/alternative; boundary="----=_NextPart_001_62e43c8d_1ceb_4735d7f3" Received-SPF: pass client-ip=213.182.54.12; envelope-from=brutser@perso.be; helo=msg-2.mailo.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, HTML_MESSAGE=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jul 2022 20:01:24 -0000 ------=_NextPart_001_62e43c8d_1ceb_4735d7f3 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Glenn,=20 To explain in more detail how I run my tests, because the whole picture ca= n give you a better understanding as to why it fails with me: 1. As grub payload is used for coreboot, I first build coreboot for the sy= stem (default build, nothing special). 2. To build grub: git clone https://git.savannah.gnu.org/git/grub.git ./bootstrap ./autogen.sh ./configure --with-platform=3Dcoreboot --disable-werror make 3. Change modules in Makefile to match the ones I wrote earlier. 4. make default_payload.elf 5. Installation debian (expert install) 6. Encrypt partition cryptsetup luksFormat --type luks2 -q -h sha512 -s 512 --pbkdf pbkdf2 --he= ader /path/to/header --luks2-metadata-size=3D16k --luks2-keyslots-size=3D51= 2k /dev/sda1 or LUKS1: cryptsetup luksFormat --cipher aes-xts-plain64 --hash=3Dsha256 --key-size= =3D512 --header /path/to/header --type luks1 /dev/sda1 7. Create necessary logical volumes and start installation debian 8. add crypttab, copy the header and keyfiles to target system. This exact same setup works fine with grub 2.04 and john lane's patches: h= ttps://grub.johnlane.ie/ (obviously only LUKS1 support). I will try to debug, not really experience with that, but will try to figu= re it out. Van: Glenn Washburn Aan: brutser@perso.be Onderwerp: Re: [PATCH v3 0/3] Cryptomount detached headers Datum: 29/07/2022 21:27:48 Europe/Paris Cc: grub-devel@gnu.org; =C2=A0=C2=A0=C2=A0dkiper@net-space.pl; =C2=A0=C2=A0=C2=A0ps@pks.im On Fri, 29 Jul 2022 20:56:18 +0200 (CEST) brutser@perso.be wrote: >=20 > testing detached header failed: >=20 >=20 >=20 > 1. built grub payload with following modules: ahci usb_keyboard part_msd= os part_gpt at_keyboard cbfs cryptodisk luks2 lvm gcry_rijndael gcry_sha1 g= cry_sha256 gcry_sha512 >=20 > 2. encrypt a partition: cryptsetup luksFormat --type luks2 -q -h sha512 = -s 512 --pbkdf pbkdf2 --header /path/to/header --luks2-metadata-size=3D16k = --luks2-keyslots-size=3D512k /dev/sda1 >=20 > (where --luks2-metadata-size=3D16k --luks2-keyslots-size=3D512k is optio= nal, this is just to minimize header size, but I also tested without). >=20 > 3. from the grub cmd, i try to decrypt this partition using: cryptomount= -H /path/to/header (ahci0,msdos1) >=20 >=20 >=20 > 4. I also tried luks1 encryption with detached header. >=20 >=20 >=20 > whatever I try, I always get the same error: >=20 > "no cryptodisk module can handle this device" >=20 >=20 >=20 > Is this feature not 100% implemented yet, I saw people already verifying= the patches and would expect this to be working, so if yes, this seems lik= e a bug. This feature should be working in all cases, and if not there may be a bug. I responded to your off-list email before seeing this one. I'll repeat what I said there and let's continue this discussion on the list. I see nothing obviously wrong with what you're doing, given the information above. To further debug this, would you be able to send a log of the serial output when the GRUB envvar debug is set to "all" while running the cryptomount command? If so, please send compressed in a reply to this email on the list. If you can't because of hardware issues, would you be able to replicate this in QEMU and grab the serial output from there? If you can boot the system via other means, you should be able to use the raw disks (the one with the LUKS volume and the other with the filesystem containing the header file). Glenn _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel ------=_NextPart_001_62e43c8d_1ceb_4735d7f3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Glenn,

To explain in more detail how = I run my tests, because the whole picture can give you a better understandi= ng as to why it fails with me:
1. As grub payload is used for cor= eboot, I first build coreboot for the system (default build, nothing specia= l).
2. To build grub:
git clone https://git.savannah.gn= u.org/git/grub.git
./bootstrap
./autogen.sh
.= /configure --with-platform=3Dcoreboot --disable-werror
make
=

3. Change modules in Makefile to match the ones I wrote= earlier.
4. make default_payload.elf

5.= Installation debian (expert install)
6. Encrypt partition
cryptsetup luksFormat --type luks2 -q -h sha512 -s 512 --pbkdf pbkd= f2=20 --header /path/to/header --luks2-metadata-size=3D16k=20 --luks2-keyslots-size=3D512k /dev/sda1
or LUKS1:
crypt= setup luksFormat --cipher aes-xts-plain64 --hash=3Dsha256 --key-size=3D512 = --header /path/to/header --type luks1 /dev/sda1
7. Create necessa= ry logical volumes and start installation debian
8. add crypttab,= copy the header and keyfiles to target system.

Th= is exact same setup works fine with grub 2.04 and john lane's patches: http= s://grub.johnlane.ie/ (obviously only LUKS1 support).

<= div>I will try to debug, not really experience with that, but will try to f= igure it out.


Van: Glenn Washburn= <development@efficientek.com>
Aan: brutser@perso.be
Onderwerp: Re: [PATCH v3 0/3] Cryptomount detached headers
Datum: 29/07/2022 21:27:48 Europe/Paris
Cc: grub-devel@gnu.org;
=C2=A0=C2=A0=C2=A0dkiper@net-space.pl;
=C2=A0=C2=A0=C2=A0ps@pks.im

On Fri, 29 Jul 2022 20:56:18 +0200 (CEST)
brutser@perso.be wrote:

>
> testing detached header failed:
>
>
>
> 1. built grub payload with following modules: ahci usb_keyboard part_= msdos part_gpt at_keyboard cbfs cryptodisk luks2 lvm gcry_rijndael gcry_sha= 1 gcry_sha256 gcry_sha512
>
> 2. encrypt a partition: cryptsetup luksFormat --type luks2 -q -h sha5= 12 -s 512 --pbkdf pbkdf2 --header /path/to/header --luks2-metadata-size=3D1= 6k --luks2-keyslots-size=3D512k /dev/sda1
>
> (where --luks2-metadata-size=3D16k --luks2-keyslots-size=3D512k is op= tional, this is just to minimize header size, but I also tested without). >
> 3. from the grub cmd, i try to decrypt this partition using: cryptomo= unt -H /path/to/header (ahci0,msdos1)
>
>
>
> 4. I also tried luks1 encryption with detached header.
>
>
>
> whatever I try, I always get the same error:
>
> "no cryptodisk module can handle this device"
>
>
>
> Is this feature not 100% implemented yet, I saw people already verify= ing the patches and would expect this to be working, so if yes, this seems = like a bug.

This feature should be working in all cases, and if not there may be a
= bug. I responded to your off-list email before seeing this one. I'll
repeat what I said there and let's continue this discussion on the list.
I see nothing obviously wrong with what you're doing, given the
information above. To further debug this, would you be able to send a
log of the serial output when the GRUB envvar debug is set to "all&qu= ot;
while running the cryptomount command? If so, please send compressed in a reply to this email on the list.

If you can't because of hardware issues, would you be able to replicate this in QEMU and grab the serial output from there? If you can boot the system via other means, you should be able to use the raw disks (the
one with the LUKS volume and the other with the filesystem containing
the header file).

Glenn


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
------=_NextPart_001_62e43c8d_1ceb_4735d7f3--