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