[06/19] libstb: move drivers/sha512.* to mbedtls directory

Message ID 1510421322-27237-7-git-send-email-cclaudio@linux.vnet.ibm.com
State New
Headers show
Series
  • libstb: add support for secure and trusted boot in P9
Related show

Commit Message

Claudio Carvalho Nov. 11, 2017, 5:28 p.m.
The drivers/sha512.c file is a SHA512 hash implementation imported from
the mbed TLS project.

As a matter of semantics, this moves drivers/sha512.* to the mbedtls
directory.

Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com>
---
 libstb/Makefile.inc                  |  3 ++-
 libstb/drivers/Makefile.inc          |  2 +-
 libstb/drivers/sw_driver.c           |  2 +-
 libstb/mbedtls/Makefile.inc          | 11 +++++++++++
 libstb/{drivers => mbedtls}/sha512.c |  0
 libstb/{drivers => mbedtls}/sha512.h |  0
 6 files changed, 15 insertions(+), 3 deletions(-)
 create mode 100644 libstb/mbedtls/Makefile.inc
 rename libstb/{drivers => mbedtls}/sha512.c (100%)
 rename libstb/{drivers => mbedtls}/sha512.h (100%)

Patch

diff --git a/libstb/Makefile.inc b/libstb/Makefile.inc
index 010e4b1..473edec 100644
--- a/libstb/Makefile.inc
+++ b/libstb/Makefile.inc
@@ -8,10 +8,11 @@  LIBSTB_SRCS = container.c rom.c tpm_chip.c stb.c cvc.c
 LIBSTB_OBJS = $(LIBSTB_SRCS:%.c=%.o)
 LIBSTB = $(LIBSTB_DIR)/built-in.o
 
+include $(SRC)/$(LIBSTB_DIR)/mbedtls/Makefile.inc
 include $(SRC)/$(LIBSTB_DIR)/drivers/Makefile.inc
 include $(SRC)/$(LIBSTB_DIR)/tss/Makefile.inc
 
-$(LIBSTB): $(LIBSTB_OBJS:%=$(LIBSTB_DIR)/%) $(DRIVERS) $(TSS)
+$(LIBSTB): $(LIBSTB_OBJS:%=$(LIBSTB_DIR)/%) $(DRIVERS) $(TSS) $(MBEDTLS)
 
 libstb/create-container: libstb/create-container.c
 	$(call Q, HOSTCC ,$(HOSTCC) $(HOSTCFLAGS) \
diff --git a/libstb/drivers/Makefile.inc b/libstb/drivers/Makefile.inc
index d0f88ea..9eaa257 100644
--- a/libstb/drivers/Makefile.inc
+++ b/libstb/drivers/Makefile.inc
@@ -4,7 +4,7 @@  DRIVERS_DIR = libstb/drivers
 
 SUBDIRS += $(DRIVERS_DIR)
 
-DRIVERS_SRCS = romcode.c tpm_i2c_interface.c tpm_i2c_nuvoton.c sw_driver.c sha512.c
+DRIVERS_SRCS = romcode.c tpm_i2c_interface.c tpm_i2c_nuvoton.c sw_driver.c
 DRIVERS_OBJS = $(DRIVERS_SRCS:%.c=%.o)
 DRIVERS = $(DRIVERS_DIR)/built-in.o
 
diff --git a/libstb/drivers/sw_driver.c b/libstb/drivers/sw_driver.c
index e7f3740..287dae9 100644
--- a/libstb/drivers/sw_driver.c
+++ b/libstb/drivers/sw_driver.c
@@ -17,8 +17,8 @@ 
 #include <chip.h>
 #include <string.h>
 #include <skiboot.h>
+#include <libstb/mbedtls/sha512.h>
 #include "../rom.h"
-#include "sha512.h"
 #include "sw_driver.h"
 
 static sha2_hash_t *hw_key_hash = NULL;
diff --git a/libstb/mbedtls/Makefile.inc b/libstb/mbedtls/Makefile.inc
new file mode 100644
index 0000000..07aa26a
--- /dev/null
+++ b/libstb/mbedtls/Makefile.inc
@@ -0,0 +1,11 @@ 
+# -*-Makefile-*-
+
+MBEDTLS_DIR = libstb/mbedtls
+
+SUBDIRS += $(MBEDTLS_DIR)
+
+MBEDTLS_SRCS = sha512.c
+MBEDTLS_OBJS = $(MBEDTLS_SRCS:%.c=%.o)
+MBEDTLS = $(MBEDTLS_DIR)/built-in.o
+
+$(MBEDTLS): $(MBEDTLS_OBJS:%=$(MBEDTLS_DIR)/%)
diff --git a/libstb/drivers/sha512.c b/libstb/mbedtls/sha512.c
similarity index 100%
rename from libstb/drivers/sha512.c
rename to libstb/mbedtls/sha512.c
diff --git a/libstb/drivers/sha512.h b/libstb/mbedtls/sha512.h
similarity index 100%
rename from libstb/drivers/sha512.h
rename to libstb/mbedtls/sha512.h