~jocave/checkbox/hybrid-amd-gpu-mods

« back to all changes in this revision

Viewing changes to providers/plainbox-provider-tpm2/bin/test_tpm2_certify.sh

  • Committer: Sylvain Pineau
  • Author(s): Sylvain Pineau
  • Date: 2016-05-09 22:02:27 UTC
  • mfrom: (4323.2.1 launchpad/tpm2-provider)
  • Revision ID: sylvain_pineau-20160509220227-wt2e8boo9ktitvzl
"automatic merge of lp:~sylvain-pineau/checkbox/tpm2-provider/ by tarmac [r=sylvain-pineau][bug=][author=sylvain-pineau]"

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
new_path=`pwd`
 
3
PATH="$PATH":"$new_path"
 
4
 
 
5
file_primary_key_ctx=context.p_B1
 
6
file_certify_key_pub=opuB1_B8
 
7
file_certify_key_priv=oprB1_B8
 
8
file_certify_key_ctx=context_load_out_B1_B8
 
9
file_certify_key_name=name.load.B1_B8
 
10
file_output_data=
 
11
file_verify_output_data= 
 
12
  
 
13
 
 
14
alg_hash=0x000B
 
15
alg_primary_key=0x0001
 
16
alg_certify_key=0x0001
 
17
 
 
18
 
 
19
rm $file_primary_key_ctx $file_certify_key_pub $file_certify_key_priv $file_certify_key_ctx $file_certify_key_name $file_output_data -rf
 
20
 
 
21
tpm2_takeownership -c
 
22
tpm2_createprimary -A e -g $alg_hash -G $alg_primary_key -C $file_primary_key_ctx
 
23
if [ $? != 0 ];then
 
24
echo "createprimary fail, please check the environment or parameters!"
 
25
exit 1
 
26
fi
 
27
tpm2_create -g $alg_hash -G $alg_certify_key -o $file_certify_key_pub -O $file_certify_key_priv  -c $file_primary_key_ctx
 
28
if [ $? != 0 ];then
 
29
echo "create fail, please check the environment or parameters!"
 
30
exit 1
 
31
fi
 
32
tpm2_load -c $file_primary_key_ctx  -u $file_certify_key_pub  -r $file_certify_key_priv -n $file_certify_key_name -C $file_certify_key_ctx
 
33
if [ $? != 0 ];then
 
34
echo "load fail, please check the environment or parameters!"
 
35
exit 1
 
36
fi
 
37
tpm2_certify -C $file_primary_key_ctx  -c $file_certify_key_ctx -g $alg_hash -a attest.out -s certify_signature.out
 
38
if [ $? != 0 ];then
 
39
 echo "certify fail, please check the environment or parameters!"
 
40
 exit 1
 
41
fi
 
42
 
 
43