tests: Enable running tests in out-of-source builds

Pass the top_builddir and top_srcdir via TESTS_ENVIRONMENT
variable in Makefile.am.

Use TESTDIR for the path to the test directory and replace
previously used DIR in all occurences.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
This commit is contained in:
Stefan Berger 2018-08-02 21:15:06 -04:00
parent 430a39d335
commit 313cf75c42
52 changed files with 332 additions and 292 deletions

View File

@ -6,6 +6,10 @@
check_PROGRAMS =
TESTS_ENVIRONMENT = \
abs_top_testdir=`cd '$(top_srcdir)'/tests; pwd` \
abs_top_builddir=`cd '$(top_builddir)'; pwd`
TESTS = \
test_vtpm_proxy \
test_tpm2_vtpm_proxy
@ -148,6 +152,7 @@ EXTRA_DIST=$(TESTS) \
_test_tpm2_resume_volatile \
_test_tpm2_savestate \
_test_tpm2_save_load_encrypted_state \
_test_tpm2_save_load_state_da_timeout \
_test_tpm2_setbuffersize \
_test_tpm2_swtpm_bios \
_test_tpm2_volatilestate \

View File

@ -3,9 +3,9 @@
# For the license, see the LICENSE file in the root directory.
#set -x
ROOT=${abs_top_builddir:-$(pwd)/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
DIR=$(dirname "$0")
ROOT=${DIR}/..
VTPM_NAME="vtpm-test-encrypted-state"
SWTPM_DEV_NAME="/dev/${VTPM_NAME}"
export TPM_PATH=$(mktemp -d)
@ -32,8 +32,8 @@ function cleanup()
trap "cleanup" EXIT
[ "${SWTPM_INTERFACE}" == cuse ] && source ${DIR}/test_cuse
source ${DIR}/common
[ "${SWTPM_INTERFACE}" == cuse ] && source ${TESTDIR}/test_cuse
source ${TESTDIR}/common
rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null

View File

@ -3,8 +3,9 @@
# For the license, see the LICENSE file in the root directory.
#set -x
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(pwd)/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
VTPM_NAME="vtpm-test-getcap"
SWTPM_DEV_NAME="/dev/${VTPM_NAME}"
export TPM_PATH=$(mktemp -d)
@ -25,8 +26,8 @@ function cleanup()
trap "cleanup" EXIT
[ "${SWTPM_INTERFACE}" == cuse ] && source ${DIR}/test_cuse
source ${DIR}/common
[ "${SWTPM_INTERFACE}" == cuse ] && source ${TESTDIR}/test_cuse
source ${TESTDIR}/common
rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null

View File

@ -3,8 +3,9 @@
# For the license, see the LICENSE file in the root directory.
#set -x
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(pwd)/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
VTPM_NAME="vtpm-test-hashing"
SWTPM_DEV_NAME="/dev/${VTPM_NAME}"
export TPM_PATH=$(mktemp -d)
@ -25,8 +26,8 @@ function cleanup()
trap "cleanup" EXIT
[ "${SWTPM_INTERFACE}" == cuse ] && source ${DIR}/test_cuse
source ${DIR}/common
[ "${SWTPM_INTERFACE}" == cuse ] && source ${TESTDIR}/test_cuse
source ${TESTDIR}/common
rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null

View File

@ -3,8 +3,9 @@
# For the license, see the LICENSE file in the root directory.
#set -x
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(pwd)/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
VTPM_NAME="vtpm-test-hashing2"
SWTPM_DEV_NAME="/dev/${VTPM_NAME}"
export TPM_PATH=$(mktemp -d)
@ -25,8 +26,8 @@ function cleanup()
trap "cleanup" EXIT
[ "${SWTPM_INTERFACE}" == cuse ] && source ${DIR}/test_cuse
source ${DIR}/common
[ "${SWTPM_INTERFACE}" == cuse ] && source ${TESTDIR}/test_cuse
source ${TESTDIR}/common
rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null

View File

@ -3,9 +3,9 @@
# For the license, see the LICENSE file in the root directory.
#set -x
ROOT=${abs_top_builddir:-$(pwd)/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
DIR=$(dirname "$0")
ROOT=${DIR}/..
VTPM_NAME="vtpm-test-init"
SWTPM_DEV_NAME="/dev/${VTPM_NAME}"
TPM_PATH=$(mktemp -d)
@ -27,8 +27,8 @@ function cleanup()
trap "cleanup" EXIT
[ "${SWTPM_INTERFACE}" == cuse ] && source ${DIR}/test_cuse
source ${DIR}/common
[ "${SWTPM_INTERFACE}" == cuse ] && source ${TESTDIR}/test_cuse
source ${TESTDIR}/common
rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null

View File

@ -3,8 +3,9 @@
# For the license, see the LICENSE file in the root directory.
#set -x
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(pwd)/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
VTPM_NAME="vtpm-test-locality"
SWTPM_DEV_NAME="/dev/${VTPM_NAME}"
export TPM_PATH=$(mktemp -d)
@ -25,8 +26,8 @@ function cleanup()
trap "cleanup" EXIT
[ "${SWTPM_INTERFACE}" == cuse ] && source ${DIR}/test_cuse
source ${DIR}/common
[ "${SWTPM_INTERFACE}" == cuse ] && source ${TESTDIR}/test_cuse
source ${TESTDIR}/common
rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null

View File

@ -3,12 +3,13 @@
# For the license, see the LICENSE file in the root directory.
# set -x
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(pwd)/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
VTPM_NAME="${VTPM_NAME:-vtpm-test-migration-key}"
SWTPM_DEV_NAME="/dev/${VTPM_NAME}"
MIGRATION_PASSWORD="migration"
VOLATILESTATE=${PWD}/${DIR}/data/migkey1/volatilestate.bin
VOLATILESTATE=${TESTDIR}/data/migkey1/volatilestate.bin
tpmstatedir=$(mktemp -d)
if [ -z "$tpmstatedir" ]; then
@ -44,12 +45,12 @@ function cleanup()
trap "cleanup" EXIT
[ "${SWTPM_INTERFACE}" == cuse ] && source ${DIR}/test_cuse
source ${DIR}/common
[ "${SWTPM_INTERFACE}" == cuse ] && source ${TESTDIR}/test_cuse
source ${TESTDIR}/common
# make a backup of the volatile state
export TPM_PATH=$tpmstatedir
cp ${PWD}/${DIR}/data/tpmstate1/* $TPM_PATH
cp ${TESTDIR}/data/tpmstate1/* $TPM_PATH
run_swtpm ${SWTPM_INTERFACE} --migration-key pwdfile=$migpwdfile,remove=false

View File

@ -3,8 +3,9 @@
# For the license, see the LICENSE file in the root directory.
#set -x
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(pwd)/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
VTPM_NAME="vtpm-test-resume-volatile"
SWTPM_DEV_NAME="/dev/${VTPM_NAME}"
@ -29,13 +30,13 @@ function cleanup()
trap "cleanup" EXIT
[ "${SWTPM_INTERFACE}" == cuse ] && source ${DIR}/test_cuse
source ${DIR}/common
[ "${SWTPM_INTERFACE}" == cuse ] && source ${TESTDIR}/test_cuse
source ${TESTDIR}/common
export TPM_PATH=$tpmstatedir
# copy all the state files
cp ${PWD}/${DIR}/data/tpmstate1/* ${TPM_PATH}
cp ${TESTDIR}/data/tpmstate1/* ${TPM_PATH}
run_swtpm ${SWTPM_INTERFACE}
@ -91,9 +92,9 @@ echo "Test 1: Ok"
# 2nd test: with encrypted state
# copy all the state files
cp ${PWD}/${DIR}/data/tpmstate2/* ${TPM_PATH}
cp ${TESTDIR}/data/tpmstate2/* ${TPM_PATH}
run_swtpm ${SWTPM_INTERFACE} --key pwdfile=${PWD}/${DIR}/data/tpmstate2/pwdfile.txt
run_swtpm ${SWTPM_INTERFACE} --key pwdfile=${TESTDIR}/data/tpmstate2/pwdfile.txt
ps aux | grep $SWTPM | grep -v grep

View File

@ -3,8 +3,9 @@
# For the license, see the LICENSE file in the root directory.
#set -x
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(pwd)/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
VTPM_NAME="${VTPM_NAME:-vtpm-test-save-load-encrypted-state}"
SWTPM_DEV_NAME="/dev/${VTPM_NAME}"
export TPM_PATH=$(mktemp -d)
@ -33,8 +34,8 @@ function cleanup()
trap "cleanup" EXIT
[ "${SWTPM_INTERFACE}" == cuse ] && source ${DIR}/test_cuse
source ${DIR}/common
[ "${SWTPM_INTERFACE}" == cuse ] && source ${TESTDIR}/test_cuse
source ${TESTDIR}/common
rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null

View File

@ -3,8 +3,9 @@
# For the license, see the LICENSE file in the root directory.
#set -x
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(pwd)/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
VTPM_NAME="${VTPM_NAME:-vtpm-test-save-load-state}"
SWTPM_DEV_NAME="/dev/${VTPM_NAME}"
export TPM_PATH=$(mktemp -d)
@ -30,8 +31,8 @@ function cleanup()
trap "cleanup" EXIT
[ "${SWTPM_INTERFACE}" == cuse ] && source ${DIR}/test_cuse
source ${DIR}/common
[ "${SWTPM_INTERFACE}" == cuse ] && source ${TESTDIR}/test_cuse
source ${TESTDIR}/common
rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null

View File

@ -1,10 +1,11 @@
#!/bin/bash
# For the license, see the LICENSE file in the root directory.
set -x
# set -x
ROOT=${abs_top_builddir:-$(pwd)/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
DIR=$(dirname "$0")
ROOT=${DIR}/..
VTPM_NAME="vtpm-test-setbuffersize"
SWTPM_DEV_NAME="/dev/${VTPM_NAME}"
export TPM_PATH=$(mktemp -d)
@ -26,8 +27,8 @@ function cleanup()
trap "cleanup" EXIT
[ "${SWTPM_INTERFACE}" == cuse ] && source ${DIR}/test_cuse
source ${DIR}/common
[ "${SWTPM_INTERFACE}" == cuse ] && source ${TESTDIR}/test_cuse
source ${TESTDIR}/common
rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null

View File

@ -3,8 +3,9 @@
# For the license, see the LICENSE file in the root directory.
#set -x
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(pwd)/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
SWTPM_BIOS=$ROOT/src/swtpm_bios/swtpm_bios
VTPM_NAME="vtpm-test-swtpm-bios"
SWTPM_DEV_NAME="/dev/${VTPM_NAME}"
@ -27,8 +28,8 @@ function cleanup()
trap "cleanup" EXIT
[ "${SWTPM_INTERFACE}" == cuse ] && source ${DIR}/test_cuse
source ${DIR}/common
[ "${SWTPM_INTERFACE}" == cuse ] && source ${TESTDIR}/test_cuse
source ${TESTDIR}/common
rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null

View File

@ -3,8 +3,9 @@
# For the license, see the LICENSE file in the root directory.
#set -x
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(pwd)/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
VTPM_NAME=${VTPM_NAME:-vtpm-test-tpm2-encrypted-state}
SWTPM_DEV_NAME="/dev/${VTPM_NAME}"
export TPM_PATH=$(mktemp -d)
@ -31,8 +32,8 @@ function cleanup()
trap "cleanup" EXIT
[ "${SWTPM_INTERFACE}" == "cuse" ] && source ${DIR}/test_cuse
source ${DIR}/common
[ "${SWTPM_INTERFACE}" == "cuse" ] && source ${TESTDIR}/test_cuse
source ${TESTDIR}/common
rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null

View File

@ -3,8 +3,9 @@
# For the license, see the LICENSE file in the root directory.
#set -x
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(pwd)/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
VTPM_NAME="vtpm-test-tpm2-getcap"
SWTPM_DEV_NAME="/dev/${VTPM_NAME}"
export TPM_PATH=$(mktemp -d)
@ -25,8 +26,8 @@ function cleanup()
trap "cleanup" EXIT
[ "${SWTPM_INTERFACE}" == "cuse" ] && source ${DIR}/test_cuse
source ${DIR}/common
[ "${SWTPM_INTERFACE}" == "cuse" ] && source ${TESTDIR}/test_cuse
source ${TESTDIR}/common
rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null

View File

@ -3,8 +3,9 @@
# For the license, see the LICENSE file in the root directory.
#set -x
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(pwd)/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
VTPM_NAME="vtpm-test-tpm2-hashing"
SWTPM_DEV_NAME="/dev/${VTPM_NAME}"
export TPM_PATH=$(mktemp -d)
@ -26,8 +27,8 @@ function cleanup()
trap "cleanup" EXIT
[ "${SWTPM_INTERFACE}" == "cuse" ] && source ${DIR}/test_cuse
source ${DIR}/common
[ "${SWTPM_INTERFACE}" == "cuse" ] && source ${TESTDIR}/test_cuse
source ${TESTDIR}/common
rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null

View File

@ -3,8 +3,9 @@
# For the license, see the LICENSE file in the root directory.
#set -x
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(pwd)/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
VTPM_NAME="vtpm-test-tpm2-hashing2"
SWTPM_DEV_NAME="/dev/${VTPM_NAME}"
export TPM_PATH=$(mktemp -d)
@ -25,8 +26,8 @@ function cleanup()
trap "cleanup" EXIT
[ "${SWTPM_INTERFACE}" == "cuse" ] && source ${DIR}/test_cuse
source ${DIR}/common
[ "${SWTPM_INTERFACE}" == "cuse" ] && source ${TESTDIR}/test_cuse
source ${TESTDIR}/common
rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null

View File

@ -3,8 +3,9 @@
# For the license, see the LICENSE file in the root directory.
#set -x
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(pwd)/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
VTPM_NAME="vtpm-test-tpm2-hashing3"
SWTPM_DEV_NAME="/dev/${VTPM_NAME}"
export TPM_PATH=$(mktemp -d)
@ -25,8 +26,8 @@ function cleanup()
trap "cleanup" EXIT
[ "${SWTPM_INTERFACE}" == "cuse" ] && source ${DIR}/test_cuse
source ${DIR}/common
[ "${SWTPM_INTERFACE}" == "cuse" ] && source ${TESTDIR}/test_cuse
source ${TESTDIR}/common
rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null

View File

@ -3,8 +3,9 @@
# For the license, see the LICENSE file in the root directory.
#set -x
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(pwd)/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
VTPM_NAME="vtpm-test-tpm2-init"
SWTPM_DEV_NAME="/dev/${VTPM_NAME}"
export TPM_PATH=$(mktemp -d)
@ -25,8 +26,8 @@ function cleanup()
trap "cleanup" EXIT
[ "${SWTPM_INTERFACE}" == "cuse" ] && source ${DIR}/test_cuse
source ${DIR}/common
[ "${SWTPM_INTERFACE}" == "cuse" ] && source ${TESTDIR}/test_cuse
source ${TESTDIR}/common
rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null

View File

@ -3,8 +3,9 @@
# For the license, see the LICENSE file in the root directory.
#set -x
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(pwd)/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
VTPM_NAME="vtpm-test-tpm2-locality"
SWTPM_DEV_NAME="/dev/${VTPM_NAME}"
export TPM_PATH=$(mktemp -d)
@ -25,8 +26,8 @@ function cleanup()
trap "cleanup" EXIT
[ "${SWTPM_INTERFACE}" == "cuse" ] && source ${DIR}/test_cuse
source ${DIR}/common
[ "${SWTPM_INTERFACE}" == "cuse" ] && source ${TESTDIR}/test_cuse
source ${TESTDIR}/common
rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null

View File

@ -3,12 +3,13 @@
# For the license, see the LICENSE file in the root directory.
# set -x
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(pwd)/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
VTPM_NAME="${VTPM_NAME:-vtpm-test-tpm2-migration-key}"
SWTPM_DEV_NAME=/dev/${VTPM_NAME}
MIGRATION_PASSWORD="migration"
VOLATILESTATE=${PWD}/${DIR}/data/migkey1/tpm2-volatilestate.bin
VOLATILESTATE=${TESTDIR}/data/migkey1/tpm2-volatilestate.bin
SWTPM_INTERFACE=${SWTPM_INTERFACE:-cuse}
function cleanup()
@ -45,12 +46,12 @@ logfile=$(mktemp)
SWTPM_CMD_UNIX_PATH=${tpmstatedir}/unix-cmd.sock
SWTPM_CTRL_UNIX_PATH=${tpmstatedir}/unix-ctrl.sock
[ "${SWTPM_INTERFACE}" == "cuse" ] && source ${DIR}/test_cuse
source ${DIR}/common
[ "${SWTPM_INTERFACE}" == "cuse" ] && source ${TESTDIR}/test_cuse
source ${TESTDIR}/common
# make a backup of the volatile state
export TPM_PATH=$tpmstatedir
cp ${PWD}/${DIR}/data/tpm2state1/* $TPM_PATH
cp ${TESTDIR}/data/tpm2state1/* $TPM_PATH
rm -f ${logfile}
run_swtpm ${SWTPM_INTERFACE} \

View File

@ -3,8 +3,9 @@
# For the license, see the LICENSE file in the root directory.
#set -x
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(pwd)/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
VTPM_NAME="vtpm-test-tpm2-probe"
SWTPM_DEV_NAME="/dev/${VTPM_NAME}"
export TPM_PATH=$(mktemp -d)
@ -25,8 +26,8 @@ function cleanup()
trap "cleanup" EXIT
[ "${SWTPM_INTERFACE}" == "cuse" ] && source ${DIR}/test_cuse
source ${DIR}/common
[ "${SWTPM_INTERFACE}" == "cuse" ] && source ${TESTDIR}/test_cuse
source ${TESTDIR}/common
rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null

View File

@ -3,8 +3,9 @@
# For the license, see the LICENSE file in the root directory.
#set -x
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(pwd)/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
VTPM_NAME=${vtpm-test-tpm2-resume-volatile:-VTPM_NAME}
SWTPM_DEV_NAME="/dev/${VTPM_NAME}"
SWTPM_INTERFACE=${SWTPM_INTERFACE:-cuse}
@ -29,13 +30,13 @@ function cleanup()
trap "cleanup" EXIT
[ "${SWTPM_INTERFACE}" == "cuse" ] && source ${DIR}/test_cuse
source ${DIR}/common
[ "${SWTPM_INTERFACE}" == "cuse" ] && source ${TESTDIR}/test_cuse
source ${TESTDIR}/common
export TPM_PATH=$tpmstatedir
# copy all the state files
cp ${PWD}/${DIR}/data/tpm2state1/* ${TPM_PATH}
cp ${TESTDIR}/data/tpm2state1/* ${TPM_PATH}
run_swtpm ${SWTPM_INTERFACE} --tpm2
@ -91,11 +92,11 @@ echo "Test 1: Ok"
# 2nd test: with encrypted state
# copy all the state files
cp ${PWD}/${DIR}/data/tpm2state2/* ${TPM_PATH}
cp ${TESTDIR}/data/tpm2state2/* ${TPM_PATH}
run_swtpm ${SWTPM_INTERFACE} \
--tpm2 \
--key pwdfile=${PWD}/${DIR}/data/tpm2state2/pwdfile.txt
--key pwdfile=${TESTDIR}/data/tpm2state2/pwdfile.txt
ps aux | grep $SWTPM | grep -v grep

View File

@ -3,8 +3,9 @@
# For the license, see the LICENSE file in the root directory.
#set -x
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(pwd)/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
VTPM_NAME="${VTPM_NAME:-vtpm-test-tpm2-save-load-encrypted-state}"
SWTPM_DEV_NAME="/dev/${VTPM_NAME}"
export TPM_PATH=$(mktemp -d)
@ -33,8 +34,8 @@ function cleanup()
trap "cleanup" EXIT
[ "${SWTPM_INTERFACE}" == "cuse" ] && source ${DIR}/test_cuse
source ${DIR}/common
[ "${SWTPM_INTERFACE}" == "cuse" ] && source ${TESTDIR}/test_cuse
source ${TESTDIR}/common
rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null

View File

@ -3,9 +3,9 @@
# For the license, see the LICENSE file in the root directory.
#set -x
ROOT=${abs_top_builddir:-$(pwd)/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
DIR=$(dirname "$0")
ROOT=${DIR}/..
VTPM_NAME="${VTPM_NAME:-vtpm-tpm2-test-save-load-state}"
SWTPM_DEV_NAME="/dev/${VTPM_NAME}"
export TPM_PATH=$(mktemp -d)
@ -31,8 +31,8 @@ function cleanup()
trap "cleanup" EXIT
[ "${SWTPM_INTERFACE}" == "cuse" ] && source ${DIR}/test_cuse
source ${DIR}/common
[ "${SWTPM_INTERFACE}" == "cuse" ] && source ${TESTDIR}/test_cuse
source ${TESTDIR}/common
rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null

View File

@ -4,8 +4,9 @@
#set -x
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(pwd)/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
VTPM_NAME="${VTPM_NAME:-vtpm-tpm2-test-save-load-state-da-timeout}"
SWTPM_DEV_NAME="/dev/${VTPM_NAME}"
export TPM_PATH=$(mktemp -d)
@ -31,8 +32,8 @@ function cleanup()
trap "cleanup" EXIT
[ "${SWTPM_INTERFACE}" == "cuse" ] && source ${DIR}/test_cuse
source ${DIR}/common
[ "${SWTPM_INTERFACE}" == "cuse" ] && source ${TESTDIR}/test_cuse
source ${TESTDIR}/common
rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null

View File

@ -3,8 +3,9 @@
# For the license, see the LICENSE file in the root directory.
#set -x
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(pwd)/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
VTPM_NAME="vtpm-test-tpm2-savestate"
SWTPM_DEV_NAME="/dev/${VTPM_NAME}"
export TPM_PATH=$(mktemp -d)
@ -25,8 +26,8 @@ function cleanup()
trap "cleanup" EXIT
[ "${SWTPM_INTERFACE}" == "cuse" ] && source ${DIR}/test_cuse
source ${DIR}/common
[ "${SWTPM_INTERFACE}" == "cuse" ] && source ${TESTDIR}/test_cuse
source ${TESTDIR}/common
rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null

View File

@ -3,8 +3,9 @@
# For the license, see the LICENSE file in the root directory.
#set -x
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(pwd)/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
VTPM_NAME="vtpm-test-tpm2-setbuffersize"
SWTPM_DEV_NAME="/dev/${VTPM_NAME}"
export TPM_PATH=$(mktemp -d)
@ -26,8 +27,8 @@ function cleanup()
trap "cleanup" EXIT
[ "${SWTPM_INTERFACE}" == cuse ] && source ${DIR}/test_cuse
source ${DIR}/common
[ "${SWTPM_INTERFACE}" == cuse ] && source ${TESTDIR}/test_cuse
source ${TESTDIR}/common
rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null

View File

@ -3,8 +3,9 @@
# For the license, see the LICENSE file in the root directory.
#set -x
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(pwd)/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
VTPM_NAME="vtpm-test-tpm2-swtpm-bios"
SWTPM_DEV_NAME="/dev/${VTPM_NAME}"
TPM_PATH=$(mktemp -d)
@ -26,8 +27,8 @@ function cleanup()
trap "cleanup" EXIT
[ "${SWTPM_INTERFACE}" == "cuse" ] && source ${DIR}/test_cuse
source ${DIR}/common
[ "${SWTPM_INTERFACE}" == "cuse" ] && source ${TESTDIR}/test_cuse
source ${TESTDIR}/common
rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null

View File

@ -3,8 +3,9 @@
# For the license, see the LICENSE file in the root directory.
# set -x
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(pwd)/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
VTPM_NAME="vtpm-test-tpm2-volatilestate"
SWTPM_DEV_NAME="/dev/${VTPM_NAME}"
export TPM_PATH=$(mktemp -d)
@ -25,8 +26,8 @@ function cleanup()
trap "cleanup" EXIT
[ "${SWTPM_INTERFACE}" == "cuse" ] && source ${DIR}/test_cuse
source ${DIR}/common
[ "${SWTPM_INTERFACE}" == "cuse" ] && source ${TESTDIR}/test_cuse
source ${TESTDIR}/common
rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null

View File

@ -3,8 +3,9 @@
# For the license, see the LICENSE file in the root directory.
#set -x
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(pwd)/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
VTPM_NAME="vtpm-test-tpm2-wrongorder"
SWTPM_DEV_NAME="/dev/${VTPM_NAME}"
export TPM_PATH=$(mktemp -d)
@ -25,8 +26,8 @@ function cleanup()
trap "cleanup" EXIT
[ "${SWTPM_INTERFACE}" == "cuse" ] && source ${DIR}/test_cuse
source ${DIR}/common
[ "${SWTPM_INTERFACE}" == "cuse" ] && source ${TESTDIR}/test_cuse
source ${TESTDIR}/common
rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null

View File

@ -3,9 +3,9 @@
# For the license, see the LICENSE file in the root directory.
#set -x
ROOT=${abs_top_builddir:-$(pwd)/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
DIR=$(dirname "$0")
ROOT=${DIR}/..
VTPM_NAME="vtpm-test-tpm-probe"
SWTPM_DEV_NAME="/dev/${VTPM_NAME}"
export TPM_PATH=$(mktemp -d)
@ -26,8 +26,8 @@ function cleanup()
trap "cleanup" EXIT
[ "${SWTPM_INTERFACE}" == "cuse" ] && source ${DIR}/test_cuse
source ${DIR}/common
[ "${SWTPM_INTERFACE}" == "cuse" ] && source ${TESTDIR}/test_cuse
source ${TESTDIR}/common
rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null

View File

@ -3,8 +3,9 @@
# For the license, see the LICENSE file in the root directory.
#set -x
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(pwd)/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
VTPM_NAME="vtpm-test-volatilestate"
SWTPM_DEV_NAME="/dev/${VTPM_NAME}"
export TPM_PATH=$(mktemp -d)
@ -25,8 +26,8 @@ function cleanup()
trap "cleanup" EXIT
[ "${SWTPM_INTERFACE}" == cuse ] && source ${DIR}/test_cuse
source ${DIR}/common
[ "${SWTPM_INTERFACE}" == cuse ] && source ${TESTDIR}/test_cuse
source ${TESTDIR}/common
rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null

View File

@ -3,8 +3,9 @@
# For the license, see the LICENSE file in the root directory.
#set -x
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(pwd)/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
VTPM_NAME="vtpm-test-wrongorder"
SWTPM_DEV_NAME="/dev/${VTPM_NAME}"
export TPM_PATH=$(mktemp -d)
@ -26,9 +27,9 @@ function cleanup()
trap "cleanup" EXIT
[ "${SWTPM_INTERFACE}" == cuse ] && source ${DIR}/test_cuse
source ${DIR}/common
source ${DIR}/test_common
[ "${SWTPM_INTERFACE}" == cuse ] && source ${TESTDIR}/test_cuse
source ${TESTDIR}/common
source ${TESTDIR}/test_common
rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null

View File

@ -1,7 +1,4 @@
DIR=$(dirname "$0")
ROOT=${DIR}/..
SWTPM=swtpm
SWTPM_EXE=${SWTPM_EXE:-${ROOT}/src/swtpm/${SWTPM}}
SWTPM_IOCTL=${SWTPM_IOCTL:-${ROOT}/src/swtpm_ioctl/swtpm_ioctl}

View File

@ -2,19 +2,17 @@
# For the license, see the LICENSE file in the root directory.
DIR=$(dirname "$0")
ROOT=${DIR}/..
SWTPM=swtpm
SWTPM_EXE=$ROOT/src/swtpm/$SWTPM
ROOT=${abs_top_builddir:-$(dirname "$0")/..}
TESTDIR=${abs_top_testdir:=$(dirname "$0")}
# need SWTPM to be set
source ${TESTDIR}/common
TPMDIR=`mktemp -d`
TPMAUTHORING=$ROOT/src/swtpm_setup/swtpm_setup
PID_FILE=$TPMDIR/${SWTPM}.pid
LOG_FILE=$TPMDIR/${SWTPM}.log
PATH=${PWD}/${ROOT}/src/swtpm:$PATH
PATH=${PWD}/${ROOT}/src/swtpm_setup:$PATH
PATH=${PWD}/${ROOT}/src/swtpm_bios:$PATH
source ${DIR}/test_common
source ${TESTDIR}/test_common
trap "cleanup" SIGTERM EXIT
@ -96,8 +94,7 @@ if [ "$PIDF" != "$PID" ]; then
exit 1
fi
swtpm_bios &>/dev/null
${SWTPM_BIOS} &>/dev/null
if [ $? -ne 0 ]; then
echo "Test 1 failed: tpm_bios did not work"
@ -171,7 +168,7 @@ echo "Test 2 passed"
# Test 3: test --fd= and --ctrl type=unxio,clientfd=
# The python script execs swtpm with client sockets
exec 20<&1-; exec 21<&2-
LOG=$(PID_FILE=$TPMDIR/swtpm.pid SWTPM_EXE=$SWTPM_EXE TPMDIR=$TPMDIR exec $DIR/test_clientfds.py)
LOG=$(PID_FILE=$TPMDIR/swtpm.pid SWTPM_EXE=$SWTPM_EXE TPMDIR=$TPMDIR exec $TESTDIR/test_clientfds.py)
RES=$?
exec 1<&20-; exec 2<&21-

View File

@ -2,8 +2,9 @@
# For the license, see the LICENSE file in the root directory.
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(dirname "$0")/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
TPMDIR=`mktemp -d`
SWTPM_CTRL_UNIX_PATH=$TPMDIR/sock
PID_FILE=$TPMDIR/swtpm.pid
@ -11,7 +12,7 @@ LOG_FILE=$TPMDIR/swtpm.log
CMD_PATH=$TPMDIR/cmd
RESP_PATH=$TPMDIR/resp
source ${DIR}/test_common
source ${TESTDIR}/test_common
trap "cleanup" SIGTERM EXIT
@ -26,7 +27,7 @@ function cleanup()
SWTPM_INTERFACE=socket+unix
SWTPM_SERVER_PORT=65430
SWTPM_SERVER_NAME=localhost
source ${DIR}/common
source ${TESTDIR}/common
# Test 1: test the control channel on the socket tpm
@ -387,12 +388,12 @@ echo "OK"
# Test 3: test the control channel on the socket tpm: resume encrypted state
# copy all the state files
cp ${PWD}/${DIR}/data/tpmstate2/* ${TPMDIR}
cp ${TESTDIR}/data/tpmstate2/* ${TPMDIR}
run_swtpm ${SWTPM_INTERFACE} \
--tpmstate dir=$TPMDIR \
--pid file=$PID_FILE \
--key pwdfile=${PWD}/${DIR}/data/tpmstate2/pwdfile.txt \
--key pwdfile=${TESTDIR}/data/tpmstate2/pwdfile.txt \
--log file=$LOG_FILE,level=20 \
--flags not-need-init
@ -457,7 +458,7 @@ rm -f $TPMDIR/*.volatilestate
run_swtpm ${SWTPM_INTERFACE} \
--tpmstate dir=$TPMDIR \
--pid file=$PID_FILE \
--key pwdfile=${PWD}/${DIR}/data/tpmstate2/pwdfile.txt \
--key pwdfile=${TESTDIR}/data/tpmstate2/pwdfile.txt \
--log file=$LOG_FILE \
--flags not-need-init

View File

@ -2,8 +2,9 @@
# For the license, see the LICENSE file in the root directory.
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(dirname "$0")/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
SWTPM=swtpm
SWTPM_EXE=${SWTPM_EXE:-$ROOT/src/swtpm/$SWTPM}
SWTPM_IOCTL=${SWTPM_IOCTL:-$ROOT/src/swtpm_ioctl/swtpm_ioctl}
@ -14,7 +15,7 @@ CMD_PATH=$TPMDIR/cmd
RESP_PATH=$TPMDIR/resp
VOLATILESTATE=$TPMDIR/volatile
source ${DIR}/common
source ${TESTDIR}/common
trap "cleanup" SIGTERM EXIT
@ -300,14 +301,14 @@ echo "OK"
# Test 3: test the control channel on the socket tpm: resume encrypted state
# copy all the state files
cp ${PWD}/${DIR}/data/tpmstate2/* ${TPMDIR}
cp ${TESTDIR}/data/tpmstate2/* ${TPMDIR}
$SWTPM_EXE socket \
--server port=65431,disconnect=true \
--tpmstate dir=$TPMDIR \
--pid file=$PID_FILE \
--ctrl type=unixio,path=$SOCK_PATH \
--key pwdfile=${PWD}/${DIR}/data/tpmstate2/pwdfile.txt \
--key pwdfile=${TESTDIR}/data/tpmstate2/pwdfile.txt \
--flags not-need-init &
if wait_for_file $PID_FILE 3; then
@ -363,7 +364,7 @@ $SWTPM_EXE socket \
--tpmstate dir=$TPMDIR \
--pid file=$PID_FILE \
--ctrl type=unixio,path=$SOCK_PATH \
--key pwdfile=${PWD}/${DIR}/data/tpmstate2/pwdfile.txt \
--key pwdfile=${TESTDIR}/data/tpmstate2/pwdfile.txt \
--flags not-need-init &
if wait_for_file $PID_FILE 3; then

View File

@ -2,14 +2,15 @@
# For the license, see the LICENSE file in the root directory.
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(dirname "$0")/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
TPMDIR=`mktemp -d`
SWTPM_CTRL_UNIX_PATH=$TPMDIR/sock
PID_FILE=$TPMDIR/swtpm.pid
LOG_FILE=$TPMDIR/swtpm.log
source ${DIR}/test_common
source ${TESTDIR}/test_common
trap "cleanup" SIGTERM EXIT
@ -21,7 +22,7 @@ function cleanup()
fi
}
source ${DIR}/common
source ${TESTDIR}/common
if ! [[ "$(uname -o)" =~ Linux ]]; then
echo "Need Linux to run UnixIO test for CMD_SET_DATAFD."
@ -29,7 +30,7 @@ if ! [[ "$(uname -o)" =~ Linux ]]; then
fi
# Test CMD_SET_DATAFD
cp ${PWD}/${DIR}/data/tpmstate1/* ${TPMDIR}
cp ${TESTDIR}/data/tpmstate1/* ${TPMDIR}
$SWTPM_EXE socket \
--flags not-need-init \
--ctrl type=unixio,path=$SWTPM_CTRL_UNIX_PATH \
@ -44,7 +45,7 @@ if wait_for_file $PID_FILE 3; then
exit 1
fi
LOG=$(SOCK_PATH=$SWTPM_CTRL_UNIX_PATH exec python $DIR/test_setdatafd.py)
LOG=$(SOCK_PATH=$SWTPM_CTRL_UNIX_PATH exec python $TESTDIR/test_setdatafd.py)
res=$?
if [ $res -ne 0 ]; then

View File

@ -2,14 +2,15 @@
# For the license, see the LICENSE file in the root directory.
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(dirname "$0")/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
TPMDIR=`mktemp -d`
SWTPM_CTRL_UNIX_PATH=$TPMDIR/sock
PID_FILE=$TPMDIR/swtpm.pid
LOG_FILE=$TPMDIR/swtpm.log
source ${DIR}/test_common
source ${TESTDIR}/test_common
trap "cleanup" SIGTERM EXIT
@ -22,7 +23,7 @@ function cleanup()
}
SWTPM_INTERFACE=socket+unix
source ${DIR}/common
source ${TESTDIR}/common
# Test 1: test the control channel on the chardev tpm

View File

@ -2,8 +2,8 @@
# For the license, see the LICENSE file in the root directory.
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(dirname "$0")/..}
TESTDIR=${abs_top_testdir:=$(dirname "$0")}
PARAMETERS=(
""
@ -21,9 +21,9 @@ PARAMETERS=(
"--take-ownership --srk-well-known"
"--take-ownership --owner-well-known"
"--take-ownership --srk-well-known --owner-well-known"
"--createek --create-ek-cert --create-platform-cert --lock-nvram --config ${DIR}/swtpm_setup.conf --vmid test --display"
"--createek --create-ek-cert --create-platform-cert --lock-nvram --config ${DIR}/swtpm_setup.conf --vmid test --display --keyfile ${DIR}/data/keyfile.txt"
"--createek --create-ek-cert --create-platform-cert --lock-nvram --config ${DIR}/swtpm_setup.conf --vmid test --display --pwdfile ${DIR}/data/pwdfile.txt"
"--createek --create-ek-cert --create-platform-cert --lock-nvram --config ${TESTDIR}/swtpm_setup.conf --vmid test --display"
"--createek --create-ek-cert --create-platform-cert --lock-nvram --config ${TESTDIR}/swtpm_setup.conf --vmid test --display --keyfile ${TESTDIR}/data/keyfile.txt"
"--createek --create-ek-cert --create-platform-cert --lock-nvram --config ${TESTDIR}/swtpm_setup.conf --vmid test --display --pwdfile ${TESTDIR}/data/pwdfile.txt"
)
FILESIZES=(
@ -60,10 +60,9 @@ TPMDIR=`mktemp -d`
SWTPM_SETUP_CONF=$ROOT/etc/swtpm_setup.conf
# filesystem privileges require to run swtpm_setup as root during test
TPMAUTHORING="$ROOT/src/swtpm_setup/swtpm_setup --config ${SWTPM_SETUP_CONF} --runas root"
PATH=${PWD}/${ROOT}/src/swtpm_bios:$PATH
PATH=${PWD}/${ROOT}/src/swtpm_setup:$PATH
PATH=${ROOT}/src/swtpm_bios:$PATH
source ${DIR}/test_config
source ${TESTDIR}/test_config
trap "cleanup" SIGTERM EXIT

View File

@ -2,8 +2,9 @@
# For the license, see the LICENSE file in the root directory.
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(dirname "$0")/..}
TESTDIR=${abs_top_testdir:=$(dirname "$0")}
SWTPM_CERT=${ROOT}/src/swtpm_cert/swtpm_cert
cert=$(mktemp)
@ -33,8 +34,8 @@ function check_cert_size()
}
${SWTPM_CERT} \
--signkey ${DIR}/data/signkey.pem \
--issuercert ${DIR}/data/issuercert.pem \
--signkey ${TESTDIR}/data/signkey.pem \
--issuercert ${TESTDIR}/data/issuercert.pem \
--out-cert ${cert} \
--modulus 'b9dda830729de58f9f5bed2b3b9394ad4ec5afb9c390b89a3337250cbc575cfc8f31f7ffd3f05f4155076f7d1605381cd281b7f147b801154e4f89ee529fe36eae50f79561850e5b63037edaacbb390ea3fcd037e674fb179e3c5afe31214d78a756ca44cc6cf25421b51420ede548310c92b08a513ccc62fd0ef45dcf6546f6e865be6a661d045d1c47b60b428d11dc97cb9f35ee7c385bb20320934b015f8014e8fb19851c2af307e1e64648c142175e40b60615dc494fdb09ea5d5a6f3273b65a241e3cf30cc449b9fb3f900d1ed4be967b32b16f95a1d732dbfa143eaa1c2017556117f70faee5d77f836705d05405361ad5871a32161fa5a1234cfab497' \
--days 3650 \
@ -55,8 +56,8 @@ echo -n > ${cert}
echo "Test 1: OK"
${SWTPM_CERT} \
--signkey ${DIR}/data/signkey.pem \
--issuercert ${DIR}/data/issuercert.pem \
--signkey ${TESTDIR}/data/signkey.pem \
--issuercert ${TESTDIR}/data/issuercert.pem \
--out-cert ${cert} \
--modulus 'b9dda830729de58f9f5bed2b3b9394ad4ec5afb9c390b89a3337250cbc575cfc8f31f7ffd3f05f4155076f7d1605381cd281b7f147b801154e4f89ee529fe36eae50f79561850e5b63037edaacbb390ea3fcd037e674fb179e3c5afe31214d78a756ca44cc6cf25421b51420ede548310c92b08a513ccc62fd0ef45dcf6546f6e865be6a661d045d1c47b60b428d11dc97cb9f35ee7c385bb20320934b015f8014e8fb19851c2af307e1e64648c142175e40b60615dc494fdb09ea5d5a6f3273b65a241e3cf30cc449b9fb3f900d1ed4be967b32b16f95a1d732dbfa143eaa1c2017556117f70faee5d77f836705d05405361ad5871a32161fa5a1234cfab497' \
--days 3650 \
@ -78,10 +79,10 @@ echo -n > ${cert}
echo "Test 2: OK"
${SWTPM_CERT} \
--signkey ${DIR}/data/signkey.pem \
--issuercert ${DIR}/data/issuercert.pem \
--signkey ${TESTDIR}/data/signkey.pem \
--issuercert ${TESTDIR}/data/issuercert.pem \
--out-cert ${cert} \
--pubkey ${DIR}/data/pubek.pem \
--pubkey ${TESTDIR}/data/pubek.pem \
--days 3650 \
--subject "OU=foo,L=NewYork,ST=NY,C=US" \
--pem \
@ -106,9 +107,9 @@ echo "Test 3: OK"
${SWTPM_CERT} \
--type platform \
--signkey ${DIR}/data/signkey.pem \
--issuercert ${DIR}/data/issuercert.pem \
--pubkey ${DIR}/data/pubek.pem \
--signkey ${TESTDIR}/data/signkey.pem \
--issuercert ${TESTDIR}/data/issuercert.pem \
--pubkey ${TESTDIR}/data/pubek.pem \
--out-cert ${cert} \
--days 3650 \
--subject "OU=foo,L=NewYork,ST=NY,C=US" \

View File

@ -7,8 +7,9 @@ if [ "$(id -u)" -ne 0 ]; then
exit 77
fi
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(dirname "$0")/..}
TESTDIR=${abs_top_testdir:=$(dirname "$0")}
SWTPM_SETUP=${ROOT}/src/swtpm_setup/swtpm_setup
SWTPM_LOCALCA=${ROOT}/samples/swtpm-localca
SWTPM=${ROOT}/src/swtpm/swtpm
@ -20,7 +21,7 @@ SIGNINGKEY=${workdir}/signingkey.pem
ISSUERCERT=${workdir}/issuercert.pem
CERTSERIAL=${workdir}/certserial
PATH=${PWD}/${ROOT}/src/swtpm_bios:$PATH
PATH=${ROOT}/src/swtpm_bios:$PATH
trap "cleanup" SIGTERM EXIT

View File

@ -2,8 +2,9 @@
# For the license, see the LICENSE file in the root directory.
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(dirname "$0")/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
SWTPM=swtpm
SWTPM_EXE=$ROOT/src/swtpm/$SWTPM
SWTPM_IOCTL=$ROOT/src/swtpm_ioctl/swtpm_ioctl
@ -15,7 +16,7 @@ RESP_PATH=$TPMDIR/resp
LOGFILE=$TPMDIR/logfile
VOLATILESTATE=$TPMDIR/volatile
source ${DIR}/test_common
source ${TESTDIR}/test_common
trap "cleanup" SIGTERM EXIT
@ -321,14 +322,14 @@ exit 0
# Test 3: test the control channel on the socket tpm: resume encrypted state
# copy all the state files
cp ${PWD}/${DIR}/data/tpmstate2/* ${TPMDIR}
cp ${TESTDIR}/data/tpmstate2/* ${TPMDIR}
$SWTPM_EXE socket \
--server port=65532,disconnect=true \
--tpmstate dir=$TPMDIR \
--pid file=$PID_FILE \
--ctrl type=unixio,path=$SOCK_PATH \
--key pwdfile=${PWD}/${DIR}/data/tpmstate2/pwdfile.txt \
--key pwdfile=${TESTDIR}/data/tpmstate2/pwdfile.txt \
--tpm2 &
if wait_for_file $PID_FILE 3; then
@ -387,7 +388,7 @@ $SWTPM_EXE socket \
--tpmstate dir=$TPMDIR \
--pid file=$PID_FILE \
--ctrl type=unixio,path=$SOCK_PATH \
--key pwdfile=${PWD}/${DIR}/data/tpmstate2/pwdfile.txt &
--key pwdfile=${TESTDIR}/data/tpmstate2/pwdfile.txt &
if wait_for_file $PID_FILE 3; then
echo "Error: Socket TPM did not write pidfile."

View File

@ -2,27 +2,27 @@
# For the license, see the LICENSE file in the root directory.
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(dirname "$0")/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
PARAMETERS=(
""
"--createek"
"--createek --create-ek-cert --create-platform-cert --config ${DIR}/swtpm_setup.conf --vmid test --display"
"--createek --create-ek-cert --create-platform-cert --config ${DIR}/swtpm_setup.conf --vmid test --display --keyfile ${DIR}/data/keyfile.txt"
"--createek --create-ek-cert --create-platform-cert --config ${DIR}/swtpm_setup.conf --vmid test --display --pwdfile ${DIR}/data/pwdfile.txt"
"--createek --create-ek-cert --create-platform-cert --config ${TESTDIR}/swtpm_setup.conf --vmid test --display"
"--createek --create-ek-cert --create-platform-cert --config ${TESTDIR}/swtpm_setup.conf --vmid test --display --keyfile ${TESTDIR}/data/keyfile.txt"
"--createek --create-ek-cert --create-platform-cert --config ${TESTDIR}/swtpm_setup.conf --vmid test --display --pwdfile ${TESTDIR}/data/pwdfile.txt"
"--createek --allow-signing"
"--createek --allow-signing --create-ek-cert --create-platform-cert --config ${DIR}/swtpm_setup.conf --vmid test --display"
"--createek --allow-signing --create-ek-cert --create-platform-cert --config ${DIR}/swtpm_setup.conf --vmid test --display --keyfile ${DIR}/data/keyfile.txt"
"--createek --allow-signing --create-ek-cert --create-platform-cert --config ${DIR}/swtpm_setup.conf --vmid test --display --pwdfile ${DIR}/data/pwdfile.txt"
"--createek --allow-signing --create-ek-cert --create-platform-cert --config ${TESTDIR}/swtpm_setup.conf --vmid test --display"
"--createek --allow-signing --create-ek-cert --create-platform-cert --config ${TESTDIR}/swtpm_setup.conf --vmid test --display --keyfile ${TESTDIR}/data/keyfile.txt"
"--createek --allow-signing --create-ek-cert --create-platform-cert --config ${TESTDIR}/swtpm_setup.conf --vmid test --display --pwdfile ${TESTDIR}/data/pwdfile.txt"
"--ecc --createek"
"--ecc --createek --create-ek-cert --create-platform-cert --config ${DIR}/swtpm_setup.conf --vmid test --display"
"--ecc --createek --create-ek-cert --create-platform-cert --config ${DIR}/swtpm_setup.conf --vmid test --display --keyfile ${DIR}/data/keyfile.txt"
"--ecc --createek --create-ek-cert --create-platform-cert --config ${DIR}/swtpm_setup.conf --vmid test --display --pwdfile ${DIR}/data/pwdfile.txt"
"--ecc --createek --create-ek-cert --create-platform-cert --config ${TESTDIR}/swtpm_setup.conf --vmid test --display"
"--ecc --createek --create-ek-cert --create-platform-cert --config ${TESTDIR}/swtpm_setup.conf --vmid test --display --keyfile ${TESTDIR}/data/keyfile.txt"
"--ecc --createek --create-ek-cert --create-platform-cert --config ${TESTDIR}/swtpm_setup.conf --vmid test --display --pwdfile ${TESTDIR}/data/pwdfile.txt"
"--ecc --createek --allow-signing"
"--ecc --createek --allow-signing --create-ek-cert --create-platform-cert --config ${DIR}/swtpm_setup.conf --vmid test --display"
"--ecc --createek --allow-signing --create-ek-cert --create-platform-cert --config ${DIR}/swtpm_setup.conf --vmid test --display --keyfile ${DIR}/data/keyfile.txt"
"--ecc --createek --allow-signing --create-ek-cert --create-platform-cert --config ${DIR}/swtpm_setup.conf --vmid test --display --pwdfile ${DIR}/data/pwdfile.txt"
"--ecc --createek --allow-signing --create-ek-cert --create-platform-cert --config ${TESTDIR}/swtpm_setup.conf --vmid test --display"
"--ecc --createek --allow-signing --create-ek-cert --create-platform-cert --config ${TESTDIR}/swtpm_setup.conf --vmid test --display --keyfile ${TESTDIR}/data/keyfile.txt"
"--ecc --createek --allow-signing --create-ek-cert --create-platform-cert --config ${TESTDIR}/swtpm_setup.conf --vmid test --display --pwdfile ${TESTDIR}/data/pwdfile.txt"
)
# produced file size is always the same with TPM2
@ -39,10 +39,9 @@ SWTPM_SETUP_CONF=$ROOT/etc/swtpm_setup.conf
SWTPM_IOCTL=$ROOT/src/swtpm_ioctl/swtpm_ioctl
# filesystem privileges require to run swtpm_setup as root during test
TPMAUTHORING="$ROOT/src/swtpm_setup/swtpm_setup --tpm2 --config ${SWTPM_SETUP_CONF} --runas root"
PATH=${PWD}/${ROOT}/src/swtpm_bios:$PATH
PATH=${PWD}/${ROOT}/src/swtpm_setup:$PATH
PATH=${ROOT}/src/swtpm_bios:$PATH
source ${DIR}/test_config
source ${TESTDIR}/test_config
trap "cleanup" SIGTERM EXIT
@ -63,7 +62,7 @@ fi
# swtpm_setup.conf points to the local create_certs.sh
# For create_certs.sh to be found (with out full path)
# add this directory to the PATH
PATH=$PATH:$DIR
PATH=$PATH:$TESTDIR
for (( i=0; i<${#PARAMETERS[*]}; i++)); do
rm -rf $TPMDIR/*

View File

@ -3,8 +3,9 @@
# For the license, see the LICENSE file in the root directory.
#set -x
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(dirname "$0")/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
SWTPM_LOCALCA=${ROOT}/samples/swtpm-localca
workdir=$(mktemp -d)

View File

@ -14,8 +14,9 @@ if [ $? -ne 0 ]; then
fi
TOOLSPATH=$(dirname $(type -P ${PREFIX}startup))
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(dirname "$0")/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
SWTPM=swtpm
SWTPM_EXE=${SWTPM_EXE:-$ROOT/src/swtpm/$SWTPM}
SWTPM_IOCTL=$ROOT/src/swtpm_ioctl/swtpm_ioctl
@ -33,11 +34,11 @@ SIGFILE2=$TPMDIR/sigfile2
TMP2FILE=$TPMDIR/tmpfile2
HKEYPRIV=${DIR}/data/tpm2state3/hkey.priv
HKEYPUB=${DIR}/data/tpm2state3/hkey.pub
HKEYPRIV=${TESTDIR}/data/tpm2state3/hkey.priv
HKEYPUB=${TESTDIR}/data/tpm2state3/hkey.pub
source ${DIR}/test_common
source ${DIR}/common
source ${TESTDIR}/test_common
source ${TESTDIR}/common
trap "cleanup" SIGTERM EXIT
@ -222,7 +223,7 @@ function test_primary()
-if ${BINFILE} > $TMPFILE
else
${TOOLSPATH}/${PREFIX}verifysignature -hk 81000000 \
-is ${DIR}/data/tpm2state3/signature.bin \
-is ${TESTDIR}/data/tpm2state3/signature.bin \
-if ${BINFILE} > $TMPFILE
fi
if [ $? -ne 0 ]; then
@ -621,7 +622,7 @@ function test_primary_volatile_load()
local sigfile=${SIGFILE} hash1 hash2
if [ $previousstate -ne 0 ]; then
sigfile=${DIR}/data/tpm2state3d/signature2.bin
sigfile=${TESTDIR}/data/tpm2state3d/signature2.bin
fi
printf "Checking availability of key with handle 0x80000000\n"
@ -715,8 +716,8 @@ echo "============================" >> $LOGFILE
echo "TPM was shut down"
# Store this state for later usage
# cp $TPMDIR/tpm2-00.permall ${DIR}/data/tpm2state3;
# cp $SIGFILE ${DIR}/data/tpm2state3/signature.bin
# cp $TPMDIR/tpm2-00.permall ${TESTDIR}/data/tpm2state3;
# cp $SIGFILE ${TESTDIR}/data/tpm2state3/signature.bin
#################################################################
# Run TPM2 with the created state and verify it's the same
@ -779,7 +780,7 @@ echo "TPM was shut down"
# Run TPM2 with previously saved state and verify it's the same
rm -f $TPMDIR/*
cp -f ${DIR}/data/tpm2state3/tpm2-00.permall $TPMDIR/tpm2-00.permall
cp -f ${TESTDIR}/data/tpm2state3/tpm2-00.permall $TPMDIR/tpm2-00.permall
$SWTPM_EXE socket \
--server port=${TPM_COMMAND_PORT} \
@ -897,10 +898,10 @@ fi
# Run TPM2 with the saved volatile state
# create a backup for running the next test...
# cp $TPMDIR/tpm2-00.permall ${DIR}/data/tpm2state3b/tpm2-00.permall
# cp $TPMDIR/tpm2-00.volatilestate ${DIR}/data/tpm2state3b/tpm2-00.volatilestate
# cp $TPMDIR/h02000000.bin ${DIR}/data/tpm2state3b/h02000000.bin
# cp $TPMDIR/h81000000.bin ${DIR}/data/tpm2state3b/h81000000.bin
# cp $TPMDIR/tpm2-00.permall ${TESTDIR}/data/tpm2state3b/tpm2-00.permall
# cp $TPMDIR/tpm2-00.volatilestate ${TESTDIR}/data/tpm2state3b/tpm2-00.volatilestate
# cp $TPMDIR/h02000000.bin ${TESTDIR}/data/tpm2state3b/h02000000.bin
# cp $TPMDIR/h81000000.bin ${TESTDIR}/data/tpm2state3b/h81000000.bin
$SWTPM_EXE socket \
--server port=${TPM_COMMAND_PORT} \
@ -946,10 +947,10 @@ fi
# Run TPM2 with previously saved (volatile) state and verify it's
# working as well
cp -f ${DIR}/data/tpm2state3b/tpm2-00.permall $TPMDIR/tpm2-00.permall
cp -f ${DIR}/data/tpm2state3b/tpm2-00.volatilestate $TPMDIR/tpm2-00.volatilestate
cp -f ${DIR}/data/tpm2state3b/h02000000.bin $TPMDIR/h02000000.bin
cp -f ${DIR}/data/tpm2state3b/h81000000.bin $TPMDIR/h81000000.bin
cp -f ${TESTDIR}/data/tpm2state3b/tpm2-00.permall $TPMDIR/tpm2-00.permall
cp -f ${TESTDIR}/data/tpm2state3b/tpm2-00.volatilestate $TPMDIR/tpm2-00.volatilestate
cp -f ${TESTDIR}/data/tpm2state3b/h02000000.bin $TPMDIR/h02000000.bin
cp -f ${TESTDIR}/data/tpm2state3b/h81000000.bin $TPMDIR/h81000000.bin
$SWTPM_EXE socket \
--server port=${TPM_COMMAND_PORT} \
@ -1052,8 +1053,8 @@ fi
# Run TPM2 with the saved volatile state
# create a backup for running the next test...
# cp $TPMDIR/tpm2-00.permall ${DIR}/data/tpm2state3c/tpm2-00.permall
# cp $TPMDIR/tpm2-00.volatilestate ${DIR}/data/tpm2state3c/tpm2-00.volatilestate
# cp $TPMDIR/tpm2-00.permall ${TESTDIR}/data/tpm2state3c/tpm2-00.permall
# cp $TPMDIR/tpm2-00.volatilestate ${TESTDIR}/data/tpm2state3c/tpm2-00.volatilestate
#echo $TPMDIR
#ls -l $TPMDIR
@ -1103,8 +1104,8 @@ fi
# Run TPM2 with previously saved (volatile) state and verify it's
# working as well
cp -f ${DIR}/data/tpm2state3c/tpm2-00.volatilestate $TPMDIR/tpm2-00.volatilestate
cp -f ${DIR}/data/tpm2state3c/tpm2-00.permall $TPMDIR/tpm2-00.permall
cp -f ${TESTDIR}/data/tpm2state3c/tpm2-00.volatilestate $TPMDIR/tpm2-00.volatilestate
cp -f ${TESTDIR}/data/tpm2state3c/tpm2-00.permall $TPMDIR/tpm2-00.permall
$SWTPM_EXE socket \
--server port=${TPM_COMMAND_PORT} \
@ -1205,9 +1206,9 @@ fi
# Run TPM2 with the saved volatile state
# create a backup for running the next test...
# cp $TPMDIR/tpm2-00.volatilestate ${DIR}/data/tpm2state3d/tpm2-00.volatilestate
# cp $TPMDIR/tpm2-00.permall ${DIR}/data/tpm2state3d/tpm2-00.permall
# cp $SIGFILE ${DIR}/data/tpm2state3d/signature2.bin
# cp $TPMDIR/tpm2-00.volatilestate ${TESTDIR}/data/tpm2state3d/tpm2-00.volatilestate
# cp $TPMDIR/tpm2-00.permall ${TESTDIR}/data/tpm2state3d/tpm2-00.permall
# cp $SIGFILE ${TESTDIR}/data/tpm2state3d/signature2.bin
#echo $TPMDIR
#ls -l $TPMDIR
@ -1254,8 +1255,8 @@ fi
# Run TPM2 with previously saved (volatile) state and verify it's
# working as well
cp -f ${DIR}/data/tpm2state3d/tpm2-00.permall $TPMDIR/tpm2-00.permall
cp -f ${DIR}/data/tpm2state3d/tpm2-00.volatilestate $TPMDIR/tpm2-00.volatilestate
cp -f ${TESTDIR}/data/tpm2state3d/tpm2-00.permall $TPMDIR/tpm2-00.permall
cp -f ${TESTDIR}/data/tpm2state3d/tpm2-00.volatilestate $TPMDIR/tpm2-00.volatilestate
$SWTPM_EXE socket \
--server port=${TPM_COMMAND_PORT} \

View File

@ -2,8 +2,9 @@
# For the license, see the LICENSE file in the root directory.
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(dirname "$0")/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
SWTPM_CERT=${ROOT}/src/swtpm_cert/swtpm_cert
cert=$(mktemp)
@ -35,8 +36,8 @@ function check_cert_size()
${SWTPM_CERT} \
--tpm2 \
--allow-signing \
--signkey ${DIR}/data/signkey.pem \
--issuercert ${DIR}/data/issuercert.pem \
--signkey ${TESTDIR}/data/signkey.pem \
--issuercert ${TESTDIR}/data/issuercert.pem \
--out-cert ${cert} \
--modulus 'b9dda830729de58f9f5bed2b3b9394ad4ec5afb9c390b89a3337250cbc575cfc8f31f7ffd3f05f4155076f7d1605381cd281b7f147b801154e4f89ee529fe36eae50f79561850e5b63037edaacbb390ea3fcd037e674fb179e3c5afe31214d78a756ca44cc6cf25421b51420ede548310c92b08a513ccc62fd0ef45dcf6546f6e865be6a661d045d1c47b60b428d11dc97cb9f35ee7c385bb20320934b015f8014e8fb19851c2af307e1e64648c142175e40b60615dc494fdb09ea5d5a6f3273b65a241e3cf30cc449b9fb3f900d1ed4be967b32b16f95a1d732dbfa143eaa1c2017556117f70faee5d77f836705d05405361ad5871a32161fa5a1234cfab497' \
--days 3650 \
@ -58,8 +59,8 @@ echo "Test 1: OK"
${SWTPM_CERT} \
--tpm2 \
--signkey ${DIR}/data/signkey.pem \
--issuercert ${DIR}/data/issuercert.pem \
--signkey ${TESTDIR}/data/signkey.pem \
--issuercert ${TESTDIR}/data/issuercert.pem \
--out-cert ${cert} \
--modulus 'b9dda830729de58f9f5bed2b3b9394ad4ec5afb9c390b89a3337250cbc575cfc8f31f7ffd3f05f4155076f7d1605381cd281b7f147b801154e4f89ee529fe36eae50f79561850e5b63037edaacbb390ea3fcd037e674fb179e3c5afe31214d78a756ca44cc6cf25421b51420ede548310c92b08a513ccc62fd0ef45dcf6546f6e865be6a661d045d1c47b60b428d11dc97cb9f35ee7c385bb20320934b015f8014e8fb19851c2af307e1e64648c142175e40b60615dc494fdb09ea5d5a6f3273b65a241e3cf30cc449b9fb3f900d1ed4be967b32b16f95a1d732dbfa143eaa1c2017556117f70faee5d77f836705d05405361ad5871a32161fa5a1234cfab497' \
--days 3650 \
@ -82,10 +83,10 @@ echo "Test 2: OK"
${SWTPM_CERT} \
--tpm2 \
--signkey ${DIR}/data/signkey.pem \
--issuercert ${DIR}/data/issuercert.pem \
--signkey ${TESTDIR}/data/signkey.pem \
--issuercert ${TESTDIR}/data/issuercert.pem \
--out-cert ${cert} \
--pubkey ${DIR}/data/pubek.pem \
--pubkey ${TESTDIR}/data/pubek.pem \
--days 3650 \
--subject "OU=foo,L=NewYork,ST=NY,C=US" \
--pem \
@ -111,9 +112,9 @@ echo "Test 3: OK"
${SWTPM_CERT} \
--tpm2 \
--type platform \
--signkey ${DIR}/data/signkey.pem \
--issuercert ${DIR}/data/issuercert.pem \
--pubkey ${DIR}/data/pubek.pem \
--signkey ${TESTDIR}/data/signkey.pem \
--issuercert ${TESTDIR}/data/issuercert.pem \
--pubkey ${TESTDIR}/data/pubek.pem \
--out-cert ${cert} \
--days 3650 \
--subject "OU=foo,L=NewYork,ST=NY,C=US" \

View File

@ -2,8 +2,9 @@
# For the license, see the LICENSE file in the root directory.
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(dirname "$0")/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
SWTPM_CERT=${ROOT}/src/swtpm_cert/swtpm_cert
cert=$(mktemp)
@ -34,8 +35,8 @@ function check_cert_size()
${SWTPM_CERT} \
--tpm2 \
--signkey ${DIR}/data/signkey.pem \
--issuercert ${DIR}/data/issuercert.pem \
--signkey ${TESTDIR}/data/signkey.pem \
--issuercert ${TESTDIR}/data/issuercert.pem \
--out-cert ${cert} \
--ecc-x 61eaf811ea582656ca2a835dd1b9cd63eb196d7ff62711d6e9b8f85e580a47ca \
--ecc-y a51efdc71fd6c791a24a75beb50526aa81b44cc598e65b2d5e116084aea4cb5b \
@ -61,8 +62,8 @@ echo "Test 1: OK"
${SWTPM_CERT} \
--tpm2 \
--signkey ${DIR}/data/signkey.pem \
--issuercert ${DIR}/data/issuercert.pem \
--signkey ${TESTDIR}/data/signkey.pem \
--issuercert ${TESTDIR}/data/issuercert.pem \
--out-cert ${cert} \
--ecc-x 61eaf811ea582656ca2a835dd1b9cd63eb196d7ff62711d6e9b8f85e580a47ca \
--ecc-y a51efdc71fd6c791a24a75beb50526aa81b44cc598e65b2d5e116084aea4cb5b \
@ -86,10 +87,10 @@ echo "Test 2: OK"
${SWTPM_CERT} \
--tpm2 \
--signkey ${DIR}/data/signkey.pem \
--issuercert ${DIR}/data/issuercert.pem \
--signkey ${TESTDIR}/data/signkey.pem \
--issuercert ${TESTDIR}/data/issuercert.pem \
--out-cert ${cert} \
--pubkey ${DIR}/data/ecpubek.pem \
--pubkey ${TESTDIR}/data/ecpubek.pem \
--days 3650 \
--subject "OU=foo,L=NewYork,ST=NY,C=US" \
--pem \
@ -115,9 +116,9 @@ echo "Test 3: OK"
${SWTPM_CERT} \
--tpm2 \
--type platform \
--signkey ${DIR}/data/signkey.pem \
--issuercert ${DIR}/data/issuercert.pem \
--pubkey ${DIR}/data/ecpubek.pem \
--signkey ${TESTDIR}/data/signkey.pem \
--issuercert ${TESTDIR}/data/issuercert.pem \
--pubkey ${TESTDIR}/data/ecpubek.pem \
--out-cert ${cert} \
--days 3650 \
--subject "OU=foo,L=NewYork,ST=NY,C=US" \

View File

@ -7,8 +7,9 @@ if [ "$(id -u)" -ne 0 ]; then
exit 77
fi
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(dirname "$0")/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
SWTPM_SETUP=${ROOT}/src/swtpm_setup/swtpm_setup
SWTPM_LOCALCA=${ROOT}/samples/swtpm-localca
SWTPM=${ROOT}/src/swtpm/swtpm
@ -20,7 +21,7 @@ SIGNINGKEY=${workdir}/signingkey.pem
ISSUERCERT=${workdir}/issuercert.pem
CERTSERIAL=${workdir}/certserial
PATH=${PWD}/${ROOT}/src/swtpm_bios:$PATH
PATH=${ROOT}/src/swtpm_bios:$PATH
trap "cleanup" SIGTERM EXIT

View File

@ -8,8 +8,9 @@ if [ "$(id -u)" -ne 0 ]; then
exit 77
fi
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(dirname "$0")/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
SWTPM=swtpm
SWTPM_EXE=$ROOT/src/swtpm/$SWTPM
TPM_PATH=$(mktemp -d)
@ -32,7 +33,7 @@ function cleanup()
trap "cleanup" EXIT
source ${DIR}/load_vtpm_proxy
source ${TESTDIR}/load_vtpm_proxy
rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null

View File

@ -8,8 +8,9 @@ if [ "$(id -u)" -ne 0 ]; then
exit 77
fi
DIR=$(dirname "$0")
ROOT=${DIR}/..
ROOT=${abs_top_builddir:-$(dirname "$0")/..}
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
SWTPM=swtpm
SWTPM_EXE=${SWTPM_EXE:-$ROOT/src/swtpm/$SWTPM}
TPM_PATH=$(mktemp -d)
@ -32,7 +33,7 @@ function cleanup()
trap "cleanup" EXIT
source ${DIR}/load_vtpm_proxy
source ${TESTDIR}/load_vtpm_proxy
rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null