diff options
Diffstat (limited to 'src/regress/usr.bin/openssl/testenc.sh')
-rw-r--r-- | src/regress/usr.bin/openssl/testenc.sh | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/src/regress/usr.bin/openssl/testenc.sh b/src/regress/usr.bin/openssl/testenc.sh new file mode 100644 index 0000000000..72c87a87a9 --- /dev/null +++ b/src/regress/usr.bin/openssl/testenc.sh | |||
@@ -0,0 +1,69 @@ | |||
1 | #!/bin/sh | ||
2 | # $OpenBSD: testenc.sh,v 1.1 2014/08/26 17:50:07 jsing Exp $ | ||
3 | |||
4 | testsrc=$2/openssl.cnf | ||
5 | test=$1/p | ||
6 | cmd=/usr/bin/openssl | ||
7 | |||
8 | cd $1 | ||
9 | |||
10 | cat $testsrc >$test; | ||
11 | |||
12 | echo cat | ||
13 | $cmd enc < $test > $test.cipher | ||
14 | $cmd enc < $test.cipher >$test.clear | ||
15 | cmp $test $test.clear | ||
16 | if [ $? != 0 ] | ||
17 | then | ||
18 | exit 1 | ||
19 | else | ||
20 | /bin/rm $test.cipher $test.clear | ||
21 | fi | ||
22 | echo base64 | ||
23 | $cmd enc -a -e < $test > $test.cipher | ||
24 | $cmd enc -a -d < $test.cipher >$test.clear | ||
25 | cmp $test $test.clear | ||
26 | if [ $? != 0 ] | ||
27 | then | ||
28 | exit 1 | ||
29 | else | ||
30 | /bin/rm $test.cipher $test.clear | ||
31 | fi | ||
32 | |||
33 | /bin/rm -f $test | ||
34 | exit 0 | ||
35 | |||
36 | # These tests are now done by the makefile. | ||
37 | |||
38 | for i in rc4 \ | ||
39 | des-cfb des-ede-cfb des-ede3-cfb \ | ||
40 | des-ofb des-ede-ofb des-ede3-ofb \ | ||
41 | des-ecb des-ede des-ede3 desx \ | ||
42 | des-cbc des-ede-cbc des-ede3-cbc \ | ||
43 | rc2-ecb rc2-cfb rc2-ofb rc2-cbc \ | ||
44 | bf-ecb bf-cfb bf-ofb bf-cbc rc4 \ | ||
45 | cast5-ecb cast5-cfb cast5-ofb cast5-cbc | ||
46 | do | ||
47 | echo $i | ||
48 | $cmd $i -bufsize 113 -e -k test < $test > $test.$i.cipher | ||
49 | $cmd $i -bufsize 157 -d -k test < $test.$i.cipher >$test.$i.clear | ||
50 | cmp $test $test.$i.clear | ||
51 | if [ $? != 0 ] | ||
52 | then | ||
53 | exit 1 | ||
54 | else | ||
55 | /bin/rm $test.$i.cipher $test.$i.clear | ||
56 | fi | ||
57 | |||
58 | echo $i base64 | ||
59 | $cmd $i -bufsize 113 -a -e -k test < $test > $test.$i.cipher | ||
60 | $cmd $i -bufsize 157 -a -d -k test < $test.$i.cipher >$test.$i.clear | ||
61 | cmp $test $test.$i.clear | ||
62 | if [ $? != 0 ] | ||
63 | then | ||
64 | exit 1 | ||
65 | else | ||
66 | /bin/rm $test.$i.cipher $test.$i.clear | ||
67 | fi | ||
68 | done | ||
69 | rm -f $test | ||