Blame SOURCES/trousers-0.3.14-memset.patch

efa152
diff -ur trousers-0.3.14/src/include/spi_utils.h trousers-0.3.14-new/src/include/spi_utils.h
efa152
--- trousers-0.3.14/src/include/spi_utils.h	2014-07-23 12:42:44.000000000 -0700
efa152
+++ trousers-0.3.14-new/src/include/spi_utils.h	2019-06-05 11:25:12.278782622 -0700
efa152
@@ -53,7 +53,7 @@
efa152
 void *calloc_tspi(TSS_HCONTEXT, UINT32);
efa152
 TSS_RESULT free_tspi(TSS_HCONTEXT, void *);
efa152
 TSS_RESULT __tspi_add_mem_entry(TSS_HCONTEXT, void *);
efa152
-void * __no_optimize __tspi_memset(void *, int, size_t);
efa152
+void * __tspi_memset(void *, int, size_t);
efa152
 
efa152
 /* secrets.c */
efa152
 
efa152
diff -ur trousers-0.3.14/src/tspi/tsp_context_mem.c trousers-0.3.14-new/src/tspi/tsp_context_mem.c
efa152
--- trousers-0.3.14/src/tspi/tsp_context_mem.c	2014-07-23 12:42:45.000000000 -0700
efa152
+++ trousers-0.3.14-new/src/tspi/tsp_context_mem.c	2019-06-05 11:27:23.585033966 -0700
efa152
@@ -258,8 +258,10 @@
efa152
 }
efa152
 
efa152
 /* definition for a memset that cannot be optimized away */
efa152
-void * __no_optimize
efa152
+void *
efa152
 __tspi_memset(void *s, int c, size_t n)
efa152
 {
efa152
-	return memset(s, c, n);
efa152
+	memset(s, c, n);
efa152
+	asm volatile("" ::: "memory");
efa152
+	return s;
efa152
 }