]>
Commit | Line | Data |
---|---|---|
d02b48c6 RE |
1 | #!/bin/sh |
2 | ||
65b002f3 BM |
3 | if [ "$1" = "" ]; then |
4 | key=../apps/server.pem | |
5 | else | |
6 | key="$1" | |
7 | fi | |
8 | if [ "$2" = "" ]; then | |
9 | cert=../apps/server.pem | |
10 | else | |
11 | cert="$2" | |
12 | fi | |
62d27939 | 13 | ssltest="../util/shlib_wrap.sh ./ssltest -key $key -cert $cert -c_key $key -c_cert $cert" |
65b002f3 | 14 | |
62d27939 | 15 | if ../util/shlib_wrap.sh ../apps/openssl x509 -in $cert -text -noout | fgrep 'DSA Public Key' >/dev/null; then |
65b002f3 BM |
16 | dsa_cert=YES |
17 | else | |
18 | dsa_cert=NO | |
19 | fi | |
20 | ||
21 | if [ "$3" = "" ]; then | |
22 | CA="-CApath ../certs" | |
23 | else | |
24 | CA="-CAfile $3" | |
25 | fi | |
26 | ||
23f80f46 RL |
27 | if [ "$4" = "" ]; then |
28 | extra="" | |
29 | else | |
30 | extra="$4" | |
31 | fi | |
32 | ||
65b002f3 BM |
33 | ############################################################################# |
34 | ||
d02b48c6 | 35 | echo test sslv2 |
23f80f46 | 36 | $ssltest -ssl2 $extra || exit 1 |
d02b48c6 RE |
37 | |
38 | echo test sslv2 with server authentication | |
23f80f46 | 39 | $ssltest -ssl2 -server_auth $CA $extra || exit 1 |
d02b48c6 | 40 | |
65b002f3 BM |
41 | if [ $dsa_cert = NO ]; then |
42 | echo test sslv2 with client authentication | |
23f80f46 | 43 | $ssltest -ssl2 -client_auth $CA $extra || exit 1 |
d02b48c6 | 44 | |
65b002f3 | 45 | echo test sslv2 with both client and server authentication |
23f80f46 | 46 | $ssltest -ssl2 -server_auth -client_auth $CA $extra || exit 1 |
65b002f3 | 47 | fi |
d02b48c6 RE |
48 | |
49 | echo test sslv3 | |
23f80f46 | 50 | $ssltest -ssl3 $extra || exit 1 |
d02b48c6 RE |
51 | |
52 | echo test sslv3 with server authentication | |
23f80f46 | 53 | $ssltest -ssl3 -server_auth $CA $extra || exit 1 |
d02b48c6 RE |
54 | |
55 | echo test sslv3 with client authentication | |
23f80f46 | 56 | $ssltest -ssl3 -client_auth $CA $extra || exit 1 |
d02b48c6 RE |
57 | |
58 | echo test sslv3 with both client and server authentication | |
23f80f46 | 59 | $ssltest -ssl3 -server_auth -client_auth $CA $extra || exit 1 |
d02b48c6 RE |
60 | |
61 | echo test sslv2/sslv3 | |
23f80f46 | 62 | $ssltest $extra || exit 1 |
d02b48c6 RE |
63 | |
64 | echo test sslv2/sslv3 with server authentication | |
23f80f46 | 65 | $ssltest -server_auth $CA $extra || exit 1 |
d02b48c6 RE |
66 | |
67 | echo test sslv2/sslv3 with client authentication | |
23f80f46 | 68 | $ssltest -client_auth $CA $extra || exit 1 |
d02b48c6 RE |
69 | |
70 | echo test sslv2/sslv3 with both client and server authentication | |
23f80f46 | 71 | $ssltest -server_auth -client_auth $CA $extra || exit 1 |
d02b48c6 | 72 | |
95d29597 | 73 | echo test sslv2 via BIO pair |
23f80f46 | 74 | $ssltest -bio_pair -ssl2 $extra || exit 1 |
95d29597 BM |
75 | |
76 | echo test sslv2 with server authentication via BIO pair | |
23f80f46 | 77 | $ssltest -bio_pair -ssl2 -server_auth $CA $extra || exit 1 |
95d29597 | 78 | |
65b002f3 BM |
79 | if [ $dsa_cert = NO ]; then |
80 | echo test sslv2 with client authentication via BIO pair | |
23f80f46 | 81 | $ssltest -bio_pair -ssl2 -client_auth $CA $extra || exit 1 |
95d29597 | 82 | |
65b002f3 | 83 | echo test sslv2 with both client and server authentication via BIO pair |
23f80f46 | 84 | $ssltest -bio_pair -ssl2 -server_auth -client_auth $CA $extra || exit 1 |
65b002f3 | 85 | fi |
95d29597 BM |
86 | |
87 | echo test sslv3 via BIO pair | |
23f80f46 | 88 | $ssltest -bio_pair -ssl3 $extra || exit 1 |
95d29597 BM |
89 | |
90 | echo test sslv3 with server authentication via BIO pair | |
23f80f46 | 91 | $ssltest -bio_pair -ssl3 -server_auth $CA $extra || exit 1 |
95d29597 BM |
92 | |
93 | echo test sslv3 with client authentication via BIO pair | |
23f80f46 | 94 | $ssltest -bio_pair -ssl3 -client_auth $CA $extra || exit 1 |
95d29597 BM |
95 | |
96 | echo test sslv3 with both client and server authentication via BIO pair | |
23f80f46 | 97 | $ssltest -bio_pair -ssl3 -server_auth -client_auth $CA $extra || exit 1 |
d02b48c6 | 98 | |
95d29597 | 99 | echo test sslv2/sslv3 via BIO pair |
23f80f46 | 100 | $ssltest $extra || exit 1 |
95d29597 | 101 | |
65b002f3 | 102 | if [ $dsa_cert = NO ]; then |
f30258c4 BM |
103 | echo 'test sslv2/sslv3 w/o (EC)DHE via BIO pair' |
104 | $ssltest -bio_pair -no_dhe -no_ecdhe $extra || exit 1 | |
65b002f3 | 105 | fi |
77fa04a9 | 106 | |
563f1503 | 107 | echo test sslv2/sslv3 with 1024bit DHE via BIO pair |
23f80f46 | 108 | $ssltest -bio_pair -dhe1024dsa -v $extra || exit 1 |
a87030a1 | 109 | |
95d29597 | 110 | echo test sslv2/sslv3 with server authentication |
23f80f46 | 111 | $ssltest -bio_pair -server_auth $CA $extra || exit 1 |
95d29597 BM |
112 | |
113 | echo test sslv2/sslv3 with client authentication via BIO pair | |
23f80f46 | 114 | $ssltest -bio_pair -client_auth $CA $extra || exit 1 |
95d29597 BM |
115 | |
116 | echo test sslv2/sslv3 with both client and server authentication via BIO pair | |
23f80f46 | 117 | $ssltest -bio_pair -server_auth -client_auth $CA $extra || exit 1 |
65b002f3 | 118 | |
023ec151 BM |
119 | echo test sslv2/sslv3 with both client and server authentication via BIO pair and app verify |
120 | $ssltest -bio_pair -server_auth -client_auth -app_verify $CA $extra || exit 1 | |
121 | ||
1ee85aab | 122 | test_cipher() { |
9ad2eb6a | 123 | _cipher=$1 |
ae2f4659 | 124 | echo "Testing $_cipher" |
f306b87d | 125 | prot="" |
9ad2eb6a | 126 | if [ $2 = "SSLv3" ] ; then |
f306b87d AL |
127 | prot="-ssl3" |
128 | fi | |
ae2f4659 | 129 | $ssltest -cipher $_cipher $prot |
f306b87d | 130 | if [ $? -ne 0 ] ; then |
ae2f4659 | 131 | echo "Failed $_cipher" |
f306b87d AL |
132 | exit 1 |
133 | fi | |
1ee85aab EK |
134 | } |
135 | ||
136 | echo "Testing ciphersuites" | |
137 | for protocol in TLSv1.2 SSLv3; do | |
138 | echo "Testing ciphersuites for $protocol" | |
139 | for cipher in `../util/shlib_wrap.sh ../apps/openssl ciphers "RSA+$protocol" | tr ':' ' '`; do | |
140 | test_cipher $cipher $protocol | |
f306b87d | 141 | done |
1ee85aab EK |
142 | if ../util/shlib_wrap.sh ../apps/openssl no-dh; then |
143 | echo "skipping RSA+DHE tests" | |
144 | else | |
145 | for cipher in `../util/shlib_wrap.sh ../apps/openssl ciphers "EDH+aRSA+$protocol:-EXP" | tr ':' ' '`; do | |
146 | test_cipher $cipher $protocol | |
147 | done | |
148 | echo "testing connection with weak DH, expecting failure" | |
149 | if [ $protocol = "SSLv3" ] ; then | |
150 | $ssltest -cipher EDH -dhe512 -ssl3 | |
151 | else | |
152 | $ssltest -cipher EDH -dhe512 | |
153 | fi | |
154 | if [ $? -eq 0 ]; then | |
155 | echo "FAIL: connection with weak DH succeeded" | |
156 | exit 1 | |
157 | fi | |
158 | fi | |
159 | if ../util/shlib_wrap.sh ../apps/openssl no-ec; then | |
160 | echo "skipping RSA+ECDHE tests" | |
161 | else | |
162 | for cipher in `../util/shlib_wrap.sh ../apps/openssl ciphers "EECDH+aRSA+$protocol:-EXP" | tr ':' ' '`; do | |
163 | test_cipher $cipher $protocol | |
164 | done | |
165 | fi | |
f306b87d AL |
166 | done |
167 | ||
65b002f3 BM |
168 | ############################################################################# |
169 | ||
62d27939 | 170 | if ../util/shlib_wrap.sh ../apps/openssl no-dh; then |
0d3f2ccb RL |
171 | echo skipping anonymous DH tests |
172 | else | |
173 | echo test tls1 with 1024bit anonymous DH, multiple handshakes | |
174 | $ssltest -v -bio_pair -tls1 -cipher ADH -dhe1024dsa -num 10 -f -time $extra || exit 1 | |
175 | fi | |
d58d6c27 | 176 | |
62d27939 | 177 | if ../util/shlib_wrap.sh ../apps/openssl no-rsa; then |
46c4647e BM |
178 | echo skipping RSA tests |
179 | else | |
f30258c4 BM |
180 | echo 'test tls1 with 1024bit RSA, no (EC)DHE, multiple handshakes' |
181 | ../util/shlib_wrap.sh ./ssltest -v -bio_pair -tls1 -cert ../apps/server2.pem -no_dhe -no_ecdhe -num 10 -f -time $extra || exit 1 | |
95d29597 | 182 | |
62d27939 | 183 | if ../util/shlib_wrap.sh ../apps/openssl no-dh; then |
0d3f2ccb RL |
184 | echo skipping RSA+DHE tests |
185 | else | |
186 | echo test tls1 with 1024bit RSA, 1024bit DHE, multiple handshakes | |
62d27939 | 187 | ../util/shlib_wrap.sh ./ssltest -v -bio_pair -tls1 -cert ../apps/server2.pem -dhe1024dsa -num 10 -f -time $extra || exit 1 |
0d3f2ccb | 188 | fi |
65b002f3 | 189 | fi |
563f1503 | 190 | |
efebb108 BM |
191 | echo test tls1 with PSK |
192 | $ssltest -tls1 -cipher PSK -psk abc123 $extra || exit 1 | |
ddac1974 NL |
193 | |
194 | echo test tls1 with PSK via BIO pair | |
195 | $ssltest -bio_pair -tls1 -cipher PSK -psk abc123 $extra || exit 1 | |
196 | ||
a149b246 BL |
197 | if ../util/shlib_wrap.sh ../apps/openssl no-srp; then |
198 | echo skipping SRP tests | |
199 | else | |
200 | echo test tls1 with SRP | |
eb0e2a5c | 201 | $ssltest -tls1 -cipher SRP -srpuser test -srppass abc123 || exit 1 |
a149b246 BL |
202 | |
203 | echo test tls1 with SRP via BIO pair | |
eb0e2a5c | 204 | $ssltest -bio_pair -tls1 -cipher SRP -srpuser test -srppass abc123 || exit 1 |
1241e77f DSH |
205 | |
206 | echo test tls1 with SRP auth | |
eb0e2a5c | 207 | $ssltest -tls1 -cipher aSRP -srpuser test -srppass abc123 || exit 1 |
1241e77f DSH |
208 | |
209 | echo test tls1 with SRP auth via BIO pair | |
eb0e2a5c | 210 | $ssltest -bio_pair -tls1 -cipher aSRP -srpuser test -srppass abc123 || exit 1 |
a149b246 BL |
211 | fi |
212 | ||
95d29597 | 213 | exit 0 |