Hi,

please consider the attached patch. Currently tboot respects CFLAGS and LDFLAGS from the environment but not CPPFLAGS.

-Timo
# HG changeset patch
# User Timo Lindfors <timo.lindf...@iki.fi>
# Date 1655455151 -10800
#      Fri Jun 17 11:39:11 2022 +0300
# Node ID 2bd7c7a33d49ffeb01edd0306b581b9f320316e6
# Parent  206a47f3e9d2c18c8a3db082216ee6fc3c5d475c
Use CPPFLAGS supplied by the environment during the build

This makes it possible to use distribution-wide security hardening
options automatically with tboot builds. This commit only adds
CPPFLAGS to userland utilities as there is a risk of regressions if
such hardening options are set for the tboot binary itself.

diff -r 206a47f3e9d2 -r 2bd7c7a33d49 lcptools-v2/Makefile
--- a/lcptools-v2/Makefile	Thu Mar 17 23:58:50 2022 +0200
+++ b/lcptools-v2/Makefile	Fri Jun 17 11:39:11 2022 +0300
@@ -93,4 +93,4 @@
 BUILD_DEPS := $(ROOTDIR)/Config.mk $(CURDIR)/Makefile
 
 %.o : %.c $(HDRS) $(BUILD_DEPS)
-	$(CC) $(CFLAGS) -DNO_TBOOT_LOGLVL -c $< -o $@
+	$(CC) $(CFLAGS) $(CPPFLAGS) -DNO_TBOOT_LOGLVL -c $< -o $@
diff -r 206a47f3e9d2 -r 2bd7c7a33d49 safestringlib/makefile
--- a/safestringlib/makefile	Thu Mar 17 23:58:50 2022 +0200
+++ b/safestringlib/makefile	Fri Jun 17 11:39:11 2022 +0300
@@ -26,7 +26,7 @@
 
 $(ODIR)/%.o: $(SRCDIR)/%.c $(DEPS) $(ODEPS)
 	mkdir -p $(ODIR)
-	$(CC) $(LDFLAGS) -c -o $@ $< $(CFLAGS)
+	$(CC) $(LDFLAGS) -c -o $@ $< $(CFLAGS) $(CPPFLAGS)
 
 libsafestring.a: $(OBJ)
 	ar rcs $@ $^ 
@@ -41,7 +41,7 @@
 
 $(OTDIR)/%.o: $(TESTDIR)/%.c $(TESTDIR)/test_private.h
 	mkdir -p $(OTDIR)
-	$(CC) -c -o $@ $< $(CFLAGS)
+	$(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS)
 
 
 safestringtest: libsafestring.a $(TOBJ)
diff -r 206a47f3e9d2 -r 2bd7c7a33d49 tb_polgen/Makefile
--- a/tb_polgen/Makefile	Thu Mar 17 23:58:50 2022 +0200
+++ b/tb_polgen/Makefile	Fri Jun 17 11:39:11 2022 +0300
@@ -62,4 +62,4 @@
 BUILD_DEPS := $(ROOTDIR)/Config.mk $(CURDIR)/Makefile
 
 %.o : %.c $(HDRS) $(BUILD_DEPS)
-	$(CC) $(CFLAGS) -DNO_TBOOT_LOGLVL -c $< -o $@
+	$(CC) $(CFLAGS) $(CPPFLAGS) -DNO_TBOOT_LOGLVL -c $< -o $@
diff -r 206a47f3e9d2 -r 2bd7c7a33d49 utils/Makefile
--- a/utils/Makefile	Thu Mar 17 23:58:50 2022 +0200
+++ b/utils/Makefile	Fri Jun 17 11:39:11 2022 +0300
@@ -61,4 +61,4 @@
 txt-acminfo : txt-acminfo.o
 	$(CC) $(CFLAGS) $(LDFLAGS) $^ $(LIBS) -o $@
 %.o : %.c $(BUILD_DEPS)
-	$(CC) $(CFLAGS) -DNO_TBOOT_LOGLVL -c $< -o $@
+	$(CC) $(CFLAGS) $(CPPFLAGS) -DNO_TBOOT_LOGLVL -c $< -o $@
_______________________________________________
tboot-devel mailing list
tboot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tboot-devel

Reply via email to