mirror of
https://github.com/stefanberger/swtpm.git
synced 2025-08-22 19:04:35 +00:00

Older versions of libtpms need to have another patch applied that disables x509 certificate creation (0013-Disable-x509-test-cases-part2.patch). Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
149 lines
3.6 KiB
Diff
149 lines
3.6 KiB
Diff
From 8162afd2316d2a374447a0e620d18cf5021d4fdb Mon Sep 17 00:00:00 2001
|
|
From: Stefan Berger <stefanb@linux.vnet.ibm.com>
|
|
Date: Sun, 28 Feb 2021 16:39:51 -0500
|
|
Subject: [PATCH 02/13] Implement powerup for swtpm
|
|
|
|
---
|
|
utils/reg.sh | 12 ++++++++++++
|
|
utils/regtests/inittpm.sh | 4 ++--
|
|
utils/regtests/testevent.sh | 2 +-
|
|
utils/regtests/testnvpin.sh | 4 ++--
|
|
utils/regtests/testpcr.sh | 2 +-
|
|
utils/regtests/testshutdown.sh | 6 +++---
|
|
6 files changed, 21 insertions(+), 9 deletions(-)
|
|
|
|
diff --git a/utils/reg.sh b/utils/reg.sh
|
|
index 5f44760..24ea1df 100755
|
|
--- a/utils/reg.sh
|
|
+++ b/utils/reg.sh
|
|
@@ -1,6 +1,12 @@
|
|
#!/bin/bash
|
|
#
|
|
|
|
+SWTPM_IOCTL=${SWTPM_IOCTL:-$(type -P swtpm_ioctl)}
|
|
+if [ -z "${SWTPM_IOCTL}" ]; then
|
|
+ echo "SWTPM_IOCTL not set and could not find swtpm_ioctl in PATH"
|
|
+ exit 1
|
|
+fi
|
|
+
|
|
#################################################################################
|
|
# #
|
|
# TPM2 regression test #
|
|
@@ -261,6 +267,12 @@ initprimary()
|
|
checkSuccess $?
|
|
}
|
|
|
|
+powerup()
|
|
+{
|
|
+ ${SWTPM_IOCTL} -i --tcp ${TPM_SERVER_NAME}:${TPM_PLATFORM_PORT}
|
|
+ return $?
|
|
+}
|
|
+export -f powerup
|
|
|
|
export -f checkSuccess
|
|
export -f checkWarning
|
|
diff --git a/utils/regtests/inittpm.sh b/utils/regtests/inittpm.sh
|
|
index 37d1584..99a4d41 100755
|
|
--- a/utils/regtests/inittpm.sh
|
|
+++ b/utils/regtests/inittpm.sh
|
|
@@ -45,7 +45,7 @@ echo "Initialize TPM"
|
|
echo ""
|
|
|
|
echo "Power cycle"
|
|
-${PREFIX}powerup > run.out
|
|
+powerup > run.out
|
|
checkSuccess $?
|
|
|
|
echo "Startup"
|
|
@@ -65,7 +65,7 @@ ${PREFIX}pcrallocate +sha1 +sha256 +sha384 +sha512 -v > run.out
|
|
checkSuccess $?
|
|
|
|
echo "Power cycle"
|
|
-${PREFIX}powerup > run.out
|
|
+powerup > run.out
|
|
checkSuccess $?
|
|
|
|
echo "Startup"
|
|
diff --git a/utils/regtests/testevent.sh b/utils/regtests/testevent.sh
|
|
index 7b2ee94..c201cb2 100755
|
|
--- a/utils/regtests/testevent.sh
|
|
+++ b/utils/regtests/testevent.sh
|
|
@@ -71,7 +71,7 @@ do
|
|
do
|
|
|
|
echo "Power cycle to reset IMA PCR"
|
|
- ${PREFIX}powerup > run.out
|
|
+ powerup > run.out
|
|
checkSuccess $?
|
|
|
|
echo "Startup"
|
|
diff --git a/utils/regtests/testnvpin.sh b/utils/regtests/testnvpin.sh
|
|
index 2d96aed..0f09bab 100755
|
|
--- a/utils/regtests/testnvpin.sh
|
|
+++ b/utils/regtests/testnvpin.sh
|
|
@@ -248,7 +248,7 @@ ${PREFIX}nvwrite -ha 01000000 -hia p -id 0 1 > run.out
|
|
checkFailure $?
|
|
|
|
echo "Reboot"
|
|
-${PREFIX}powerup > run.out
|
|
+powerup > run.out
|
|
checkSuccess $?
|
|
|
|
echo "Startup"
|
|
@@ -456,7 +456,7 @@ ${PREFIX}nvwrite -ha 01000000 -hia p -id 0 1 > run.out
|
|
checkFailure $?
|
|
|
|
echo "Reboot"
|
|
-${PREFIX}powerup > run.out
|
|
+powerup > run.out
|
|
checkSuccess $?
|
|
|
|
echo "Startup"
|
|
diff --git a/utils/regtests/testpcr.sh b/utils/regtests/testpcr.sh
|
|
index f936d12..8d7bb98 100755
|
|
--- a/utils/regtests/testpcr.sh
|
|
+++ b/utils/regtests/testpcr.sh
|
|
@@ -191,7 +191,7 @@ do
|
|
checkSuccess $?
|
|
|
|
echo "powerup"
|
|
- ${PREFIX}powerup > run.out
|
|
+ powerup > run.out
|
|
checkSuccess $?
|
|
|
|
echo "startup"
|
|
diff --git a/utils/regtests/testshutdown.sh b/utils/regtests/testshutdown.sh
|
|
index dc45721..65c6f4d 100755
|
|
--- a/utils/regtests/testshutdown.sh
|
|
+++ b/utils/regtests/testshutdown.sh
|
|
@@ -147,7 +147,7 @@ ${PREFIX}shutdown -s -v > run.out
|
|
checkSuccess $?
|
|
|
|
echo "Power cycle"
|
|
-${PREFIX}powerup > run.out
|
|
+powerup > run.out
|
|
checkSuccess $?
|
|
|
|
echo "Startup state"
|
|
@@ -255,7 +255,7 @@ ${PREFIX}shutdown -s > run.out
|
|
checkSuccess $?
|
|
|
|
echo "Power cycle"
|
|
-${PREFIX}powerup > run.out
|
|
+powerup > run.out
|
|
checkSuccess $?
|
|
|
|
echo "Startup clear"
|
|
@@ -331,7 +331,7 @@ ${PREFIX}shutdown -c > run.out
|
|
checkSuccess $?
|
|
|
|
echo "Power cycle"
|
|
-${PREFIX}powerup > run.out
|
|
+powerup > run.out
|
|
checkSuccess $?
|
|
|
|
echo "Startup clear"
|
|
--
|
|
2.39.1
|
|
|