57 changes: 0 additions & 57 deletions test/system/test_algs_tpm2_readpublic.sh

This file was deleted.

70 changes: 0 additions & 70 deletions test/system/test_algs_tpm2_sign.sh

This file was deleted.

105 changes: 0 additions & 105 deletions test/system/test_algs_tpm2_unseal.sh

This file was deleted.

85 changes: 0 additions & 85 deletions test/system/test_algs_tpm2_verifysignature.sh

This file was deleted.

6 changes: 1 addition & 5 deletions test/system/test_all.sh
Expand Up @@ -53,10 +53,6 @@ test_wrapper()
let "fail++"
fail_summary="$fail_summary"$'\n'"$1"
fi

# Scripts are sloppy, perform cleanup
rm `find . -maxdepth 1 -type f ! -name '*.sh' ! -name 'README.md' ! -name 'yaml_get.py'` 2>/dev/null
sleep 1
}

test_wrapper test_tpm2_takeownership_all.sh
Expand All @@ -65,7 +61,7 @@ test_wrapper test_tpm2_pcrlist.sh
test_wrapper test_tpm2_getrandom.sh
test_wrapper test_tpm2_getrandom_func.sh
#test_wrapper test_tpm2_createprimary_all.sh
#test_wrapper test_tpm2_create_all.sh
test_wrapper test_tpm2_create_all.sh
test_wrapper test_tpm2_load.sh
test_wrapper test_tpm2_loadexternal.sh
test_wrapper test_tpm2_evictcontrol.sh
Expand Down
100 changes: 43 additions & 57 deletions test/system/test_tpm2_create_all.sh
Expand Up @@ -4,83 +4,69 @@
# Copyright (c) 2016, Intel Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# 3. Neither the name of Intel Corporation nor the names of its contributors
# may be used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
# THE POSSIBILITY OF SUCH DAMAGE.
#;**********************************************************************;

new_path=`dirname $0`
PATH="$PATH":"$new_path"
pCtx=
gAlg=
GAlg=
onerror() {
echo "$BASH_COMMAND on line ${BASH_LINENO[0]} failed: $?"
exit 1
}
trap onerror ERR

cleanup() {
rm -f key.pub key.priv policy.bin

if [ "$1" != "keep_context" ]; then
rm -f context.out
fi

rm create.error.log
}
trap cleanup EXIT

ctx_count=`ls |grep -c context_load`
if [ $ctx_count -le 1 ];then
echo "we should execute test_tpm2_createprimary_all.sh first!"
wait 5
test_tpm2_createprimary_all.sh
fi
cleanup

for pCtx in `ls ctx.cpri*`
do
for gAlg in sha1 0x0B sha384 0x0D 0x12
do
for GAlg in rsa 0x08 ecc 0x25
do
tpm2_create -c $pCtx -g $gAlg -G $GAlg -u opu."$pCtx".g"$gAlg".G"$GAlg" -r opr."$pCtx".g"$gAlg".G"$GAlg"
if [ $? != 0 ];then
echo "tpm2_create error: pCtx=$pCtx gAlg=$gAlg GAlg=$GAlg"
echo "tpm2_create error: pCtx=$pCtx gAlg=$gAlg GAlg=$GAlg" >> create.error.log
fi
done
tpm2_createprimary -Q -A p -g sha -G rsa -C context.out

# Keep the algorithm specifiers mixed to test friendly and raw
# values.
for gAlg in sha1 0x0B sha384; do
for GAlg in rsa 0x08 ecc 0x25; do
tpm2_create -Q -c context.out -g $gAlg -G $GAlg -u key.pub -r key.priv
cleanup keep_context
done
done

cleanup keep_context

echo "f28230c080bbe417141199e36d18978228d8948fc10a6a24921b9eba6bb1d988" \
| xxd -r -p > policy.bin

tpm2_createprimary -A o -g 0xb -C prim.ctx -G 0x1
if [ $? != 0 ];then
echo "create primary failed"
exit 1
fi

tpm2_create -c prim.ctx -g sha256 -G 0x1 -L policy.bin -u key.pub -r key.priv -E
if [ $? != 0 ];then
echo "create object failed"
exit 1
fi
tpm2_create -Q -c context.out -g sha256 -G 0x1 -L policy.bin -u key.pub -r key.priv -E

cmp -i 4:0 -n 32 key.pub policy.bin -s
if [ $? != 0 ];then
echo "tpm2_create_error: Policy digest did not match in auth structure" >> create.error.log
exit 1
fi
cmp -i 14:0 -n 32 key.pub policy.bin -s

rm -f prim.ctx policy.bin key.priv key.pub
exit 0