Skip to content

Commit 126a07e

Browse files
Steve McIntyresteve-mcintyre
authored andcommitted
Validate that a supplied vendor cert is not in PEM format
If we see "BEGIN", it's likely a PEM certificate and won't work. Fail the build early and say so. Fixes #645 Signed-off-by: Steve McIntyre <[email protected]>
1 parent 5914984 commit 126a07e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,21 @@ ifneq ($(origin FALLBACK_VERBOSE_WAIT), undefined)
6969
CFLAGS += -DFALLBACK_VERBOSE_WAIT=$(FALLBACK_VERBOSE_WAIT)
7070
endif
7171

72-
all: confcheck $(TARGETS)
72+
all: confcheck certcheck $(TARGETS)
7373

7474
confcheck:
7575
ifneq ($(origin EFI_PATH),undefined)
7676
$(error EFI_PATH is no longer supported, you must build using the supplied copy of gnu-efi)
7777
endif
7878

79+
certcheck:
80+
ifneq ($(origin VENDOR_CERT_FILE), undefined)
81+
@if grep -q "BEGIN" $(VENDOR_CERT_FILE); then \
82+
echo "$(VENDOR_CERT_FILE) is PEM-format, convert to DER!"; \
83+
exit 1; \
84+
fi
85+
endif
86+
7987
compile_commands.json : Makefile Make.rules Make.defaults
8088
make clean
8189
bear -- make COMPILER=clang test all

0 commit comments

Comments
 (0)