Skip to content

Commit

Permalink
Only run the endorsement policy examples if wolfCrypt is available.
Browse files Browse the repository at this point in the history
  • Loading branch information
dgarske committed Dec 28, 2023
1 parent 6e3ba38 commit 1dc5960
Showing 1 changed file with 27 additions and 22 deletions.
49 changes: 27 additions & 22 deletions examples/run_examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,15 @@ RESULT=$?
rm -f keyedhashblob.bin
[ $RESULT -ne 0 ] && echo -e "keygen keyed hash load failed! $RESULT" && exit 1

# KeyGen Endorsement with Policy Secret
./examples/keygen/keygen rsakeyblobeh.bin -rsa -eh >> run.out
RESULT=$?
[ $RESULT -ne 0 ] && echo -e "keygen endorsement rsa failed! $RESULT" && exit 1
./examples/keygen/keygen ecckeyblobeh.bin -ecc -eh >> run.out
RESULT=$?
[ $RESULT -ne 0 ] && echo -e "keygen endorsement rsa failed! $RESULT" && exit 1
if [ $WOLFCRYPT_ENABLE -eq 1 ]; then
# KeyGen Endorsement with Policy Secret
./examples/keygen/keygen rsakeyblobeh.bin -rsa -eh >> run.out
RESULT=$?
[ $RESULT -ne 0 ] && echo -e "keygen endorsement rsa failed! $RESULT" && exit 1
./examples/keygen/keygen ecckeyblobeh.bin -ecc -eh >> run.out
RESULT=$?
[ $RESULT -ne 0 ] && echo -e "keygen endorsement rsa failed! $RESULT" && exit 1
fi


# NV Tests
Expand Down Expand Up @@ -194,12 +196,14 @@ run_tpm_tls_client() { # Usage: run_tpm_tls_client [ecc/rsa] [tpmargs]]
echo -e "TLS test (TPM as client) $1 $2"
generate_port
pushd $WOLFSSL_PATH >> run.out
echo -e "./examples/server/server -p $port -w -g -A ./certs/tpm-ca-$1-cert.pem"
./examples/server/server -p $port -w -g -A ./certs/tpm-ca-$1-cert.pem 2>&1 >> $PWD/run.out &
RESULT=$?
[ $RESULT -ne 0 ] && echo -e "tls server $1 $2 failed! $RESULT" && exit 1
popd >> run.out
sleep 0.1

echo -e "./examples/tls/tls_client -p=$port -$1 $2"
./examples/tls/tls_client -p=$port -$1 $2 2>&1 >> run.out
RESULT=$?
[ $RESULT -ne 0 ] && echo -e "tpm tls client $1 $2 failed! $RESULT" && exit 1
Expand Down Expand Up @@ -272,22 +276,23 @@ if [ $WOLFCRYPT_ENABLE -eq 1 ]; then
[ $RESULT -ne 0 ] && echo -e "signed_timestamp ecc param enc failed! $RESULT" && exit 1
fi

./examples/attestation/make_credential >> run.out
RESULT=$?
[ $RESULT -ne 0 ] && echo -e "make_credential failed! $RESULT" && exit 1
# TODO: TPM_RC_INTEGRITY
#./examples/attestation/activate_credential >> run.out
#RESULT=$?
#[ $RESULT -ne 0 ] && echo -e "activate_credential failed! $RESULT" && exit 1

./examples/attestation/make_credential -eh >> run.out
RESULT=$?
[ $RESULT -ne 0 ] && echo -e "make_credential endorsement failed! $RESULT" && exit 1
# TODO: TPM_RC_INTEGRITY
#./examples/attestation/activate_credential -eh >> run.out
#RESULT=$?
#[ $RESULT -ne 0 ] && echo -e "activate_credential endorsement failed! $RESULT" && exit 1
if [ $WOLFCRYPT_ENABLE -eq 1 ]; then
./examples/attestation/make_credential >> run.out
RESULT=$?
[ $RESULT -ne 0 ] && echo -e "make_credential failed! $RESULT" && exit 1
# TODO: TPM_RC_INTEGRITY
#./examples/attestation/activate_credential >> run.out
#RESULT=$?
#[ $RESULT -ne 0 ] && echo -e "activate_credential failed! $RESULT" && exit 1

./examples/attestation/make_credential -eh >> run.out
RESULT=$?
[ $RESULT -ne 0 ] && echo -e "make_credential endorsement failed! $RESULT" && exit 1
# TODO: TPM_RC_INTEGRITY
#./examples/attestation/activate_credential -eh >> run.out
#RESULT=$?
#[ $RESULT -ne 0 ] && echo -e "activate_credential endorsement failed! $RESULT" && exit 1
fi

# PCR Quote Tests
echo -e "PCR Quote tests"
Expand Down

0 comments on commit 1dc5960

Please sign in to comment.