From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1iQxnu-0006pK-Tz for mharc-grub-devel@gnu.org; Sat, 02 Nov 2019 14:07:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51652) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iQxnr-0006ob-Du for grub-devel@gnu.org; Sat, 02 Nov 2019 14:07:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iQxnq-0002at-4b for grub-devel@gnu.org; Sat, 02 Nov 2019 14:07:11 -0400 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:35369) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iQxnp-0002Ug-OY for grub-devel@gnu.org; Sat, 02 Nov 2019 14:07:10 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id BBC45425 for ; Sat, 2 Nov 2019 14:07:07 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Sat, 02 Nov 2019 14:07:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=seaSw+MdATnoc WcJiQTJ0TUNZdGxVn7lrxAMY/pFWi0=; b=1a1VYNiZOSLVs55DHpJKUm7FWQWjY JImpbTK/RXfihK3qNQdo4B913f+BJ7V9H1QWI9yV1CzAaLHdZ1g3YiK9hrvoPbHT O8T/5ggI/R7LOKvxe/k5kIxkP3FG45waC5NAEUU8lY2N/Ku7L0gUOkrbbpoQBy2z 00iDdSTBfq1oMk8Tm37TkrVtcE0nxq09ujKCRItf0fPgdNBJYajR2sav6AhT0+oY oOqdQ6DFRsxZtkz2xn8DhV+bc48o5gQoR66DT8ec1r4n69yBEn6GwWpKbxiobcKJ otK5FV5dV3xdvxmnzPnsVvSemZ5gtlC4IafKEkdTgmToNFQs8y6/2zM7Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=seaSw+MdATnocWcJiQTJ0TUNZdGxVn7lrxAMY/pFWi0=; b=kRJpybsS /hiZ46S+wWVkjsXmjSPXV+8WAZyBdl6iLbNj/Z6te/Da1/kSG5mHWJ23ZkQ8XW2D N9chB0AUsUzqmaf/HJpmizjEHdWlieMLfmQanT77wMhylpAPcoY0I6Fw7HsJfsLT 1efbVTiYzRtXyPH+RRA4BlieUTWgVKWVi85IeRLtX47Ig/P1VhhkOK2KFeSDmIYf hPpccf+NxJrrEHk9qjZmNyJ5ysMJjHaTkkq+Xzfsjx8NM9PAyA+DZPnX1p5qfEv1 7St7NB47SmUj8Kx1IccERn73U0znks3OyijL9LYGH4ynNSYvthkM9g7yTb2B9WOQ sLgUB2UAuHFVVw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedruddtledguddtjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefrrghtrhhitghkucfuthgvihhnhhgrrhguthcuoehpshes phhkshdrihhmqeenucfkphepjeejrddukeefrddvtddvrdejfeenucfrrghrrghmpehmrg hilhhfrhhomhepphhssehpkhhsrdhimhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from NSJAIL (x4db7ca49.dyn.telefonica.de [77.183.202.73]) by mail.messagingengine.com (Postfix) with ESMTPA id BAFE13060062 for ; Sat, 2 Nov 2019 14:07:06 -0400 (EDT) Received: from localhost (10.192.0.11 [10.192.0.11]) by NSJAIL (OpenSMTPD) with ESMTPSA id a992116b (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sat, 2 Nov 2019 18:07:04 +0000 (UTC) From: Patrick Steinhardt To: grub-devel@gnu.org Cc: Patrick Steinhardt Subject: [PATCH 3/6] bootstrap: Add gnulib's base64 module Date: Sat, 2 Nov 2019 19:06:52 +0100 Message-Id: <886d2a055eed285759cff7cc9272116a8934f3d3.1572717208.git.ps@pks.im> X-Mailer: git-send-email 2.23.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.21 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Nov 2019 18:07:12 -0000 The upcoming support for LUKS2 disc encryption requires us to include a parser for base64-encoded data, as it is used to represent salts and digests. As gnulib already has code to decode such data, we can just add it to the boostrapping configuration in order to make it available in GRUB. The gnulib module makes use of booleans via the header. As GRUB does not provide any POSIX wrapper header for this, but instead implements support for `bool` in , we need to patch base64.h to not use anymore. We unfortunately cannot include instead, as it would then use gnulib's internal header while compiling the gnulib object but our own when including it in a GRUB module. Because of this, the patch replaces the include with a direct typedef. Signed-off-by: Patrick Steinhardt --- bootstrap.conf | 3 ++- conf/Makefile.extra-dist | 1 + grub-core/lib/gnulib-patches/fix-base64.patch | 26 +++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 grub-core/lib/gnulib-patches/fix-base64.patch diff --git a/bootstrap.conf b/bootstrap.conf index 988dda099..22b908f36 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -23,6 +23,7 @@ GNULIB_REVISION=d271f868a8df9bbec29049d01e056481b7a1a263 # directly. gnulib_modules=" argp + base64 error fnmatch getdelim @@ -78,7 +79,7 @@ cp -a INSTALL INSTALL.grub bootstrap_post_import_hook () { set -e - for patchname in fix-null-deref fix-width no-abort; do + for patchname in fix-base64 fix-null-deref fix-width no-abort; do patch -d grub-core/lib/gnulib -p2 \ < "grub-core/lib/gnulib-patches/$patchname.patch" done diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist index 46c4e95e2..32b217853 100644 --- a/conf/Makefile.extra-dist +++ b/conf/Makefile.extra-dist @@ -28,6 +28,7 @@ EXTRA_DIST += grub-core/gensymlist.sh EXTRA_DIST += grub-core/genemuinit.sh EXTRA_DIST += grub-core/genemuinitheader.sh +EXTRA_DIST += grub-core/lib/gnulib-patches/fix-base64.patch EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-deref.patch EXTRA_DIST += grub-core/lib/gnulib-patches/fix-width.patch EXTRA_DIST += grub-core/lib/gnulib-patches/no-abort.patch diff --git a/grub-core/lib/gnulib-patches/fix-base64.patch b/grub-core/lib/gnulib-patches/fix-base64.patch new file mode 100644 index 000000000..392f21fb1 --- /dev/null +++ b/grub-core/lib/gnulib-patches/fix-base64.patch @@ -0,0 +1,26 @@ +diff --git a/lib/base64.h b/lib/base64.h +index 9cd0183b8..7b06e03df 100644 +--- a/lib/base64.h ++++ b/lib/base64.h +@@ -21,8 +21,10 @@ + /* Get size_t. */ + # include + +-/* Get bool. */ +-# include ++#ifndef GRUB_POSIX_BOOL_DEFINED ++typedef enum { false = 0, true = 1 } bool; ++#define GRUB_POSIX_BOOL_DEFINED 1 ++#endif + + # ifdef __cplusplus + extern "C" { +@@ -38,7 +40,7 @@ struct base64_decode_context + char buf[4]; + }; + +-extern bool isbase64 (char ch) _GL_ATTRIBUTE_CONST; ++extern bool isbase64 (char ch); + + extern void base64_encode (const char *restrict in, size_t inlen, + char *restrict out, size_t outlen); -- 2.23.0