From 85c5c7576c9e10f5b7c37573311aaf96353eee07 Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Sun, 28 Feb 2021 16:42:11 -0500 Subject: [PATCH 04/13] Store and restore volatile state at every step --- utils/reg.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/utils/reg.sh b/utils/reg.sh index c9d49b9..0bba17a 100755 --- a/utils/reg.sh +++ b/utils/reg.sh @@ -140,6 +140,16 @@ printUsage () echo "-51 Events" } +storeAndRestoreVolatileState() +{ + if [ ${SWTPM_TEST_STORE_VOLATILE:-0} -ne 0 ]; then + echo ">>> Storing and re-storing volatile state <<<" + ${SWTPM_IOCTL} -v --tcp ${TPM_SERVER_NAME}:${TPM_PLATFORM_PORT} + ${SWTPM_IOCTL} -i --tcp ${TPM_SERVER_NAME}:${TPM_PLATFORM_PORT} + fi +} +export -f storeAndRestoreVolatileState + checkSuccess() { if [ $1 -ne 0 ]; then @@ -149,7 +159,7 @@ if [ $1 -ne 0 ]; then else echo " INFO:" fi - +storeAndRestoreVolatileState } # FIXME should not increment past 254 @@ -162,6 +172,7 @@ if [ $1 -ne 0 ]; then else echo " INFO:" fi +storeAndRestoreVolatileState } checkFailure() @@ -173,6 +184,7 @@ if [ $1 -eq 0 ]; then else echo " INFO:" fi +storeAndRestoreVolatileState } cleanup() -- 2.39.1