2012-06-13 06:23:26 +00:00
|
|
|
|
2012-08-13 05:01:20 +00:00
|
|
|
AUTOMAKE_OPTIONS = parallel-tests
|
|
|
|
|
2012-06-13 06:23:26 +00:00
|
|
|
test_key = private-key.rsa
|
|
|
|
test_cert = public-cert.pem
|
2020-06-06 01:34:55 +00:00
|
|
|
ca_key = ca-key.ec
|
|
|
|
ca_cert = ca-cert.pem
|
|
|
|
int_key = int-key.ec
|
|
|
|
int_cert = int-cert.pem
|
2017-10-19 16:20:42 +00:00
|
|
|
test_arches = $(EFI_ARCH)
|
2012-06-13 06:23:26 +00:00
|
|
|
|
2017-10-19 16:20:42 +00:00
|
|
|
check_PROGRAMS = test.pecoff
|
|
|
|
|
|
|
|
# override the automake rule to say we build from .elf files
|
|
|
|
test.pecoff$(EXEEXT): test.elf
|
|
|
|
|
|
|
|
if TEST_BINARY_FORMAT
|
|
|
|
EFILDFLAGS = --defsym=EFI_SUBSYSTEM=0x0a
|
|
|
|
FORMAT = -O binary
|
|
|
|
else
|
|
|
|
FORMAT = --target=efi-app-$(EFI_ARCH)
|
|
|
|
endif
|
2012-06-13 06:23:26 +00:00
|
|
|
check_DATA = $(test_key) $(test_cert)
|
2012-08-13 05:01:20 +00:00
|
|
|
check_SCRIPTS = test-wrapper.sh
|
2012-06-13 06:23:26 +00:00
|
|
|
|
2017-10-19 16:20:42 +00:00
|
|
|
.elf.pecoff:
|
|
|
|
echo "TEST ARCHES $(test_arches) TEST_COMPAT=$(TEST_COMPAT_FALSE)"
|
2012-06-13 06:23:26 +00:00
|
|
|
$(OBJCOPY) -j .text -j .sdata -j .data \
|
|
|
|
-j .dynamic -j .dynsym -j .rel \
|
|
|
|
-j .rela -j .reloc \
|
2017-10-19 16:20:42 +00:00
|
|
|
$(FORMAT) $^ $@
|
2012-06-13 06:23:26 +00:00
|
|
|
|
2017-10-19 16:20:42 +00:00
|
|
|
.$(OBJEXT).elf:
|
2018-02-20 19:42:15 +00:00
|
|
|
$(LD) $(EFILDFLAGS) -nostdlib -L /usr/lib -L /usr/lib64 -L $(CRTPATH) -shared -Bsymbolic $(CRTPATH)/crt0-efi-$(EFI_ARCH).o -T elf_$(EFI_ARCH)_efi.lds $< -o $@ -lefi -lgnuefi
|
2012-08-13 05:01:20 +00:00
|
|
|
|
2017-10-19 16:20:42 +00:00
|
|
|
AM_CFLAGS=-fpic -I/usr/include/efi -I/usr/include/efi/$(EFI_ARCH)
|
2012-06-13 06:23:26 +00:00
|
|
|
|
2020-06-06 01:34:55 +00:00
|
|
|
%.rsa: Makefile
|
2012-06-13 06:23:26 +00:00
|
|
|
openssl genrsa -out $@ 2048
|
|
|
|
|
2020-06-06 01:34:55 +00:00
|
|
|
%.ec: Makefile
|
|
|
|
openssl genpkey -algorithm ec -pkeyopt ec_paramgen_curve:prime256v1 -out $@
|
|
|
|
|
|
|
|
$(ca_cert): $(ca_key) Makefile
|
|
|
|
openssl req -x509 -days 1 -sha256 -subj '/CN=CA Key/' -new -key $< -out $@
|
|
|
|
|
|
|
|
$(int_cert): $(int_key) $(ca_cert) Makefile
|
|
|
|
openssl req -new -subj '/CN=Intermediate Certificate/' -key $< -out tmp.req
|
|
|
|
echo -e "[ca]\nbasicConstraints = critical, CA:true\n" > ca.cnf
|
|
|
|
openssl x509 -req -sha256 -CA $(ca_cert) -CAkey $(ca_key) -in tmp.req -set_serial 1 -days 1 -extfile ca.cnf -extensions ca -out $@
|
|
|
|
-rm -f tmp.req ca.cnf
|
|
|
|
|
|
|
|
$(test_cert): $(test_key) $(int_cert) Makefile
|
|
|
|
openssl req -new -subj '/CN=Signer Certificate/' -key $< -out tmp.req
|
|
|
|
openssl x509 -req -sha256 -CA $(int_cert) -CAkey $(int_key) -in tmp.req -set_serial 1 -days 1 -out $@
|
|
|
|
-rm -f tmp.req
|
2012-06-13 06:23:26 +00:00
|
|
|
|
|
|
|
TESTS = sign-verify.sh \
|
|
|
|
sign-verify-detached.sh \
|
2012-08-02 08:43:08 +00:00
|
|
|
sign-detach-verify.sh \
|
2012-06-13 09:25:47 +00:00
|
|
|
sign-attach-verify.sh \
|
|
|
|
sign-missing-image.sh \
|
|
|
|
sign-missing-cert.sh \
|
|
|
|
sign-missing-key.sh \
|
|
|
|
verify-missing-image.sh \
|
2012-06-19 03:19:48 +00:00
|
|
|
verify-missing-cert.sh \
|
2012-06-28 04:38:34 +00:00
|
|
|
sign-invalidattach-verify.sh \
|
2012-08-03 02:03:14 +00:00
|
|
|
resign-warning.sh \
|
2017-10-19 16:20:42 +00:00
|
|
|
reattach-warning.sh
|
|
|
|
|
|
|
|
if !TEST_BINARY_FORMAT
|
|
|
|
##
|
|
|
|
# These tests involve objdump which will fail because the format
|
|
|
|
# is not recognised. Someone needs to fix arm bfd to add efi
|
|
|
|
##
|
|
|
|
TESTS += cert-table-header.sh \
|
|
|
|
detach-remove.sh
|
|
|
|
endif
|
|
|
|
|
2012-06-13 06:23:26 +00:00
|
|
|
|
2012-08-13 05:01:20 +00:00
|
|
|
TEST_EXTENSIONS = .sh
|
2017-10-18 23:48:01 +00:00
|
|
|
AM_TESTS_ENVIRONMENT = TEST_ARCHES='$(test_arches)'; export TEST_ARCHES;
|
|
|
|
SH_LOG_COMPILER = $(srcdir)/test-wrapper.sh
|
2012-08-13 05:01:20 +00:00
|
|
|
|
2017-10-19 16:20:42 +00:00
|
|
|
EXTRA_DIST = test.S $(TESTS) $(check_SCRIPTS)
|
2020-06-06 01:34:55 +00:00
|
|
|
CLEANFILES = $(test_key) $(test_cert) $(int_key) $(int_cert) $(ca_key) \
|
|
|
|
$(ca_cert)
|