]>
git.proxmox.com Git - swtpm.git/blob - tests/test_parameters
3 # For the license, see the LICENSE file in the root directory.
12 "--createek --lock-nvram"
13 "--take-ownership --lock-nvram"
15 "--take-ownership --ownerpass OOO"
16 "--take-ownership --srkpass SSS"
17 "--take-ownership --ownerpass OO --srkpass SS"
18 "--take-ownership --lock-nvram --display"
20 "--lock-nvram --display"
21 "--take-ownership --srk-well-known"
22 "--take-ownership --owner-well-known"
23 "--take-ownership --srk-well-known --owner-well-known"
24 "--createek --create-ek-cert --create-platform-cert --lock-nvram --config ${DIR}/swtpm_setup.conf --vmid test --display"
25 "--createek --create-ek-cert --create-platform-cert --lock-nvram --config ${DIR}/swtpm_setup.conf --vmid test --display --keyfile ${DIR}/data/keyfile.txt"
26 "--createek --create-ek-cert --create-platform-cert --lock-nvram --config ${DIR}/swtpm_setup.conf --vmid test --display --pwdfile ${DIR}/data/pwdfile.txt"
50 if [ "$(id -u)" -ne 0 ]; then
51 echo "Need to be root to run this test."
56 SWTPM_EXE
=${SWTPM_EXE:-$ROOT/src/swtpm/$SWTPM}
57 SWTPM_IOCTL
=${SWTPM_IOCTL:-$ROOT/src/swtpm_ioctl/swtpm_ioctl}
60 SWTPM_SETUP_CONF
=$ROOT/etc
/swtpm_setup.conf
61 # filesystem privileges require to run swtpm_setup as root during test
62 TPMAUTHORING
="$ROOT/src/swtpm_setup/swtpm_setup --config ${SWTPM_SETUP_CONF} --runas root"
63 PATH
=${PWD}/${ROOT}/src
/swtpm_bios
:$PATH
64 PATH
=${PWD}/${ROOT}/src
/swtpm_setup
:$PATH
66 source ${DIR}/test_config
68 trap "cleanup" SIGTERM EXIT
70 if test "$TCSD" = ""; then
71 echo "TCSD executable 'tcsd' was not found in path."
80 chown
$TSS_USER:$TSS_GROUP $TPMDIR 2>/dev
/null
82 echo "Could not change ownership of $TPMDIR to $TSS_USER:$TSS_GROUP." \
83 "You need to be root."
87 # swtpm_setup.conf points to the local create_certs.sh
88 # For create_certs.sh to be found (with out full path)
89 # add this directory to the PATH
92 for (( i
=0; i
<${#PARAMETERS[*]}; i
++)); do
97 --tpm "$SWTPM_EXE socket" \
98 --swtpm_ioctl "$SWTPM_IOCTL" \
99 ${PARAMETERS[$i]} 2>&1 >/dev
/null
101 if [ $?
-ne 0 ]; then
102 echo "ERROR: Test with parameters '${PARAMETERS[$i]}' failed."
104 elif [ ! -f $TPMDIR/tpm-00.permall
]; then
105 echo "ERROR: Test with parameters '${PARAMETERS[$i]}' did not
106 produce file $TPMDIR/tpm-00.permall."
110 FILESIZE
=`stat -c%s $TPMDIR/tpm-00.permall`
111 if [ ${FILESIZE} -ne ${FILESIZES[$i]} ]; then
112 echo "ERROR: Unexpected file size of $FILESIZE, "\
113 "expected ${FILESIZES[$i]}. Parameters: ${PARAMETERS[$i]}"
117 echo "SUCCESS with parameters '${PARAMETERS[$i]}'."