9 cert=../apps/server.pem
13 ssltest="../util/shlib_wrap.sh ./ssltest -key $key -cert $cert -c_key $key -c_cert $cert"
15 if ../util/shlib_wrap.sh ../apps/openssl x509 -in $cert -text -noout | fgrep 'DSA Public Key' >/dev/null; then
21 if [ "$3" = "" ]; then
27 if [ "$4" = "" ]; then
33 serverinfo="./serverinfo.pem"
35 #############################################################################
38 $ssltest -ssl3 $extra || exit 1
40 echo test sslv3 with server authentication
41 $ssltest -ssl3 -server_auth $CA $extra || exit 1
43 echo test sslv3 with client authentication
44 $ssltest -ssl3 -client_auth $CA $extra || exit 1
46 echo test sslv3 with both client and server authentication
47 $ssltest -ssl3 -server_auth -client_auth $CA $extra || exit 1
50 $ssltest $extra || exit 1
52 echo test sslv2/sslv3 with server authentication
53 $ssltest -server_auth $CA $extra || exit 1
55 echo test sslv2/sslv3 with client authentication
56 $ssltest -client_auth $CA $extra || exit 1
58 echo test sslv2/sslv3 with both client and server authentication
59 $ssltest -server_auth -client_auth $CA $extra || exit 1
61 echo test sslv3 via BIO pair
62 $ssltest -bio_pair -ssl3 $extra || exit 1
64 echo test sslv3 with server authentication via BIO pair
65 $ssltest -bio_pair -ssl3 -server_auth $CA $extra || exit 1
67 echo test sslv3 with client authentication via BIO pair
68 $ssltest -bio_pair -ssl3 -client_auth $CA $extra || exit 1
70 echo test sslv3 with both client and server authentication via BIO pair
71 $ssltest -bio_pair -ssl3 -server_auth -client_auth $CA $extra || exit 1
73 echo test sslv2/sslv3 via BIO pair
74 $ssltest $extra || exit 1
77 $ssltest -dtls1 $extra || exit 1
79 echo test dtlsv1 with server authentication
80 $ssltest -dtls1 -server_auth $CA $extra || exit 1
82 echo test dtlsv1 with client authentication
83 $ssltest -dtls1 -client_auth $CA $extra || exit 1
85 echo test dtlsv1 with both client and server authentication
86 $ssltest -dtls1 -server_auth -client_auth $CA $extra || exit 1
89 $ssltest -dtls12 $extra || exit 1
91 echo test dtlsv1.2 with server authentication
92 $ssltest -dtls12 -server_auth $CA $extra || exit 1
94 echo test dtlsv1.2 with client authentication
95 $ssltest -dtls12 -client_auth $CA $extra || exit 1
97 echo test dtlsv1.2 with both client and server authentication
98 $ssltest -dtls12 -server_auth -client_auth $CA $extra || exit 1
100 if [ $dsa_cert = NO ]; then
101 echo 'test sslv2/sslv3 w/o (EC)DHE via BIO pair'
102 $ssltest -bio_pair -no_dhe -no_ecdhe $extra || exit 1
105 echo test sslv2/sslv3 with 1024bit DHE via BIO pair
106 $ssltest -bio_pair -dhe1024dsa -v $extra || exit 1
108 echo test sslv2/sslv3 with server authentication
109 $ssltest -bio_pair -server_auth $CA $extra || exit 1
111 echo test sslv2/sslv3 with client authentication via BIO pair
112 $ssltest -bio_pair -client_auth $CA $extra || exit 1
114 echo test sslv2/sslv3 with both client and server authentication via BIO pair
115 $ssltest -bio_pair -server_auth -client_auth $CA $extra || exit 1
117 echo test sslv2/sslv3 with both client and server authentication via BIO pair and app verify
118 $ssltest -bio_pair -server_auth -client_auth -app_verify $CA $extra || exit 1
122 echo "Testing $_cipher"
124 if [ $2 = "SSLv3" ] ; then
127 $ssltest -cipher $_cipher $prot
128 if [ $? -ne 0 ] ; then
129 echo "Failed $_cipher"
134 echo "Testing ciphersuites"
135 for protocol in TLSv1.2 SSLv3; do
136 echo "Testing ciphersuites for $protocol"
137 for cipher in `../util/shlib_wrap.sh ../apps/openssl ciphers "RSA+$protocol" | tr ':' ' '`; do
138 test_cipher $cipher $protocol
140 if ../util/shlib_wrap.sh ../apps/openssl no-dhparam; then
141 echo "skipping RSA+DHE tests"
143 for cipher in `../util/shlib_wrap.sh ../apps/openssl ciphers "EDH+aRSA+$protocol:-EXP" | tr ':' ' '`; do
144 test_cipher $cipher $protocol
146 echo "testing connection with weak DH, expecting failure"
147 if [ $protocol = "SSLv3" ] ; then
148 $ssltest -s_cipher "EDH" -c_cipher "EDH:@SECLEVEL=1" -dhe512 -ssl3
150 $ssltest -s_cipher "EDH" -c_cipher "EDH:@SECLEVEL=1" -dhe512
152 if [ $? -eq 0 ]; then
153 echo "FAIL: connection with weak DH succeeded"
157 if ../util/shlib_wrap.sh ../apps/openssl no-ec; then
158 echo "skipping RSA+ECDHE tests"
160 for cipher in `../util/shlib_wrap.sh ../apps/openssl ciphers "EECDH+aRSA+$protocol:-EXP" | tr ':' ' '`; do
161 test_cipher $cipher $protocol
166 #############################################################################
168 if ../util/shlib_wrap.sh ../apps/openssl no-dhparam; then
169 echo skipping anonymous DH tests
171 echo test tls1 with 1024bit anonymous DH, multiple handshakes
172 $ssltest -v -bio_pair -tls1 -cipher ADH -dhe1024dsa -num 10 -f -time $extra || exit 1
175 if ../util/shlib_wrap.sh ../apps/openssl no-rsa; then
176 echo skipping RSA tests
178 echo 'test tls1 with 1024bit RSA, no (EC)DHE, multiple handshakes'
179 ../util/shlib_wrap.sh ./ssltest -v -bio_pair -tls1 -cert ../apps/server2.pem -no_dhe -no_ecdhe -num 10 -f -time $extra || exit 1
181 if ../util/shlib_wrap.sh ../apps/openssl no-dhparam; then
182 echo skipping RSA+DHE tests
184 echo test tls1 with 1024bit RSA, 1024bit DHE, multiple handshakes
185 ../util/shlib_wrap.sh ./ssltest -v -bio_pair -tls1 -cert ../apps/server2.pem -dhe1024dsa -num 10 -f -time $extra || exit 1
189 echo test tls1 with PSK
190 $ssltest -tls1 -cipher PSK -psk abc123 $extra || exit 1
192 echo test tls1 with PSK via BIO pair
193 $ssltest -bio_pair -tls1 -cipher PSK -psk abc123 $extra || exit 1
195 #############################################################################
196 # Next Protocol Negotiation Tests
198 $ssltest -bio_pair -tls1 -npn_client || exit 1
199 $ssltest -bio_pair -tls1 -npn_server || exit 1
200 $ssltest -bio_pair -tls1 -npn_server_reject || exit 1
201 $ssltest -bio_pair -tls1 -npn_client -npn_server_reject || exit 1
202 $ssltest -bio_pair -tls1 -npn_client -npn_server || exit 1
203 $ssltest -bio_pair -tls1 -npn_client -npn_server -num 2 || exit 1
204 $ssltest -bio_pair -tls1 -npn_client -npn_server -num 2 -reuse || exit 1
206 #############################################################################
207 # Custom Extension tests
209 echo test tls1 with custom extensions
210 $ssltest -bio_pair -tls1 -custom_ext || exit 1
212 #############################################################################
215 echo test tls1 with serverinfo
216 $ssltest -bio_pair -tls1 -serverinfo_file $serverinfo || exit 1
217 $ssltest -bio_pair -tls1 -serverinfo_file $serverinfo -serverinfo_sct || exit 1
218 $ssltest -bio_pair -tls1 -serverinfo_file $serverinfo -serverinfo_tack || exit 1
219 $ssltest -bio_pair -tls1 -serverinfo_file $serverinfo -serverinfo_sct -serverinfo_tack || exit 1
220 $ssltest -bio_pair -tls1 -custom_ext -serverinfo_file $serverinfo -serverinfo_sct -serverinfo_tack || exit 1
223 #############################################################################
226 $ssltest -bio_pair -tls1 -alpn_client foo -alpn_server bar || exit 1
227 $ssltest -bio_pair -tls1 -alpn_client foo -alpn_server foo -alpn_expected foo || exit 1
228 $ssltest -bio_pair -tls1 -alpn_client foo,bar -alpn_server foo -alpn_expected foo || exit 1
229 $ssltest -bio_pair -tls1 -alpn_client bar,foo -alpn_server foo -alpn_expected foo || exit 1
230 $ssltest -bio_pair -tls1 -alpn_client bar,foo -alpn_server foo,bar -alpn_expected foo || exit 1
231 $ssltest -bio_pair -tls1 -alpn_client bar,foo -alpn_server bar,foo -alpn_expected bar || exit 1
232 $ssltest -bio_pair -tls1 -alpn_client foo,bar -alpn_server bar,foo -alpn_expected bar || exit 1
233 $ssltest -bio_pair -tls1 -alpn_client baz -alpn_server bar,foo || exit 1
235 if ../util/shlib_wrap.sh ../apps/openssl no-srp; then
236 echo skipping SRP tests
238 echo test tls1 with SRP
239 $ssltest -tls1 -cipher SRP -srpuser test -srppass abc123 || exit 1
241 echo test tls1 with SRP via BIO pair
242 $ssltest -bio_pair -tls1 -cipher SRP -srpuser test -srppass abc123 || exit 1
244 echo test tls1 with SRP auth
245 $ssltest -tls1 -cipher aSRP -srpuser test -srppass abc123 || exit 1
247 echo test tls1 with SRP auth via BIO pair
248 $ssltest -bio_pair -tls1 -cipher aSRP -srpuser test -srppass abc123 || exit 1
251 #############################################################################
254 if [ -z "$extra" -a `uname -m` = "x86_64" ]; then
255 $ssltest -cipher AES128-SHA -bytes 8m || exit 1
256 $ssltest -cipher AES128-SHA256 -bytes 8m || exit 1