From 5d581ad75e5c9008195f88c7cb885dca0aff7707 Mon Sep 17 00:00:00 2001 From: Ruben Rodriguez <ruben@trisquel.info> Date: Tue, 30 Apr 2019 22:40:01 -0400 Subject: [PATCH] Removed upstreamed changes to libsdl1.2 --- ...4-Cryptomount-support-plain-dm-crypt.patch | 72 ++++++++---- ...or-using-a-whole-device-as-a-keyfile.patch | 111 ++++++++++++++++++ helpers/DATA/libsdl1.2/no-riva-accel.patch | 24 ---- helpers/make-grub2 | 5 - helpers/make-libsdl1.2 | 33 ------ 5 files changed, 157 insertions(+), 88 deletions(-) create mode 100644 helpers/DATA/grub2/0007-Add-support-for-using-a-whole-device-as-a-keyfile.patch delete mode 100644 helpers/DATA/libsdl1.2/no-riva-accel.patch delete mode 100644 helpers/make-libsdl1.2 diff --git a/helpers/DATA/grub2/0004-Cryptomount-support-plain-dm-crypt.patch b/helpers/DATA/grub2/0004-Cryptomount-support-plain-dm-crypt.patch index 0285b5c6..34c10d72 100644 --- a/helpers/DATA/grub2/0004-Cryptomount-support-plain-dm-crypt.patch +++ b/helpers/DATA/grub2/0004-Cryptomount-support-plain-dm-crypt.patch @@ -1,8 +1,16 @@ -From c584bacaad58facb9124df26f98fff2542f7237a Mon Sep 17 00:00:00 2001 +From a8f9e3dcece89c179e89414abe89985c7ab1e03f Mon Sep 17 00:00:00 2001 From: John Lane <john@lane.uk.net> Date: Fri, 26 Jun 2015 22:09:52 +0100 -Subject: [PATCH 4/5] Cryptomount support plain dm-crypt +Subject: [PATCH 4/7] Cryptomount support plain dm-crypt +Patch modified to take into account a change to context +brought about by c93d3e694713b8230fa2cf88414fabe005b56782 + +grub-core/disk/cryptodisk.c +142c142 +< if (disklast) +--- +> --- grub-core/disk/cryptodisk.c | 298 +++++++++++++++++++++++++++++++++++++++++++- grub-core/disk/luks.c | 195 +---------------------------- @@ -10,10 +18,10 @@ Subject: [PATCH 4/5] Cryptomount support plain dm-crypt 3 files changed, 310 insertions(+), 191 deletions(-) diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c -index a27e70c..cd5cfc9 100644 +index 5261af547..7f656f75c 100644 --- a/grub-core/disk/cryptodisk.c +++ b/grub-core/disk/cryptodisk.c -@@ -44,6 +44,12 @@ static const struct grub_arg_option options[] = +@@ -45,6 +45,12 @@ static const struct grub_arg_option options[] = {"keyfile", 'k', 0, N_("Key file"), 0, ARG_TYPE_STRING}, {"keyfile-offset", 'O', 0, N_("Key file offset (bytes)"), 0, ARG_TYPE_INT}, {"keyfile-size", 'S', 0, N_("Key file data size (bytes)"), 0, ARG_TYPE_INT}, @@ -26,7 +34,7 @@ index a27e70c..cd5cfc9 100644 {0, 0, 0, 0, 0, 0} }; -@@ -927,6 +933,48 @@ grub_cryptodisk_scan_device (const char *name, +@@ -933,6 +939,48 @@ grub_cryptodisk_scan_device (const char *name, return have_it && search_uuid ? 1 : 0; } @@ -75,11 +83,11 @@ index a27e70c..cd5cfc9 100644 static grub_err_t grub_cmd_cryptomount (grub_extcmd_context_t ctxt, int argc, char **args) { -@@ -1085,7 +1085,63 @@ +@@ -1060,7 +1108,63 @@ grub_cmd_cryptomount (grub_extcmd_context_t ctxt, int argc, char **args) return GRUB_ERR_NONE; } -- err = grub_cryptodisk_scan_device_real (args[0], disk); +- err = grub_cryptodisk_scan_device_real (diskname, disk); + if (state[7].set) /* Plain mode */ + { + char *cipher; @@ -92,7 +100,7 @@ index a27e70c..cd5cfc9 100644 + offset = state[10].set ? grub_strtoul (state[10].arg, 0, 0) : 0; + size = state[11].set ? grub_strtoul (state[11].arg, 0, 0) : 0; + key_size = ( state[12].set ? grub_strtoul (state[12].arg, 0, 0) \ -+ : GRUB_CRYPTODISK_PLAIN_KEYSIZE ) / 8; ++ : GRUB_CRYPTODISK_PLAIN_KEYSIZE ) / 8; + + /* no strtok, do it manually */ + mode = grub_strchr(cipher,'-'); @@ -104,16 +112,16 @@ index a27e70c..cd5cfc9 100644 + dev = grub_cryptodisk_create (disk, NULL, cipher, mode, digest); + + dev->offset = offset; -+ if (size) dev->total_length = size; ++ if (size) dev->total_length = size; + + if (key) -+ { ++ { + err = grub_cryptodisk_setkey (dev, key, key_size); + if (err) + return err; -+ } -+ else -+ { ++ } ++ else ++ { + char passphrase[GRUB_CRYPTODISK_MAX_PASSPHRASE] = ""; + + grub_printf_ (N_("Enter passphrase for %s: "), diskname); @@ -126,7 +134,7 @@ index a27e70c..cd5cfc9 100644 + grub_crypto_cipher_close (dev->cipher); + return err; + } -+ } ++ } + + grub_cryptodisk_insert (dev, diskname, disk); + @@ -139,8 +147,8 @@ index a27e70c..cd5cfc9 100644 + err = grub_cryptodisk_scan_device_real (diskname, disk); grub_disk_close (disk); - -@@ -1177,13 +1281,203 @@ struct grub_procfs_entry luks_script = + if (disklast) +@@ -1193,13 +1297,203 @@ struct grub_procfs_entry luks_script = .get_contents = luks_script_get }; @@ -346,7 +354,7 @@ index a27e70c..cd5cfc9 100644 grub_procfs_register ("luks_script", &luks_script); } diff --git a/grub-core/disk/luks.c b/grub-core/disk/luks.c -index 11e437e..4ebe21b 100644 +index 11e437edb..4ebe21b4e 100644 --- a/grub-core/disk/luks.c +++ b/grub-core/disk/luks.c @@ -30,8 +30,6 @@ @@ -391,7 +399,7 @@ index 11e437e..4ebe21b 100644 /* Make sure that strings are null terminated. */ grub_memcpy (ciphername, header.cipherName, sizeof (header.cipherName)); ciphername[sizeof (header.cipherName)] = 0; -@@ -128,172 +128,9 @@ +@@ -137,184 +128,10 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid, grub_memcpy (hashspec, header.hashSpec, sizeof (header.hashSpec)); hashspec[sizeof (header.hashSpec)] = 0; @@ -412,6 +420,7 @@ index 11e437e..4ebe21b 100644 - { - grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid keysize %d", - grub_be_to_cpu32 (header.keyBytes)); +- grub_crypto_cipher_close (cipher); - return NULL; - } - @@ -450,9 +459,10 @@ index 11e437e..4ebe21b 100644 - } - if (cipher->cipher->blocksize != GRUB_CRYPTODISK_GF_BYTES) - { -- grub_crypto_cipher_close (cipher); - grub_error (GRUB_ERR_BAD_ARGUMENT, "Unsupported XTS block size: %d", - cipher->cipher->blocksize); +- grub_crypto_cipher_close (cipher); +- grub_crypto_cipher_close (secondary_cipher); - return NULL; - } - if (secondary_cipher->cipher->blocksize != GRUB_CRYPTODISK_GF_BYTES) @@ -460,6 +470,7 @@ index 11e437e..4ebe21b 100644 - grub_crypto_cipher_close (cipher); - grub_error (GRUB_ERR_BAD_ARGUMENT, "Unsupported XTS block size: %d", - secondary_cipher->cipher->blocksize); +- grub_crypto_cipher_close (secondary_cipher); - return NULL; - } - } @@ -469,9 +480,9 @@ index 11e437e..4ebe21b 100644 - cipheriv = ciphermode + sizeof ("lrw-") - 1; - if (cipher->cipher->blocksize != GRUB_CRYPTODISK_GF_BYTES) - { -- grub_crypto_cipher_close (cipher); - grub_error (GRUB_ERR_BAD_ARGUMENT, "Unsupported LRW block size: %d", - cipher->cipher->blocksize); +- grub_crypto_cipher_close (cipher); - return NULL; - } - } @@ -494,6 +505,7 @@ index 11e437e..4ebe21b 100644 - || cipher->cipher->blocksize == 0) - grub_error (GRUB_ERR_BAD_ARGUMENT, "Unsupported benbi blocksize: %d", - cipher->cipher->blocksize); +- /* FIXME should we return an error here? */ - for (benbi_log = 0; - (cipher->cipher->blocksize << benbi_log) < GRUB_DISK_SECTOR_SIZE; - benbi_log++); @@ -512,6 +524,7 @@ index 11e437e..4ebe21b 100644 - if (!essiv_hash) - { - grub_crypto_cipher_close (cipher); +- grub_crypto_cipher_close (secondary_cipher); - grub_error (GRUB_ERR_FILE_NOT_FOUND, - "Couldn't load %s hash", hash_str); - return NULL; @@ -520,12 +533,14 @@ index 11e437e..4ebe21b 100644 - if (!essiv_cipher) - { - grub_crypto_cipher_close (cipher); +- grub_crypto_cipher_close (secondary_cipher); - return NULL; - } - } - else - { - grub_crypto_cipher_close (cipher); +- grub_crypto_cipher_close (secondary_cipher); - grub_error (GRUB_ERR_BAD_ARGUMENT, "Unknown IV mode: %s", - cipheriv); - return NULL; @@ -542,12 +557,17 @@ index 11e437e..4ebe21b 100644 - hashspec); - return NULL; - } -- ++ newdev = grub_cryptodisk_create (disk, uuid, ciphername, ciphermode, hashspec); + - newdev = grub_zalloc (sizeof (struct grub_cryptodisk)); - if (!newdev) -- return NULL; +- { +- grub_crypto_cipher_close (cipher); +- grub_crypto_cipher_close (essiv_cipher); +- grub_crypto_cipher_close (secondary_cipher); +- return NULL; +- } - newdev->cipher = cipher; -+ newdev = grub_cryptodisk_create (disk, uuid, ciphername, ciphermode, hashspec); newdev->offset = grub_be_to_cpu32 (header.payloadOffset); - newdev->source_disk = NULL; - newdev->benbi_log = benbi_log; @@ -593,7 +613,7 @@ index 11e437e..4ebe21b 100644 grub_free (split_key); return grub_error (GRUB_ERR_BAD_ARGUMENT, "Passphrase not supplied"); diff --git a/include/grub/cryptodisk.h b/include/grub/cryptodisk.h -index 0299625..4076412 100644 +index 67f6b0b59..bb25ab730 100644 --- a/include/grub/cryptodisk.h +++ b/include/grub/cryptodisk.h @@ -54,9 +54,14 @@ typedef enum @@ -611,7 +631,7 @@ index 0299625..4076412 100644 struct grub_cryptodisk; typedef gcry_err_code_t -@@ -159,4 +164,7 @@ grub_util_get_geli_uuid (const char *dev); +@@ -160,4 +165,7 @@ grub_util_get_geli_uuid (const char *dev); grub_cryptodisk_t grub_cryptodisk_get_by_uuid (const char *uuid); grub_cryptodisk_t grub_cryptodisk_get_by_source_disk (grub_disk_t disk); @@ -620,5 +640,5 @@ index 0299625..4076412 100644 + #endif -- -2.1.2 +2.16.2 diff --git a/helpers/DATA/grub2/0007-Add-support-for-using-a-whole-device-as-a-keyfile.patch b/helpers/DATA/grub2/0007-Add-support-for-using-a-whole-device-as-a-keyfile.patch new file mode 100644 index 00000000..0c45a8c3 --- /dev/null +++ b/helpers/DATA/grub2/0007-Add-support-for-using-a-whole-device-as-a-keyfile.patch @@ -0,0 +1,111 @@ +From ef720d0d44b8d97a83950ced0df1ce1bcf8cd988 Mon Sep 17 00:00:00 2001 +From: Paul Gideon Dann <pdgiddie@gmail.com> +Date: Tue, 19 Jul 2016 12:36:37 +0100 +Subject: [PATCH 7/7] Add support for using a whole device as a keyfile + +--- + grub-core/disk/cryptodisk.c | 86 +++++++++++++++++++++++++++++++++++---------- + 1 file changed, 68 insertions(+), 18 deletions(-) + +diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c +index 6fc2c23aa..a8937e5e3 100644 +--- a/grub-core/disk/cryptodisk.c ++++ b/grub-core/disk/cryptodisk.c +@@ -1032,26 +1032,76 @@ grub_cmd_cryptomount (grub_extcmd_context_t ctxt, int argc, char **args) + else + { + keyfile_offset = state[5].set ? grub_strtoul (state[5].arg, 0, 0) : 0; +- keyfile_size = requested_keyfile_size ? requested_keyfile_size : \ +- GRUB_CRYPTODISK_MAX_KEYFILE_SIZE; +- +- keyfile = grub_file_open (state[4].arg); +- if (!keyfile) +- grub_printf (N_("Unable to open key file %s\n"), state[4].arg); +- else if (grub_file_seek (keyfile, keyfile_offset) == (grub_off_t)-1) +- grub_printf (N_("Unable to seek to offset %d in key file\n"), keyfile_offset); +- else ++ ++ if (grub_strchr (state[4].arg, '/')) + { +- keyfile_size = grub_file_read (keyfile, keyfile_buffer, keyfile_size); +- if (keyfile_size == (grub_size_t)-1) +- grub_printf (N_("Error reading key file\n")); +- else if (requested_keyfile_size && (keyfile_size != requested_keyfile_size)) +- grub_printf (N_("Cannot read %llu bytes for key file (read %llu bytes)\n"), +- (unsigned long long) requested_keyfile_size, +- (unsigned long long) keyfile_size); ++ keyfile_size = requested_keyfile_size ? requested_keyfile_size : \ ++ GRUB_CRYPTODISK_MAX_KEYFILE_SIZE; ++ keyfile = grub_file_open (state[4].arg); ++ if (!keyfile) ++ grub_printf (N_("Unable to open key file %s\n"), state[4].arg); ++ else if (grub_file_seek (keyfile, keyfile_offset) == (grub_off_t)-1) ++ grub_printf (N_("Unable to seek to offset %d in key file\n"), keyfile_offset); + else +- key = keyfile_buffer; +- } ++ { ++ keyfile_size = grub_file_read (keyfile, keyfile_buffer, keyfile_size); ++ if (keyfile_size == (grub_size_t)-1) ++ grub_printf (N_("Error reading key file\n")); ++ else if (requested_keyfile_size && (keyfile_size != requested_keyfile_size)) ++ grub_printf (N_("Cannot read %llu bytes for key file (read %llu bytes)\n"), ++ (unsigned long long) requested_keyfile_size, ++ (unsigned long long) keyfile_size); ++ else ++ key = keyfile_buffer; ++ } ++ } ++ else ++ { ++ grub_disk_t keydisk; ++ char* keydisk_name; ++ grub_err_t err; ++ grub_uint64_t total_sectors; ++ ++ keydisk_name = grub_file_get_device_name(state[4].arg); ++ keydisk = grub_disk_open (keydisk_name); ++ if (!keydisk) ++ { ++ grub_printf (N_("Unable to open disk %s\n"), keydisk_name); ++ goto cleanup_keydisk_name; ++ } ++ ++ total_sectors = grub_disk_get_size (keydisk); ++ if (total_sectors == GRUB_DISK_SIZE_UNKNOWN) ++ { ++ grub_printf (N_("Unable to determine size of disk %s\n"), keydisk_name); ++ goto cleanup_keydisk; ++ } ++ ++ keyfile_size = (total_sectors << GRUB_DISK_SECTOR_BITS); ++ if (requested_keyfile_size > 0 && requested_keyfile_size < keyfile_size) ++ keyfile_size = requested_keyfile_size; ++ if (keyfile_size > GRUB_CRYPTODISK_MAX_KEYFILE_SIZE) ++ { ++ grub_printf (N_("Key file size exceeds maximum (%llu)\n"), \ ++ (unsigned long long) GRUB_CRYPTODISK_MAX_KEYFILE_SIZE); ++ goto cleanup_keydisk; ++ } ++ ++ err = grub_disk_read (keydisk, 0, keyfile_offset, keyfile_size, keyfile_buffer); ++ if (err != GRUB_ERR_NONE) ++ { ++ grub_printf (N_("Failed to read from disk %s\n"), keydisk_name); ++ keyfile_size = 0; ++ goto cleanup_keydisk; ++ } ++ ++ key = keyfile_buffer; ++ ++ cleanup_keydisk: ++ grub_disk_close (keydisk); ++ cleanup_keydisk_name: ++ grub_free (keydisk_name); ++ } + } + } + +-- +2.16.2 + diff --git a/helpers/DATA/libsdl1.2/no-riva-accel.patch b/helpers/DATA/libsdl1.2/no-riva-accel.patch deleted file mode 100644 index 89f8ebee..00000000 --- a/helpers/DATA/libsdl1.2/no-riva-accel.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- src/video/fbcon/SDL_fbvideo.c.orig 2011-09-08 17:30:03.670583685 +0200 -+++ src/video/fbcon/SDL_fbvideo.c 2011-09-08 17:30:24.230582737 +0200 -@@ -46,7 +46,6 @@ - #include "SDL_fbevents_c.h" - #include "SDL_fb3dfx.h" - #include "SDL_fbmatrox.h" --#include "SDL_fbriva.h" - - /*#define FBCON_DEBUG*/ - -@@ -769,13 +768,6 @@ - #endif - FB_3DfxAccel(this, finfo.accel); - break; -- case FB_ACCEL_NV3: -- case FB_ACCEL_NV4: --#ifdef FBACCEL_DEBUG -- printf("NVidia hardware accelerator!\n"); --#endif -- FB_RivaAccel(this, finfo.accel); -- break; - default: - #ifdef FBACCEL_DEBUG - printf("Unknown hardware accelerator.\n"); diff --git a/helpers/make-grub2 b/helpers/make-grub2 index 4fc7239b..416e2712 100644 --- a/helpers/make-grub2 +++ b/helpers/make-grub2 @@ -47,11 +47,6 @@ replace Ubuntu Trisquel . replace ubuntu trisquel . find |grep ubuntu|xargs rename s/ubuntu/trisquel/ -GRUBVERSION=$(head -n1 debian/changelog |/bin/sed 's/.*(//;s/).*//; s/[~+-].*//') - -echo /bin/sed "/GNU GRUB version/ s/PACKAGE_VERSION/\"$GRUBVERSION\"/" -i grub-core/normal/main.c -/bin/sed "/GNU GRUB version/ s/PACKAGE_VERSION/\"$GRUBVERSION\"/" -i grub-core/normal/main.c - # Allow Windows and MacOX entries to boot without a password sed 's/class osx/class osx --unrestricted/; s/class windows/class osx --unrestricted/;' -i ./util/grub.d/30_os-prober.in diff --git a/helpers/make-libsdl1.2 b/helpers/make-libsdl1.2 deleted file mode 100644 index 7bc3f9a4..00000000 --- a/helpers/make-libsdl1.2 +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2011 Santiago RodrÃguez <santi@trisquel.info> -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# - -VERSION=1 -COMPONENT=main -. ./config - -# Origin: -# http://lists.nongnu.org/archive/html/gnu-linux-libre/2011-09/msg00001.html -rm src/video/fbcon/riva_mmio.h -rm src/video/fbcon/SDL_fbriva.c - -patch -p0 < $DATA/no-riva-accel.patch -changelog "Compiled for Trisquel" - -compile - -- GitLab