aboutsummaryrefslogtreecommitdiffstats
path: root/main/efitools/003-fix-wchar_t.patch
blob: 049d52fd7a94eae4973c4100513f44b633fcec2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
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) {