Skip to content

Commit 4a91665

Browse files
committed
app-crypt/efitools: Sync with Gentoo
It's from Gentoo commit ae1e332058fc483a5d8d7804d34f369f4566638e.
1 parent d17611c commit 4a91665

File tree

7 files changed

+251
-110
lines changed

7 files changed

+251
-110
lines changed
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
DIST efitools-1.8.1.tar.gz 115319 BLAKE2B 3aad65defc203055122027cc3a48f50912d2f08b592841780fdc1bf337d75774116e698c4270865275ce7fe64988cd84105138ca979d81818f0065d7ae90f1d0 SHA512 114ef8e52160f5a5239ec306dbd587610849bce771ba8145ed092afd79e44f3ecee93cc1d97e2d5fdb880cc825bbbe928b3ef6701fd3b1fa444053894be1098a
21
DIST efitools-1.9.2.tar.gz 116037 BLAKE2B b3540932eb112e362fd0eed47090360603807dcaec8c6a10058618f8252eeb5dcbbd703d313cb6fadae62c1312815080cf2c77fc86f9dfc9f9afca24ad97f584 SHA512 77e0ad7e865814ed388ff6daabe0f4b49ba51672bf2cbb98b7905e209cbd28f9ede2f73213ce45af8a978c1e67dba24ec88a1188661317cc22317b47e575cde8

sdk_container/src/third_party/portage-stable/app-crypt/efitools/efitools-1.8.1.ebuild

Lines changed: 0 additions & 51 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Copyright 1999-2021 Gentoo Authors
1+
# Copyright 1999-2023 Gentoo Authors
22
# Distributed under the terms of the GNU General Public License v2
33

4-
EAPI=6
4+
EAPI=8
55

66
inherit flag-o-matic toolchain-funcs
77

@@ -14,43 +14,43 @@ SLOT="0"
1414
KEYWORDS="amd64 ~arm64 x86"
1515
IUSE="static"
1616

17-
LIB_DEPEND="dev-libs/openssl:0=[static-libs(+)]"
17+
LIB_DEPEND="dev-libs/openssl:=[static-libs(+)]"
1818

