From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1ikrNm-0002hQ-9u for mharc-grub-devel@gnu.org; Fri, 27 Dec 2019 10:18:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48943) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ikrNi-0002eI-T5 for grub-devel@gnu.org; Fri, 27 Dec 2019 10:18:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ikrNh-00007c-Lj for grub-devel@gnu.org; Fri, 27 Dec 2019 10:18:26 -0500 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:45629) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ikrNh-00007O-IF for grub-devel@gnu.org; Fri, 27 Dec 2019 10:18:25 -0500 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 3B4A721E5B; Fri, 27 Dec 2019 10:18:25 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Fri, 27 Dec 2019 10:18:25 -0500 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=24+FKzdJiTOsE JqvZlFdZhmF/1VL6nY7oMAgzbh5Z9w=; b=E1JAKHWlbJPRw1MTVSBJCWJEUv2yx WEemefYHBSnBwwSLDJ/+7sFdXl3WceAjevJQOhgvH29JaADzIVATApP2VN8IWXqC ywpmrdgErv9St0VER1YOsRwSZKIvel17Ow6ch4OJlCdGZh+ZO7LJeBfnD9oMoDe+ ha9pA2xiHqJFhJsN2Bm9d/KNKlppIhIwfkv27sCl4/9WnIfNM/GGvBRrMIcKjCe9 ZCZyckG6/vhp1BAX1tGo7RUmXgOaSGFnxawqDIVlmK9bMZxyBRbADnsqSjyn2Mq9 hh/iAlt0vT2vycFgjQ+c28ORG74znJr8LUUBLlDeUu9rFxvNjzxeQrdCA== 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=24+FKzdJiTOsEJqvZlFdZhmF/1VL6nY7oMAgzbh5Z9w=; b=AVTgY8hd kamG/5yKtvV1W/3zeAYiSFkeoFrXlVDdULYCX29+1AmT5fq5Rqk5AqE+hm7ou8FQ vbV34jFdKZypvYtnaZJSapXRRBpyk7x8Vz3YLpAj8AW6fHVivdVvMAcs54C35Egt T3ITwwEe8JCEFYOsMKHc3afkPNEpDNB6OHba7k0NBzya48O8/7JBik4hsM/gD0e2 OF7Qp1pLtBmwTd42iaGjByyJ+3+YJdp05BuXLwanyzJsfrq/liHi43mXCwWxU4Xr BF/oEy3lIjlCj12DzZM9yfXZxUFc5679aITctPznBsNpnX3FKX0o3pS7OlzaWdoW i/468S7TiRWMEg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrvddvkedgjeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefrrghtrhhi tghkucfuthgvihhnhhgrrhguthcuoehpshesphhkshdrihhmqeenucfkphepkeelrdduvd drudeifedrgeelnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpshesphhkshdrihhmnecu vehluhhsthgvrhfuihiivgepud X-ME-Proxy: Received: from vm-mail (x590ca331.dyn.telefonica.de [89.12.163.49]) by mail.messagingengine.com (Postfix) with ESMTPA id 809E080062; Fri, 27 Dec 2019 10:18:24 -0500 (EST) Received: from localhost ( [10.192.0.11]) by vm-mail (OpenSMTPD) with ESMTPSA id 44b8e338 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 27 Dec 2019 15:18:20 +0000 (UTC) From: Patrick Steinhardt To: grub-devel@gnu.org Cc: Patrick Steinhardt , Daniel Kiper , Daniel Kiper Subject: [PATCH v7 3/6] bootstrap: Add gnulib's base64 module Date: Fri, 27 Dec 2019 16:18:36 +0100 Message-Id: X-Mailer: git-send-email 2.24.1 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: 66.111.4.26 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: Fri, 27 Dec 2019 15:18:28 -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. A second fix is required to make available `_GL_ATTRIBUTE_CONST`, which is provided by the configure script. As "base64.h" does not include , it is thus not available and results in a compile error. This is fixed by adding an include of . Signed-off-by: Patrick Steinhardt Reviewed-by: Daniel Kiper --- bootstrap.conf | 3 ++- conf/Makefile.extra-dist | 1 + grub-core/lib/gnulib-patches/fix-base64.patch | 23 +++++++++++++++++++ 3 files changed, 26 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..e075b6fab --- /dev/null +++ b/grub-core/lib/gnulib-patches/fix-base64.patch @@ -0,0 +1,23 @@ +diff --git a/lib/base64.h b/lib/base64.h +index 9cd0183b8..a2aaa2d4a 100644 +--- a/lib/base64.h ++++ b/lib/base64.h +@@ -18,11 +18,16 @@ + #ifndef BASE64_H + # define BASE64_H + ++/* Get _GL_ATTRIBUTE_CONST */ ++# include ++ + /* 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" { -- 2.24.1