aboutsummaryrefslogtreecommitdiffstats
path: root/testing/efitools
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2019-08-30 17:48:28 +0300
committerTimo Teräs <timo.teras@iki.fi>2019-08-30 17:51:02 +0300
commitc8f276e61b44fb233f6e26cae65eb20919b5d8c5 (patch)
treee9adcdafefd51b04583981373aad5d7360e352b1 /testing/efitools
parent8aa5a8b4714c0ec182a324961b6d08d9424b5edc (diff)
downloadaports-c8f276e61b44fb233f6e26cae65eb20919b5d8c5.tar.bz2
aports-c8f276e61b44fb233f6e26cae65eb20919b5d8c5.tar.xz
testing/efitools: fix signature calculation
Remove the -fsigned-wchar hack which does not work in musl. Instead convert to honest uint16_t. This fixes setting Custom PK in Setup Mode.
Diffstat (limited to 'testing/efitools')
-rw-r--r--testing/efitools/003-fix-wchar_t.patch96
-rw-r--r--testing/efitools/APKBUILD6
2 files changed, 100 insertions, 2 deletions
diff --git a/testing/efitools/003-fix-wchar_t.patch b/testing/efitools/003-fix-wchar_t.patch
new file mode 100644
index 0000000000..049d52fd7a
--- /dev/null
+++ b/testing/efitools/003-fix-wchar_t.patch
@@ -0,0 +1,96 @@
+diff --git a/Make.rules b/Make.rules
+index 903a5a4..3de81c7 100644
+--- a/Make.rules
++++ b/Make.rules
+@@ -15,7 +15,7 @@ $(error unknown architecture $(ARCH))
+ endif
+ INCDIR = -I$(TOPDIR)include/ -I/usr/include/efi -I/usr/include/efi/$(ARCH) -I/usr/include/efi/protocol
+ CPPFLAGS = -DCONFIG_$(ARCH)
+-CFLAGS = -O2 -g $(ARCH3264) -fpic -Wall -fshort-wchar -fno-strict-aliasing -fno-merge-constants -fno-stack-protector -ffreestanding -fno-stack-check
++CFLAGS = -O2 -g $(ARCH3264) -fpic -Wall -fno-strict-aliasing -fno-merge-constants -fno-stack-protector -ffreestanding -fno-stack-check
+ LDFLAGS = -nostdlib
+ CRTOBJ = crt0-efi-$(ARCH).o
+ CRTPATHS = /lib /lib64 /lib/efi /lib64/efi /usr/lib /usr/lib64 /usr/lib/efi /usr/lib64/efi /usr/lib/gnuefi /usr/lib64/gnuefi
+diff --git a/cert-to-efi-hash-list.c b/cert-to-efi-hash-list.c
+index 8a5468a..c6b1e8e 100644
+--- a/cert-to-efi-hash-list.c
++++ b/cert-to-efi-hash-list.c
+@@ -23,7 +23,6 @@
+ #include <fcntl.h>
+ #include <time.h>
+ #include <unistd.h>
+-#include <wchar.h>
+
+ #include <openssl/pem.h>
+ #include <openssl/err.h>
+diff --git a/flash-var.c b/flash-var.c
+index aa10ae6..3ff6c7e 100644
+--- a/flash-var.c
++++ b/flash-var.c
+@@ -46,7 +46,7 @@ main(int argc, char *argv[])
+ | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS;
+ int flashfile, varfile, i, offset, varlen, varfilesize, listvars = 0;
+ const int chunk = 8;
+- wchar_t var[128];
++ uint16_t var[128];
+ struct stat st;
+ EFI_GUID *owner = NULL, guid;
+ EFI_TIME timestamp;
+@@ -88,7 +88,7 @@ main(int argc, char *argv[])
+ /* copy to wchar16_t including trailing zero */
+ for (i = 0; i < strlen(argv[2]) + 1; i++)
+ var[i] = argv[2][i];
+- varlen = i*2; /* size of storage including zero */
++ varlen = i*sizeof(var[0]); /* size of storage including zero */
+
+ if (!owner)
+ owner = get_owner_guid(argv[2]);
+diff --git a/hash-to-efi-sig-list.c b/hash-to-efi-sig-list.c
+index 4b69026..dbbc4f1 100644
+--- a/hash-to-efi-sig-list.c
++++ b/hash-to-efi-sig-list.c
+@@ -21,7 +21,6 @@
+ #include <fcntl.h>
+ #include <time.h>
+ #include <unistd.h>
+-#include <wchar.h>
+
+ #include <PeImage.h> /* for ALIGN_VALUE */
+ #include <sha256.h>
+diff --git a/sign-efi-sig-list.c b/sign-efi-sig-list.c
+index 94bd7d4..27abc17 100644
+--- a/sign-efi-sig-list.c
++++ b/sign-efi-sig-list.c
+@@ -21,7 +21,6 @@
+ #include <fcntl.h>
+ #include <time.h>
+ #include <unistd.h>
+-#include <wchar.h>
+
+ #include <variables.h>
+ #include <guid.h>
+@@ -73,7 +72,7 @@ main(int argc, char *argv[])
+ sigsize;
+ EFI_GUID vendor_guid;
+ struct stat st;
+- wchar_t var[256];
++ uint16_t var[256];
+ UINT32 attributes = EFI_VARIABLE_NON_VOLATILE
+ | EFI_VARIABLE_RUNTIME_ACCESS
+ | EFI_VARIABLE_BOOTSERVICE_ACCESS
+@@ -191,14 +190,11 @@ main(int argc, char *argv[])
+ timestamp.Month, timestamp.Day, timestamp.Hour, timestamp.Minute,
+ timestamp.Second);
+
+- /* Warning: don't use any glibc wchar functions. We're building
+- * with -fshort-wchar which breaks the glibc ABI */
+ i = 0;
+ do {
+ var[i] = str[i];
+ } while (str[i++] != '\0');
+-
+- varlen = (i - 1)*sizeof(wchar_t);
++ varlen = (i - 1)*sizeof(var[0]);
+
+ int fdefifile = open(efifile, O_RDONLY);
+ if (fdefifile == -1) {
diff --git a/testing/efitools/APKBUILD b/testing/efitools/APKBUILD
index 7c0841d90a..3563e3a31c 100644
--- a/testing/efitools/APKBUILD
+++ b/testing/efitools/APKBUILD
@@ -3,7 +3,7 @@
# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname=efitools
pkgver=1.9.2
-pkgrel=0
+pkgrel=1
pkgdesc="EFI tools"
url="https://git.kernel.org/pub/scm/linux/kernel/git/jejb/efitools.git"
arch="x86_64"
@@ -13,6 +13,7 @@ subpackages="$pkgname-doc"
source="https://git.kernel.org/pub/scm/linux/kernel/git/jejb/efitools.git/snapshot/efitools-$pkgver.tar.gz
001-datatypes.patch
002-fix-parallel-make.patch
+ 003-fix-wchar_t.patch
"
prepare() {
@@ -31,4 +32,5 @@ package() {
sha512sums="77e0ad7e865814ed388ff6daabe0f4b49ba51672bf2cbb98b7905e209cbd28f9ede2f73213ce45af8a978c1e67dba24ec88a1188661317cc22317b47e575cde8 efitools-1.9.2.tar.gz
cd72161a99b26472909a8da834c08a1f88b54d35291a6646562b03a6616fa5fb61e49d4fb3c780861689d23823c101709890dd245dd8aa9f51dca40ac1b2d369 001-datatypes.patch
-7afe87e9b44ed3e10200770d3079e4e14b6d39c54c05538031e93d021631427fed47781b016b46f58b8fe6d21f1f3c78667b2b502aa20b99516aa980303aa2ad 002-fix-parallel-make.patch"
+7afe87e9b44ed3e10200770d3079e4e14b6d39c54c05538031e93d021631427fed47781b016b46f58b8fe6d21f1f3c78667b2b502aa20b99516aa980303aa2ad 002-fix-parallel-make.patch
+bd31e51c6d80ab3fdfe0e7abea1cd6f982d63a96a345c0e75f438f6a219bf64b1510f0dabdcc49d24cc788c06ff4ccfbccde0c1aead9c00b65eaf2977e87e742 003-fix-wchar_t.patch"