Skip to content

Commit

Permalink
Fix integration test stability issues
Browse files Browse the repository at this point in the history
Signed-off-by: wenxin.leong <wenxin.leong@infineon.com>
  • Loading branch information
wxleong authored and AndreasFuchsTPM committed Jun 17, 2024
1 parent de0b19a commit eb3897b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions test/integration/pkcs11-tool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,22 +84,22 @@ pkcs11_tool --slot=1 --keypairgen --login --pin myuserpin \
--key-type EC:prime256v1 --id 02 --label key2

echo "Read public components"
if pkcs11_tool --read-object --login --pin myuserpin --type pubkey -id 01 -o {tmp}/key1_pub.der ; then
pkcs11_tool --read-object --login --pin myuserpin --type pubkey --id 02 -o {tmp}/key2_pub.der
if pkcs11_tool --read-object --login --pin myuserpin --type pubkey --id 01 -o ${tmp}/key1_pub.der ; then
pkcs11_tool --read-object --login --pin myuserpin --type pubkey --id 02 -o ${tmp}/key2_pub.der

echo "Derive secrets"
pkcs11_tool --derive -m ECDH1-DERIVE --id 01 --label key1 \
--login --pin myuserpin \
--input-file {tmp}/key2_pub.der \
--output-file {tmp}/shared_secret_1
--input-file ${tmp}/key2_pub.der \
--output-file ${tmp}/shared_secret_1

pkcs11_tool --derive -m ECDH1-DERIVE --id 02 --label key2 \
--login --pin myuserpin \
--input-file {tmp}/key1_pub.der \
--output-file {tmp}/shared_secret_2
--input-file ${tmp}/key1_pub.der \
--output-file ${tmp}/shared_secret_2

echo "Validate output"
diff {tmp}/shared_secret_2 {tmp}/shared_secret_1 > /dev/null 2>&1
diff ${tmp}/shared_secret_2 ${tmp}/shared_secret_1 > /dev/null 2>&1
test "$?" -eq "0"
else
echo "pkcs11-tool can't read EC key public components"
Expand Down
4 changes: 2 additions & 2 deletions test/integration/ptool-link.sh.nosetup
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ echo "TPM2_PKCS11_TCTI=$TPM2_PKCS11_TCTI"
export TPM2_PKCS11_TCTI

# Create a primary key at "$handle"
tpm2_createprimary -c primary.ctx
handle=$(tpm2_evictcontrol -c primary.ctx | grep persistent-handle | cut -d' ' -f2-2)
tpm2_createprimary -c ${tempdir}/primary.ctx
handle=$(tpm2_evictcontrol -c ${tempdir}/primary.ctx | grep persistent-handle | cut -d' ' -f2-2)

# Create a primary object in the store referencing it
pid=$(tpm2_ptool init --primary-handle="$handle" --path=$TPM2_PKCS11_STORE | grep id | cut -d' ' -f2-2)
Expand Down

0 comments on commit eb3897b

Please sign in to comment.