diff options
author | James Bottomley <James.Bottomley@HansenPartnership.com> | 2023-11-22 09:27:41 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2023-11-22 21:25:04 +0000 |
commit | cd38afd8f47900bd2002bf905cc57944d6030ccc (patch) | |
tree | 2196772d0a2bee349e3a50eab5fe31d666809aa2 | |
parent | d9433dc6be201d6c71a7decbecc482dce879b67b (diff) | |
download | openssl_tpm2_engine-cd38afd8f47900bd2002bf905cc57944d6030ccc.tar.gz |
tests: fix for swtpm and tpm_server being installed simultaneously
If both are installed, we will prefer the IBM swtpm2 (tpm_server), so
we are still able to run the nonopenssl_ecc test that swtpm fails.
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
-rwxr-xr-x | tests/create_nonopenssl_ecc.sh | 2 | ||||
-rwxr-xr-x | tests/start_sw_tpm.sh | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/tests/create_nonopenssl_ecc.sh b/tests/create_nonopenssl_ecc.sh index c1e6b4d..d018ac3 100755 --- a/tests/create_nonopenssl_ecc.sh +++ b/tests/create_nonopenssl_ecc.sh @@ -2,7 +2,7 @@ # swtpm doesn't have a correct implementation of the Barreto-Naehrig curves # which are the only openssl unparametrised ones, so skip the test -if [ -x "${SWTPM}" ]; then +if [ ! -x "${TPMSERVER}" -a -x "${SWTPM}" ]; then exit 77; fi diff --git a/tests/start_sw_tpm.sh b/tests/start_sw_tpm.sh index c968418..e8f4eda 100755 --- a/tests/start_sw_tpm.sh +++ b/tests/start_sw_tpm.sh @@ -3,10 +3,10 @@ set -x # 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 +if [ -x "${TPMSERVER}" ]; then ${TPMSERVER} > /dev/null 2>&1 & +else +${SWTPM} socket --tpm2 --server type=tcp,port=2321 --ctrl type=tcp,port=2322 --tpmstate dir=`pwd` & fi pid=$! echo ${pid} > tpm_server.pid @@ -16,7 +16,7 @@ echo ${pid} > tpm_server.pid # store it permanently at handle 81000001 and flush the transient ## a=0; while [ $a -lt 10 ]; do - if [ -x "${SWTPM_IOCTL}" ]; then + if [ ! -x "${TPMSERVER}" -a -x "${SWTPM_IOCTL}" ]; then ${SWTPM_IOCTL} --tcp 127.0.0.1:2322 -i else tsspowerup |