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

« back to all changes in this revision

Viewing changes to providers/plainbox-provider-tpm2/bin/test_algs_tpm2_encryptdecrypt.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/sh
 
2
 
 
3
##before this script, you should make sure all kinds of context already loaded 
 
4
 
 
5
context_p=
 
6
halg=
 
7
 
 
8
ctx_count=`ls |grep -c context_load`
 
9
if [ $ctx_count -le 1 ];then
 
10
        echo "we should execute test_algs.sh first!"
 
11
        wait 5
 
12
    ./test_algs.sh
 
13
fi
 
14
 
 
15
rm test_algs_encryptdecrypt_*.log
 
16
 
 
17
#for  halg_p in 0x0004 0x000B 0x000C 0x000D 0x0012  
 
18
for  context_p in `ls context_load*`   
 
19
  do
 
20
        
 
21
        ./tpm2_encryptdecrypt -c  $context_p  -D NO -I secret.data -o endecrypt_"$context_p".f
 
22
 
 
23
 
 
24
         if [ $? != 0 ];then
 
25
         echo "encryptdecrypt  for  endecrypt_"$context_p".f fail, please check the environment or parameters!"
 
26
         echo "encryptdecrypt  for  endecrypt_"$context_p".f fail" >>test_encryptdecrypt_error.log
 
27
        else
 
28
         echo "encryptdecrypt  for  endecrypt_"$context_p".f pass" >>test_encryptdecrypt_pass.log
 
29
   ./tpm2_encryptdecrypt -c  $context_p  -D YES -I  endecrypt_"$context_p".f -o decrypt_"$context_p".f
 
30
        
 
31
          if [ $? != 0 ];then
 
32
          echo "encryptdecrypt  for  decrypt_"$context_p".f fail, please check the environment or parameters!"
 
33
          echo "encryptdecrypt  for  decrypt_"$context_p".f fail" >>test_encryptdecrypt_error.log
 
34
         else
 
35
          echo "encryptdecrypt  for  decrypt_"$context_p".f pass" >>test_encryptdecrypt_pass.log
 
36
         fi
 
37
        fi
 
38
 
 
39
 done