Remove fips utility build rules from test/Makefile
[openssl.git] / test / testssl
1 #!/bin/sh
2
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
13 ssltest="../util/shlib_wrap.sh ./ssltest -key $key -cert $cert -c_key $key -c_cert $cert"
14
15 if ../util/shlib_wrap.sh ../apps/openssl x509 -in $cert -text -noout | fgrep 'DSA Public Key' >/dev/null; then
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
27 if [ "$4" = "" ]; then
28   extra=""
29 else
30   extra="$4"
31 fi
32
33 serverinfo="./serverinfo.pem"
34
35 #############################################################################
36
37 echo test sslv3
38 $ssltest -ssl3 $extra || exit 1
39
40 echo test sslv3 with server authentication
41 $ssltest -ssl3 -server_auth $CA $extra || exit 1
42
43 echo test sslv3 with client authentication
44 $ssltest -ssl3 -client_auth $CA $extra || exit 1
45
46 echo test sslv3 with both client and server authentication
47 $ssltest -ssl3 -server_auth -client_auth $CA $extra || exit 1
48
49 echo test sslv2/sslv3
50 $ssltest $extra || exit 1
51
52 echo test sslv2/sslv3 with server authentication
53 $ssltest -server_auth $CA $extra || exit 1
54
55 echo test sslv2/sslv3 with client authentication
56 $ssltest -client_auth $CA $extra || exit 1
57
58 echo test sslv2/sslv3 with both client and server authentication
59 $ssltest -server_auth -client_auth $CA $extra || exit 1
60
61 echo test sslv3 via BIO pair
62 $ssltest -bio_pair -ssl3 $extra || exit 1
63
64 echo test sslv3 with server authentication via BIO pair
65 $ssltest -bio_pair -ssl3 -server_auth $CA $extra || exit 1
66
67 echo test sslv3 with client authentication via BIO pair
68 $ssltest -bio_pair -ssl3 -client_auth $CA $extra || exit 1
69
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
72
73 echo test sslv2/sslv3 via BIO pair
74 $ssltest $extra || exit 1
75
76 if [ $dsa_cert = NO ]; then
77   echo 'test sslv2/sslv3 w/o (EC)DHE via BIO pair'
78   $ssltest -bio_pair -no_dhe -no_ecdhe $extra || exit 1
79 fi
80
81 echo test sslv2/sslv3 with 1024bit DHE via BIO pair
82 $ssltest -bio_pair -dhe1024dsa -v $extra || exit 1
83
84 echo test sslv2/sslv3 with server authentication
85 $ssltest -bio_pair -server_auth $CA $extra || exit 1
86
87 echo test sslv2/sslv3 with client authentication via BIO pair
88 $ssltest -bio_pair -client_auth $CA $extra || exit 1
89
90 echo test sslv2/sslv3 with both client and server authentication via BIO pair
91 $ssltest -bio_pair -server_auth -client_auth $CA $extra || exit 1
92
93 echo test sslv2/sslv3 with both client and server authentication via BIO pair and app verify
94 $ssltest -bio_pair -server_auth -client_auth -app_verify $CA $extra || exit 1
95
96 echo "Testing ciphersuites"
97 for protocol in TLSv1.2 SSLv3; do
98   echo "Testing ciphersuites for $protocol"
99   for cipher in `../util/shlib_wrap.sh ../apps/openssl ciphers "RSA+$protocol" | tr ':' ' '`; do
100     echo "Testing $cipher"
101     prot=""
102     if [ $protocol = "SSLv3" ] ; then
103       prot="-ssl3"
104     fi
105     $ssltest -cipher $cipher $prot
106     if [ $? -ne 0 ] ; then
107           echo "Failed $cipher"
108           exit 1
109     fi
110   done
111 done
112
113 #############################################################################
114
115 if ../util/shlib_wrap.sh ../apps/openssl no-dh; then
116   echo skipping anonymous DH tests
117 else
118   echo test tls1 with 1024bit anonymous DH, multiple handshakes
119   $ssltest -v -bio_pair -tls1 -cipher ADH -dhe1024dsa -num 10 -f -time $extra || exit 1
120 fi
121
122 if ../util/shlib_wrap.sh ../apps/openssl no-rsa; then
123   echo skipping RSA tests
124 else
125   echo 'test tls1 with 1024bit RSA, no (EC)DHE, multiple handshakes'
126   ../util/shlib_wrap.sh ./ssltest -v -bio_pair -tls1 -cert ../apps/server2.pem -no_dhe -no_ecdhe -num 10 -f -time $extra || exit 1
127
128   if ../util/shlib_wrap.sh ../apps/openssl no-dh; then
129     echo skipping RSA+DHE tests
130   else
131     echo test tls1 with 1024bit RSA, 1024bit DHE, multiple handshakes
132     ../util/shlib_wrap.sh ./ssltest -v -bio_pair -tls1 -cert ../apps/server2.pem -dhe1024dsa -num 10 -f -time $extra || exit 1
133   fi
134 fi
135
136 echo test tls1 with PSK
137 $ssltest -tls1 -cipher PSK -psk abc123 $extra || exit 1
138
139 echo test tls1 with PSK via BIO pair
140 $ssltest -bio_pair -tls1 -cipher PSK -psk abc123 $extra || exit 1
141
142 #############################################################################
143 # Next Protocol Negotiation Tests
144
145 $ssltest -bio_pair -tls1 -npn_client || exit 1
146 $ssltest -bio_pair -tls1 -npn_server || exit 1
147 $ssltest -bio_pair -tls1 -npn_server_reject || exit 1
148 $ssltest -bio_pair -tls1 -npn_client -npn_server_reject || exit 1
149 $ssltest -bio_pair -tls1 -npn_client -npn_server || exit 1
150 $ssltest -bio_pair -tls1 -npn_client -npn_server -num 2 || exit 1
151 $ssltest -bio_pair -tls1 -npn_client -npn_server -num 2 -reuse || exit 1
152
153 #############################################################################
154 # Custom Extension tests
155
156 echo test tls1 with custom extensions
157 $ssltest -bio_pair -tls1 -custom_ext || exit 1
158
159 #############################################################################
160 # Serverinfo tests
161
162 echo test tls1 with serverinfo
163 $ssltest -bio_pair -tls1 -serverinfo_file $serverinfo || exit 1
164 $ssltest -bio_pair -tls1 -serverinfo_file $serverinfo -serverinfo_sct || exit 1
165 $ssltest -bio_pair -tls1 -serverinfo_file $serverinfo -serverinfo_tack || exit 1
166 $ssltest -bio_pair -tls1 -serverinfo_file $serverinfo -serverinfo_sct -serverinfo_tack || exit 1
167 $ssltest -bio_pair -tls1 -custom_ext -serverinfo_file $serverinfo -serverinfo_sct -serverinfo_tack || exit 1
168
169
170 #############################################################################
171 # ALPN tests
172
173 $ssltest -bio_pair -tls1 -alpn_client foo -alpn_server bar || exit 1
174 $ssltest -bio_pair -tls1 -alpn_client foo -alpn_server foo -alpn_expected foo || exit 1
175 $ssltest -bio_pair -tls1 -alpn_client foo,bar -alpn_server foo -alpn_expected foo || exit 1
176 $ssltest -bio_pair -tls1 -alpn_client bar,foo -alpn_server foo -alpn_expected foo || exit 1
177 $ssltest -bio_pair -tls1 -alpn_client bar,foo -alpn_server foo,bar -alpn_expected foo || exit 1
178 $ssltest -bio_pair -tls1 -alpn_client bar,foo -alpn_server bar,foo -alpn_expected bar || exit 1
179 $ssltest -bio_pair -tls1 -alpn_client foo,bar -alpn_server bar,foo -alpn_expected bar || exit 1
180 $ssltest -bio_pair -tls1 -alpn_client baz -alpn_server bar,foo || exit 1
181
182 if ../util/shlib_wrap.sh ../apps/openssl no-srp; then
183   echo skipping SRP tests
184 else
185   echo test tls1 with SRP
186   $ssltest -tls1 -cipher SRP -srpuser test -srppass abc123
187
188   echo test tls1 with SRP via BIO pair
189   $ssltest -bio_pair -tls1 -cipher SRP -srpuser test -srppass abc123
190
191   echo test tls1 with SRP auth
192   $ssltest -tls1 -cipher aSRP -srpuser test -srppass abc123
193
194   echo test tls1 with SRP auth via BIO pair
195   $ssltest -bio_pair -tls1 -cipher aSRP -srpuser test -srppass abc123
196 fi
197
198 #############################################################################
199 # Multi-buffer tests
200
201 if [ -z "$extra" -a `uname -m` = "x86_64" ]; then
202   $ssltest -cipher AES128-SHA    -bytes 8m      || exit 1
203   $ssltest -cipher AES128-SHA256 -bytes 8m      || exit 1
204 fi
205
206 exit 0