9 cert=../apps/server.pem
13 OPENSSL_CONF=/dev/null ; export OPENSSL_CONF
14 ssltest="../util/shlib_wrap.sh ./ssltest -key $key -cert $cert -c_key $key -c_cert $cert"
16 if ../util/shlib_wrap.sh ../apps/openssl x509 -in $cert -text -noout | fgrep 'DSA Public Key' >/dev/null; then
22 if [ "$3" = "" ]; then
28 if [ "$4" = "" ]; then
34 serverinfo="./serverinfo.pem"
36 #############################################################################
39 $ssltest -ssl3 $extra || exit 1
41 echo test sslv3 with server authentication
42 $ssltest -ssl3 -server_auth $CA $extra || exit 1
44 echo test sslv3 with client authentication
45 $ssltest -ssl3 -client_auth $CA $extra || exit 1
47 echo test sslv3 with both client and server authentication
48 $ssltest -ssl3 -server_auth -client_auth $CA $extra || exit 1
51 $ssltest $extra || exit 1
53 echo test sslv2/sslv3 with server authentication
54 $ssltest -server_auth $CA $extra || exit 1
56 echo test sslv2/sslv3 with client authentication
57 $ssltest -client_auth $CA $extra || exit 1
59 echo test sslv2/sslv3 with both client and server authentication
60 $ssltest -server_auth -client_auth $CA $extra || exit 1
62 echo test sslv3 via BIO pair
63 $ssltest -bio_pair -ssl3 $extra || exit 1
65 echo test sslv3 with server authentication via BIO pair
66 $ssltest -bio_pair -ssl3 -server_auth $CA $extra || exit 1
68 echo test sslv3 with client authentication via BIO pair
69 $ssltest -bio_pair -ssl3 -client_auth $CA $extra || exit 1
71 echo test sslv3 with both client and server authentication via BIO pair
72 $ssltest -bio_pair -ssl3 -server_auth -client_auth $CA $extra || exit 1
74 echo test sslv2/sslv3 via BIO pair
75 $ssltest $extra || exit 1
78 $ssltest -dtls1 $extra || exit 1
80 echo test dtlsv1 with server authentication
81 $ssltest -dtls1 -server_auth $CA $extra || exit 1
83 echo test dtlsv1 with client authentication
84 $ssltest -dtls1 -client_auth $CA $extra || exit 1
86 echo test dtlsv1 with both client and server authentication
87 $ssltest -dtls1 -server_auth -client_auth $CA $extra || exit 1
90 $ssltest -dtls12 $extra || exit 1
92 echo test dtlsv1.2 with server authentication
93 $ssltest -dtls12 -server_auth $CA $extra || exit 1
95 echo test dtlsv1.2 with client authentication
96 $ssltest -dtls12 -client_auth $CA $extra || exit 1
98 echo test dtlsv1.2 with both client and server authentication
99 $ssltest -dtls12 -server_auth -client_auth $CA $extra || exit 1
101 if [ $dsa_cert = NO ]; then
102 echo 'test sslv2/sslv3 w/o (EC)DHE via BIO pair'
103 $ssltest -bio_pair -no_dhe -no_ecdhe $extra || exit 1
106 echo test sslv2/sslv3 with 1024bit DHE via BIO pair
107 $ssltest -bio_pair -dhe1024dsa -v $extra || exit 1
109 echo test sslv2/sslv3 with server authentication
110 $ssltest -bio_pair -server_auth $CA $extra || exit 1
112 echo test sslv2/sslv3 with client authentication via BIO pair
113 $ssltest -bio_pair -client_auth $CA $extra || exit 1
115 echo test sslv2/sslv3 with both client and server authentication via BIO pair
116 $ssltest -bio_pair -server_auth -client_auth $CA $extra || exit 1
118 echo test sslv2/sslv3 with both client and server authentication via BIO pair and app verify
119 $ssltest -bio_pair -server_auth -client_auth -app_verify $CA $extra || exit 1
124 echo "Testing $cipher"
126 if [ $protocol = "SSLv3" ] ; then
129 $ssltest -cipher $cipher $prot
130 if [ $? -ne 0 ] ; then
131 echo "Failed $cipher"
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
142 if ../util/shlib_wrap.sh ../apps/openssl no-dh; then
143 echo "skipping RSA+DHE tests"
145 for cipher in `../util/shlib_wrap.sh ../apps/openssl ciphers "EDH+aRSA+$protocol:-EXP" | tr ':' ' '`; do
146 test_cipher $cipher $protocol
148 echo "testing connection with weak DH, expecting failure"
149 if [ $protocol = "SSLv3" ] ; then
150 $ssltest -cipher EDH -dhe512 -ssl3
152 $ssltest -cipher EDH -dhe512
154 if [ $? -eq 0 ]; then
155 echo "FAIL: connection with weak DH succeeded"
159 if ../util/shlib_wrap.sh ../apps/openssl no-ec; then
160 echo "skipping RSA+ECDHE tests"
162 for cipher in `../util/shlib_wrap.sh ../apps/openssl ciphers "EECDH+aRSA+$protocol:-EXP" | tr ':' ' '`; do
163 test_cipher $cipher $protocol
168 #############################################################################
170 if ../util/shlib_wrap.sh ../apps/openssl no-dh; then
171 echo skipping anonymous DH tests
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
177 if ../util/shlib_wrap.sh ../apps/openssl no-rsa; then
178 echo skipping RSA tests
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
183 if ../util/shlib_wrap.sh ../apps/openssl no-dh; then
184 echo skipping RSA+DHE tests
186 echo test tls1 with 1024bit RSA, 1024bit DHE, multiple handshakes
187 ../util/shlib_wrap.sh ./ssltest -v -bio_pair -tls1 -cert ../apps/server2.pem -dhe1024dsa -num 10 -f -time $extra || exit 1
191 echo test tls1 with PSK
192 $ssltest -tls1 -cipher PSK -psk abc123 $extra || exit 1
194 echo test tls1 with PSK via BIO pair
195 $ssltest -bio_pair -tls1 -cipher PSK -psk abc123 $extra || exit 1
197 #############################################################################
198 # Next Protocol Negotiation Tests
200 $ssltest -bio_pair -tls1 -npn_client || exit 1
201 $ssltest -bio_pair -tls1 -npn_server || exit 1
202 $ssltest -bio_pair -tls1 -npn_server_reject || exit 1
203 $ssltest -bio_pair -tls1 -npn_client -npn_server_reject || exit 1
204 $ssltest -bio_pair -tls1 -npn_client -npn_server || exit 1
205 $ssltest -bio_pair -tls1 -npn_client -npn_server -num 2 || exit 1
206 $ssltest -bio_pair -tls1 -npn_client -npn_server -num 2 -reuse || exit 1
208 #############################################################################
209 # Custom Extension tests
211 echo test tls1 with custom extensions
212 $ssltest -bio_pair -tls1 -custom_ext || exit 1
214 #############################################################################
217 echo test tls1 with serverinfo
218 $ssltest -bio_pair -tls1 -serverinfo_file $serverinfo || exit 1
219 $ssltest -bio_pair -tls1 -serverinfo_file $serverinfo -serverinfo_sct || exit 1
220 $ssltest -bio_pair -tls1 -serverinfo_file $serverinfo -serverinfo_tack || exit 1
221 $ssltest -bio_pair -tls1 -serverinfo_file $serverinfo -serverinfo_sct -serverinfo_tack || exit 1
222 $ssltest -bio_pair -tls1 -custom_ext -serverinfo_file $serverinfo -serverinfo_sct -serverinfo_tack || exit 1
225 #############################################################################
228 $ssltest -bio_pair -tls1 -alpn_client foo -alpn_server bar || exit 1
229 $ssltest -bio_pair -tls1 -alpn_client foo -alpn_server foo -alpn_expected foo || exit 1
230 $ssltest -bio_pair -tls1 -alpn_client foo,bar -alpn_server foo -alpn_expected foo || exit 1
231 $ssltest -bio_pair -tls1 -alpn_client bar,foo -alpn_server foo -alpn_expected foo || exit 1
232 $ssltest -bio_pair -tls1 -alpn_client bar,foo -alpn_server foo,bar -alpn_expected foo || exit 1
233 $ssltest -bio_pair -tls1 -alpn_client bar,foo -alpn_server bar,foo -alpn_expected bar || exit 1
234 $ssltest -bio_pair -tls1 -alpn_client foo,bar -alpn_server bar,foo -alpn_expected bar || exit 1
235 $ssltest -bio_pair -tls1 -alpn_client baz -alpn_server bar,foo || exit 1
237 if ../util/shlib_wrap.sh ../apps/openssl no-srp; then
238 echo skipping SRP tests
240 echo test tls1 with SRP
241 $ssltest -tls1 -cipher SRP -srpuser test -srppass abc123
243 echo test tls1 with SRP via BIO pair
244 $ssltest -bio_pair -tls1 -cipher SRP -srpuser test -srppass abc123
246 echo test tls1 with SRP auth
247 $ssltest -tls1 -cipher aSRP -srpuser test -srppass abc123
249 echo test tls1 with SRP auth via BIO pair
250 $ssltest -bio_pair -tls1 -cipher aSRP -srpuser test -srppass abc123
253 #############################################################################
256 if [ -z "$extra" -a `uname -m` = "x86_64" ]; then
257 $ssltest -cipher AES128-SHA -bytes 8m || exit 1
258 $ssltest -cipher AES128-SHA256 -bytes 8m || exit 1