1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

tests:tpm2d: add missing start_sw_tpm.sh script

* tests/tpm2dtests/start_sw_tpm.sh: New.
* tests/tpm2dtests/Makefile.am: Add.
--

This accidentally got left out of the initial commit for testing
6720f1343 ("tpm2d: add tests for the tpm2daemon")

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>

Added to Makefile and wrote tiny ChangeLog.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
James Bottomley 2021-03-15 17:09:32 +01:00 committed by Werner Koch
parent 1523b5f76f
commit a788f2e830
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
2 changed files with 36 additions and 1 deletions

View file

@ -0,0 +1,35 @@
#!/bin/bash
# remove any prior TPM contents
rm -f NVChip h*.bin *.permall
if [ -x "${SWTPM}" ]; then
${SWTPM} socket --tpm2 --server type=tcp,port=2321 \
--ctrl type=tcp,port=2322 --tpmstate dir=`pwd` &
else
${TPMSERVER} > /dev/null 2>&1 &
fi
pid=$!
##
# This powers on the tpm and starts it
# then we derive the RSA version of the storage seed and
# store it permanently at handle 81000001 and flush the transient
##
a=0; while [ $a -lt 10 ]; do
if [ -x "${SWTPM_IOCTL}" ]; then
${SWTPM_IOCTL} --tcp 127.0.0.1:2322 -i > /dev/null 2>&1
else
tsspowerup > /dev/null 2>&1
fi
if [ $? -eq 0 ]; then
break;
fi
sleep 1
a=$[$a+1]
done
if [ $a -eq 10 ]; then
echo "Waited 10s for tpm_server to come up; exiting"
exit 1
fi
tssstartup || exit 1
echo -n $pid