]> git.ipfire.org Git - thirdparty/openssl.git/blob - test/test_t4
Add final(?) set of copyrights.
[thirdparty/openssl.git] / test / test_t4
1 #!/bin/sh
2
3 PROG=$1
4
5 if [ -x $PROG ]; then
6 if expr "x`$PROG version`" : "xOpenSSL" > /dev/null; then
7 :
8 else
9 echo "$PROG is not OpenSSL executable"
10 exit 1
11 fi
12 else
13 echo "$PROG is not executable"
14 exit 1;
15 fi
16
17 if [ 1 ]; then
18
19 HASH=`cat $PROG | $PROG dgst -hex`
20
21 AES_ALGS=" des-cbc des-ede-cbc des-ede3-cbc \
22 camellia-128-cbc camellia-128-cfb \
23 camellia-192-cbc camellia-192-cfb \
24 camellia-256-cbc camellia-256-cfb \
25 aes-128-ctr aes-128-cbc aes-128-cfb aes-128-ofb \
26 aes-192-ctr aes-192-cbc aes-192-cfb aes-192-ofb \
27 aes-256-ctr aes-256-cbc aes-256-cfb aes-256-ofb"
28 BUFSIZE="16 32 48 999"
29
30 nerr=0
31
32 for alg in $AES_ALGS; do
33 echo $alg
34 for bufsize in $BUFSIZE; do
35 TEST=`( cat $PROG | \
36 $PROG enc -e -k "$HASH" -$alg -bufsize $bufsize | \
37 env OPENSSL_sparcv9cap=0 $PROG enc -d -k "$HASH" -$alg | \
38 $PROG dgst -hex ) 2>/dev/null`
39 if [ "$TEST" != "$HASH" ]; then
40 echo "-$alg/$bufsize encrypt test failed"
41 nerr=`expr $nerr + 1`
42 fi
43 done
44 for bufsize in $BUFSIZE; do
45 TEST=`( cat $PROG | \
46 env OPENSSL_sparcv9cap=0 $PROG enc -e -k "$HASH" -$alg | \
47 $PROG enc -d -k "$HASH" -$alg -bufsize $bufsize | \
48 $PROG dgst -hex ) 2>/dev/null`
49 if [ "$TEST" != "$HASH" ]; then
50 echo "-$alg/$bufsize decrypt test failed"
51 nerr=`expr $nerr + 1`
52 fi
53 done
54 TEST=`( cat $PROG | \
55 $PROG enc -e -k "$HASH" -$alg | \
56 $PROG enc -d -k "$HASH" -$alg | \
57 $PROG dgst -hex ) 2>/dev/null`
58 if [ "$TEST" != "$HASH" ]; then
59 echo "-$alg en/decrypt test failed"
60 nerr=`expr $nerr + 1`
61 fi
62 done
63
64 if [ $nerr -gt 0 ]; then
65 echo "SPARC T4 test failed."
66 exit 1
67 fi
68 fi
69
70 exit 0