summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Berger <stefanb@linux.ibm.com>2021-07-09 11:38:59 -0400
committerAlexey Kardashevskiy <aik@ozlabs.ru>2021-07-11 23:44:02 +1000
commitcc4c4cb3c193dabdefe45db343c949452c081435 (patch)
tree0b74c69a27d7787f9f6f465c2d3858323d28396a
parent6c0fcd9f3085814b808d18aa81ae6669063ea33b (diff)
downloadqemu-SLOF-cc4c4cb3c193dabdefe45db343c949452c081435.tar.gz
tcgbios: Change format of S_CRTM_VERSION string to ucs-2
Change the format of the S_CRTM_VERSION string to ucs-2 since this is what seems to be commonly used by other firmwares following insight from a TCG work group member. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> Tested-by: Stefan Berger <stefanb@linux.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
-rw-r--r--Makefile.gen2
-rw-r--r--lib/libtpm/Makefile1
-rw-r--r--lib/libtpm/tcgbios.c23
-rw-r--r--make.rules3
4 files changed, 16 insertions, 13 deletions
diff --git a/Makefile.gen b/Makefile.gen
index f18c57a..6f78829 100644
--- a/Makefile.gen
+++ b/Makefile.gen
@@ -164,7 +164,7 @@ distclean_gen: clean_top
common-libs:
@echo " ====== Building common libraries ======"
- $(MAKE) -C $(LIBCMNDIR) $(COMMON_LIBS)
+ $(MAKE) -C $(LIBCMNDIR) $(COMMON_LIBS) RELEASE=-DRELEASE=\"\\\"$(RELEASE)\\\"\"
board-libs:
$(MAKE) -C lib $(MAKEARG)
diff --git a/lib/libtpm/Makefile b/lib/libtpm/Makefile
index 9d32dfc..895dbfd 100644
--- a/lib/libtpm/Makefile
+++ b/lib/libtpm/Makefile
@@ -15,6 +15,7 @@ TOPCMNDIR ?= ../..
CPPFLAGS = -I../libc/include $(CPUARCHDEF) -I$(INCLBRDDIR) \
-I$(INCLCMNDIR) -I$(INCLCMNDIR)/$(CPUARCH) -I$(SLOFCMNDIR)
CPPFLAGS += -I../libhvcall
+CPPFLAGS += $(RELEASE)
LDFLAGS = -nostdlib
diff --git a/lib/libtpm/tcgbios.c b/lib/libtpm/tcgbios.c
index dcf0cc6..24ac83c 100644
--- a/lib/libtpm/tcgbios.c
+++ b/lib/libtpm/tcgbios.c
@@ -1108,24 +1108,25 @@ uint32_t tpm_measure_gpt(void)
uint32_t tpm_measure_scrtm(void)
{
- uint32_t rc;
- char *version_start = strstr((char *)&print_version, "FW Version");
- char *version_end;
- uint32_t version_length;
+ uint32_t rc, i;
char *slof_text_start = (char *)&_slof_text;
uint32_t slof_text_length = (long)&_slof_text_end - (long)&_slof_text;
const char *scrtm = "S-CRTM Contents";
-
- version_end = strchr(version_start, '\r');
- version_length = version_end - version_start;
+#define _TT(a, x) a##x
+#define _T(a, x) _TT(a, x)
+ unsigned short ucs2_version[] = _T(L, RELEASE);
dprintf("Measure S-CRTM Version: addr = %p, length = %d\n",
- version_start, version_length);
+ ucs2_version, ucs2_length);
+
+ for (i = 0; i < ARRAY_SIZE(ucs2_version); ++i)
+ ucs2_version[i] = cpu_to_le16(ucs2_version[i]);
rc = tpm_add_measurement_to_log(0, EV_S_CRTM_VERSION,
- version_start, version_length,
- (uint8_t *)version_start,
- version_length);
+ (char *)ucs2_version,
+ sizeof(ucs2_version),
+ (uint8_t *)ucs2_version,
+ sizeof(ucs2_version));
if (rc)
return rc;
diff --git a/make.rules b/make.rules
index 885eea3..d37c365 100644
--- a/make.rules
+++ b/make.rules
@@ -79,6 +79,7 @@ CPP ?= $(CROSS)cpp
WARNFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -Wformat-security -Wextra -Wno-unused-parameter
CFLAGS ?= -g -O2 -fno-builtin -ffreestanding -nostdinc -msoft-float \
-fno-strict-aliasing -mno-altivec -mabi=no-altivec \
- -fno-stack-protector -fno-asynchronous-unwind-tables $(WARNFLAGS)
+ -fno-stack-protector -fno-asynchronous-unwind-tables $(WARNFLAGS) \
+ -fshort-wchar
export CC AS LD CLEAN OBJCOPY OBJDUMP STRIP AR RANLIB CFLAGS