aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Richter <erichte@linux.ibm.com>2020-10-01 11:37:42 -0500
committerOliver O'Halloran <oohall@gmail.com>2020-10-02 09:21:35 +1000
commit5e686a75b31ba099cdfd996709532b4bf3449126 (patch)
tree43e83c1fef919011c7a0e7a38c386a6bb47a38fd
parent8830892c7b61187b352c07ab35be2d0dddb713cc (diff)
downloadskiboot-5e686a75b31ba099cdfd996709532b4bf3449126.zip
skiboot-5e686a75b31ba099cdfd996709532b4bf3449126.tar.gz
skiboot-5e686a75b31ba099cdfd996709532b4bf3449126.tar.bz2
secvar/test: use vendored mbedtls instead of host
Linking against the host mbedtls introduces problems if the host does not have the library, or if the host has a different version installed. This patch changes the tests to instead build mbedtls from the version included in skiboot using the host compiler, removing the dependency on external mbedtls. Signed-off-by: Eric Richter <erichte@linux.ibm.com> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
-rw-r--r--libstb/secvar/test/Makefile.check15
-rw-r--r--libstb/secvar/test/secvar-test-secboot-tpm.c2
2 files changed, 10 insertions, 7 deletions
diff --git a/libstb/secvar/test/Makefile.check b/libstb/secvar/test/Makefile.check
index a49672c..1e23703 100644
--- a/libstb/secvar/test/Makefile.check
+++ b/libstb/secvar/test/Makefile.check
@@ -30,15 +30,20 @@ $(SECVAR_TEST:%=%-check) : %-check: %
$(call QTEST, RUN-TEST ,$(VALGRIND) $<, $<)
@$(RM) -f secboot.img
-HOSTMBEDFLAGS += -lmbedcrypto -lmbedx509
+HOST_MBEDTLS_OBJS=$(MBEDTLS_OBJS:%.o=$(CRYPTO_DIR)/%.host.o)
+HOST_MBEDTLS_CFLAGS=-I$(SRC)/$(LIBSTB_DIR)/crypto -DMBEDTLS_CONFIG_FILE='<mbedtls-config.h>'
+HOST_MBEDTLS_CFLAGS+= -Wno-unused-function -Wno-suggest-attribute=const
+%.host.o: %.c
+ $(call Q, HOSTCC , $(HOSTCC) $(HOSTCFLAGS) $(HOST_MBEDTLS_CFLAGS) -O0 -g -c -o $@ $<, $<)
+
$(SECVAR_TEST) : core/test/stubs.o
-$(SECVAR_TEST) : % : %.c
- $(call Q, HOSTCC ,$(HOSTCC) $(HOSTCFLAGS) $(HOSTMBEDFLAGS) -O0 -g -I include -I . -I libfdt -o $@ $< core/test/stubs.o, $<)
+$(SECVAR_TEST) : % : %.c $(HOST_MBEDTLS_OBJS)
+ $(call Q, HOSTCC ,$(HOSTCC) $(HOSTCFLAGS) -O0 -g -I include -I . -I libfdt -o $@ $< $(HOST_MBEDTLS_OBJS) core/test/stubs.o, $<)
-$(SECVAR_TEST:%=%-gcov): %-gcov : %.c %
- $(call Q, HOSTCC ,$(HOSTCC) $(HOSTCFLAGS) $(HOSTGCOVCFLAGS) $(HOSTMBEDFLAGS) -I include -I . -I libfdt -lgcov -o $@ $< core/test/stubs.o, $<)
+$(SECVAR_TEST:%=%-gcov): %-gcov : %.c % $(HOST_MBEDTLS_OBJS)
+ $(call Q, HOSTCC ,$(HOSTCC) $(HOSTCFLAGS) $(HOSTGCOVCFLAGS) -I include -I . -I libfdt -lgcov -o $@ $< $(HOST_MBEDTLS_OBJS) core/test/stubs.o, $<)
-include $(wildcard libstb/secvar/test/*.d)
diff --git a/libstb/secvar/test/secvar-test-secboot-tpm.c b/libstb/secvar/test/secvar-test-secboot-tpm.c
index e883b88..798ca28 100644
--- a/libstb/secvar/test/secvar-test-secboot-tpm.c
+++ b/libstb/secvar/test/secvar-test-secboot-tpm.c
@@ -4,8 +4,6 @@
#include "secvar_common_test.c"
#include "../storage/secboot_tpm.c"
#include "../storage/fakenv_ops.c"
-#include "../../crypto/mbedtls/library/sha256.c"
-#include "../../crypto/mbedtls/library/platform_util.c"
#include "../secvar_util.c"
char *secboot_buffer;