Various cleanups and fixed by Marc and Ralf to start the OpenTLS project
[openssl.git] / test / testenc
1 #!/bin/sh
2
3 testsrc=Makefile.ssl
4 test=./p
5 cmd=../apps/ssleay
6
7 cat $testsrc >$test;
8
9 echo cat
10 $cmd enc < $test > $test.cipher
11 $cmd enc < $test.cipher >$test.clear
12 cmp $test $test.clear
13 if [ $? != 0 ]
14 then
15         exit 1
16 else
17         /bin/rm $test.cipher $test.clear
18 fi
19 echo base64
20 $cmd enc -a -e < $test > $test.cipher
21 $cmd enc -a -d < $test.cipher >$test.clear
22 cmp $test $test.clear
23 if [ $? != 0 ]
24 then
25         exit 1
26 else
27         /bin/rm $test.cipher $test.clear
28 fi
29
30 for i in rc4 \
31         des-cfb des-ede-cfb des-ede3-cfb \
32         des-ofb des-ede-ofb des-ede3-ofb \
33         des-ecb des-ede des-ede3 desx \
34         des-cbc des-ede-cbc des-ede3-cbc \
35         idea-ecb idea-cfb idea-ofb idea-cbc \
36         rc2-ecb rc2-cfb rc2-ofb rc2-cbc \
37         bf-ecb bf-cfb bf-ofb bf-cbc rc4 \
38         cast5-ecb cast5-cfb cast5-ofb cast5-cbc
39 do
40         echo $i
41         $cmd $i -bufsize 113 -e -k test < $test > $test.$i.cipher
42         $cmd $i -bufsize 157 -d -k test < $test.$i.cipher >$test.$i.clear
43         cmp $test $test.$i.clear
44         if [ $? != 0 ]
45         then
46                 exit 1
47         else
48                 /bin/rm $test.$i.cipher $test.$i.clear
49         fi
50
51         echo $i base64
52         $cmd $i -bufsize 113 -a -e -k test < $test > $test.$i.cipher
53         $cmd $i -bufsize 157 -a -d -k test < $test.$i.cipher >$test.$i.clear
54         cmp $test $test.$i.clear
55         if [ $? != 0 ]
56         then
57                 exit 1
58         else
59                 /bin/rm $test.$i.cipher $test.$i.clear
60         fi
61 done
62 rm -f $test