3
PATH="$PATH":"$new_path"
11
handle_hmac_key=0x81010013
13
file_primary_key_ctx=context.p_"$alg_primary_obj"_"$alg_primary_key"
14
file_hmac_key_pub=opu_"$alg_create_obj"_"$alg_create_key"
15
file_hmac_key_priv=opr_"$alg_create_obj"_"$alg_create_key"
16
file_hmac_key_name=name.load_"$alg_primary_obj"_"$alg_primary_key"-"$alg_create_obj"_"$alg_create_key"
17
file_hmac_key_ctx=ctx_load_out_"$alg_primary_obj"_"$alg_primary_key"-"$alg_create_obj"_"$alg_create_key"
18
file_hmac_output=hmac_"$file_hmac_key_ctx"
20
file_input_data=secret.data
24
echo "$1 test fail, please check the environment or parameters!"
29
echo ""$1" pass" >>test_getpubak_pass.log
32
rm $file_primary_key_ctx $file_hmac_key_pub $file_hmac_key_priv $file_hmac_key_name $file_hmac_key_ctx $file_hmac_output -rf
34
if [ ! -e "$file_input_data" ]
36
echo "12345678" > $file_input_data
41
tpm2_createprimary -A e -g $alg_primary_obj -G $alg_primary_key -C $file_primary_key_ctx
45
tpm2_create -g $alg_create_obj -G $alg_create_key -o $file_hmac_key_pub -O $file_hmac_key_priv -c $file_primary_key_ctx
50
tpm2_load -c $file_primary_key_ctx -u $file_hmac_key_pub -r $file_hmac_key_priv -n $file_hmac_key_name -C $file_hmac_key_ctx
55
tpm2_hmac -c $file_hmac_key_ctx -g $halg -I $file_input_data -o $file_hmac_output
61
rm -f $file_hmac_output
62
tpm2_evictcontrol -A o -c $file_hmac_key_ctx -S $handle_hmac_key |tee evict.log
64
grep "persistentHanlde: "$handle_hmac_key"" evict.log
67
if [ $c1 != 0 ] || [ $c2 != 0 ];then
71
tpm2_hmac -k $handle_hmac_key -g $halg -I $file_input_data -o $file_hmac_output