jroovy, I was also having problems on my laptop with this patch, but I was never able to figure out the cause. What device are you running it on?
Search Criteria
Package Details: grub-improved-luks2-git 2.12.r10.g04d2a50f3-1
Package Actions
Git Clone URL: | https://aur.archlinux.org/grub-improved-luks2-git.git (read-only, click to copy) |
---|---|
Package Base: | grub-improved-luks2-git |
Description: | GNU GRand Unified Bootloader (2) with Argon2 support. Patch made by Patrick Steinhardt |
Upstream URL: | https://www.gnu.org/software/grub/ |
Licenses: | GPL3, CC0 |
Conflicts: | grub |
Provides: | grub |
Submitter: | Ax333l |
Maintainer: | Ax333l |
Last Packager: | Ax333l |
Votes: | 27 |
Popularity: | 1.49 |
First Submitted: | 2022-01-02 14:06 (UTC) |
Last Updated: | 2024-03-09 00:19 (UTC) |
Dependencies (18)
- device-mapper (device-mapper-gitAUR)
- freetype2 (freetype2-qdoledAUR, freetype2-macosAUR, freetype2-gitAUR)
- fuse2
- gettext (gettext-gitAUR)
- autogen (make)
- bdf-unifontAUR (make)
- bison (byacc-bisonAUR, bison-gitAUR) (make)
- git (git-gitAUR, git-glAUR) (make)
- help2man (help2man-gitAUR, python-help2manAUR) (make)
- python (python37AUR, python311AUR, python310AUR) (make)
- rsync (rsync-gitAUR, rsync-reflinkAUR, rsync-reflink-gitAUR) (make)
- texinfo (texinfo-gitAUR) (make)
- ttf-dejavu (ttf-dejavu-ibAUR, ttf-dejavu-emojilessAUR) (make)
- dosfstools (dosfstools-gitAUR) (optional) – For grub-mkrescue FAT FS and EFI support
- efibootmgr (efibootmgr-gitAUR) (optional) – For grub-install EFI support
- libisoburn (libisoburn-gitAUR) (optional) – Provides xorriso for generating grub rescue iso using grub-mkrescue
- mtools (mtools-svnAUR) (optional) – For grub-mkrescue FAT FS support
- os-prober (os-prober-gitAUR, os-prober-btrfsAUR) (optional) – To detect other OSes when generating grub.cfg in BIOS systems
Required by (314)
- apple_set_os (requires grub) (optional)
- arch-grub2-theme (requires grub)
- arch-matrix-grub-theme-git (requires grub)
- archiso-git (requires grub) (optional)
- archiso-grub-themes (requires grub)
- archuseriso (requires grub)
- bieaz (requires grub)
- bieaz-git (requires grub)
- boo-grub-git (requires grub)
- booty-git (requires grub)
- cryptboot (requires grub)
- cyberpunk-grub-theme-git (requires grub)
- dedsec-grub2-theme (requires grub)
- distro-grub-themes-arch (requires grub)
- distro-grub-themes-endeavouros (requires grub)
- distro-grub-themes-meta (requires grub)
- dracula-grub-theme-git (requires grub)
- endeavouros-galleon-grub (requires grub)
- graphite-grub-theme-default-1080p (requires grub)
- graphite-grub-theme-default-2k (requires grub)
- graphite-grub-theme-default-4k (requires grub)
- graphite-grub-theme-nord-1080p (requires grub)
- graphite-grub-theme-nord-2k (requires grub)
- graphite-grub-theme-nord-4k (requires grub)
- grml-iso (requires grub)
- grml-rescueboot (requires grub)
- grml2usb (requires grub) (optional)
- grub-android-prober (requires grub)
- grub-android-x86 (requires grub)
- grub-backup-hook (requires grub)
- grub-btrfs-autogenerate (requires grub)
- grub-btrfs-git (requires grub)
- grub-custom-simona (requires grub)
- grub-customizer-git (requires grub)
- grub-customizer5-git (requires grub)
- grub-editor (requires grub)
- grub-esp (requires grub)
- grub-hook (requires grub)
- grub-imageboot (requires grub)
- grub-linux-default-hook (requires grub)
- grub-linux-rt-default-hook (requires grub)
- grub-netboot-alpine (requires grub)
- grub-netboot-archlinux (requires grub)
- grub-reboot-picker (requires grub)
- grub-reboot-poweroff (requires grub)
- grub-secureboot-scripts (requires grub)
- grub-theme-acer (requires grub)
- grub-theme-almalinux (requires grub)
- grub-theme-aorus (requires grub)
- grub-theme-apple (requires grub)
- grub-theme-arch-linux (requires grub)
- grub-theme-arco-linux (requires grub)
- grub-theme-artix-linux (requires grub)
- grub-theme-asrock (requires grub)
- grub-theme-asus (requires grub)
- grub-theme-bedrock-linux (requires grub)
- grub-theme-boot-minegrub-git (requires grub)
- grub-theme-brainwash-color-1080p-git (requires grub)
- grub-theme-brainwash-color-1440p-git (requires grub)
- grub-theme-brainwash-white-1080p-git (requires grub)
- grub-theme-brainwash-white-1440p-git (requires grub)
- grub-theme-centos (requires grub)
- grub-theme-chromeos (requires grub)
- grub-theme-comments-color-1080p-git (requires grub)
- grub-theme-comments-color-1440p-git (requires grub)
- grub-theme-comments-white-1080p-git (requires grub)
- grub-theme-comments-white-1440p-git (requires grub)
- grub-theme-compact-color-1080p-git (requires grub)
- grub-theme-compact-color-1440p-git (requires grub)
- grub-theme-compact-white-1080p-git (requires grub)
- grub-theme-compact-white-1440p-git (requires grub)
- grub-theme-debian (requires grub)
- grub-theme-deepin (requires grub)
- grub-theme-dell (requires grub)
- grub-theme-elementaryos (requires grub)
- grub-theme-endeavouros (requires grub)
- grub-theme-fedora (requires grub)
- grub-theme-firewall-color-1080p-git (requires grub)
- grub-theme-firewall-color-1440p-git (requires grub)
- grub-theme-firewall-white-1080p-git (requires grub)
- grub-theme-firewall-white-1440p-git (requires grub)
- grub-theme-framework (requires grub)
- grub-theme-freebsd (requires grub)
- grub-theme-fuckery-color-1080p-git (requires grub)
- grub-theme-fuckery-color-1440p-git (requires grub)
- grub-theme-fuckery-white-1080p-git (requires grub)
- grub-theme-fuckery-white-1440p-git (requires grub)
- grub-theme-garuda (requires grub)
- grub-theme-gentoo (requires grub)
- grub-theme-gigabyte (requires grub)
- grub-theme-hackerden-color-1080p-git (requires grub)
- grub-theme-hackerden-color-1440p-git (requires grub)
- grub-theme-hackerden-white-1080p-git (requires grub)
- grub-theme-hackerden-white-1440p-git (requires grub)
- grub-theme-hook (requires grub)
- grub-theme-hp (requires grub)
- grub-theme-huawei (requires grub)
- grub-theme-kawaiki-color-1080p-git (requires grub)
- grub-theme-kawaiki-color-2k-git (requires grub)
- grub-theme-kawaiki-color-4k-git (requires grub)
- grub-theme-kawaiki-color-ultrawide-git (requires grub)
- grub-theme-kawaiki-color-ultrawide2k-git (requires grub)
- grub-theme-kawaiki-white-1080p-git (requires grub)
- grub-theme-kawaiki-white-2k-git (requires grub)
- grub-theme-kawaiki-white-4k-git (requires grub)
- grub-theme-kawaiki-white-ultrawide-git (requires grub)
- grub-theme-kawaiki-white-ultrawide2k-git (requires grub)
- grub-theme-kawaiki-whitesur-1080p-git (requires grub)
- grub-theme-kawaiki-whitesur-2k-git (requires grub)
- grub-theme-kawaiki-whitesur-4k-git (requires grub)
- grub-theme-kawaiki-whitesur-ultrawide-git (requires grub)
- grub-theme-kawaiki-whitesur-ultrawide2k-git (requires grub)
- grub-theme-kde-neon (requires grub)
- grub-theme-kingston (requires grub)
- grub-theme-kubuntu (requires grub)
- grub-theme-legion (requires grub)
- grub-theme-legion-color-1080p-git (requires grub)
- grub-theme-legion-color-1440p-git (requires grub)
- grub-theme-legion-white-1080p-git (requires grub)
- grub-theme-legion-white-1440p-git (requires grub)
- grub-theme-lenovo (requires grub)
- grub-theme-lg (requires grub)
- grub-theme-linux-mint (requires grub)
- grub-theme-live-common (requires grub)
- grub-theme-lovetrap-color-1080p-git (requires grub)
- grub-theme-lovetrap-color-1440p-git (requires grub)
- grub-theme-lovetrap-white-1080p-git (requires grub)
- grub-theme-lovetrap-white-1440p-git (requires grub)
- grub-theme-lubuntu (requires grub)
- grub-theme-manjaro2 (requires grub)
- grub-theme-mashup-color-1080p-git (requires grub)
- grub-theme-mashup-color-1440p-git (requires grub)
- grub-theme-mashup-white-1080p-git (requires grub)
- grub-theme-mashup-white-1440p-git (requires grub)
- grub-theme-medion (requires grub)
- grub-theme-minegrub (requires grub)
- grub-theme-minegrub-git (requires grub)
- grub-theme-msi (requires grub)
- grub-theme-mx-linux (requires grub)
- grub-theme-nixos (requires grub)
- grub-theme-opensuse (requires grub)
- grub-theme-parabola (requires grub)
- grub-theme-pop-os (requires grub)
- grub-theme-razer (requires grub)
- grub-theme-reaper-color-1080p-git (requires grub)
- grub-theme-reaper-color-1440p-git (requires grub)
- grub-theme-reaper-white-1080p-git (requires grub)
- grub-theme-reaper-white-1440p-git (requires grub)
- grub-theme-redskull-color-1080p-git (requires grub)
- grub-theme-redskull-color-1440p-git (requires grub)
- grub-theme-redskull-white-1080p-git (requires grub)
- grub-theme-redskull-white-1440p-git (requires grub)
- grub-theme-rocky-linux (requires grub)
- grub-theme-samsung (requires grub)
- grub-theme-singularity (requires grub)
- grub-theme-sitedown-color-1080p-git (requires grub)
- grub-theme-sitedown-color-1440p-git (requires grub)
- grub-theme-sitedown-white-1080p-git (requires grub)
- grub-theme-sitedown-white-1440p-git (requires grub)
- grub-theme-slackware (requires grub)
- grub-theme-solus (requires grub)
- grub-theme-spam-color-1080p-git (requires grub)
- grub-theme-spam-color-1440p-git (requires grub)
- grub-theme-spam-white-1080p-git (requires grub)
- grub-theme-spam-white-1440p-git (requires grub)
- grub-theme-spyware-color-1080p-git (requires grub)
- grub-theme-spyware-color-1440p-git (requires grub)
- grub-theme-spyware-white-1080p-git (requires grub)
- grub-theme-spyware-white-1440p-git (requires grub)
- grub-theme-stalker-color-1080p-git (requires grub)
- grub-theme-stalker-color-1440p-git (requires grub)
- grub-theme-stalker-white-1080p-git (requires grub)
- grub-theme-stalker-white-1440p-git (requires grub)
- grub-theme-strike-color-1080p-git (requires grub)
- grub-theme-strike-color-1440p-git (requires grub)
- grub-theme-strike-white-1080p-git (requires grub)
- grub-theme-strike-white-1440p-git (requires grub)
- grub-theme-stylish-color-1080p-git (requires grub)
- grub-theme-stylish-color-2k-git (requires grub)
- grub-theme-stylish-color-4k-git (requires grub)
- grub-theme-stylish-color-ultrawide-git (requires grub)
- grub-theme-stylish-color-ultrawide2k-git (requires grub)
- grub-theme-stylish-white-1080p-git (requires grub)
- grub-theme-stylish-white-2k-git (requires grub)
- grub-theme-stylish-white-4k-git (requires grub)
- grub-theme-stylish-white-ultrawide-git (requires grub)
- grub-theme-stylish-white-ultrawide2k-git (requires grub)
- grub-theme-stylish-whitesur-1080p-git (requires grub)
- grub-theme-stylish-whitesur-2k-git (requires grub)
- grub-theme-stylish-whitesur-4k-git (requires grub)
- grub-theme-stylish-whitesur-ultrawide-git (requires grub)
- grub-theme-stylish-whitesur-ultrawide2k-git (requires grub)
- grub-theme-system76 (requires grub)
- grub-theme-tela-color-1080p-git (requires grub)
- grub-theme-tela-color-2k-git (requires grub)
- grub-theme-tela-color-4k-git (requires grub)
- grub-theme-tela-color-ultrawide-git (requires grub)
- grub-theme-tela-color-ultrawide2k-git (requires grub)
- grub-theme-tela-white-1080p-git (requires grub)
- grub-theme-tela-white-2k-git (requires grub)
- grub-theme-tela-white-4k-git (requires grub)
- grub-theme-tela-white-ultrawide-git (requires grub)
- grub-theme-tela-white-ultrawide2k-git (requires grub)
- grub-theme-tela-whitesur-1080p-git (requires grub)
- grub-theme-tela-whitesur-2k-git (requires grub)
- grub-theme-tela-whitesur-4k-git (requires grub)
- grub-theme-tela-whitesur-ultrawide-git (requires grub)
- grub-theme-tela-whitesur-ultrawide2k-git (requires grub)
- grub-theme-thinkpad (requires grub)
- grub-theme-toshiba (requires grub)
- grub-theme-tremor-color-1080p-git (requires grub)
- grub-theme-tremor-color-1440p-git (requires grub)
- grub-theme-tremor-white-1080p-git (requires grub)
- grub-theme-tremor-white-1440p-git (requires grub)
- grub-theme-trolls-color-1080p-git (requires grub)
- grub-theme-trolls-color-1440p-git (requires grub)
- grub-theme-trolls-white-1080p-git (requires grub)
- grub-theme-trolls-white-1440p-git (requires grub)
- grub-theme-ubuntu-mate (requires grub)
- grub-theme-ultramarine (requires grub)
- grub-theme-unite-color-1080p-git (requires grub)
- grub-theme-unite-color-1440p-git (requires grub)
- grub-theme-unite-white-1080p-git (requires grub)
- grub-theme-unite-white-1440p-git (requires grub)
- grub-theme-vaio (requires grub)
- grub-theme-ventoy (requires grub)
- grub-theme-vimix-color-1080p-git (requires grub)
- grub-theme-vimix-color-2k-git (requires grub)
- grub-theme-vimix-color-4k-git (requires grub)
- grub-theme-vimix-color-ultrawide-git (requires grub)
- grub-theme-vimix-color-ultrawide2k-git (requires grub)
- grub-theme-vimix-very-dark-blue (requires grub)
- grub-theme-vimix-white-1080p-git (requires grub)
- grub-theme-vimix-white-2k-git (requires grub)
- grub-theme-vimix-white-4k-git (requires grub)
- grub-theme-vimix-white-ultrawide-git (requires grub)
- grub-theme-vimix-white-ultrawide2k-git (requires grub)
- grub-theme-vimix-whitesur-1080p-git (requires grub)
- grub-theme-vimix-whitesur-2k-git (requires grub)
- grub-theme-vimix-whitesur-4k-git (requires grub)
- grub-theme-vimix-whitesur-ultrawide-git (requires grub)
- grub-theme-vimix-whitesur-ultrawide2k-git (requires grub)
- grub-theme-void-linux (requires grub)
- grub-theme-wannacry-color-1080p-git (requires grub)
- grub-theme-wannacry-color-1440p-git (requires grub)
- grub-theme-wannacry-white-1080p-git (requires grub)
- grub-theme-wannacry-white-1440p-git (requires grub)
- grub-theme-whitesur-color-1080p-git (requires grub)
- grub-theme-whitesur-color-2k-git (requires grub)
- grub-theme-whitesur-color-4k-git (requires grub)
- grub-theme-whitesur-white-1080p-git (requires grub)
- grub-theme-whitesur-white-2k-git (requires grub)
- grub-theme-whitesur-white-4k-git (requires grub)
- grub-theme-whitesur-whitesur-1080p-git (requires grub)
- grub-theme-whitesur-whitesur-2k-git (requires grub)
- grub-theme-whitesur-whitesur-4k-git (requires grub)
- grub-theme-windows-10 (requires grub)
- grub-theme-windows-11 (requires grub)
- grub-theme-wrench-color-1080p-git (requires grub)
- grub-theme-wrench-color-1440p-git (requires grub)
- grub-theme-wrench-white-1080p-git (requires grub)
- grub-theme-wrench-white-1440p-git (requires grub)
- grub-theme-xero-linux (requires grub)
- grub-theme-zorin-bin (requires grub)
- grub-theme-zorin-os (requires grub)
- grub2-filemanager-git (requires grub) (make)
- grub2-signing-extension (requires grub)
- grub2-theme-arch-leap (requires grub)
- grub2-theme-arch-suse (requires grub)
- grub2-theme-archlinux (requires grub)
- grub2-theme-archxion (requires grub)
- grub2-theme-breeze-git (requires grub)
- grub2-theme-crt-amber-4k-git (requires grub)
- grub2-theme-cybersynchro (requires grub)
- grub2-theme-ettery (requires grub)
- grub2-theme-preview (requires grub)
- grub4dos-efi-git (requires grub) (optional)
- horizontal-grub (requires grub)
- image-bootstrap-git (requires grub) (optional)
- kcm-grub2-git (requires grub)
- linux-linode (requires grub)
- liveusb-builder-git (requires grub)
- memtest86-efi (requires grub) (optional)
- mkosi-git (requires grub) (optional)
- mkusb (requires grub)
- novix-devel-meta (requires grub)
- penguins-eggs (requires grub)
- plop-bootmanager (requires grub) (optional)
- plop-bootmanager-6-bin (requires grub) (optional)
- puzzle-bobble-grub2-theme (requires grub)
- rp-alt-grub (requires grub)
- sbsimple (requires grub) (optional)
- secureboot-grub (requires grub)
- sekiro-grub-theme-git (requires grub)
- starlabstheme-grub-git (requires grub)
- system-tar-and-restore (requires grub) (optional)
- system76-driver (requires grub) (optional)
- system76-driver-git (requires grub)
- systemback (requires grub)
- systemback-efiboot (requires grub) (make)
- teaiso (requires grub)
- terminus-font-td1 (requires grub) (make)
- ubuntu-kylin-theme (requires grub) (optional)
- update-grub (requires grub)
- usbmaker (requires grub) (optional)
- usbmaker-git (requires grub) (optional)
- woeusb (requires grub)
- woeusb-ng (requires grub)
- woeusb-ng-git (requires grub)
- woeusbgui (requires grub)
- zbectl-git (requires grub)
- zenbook-sound-fix-ux3405ma (requires grub) (optional)
- zfsbootmenu (requires grub) (optional)
- zfsbootmenu-efi-bin (requires grub) (optional)
Sources (12)
Ax333l commented on 2023-04-23 18:00 (UTC)
jroovy commented on 2023-04-23 15:31 (UTC)
Hi, I'm having trouble with this package
Since updating to latest version, it doesn't want to unlock luks partition with the error: error: Invalid passphrase
even when entered correctly
My configuration is as follows
/etc/default/grub:
GRUB_CMDLINE_LINUX="cryptdevice=UUID=<UUID_HERE>:root"
GRUB_ENABLE_CRYPTODISK=y
And I installed it with command:
sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB --removable
Any help would be appreciated. Thanks
Ax333l commented on 2023-04-20 16:57 (UTC) (edited on 2023-04-20 16:59 (UTC) by Ax333l)
All argon2 variants are supported. A UEFI installation is required due to the memory usage of argon2. An MBR installation on a UEFI system will not work.
grub-install --target=x86_64-efi
should work. Check the arch wiki for more info regarding how to install grub with UEFI.
If it fails to unlock at runtime, let me know.
necklace commented on 2023-04-19 07:57 (UTC) (edited on 2023-04-19 09:55 (UTC) by necklace)
Wow, thanks for this package! Amazing work.
I'm trying to set up this with Argon2id, but I just had the thought that maybe that one isn't supported? Edit: or maybe it is uefi? Can't get it to work..
Would you mind posting instructions for how you set this up yourself, maybe a blogpost or a gist?
Ax333l commented on 2023-02-05 00:05 (UTC)
Finally got time to update it. The patches are now much less likely to break in the future, so I have unpinned it.
randomxusr commented on 2023-01-03 11:30 (UTC)
Any chance this could go to the main repos? As it's quite useful
<deleted-account> commented on 2022-11-28 22:53 (UTC)
Hi. Isn't exactly a bug or something that compromises the usability, but the license shouldn't use commas (that's also making expac report a wrong license). Like this: license=('GPL3' 'CC0')
Ax333l commented on 2022-11-27 12:33 (UTC)
Thank you for notifying me. I will see how much needs to be done to update it, but I am not sure if I have time to do so this week. It depends on how much I need to change the patch.
mca2 commented on 2022-11-26 00:03 (UTC) (edited on 2022-11-26 00:15 (UTC) by mca2)
The build fails with the upstream commit that the grub package in the core repository is currently based on (1514678888595ef41a968a0c69b7ff769edd1e9c
). Two hunks in grub-install_luks2.patch
fail because there have been small modifications in grub-core/disk/luks2.c
upstream (see below).
Rejected hunks:
--- grub-core/disk/luks2.c
+++ grub-core/disk/luks2.c
@@ -353,8 +353,16 @@ luks2_scan (grub_disk_t disk, grub_cryptomount_args_t cargs)
{
grub_cryptodisk_t cryptodisk;
grub_luks2_header_t header;
+ grub_luks2_keyslot_t keyslot;
+ grub_luks2_digest_t digest;
+ grub_luks2_segment_t segment;
+ char cipher[32], *json_header = NULL, *ptr;
+ grub_size_t candidate_key_len = 0, json_idx, size;
char uuid[sizeof (header.uuid) + 1];
grub_size_t i, j;
+ grub_err_t ret;
+ gcry_md_spec_t *hash = NULL;
+ grub_json_t *json = NULL, keyslots;
if (cargs->check_boot)
return NULL;
@@ -545,15 +722,39 @@ luks2_scan (grub_disk_t disk, grub_cryptomount_args_t cargs)
return NULL;
}
- cryptodisk = grub_zalloc (sizeof (*cryptodisk));
- if (!cryptodisk)
- return NULL;
-
COMPILE_TIME_ASSERT (sizeof (cryptodisk->uuid) >= sizeof (uuid));
grub_memcpy (cryptodisk->uuid, uuid, sizeof (uuid));
+ hash = grub_crypto_lookup_md_by_name (digest.hash);
+ if (cryptodisk->hash) {
+ if (grub_strcmp(hash->name, cryptodisk->hash->name)) {
+ ret = grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, "LUKS2 Module does not support using multiple SHA versions.");
+ goto err;
+ }
+ } else
+ cryptodisk->hash = hash;
+
+ /* Set up disk cipher. */
+ grub_strncpy (cipher, segment.encryption, sizeof (cipher));
+ ptr = grub_memchr (cipher, '-', grub_strlen (cipher));
+ if (!ptr) {
+ ret = grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid encryption");
+ goto err;
+ }
+ *ptr = '\0';
+
+ ret = grub_cryptodisk_setcipher (cryptodisk, cipher, ptr + 1);
+ if (ret)
+ goto err;
+
+
cryptodisk->modname = "luks2";
return cryptodisk;
+err:
+ grub_free (json_header);
+ grub_json_free (json);
+ grub_errno = ret;
+ return NULL;
}
static grub_err_t
The upstream differences in grub-core/disk/luks2.c
between the commit this package is based on (e43f3d93b28cce852c110c7a8e40d8311bcd8bb1
) and the current commit (1514678888595ef41a968a0c69b7ff769edd1e9c
) are:
diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c
index bf741d70f..d5106402f 100644
--- a/grub-core/disk/luks2.c
+++ b/grub-core/disk/luks2.c
@@ -350,8 +350,6 @@ luks2_scan (grub_disk_t disk, grub_cryptomount_args_t cargs)
{
grub_cryptodisk_t cryptodisk;
grub_luks2_header_t header;
- char uuid[sizeof (header.uuid) + 1];
- grub_size_t i, j;
if (cargs->check_boot)
return NULL;
@@ -362,14 +360,9 @@ luks2_scan (grub_disk_t disk, grub_cryptomount_args_t cargs)
return NULL;
}
- for (i = 0, j = 0; i < sizeof (header.uuid); i++)
- if (header.uuid[i] != '-')
- uuid[j++] = header.uuid[i];
- uuid[j] = '\0';
-
- if (cargs->search_uuid != NULL && grub_strcasecmp (cargs->search_uuid, uuid) != 0)
+ if (cargs->search_uuid != NULL && grub_uuidcasecmp (cargs->search_uuid, header.uuid, sizeof (header.uuid)) != 0)
{
- grub_dprintf ("luks2", "%s != %s\n", uuid, cargs->search_uuid);
+ grub_dprintf ("luks2", "%s != %s\n", header.uuid, cargs->search_uuid);
return NULL;
}
@@ -377,13 +370,31 @@ luks2_scan (grub_disk_t disk, grub_cryptomount_args_t cargs)
if (!cryptodisk)
return NULL;
- COMPILE_TIME_ASSERT (sizeof (cryptodisk->uuid) >= sizeof (uuid));
- grub_memcpy (cryptodisk->uuid, uuid, sizeof (uuid));
+ COMPILE_TIME_ASSERT (sizeof (cryptodisk->uuid) >= sizeof (header.uuid));
+ grub_memcpy (cryptodisk->uuid, header.uuid, sizeof (header.uuid));
cryptodisk->modname = "luks2";
return cryptodisk;
}
+static grub_err_t
+luks2_base64_decode (const char *in, grub_size_t inlen, grub_uint8_t *decoded, idx_t *decodedlen)
+{
+ grub_size_t unescaped_len = 0;
+ char *unescaped = NULL;
+ bool successful;
+
+ if (grub_json_unescape (&unescaped, &unescaped_len, in, inlen) != GRUB_ERR_NONE)
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("could not unescape Base64 string"));
+
+ successful = base64_decode (unescaped, unescaped_len, (char *) decoded, decodedlen);
+ grub_free (unescaped);
+ if (!successful)
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("could not decode Base64 string"));
+
+ return GRUB_ERR_NONE;
+}
+
static grub_err_t
luks2_verify_key (grub_luks2_digest_t *d, grub_uint8_t *candidate_key,
grub_size_t candidate_key_len)
@@ -395,9 +406,11 @@ luks2_verify_key (grub_luks2_digest_t *d, grub_uint8_t *candidate_key,
gcry_err_code_t gcry_ret;
/* Decode both digest and salt */
- if (!base64_decode (d->digest, grub_strlen (d->digest), (char *)digest, &digestlen))
+ if (luks2_base64_decode (d->digest, grub_strlen (d->digest),
+ digest, &digestlen) != GRUB_ERR_NONE)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid digest");
- if (!base64_decode (d->salt, grub_strlen (d->salt), (char *)salt, &saltlen))
+ if (luks2_base64_decode (d->salt, grub_strlen (d->salt),
+ salt, &saltlen) != GRUB_ERR_NONE)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid digest salt");
/* Configure the hash used for the digest. */
@@ -435,8 +448,8 @@ luks2_decrypt_key (grub_uint8_t *out_key,
gcry_err_code_t gcry_ret;
grub_err_t ret;
- if (!base64_decode (k->kdf.salt, grub_strlen (k->kdf.salt),
- (char *)salt, &saltlen))
+ if (luks2_base64_decode (k->kdf.salt, grub_strlen (k->kdf.salt),
+ salt, &saltlen) != GRUB_ERR_NONE)
{
ret = grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid keyslot salt");
goto err;
@@ -610,7 +623,15 @@ luks2_recover_key (grub_disk_t source,
grub_errno = GRUB_ERR_NONE;
ret = luks2_get_keyslot (&keyslot, &digest, &segment, json, json_idx);
if (ret)
- goto err;
+ {
+ /*
+ * luks2_get_keyslot() can fail for a variety of reasons that do not
+ * necessarily mean the next keyslot should not be tried (e.g. a new
+ * kdf type). So always try the next slot.
+ */
+ grub_dprintf ("luks2", "Failed to get keyslot %" PRIuGRUB_UINT64_T "\n", keyslot.idx);
+ continue;
+ }
if (grub_errno != GRUB_ERR_NONE)
grub_dprintf ("luks2", "Ignoring unhandled error %d from luks2_get_keyslot\n", grub_errno);
So patching the current upstream commit with grub-install_luks2.patch
fails because of these minor changes:
@@ -350,8 +350,6 @@ luks2_scan (grub_disk_t disk, grub_cryptomount_args_t cargs)
@@ -362,14 +360,9 @@ luks2_scan (grub_disk_t disk, grub_cryptomount_args_t cargs)
@@ -377,13 +370,31 @@ luks2_scan (grub_disk_t disk, grub_cryptomount_args_t cargs)
Can you update grub-install_luks2.patch
accordingly please, Ax333l? (There may be more issues to fix after these ones are taken care of.)
Pinned Comments
Ax333l commented on 2022-02-17 18:58 (UTC) (edited on 2023-06-16 14:24 (UTC) by Ax333l)
I have disabled translations because they have been the cause of build failures in both this package and
grub-git
. If you want to re-enable them, check the PKGBUILD.Also, make sure you have installed
base-devel
.Argon2 might not work on some devices due to issues with the memory allocator