19-
RDEPEND="!static? ( ${LIB_DEPEND//\[static-libs(+)]} )
19+
RDEPEND="
20+
!static? ( ${LIB_DEPEND//\[static-libs(+)]} )
2021
sys-apps/util-linux"
21-
2222
DEPEND="${RDEPEND}
23+
static? ( ${LIB_DEPEND} )
24+
sys-boot/gnu-efi"
25+
BDEPEND="
2326
app-crypt/sbsigntools
2427
dev-perl/File-Slurp
25-
static? ( ${LIB_DEPEND} )
2628
sys-apps/help2man
27-
sys-boot/gnu-efi
2829
virtual/pkgconfig"
2930

3031
PATCHES=(
31-
"${FILESDIR}/1.7.0-Make.rules.patch"
32-
"${FILESDIR}/1.8.1-respect-ar.patch"
32+
"${FILESDIR}"/1.9.2-clang16.patch
33+
"${FILESDIR}"/1.9.2-Makefile.patch
3334
)
3435

3536
src_prepare() {
36-
if use static; then
37-
append-ldflags -static
38-
sed -i "s/-lcrypto\b/$($(tc-getPKG_CONFIG) --static --libs libcrypto)/g" \
39-
Makefile || die
40-
fi
37+
default
4138

42-
# Let it build with clang.
39+
# Let it build with clang
4340
if tc-is-clang; then
4441
sed -i -e 's/-fno-toplevel-reorder//g' Make.rules || die
4542
fi
4643

47-
# Respect users CFLAGS
48-
sed -i -e 's/CFLAGS.*= -O2 -g/CFLAGS += /' Make.rules || die
44+
if use static; then
45+
append-ldflags -static
46+
export STATIC_FLAG=--static
47+
fi
48+
}
4949

50-
# Respect users LDFLAGS
51-
sed -i -e 's/LDFLAGS/LIBS/g' Make.rules || die
52-
sed -i -e 's/\$(CC)/& $(LDFLAGS)/g' Makefile || die
50+
src_configure() {
51+
# Calls LD directly, doesn't respect LDFLAGS. Low level package anyway.
52+
# See bug #908813.
53+
filter-lto
5354

54-
# Run 'default', to apply user patches
55-
default
55+
tc-export AR CC LD NM OBJCOPY PKG_CONFIG
5656
}

sdk_container/src/third_party/portage-stable/app-crypt/efitools/files/1.7.0-Make.rules.patch

Lines changed: 0 additions & 11 deletions
This file was deleted.

sdk_container/src/third_party/portage-stable/app-crypt/efitools/files/1.8.1-respect-ar.patch

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
--- a/Makefile
2+
+++ b/Makefile
3+
@@ -21,6 +21,8 @@
4+
KEYBLACKLISTAUTH = $(ALLKEYS:=-blacklist.auth)
5+
KEYHASHBLACKLISTAUTH = $(ALLKEYS:=-hash-blacklist.auth)
6+
7+
+SSL_LIBS = $(shell $(PKG_CONFIG) $(STATIC_FLAG) --libs libcrypto)
8+
+
9+
export TOPDIR := $(shell pwd)/
10+
11+
include Make.rules
12+
@@ -88,31 +90,31 @@
13+
ShimReplace.so: lib/lib-efi.a
14+
15+
cert-to-efi-sig-list: cert-to-efi-sig-list.o lib/lib.a
16+
- $(CC) $(ARCH3264) -o $@ $< lib/lib.a -lcrypto
17+
+ $(CC) $(LDFLAGS) $(ARCH3264) -o $@ $< lib/lib.a $(SSL_LIBS)
18+
19+
sig-list-to-certs: sig-list-to-certs.o lib/lib.a
20+
- $(CC) $(ARCH3264) -o $@ $< lib/lib.a -lcrypto
21+
+ $(CC) $(LDFLAGS) $(ARCH3264) -o $@ $< lib/lib.a $(SSL_LIBS)
22+
23+
sign-efi-sig-list: sign-efi-sig-list.o lib/lib.a
24+
- $(CC) $(ARCH3264) -o $@ $< lib/lib.a -lcrypto
25+
+ $(CC) $(LDFLAGS) $(ARCH3264) -o $@ $< lib/lib.a $(SSL_LIBS)
26+
27+
hash-to-efi-sig-list: hash-to-efi-sig-list.o lib/lib.a
28+
- $(CC) $(ARCH3264) -o $@ $< lib/lib.a
29+
+ $(CC) $(LDFLAGS) $(ARCH3264) -o $@ $< lib/lib.a
30+
31+
cert-to-efi-hash-list: cert-to-efi-hash-list.o lib/lib.a
32+
- $(CC) $(ARCH3264) -o $@ $< lib/lib.a -lcrypto
33+
+ $(CC) $(LDFLAGS) $(ARCH3264) -o $@ $< lib/lib.a $(SSL_LIBS)
34+
35+
efi-keytool: efi-keytool.o lib/lib.a
36+
- $(CC) $(ARCH3264) -o $@ $< lib/lib.a
37+
+ $(CC) $(LDFLAGS) $(ARCH3264) -o $@ $< lib/lib.a
38+
39+
efi-readvar: efi-readvar.o lib/lib.a
40+
- $(CC) $(ARCH3264) -o $@ $< lib/lib.a -lcrypto
41+
+ $(CC) $(LDFLAGS) $(ARCH3264) -o $@ $< lib/lib.a $(SSL_LIBS)
42+
43+
efi-updatevar: efi-updatevar.o lib/lib.a
44+
- $(CC) $(ARCH3264) -o $@ $< lib/lib.a -lcrypto
45+
+ $(CC) $(LDFLAGS) $(ARCH3264) -o $@ $< lib/lib.a $(SSL_LIBS)
46+
47+
flash-var: flash-var.o lib/lib.a
48+
- $(CC) $(ARCH3264) -o $@ $< lib/lib.a
49+
+ $(CC) $(LDFLAGS) $(ARCH3264) -o $@ $< lib/lib.a
50+
51+
clean:
52+
rm -f PK.* KEK.* DB.* $(EFIFILES) $(EFISIGNED) $(BINARIES) *.o *.so
53+
--- a/Make.rules
54+
+++ b/Make.rules
55+
@@ -15,8 +15,7 @@
56+
endif
57+
INCDIR = -I$(TOPDIR)include/ -I/usr/include/efi -I/usr/include/efi/$(ARCH) -I/usr/include/efi/protocol
58+
CPPFLAGS = -DCONFIG_$(ARCH)
59+
-CFLAGS = -O2 -g $(ARCH3264) -fpic -Wall -fshort-wchar -fno-strict-aliasing -fno-merge-constants -fno-stack-protector -ffreestanding -fno-stack-check
60+
-LDFLAGS = -nostdlib
61+
+CFLAGS += $(ARCH3264) -fpic -Wall -fshort-wchar -fno-strict-aliasing -fno-merge-constants -fno-stack-protector -ffreestanding -fno-stack-check
62+
CRTOBJ = crt0-efi-$(ARCH).o
63+
CRTPATHS = /lib /lib64 /lib/efi /lib64/efi /usr/lib /usr/lib64 /usr/lib/efi /usr/lib64/efi /usr/lib/gnuefi /usr/lib64/gnuefi
64+
CRTPATH = $(shell for f in $(CRTPATHS); do if [ -e $$f/$(CRTOBJ) ]; then echo $$f; break; fi; done)
65+
@@ -24,10 +23,9 @@
66+
# there's a bug in the gnu tools ... the .reloc section has to be
67+
# aligned otherwise the file alignment gets screwed up
68+
LDSCRIPT = elf_$(ARCH)_efi.lds
69+
-LDFLAGS += -shared -Bsymbolic $(CRTOBJS) -L $(CRTPATH) -L /usr/lib -L /usr/lib64 -T $(LDSCRIPT)
70+
+LIBS += -nostdlib -shared -Bsymbolic $(CRTOBJS) -L $(CRTPATH) -T $(LDSCRIPT)
71+
LOADLIBES = -lefi -lgnuefi $(shell $(CC) $(ARCH3264) -print-libgcc-file-name)
72+
FORMAT = --target=efi-app-$(ARCH)
73+
-OBJCOPY = objcopy
74+
MYGUID = 11111111-2222-3333-4444-123456789abc
75+
INSTALL = install
76+
BINDIR = $(DESTDIR)/usr/bin
77+
@@ -47,12 +45,12 @@
78+
endif
79+
80+
ifeq ($(ARCH),arm)
81+
- LDFLAGS += --defsym=EFI_SUBSYSTEM=0x0a
82+
+ LIBS += --defsym=EFI_SUBSYSTEM=0x0a
83+
FORMAT = -O binary
84+
endif
85+
86+
ifeq ($(ARCH),aarch64)
87+
- LDFLAGS += --defsym=EFI_SUBSYSTEM=0x0a
88+
+ LIBS += --defsym=EFI_SUBSYSTEM=0x0a
89+
FORMAT = -O binary
90+
endif
91+
92+
@@ -61,9 +59,9 @@
93+
-j .rel -j .rela -j .rel.* -j .rela.* -j .rel* -j .rela* \
94+
-j .reloc $(FORMAT) $*.so $@
95+
%.so: %.o
96+
- $(LD) $(LDFLAGS) $^ -o $@ $(LOADLIBES)
97+
+ $(LD) $(LIBS) $^ -o $@ $(LOADLIBES)
98+
# check we have no undefined symbols
99+
- nm -D $@ | grep ' U ' && exit 1 || exit 0
100+
+ $(NM) -D $@ | grep ' U ' && exit 1 || exit 0
101+
102+
%.h: %.auth
103+
./xxdi.pl $< > $@
104+
@@ -71,7 +69,7 @@
105+
%.hash: %.efi hash-to-efi-sig-list
106+
./hash-to-efi-sig-list $< $@
107+
108+
-%-blacklist.esl: %.crt cert-to-efi-hash-list
109+
+%-blacklist.esl: %.crt cert-to-efi-sig-list
110+
./cert-to-efi-sig-list $< $@
111+
112+
%-hash-blacklist.esl: %.crt cert-to-efi-hash-list
113+
@@ -129,7 +127,7 @@
114+
# sbsign --key KEK.key --cert KEK.crt --output $@ $<
115+
116+
%.a:
117+
- ar rcv $@ $^
118+
+ $(AR) rcv $@ $^
119+
120+
doc/%.1: doc/%.1.in %
121+
$(HELP2MAN) --no-info -i $< -o $@ ./$*
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
--- a/cert-to-efi-sig-list.c
2+
+++ b/cert-to-efi-sig-list.c
3+
@@ -6,7 +6,6 @@
4+
5+
6+
#include <stdint.h>
7+
-#define __STDC_VERSION__ 199901L
8+
#include <efi.h>
9+
#ifdef CONFIG_arm
10+
/* FIXME:
11+
--- a/efi-keytool.c
12+
+++ b/efi-keytool.c
13+
@@ -15,7 +15,6 @@
14+
#include <fcntl.h>
15+
#include <unistd.h>
16+
17+
-#define __STDC_VERSION__ 199901L
18+
#include <efi.h>
19+
20+
#include <kernel_efivars.h>
21+
--- a/efi-readvar.c
22+
+++ b/efi-readvar.c
23+
@@ -17,7 +17,6 @@
24+
25+
#include <openssl/x509.h>
26+
27+
-#define __STDC_VERSION__ 199901L
28+
#include <efi.h>
29+
30+
#include <kernel_efivars.h>
31+
--- a/efi-updatevar.c
32+
+++ b/efi-updatevar.c
33+
@@ -20,7 +20,6 @@
34+
#include <openssl/err.h>
35+
#include <openssl/pem.h>
36+
37+
-#define __STDC_VERSION__ 199901L
38+
#include <efi.h>
39+
40+
#include <kernel_efivars.h>
41+
--- a/flash-var.c
42+
+++ b/flash-var.c
43+
@@ -1,3 +1,5 @@
44+
+#define _XOPEN_SOURCE 700
45+
+
46+
#include <stdlib.h>
47+
#include <stdint.h>
48+
#include <sys/types.h>
49+
@@ -10,7 +12,6 @@
50+
#include <fcntl.h>
51+
#include <unistd.h>
52+
53+
-#define __STDC_VERSION__ 199901L
54+
#include <efi.h>
55+
56+
#include <version.h>
57+
--- a/hash-to-efi-sig-list.c
58+
+++ b/hash-to-efi-sig-list.c
59+
@@ -4,7 +4,6 @@
60+
* see COPYING file
61+
*/
62+
#include <stdint.h>
63+
-#define __STDC_VERSION__ 199901L
64+
#include <efi.h>
65+
#ifdef CONFIG_arm
66+
/* FIXME:
67+
--- a/include/variableformat.h
68+
+++ b/include/variableformat.h
69+
@@ -109,7 +109,7 @@
70+
71+
#pragma pack()
72+
73+
-inline BOOLEAN
74+
+static inline BOOLEAN
75+
IsValidVariableHeader (VARIABLE_HEADER *vh) {
76+
if (vh == NULL || vh->StartId != VARIABLE_DATA)
77+
return FALSE;
78+
--- a/lib/kernel_efivars.c
79+
+++ b/lib/kernel_efivars.c
80+
@@ -16,7 +16,6 @@
81+
#include <unistd.h>
82+
#include <time.h>
83+
84+
-#define __STDC_VERSION__ 199901L
85+
#include <efi.h>
86+
87+
#include <kernel_efivars.h>
88+
--- a/sig-list-to-certs.c
89+
+++ b/sig-list-to-certs.c
90+
@@ -4,7 +4,6 @@
91+
* see COPYING file
92+
*/
93+
#include <stdint.h>
94+
-#define __STDC_VERSION__ 199901L
95+
#include <efi.h>
96+
#ifdef CONFIG_arm
97+
/* FIXME:
98+
--- a/sign-efi-sig-list.c
99+
+++ b/sign-efi-sig-list.c
100+
@@ -4,7 +4,7 @@
101+
* see COPYING file
102+
*/
103+
#include <stdint.h>
104+
-#define __STDC_VERSION__ 199901L
105+
+#define _XOPEN_SOURCE 700
106+
#include <efi.h>
107+
#ifdef CONFIG_arm
108+
/* FIXME:

0 commit comments

Comments
 (0)