mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-23 19:25:25 +03:00
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.
96 lines
3.1 KiB
Diff
96 lines
3.1 KiB
Diff
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) {
|