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

« back to all changes in this revision

Viewing changes to providers/plainbox-provider-tpm2/bin/test_tpm2_evictcontrol.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_evict_key_pub=opuB1_B8
 
7
file_evict_key_priv=oprB1_B8
 
8
file_evict_key_ctx=context_load_out_B1_B8
 
9
file_evict_key_name=name.load.B1_B8
 
10
  
 
11
persistentHandle=0x81010003
 
12
 
 
13
 
 
14
alg_hash=0x000B
 
15
alg_primary_key=0x0001
 
16
alg_evict_key=0x0008
 
17
 
 
18
 
 
19
rm $file_primary_key_ctx $file_evict_key_pub $file_evict_key_priv $file_evict_key_ctx $file_evict_key_name $file_output_data -rf
 
20
 
 
21
tpm2_takeownership -c
 
22
 
 
23
tpm2_createprimary -A e -g $alg_hash -G $alg_primary_key -C $file_primary_key_ctx
 
24
if [ $? != 0 ];then
 
25
 echo "createprimary fail, please check the environment or parameters!"
 
26
 exit 1
 
27
fi
 
28
tpm2_create -g $alg_hash -G $alg_evict_key -o $file_evict_key_pub -O $file_evict_key_priv  -c $file_primary_key_ctx
 
29
if [ $? != 0 ];then
 
30
 echo "create fail, please check the environment or parameters!"
 
31
 exit 1
 
32
fi
 
33
tpm2_load -c $file_primary_key_ctx  -u $file_evict_key_pub  -r $file_evict_key_priv -n $file_evict_key_name -C $file_evict_key_ctx
 
34
if [ $? != 0 ];then
 
35
 echo "load fail, please check the environment or parameters!"
 
36
 exit 1
 
37
fi
 
38
 
 
39
tpm2_evictcontrol -A o -c $file_evict_key_ctx  -S $persistentHandle
 
40
if [ $? != 0 ];then
 
41
 echo "evictontronl persistentHandle fail, please check the environment or parameters!"
 
42
 exit 1
 
43
else
 
44
 tpm2_evictcontrol -A o -H $persistentHandle   -S $persistentHandle
 
45
 if [ $? != 0 ];then
 
46
  echo "evictcontrol release Handle fail, please check the environment or parameters!"
 
47
  exit 1
 
48
 fi
 
49
fi
 
50