blob: 2e6e1fde4f16b0658ea46063d5b21272bc476ba8 [file] [log] [blame]
Manuel Pégourié-Gonnardeaadc502014-02-20 11:01:30 +01001#!/bin/sh
2
3# Test various options that are not covered by compat.sh
4#
5# Here the goal is not to cover every ciphersuite/version, but
6# rather specific options (max fragment length, truncated hmac, etc)
7# or procedures (session resumption from cache or ticket, renego, etc).
8#
Manuel Pégourié-Gonnard0eb6cab2014-07-23 20:17:47 +02009# Assumes a build with default options.
Manuel Pégourié-Gonnardeaadc502014-02-20 11:01:30 +010010
Manuel Pégourié-Gonnardfccd3252014-02-25 17:14:15 +010011set -u
12
Manuel Pégourié-Gonnardf7a26902014-02-27 12:25:54 +010013# default values, can be overriden by the environment
14: ${P_SRV:=../programs/ssl/ssl_server2}
15: ${P_CLI:=../programs/ssl/ssl_client2}
Manuel Pégourié-Gonnardbe9eb872014-09-05 17:45:19 +020016: ${P_PXY:=../programs/test/udp_proxy}
Manuel Pégourié-Gonnard74faf3c2014-03-13 18:47:44 +010017: ${OPENSSL_CMD:=openssl} # OPENSSL would conflict with the build system
Manuel Pégourié-Gonnardbaa7f072014-08-20 20:15:53 +020018: ${GNUTLS_CLI:=gnutls-cli}
19: ${GNUTLS_SERV:=gnutls-serv}
Manuel Pégourié-Gonnardeaadc502014-02-20 11:01:30 +010020
Manuel Pégourié-Gonnardfa60f122014-09-26 16:07:29 +020021O_SRV="$OPENSSL_CMD s_server -www -cert data_files/server5.crt -key data_files/server5.key"
Manuel Pégourié-Gonnard74faf3c2014-03-13 18:47:44 +010022O_CLI="echo 'GET / HTTP/1.0' | $OPENSSL_CMD s_client"
Manuel Pégourié-Gonnardbaa7f072014-08-20 20:15:53 +020023G_SRV="$GNUTLS_SERV --x509certfile data_files/server5.crt --x509keyfile data_files/server5.key"
Manuel Pégourié-Gonnard85d915b2014-11-03 20:10:36 +010024G_CLI="echo 'GET / HTTP/1.0' | $GNUTLS_CLI --x509cafile data_files/test-ca_cat12.crt"
Manuel Pégourié-Gonnardfccd3252014-02-25 17:14:15 +010025
Manuel Pégourié-Gonnard33a752e2014-02-21 09:47:37 +010026TESTS=0
27FAILS=0
Manuel Pégourié-Gonnard6f4fbbb2014-08-14 14:31:29 +020028SKIPS=0
Manuel Pégourié-Gonnard33a752e2014-02-21 09:47:37 +010029
Manuel Pégourié-Gonnard83d8c732014-04-07 13:24:21 +020030CONFIG_H='../include/polarssl/config.h'
31
Manuel Pégourié-Gonnardc73339f2014-02-26 16:35:27 +010032MEMCHECK=0
Manuel Pégourié-Gonnard417d46c2014-03-13 19:17:53 +010033FILTER='.*'
Manuel Pégourié-Gonnard6f4fbbb2014-08-14 14:31:29 +020034EXCLUDE='^$'
Manuel Pégourié-Gonnardc73339f2014-02-26 16:35:27 +010035
36print_usage() {
37 echo "Usage: $0 [options]"
Manuel Pégourié-Gonnardf46f1282014-12-11 11:51:28 +010038 printf " -h|--help\tPrint this help.\n"
39 printf " -m|--memcheck\tCheck memory leaks and errors.\n"
40 printf " -f|--filter\tOnly matching tests are executed (default: '$FILTER')\n"
41 printf " -e|--exclude\tMatching tests are excluded (default: '$EXCLUDE')\n"
Manuel Pégourié-Gonnardc73339f2014-02-26 16:35:27 +010042}
43
44get_options() {
45 while [ $# -gt 0 ]; do
46 case "$1" in
Manuel Pégourié-Gonnard417d46c2014-03-13 19:17:53 +010047 -f|--filter)
48 shift; FILTER=$1
49 ;;
50 -e|--exclude)
51 shift; EXCLUDE=$1
52 ;;
Manuel Pégourié-Gonnardc73339f2014-02-26 16:35:27 +010053 -m|--memcheck)
54 MEMCHECK=1
55 ;;
56 -h|--help)
57 print_usage
58 exit 0
59 ;;
60 *)
Paul Bakker1ebc0c52014-05-22 15:47:58 +020061 echo "Unknown argument: '$1'"
Manuel Pégourié-Gonnardc73339f2014-02-26 16:35:27 +010062 print_usage
63 exit 1
64 ;;
65 esac
66 shift
67 done
68}
69
Manuel Pégourié-Gonnard6f4fbbb2014-08-14 14:31:29 +020070# skip next test if OpenSSL can't send SSLv2 ClientHello
71requires_openssl_with_sslv2() {
72 if [ -z "${OPENSSL_HAS_SSL2:-}" ]; then
Manuel Pégourié-Gonnarda4afadf2014-08-30 22:09:36 +020073 if $OPENSSL_CMD ciphers -ssl2 >/dev/null 2>&1; then
Manuel Pégourié-Gonnard6f4fbbb2014-08-14 14:31:29 +020074 OPENSSL_HAS_SSL2="YES"
75 else
76 OPENSSL_HAS_SSL2="NO"
77 fi
78 fi
Manuel Pégourié-Gonnard0eb6cab2014-07-23 20:17:47 +020079
Manuel Pégourié-Gonnard6f4fbbb2014-08-14 14:31:29 +020080 if [ "$OPENSSL_HAS_SSL2" = "NO" ]; then
81 SKIP_NEXT="YES"
82 fi
83}
84
Manuel Pégourié-Gonnard1cbd39d2014-10-20 13:34:59 +020085# skip next test if OpenSSL doesn't support FALLBACK_SCSV
86requires_openssl_with_fallback_scsv() {
87 if [ -z "${OPENSSL_HAS_FBSCSV:-}" ]; then
88 if $OPENSSL_CMD s_client -help 2>&1 | grep fallback_scsv >/dev/null
89 then
90 OPENSSL_HAS_FBSCSV="YES"
91 else
92 OPENSSL_HAS_FBSCSV="NO"
93 fi
94 fi
95 if [ "$OPENSSL_HAS_FBSCSV" = "NO" ]; then
96 SKIP_NEXT="YES"
97 fi
98}
99
Manuel Pégourié-Gonnardbaa7f072014-08-20 20:15:53 +0200100# skip next test if GnuTLS isn't available
101requires_gnutls() {
102 if [ -z "${GNUTLS_AVAILABLE:-}" ]; then
103 if ( which "$GNUTLS_CLI" && which "$GNUTLS_SERV" ) >/dev/null; then
104 GNUTLS_AVAILABLE="YES"
105 else
106 GNUTLS_AVAILABLE="NO"
107 fi
108 fi
109 if [ "$GNUTLS_AVAILABLE" = "NO" ]; then
110 SKIP_NEXT="YES"
111 fi
112}
113
Manuel Pégourié-Gonnard0eb6cab2014-07-23 20:17:47 +0200114# skip next test if IPv6 isn't available on this host
115requires_ipv6() {
116 if [ -z "${HAS_IPV6:-}" ]; then
117 $P_SRV server_addr='::1' > $SRV_OUT 2>&1 &
118 SRV_PID=$!
119 sleep 1
120 kill $SRV_PID >/dev/null 2>&1
121 if grep "NET - Binding of the socket failed" $SRV_OUT >/dev/null; then
122 HAS_IPV6="NO"
123 else
124 HAS_IPV6="YES"
125 fi
126 rm -r $SRV_OUT
127 fi
128
129 if [ "$HAS_IPV6" = "NO" ]; then
130 SKIP_NEXT="YES"
131 fi
132}
133
Manuel Pégourié-Gonnard76fe9e42014-09-24 15:17:31 +0200134# skip the next test if valgrind is in use
135not_with_valgrind() {
136 if [ "$MEMCHECK" -gt 0 ]; then
137 SKIP_NEXT="YES"
138 fi
139}
140
Manuel Pégourié-Gonnarda0719722014-09-20 12:46:27 +0200141# multiply the client timeout delay by the given factor for the next test
142needs_more_time() {
143 CLI_DELAY_FACTOR=$1
144}
145
Manuel Pégourié-Gonnardf8bdbb52014-02-21 09:20:14 +0100146# print_name <name>
147print_name() {
Manuel Pégourié-Gonnardf46f1282014-12-11 11:51:28 +0100148 printf "$1 "
Manuel Pégourié-Gonnard72e51ee2014-08-31 10:22:11 +0200149 LEN=$(( 72 - `echo "$1" | wc -c` ))
Manuel Pégourié-Gonnardf46f1282014-12-11 11:51:28 +0100150 for i in `seq 1 $LEN`; do printf '.'; done
151 printf ' '
Manuel Pégourié-Gonnard33a752e2014-02-21 09:47:37 +0100152
Manuel Pégourié-Gonnard72e51ee2014-08-31 10:22:11 +0200153 TESTS=$(( $TESTS + 1 ))
Manuel Pégourié-Gonnardf8bdbb52014-02-21 09:20:14 +0100154}
155
156# fail <message>
157fail() {
158 echo "FAIL"
Manuel Pégourié-Gonnard3eec6042014-02-27 15:37:24 +0100159 echo " ! $1"
Manuel Pégourié-Gonnard33a752e2014-02-21 09:47:37 +0100160
Manuel Pégourié-Gonnardc2b00922014-08-31 16:46:04 +0200161 mv $SRV_OUT o-srv-${TESTS}.log
162 mv $CLI_OUT o-cli-${TESTS}.log
Manuel Pégourié-Gonnardbe9eb872014-09-05 17:45:19 +0200163 if [ -n "$PXY_CMD" ]; then
164 mv $PXY_OUT o-pxy-${TESTS}.log
165 fi
166 echo " ! outputs saved to o-XXX-${TESTS}.log"
Manuel Pégourié-Gonnard33a752e2014-02-21 09:47:37 +0100167
Manuel Pégourié-Gonnard7fa67722014-08-31 17:42:53 +0200168 if [ "X${USER:-}" = Xbuildbot -o "X${LOGNAME:-}" = Xbuildbot ]; then
169 echo " ! server output:"
170 cat o-srv-${TESTS}.log
Manuel Pégourié-Gonnardbe9eb872014-09-05 17:45:19 +0200171 echo " ! ========================================================"
Manuel Pégourié-Gonnard7fa67722014-08-31 17:42:53 +0200172 echo " ! client output:"
173 cat o-cli-${TESTS}.log
Manuel Pégourié-Gonnardbe9eb872014-09-05 17:45:19 +0200174 if [ -n "$PXY_CMD" ]; then
175 echo " ! ========================================================"
176 echo " ! proxy output:"
177 cat o-pxy-${TESTS}.log
178 fi
179 echo ""
Manuel Pégourié-Gonnard7fa67722014-08-31 17:42:53 +0200180 fi
181
Manuel Pégourié-Gonnard72e51ee2014-08-31 10:22:11 +0200182 FAILS=$(( $FAILS + 1 ))
Manuel Pégourié-Gonnardf8bdbb52014-02-21 09:20:14 +0100183}
184
Manuel Pégourié-Gonnard677884d2014-02-25 16:42:31 +0100185# is_polar <cmd_line>
186is_polar() {
187 echo "$1" | grep 'ssl_server2\|ssl_client2' > /dev/null
188}
189
Manuel Pégourié-Gonnardfa60f122014-09-26 16:07:29 +0200190# openssl s_server doesn't have -www with DTLS
191check_osrv_dtls() {
192 if echo "$SRV_CMD" | grep 's_server.*-dtls' >/dev/null; then
193 NEEDS_INPUT=1
194 SRV_CMD="$( echo $SRV_CMD | sed s/-www// )"
195 else
196 NEEDS_INPUT=0
197 fi
198}
199
200# provide input to commands that need it
201provide_input() {
202 if [ $NEEDS_INPUT -eq 0 ]; then
203 return
204 fi
205
206 while true; do
207 echo "HTTP/1.0 200 OK"
208 sleep 1
209 done
210}
211
Manuel Pégourié-Gonnardc73339f2014-02-26 16:35:27 +0100212# has_mem_err <log_file_name>
213has_mem_err() {
214 if ( grep -F 'All heap blocks were freed -- no leaks are possible' "$1" &&
215 grep -F 'ERROR SUMMARY: 0 errors from 0 contexts' "$1" ) > /dev/null
216 then
217 return 1 # false: does not have errors
218 else
219 return 0 # true: has errors
220 fi
221}
222
Manuel Pégourié-Gonnard0c1ec472014-06-20 18:41:11 +0200223# wait for server to start: two versions depending on lsof availability
224wait_server_start() {
225 if which lsof >/dev/null; then
226 # make sure we don't loop forever
227 ( sleep "$DOG_DELAY"; echo "SERVERSTART TIMEOUT"; kill $MAIN_PID ) &
Manuel Pégourié-Gonnarda6189f02014-09-20 13:15:43 +0200228 DOG_PID=$!
Manuel Pégourié-Gonnard0c1ec472014-06-20 18:41:11 +0200229
230 # make a tight loop, server usually takes less than 1 sec to start
Manuel Pégourié-Gonnard0eb6cab2014-07-23 20:17:47 +0200231 if [ "$DTLS" -eq 1 ]; then
Manuel Pégourié-Gonnarda65d5082015-01-12 14:54:55 +0100232 until lsof -nbi UDP:"$SRV_PORT" 2>/dev/null | grep UDP >/dev/null;
233 do :; done
Manuel Pégourié-Gonnard0eb6cab2014-07-23 20:17:47 +0200234 else
Manuel Pégourié-Gonnarda65d5082015-01-12 14:54:55 +0100235 until lsof -nbi TCP:"$SRV_PORT" 2>/dev/null | grep LISTEN >/dev/null;
236 do :; done
Manuel Pégourié-Gonnard0eb6cab2014-07-23 20:17:47 +0200237 fi
Manuel Pégourié-Gonnard0c1ec472014-06-20 18:41:11 +0200238
Manuel Pégourié-Gonnarda6189f02014-09-20 13:15:43 +0200239 kill $DOG_PID >/dev/null 2>&1
240 wait $DOG_PID
Manuel Pégourié-Gonnard0c1ec472014-06-20 18:41:11 +0200241 else
242 sleep "$START_DELAY"
243 fi
244}
245
Manuel Pégourié-Gonnardc0f6a692014-08-30 22:41:47 +0200246# wait for client to terminate and set CLI_EXIT
247# must be called right after starting the client
248wait_client_done() {
249 CLI_PID=$!
250
Manuel Pégourié-Gonnarda0719722014-09-20 12:46:27 +0200251 CLI_DELAY=$(( $DOG_DELAY * $CLI_DELAY_FACTOR ))
252 CLI_DELAY_FACTOR=1
253
254 ( sleep $CLI_DELAY; echo "TIMEOUT" >> $CLI_OUT; kill $CLI_PID ) &
Manuel Pégourié-Gonnarda6189f02014-09-20 13:15:43 +0200255 DOG_PID=$!
Manuel Pégourié-Gonnardc0f6a692014-08-30 22:41:47 +0200256
257 wait $CLI_PID
258 CLI_EXIT=$?
259
Manuel Pégourié-Gonnarda6189f02014-09-20 13:15:43 +0200260 kill $DOG_PID >/dev/null 2>&1
261 wait $DOG_PID
Manuel Pégourié-Gonnardc0f6a692014-08-30 22:41:47 +0200262
263 echo "EXIT: $CLI_EXIT" >> $CLI_OUT
264}
265
Manuel Pégourié-Gonnard0eb6cab2014-07-23 20:17:47 +0200266# check if the given command uses dtls and sets global variable DTLS
267detect_dtls() {
Manuel Pégourié-Gonnardbe9eb872014-09-05 17:45:19 +0200268 if echo "$1" | grep 'dtls=1\|-dtls1\|-u' >/dev/null; then
Manuel Pégourié-Gonnard0eb6cab2014-07-23 20:17:47 +0200269 DTLS=1
270 else
271 DTLS=0
272 fi
273}
274
Manuel Pégourié-Gonnardbe9eb872014-09-05 17:45:19 +0200275# Usage: run_test name [-p proxy_cmd] srv_cmd cli_cmd cli_exit [option [...]]
Manuel Pégourié-Gonnardeaadc502014-02-20 11:01:30 +0100276# Options: -s pattern pattern that must be present in server output
277# -c pattern pattern that must be present in client output
278# -S pattern pattern that must be absent in server output
279# -C pattern pattern that must be absent in client output
280run_test() {
Manuel Pégourié-Gonnardfccd3252014-02-25 17:14:15 +0100281 NAME="$1"
Manuel Pégourié-Gonnardbe9eb872014-09-05 17:45:19 +0200282 shift 1
Manuel Pégourié-Gonnardfccd3252014-02-25 17:14:15 +0100283
Manuel Pégourié-Gonnard417d46c2014-03-13 19:17:53 +0100284 if echo "$NAME" | grep "$FILTER" | grep -v "$EXCLUDE" >/dev/null; then :
285 else
Manuel Pégourié-Gonnard74a13782014-10-14 22:34:08 +0200286 SKIP_NEXT="NO"
Manuel Pégourié-Gonnard417d46c2014-03-13 19:17:53 +0100287 return
288 fi
289
Manuel Pégourié-Gonnardfccd3252014-02-25 17:14:15 +0100290 print_name "$NAME"
Manuel Pégourié-Gonnardeaadc502014-02-20 11:01:30 +0100291
Manuel Pégourié-Gonnard6f4fbbb2014-08-14 14:31:29 +0200292 # should we skip?
293 if [ "X$SKIP_NEXT" = "XYES" ]; then
294 SKIP_NEXT="NO"
295 echo "SKIP"
Manuel Pégourié-Gonnard72e51ee2014-08-31 10:22:11 +0200296 SKIPS=$(( $SKIPS + 1 ))
Manuel Pégourié-Gonnard6f4fbbb2014-08-14 14:31:29 +0200297 return
298 fi
299
Manuel Pégourié-Gonnardbe9eb872014-09-05 17:45:19 +0200300 # does this test use a proxy?
301 if [ "X$1" = "X-p" ]; then
302 PXY_CMD="$2"
303 shift 2
304 else
305 PXY_CMD=""
306 fi
307
308 # get commands and client output
309 SRV_CMD="$1"
310 CLI_CMD="$2"
311 CLI_EXPECT="$3"
312 shift 3
313
314 # fix client port
315 if [ -n "$PXY_CMD" ]; then
316 CLI_CMD=$( echo "$CLI_CMD" | sed s/+SRV_PORT/$PXY_PORT/g )
317 else
318 CLI_CMD=$( echo "$CLI_CMD" | sed s/+SRV_PORT/$SRV_PORT/g )
319 fi
320
Manuel Pégourié-Gonnard0eb6cab2014-07-23 20:17:47 +0200321 # update DTLS variable
322 detect_dtls "$SRV_CMD"
323
Manuel Pégourié-Gonnardc73339f2014-02-26 16:35:27 +0100324 # prepend valgrind to our commands if active
325 if [ "$MEMCHECK" -gt 0 ]; then
326 if is_polar "$SRV_CMD"; then
327 SRV_CMD="valgrind --leak-check=full $SRV_CMD"
328 fi
329 if is_polar "$CLI_CMD"; then
330 CLI_CMD="valgrind --leak-check=full $CLI_CMD"
331 fi
332 fi
333
Manuel Pégourié-Gonnardeaadc502014-02-20 11:01:30 +0100334 # run the commands
Manuel Pégourié-Gonnardbe9eb872014-09-05 17:45:19 +0200335 if [ -n "$PXY_CMD" ]; then
336 echo "$PXY_CMD" > $PXY_OUT
Manuel Pégourié-Gonnarda6189f02014-09-20 13:15:43 +0200337 $PXY_CMD >> $PXY_OUT 2>&1 &
Manuel Pégourié-Gonnardbe9eb872014-09-05 17:45:19 +0200338 PXY_PID=$!
339 # assume proxy starts faster than server
340 fi
341
Manuel Pégourié-Gonnardfa60f122014-09-26 16:07:29 +0200342 check_osrv_dtls
Manuel Pégourié-Gonnardbc3b16c2014-05-28 23:06:50 +0200343 echo "$SRV_CMD" > $SRV_OUT
Manuel Pégourié-Gonnardfa60f122014-09-26 16:07:29 +0200344 provide_input | $SRV_CMD >> $SRV_OUT 2>&1 &
Manuel Pégourié-Gonnardeaadc502014-02-20 11:01:30 +0100345 SRV_PID=$!
Manuel Pégourié-Gonnard0c1ec472014-06-20 18:41:11 +0200346 wait_server_start
Manuel Pégourié-Gonnardc0f6a692014-08-30 22:41:47 +0200347
Manuel Pégourié-Gonnardbc3b16c2014-05-28 23:06:50 +0200348 echo "$CLI_CMD" > $CLI_OUT
Manuel Pégourié-Gonnardc0f6a692014-08-30 22:41:47 +0200349 eval "$CLI_CMD" >> $CLI_OUT 2>&1 &
350 wait_client_done
Manuel Pégourié-Gonnarde01af4c2014-03-25 14:16:44 +0100351
Manuel Pégourié-Gonnardbe9eb872014-09-05 17:45:19 +0200352 # terminate the server (and the proxy)
Manuel Pégourié-Gonnard74b11702014-08-14 15:47:33 +0200353 kill $SRV_PID
354 wait $SRV_PID
Manuel Pégourié-Gonnardbe9eb872014-09-05 17:45:19 +0200355 if [ -n "$PXY_CMD" ]; then
Manuel Pégourié-Gonnarda0719722014-09-20 12:46:27 +0200356 kill $PXY_PID >/dev/null 2>&1
Manuel Pégourié-Gonnardbe9eb872014-09-05 17:45:19 +0200357 wait $PXY_PID
358 fi
Manuel Pégourié-Gonnard677884d2014-02-25 16:42:31 +0100359
360 # check if the client and server went at least to the handshake stage
Paul Bakker1ebc0c52014-05-22 15:47:58 +0200361 # (useful to avoid tests with only negative assertions and non-zero
Manuel Pégourié-Gonnard677884d2014-02-25 16:42:31 +0100362 # expected client exit to incorrectly succeed in case of catastrophic
363 # failure)
Manuel Pégourié-Gonnardfccd3252014-02-25 17:14:15 +0100364 if is_polar "$SRV_CMD"; then
Manuel Pégourié-Gonnardbc3b16c2014-05-28 23:06:50 +0200365 if grep "Performing the SSL/TLS handshake" $SRV_OUT >/dev/null; then :;
Manuel Pégourié-Gonnard677884d2014-02-25 16:42:31 +0100366 else
Manuel Pégourié-Gonnard699cafa2014-10-27 13:57:03 +0100367 fail "server or client failed to reach handshake stage"
Manuel Pégourié-Gonnard677884d2014-02-25 16:42:31 +0100368 return
369 fi
370 fi
Manuel Pégourié-Gonnardfccd3252014-02-25 17:14:15 +0100371 if is_polar "$CLI_CMD"; then
Manuel Pégourié-Gonnardbc3b16c2014-05-28 23:06:50 +0200372 if grep "Performing the SSL/TLS handshake" $CLI_OUT >/dev/null; then :;
Manuel Pégourié-Gonnard677884d2014-02-25 16:42:31 +0100373 else
Manuel Pégourié-Gonnard699cafa2014-10-27 13:57:03 +0100374 fail "server or client failed to reach handshake stage"
Manuel Pégourié-Gonnard677884d2014-02-25 16:42:31 +0100375 return
376 fi
377 fi
378
Manuel Pégourié-Gonnardf8bdbb52014-02-21 09:20:14 +0100379 # check server exit code
380 if [ $? != 0 ]; then
381 fail "server fail"
382 return
383 fi
384
Manuel Pégourié-Gonnardeaadc502014-02-20 11:01:30 +0100385 # check client exit code
Manuel Pégourié-Gonnardfccd3252014-02-25 17:14:15 +0100386 if [ \( "$CLI_EXPECT" = 0 -a "$CLI_EXIT" != 0 \) -o \
387 \( "$CLI_EXPECT" != 0 -a "$CLI_EXIT" = 0 \) ]
Manuel Pégourié-Gonnard780d6712014-02-20 17:19:59 +0100388 then
Manuel Pégourié-Gonnardbe9eb872014-09-05 17:45:19 +0200389 fail "bad client exit code (expected $CLI_EXPECT, got $CLI_EXIT)"
Manuel Pégourié-Gonnardeaadc502014-02-20 11:01:30 +0100390 return
391 fi
Manuel Pégourié-Gonnardeaadc502014-02-20 11:01:30 +0100392
Manuel Pégourié-Gonnardc73339f2014-02-26 16:35:27 +0100393 # check other assertions
Manuel Pégourié-Gonnard480905d2014-08-21 19:38:32 +0200394 # lines beginning with == are added by valgrind, ignore them
Manuel Pégourié-Gonnardeaadc502014-02-20 11:01:30 +0100395 while [ $# -gt 0 ]
396 do
397 case $1 in
398 "-s")
Manuel Pégourié-Gonnard480905d2014-08-21 19:38:32 +0200399 if grep -v '^==' $SRV_OUT | grep "$2" >/dev/null; then :; else
Manuel Pégourié-Gonnardf8bdbb52014-02-21 09:20:14 +0100400 fail "-s $2"
Manuel Pégourié-Gonnardeaadc502014-02-20 11:01:30 +0100401 return
402 fi
403 ;;
404
405 "-c")
Manuel Pégourié-Gonnard480905d2014-08-21 19:38:32 +0200406 if grep -v '^==' $CLI_OUT | grep "$2" >/dev/null; then :; else
Manuel Pégourié-Gonnardf8bdbb52014-02-21 09:20:14 +0100407 fail "-c $2"
Manuel Pégourié-Gonnardeaadc502014-02-20 11:01:30 +0100408 return
409 fi
410 ;;
411
412 "-S")
Manuel Pégourié-Gonnard480905d2014-08-21 19:38:32 +0200413 if grep -v '^==' $SRV_OUT | grep "$2" >/dev/null; then
Manuel Pégourié-Gonnardf8bdbb52014-02-21 09:20:14 +0100414 fail "-S $2"
Manuel Pégourié-Gonnardeaadc502014-02-20 11:01:30 +0100415 return
416 fi
417 ;;
418
419 "-C")
Manuel Pégourié-Gonnard480905d2014-08-21 19:38:32 +0200420 if grep -v '^==' $CLI_OUT | grep "$2" >/dev/null; then
Manuel Pégourié-Gonnardf8bdbb52014-02-21 09:20:14 +0100421 fail "-C $2"
Manuel Pégourié-Gonnardeaadc502014-02-20 11:01:30 +0100422 return
423 fi
424 ;;
425
426 *)
Paul Bakker1ebc0c52014-05-22 15:47:58 +0200427 echo "Unknown test: $1" >&2
Manuel Pégourié-Gonnardeaadc502014-02-20 11:01:30 +0100428 exit 1
429 esac
430 shift 2
431 done
432
Manuel Pégourié-Gonnardc73339f2014-02-26 16:35:27 +0100433 # check valgrind's results
434 if [ "$MEMCHECK" -gt 0 ]; then
Manuel Pégourié-Gonnardbc3b16c2014-05-28 23:06:50 +0200435 if is_polar "$SRV_CMD" && has_mem_err $SRV_OUT; then
Manuel Pégourié-Gonnardc73339f2014-02-26 16:35:27 +0100436 fail "Server has memory errors"
437 return
438 fi
Manuel Pégourié-Gonnardbc3b16c2014-05-28 23:06:50 +0200439 if is_polar "$CLI_CMD" && has_mem_err $CLI_OUT; then
Manuel Pégourié-Gonnardc73339f2014-02-26 16:35:27 +0100440 fail "Client has memory errors"
441 return
442 fi
443 fi
444
Manuel Pégourié-Gonnardeaadc502014-02-20 11:01:30 +0100445 # if we're here, everything is ok
446 echo "PASS"
Manuel Pégourié-Gonnardbe9eb872014-09-05 17:45:19 +0200447 rm -f $SRV_OUT $CLI_OUT $PXY_OUT
Manuel Pégourié-Gonnardeaadc502014-02-20 11:01:30 +0100448}
449
Manuel Pégourié-Gonnarda9062e92014-02-25 16:21:22 +0100450cleanup() {
Manuel Pégourié-Gonnardbe9eb872014-09-05 17:45:19 +0200451 rm -f $CLI_OUT $SRV_OUT $PXY_OUT $SESSION
Manuel Pégourié-Gonnarda6189f02014-09-20 13:15:43 +0200452 test -n "${SRV_PID:-}" && kill $SRV_PID >/dev/null 2>&1
453 test -n "${PXY_PID:-}" && kill $PXY_PID >/dev/null 2>&1
454 test -n "${CLI_PID:-}" && kill $CLI_PID >/dev/null 2>&1
455 test -n "${DOG_PID:-}" && kill $DOG_PID >/dev/null 2>&1
Manuel Pégourié-Gonnarda9062e92014-02-25 16:21:22 +0100456 exit 1
457}
458
Manuel Pégourié-Gonnard9dea8bd2014-02-26 18:21:02 +0100459#
460# MAIN
461#
462
Manuel Pégourié-Gonnard913030c2014-03-28 10:12:38 +0100463get_options "$@"
464
Manuel Pégourié-Gonnardf7a26902014-02-27 12:25:54 +0100465# sanity checks, avoid an avalanche of errors
466if [ ! -x "$P_SRV" ]; then
467 echo "Command '$P_SRV' is not an executable file"
468 exit 1
469fi
470if [ ! -x "$P_CLI" ]; then
471 echo "Command '$P_CLI' is not an executable file"
472 exit 1
473fi
Manuel Pégourié-Gonnardbe9eb872014-09-05 17:45:19 +0200474if [ ! -x "$P_PXY" ]; then
475 echo "Command '$P_PXY' is not an executable file"
476 exit 1
477fi
Manuel Pégourié-Gonnard74faf3c2014-03-13 18:47:44 +0100478if which $OPENSSL_CMD >/dev/null 2>&1; then :; else
479 echo "Command '$OPENSSL_CMD' not found"
Manuel Pégourié-Gonnardf7a26902014-02-27 12:25:54 +0100480 exit 1
481fi
482
Manuel Pégourié-Gonnard32f8f4d2014-05-29 11:31:20 +0200483# used by watchdog
484MAIN_PID="$$"
485
Manuel Pégourié-Gonnard0c1ec472014-06-20 18:41:11 +0200486# be more patient with valgrind
487if [ "$MEMCHECK" -gt 0 ]; then
488 START_DELAY=3
489 DOG_DELAY=30
490else
491 START_DELAY=1
492 DOG_DELAY=10
493fi
Manuel Pégourié-Gonnarda0719722014-09-20 12:46:27 +0200494CLI_DELAY_FACTOR=1
Manuel Pégourié-Gonnard0c1ec472014-06-20 18:41:11 +0200495
Manuel Pégourié-Gonnardbe9eb872014-09-05 17:45:19 +0200496# Pick a "unique" server port in the range 10000-19999, and a proxy port
497PORT_BASE="0000$$"
Manuel Pégourié-Gonnard0af1ba32015-01-21 11:44:33 +0000498PORT_BASE="$( echo -n $PORT_BASE | tail -c 5 )"
Manuel Pégourié-Gonnardbe9eb872014-09-05 17:45:19 +0200499SRV_PORT="1$PORT_BASE"
500PXY_PORT="2$PORT_BASE"
501unset PORT_BASE
Manuel Pégourié-Gonnard8066b812014-05-28 22:59:30 +0200502
Manuel Pégourié-Gonnard0eb6cab2014-07-23 20:17:47 +0200503# fix commands to use this port, force IPv4 while at it
Manuel Pégourié-Gonnard0af1ba32015-01-21 11:44:33 +0000504# +SRV_PORT will be replaced by either $SRV_PORT or $PXY_PORT later
Manuel Pégourié-Gonnardbe9eb872014-09-05 17:45:19 +0200505P_SRV="$P_SRV server_addr=127.0.0.1 server_port=$SRV_PORT"
506P_CLI="$P_CLI server_addr=127.0.0.1 server_port=+SRV_PORT"
507P_PXY="$P_PXY server_addr=127.0.0.1 server_port=$SRV_PORT listen_addr=127.0.0.1 listen_port=$PXY_PORT"
508O_SRV="$O_SRV -accept $SRV_PORT"
509O_CLI="$O_CLI -connect localhost:+SRV_PORT"
510G_SRV="$G_SRV -p $SRV_PORT"
Manuel Pégourié-Gonnard0af1ba32015-01-21 11:44:33 +0000511G_CLI="$G_CLI -p +SRV_PORT localhost"
Manuel Pégourié-Gonnard8066b812014-05-28 22:59:30 +0200512
Manuel Pégourié-Gonnardbc3b16c2014-05-28 23:06:50 +0200513# Also pick a unique name for intermediate files
514SRV_OUT="srv_out.$$"
515CLI_OUT="cli_out.$$"
Manuel Pégourié-Gonnardbe9eb872014-09-05 17:45:19 +0200516PXY_OUT="pxy_out.$$"
Manuel Pégourié-Gonnardbc3b16c2014-05-28 23:06:50 +0200517SESSION="session.$$"
518
Manuel Pégourié-Gonnard6f4fbbb2014-08-14 14:31:29 +0200519SKIP_NEXT="NO"
520
Manuel Pégourié-Gonnarda9062e92014-02-25 16:21:22 +0100521trap cleanup INT TERM HUP
Manuel Pégourié-Gonnardeaadc502014-02-20 11:01:30 +0100522
Manuel Pégourié-Gonnarde73b2632014-07-12 04:00:00 +0200523# Basic test
524
Manuel Pégourié-Gonnard480905d2014-08-21 19:38:32 +0200525# Checks that:
526# - things work with all ciphersuites active (used with config-full in all.sh)
527# - the expected (highest security) parameters are selected
528# ("signature_algorithm ext: 6" means SHA-512 (highest common hash))
Manuel Pégourié-Gonnarde73b2632014-07-12 04:00:00 +0200529run_test "Default" \
Manuel Pégourié-Gonnard480905d2014-08-21 19:38:32 +0200530 "$P_SRV debug_level=3" \
Manuel Pégourié-Gonnarde73b2632014-07-12 04:00:00 +0200531 "$P_CLI" \
532 0 \
Manuel Pégourié-Gonnard480905d2014-08-21 19:38:32 +0200533 -s "Protocol is TLSv1.2" \
534 -s "Ciphersuite is TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384" \
535 -s "client hello v3, signature_algorithm ext: 6" \
536 -s "ECDHE curve: secp521r1" \
537 -S "error" \
538 -C "error"
Manuel Pégourié-Gonnarde73b2632014-07-12 04:00:00 +0200539
Manuel Pégourié-Gonnardc1da6642014-02-25 14:18:30 +0100540# Test for SSLv2 ClientHello
541
Manuel Pégourié-Gonnard6f4fbbb2014-08-14 14:31:29 +0200542requires_openssl_with_sslv2
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +0200543run_test "SSLv2 ClientHello: reference" \
Manuel Pégourié-Gonnardc1da6642014-02-25 14:18:30 +0100544 "$P_SRV debug_level=3" \
Manuel Pégourié-Gonnarda3d808e2014-02-26 16:33:03 +0100545 "$O_CLI -no_ssl2" \
Manuel Pégourié-Gonnardc1da6642014-02-25 14:18:30 +0100546 0 \
547 -S "parse client hello v2" \
548 -S "ssl_handshake returned"
549
550# Adding a SSL2-only suite makes OpenSSL client send SSLv2 ClientHello
Manuel Pégourié-Gonnard6f4fbbb2014-08-14 14:31:29 +0200551requires_openssl_with_sslv2
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +0200552run_test "SSLv2 ClientHello: actual test" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +0200553 "$P_SRV debug_level=2" \
Manuel Pégourié-Gonnardfccd3252014-02-25 17:14:15 +0100554 "$O_CLI -cipher 'DES-CBC-MD5:ALL'" \
Manuel Pégourié-Gonnardc1da6642014-02-25 14:18:30 +0100555 0 \
556 -s "parse client hello v2" \
557 -S "ssl_handshake returned"
558
Manuel Pégourié-Gonnard780d6712014-02-20 17:19:59 +0100559# Tests for Truncated HMAC extension
560
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +0200561run_test "Truncated HMAC: reference" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +0200562 "$P_SRV debug_level=4" \
Manuel Pégourié-Gonnardc1da6642014-02-25 14:18:30 +0100563 "$P_CLI trunc_hmac=0 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
Manuel Pégourié-Gonnard780d6712014-02-20 17:19:59 +0100564 0 \
565 -s "dumping 'computed mac' (20 bytes)"
566
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +0200567run_test "Truncated HMAC: actual test" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +0200568 "$P_SRV debug_level=4" \
Manuel Pégourié-Gonnardc1da6642014-02-25 14:18:30 +0100569 "$P_CLI trunc_hmac=1 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
Manuel Pégourié-Gonnardeaadc502014-02-20 11:01:30 +0100570 0 \
Manuel Pégourié-Gonnardf7c52012014-02-20 11:43:46 +0100571 -s "dumping 'computed mac' (10 bytes)"
572
Manuel Pégourié-Gonnard699cafa2014-10-27 13:57:03 +0100573# Tests for Encrypt-then-MAC extension
574
575run_test "Encrypt then MAC: default" \
Manuel Pégourié-Gonnard0098e7d2014-10-28 13:08:59 +0100576 "$P_SRV debug_level=3 \
577 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
Manuel Pégourié-Gonnard699cafa2014-10-27 13:57:03 +0100578 "$P_CLI debug_level=3" \
579 0 \
580 -c "client hello, adding encrypt_then_mac extension" \
581 -s "found encrypt then mac extension" \
582 -s "server hello, adding encrypt then mac extension" \
583 -c "found encrypt_then_mac extension" \
584 -c "using encrypt then mac" \
585 -s "using encrypt then mac"
586
587run_test "Encrypt then MAC: client enabled, server disabled" \
Manuel Pégourié-Gonnard0098e7d2014-10-28 13:08:59 +0100588 "$P_SRV debug_level=3 etm=0 \
589 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
Manuel Pégourié-Gonnard699cafa2014-10-27 13:57:03 +0100590 "$P_CLI debug_level=3 etm=1" \
591 0 \
592 -c "client hello, adding encrypt_then_mac extension" \
593 -s "found encrypt then mac extension" \
594 -S "server hello, adding encrypt then mac extension" \
595 -C "found encrypt_then_mac extension" \
596 -C "using encrypt then mac" \
597 -S "using encrypt then mac"
598
Manuel Pégourié-Gonnard78e745f2014-11-04 15:44:06 +0100599run_test "Encrypt then MAC: client enabled, aead cipher" \
600 "$P_SRV debug_level=3 etm=1 \
601 force_ciphersuite=TLS-RSA-WITH-AES-128-GCM-SHA256" \
602 "$P_CLI debug_level=3 etm=1" \
603 0 \
604 -c "client hello, adding encrypt_then_mac extension" \
605 -s "found encrypt then mac extension" \
606 -S "server hello, adding encrypt then mac extension" \
607 -C "found encrypt_then_mac extension" \
608 -C "using encrypt then mac" \
609 -S "using encrypt then mac"
610
611run_test "Encrypt then MAC: client enabled, stream cipher" \
612 "$P_SRV debug_level=3 etm=1 \
613 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
614 "$P_CLI debug_level=3 etm=1" \
615 0 \
616 -c "client hello, adding encrypt_then_mac extension" \
617 -s "found encrypt then mac extension" \
618 -S "server hello, adding encrypt then mac extension" \
619 -C "found encrypt_then_mac extension" \
620 -C "using encrypt then mac" \
621 -S "using encrypt then mac"
622
Manuel Pégourié-Gonnard699cafa2014-10-27 13:57:03 +0100623run_test "Encrypt then MAC: client disabled, server enabled" \
Manuel Pégourié-Gonnard0098e7d2014-10-28 13:08:59 +0100624 "$P_SRV debug_level=3 etm=1 \
625 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
Manuel Pégourié-Gonnard699cafa2014-10-27 13:57:03 +0100626 "$P_CLI debug_level=3 etm=0" \
627 0 \
628 -C "client hello, adding encrypt_then_mac extension" \
629 -S "found encrypt then mac extension" \
630 -S "server hello, adding encrypt then mac extension" \
631 -C "found encrypt_then_mac extension" \
632 -C "using encrypt then mac" \
633 -S "using encrypt then mac"
634
635run_test "Encrypt then MAC: client SSLv3, server enabled" \
Manuel Pégourié-Gonnard0098e7d2014-10-28 13:08:59 +0100636 "$P_SRV debug_level=3 \
637 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
Manuel Pégourié-Gonnard699cafa2014-10-27 13:57:03 +0100638 "$P_CLI debug_level=3 force_version=ssl3" \
639 0 \
640 -C "client hello, adding encrypt_then_mac extension" \
641 -S "found encrypt then mac extension" \
642 -S "server hello, adding encrypt then mac extension" \
643 -C "found encrypt_then_mac extension" \
644 -C "using encrypt then mac" \
645 -S "using encrypt then mac"
646
647run_test "Encrypt then MAC: client enabled, server SSLv3" \
Manuel Pégourié-Gonnard0098e7d2014-10-28 13:08:59 +0100648 "$P_SRV debug_level=3 force_version=ssl3 \
649 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
Manuel Pégourié-Gonnard699cafa2014-10-27 13:57:03 +0100650 "$P_CLI debug_level=3" \
651 0 \
652 -c "client hello, adding encrypt_then_mac extension" \
653 -s "found encrypt then mac extension" \
654 -S "server hello, adding encrypt then mac extension" \
655 -C "found encrypt_then_mac extension" \
656 -C "using encrypt then mac" \
657 -S "using encrypt then mac"
658
Manuel Pégourié-Gonnard367381f2014-10-20 18:40:56 +0200659# Tests for Extended Master Secret extension
660
661run_test "Extended Master Secret: default" \
662 "$P_SRV debug_level=3" \
663 "$P_CLI debug_level=3" \
664 0 \
665 -c "client hello, adding extended_master_secret extension" \
666 -s "found extended master secret extension" \
667 -s "server hello, adding extended master secret extension" \
668 -c "found extended_master_secret extension" \
669 -c "using extended master secret" \
670 -s "using extended master secret"
671
672run_test "Extended Master Secret: client enabled, server disabled" \
673 "$P_SRV debug_level=3 extended_ms=0" \
674 "$P_CLI debug_level=3 extended_ms=1" \
675 0 \
676 -c "client hello, adding extended_master_secret extension" \
677 -s "found extended master secret extension" \
678 -S "server hello, adding extended master secret extension" \
679 -C "found extended_master_secret extension" \
680 -C "using extended master secret" \
681 -S "using extended master secret"
682
683run_test "Extended Master Secret: client disabled, server enabled" \
684 "$P_SRV debug_level=3 extended_ms=1" \
685 "$P_CLI debug_level=3 extended_ms=0" \
686 0 \
687 -C "client hello, adding extended_master_secret extension" \
688 -S "found extended master secret extension" \
689 -S "server hello, adding extended master secret extension" \
690 -C "found extended_master_secret extension" \
691 -C "using extended master secret" \
692 -S "using extended master secret"
693
Manuel Pégourié-Gonnardb575b542014-10-24 15:12:31 +0200694run_test "Extended Master Secret: client SSLv3, server enabled" \
695 "$P_SRV debug_level=3" \
696 "$P_CLI debug_level=3 force_version=ssl3" \
697 0 \
698 -C "client hello, adding extended_master_secret extension" \
699 -S "found extended master secret extension" \
700 -S "server hello, adding extended master secret extension" \
701 -C "found extended_master_secret extension" \
702 -C "using extended master secret" \
703 -S "using extended master secret"
704
705run_test "Extended Master Secret: client enabled, server SSLv3" \
706 "$P_SRV debug_level=3 force_version=ssl3" \
707 "$P_CLI debug_level=3" \
708 0 \
709 -c "client hello, adding extended_master_secret extension" \
710 -s "found extended master secret extension" \
711 -S "server hello, adding extended master secret extension" \
712 -C "found extended_master_secret extension" \
713 -C "using extended master secret" \
714 -S "using extended master secret"
715
Manuel Pégourié-Gonnard1cbd39d2014-10-20 13:34:59 +0200716# Tests for FALLBACK_SCSV
717
718run_test "Fallback SCSV: default" \
719 "$P_SRV" \
720 "$P_CLI debug_level=3 force_version=tls1_1" \
721 0 \
722 -C "adding FALLBACK_SCSV" \
Manuel Pégourié-Gonnard01b26992014-10-20 14:05:28 +0200723 -S "received FALLBACK_SCSV" \
724 -S "inapropriate fallback" \
Manuel Pégourié-Gonnard1cbd39d2014-10-20 13:34:59 +0200725 -C "is a fatal alert message (msg 86)"
726
727run_test "Fallback SCSV: explicitly disabled" \
728 "$P_SRV" \
729 "$P_CLI debug_level=3 force_version=tls1_1 fallback=0" \
730 0 \
731 -C "adding FALLBACK_SCSV" \
Manuel Pégourié-Gonnard01b26992014-10-20 14:05:28 +0200732 -S "received FALLBACK_SCSV" \
733 -S "inapropriate fallback" \
Manuel Pégourié-Gonnard1cbd39d2014-10-20 13:34:59 +0200734 -C "is a fatal alert message (msg 86)"
735
736run_test "Fallback SCSV: enabled" \
737 "$P_SRV" \
738 "$P_CLI debug_level=3 force_version=tls1_1 fallback=1" \
Manuel Pégourié-Gonnard01b26992014-10-20 14:05:28 +0200739 1 \
740 -c "adding FALLBACK_SCSV" \
741 -s "received FALLBACK_SCSV" \
742 -s "inapropriate fallback" \
743 -c "is a fatal alert message (msg 86)"
744
745run_test "Fallback SCSV: enabled, max version" \
746 "$P_SRV" \
747 "$P_CLI debug_level=3 fallback=1" \
Manuel Pégourié-Gonnard1cbd39d2014-10-20 13:34:59 +0200748 0 \
749 -c "adding FALLBACK_SCSV" \
Manuel Pégourié-Gonnard01b26992014-10-20 14:05:28 +0200750 -s "received FALLBACK_SCSV" \
751 -S "inapropriate fallback" \
Manuel Pégourié-Gonnard1cbd39d2014-10-20 13:34:59 +0200752 -C "is a fatal alert message (msg 86)"
753
754requires_openssl_with_fallback_scsv
755run_test "Fallback SCSV: default, openssl server" \
756 "$O_SRV" \
757 "$P_CLI debug_level=3 force_version=tls1_1 fallback=0" \
758 0 \
759 -C "adding FALLBACK_SCSV" \
760 -C "is a fatal alert message (msg 86)"
761
762requires_openssl_with_fallback_scsv
763run_test "Fallback SCSV: enabled, openssl server" \
764 "$O_SRV" \
765 "$P_CLI debug_level=3 force_version=tls1_1 fallback=1" \
766 1 \
767 -c "adding FALLBACK_SCSV" \
768 -c "is a fatal alert message (msg 86)"
769
Manuel Pégourié-Gonnard01b26992014-10-20 14:05:28 +0200770requires_openssl_with_fallback_scsv
771run_test "Fallback SCSV: disabled, openssl client" \
772 "$P_SRV" \
773 "$O_CLI -tls1_1" \
774 0 \
775 -S "received FALLBACK_SCSV" \
776 -S "inapropriate fallback"
777
778requires_openssl_with_fallback_scsv
779run_test "Fallback SCSV: enabled, openssl client" \
780 "$P_SRV" \
781 "$O_CLI -tls1_1 -fallback_scsv" \
782 1 \
783 -s "received FALLBACK_SCSV" \
784 -s "inapropriate fallback"
785
786requires_openssl_with_fallback_scsv
787run_test "Fallback SCSV: enabled, max version, openssl client" \
788 "$P_SRV" \
789 "$O_CLI -fallback_scsv" \
790 0 \
791 -s "received FALLBACK_SCSV" \
792 -S "inapropriate fallback"
793
Manuel Pégourié-Gonnard780d6712014-02-20 17:19:59 +0100794# Tests for Session Tickets
795
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +0200796run_test "Session resume using tickets: basic" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +0200797 "$P_SRV debug_level=3 tickets=1" \
798 "$P_CLI debug_level=3 tickets=1 reconnect=1" \
Manuel Pégourié-Gonnardf7c52012014-02-20 11:43:46 +0100799 0 \
Manuel Pégourié-Gonnardc55a5b72014-02-20 22:50:56 +0100800 -c "client hello, adding session ticket extension" \
801 -s "found session ticket extension" \
802 -s "server hello, adding session ticket extension" \
803 -c "found session_ticket extension" \
804 -c "parse new session ticket" \
Manuel Pégourié-Gonnardf7c52012014-02-20 11:43:46 +0100805 -S "session successfully restored from cache" \
806 -s "session successfully restored from ticket" \
807 -s "a session has been resumed" \
808 -c "a session has been resumed"
809
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +0200810run_test "Session resume using tickets: cache disabled" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +0200811 "$P_SRV debug_level=3 tickets=1 cache_max=0" \
812 "$P_CLI debug_level=3 tickets=1 reconnect=1" \
Manuel Pégourié-Gonnarddbe1ee12014-02-21 09:18:13 +0100813 0 \
814 -c "client hello, adding session ticket extension" \
815 -s "found session ticket extension" \
816 -s "server hello, adding session ticket extension" \
817 -c "found session_ticket extension" \
818 -c "parse new session ticket" \
819 -S "session successfully restored from cache" \
820 -s "session successfully restored from ticket" \
821 -s "a session has been resumed" \
822 -c "a session has been resumed"
823
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +0200824run_test "Session resume using tickets: timeout" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +0200825 "$P_SRV debug_level=3 tickets=1 cache_max=0 ticket_timeout=1" \
826 "$P_CLI debug_level=3 tickets=1 reconnect=1 reco_delay=2" \
Manuel Pégourié-Gonnarddbe1ee12014-02-21 09:18:13 +0100827 0 \
828 -c "client hello, adding session ticket extension" \
829 -s "found session ticket extension" \
830 -s "server hello, adding session ticket extension" \
831 -c "found session_ticket extension" \
832 -c "parse new session ticket" \
833 -S "session successfully restored from cache" \
834 -S "session successfully restored from ticket" \
835 -S "a session has been resumed" \
836 -C "a session has been resumed"
837
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +0200838run_test "Session resume using tickets: openssl server" \
Manuel Pégourié-Gonnardf7a26902014-02-27 12:25:54 +0100839 "$O_SRV" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +0200840 "$P_CLI debug_level=3 tickets=1 reconnect=1" \
Manuel Pégourié-Gonnardfccd3252014-02-25 17:14:15 +0100841 0 \
842 -c "client hello, adding session ticket extension" \
843 -c "found session_ticket extension" \
844 -c "parse new session ticket" \
845 -c "a session has been resumed"
846
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +0200847run_test "Session resume using tickets: openssl client" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +0200848 "$P_SRV debug_level=3 tickets=1" \
Manuel Pégourié-Gonnardbc3b16c2014-05-28 23:06:50 +0200849 "( $O_CLI -sess_out $SESSION; \
850 $O_CLI -sess_in $SESSION; \
851 rm -f $SESSION )" \
Manuel Pégourié-Gonnardfccd3252014-02-25 17:14:15 +0100852 0 \
853 -s "found session ticket extension" \
854 -s "server hello, adding session ticket extension" \
855 -S "session successfully restored from cache" \
856 -s "session successfully restored from ticket" \
857 -s "a session has been resumed"
858
Manuel Pégourié-Gonnardc55a5b72014-02-20 22:50:56 +0100859# Tests for Session Resume based on session-ID and cache
Manuel Pégourié-Gonnard780d6712014-02-20 17:19:59 +0100860
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +0200861run_test "Session resume using cache: tickets enabled on client" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +0200862 "$P_SRV debug_level=3 tickets=0" \
863 "$P_CLI debug_level=3 tickets=1 reconnect=1" \
Manuel Pégourié-Gonnardf7c52012014-02-20 11:43:46 +0100864 0 \
Manuel Pégourié-Gonnardc55a5b72014-02-20 22:50:56 +0100865 -c "client hello, adding session ticket extension" \
866 -s "found session ticket extension" \
867 -S "server hello, adding session ticket extension" \
868 -C "found session_ticket extension" \
869 -C "parse new session ticket" \
Manuel Pégourié-Gonnardf7c52012014-02-20 11:43:46 +0100870 -s "session successfully restored from cache" \
871 -S "session successfully restored from ticket" \
872 -s "a session has been resumed" \
873 -c "a session has been resumed"
874
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +0200875run_test "Session resume using cache: tickets enabled on server" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +0200876 "$P_SRV debug_level=3 tickets=1" \
877 "$P_CLI debug_level=3 tickets=0 reconnect=1" \
Manuel Pégourié-Gonnardf7c52012014-02-20 11:43:46 +0100878 0 \
Manuel Pégourié-Gonnardc55a5b72014-02-20 22:50:56 +0100879 -C "client hello, adding session ticket extension" \
880 -S "found session ticket extension" \
881 -S "server hello, adding session ticket extension" \
882 -C "found session_ticket extension" \
883 -C "parse new session ticket" \
Manuel Pégourié-Gonnardf7c52012014-02-20 11:43:46 +0100884 -s "session successfully restored from cache" \
885 -S "session successfully restored from ticket" \
886 -s "a session has been resumed" \
887 -c "a session has been resumed"
Manuel Pégourié-Gonnardde143782014-02-20 14:50:42 +0100888
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +0200889run_test "Session resume using cache: cache_max=0" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +0200890 "$P_SRV debug_level=3 tickets=0 cache_max=0" \
891 "$P_CLI debug_level=3 tickets=0 reconnect=1" \
Manuel Pégourié-Gonnard4c883452014-02-20 21:32:41 +0100892 0 \
893 -S "session successfully restored from cache" \
894 -S "session successfully restored from ticket" \
Manuel Pégourié-Gonnardc55a5b72014-02-20 22:50:56 +0100895 -S "a session has been resumed" \
896 -C "a session has been resumed"
Manuel Pégourié-Gonnard4c883452014-02-20 21:32:41 +0100897
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +0200898run_test "Session resume using cache: cache_max=1" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +0200899 "$P_SRV debug_level=3 tickets=0 cache_max=1" \
900 "$P_CLI debug_level=3 tickets=0 reconnect=1" \
Manuel Pégourié-Gonnardc55a5b72014-02-20 22:50:56 +0100901 0 \
902 -s "session successfully restored from cache" \
903 -S "session successfully restored from ticket" \
904 -s "a session has been resumed" \
905 -c "a session has been resumed"
906
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +0200907run_test "Session resume using cache: timemout > delay" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +0200908 "$P_SRV debug_level=3 tickets=0" \
909 "$P_CLI debug_level=3 tickets=0 reconnect=1 reco_delay=0" \
Manuel Pégourié-Gonnardc55a5b72014-02-20 22:50:56 +0100910 0 \
911 -s "session successfully restored from cache" \
912 -S "session successfully restored from ticket" \
913 -s "a session has been resumed" \
914 -c "a session has been resumed"
915
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +0200916run_test "Session resume using cache: timeout < delay" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +0200917 "$P_SRV debug_level=3 tickets=0 cache_timeout=1" \
918 "$P_CLI debug_level=3 tickets=0 reconnect=1 reco_delay=2" \
Manuel Pégourié-Gonnardc55a5b72014-02-20 22:50:56 +0100919 0 \
920 -S "session successfully restored from cache" \
921 -S "session successfully restored from ticket" \
922 -S "a session has been resumed" \
923 -C "a session has been resumed"
924
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +0200925run_test "Session resume using cache: no timeout" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +0200926 "$P_SRV debug_level=3 tickets=0 cache_timeout=0" \
927 "$P_CLI debug_level=3 tickets=0 reconnect=1 reco_delay=2" \
Manuel Pégourié-Gonnard4c883452014-02-20 21:32:41 +0100928 0 \
929 -s "session successfully restored from cache" \
930 -S "session successfully restored from ticket" \
931 -s "a session has been resumed" \
932 -c "a session has been resumed"
933
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +0200934run_test "Session resume using cache: openssl client" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +0200935 "$P_SRV debug_level=3 tickets=0" \
Manuel Pégourié-Gonnardbc3b16c2014-05-28 23:06:50 +0200936 "( $O_CLI -sess_out $SESSION; \
937 $O_CLI -sess_in $SESSION; \
938 rm -f $SESSION )" \
Manuel Pégourié-Gonnarddb735f62014-02-25 17:57:59 +0100939 0 \
940 -s "found session ticket extension" \
941 -S "server hello, adding session ticket extension" \
942 -s "session successfully restored from cache" \
943 -S "session successfully restored from ticket" \
944 -s "a session has been resumed"
945
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +0200946run_test "Session resume using cache: openssl server" \
Manuel Pégourié-Gonnardf7a26902014-02-27 12:25:54 +0100947 "$O_SRV" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +0200948 "$P_CLI debug_level=3 tickets=0 reconnect=1" \
Manuel Pégourié-Gonnarddb735f62014-02-25 17:57:59 +0100949 0 \
950 -C "found session_ticket extension" \
951 -C "parse new session ticket" \
952 -c "a session has been resumed"
953
Manuel Pégourié-Gonnard780d6712014-02-20 17:19:59 +0100954# Tests for Max Fragment Length extension
955
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +0200956run_test "Max fragment length: not used, reference" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +0200957 "$P_SRV debug_level=3" \
958 "$P_CLI debug_level=3" \
Manuel Pégourié-Gonnardde143782014-02-20 14:50:42 +0100959 0 \
960 -C "client hello, adding max_fragment_length extension" \
961 -S "found max fragment length extension" \
962 -S "server hello, max_fragment_length extension" \
963 -C "found max_fragment_length extension"
964
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +0200965run_test "Max fragment length: used by client" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +0200966 "$P_SRV debug_level=3" \
967 "$P_CLI debug_level=3 max_frag_len=4096" \
Manuel Pégourié-Gonnardde143782014-02-20 14:50:42 +0100968 0 \
969 -c "client hello, adding max_fragment_length extension" \
970 -s "found max fragment length extension" \
971 -s "server hello, max_fragment_length extension" \
972 -c "found max_fragment_length extension"
973
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +0200974run_test "Max fragment length: used by server" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +0200975 "$P_SRV debug_level=3 max_frag_len=4096" \
976 "$P_CLI debug_level=3" \
Manuel Pégourié-Gonnardde143782014-02-20 14:50:42 +0100977 0 \
978 -C "client hello, adding max_fragment_length extension" \
979 -S "found max fragment length extension" \
980 -S "server hello, max_fragment_length extension" \
981 -C "found max_fragment_length extension"
Manuel Pégourié-Gonnard780d6712014-02-20 17:19:59 +0100982
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +0200983requires_gnutls
984run_test "Max fragment length: gnutls server" \
Manuel Pégourié-Gonnardbaa7f072014-08-20 20:15:53 +0200985 "$G_SRV" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +0200986 "$P_CLI debug_level=3 max_frag_len=4096" \
Manuel Pégourié-Gonnardbaa7f072014-08-20 20:15:53 +0200987 0 \
988 -c "client hello, adding max_fragment_length extension" \
989 -c "found max_fragment_length extension"
990
Manuel Pégourié-Gonnard37e08e12014-10-13 17:55:52 +0200991run_test "Max fragment length: client, message just fits" \
992 "$P_SRV debug_level=3" \
993 "$P_CLI debug_level=3 max_frag_len=2048 request_size=2048" \
994 0 \
995 -c "client hello, adding max_fragment_length extension" \
996 -s "found max fragment length extension" \
997 -s "server hello, max_fragment_length extension" \
998 -c "found max_fragment_length extension" \
999 -c "2048 bytes written in 1 fragments" \
1000 -s "2048 bytes read"
1001
1002run_test "Max fragment length: client, larger message" \
1003 "$P_SRV debug_level=3" \
1004 "$P_CLI debug_level=3 max_frag_len=2048 request_size=2345" \
1005 0 \
1006 -c "client hello, adding max_fragment_length extension" \
1007 -s "found max fragment length extension" \
1008 -s "server hello, max_fragment_length extension" \
1009 -c "found max_fragment_length extension" \
1010 -c "2345 bytes written in 2 fragments" \
1011 -s "2048 bytes read" \
1012 -s "297 bytes read"
1013
1014run_test "Max fragment length: client, larger message" \
1015 "$P_SRV debug_level=3 dtls=1" \
1016 "$P_CLI debug_level=3 dtls=1 max_frag_len=2048 request_size=2345" \
1017 1 \
1018 -c "client hello, adding max_fragment_length extension" \
1019 -s "found max fragment length extension" \
1020 -s "server hello, max_fragment_length extension" \
1021 -c "found max_fragment_length extension" \
1022 -c "fragment larger than.*maximum"
1023
Manuel Pégourié-Gonnard780d6712014-02-20 17:19:59 +01001024# Tests for renegotiation
1025
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001026run_test "Renegotiation: none, for reference" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001027 "$P_SRV debug_level=3 exchanges=2" \
1028 "$P_CLI debug_level=3 exchanges=2" \
Manuel Pégourié-Gonnard780d6712014-02-20 17:19:59 +01001029 0 \
1030 -C "client hello, adding renegotiation extension" \
1031 -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
1032 -S "found renegotiation extension" \
1033 -s "server hello, secure renegotiation extension" \
1034 -c "found renegotiation extension" \
Manuel Pégourié-Gonnardc73339f2014-02-26 16:35:27 +01001035 -C "=> renegotiate" \
1036 -S "=> renegotiate" \
Manuel Pégourié-Gonnard780d6712014-02-20 17:19:59 +01001037 -S "write hello request"
1038
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001039run_test "Renegotiation: client-initiated" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001040 "$P_SRV debug_level=3 exchanges=2 renegotiation=1" \
1041 "$P_CLI debug_level=3 exchanges=2 renegotiation=1 renegotiate=1" \
Manuel Pégourié-Gonnard780d6712014-02-20 17:19:59 +01001042 0 \
1043 -c "client hello, adding renegotiation extension" \
1044 -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
1045 -s "found renegotiation extension" \
1046 -s "server hello, secure renegotiation extension" \
1047 -c "found renegotiation extension" \
Manuel Pégourié-Gonnardc73339f2014-02-26 16:35:27 +01001048 -c "=> renegotiate" \
1049 -s "=> renegotiate" \
Manuel Pégourié-Gonnard780d6712014-02-20 17:19:59 +01001050 -S "write hello request"
1051
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001052run_test "Renegotiation: server-initiated" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001053 "$P_SRV debug_level=3 exchanges=2 renegotiation=1 renegotiate=1" \
1054 "$P_CLI debug_level=3 exchanges=2 renegotiation=1" \
Manuel Pégourié-Gonnard780d6712014-02-20 17:19:59 +01001055 0 \
1056 -c "client hello, adding renegotiation extension" \
1057 -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
1058 -s "found renegotiation extension" \
1059 -s "server hello, secure renegotiation extension" \
1060 -c "found renegotiation extension" \
Manuel Pégourié-Gonnardc73339f2014-02-26 16:35:27 +01001061 -c "=> renegotiate" \
1062 -s "=> renegotiate" \
Manuel Pégourié-Gonnard780d6712014-02-20 17:19:59 +01001063 -s "write hello request"
1064
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001065run_test "Renegotiation: double" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001066 "$P_SRV debug_level=3 exchanges=2 renegotiation=1 renegotiate=1" \
1067 "$P_CLI debug_level=3 exchanges=2 renegotiation=1 renegotiate=1" \
Manuel Pégourié-Gonnard780d6712014-02-20 17:19:59 +01001068 0 \
1069 -c "client hello, adding renegotiation extension" \
1070 -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
1071 -s "found renegotiation extension" \
1072 -s "server hello, secure renegotiation extension" \
1073 -c "found renegotiation extension" \
Manuel Pégourié-Gonnardc73339f2014-02-26 16:35:27 +01001074 -c "=> renegotiate" \
1075 -s "=> renegotiate" \
Manuel Pégourié-Gonnard780d6712014-02-20 17:19:59 +01001076 -s "write hello request"
1077
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001078run_test "Renegotiation: client-initiated, server-rejected" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001079 "$P_SRV debug_level=3 exchanges=2 renegotiation=0" \
1080 "$P_CLI debug_level=3 exchanges=2 renegotiation=1 renegotiate=1" \
Manuel Pégourié-Gonnard780d6712014-02-20 17:19:59 +01001081 1 \
1082 -c "client hello, adding renegotiation extension" \
1083 -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
1084 -S "found renegotiation extension" \
1085 -s "server hello, secure renegotiation extension" \
1086 -c "found renegotiation extension" \
Manuel Pégourié-Gonnardc73339f2014-02-26 16:35:27 +01001087 -c "=> renegotiate" \
1088 -S "=> renegotiate" \
Manuel Pégourié-Gonnardfae355e2014-07-04 14:32:27 +02001089 -S "write hello request" \
Manuel Pégourié-Gonnard65919622014-08-19 12:50:30 +02001090 -c "SSL - Unexpected message at ServerHello in renegotiation" \
Manuel Pégourié-Gonnardfae355e2014-07-04 14:32:27 +02001091 -c "failed"
Manuel Pégourié-Gonnard780d6712014-02-20 17:19:59 +01001092
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001093run_test "Renegotiation: server-initiated, client-rejected, default" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001094 "$P_SRV debug_level=3 exchanges=2 renegotiation=1 renegotiate=1" \
1095 "$P_CLI debug_level=3 exchanges=2 renegotiation=0" \
Manuel Pégourié-Gonnard780d6712014-02-20 17:19:59 +01001096 0 \
1097 -C "client hello, adding renegotiation extension" \
1098 -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
1099 -S "found renegotiation extension" \
1100 -s "server hello, secure renegotiation extension" \
1101 -c "found renegotiation extension" \
Manuel Pégourié-Gonnardc73339f2014-02-26 16:35:27 +01001102 -C "=> renegotiate" \
1103 -S "=> renegotiate" \
Manuel Pégourié-Gonnard780d6712014-02-20 17:19:59 +01001104 -s "write hello request" \
Manuel Pégourié-Gonnarda9964db2014-07-03 19:29:16 +02001105 -S "SSL - An unexpected message was received from our peer" \
1106 -S "failed"
Manuel Pégourié-Gonnard33a752e2014-02-21 09:47:37 +01001107
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001108run_test "Renegotiation: server-initiated, client-rejected, not enforced" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001109 "$P_SRV debug_level=3 exchanges=2 renegotiation=1 renegotiate=1 \
Manuel Pégourié-Gonnardfae355e2014-07-04 14:32:27 +02001110 renego_delay=-1" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001111 "$P_CLI debug_level=3 exchanges=2 renegotiation=0" \
Manuel Pégourié-Gonnardfae355e2014-07-04 14:32:27 +02001112 0 \
1113 -C "client hello, adding renegotiation extension" \
1114 -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
1115 -S "found renegotiation extension" \
1116 -s "server hello, secure renegotiation extension" \
1117 -c "found renegotiation extension" \
1118 -C "=> renegotiate" \
1119 -S "=> renegotiate" \
1120 -s "write hello request" \
1121 -S "SSL - An unexpected message was received from our peer" \
1122 -S "failed"
1123
Manuel Pégourié-Gonnarda8c0a0d2014-08-15 12:07:38 +02001124# delay 2 for 1 alert record + 1 application data record
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001125run_test "Renegotiation: server-initiated, client-rejected, delay 2" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001126 "$P_SRV debug_level=3 exchanges=2 renegotiation=1 renegotiate=1 \
Manuel Pégourié-Gonnarda8c0a0d2014-08-15 12:07:38 +02001127 renego_delay=2" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001128 "$P_CLI debug_level=3 exchanges=2 renegotiation=0" \
Manuel Pégourié-Gonnardfae355e2014-07-04 14:32:27 +02001129 0 \
1130 -C "client hello, adding renegotiation extension" \
1131 -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
1132 -S "found renegotiation extension" \
1133 -s "server hello, secure renegotiation extension" \
1134 -c "found renegotiation extension" \
1135 -C "=> renegotiate" \
1136 -S "=> renegotiate" \
1137 -s "write hello request" \
1138 -S "SSL - An unexpected message was received from our peer" \
1139 -S "failed"
1140
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001141run_test "Renegotiation: server-initiated, client-rejected, delay 0" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001142 "$P_SRV debug_level=3 exchanges=2 renegotiation=1 renegotiate=1 \
Manuel Pégourié-Gonnardfae355e2014-07-04 14:32:27 +02001143 renego_delay=0" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001144 "$P_CLI debug_level=3 exchanges=2 renegotiation=0" \
Manuel Pégourié-Gonnardfae355e2014-07-04 14:32:27 +02001145 0 \
1146 -C "client hello, adding renegotiation extension" \
1147 -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
1148 -S "found renegotiation extension" \
1149 -s "server hello, secure renegotiation extension" \
1150 -c "found renegotiation extension" \
1151 -C "=> renegotiate" \
1152 -S "=> renegotiate" \
1153 -s "write hello request" \
Manuel Pégourié-Gonnarda8c0a0d2014-08-15 12:07:38 +02001154 -s "SSL - An unexpected message was received from our peer"
Manuel Pégourié-Gonnardfae355e2014-07-04 14:32:27 +02001155
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001156run_test "Renegotiation: server-initiated, client-accepted, delay 0" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001157 "$P_SRV debug_level=3 exchanges=2 renegotiation=1 renegotiate=1 \
Manuel Pégourié-Gonnardfae355e2014-07-04 14:32:27 +02001158 renego_delay=0" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001159 "$P_CLI debug_level=3 exchanges=2 renegotiation=1" \
Manuel Pégourié-Gonnardfae355e2014-07-04 14:32:27 +02001160 0 \
1161 -c "client hello, adding renegotiation extension" \
1162 -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
1163 -s "found renegotiation extension" \
1164 -s "server hello, secure renegotiation extension" \
1165 -c "found renegotiation extension" \
1166 -c "=> renegotiate" \
1167 -s "=> renegotiate" \
1168 -s "write hello request" \
1169 -S "SSL - An unexpected message was received from our peer" \
1170 -S "failed"
1171
Manuel Pégourié-Gonnard590f4162014-11-05 14:23:03 +01001172run_test "Renegotiation: periodic, just below period" \
1173 "$P_SRV debug_level=3 exchanges=9 renegotiation=1 renego_period=3" \
1174 "$P_CLI debug_level=3 exchanges=2 renegotiation=1" \
1175 0 \
1176 -C "client hello, adding renegotiation extension" \
1177 -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
1178 -S "found renegotiation extension" \
1179 -s "server hello, secure renegotiation extension" \
1180 -c "found renegotiation extension" \
1181 -S "record counter limit reached: renegotiate" \
1182 -C "=> renegotiate" \
1183 -S "=> renegotiate" \
1184 -S "write hello request" \
1185 -S "SSL - An unexpected message was received from our peer" \
1186 -S "failed"
1187
1188run_test "Renegotiation: periodic, just above period" \
1189 "$P_SRV debug_level=3 exchanges=9 renegotiation=1 renego_period=3" \
1190 "$P_CLI debug_level=3 exchanges=3 renegotiation=1" \
1191 0 \
1192 -c "client hello, adding renegotiation extension" \
1193 -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
1194 -s "found renegotiation extension" \
1195 -s "server hello, secure renegotiation extension" \
1196 -c "found renegotiation extension" \
1197 -s "record counter limit reached: renegotiate" \
1198 -c "=> renegotiate" \
1199 -s "=> renegotiate" \
1200 -s "write hello request" \
1201 -S "SSL - An unexpected message was received from our peer" \
1202 -S "failed"
1203
1204run_test "Renegotiation: periodic, two times period" \
1205 "$P_SRV debug_level=3 exchanges=9 renegotiation=1 renego_period=3" \
1206 "$P_CLI debug_level=3 exchanges=6 renegotiation=1" \
1207 0 \
1208 -c "client hello, adding renegotiation extension" \
1209 -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
1210 -s "found renegotiation extension" \
1211 -s "server hello, secure renegotiation extension" \
1212 -c "found renegotiation extension" \
1213 -s "record counter limit reached: renegotiate" \
1214 -c "=> renegotiate" \
1215 -s "=> renegotiate" \
1216 -s "write hello request" \
1217 -S "SSL - An unexpected message was received from our peer" \
1218 -S "failed"
1219
1220run_test "Renegotiation: periodic, above period, disabled" \
1221 "$P_SRV debug_level=3 exchanges=9 renegotiation=0 renego_period=3" \
1222 "$P_CLI debug_level=3 exchanges=4 renegotiation=1" \
1223 0 \
1224 -C "client hello, adding renegotiation extension" \
1225 -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
1226 -S "found renegotiation extension" \
1227 -s "server hello, secure renegotiation extension" \
1228 -c "found renegotiation extension" \
1229 -S "record counter limit reached: renegotiate" \
1230 -C "=> renegotiate" \
1231 -S "=> renegotiate" \
1232 -S "write hello request" \
1233 -S "SSL - An unexpected message was received from our peer" \
1234 -S "failed"
1235
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001236run_test "Renegotiation: nbio, client-initiated" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001237 "$P_SRV debug_level=3 nbio=2 exchanges=2 renegotiation=1" \
1238 "$P_CLI debug_level=3 nbio=2 exchanges=2 renegotiation=1 renegotiate=1" \
Manuel Pégourié-Gonnardf07f4212014-08-15 19:04:47 +02001239 0 \
1240 -c "client hello, adding renegotiation extension" \
1241 -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
1242 -s "found renegotiation extension" \
1243 -s "server hello, secure renegotiation extension" \
1244 -c "found renegotiation extension" \
1245 -c "=> renegotiate" \
1246 -s "=> renegotiate" \
1247 -S "write hello request"
1248
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001249run_test "Renegotiation: nbio, server-initiated" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001250 "$P_SRV debug_level=3 nbio=2 exchanges=2 renegotiation=1 renegotiate=1" \
1251 "$P_CLI debug_level=3 nbio=2 exchanges=2 renegotiation=1" \
Manuel Pégourié-Gonnardf07f4212014-08-15 19:04:47 +02001252 0 \
1253 -c "client hello, adding renegotiation extension" \
1254 -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
1255 -s "found renegotiation extension" \
1256 -s "server hello, secure renegotiation extension" \
1257 -c "found renegotiation extension" \
1258 -c "=> renegotiate" \
1259 -s "=> renegotiate" \
1260 -s "write hello request"
1261
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001262run_test "Renegotiation: openssl server, client-initiated" \
Manuel Pégourié-Gonnarda7756172014-08-31 18:37:01 +02001263 "$O_SRV -www" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001264 "$P_CLI debug_level=3 exchanges=1 renegotiation=1 renegotiate=1" \
Manuel Pégourié-Gonnard51362962014-08-30 21:22:47 +02001265 0 \
1266 -c "client hello, adding renegotiation extension" \
1267 -c "found renegotiation extension" \
1268 -c "=> renegotiate" \
Manuel Pégourié-Gonnard85d915b2014-11-03 20:10:36 +01001269 -C "ssl_hanshake() returned" \
Manuel Pégourié-Gonnard51362962014-08-30 21:22:47 +02001270 -C "error" \
1271 -c "HTTP/1.0 200 [Oo][Kk]"
1272
Manuel Pégourié-Gonnard85d915b2014-11-03 20:10:36 +01001273run_test "Renegotiation: gnutls server strict, client-initiated" \
1274 "$G_SRV --priority=NORMAL:%SAFE_RENEGOTIATION" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001275 "$P_CLI debug_level=3 exchanges=1 renegotiation=1 renegotiate=1" \
Manuel Pégourié-Gonnard51362962014-08-30 21:22:47 +02001276 0 \
1277 -c "client hello, adding renegotiation extension" \
1278 -c "found renegotiation extension" \
1279 -c "=> renegotiate" \
Manuel Pégourié-Gonnard85d915b2014-11-03 20:10:36 +01001280 -C "ssl_hanshake() returned" \
Manuel Pégourié-Gonnard51362962014-08-30 21:22:47 +02001281 -C "error" \
1282 -c "HTTP/1.0 200 [Oo][Kk]"
1283
Manuel Pégourié-Gonnard85d915b2014-11-03 20:10:36 +01001284run_test "Renegotiation: gnutls server unsafe, client-initiated default" \
1285 "$G_SRV --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION" \
1286 "$P_CLI debug_level=3 exchanges=1 renegotiation=1 renegotiate=1" \
1287 1 \
1288 -c "client hello, adding renegotiation extension" \
1289 -C "found renegotiation extension" \
1290 -c "=> renegotiate" \
1291 -c "ssl_handshake() returned" \
1292 -c "error" \
1293 -C "HTTP/1.0 200 [Oo][Kk]"
1294
1295run_test "Renegotiation: gnutls server unsafe, client-inititated no legacy" \
1296 "$G_SRV --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION" \
1297 "$P_CLI debug_level=3 exchanges=1 renegotiation=1 renegotiate=1 \
1298 allow_legacy=0" \
1299 1 \
1300 -c "client hello, adding renegotiation extension" \
1301 -C "found renegotiation extension" \
1302 -c "=> renegotiate" \
1303 -c "ssl_handshake() returned" \
1304 -c "error" \
1305 -C "HTTP/1.0 200 [Oo][Kk]"
1306
1307run_test "Renegotiation: gnutls server unsafe, client-inititated legacy" \
1308 "$G_SRV --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION" \
1309 "$P_CLI debug_level=3 exchanges=1 renegotiation=1 renegotiate=1 \
1310 allow_legacy=1" \
1311 0 \
1312 -c "client hello, adding renegotiation extension" \
1313 -C "found renegotiation extension" \
1314 -c "=> renegotiate" \
1315 -C "ssl_hanshake() returned" \
Manuel Pégourié-Gonnard8520dac2014-02-21 12:12:23 +01001316 -C "error" \
1317 -c "HTTP/1.0 200 [Oo][Kk]"
1318
Manuel Pégourié-Gonnard30d16eb2014-08-19 17:43:50 +02001319run_test "Renegotiation: DTLS, client-initiated" \
1320 "$P_SRV debug_level=3 dtls=1 exchanges=2 renegotiation=1" \
1321 "$P_CLI debug_level=3 dtls=1 exchanges=2 renegotiation=1 renegotiate=1" \
1322 0 \
1323 -c "client hello, adding renegotiation extension" \
1324 -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
1325 -s "found renegotiation extension" \
1326 -s "server hello, secure renegotiation extension" \
1327 -c "found renegotiation extension" \
1328 -c "=> renegotiate" \
1329 -s "=> renegotiate" \
1330 -S "write hello request"
1331
Manuel Pégourié-Gonnardc392b242014-08-19 17:53:11 +02001332run_test "Renegotiation: DTLS, server-initiated" \
1333 "$P_SRV debug_level=3 dtls=1 exchanges=2 renegotiation=1 renegotiate=1" \
Manuel Pégourié-Gonnarddf9a0a82014-10-02 14:17:18 +02001334 "$P_CLI debug_level=3 dtls=1 exchanges=2 renegotiation=1 \
1335 read_timeout=1000 max_resend=2" \
Manuel Pégourié-Gonnardc392b242014-08-19 17:53:11 +02001336 0 \
1337 -c "client hello, adding renegotiation extension" \
1338 -s "received TLS_EMPTY_RENEGOTIATION_INFO" \
1339 -s "found renegotiation extension" \
1340 -s "server hello, secure renegotiation extension" \
1341 -c "found renegotiation extension" \
1342 -c "=> renegotiate" \
1343 -s "=> renegotiate" \
1344 -s "write hello request"
1345
Manuel Pégourié-Gonnardf1499f62014-08-31 17:13:13 +02001346run_test "Renegotiation: DTLS, gnutls server, client-initiated" \
1347 "$G_SRV -u --mtu 4096" \
1348 "$P_CLI debug_level=3 dtls=1 exchanges=1 renegotiation=1 renegotiate=1" \
1349 0 \
1350 -c "client hello, adding renegotiation extension" \
1351 -c "found renegotiation extension" \
1352 -c "=> renegotiate" \
1353 -C "ssl_handshake returned" \
1354 -C "error" \
1355 -s "Extra-header:"
1356
Manuel Pégourié-Gonnard85d915b2014-11-03 20:10:36 +01001357# Test for the "secure renegotation" extension only (no actual renegotiation)
1358
1359run_test "Renego ext: gnutls server strict, client default" \
1360 "$G_SRV --priority=NORMAL:%SAFE_RENEGOTIATION" \
1361 "$P_CLI debug_level=3" \
1362 0 \
1363 -c "found renegotiation extension" \
1364 -C "error" \
1365 -c "HTTP/1.0 200 [Oo][Kk]"
1366
1367run_test "Renego ext: gnutls server unsafe, client default" \
1368 "$G_SRV --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION" \
1369 "$P_CLI debug_level=3" \
1370 0 \
1371 -C "found renegotiation extension" \
1372 -C "error" \
1373 -c "HTTP/1.0 200 [Oo][Kk]"
1374
1375run_test "Renego ext: gnutls server unsafe, client break legacy" \
1376 "$G_SRV --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION" \
1377 "$P_CLI debug_level=3 allow_legacy=-1" \
1378 1 \
1379 -C "found renegotiation extension" \
1380 -c "error" \
1381 -C "HTTP/1.0 200 [Oo][Kk]"
1382
1383run_test "Renego ext: gnutls client strict, server default" \
1384 "$P_SRV debug_level=3" \
1385 "$G_CLI --priority=NORMAL:%SAFE_RENEGOTIATION" \
1386 0 \
1387 -s "received TLS_EMPTY_RENEGOTIATION_INFO\|found renegotiation extension" \
1388 -s "server hello, secure renegotiation extension"
1389
1390run_test "Renego ext: gnutls client unsafe, server default" \
1391 "$P_SRV debug_level=3" \
1392 "$G_CLI --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION" \
1393 0 \
1394 -S "received TLS_EMPTY_RENEGOTIATION_INFO\|found renegotiation extension" \
1395 -S "server hello, secure renegotiation extension"
1396
1397run_test "Renego ext: gnutls client unsafe, server break legacy" \
1398 "$P_SRV debug_level=3 allow_legacy=-1" \
1399 "$G_CLI --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION" \
1400 1 \
1401 -S "received TLS_EMPTY_RENEGOTIATION_INFO\|found renegotiation extension" \
1402 -S "server hello, secure renegotiation extension"
1403
Manuel Pégourié-Gonnard8520dac2014-02-21 12:12:23 +01001404# Tests for auth_mode
1405
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001406run_test "Authentication: server badcert, client required" \
Manuel Pégourié-Gonnard8520dac2014-02-21 12:12:23 +01001407 "$P_SRV crt_file=data_files/server5-badsign.crt \
1408 key_file=data_files/server5.key" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001409 "$P_CLI debug_level=1 auth_mode=required" \
Manuel Pégourié-Gonnard8520dac2014-02-21 12:12:23 +01001410 1 \
1411 -c "x509_verify_cert() returned" \
1412 -c "! self-signed or not signed by a trusted CA" \
1413 -c "! ssl_handshake returned" \
1414 -c "X509 - Certificate verification failed"
1415
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001416run_test "Authentication: server badcert, client optional" \
Manuel Pégourié-Gonnard8520dac2014-02-21 12:12:23 +01001417 "$P_SRV crt_file=data_files/server5-badsign.crt \
1418 key_file=data_files/server5.key" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001419 "$P_CLI debug_level=1 auth_mode=optional" \
Manuel Pégourié-Gonnard8520dac2014-02-21 12:12:23 +01001420 0 \
1421 -c "x509_verify_cert() returned" \
1422 -c "! self-signed or not signed by a trusted CA" \
1423 -C "! ssl_handshake returned" \
1424 -C "X509 - Certificate verification failed"
1425
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001426run_test "Authentication: server badcert, client none" \
Manuel Pégourié-Gonnardc1da6642014-02-25 14:18:30 +01001427 "$P_SRV crt_file=data_files/server5-badsign.crt \
Manuel Pégourié-Gonnard8520dac2014-02-21 12:12:23 +01001428 key_file=data_files/server5.key" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001429 "$P_CLI debug_level=1 auth_mode=none" \
Manuel Pégourié-Gonnard8520dac2014-02-21 12:12:23 +01001430 0 \
1431 -C "x509_verify_cert() returned" \
1432 -C "! self-signed or not signed by a trusted CA" \
1433 -C "! ssl_handshake returned" \
1434 -C "X509 - Certificate verification failed"
1435
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001436run_test "Authentication: client badcert, server required" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001437 "$P_SRV debug_level=3 auth_mode=required" \
1438 "$P_CLI debug_level=3 crt_file=data_files/server5-badsign.crt \
Manuel Pégourié-Gonnard8520dac2014-02-21 12:12:23 +01001439 key_file=data_files/server5.key" \
1440 1 \
1441 -S "skip write certificate request" \
1442 -C "skip parse certificate request" \
1443 -c "got a certificate request" \
1444 -C "skip write certificate" \
1445 -C "skip write certificate verify" \
1446 -S "skip parse certificate verify" \
1447 -s "x509_verify_cert() returned" \
1448 -S "! self-signed or not signed by a trusted CA" \
1449 -s "! ssl_handshake returned" \
1450 -c "! ssl_handshake returned" \
1451 -s "X509 - Certificate verification failed"
1452
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001453run_test "Authentication: client badcert, server optional" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001454 "$P_SRV debug_level=3 auth_mode=optional" \
1455 "$P_CLI debug_level=3 crt_file=data_files/server5-badsign.crt \
Manuel Pégourié-Gonnard8520dac2014-02-21 12:12:23 +01001456 key_file=data_files/server5.key" \
1457 0 \
1458 -S "skip write certificate request" \
1459 -C "skip parse certificate request" \
1460 -c "got a certificate request" \
1461 -C "skip write certificate" \
1462 -C "skip write certificate verify" \
1463 -S "skip parse certificate verify" \
1464 -s "x509_verify_cert() returned" \
1465 -s "! self-signed or not signed by a trusted CA" \
1466 -S "! ssl_handshake returned" \
1467 -C "! ssl_handshake returned" \
1468 -S "X509 - Certificate verification failed"
1469
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001470run_test "Authentication: client badcert, server none" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001471 "$P_SRV debug_level=3 auth_mode=none" \
1472 "$P_CLI debug_level=3 crt_file=data_files/server5-badsign.crt \
Manuel Pégourié-Gonnard8520dac2014-02-21 12:12:23 +01001473 key_file=data_files/server5.key" \
1474 0 \
1475 -s "skip write certificate request" \
1476 -C "skip parse certificate request" \
1477 -c "got no certificate request" \
1478 -c "skip write certificate" \
1479 -c "skip write certificate verify" \
1480 -s "skip parse certificate verify" \
1481 -S "x509_verify_cert() returned" \
1482 -S "! self-signed or not signed by a trusted CA" \
1483 -S "! ssl_handshake returned" \
1484 -C "! ssl_handshake returned" \
1485 -S "X509 - Certificate verification failed"
1486
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001487run_test "Authentication: client no cert, server optional" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001488 "$P_SRV debug_level=3 auth_mode=optional" \
1489 "$P_CLI debug_level=3 crt_file=none key_file=none" \
Manuel Pégourié-Gonnardde515cc2014-02-27 14:58:26 +01001490 0 \
1491 -S "skip write certificate request" \
1492 -C "skip parse certificate request" \
1493 -c "got a certificate request" \
1494 -C "skip write certificate$" \
1495 -C "got no certificate to send" \
1496 -S "SSLv3 client has no certificate" \
1497 -c "skip write certificate verify" \
1498 -s "skip parse certificate verify" \
1499 -s "! no client certificate sent" \
1500 -S "! ssl_handshake returned" \
1501 -C "! ssl_handshake returned" \
1502 -S "X509 - Certificate verification failed"
1503
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001504run_test "Authentication: openssl client no cert, server optional" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001505 "$P_SRV debug_level=3 auth_mode=optional" \
Manuel Pégourié-Gonnardde515cc2014-02-27 14:58:26 +01001506 "$O_CLI" \
1507 0 \
1508 -S "skip write certificate request" \
1509 -s "skip parse certificate verify" \
1510 -s "! no client certificate sent" \
1511 -S "! ssl_handshake returned" \
1512 -S "X509 - Certificate verification failed"
1513
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001514run_test "Authentication: client no cert, openssl server optional" \
Manuel Pégourié-Gonnardde515cc2014-02-27 14:58:26 +01001515 "$O_SRV -verify 10" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001516 "$P_CLI debug_level=3 crt_file=none key_file=none" \
Manuel Pégourié-Gonnardde515cc2014-02-27 14:58:26 +01001517 0 \
1518 -C "skip parse certificate request" \
1519 -c "got a certificate request" \
1520 -C "skip write certificate$" \
1521 -c "skip write certificate verify" \
1522 -C "! ssl_handshake returned"
1523
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001524run_test "Authentication: client no cert, ssl3" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001525 "$P_SRV debug_level=3 auth_mode=optional force_version=ssl3" \
1526 "$P_CLI debug_level=3 crt_file=none key_file=none" \
Manuel Pégourié-Gonnardde515cc2014-02-27 14:58:26 +01001527 0 \
1528 -S "skip write certificate request" \
1529 -C "skip parse certificate request" \
1530 -c "got a certificate request" \
1531 -C "skip write certificate$" \
1532 -c "skip write certificate verify" \
1533 -c "got no certificate to send" \
1534 -s "SSLv3 client has no certificate" \
1535 -s "skip parse certificate verify" \
1536 -s "! no client certificate sent" \
1537 -S "! ssl_handshake returned" \
1538 -C "! ssl_handshake returned" \
1539 -S "X509 - Certificate verification failed"
1540
Manuel Pégourié-Gonnard96ea2f22014-02-25 12:26:29 +01001541# tests for SNI
1542
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001543run_test "SNI: no SNI callback" \
Manuel Pégourié-Gonnard0eb6cab2014-07-23 20:17:47 +02001544 "$P_SRV debug_level=3 \
Manuel Pégourié-Gonnard96ea2f22014-02-25 12:26:29 +01001545 crt_file=data_files/server5.crt key_file=data_files/server5.key" \
Manuel Pégourié-Gonnard0eb6cab2014-07-23 20:17:47 +02001546 "$P_CLI server_name=localhost" \
Manuel Pégourié-Gonnard96ea2f22014-02-25 12:26:29 +01001547 0 \
1548 -S "parse ServerName extension" \
1549 -c "issuer name *: C=NL, O=PolarSSL, CN=Polarssl Test EC CA" \
1550 -c "subject name *: C=NL, O=PolarSSL, CN=localhost"
1551
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001552run_test "SNI: matching cert 1" \
Manuel Pégourié-Gonnard0eb6cab2014-07-23 20:17:47 +02001553 "$P_SRV debug_level=3 \
Manuel Pégourié-Gonnard96ea2f22014-02-25 12:26:29 +01001554 crt_file=data_files/server5.crt key_file=data_files/server5.key \
Manuel Pégourié-Gonnard76b8ab72014-03-26 09:31:35 +01001555 sni=localhost,data_files/server2.crt,data_files/server2.key,polarssl.example,data_files/server1-nospace.crt,data_files/server1.key" \
Manuel Pégourié-Gonnard0eb6cab2014-07-23 20:17:47 +02001556 "$P_CLI server_name=localhost" \
Manuel Pégourié-Gonnard96ea2f22014-02-25 12:26:29 +01001557 0 \
1558 -s "parse ServerName extension" \
1559 -c "issuer name *: C=NL, O=PolarSSL, CN=PolarSSL Test CA" \
1560 -c "subject name *: C=NL, O=PolarSSL, CN=localhost"
1561
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001562run_test "SNI: matching cert 2" \
Manuel Pégourié-Gonnard0eb6cab2014-07-23 20:17:47 +02001563 "$P_SRV debug_level=3 \
Manuel Pégourié-Gonnard96ea2f22014-02-25 12:26:29 +01001564 crt_file=data_files/server5.crt key_file=data_files/server5.key \
Manuel Pégourié-Gonnard76b8ab72014-03-26 09:31:35 +01001565 sni=localhost,data_files/server2.crt,data_files/server2.key,polarssl.example,data_files/server1-nospace.crt,data_files/server1.key" \
Manuel Pégourié-Gonnard0eb6cab2014-07-23 20:17:47 +02001566 "$P_CLI server_name=polarssl.example" \
Manuel Pégourié-Gonnard96ea2f22014-02-25 12:26:29 +01001567 0 \
1568 -s "parse ServerName extension" \
1569 -c "issuer name *: C=NL, O=PolarSSL, CN=PolarSSL Test CA" \
Manuel Pégourié-Gonnard76b8ab72014-03-26 09:31:35 +01001570 -c "subject name *: C=NL, O=PolarSSL, CN=polarssl.example"
Manuel Pégourié-Gonnard96ea2f22014-02-25 12:26:29 +01001571
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001572run_test "SNI: no matching cert" \
Manuel Pégourié-Gonnard0eb6cab2014-07-23 20:17:47 +02001573 "$P_SRV debug_level=3 \
Manuel Pégourié-Gonnard96ea2f22014-02-25 12:26:29 +01001574 crt_file=data_files/server5.crt key_file=data_files/server5.key \
Manuel Pégourié-Gonnard76b8ab72014-03-26 09:31:35 +01001575 sni=localhost,data_files/server2.crt,data_files/server2.key,polarssl.example,data_files/server1-nospace.crt,data_files/server1.key" \
Manuel Pégourié-Gonnard0eb6cab2014-07-23 20:17:47 +02001576 "$P_CLI server_name=nonesuch.example" \
Manuel Pégourié-Gonnard96ea2f22014-02-25 12:26:29 +01001577 1 \
1578 -s "parse ServerName extension" \
1579 -s "ssl_sni_wrapper() returned" \
1580 -s "ssl_handshake returned" \
1581 -c "ssl_handshake returned" \
1582 -c "SSL - A fatal alert message was received from our peer"
1583
Manuel Pégourié-Gonnard0b6609b2014-02-26 14:45:12 +01001584# Tests for non-blocking I/O: exercise a variety of handshake flows
1585
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001586run_test "Non-blocking I/O: basic handshake" \
Manuel Pégourié-Gonnard0b6609b2014-02-26 14:45:12 +01001587 "$P_SRV nbio=2 tickets=0 auth_mode=none" \
1588 "$P_CLI nbio=2 tickets=0" \
1589 0 \
1590 -S "ssl_handshake returned" \
1591 -C "ssl_handshake returned" \
1592 -c "Read from server: .* bytes read"
1593
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001594run_test "Non-blocking I/O: client auth" \
Manuel Pégourié-Gonnard0b6609b2014-02-26 14:45:12 +01001595 "$P_SRV nbio=2 tickets=0 auth_mode=required" \
1596 "$P_CLI nbio=2 tickets=0" \
1597 0 \
1598 -S "ssl_handshake returned" \
1599 -C "ssl_handshake returned" \
1600 -c "Read from server: .* bytes read"
1601
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001602run_test "Non-blocking I/O: ticket" \
Manuel Pégourié-Gonnard0b6609b2014-02-26 14:45:12 +01001603 "$P_SRV nbio=2 tickets=1 auth_mode=none" \
1604 "$P_CLI nbio=2 tickets=1" \
1605 0 \
1606 -S "ssl_handshake returned" \
1607 -C "ssl_handshake returned" \
1608 -c "Read from server: .* bytes read"
1609
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001610run_test "Non-blocking I/O: ticket + client auth" \
Manuel Pégourié-Gonnard0b6609b2014-02-26 14:45:12 +01001611 "$P_SRV nbio=2 tickets=1 auth_mode=required" \
1612 "$P_CLI nbio=2 tickets=1" \
1613 0 \
1614 -S "ssl_handshake returned" \
1615 -C "ssl_handshake returned" \
1616 -c "Read from server: .* bytes read"
1617
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001618run_test "Non-blocking I/O: ticket + client auth + resume" \
Manuel Pégourié-Gonnard0b6609b2014-02-26 14:45:12 +01001619 "$P_SRV nbio=2 tickets=1 auth_mode=required" \
1620 "$P_CLI nbio=2 tickets=1 reconnect=1" \
1621 0 \
1622 -S "ssl_handshake returned" \
1623 -C "ssl_handshake returned" \
1624 -c "Read from server: .* bytes read"
1625
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001626run_test "Non-blocking I/O: ticket + resume" \
Manuel Pégourié-Gonnard0b6609b2014-02-26 14:45:12 +01001627 "$P_SRV nbio=2 tickets=1 auth_mode=none" \
1628 "$P_CLI nbio=2 tickets=1 reconnect=1" \
1629 0 \
1630 -S "ssl_handshake returned" \
1631 -C "ssl_handshake returned" \
1632 -c "Read from server: .* bytes read"
1633
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001634run_test "Non-blocking I/O: session-id resume" \
Manuel Pégourié-Gonnard0b6609b2014-02-26 14:45:12 +01001635 "$P_SRV nbio=2 tickets=0 auth_mode=none" \
1636 "$P_CLI nbio=2 tickets=0 reconnect=1" \
1637 0 \
1638 -S "ssl_handshake returned" \
1639 -C "ssl_handshake returned" \
1640 -c "Read from server: .* bytes read"
1641
Manuel Pégourié-Gonnardf6521de2014-04-07 12:42:04 +02001642# Tests for version negotiation
1643
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001644run_test "Version check: all -> 1.2" \
Manuel Pégourié-Gonnarda3d808e2014-02-26 16:33:03 +01001645 "$P_SRV" \
1646 "$P_CLI" \
1647 0 \
1648 -S "ssl_handshake returned" \
1649 -C "ssl_handshake returned" \
1650 -s "Protocol is TLSv1.2" \
1651 -c "Protocol is TLSv1.2"
1652
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001653run_test "Version check: cli max 1.1 -> 1.1" \
Manuel Pégourié-Gonnarda3d808e2014-02-26 16:33:03 +01001654 "$P_SRV" \
1655 "$P_CLI max_version=tls1_1" \
1656 0 \
1657 -S "ssl_handshake returned" \
1658 -C "ssl_handshake returned" \
1659 -s "Protocol is TLSv1.1" \
1660 -c "Protocol is TLSv1.1"
1661
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001662run_test "Version check: srv max 1.1 -> 1.1" \
Manuel Pégourié-Gonnarda3d808e2014-02-26 16:33:03 +01001663 "$P_SRV max_version=tls1_1" \
1664 "$P_CLI" \
1665 0 \
1666 -S "ssl_handshake returned" \
1667 -C "ssl_handshake returned" \
1668 -s "Protocol is TLSv1.1" \
1669 -c "Protocol is TLSv1.1"
1670
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001671run_test "Version check: cli+srv max 1.1 -> 1.1" \
Manuel Pégourié-Gonnarda3d808e2014-02-26 16:33:03 +01001672 "$P_SRV max_version=tls1_1" \
1673 "$P_CLI max_version=tls1_1" \
1674 0 \
1675 -S "ssl_handshake returned" \
1676 -C "ssl_handshake returned" \
1677 -s "Protocol is TLSv1.1" \
1678 -c "Protocol is TLSv1.1"
1679
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001680run_test "Version check: cli max 1.1, srv min 1.1 -> 1.1" \
Manuel Pégourié-Gonnarda3d808e2014-02-26 16:33:03 +01001681 "$P_SRV min_version=tls1_1" \
1682 "$P_CLI max_version=tls1_1" \
1683 0 \
1684 -S "ssl_handshake returned" \
1685 -C "ssl_handshake returned" \
1686 -s "Protocol is TLSv1.1" \
1687 -c "Protocol is TLSv1.1"
1688
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001689run_test "Version check: cli min 1.1, srv max 1.1 -> 1.1" \
Manuel Pégourié-Gonnarda3d808e2014-02-26 16:33:03 +01001690 "$P_SRV max_version=tls1_1" \
1691 "$P_CLI min_version=tls1_1" \
1692 0 \
1693 -S "ssl_handshake returned" \
1694 -C "ssl_handshake returned" \
1695 -s "Protocol is TLSv1.1" \
1696 -c "Protocol is TLSv1.1"
1697
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001698run_test "Version check: cli min 1.2, srv max 1.1 -> fail" \
Manuel Pégourié-Gonnarda3d808e2014-02-26 16:33:03 +01001699 "$P_SRV max_version=tls1_1" \
1700 "$P_CLI min_version=tls1_2" \
1701 1 \
1702 -s "ssl_handshake returned" \
1703 -c "ssl_handshake returned" \
1704 -c "SSL - Handshake protocol not within min/max boundaries"
1705
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001706run_test "Version check: srv min 1.2, cli max 1.1 -> fail" \
Manuel Pégourié-Gonnarda3d808e2014-02-26 16:33:03 +01001707 "$P_SRV min_version=tls1_2" \
1708 "$P_CLI max_version=tls1_1" \
1709 1 \
1710 -s "ssl_handshake returned" \
1711 -c "ssl_handshake returned" \
1712 -s "SSL - Handshake protocol not within min/max boundaries"
1713
Manuel Pégourié-Gonnardf6521de2014-04-07 12:42:04 +02001714# Tests for ALPN extension
1715
Manuel Pégourié-Gonnard83d8c732014-04-07 13:24:21 +02001716if grep '^#define POLARSSL_SSL_ALPN' $CONFIG_H >/dev/null; then
1717
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001718run_test "ALPN: none" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001719 "$P_SRV debug_level=3" \
1720 "$P_CLI debug_level=3" \
Manuel Pégourié-Gonnardf6521de2014-04-07 12:42:04 +02001721 0 \
1722 -C "client hello, adding alpn extension" \
1723 -S "found alpn extension" \
1724 -C "got an alert message, type: \\[2:120]" \
1725 -S "server hello, adding alpn extension" \
1726 -C "found alpn extension " \
1727 -C "Application Layer Protocol is" \
1728 -S "Application Layer Protocol is"
1729
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001730run_test "ALPN: client only" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001731 "$P_SRV debug_level=3" \
1732 "$P_CLI debug_level=3 alpn=abc,1234" \
Manuel Pégourié-Gonnardf6521de2014-04-07 12:42:04 +02001733 0 \
1734 -c "client hello, adding alpn extension" \
1735 -s "found alpn extension" \
1736 -C "got an alert message, type: \\[2:120]" \
1737 -S "server hello, adding alpn extension" \
1738 -C "found alpn extension " \
1739 -c "Application Layer Protocol is (none)" \
1740 -S "Application Layer Protocol is"
1741
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001742run_test "ALPN: server only" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001743 "$P_SRV debug_level=3 alpn=abc,1234" \
1744 "$P_CLI debug_level=3" \
Manuel Pégourié-Gonnardf6521de2014-04-07 12:42:04 +02001745 0 \
1746 -C "client hello, adding alpn extension" \
1747 -S "found alpn extension" \
1748 -C "got an alert message, type: \\[2:120]" \
1749 -S "server hello, adding alpn extension" \
1750 -C "found alpn extension " \
1751 -C "Application Layer Protocol is" \
1752 -s "Application Layer Protocol is (none)"
1753
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001754run_test "ALPN: both, common cli1-srv1" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001755 "$P_SRV debug_level=3 alpn=abc,1234" \
1756 "$P_CLI debug_level=3 alpn=abc,1234" \
Manuel Pégourié-Gonnardf6521de2014-04-07 12:42:04 +02001757 0 \
1758 -c "client hello, adding alpn extension" \
1759 -s "found alpn extension" \
1760 -C "got an alert message, type: \\[2:120]" \
1761 -s "server hello, adding alpn extension" \
1762 -c "found alpn extension" \
1763 -c "Application Layer Protocol is abc" \
1764 -s "Application Layer Protocol is abc"
1765
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001766run_test "ALPN: both, common cli2-srv1" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001767 "$P_SRV debug_level=3 alpn=abc,1234" \
1768 "$P_CLI debug_level=3 alpn=1234,abc" \
Manuel Pégourié-Gonnardf6521de2014-04-07 12:42:04 +02001769 0 \
1770 -c "client hello, adding alpn extension" \
1771 -s "found alpn extension" \
1772 -C "got an alert message, type: \\[2:120]" \
1773 -s "server hello, adding alpn extension" \
1774 -c "found alpn extension" \
1775 -c "Application Layer Protocol is abc" \
1776 -s "Application Layer Protocol is abc"
1777
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001778run_test "ALPN: both, common cli1-srv2" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001779 "$P_SRV debug_level=3 alpn=abc,1234" \
1780 "$P_CLI debug_level=3 alpn=1234,abcde" \
Manuel Pégourié-Gonnardf6521de2014-04-07 12:42:04 +02001781 0 \
1782 -c "client hello, adding alpn extension" \
1783 -s "found alpn extension" \
1784 -C "got an alert message, type: \\[2:120]" \
1785 -s "server hello, adding alpn extension" \
1786 -c "found alpn extension" \
1787 -c "Application Layer Protocol is 1234" \
1788 -s "Application Layer Protocol is 1234"
1789
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001790run_test "ALPN: both, no common" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001791 "$P_SRV debug_level=3 alpn=abc,123" \
1792 "$P_CLI debug_level=3 alpn=1234,abcde" \
Manuel Pégourié-Gonnardf6521de2014-04-07 12:42:04 +02001793 1 \
1794 -c "client hello, adding alpn extension" \
1795 -s "found alpn extension" \
1796 -c "got an alert message, type: \\[2:120]" \
1797 -S "server hello, adding alpn extension" \
1798 -C "found alpn extension" \
1799 -C "Application Layer Protocol is 1234" \
1800 -S "Application Layer Protocol is 1234"
1801
Manuel Pégourié-Gonnard83d8c732014-04-07 13:24:21 +02001802fi
1803
Manuel Pégourié-Gonnard7f2a07d2014-04-09 09:50:57 +02001804# Tests for keyUsage in leaf certificates, part 1:
1805# server-side certificate/suite selection
1806
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001807run_test "keyUsage srv: RSA, digitalSignature -> (EC)DHE-RSA" \
Manuel Pégourié-Gonnard7f2a07d2014-04-09 09:50:57 +02001808 "$P_SRV key_file=data_files/server2.key \
1809 crt_file=data_files/server2.ku-ds.crt" \
1810 "$P_CLI" \
1811 0 \
Manuel Pégourié-Gonnard17cde5f2014-05-22 14:42:39 +02001812 -c "Ciphersuite is TLS-[EC]*DHE-RSA-WITH-"
Manuel Pégourié-Gonnard7f2a07d2014-04-09 09:50:57 +02001813
1814
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001815run_test "keyUsage srv: RSA, keyEncipherment -> RSA" \
Manuel Pégourié-Gonnard7f2a07d2014-04-09 09:50:57 +02001816 "$P_SRV key_file=data_files/server2.key \
1817 crt_file=data_files/server2.ku-ke.crt" \
1818 "$P_CLI" \
1819 0 \
1820 -c "Ciphersuite is TLS-RSA-WITH-"
1821
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001822run_test "keyUsage srv: RSA, keyAgreement -> fail" \
Manuel Pégourié-Gonnardf2629b92014-08-30 14:20:14 +02001823 "$P_SRV key_file=data_files/server2.key \
Manuel Pégourié-Gonnard7f2a07d2014-04-09 09:50:57 +02001824 crt_file=data_files/server2.ku-ka.crt" \
Manuel Pégourié-Gonnardf2629b92014-08-30 14:20:14 +02001825 "$P_CLI" \
Manuel Pégourié-Gonnard7f2a07d2014-04-09 09:50:57 +02001826 1 \
1827 -C "Ciphersuite is "
1828
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001829run_test "keyUsage srv: ECDSA, digitalSignature -> ECDHE-ECDSA" \
Manuel Pégourié-Gonnard7f2a07d2014-04-09 09:50:57 +02001830 "$P_SRV key_file=data_files/server5.key \
1831 crt_file=data_files/server5.ku-ds.crt" \
1832 "$P_CLI" \
1833 0 \
1834 -c "Ciphersuite is TLS-ECDHE-ECDSA-WITH-"
1835
1836
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001837run_test "keyUsage srv: ECDSA, keyAgreement -> ECDH-" \
Manuel Pégourié-Gonnard7f2a07d2014-04-09 09:50:57 +02001838 "$P_SRV key_file=data_files/server5.key \
1839 crt_file=data_files/server5.ku-ka.crt" \
1840 "$P_CLI" \
1841 0 \
1842 -c "Ciphersuite is TLS-ECDH-"
1843
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001844run_test "keyUsage srv: ECDSA, keyEncipherment -> fail" \
Manuel Pégourié-Gonnardf2629b92014-08-30 14:20:14 +02001845 "$P_SRV key_file=data_files/server5.key \
Manuel Pégourié-Gonnard7f2a07d2014-04-09 09:50:57 +02001846 crt_file=data_files/server5.ku-ke.crt" \
Manuel Pégourié-Gonnardf2629b92014-08-30 14:20:14 +02001847 "$P_CLI" \
Manuel Pégourié-Gonnard7f2a07d2014-04-09 09:50:57 +02001848 1 \
1849 -C "Ciphersuite is "
1850
1851# Tests for keyUsage in leaf certificates, part 2:
Manuel Pégourié-Gonnarda9db85d2014-04-09 14:53:05 +02001852# client-side checking of server cert
Manuel Pégourié-Gonnard7f2a07d2014-04-09 09:50:57 +02001853
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001854run_test "keyUsage cli: DigitalSignature+KeyEncipherment, RSA: OK" \
Manuel Pégourié-Gonnard7f2a07d2014-04-09 09:50:57 +02001855 "$O_SRV -key data_files/server2.key \
1856 -cert data_files/server2.ku-ds_ke.crt" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001857 "$P_CLI debug_level=1 \
Manuel Pégourié-Gonnard7f2a07d2014-04-09 09:50:57 +02001858 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
1859 0 \
Manuel Pégourié-Gonnarda9db85d2014-04-09 14:53:05 +02001860 -C "bad certificate (usage extensions)" \
Manuel Pégourié-Gonnard7f2a07d2014-04-09 09:50:57 +02001861 -C "Processing of the Certificate handshake message failed" \
1862 -c "Ciphersuite is TLS-"
1863
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001864run_test "keyUsage cli: DigitalSignature+KeyEncipherment, DHE-RSA: OK" \
Manuel Pégourié-Gonnard7f2a07d2014-04-09 09:50:57 +02001865 "$O_SRV -key data_files/server2.key \
1866 -cert data_files/server2.ku-ds_ke.crt" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001867 "$P_CLI debug_level=1 \
Manuel Pégourié-Gonnard7f2a07d2014-04-09 09:50:57 +02001868 force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA" \
1869 0 \
Manuel Pégourié-Gonnarda9db85d2014-04-09 14:53:05 +02001870 -C "bad certificate (usage extensions)" \
Manuel Pégourié-Gonnard7f2a07d2014-04-09 09:50:57 +02001871 -C "Processing of the Certificate handshake message failed" \
1872 -c "Ciphersuite is TLS-"
1873
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001874run_test "keyUsage cli: KeyEncipherment, RSA: OK" \
Manuel Pégourié-Gonnard7f2a07d2014-04-09 09:50:57 +02001875 "$O_SRV -key data_files/server2.key \
1876 -cert data_files/server2.ku-ke.crt" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001877 "$P_CLI debug_level=1 \
Manuel Pégourié-Gonnard7f2a07d2014-04-09 09:50:57 +02001878 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
1879 0 \
Manuel Pégourié-Gonnarda9db85d2014-04-09 14:53:05 +02001880 -C "bad certificate (usage extensions)" \
Manuel Pégourié-Gonnard7f2a07d2014-04-09 09:50:57 +02001881 -C "Processing of the Certificate handshake message failed" \
1882 -c "Ciphersuite is TLS-"
1883
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001884run_test "keyUsage cli: KeyEncipherment, DHE-RSA: fail" \
Manuel Pégourié-Gonnard7f2a07d2014-04-09 09:50:57 +02001885 "$O_SRV -key data_files/server2.key \
1886 -cert data_files/server2.ku-ke.crt" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001887 "$P_CLI debug_level=1 \
Manuel Pégourié-Gonnard7f2a07d2014-04-09 09:50:57 +02001888 force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA" \
1889 1 \
Manuel Pégourié-Gonnarda9db85d2014-04-09 14:53:05 +02001890 -c "bad certificate (usage extensions)" \
Manuel Pégourié-Gonnard7f2a07d2014-04-09 09:50:57 +02001891 -c "Processing of the Certificate handshake message failed" \
1892 -C "Ciphersuite is TLS-"
1893
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001894run_test "keyUsage cli: DigitalSignature, DHE-RSA: OK" \
Manuel Pégourié-Gonnard7f2a07d2014-04-09 09:50:57 +02001895 "$O_SRV -key data_files/server2.key \
1896 -cert data_files/server2.ku-ds.crt" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001897 "$P_CLI debug_level=1 \
Manuel Pégourié-Gonnard7f2a07d2014-04-09 09:50:57 +02001898 force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA" \
1899 0 \
Manuel Pégourié-Gonnarda9db85d2014-04-09 14:53:05 +02001900 -C "bad certificate (usage extensions)" \
Manuel Pégourié-Gonnard7f2a07d2014-04-09 09:50:57 +02001901 -C "Processing of the Certificate handshake message failed" \
1902 -c "Ciphersuite is TLS-"
1903
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001904run_test "keyUsage cli: DigitalSignature, RSA: fail" \
Manuel Pégourié-Gonnard7f2a07d2014-04-09 09:50:57 +02001905 "$O_SRV -key data_files/server2.key \
1906 -cert data_files/server2.ku-ds.crt" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001907 "$P_CLI debug_level=1 \
Manuel Pégourié-Gonnard7f2a07d2014-04-09 09:50:57 +02001908 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
1909 1 \
Manuel Pégourié-Gonnarda9db85d2014-04-09 14:53:05 +02001910 -c "bad certificate (usage extensions)" \
Manuel Pégourié-Gonnard7f2a07d2014-04-09 09:50:57 +02001911 -c "Processing of the Certificate handshake message failed" \
1912 -C "Ciphersuite is TLS-"
1913
Manuel Pégourié-Gonnarda9db85d2014-04-09 14:53:05 +02001914# Tests for keyUsage in leaf certificates, part 3:
1915# server-side checking of client cert
1916
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001917run_test "keyUsage cli-auth: RSA, DigitalSignature: OK" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001918 "$P_SRV debug_level=1 auth_mode=optional" \
Manuel Pégourié-Gonnarda9db85d2014-04-09 14:53:05 +02001919 "$O_CLI -key data_files/server2.key \
1920 -cert data_files/server2.ku-ds.crt" \
1921 0 \
1922 -S "bad certificate (usage extensions)" \
1923 -S "Processing of the Certificate handshake message failed"
1924
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001925run_test "keyUsage cli-auth: RSA, KeyEncipherment: fail (soft)" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001926 "$P_SRV debug_level=1 auth_mode=optional" \
Manuel Pégourié-Gonnarda9db85d2014-04-09 14:53:05 +02001927 "$O_CLI -key data_files/server2.key \
1928 -cert data_files/server2.ku-ke.crt" \
1929 0 \
1930 -s "bad certificate (usage extensions)" \
1931 -S "Processing of the Certificate handshake message failed"
1932
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001933run_test "keyUsage cli-auth: RSA, KeyEncipherment: fail (hard)" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001934 "$P_SRV debug_level=1 auth_mode=required" \
Manuel Pégourié-Gonnarda9db85d2014-04-09 14:53:05 +02001935 "$O_CLI -key data_files/server2.key \
1936 -cert data_files/server2.ku-ke.crt" \
1937 1 \
1938 -s "bad certificate (usage extensions)" \
1939 -s "Processing of the Certificate handshake message failed"
1940
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001941run_test "keyUsage cli-auth: ECDSA, DigitalSignature: OK" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001942 "$P_SRV debug_level=1 auth_mode=optional" \
Manuel Pégourié-Gonnarda9db85d2014-04-09 14:53:05 +02001943 "$O_CLI -key data_files/server5.key \
1944 -cert data_files/server5.ku-ds.crt" \
1945 0 \
1946 -S "bad certificate (usage extensions)" \
1947 -S "Processing of the Certificate handshake message failed"
1948
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001949run_test "keyUsage cli-auth: ECDSA, KeyAgreement: fail (soft)" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001950 "$P_SRV debug_level=1 auth_mode=optional" \
Manuel Pégourié-Gonnarda9db85d2014-04-09 14:53:05 +02001951 "$O_CLI -key data_files/server5.key \
1952 -cert data_files/server5.ku-ka.crt" \
1953 0 \
1954 -s "bad certificate (usage extensions)" \
1955 -S "Processing of the Certificate handshake message failed"
1956
Manuel Pégourié-Gonnard0408fd12014-04-11 11:06:22 +02001957# Tests for extendedKeyUsage, part 1: server-side certificate/suite selection
1958
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001959run_test "extKeyUsage srv: serverAuth -> OK" \
Manuel Pégourié-Gonnard0408fd12014-04-11 11:06:22 +02001960 "$P_SRV key_file=data_files/server5.key \
1961 crt_file=data_files/server5.eku-srv.crt" \
1962 "$P_CLI" \
1963 0
1964
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001965run_test "extKeyUsage srv: serverAuth,clientAuth -> OK" \
Manuel Pégourié-Gonnard0408fd12014-04-11 11:06:22 +02001966 "$P_SRV key_file=data_files/server5.key \
1967 crt_file=data_files/server5.eku-srv.crt" \
1968 "$P_CLI" \
1969 0
1970
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001971run_test "extKeyUsage srv: codeSign,anyEKU -> OK" \
Manuel Pégourié-Gonnard0408fd12014-04-11 11:06:22 +02001972 "$P_SRV key_file=data_files/server5.key \
1973 crt_file=data_files/server5.eku-cs_any.crt" \
1974 "$P_CLI" \
1975 0
1976
1977# add psk to leave an option for client to send SERVERQUIT
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001978run_test "extKeyUsage srv: codeSign -> fail" \
Manuel Pégourié-Gonnard0408fd12014-04-11 11:06:22 +02001979 "$P_SRV psk=abc123 key_file=data_files/server5.key \
1980 crt_file=data_files/server5.eku-cli.crt" \
1981 "$P_CLI psk=badbad" \
1982 1
1983
1984# Tests for extendedKeyUsage, part 2: client-side checking of server cert
1985
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001986run_test "extKeyUsage cli: serverAuth -> OK" \
Manuel Pégourié-Gonnard0408fd12014-04-11 11:06:22 +02001987 "$O_SRV -key data_files/server5.key \
1988 -cert data_files/server5.eku-srv.crt" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001989 "$P_CLI debug_level=1" \
Manuel Pégourié-Gonnard0408fd12014-04-11 11:06:22 +02001990 0 \
1991 -C "bad certificate (usage extensions)" \
1992 -C "Processing of the Certificate handshake message failed" \
1993 -c "Ciphersuite is TLS-"
1994
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02001995run_test "extKeyUsage cli: serverAuth,clientAuth -> OK" \
Manuel Pégourié-Gonnard0408fd12014-04-11 11:06:22 +02001996 "$O_SRV -key data_files/server5.key \
1997 -cert data_files/server5.eku-srv_cli.crt" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02001998 "$P_CLI debug_level=1" \
Manuel Pégourié-Gonnard0408fd12014-04-11 11:06:22 +02001999 0 \
2000 -C "bad certificate (usage extensions)" \
2001 -C "Processing of the Certificate handshake message failed" \
2002 -c "Ciphersuite is TLS-"
2003
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02002004run_test "extKeyUsage cli: codeSign,anyEKU -> OK" \
Manuel Pégourié-Gonnard0408fd12014-04-11 11:06:22 +02002005 "$O_SRV -key data_files/server5.key \
2006 -cert data_files/server5.eku-cs_any.crt" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02002007 "$P_CLI debug_level=1" \
Manuel Pégourié-Gonnard0408fd12014-04-11 11:06:22 +02002008 0 \
2009 -C "bad certificate (usage extensions)" \
2010 -C "Processing of the Certificate handshake message failed" \
2011 -c "Ciphersuite is TLS-"
2012
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02002013run_test "extKeyUsage cli: codeSign -> fail" \
Manuel Pégourié-Gonnard0408fd12014-04-11 11:06:22 +02002014 "$O_SRV -key data_files/server5.key \
2015 -cert data_files/server5.eku-cs.crt" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02002016 "$P_CLI debug_level=1" \
Manuel Pégourié-Gonnard0408fd12014-04-11 11:06:22 +02002017 1 \
2018 -c "bad certificate (usage extensions)" \
2019 -c "Processing of the Certificate handshake message failed" \
2020 -C "Ciphersuite is TLS-"
2021
2022# Tests for extendedKeyUsage, part 3: server-side checking of client cert
2023
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02002024run_test "extKeyUsage cli-auth: clientAuth -> OK" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02002025 "$P_SRV debug_level=1 auth_mode=optional" \
Manuel Pégourié-Gonnard0408fd12014-04-11 11:06:22 +02002026 "$O_CLI -key data_files/server5.key \
2027 -cert data_files/server5.eku-cli.crt" \
2028 0 \
2029 -S "bad certificate (usage extensions)" \
2030 -S "Processing of the Certificate handshake message failed"
2031
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02002032run_test "extKeyUsage cli-auth: serverAuth,clientAuth -> OK" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02002033 "$P_SRV debug_level=1 auth_mode=optional" \
Manuel Pégourié-Gonnard0408fd12014-04-11 11:06:22 +02002034 "$O_CLI -key data_files/server5.key \
2035 -cert data_files/server5.eku-srv_cli.crt" \
2036 0 \
2037 -S "bad certificate (usage extensions)" \
2038 -S "Processing of the Certificate handshake message failed"
2039
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02002040run_test "extKeyUsage cli-auth: codeSign,anyEKU -> OK" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02002041 "$P_SRV debug_level=1 auth_mode=optional" \
Manuel Pégourié-Gonnard0408fd12014-04-11 11:06:22 +02002042 "$O_CLI -key data_files/server5.key \
2043 -cert data_files/server5.eku-cs_any.crt" \
2044 0 \
2045 -S "bad certificate (usage extensions)" \
2046 -S "Processing of the Certificate handshake message failed"
2047
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02002048run_test "extKeyUsage cli-auth: codeSign -> fail (soft)" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02002049 "$P_SRV debug_level=1 auth_mode=optional" \
Manuel Pégourié-Gonnard0408fd12014-04-11 11:06:22 +02002050 "$O_CLI -key data_files/server5.key \
2051 -cert data_files/server5.eku-cs.crt" \
2052 0 \
2053 -s "bad certificate (usage extensions)" \
2054 -S "Processing of the Certificate handshake message failed"
2055
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02002056run_test "extKeyUsage cli-auth: codeSign -> fail (hard)" \
Manuel Pégourié-Gonnard644e8f32014-08-30 21:59:31 +02002057 "$P_SRV debug_level=1 auth_mode=required" \
Manuel Pégourié-Gonnard0408fd12014-04-11 11:06:22 +02002058 "$O_CLI -key data_files/server5.key \
2059 -cert data_files/server5.eku-cs.crt" \
2060 1 \
2061 -s "bad certificate (usage extensions)" \
2062 -s "Processing of the Certificate handshake message failed"
2063
Manuel Pégourié-Gonnard0cc7e312014-06-09 11:36:47 +02002064# Tests for DHM parameters loading
2065
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02002066run_test "DHM parameters: reference" \
Manuel Pégourié-Gonnard0cc7e312014-06-09 11:36:47 +02002067 "$P_SRV" \
2068 "$P_CLI force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA \
2069 debug_level=3" \
2070 0 \
2071 -c "value of 'DHM: P ' (2048 bits)" \
2072 -c "value of 'DHM: G ' (2048 bits)"
2073
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02002074run_test "DHM parameters: other parameters" \
Manuel Pégourié-Gonnard0cc7e312014-06-09 11:36:47 +02002075 "$P_SRV dhm_file=data_files/dhparams.pem" \
2076 "$P_CLI force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA \
2077 debug_level=3" \
2078 0 \
2079 -c "value of 'DHM: P ' (1024 bits)" \
2080 -c "value of 'DHM: G ' (2 bits)"
2081
Manuel Pégourié-Gonnarda6781c92014-06-10 15:00:46 +02002082# Tests for PSK callback
2083
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02002084run_test "PSK callback: psk, no callback" \
Manuel Pégourié-Gonnarda6781c92014-06-10 15:00:46 +02002085 "$P_SRV psk=abc123 psk_identity=foo" \
2086 "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \
2087 psk_identity=foo psk=abc123" \
2088 0 \
Manuel Pégourié-Gonnard10c3c9f2014-06-10 15:28:52 +02002089 -S "SSL - The server has no ciphersuites in common" \
2090 -S "SSL - Unknown identity received" \
2091 -S "SSL - Verification of the message MAC failed"
2092
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02002093run_test "PSK callback: no psk, no callback" \
Manuel Pégourié-Gonnard10c3c9f2014-06-10 15:28:52 +02002094 "$P_SRV" \
2095 "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \
2096 psk_identity=foo psk=abc123" \
2097 1 \
2098 -s "SSL - The server has no ciphersuites in common" \
Manuel Pégourié-Gonnarda6781c92014-06-10 15:00:46 +02002099 -S "SSL - Unknown identity received" \
2100 -S "SSL - Verification of the message MAC failed"
2101
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02002102run_test "PSK callback: callback overrides other settings" \
Manuel Pégourié-Gonnarda6781c92014-06-10 15:00:46 +02002103 "$P_SRV psk=abc123 psk_identity=foo psk_list=abc,dead,def,beef" \
2104 "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \
2105 psk_identity=foo psk=abc123" \
2106 1 \
Manuel Pégourié-Gonnard10c3c9f2014-06-10 15:28:52 +02002107 -S "SSL - The server has no ciphersuites in common" \
Manuel Pégourié-Gonnarda6781c92014-06-10 15:00:46 +02002108 -s "SSL - Unknown identity received" \
2109 -S "SSL - Verification of the message MAC failed"
2110
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02002111run_test "PSK callback: first id matches" \
Manuel Pégourié-Gonnarda6781c92014-06-10 15:00:46 +02002112 "$P_SRV psk_list=abc,dead,def,beef" \
2113 "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \
2114 psk_identity=abc psk=dead" \
2115 0 \
Manuel Pégourié-Gonnard10c3c9f2014-06-10 15:28:52 +02002116 -S "SSL - The server has no ciphersuites in common" \
Manuel Pégourié-Gonnarda6781c92014-06-10 15:00:46 +02002117 -S "SSL - Unknown identity received" \
2118 -S "SSL - Verification of the message MAC failed"
2119
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02002120run_test "PSK callback: second id matches" \
Manuel Pégourié-Gonnarda6781c92014-06-10 15:00:46 +02002121 "$P_SRV psk_list=abc,dead,def,beef" \
2122 "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \
2123 psk_identity=def psk=beef" \
2124 0 \
Manuel Pégourié-Gonnard10c3c9f2014-06-10 15:28:52 +02002125 -S "SSL - The server has no ciphersuites in common" \
Manuel Pégourié-Gonnarda6781c92014-06-10 15:00:46 +02002126 -S "SSL - Unknown identity received" \
2127 -S "SSL - Verification of the message MAC failed"
2128
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02002129run_test "PSK callback: no match" \
Manuel Pégourié-Gonnarda6781c92014-06-10 15:00:46 +02002130 "$P_SRV psk_list=abc,dead,def,beef" \
2131 "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \
2132 psk_identity=ghi psk=beef" \
2133 1 \
Manuel Pégourié-Gonnard10c3c9f2014-06-10 15:28:52 +02002134 -S "SSL - The server has no ciphersuites in common" \
Manuel Pégourié-Gonnarda6781c92014-06-10 15:00:46 +02002135 -s "SSL - Unknown identity received" \
2136 -S "SSL - Verification of the message MAC failed"
2137
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02002138run_test "PSK callback: wrong key" \
Manuel Pégourié-Gonnarda6781c92014-06-10 15:00:46 +02002139 "$P_SRV psk_list=abc,dead,def,beef" \
2140 "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \
2141 psk_identity=abc psk=beef" \
2142 1 \
Manuel Pégourié-Gonnard10c3c9f2014-06-10 15:28:52 +02002143 -S "SSL - The server has no ciphersuites in common" \
Manuel Pégourié-Gonnarda6781c92014-06-10 15:00:46 +02002144 -S "SSL - Unknown identity received" \
2145 -s "SSL - Verification of the message MAC failed"
Manuel Pégourié-Gonnard0cc7e312014-06-09 11:36:47 +02002146
Manuel Pégourié-Gonnard90805a82014-06-11 14:06:01 +02002147# Tests for ciphersuites per version
2148
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02002149run_test "Per-version suites: SSL3" \
Manuel Pégourié-Gonnard90805a82014-06-11 14:06:01 +02002150 "$P_SRV version_suites=TLS-RSA-WITH-3DES-EDE-CBC-SHA,TLS-RSA-WITH-RC4-128-SHA,TLS-RSA-WITH-AES-128-CBC-SHA,TLS-RSA-WITH-AES-128-GCM-SHA256" \
2151 "$P_CLI force_version=ssl3" \
2152 0 \
2153 -c "Ciphersuite is TLS-RSA-WITH-3DES-EDE-CBC-SHA"
2154
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02002155run_test "Per-version suites: TLS 1.0" \
Manuel Pégourié-Gonnard90805a82014-06-11 14:06:01 +02002156 "$P_SRV version_suites=TLS-RSA-WITH-3DES-EDE-CBC-SHA,TLS-RSA-WITH-RC4-128-SHA,TLS-RSA-WITH-AES-128-CBC-SHA,TLS-RSA-WITH-AES-128-GCM-SHA256" \
2157 "$P_CLI force_version=tls1" \
2158 0 \
2159 -c "Ciphersuite is TLS-RSA-WITH-RC4-128-SHA"
2160
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02002161run_test "Per-version suites: TLS 1.1" \
Manuel Pégourié-Gonnard90805a82014-06-11 14:06:01 +02002162 "$P_SRV version_suites=TLS-RSA-WITH-3DES-EDE-CBC-SHA,TLS-RSA-WITH-RC4-128-SHA,TLS-RSA-WITH-AES-128-CBC-SHA,TLS-RSA-WITH-AES-128-GCM-SHA256" \
2163 "$P_CLI force_version=tls1_1" \
2164 0 \
2165 -c "Ciphersuite is TLS-RSA-WITH-AES-128-CBC-SHA"
2166
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02002167run_test "Per-version suites: TLS 1.2" \
Manuel Pégourié-Gonnard90805a82014-06-11 14:06:01 +02002168 "$P_SRV version_suites=TLS-RSA-WITH-3DES-EDE-CBC-SHA,TLS-RSA-WITH-RC4-128-SHA,TLS-RSA-WITH-AES-128-CBC-SHA,TLS-RSA-WITH-AES-128-GCM-SHA256" \
2169 "$P_CLI force_version=tls1_2" \
2170 0 \
2171 -c "Ciphersuite is TLS-RSA-WITH-AES-128-GCM-SHA256"
2172
Manuel Pégourié-Gonnard95c0a632014-06-11 18:32:36 +02002173# Tests for ssl_get_bytes_avail()
2174
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02002175run_test "ssl_get_bytes_avail: no extra data" \
Manuel Pégourié-Gonnard95c0a632014-06-11 18:32:36 +02002176 "$P_SRV" \
2177 "$P_CLI request_size=100" \
2178 0 \
2179 -s "Read from client: 100 bytes read$"
2180
Manuel Pégourié-Gonnard8e03c712014-08-30 21:42:40 +02002181run_test "ssl_get_bytes_avail: extra data" \
Manuel Pégourié-Gonnard95c0a632014-06-11 18:32:36 +02002182 "$P_SRV" \
2183 "$P_CLI request_size=500" \
2184 0 \
2185 -s "Read from client: 500 bytes read (.*+.*)"
Manuel Pégourié-Gonnard90805a82014-06-11 14:06:01 +02002186
Manuel Pégourié-Gonnardee415032014-06-18 15:08:56 +02002187# Tests for small packets
2188
2189run_test "Small packet SSLv3 BlockCipher" \
2190 "$P_SRV" \
2191 "$P_CLI request_size=1 force_version=ssl3 \
2192 force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
2193 0 \
2194 -s "Read from client: 1 bytes read"
2195
2196run_test "Small packet SSLv3 StreamCipher" \
2197 "$P_SRV" \
2198 "$P_CLI request_size=1 force_version=ssl3 \
2199 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
2200 0 \
2201 -s "Read from client: 1 bytes read"
2202
2203run_test "Small packet TLS 1.0 BlockCipher" \
2204 "$P_SRV" \
2205 "$P_CLI request_size=1 force_version=tls1 \
2206 force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
2207 0 \
2208 -s "Read from client: 1 bytes read"
2209
Manuel Pégourié-Gonnard169dd6a2014-11-04 16:15:39 +01002210run_test "Small packet TLS 1.0 BlockCipher without EtM" \
2211 "$P_SRV" \
2212 "$P_CLI request_size=1 force_version=tls1 etm=0 \
2213 force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
2214 0 \
2215 -s "Read from client: 1 bytes read"
2216
Manuel Pégourié-Gonnardee415032014-06-18 15:08:56 +02002217run_test "Small packet TLS 1.0 BlockCipher truncated MAC" \
2218 "$P_SRV" \
2219 "$P_CLI request_size=1 force_version=tls1 \
2220 force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA \
2221 trunc_hmac=1" \
2222 0 \
2223 -s "Read from client: 1 bytes read"
2224
2225run_test "Small packet TLS 1.0 StreamCipher truncated MAC" \
2226 "$P_SRV" \
2227 "$P_CLI request_size=1 force_version=tls1 \
2228 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \
2229 trunc_hmac=1" \
2230 0 \
2231 -s "Read from client: 1 bytes read"
2232
2233run_test "Small packet TLS 1.1 BlockCipher" \
2234 "$P_SRV" \
2235 "$P_CLI request_size=1 force_version=tls1_1 \
2236 force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
2237 0 \
2238 -s "Read from client: 1 bytes read"
2239
Manuel Pégourié-Gonnard169dd6a2014-11-04 16:15:39 +01002240run_test "Small packet TLS 1.1 BlockCipher without EtM" \
2241 "$P_SRV" \
2242 "$P_CLI request_size=1 force_version=tls1_1 etm=0 \
2243 force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
2244 0 \
2245 -s "Read from client: 1 bytes read"
2246
Manuel Pégourié-Gonnardee415032014-06-18 15:08:56 +02002247run_test "Small packet TLS 1.1 StreamCipher" \
2248 "$P_SRV" \
2249 "$P_CLI request_size=1 force_version=tls1_1 \
2250 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
2251 0 \
2252 -s "Read from client: 1 bytes read"
2253
2254run_test "Small packet TLS 1.1 BlockCipher truncated MAC" \
2255 "$P_SRV" \
2256 "$P_CLI request_size=1 force_version=tls1_1 \
2257 force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA \
2258 trunc_hmac=1" \
2259 0 \
2260 -s "Read from client: 1 bytes read"
2261
2262run_test "Small packet TLS 1.1 StreamCipher truncated MAC" \
2263 "$P_SRV" \
2264 "$P_CLI request_size=1 force_version=tls1_1 \
2265 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \
2266 trunc_hmac=1" \
2267 0 \
2268 -s "Read from client: 1 bytes read"
2269
2270run_test "Small packet TLS 1.2 BlockCipher" \
2271 "$P_SRV" \
2272 "$P_CLI request_size=1 force_version=tls1_2 \
2273 force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
2274 0 \
2275 -s "Read from client: 1 bytes read"
2276
Manuel Pégourié-Gonnard169dd6a2014-11-04 16:15:39 +01002277run_test "Small packet TLS 1.2 BlockCipher without EtM" \
2278 "$P_SRV" \
2279 "$P_CLI request_size=1 force_version=tls1_2 etm=0 \
2280 force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
2281 0 \
2282 -s "Read from client: 1 bytes read"
2283
Manuel Pégourié-Gonnardee415032014-06-18 15:08:56 +02002284run_test "Small packet TLS 1.2 BlockCipher larger MAC" \
2285 "$P_SRV" \
2286 "$P_CLI request_size=1 force_version=tls1_2 force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384" \
2287 0 \
2288 -s "Read from client: 1 bytes read"
2289
2290run_test "Small packet TLS 1.2 BlockCipher truncated MAC" \
2291 "$P_SRV" \
2292 "$P_CLI request_size=1 force_version=tls1_2 \
2293 force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA \
2294 trunc_hmac=1" \
2295 0 \
2296 -s "Read from client: 1 bytes read"
2297
2298run_test "Small packet TLS 1.2 StreamCipher" \
2299 "$P_SRV" \
2300 "$P_CLI request_size=1 force_version=tls1_2 \
2301 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
2302 0 \
2303 -s "Read from client: 1 bytes read"
2304
2305run_test "Small packet TLS 1.2 StreamCipher truncated MAC" \
2306 "$P_SRV" \
2307 "$P_CLI request_size=1 force_version=tls1_2 \
2308 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \
2309 trunc_hmac=1" \
2310 0 \
2311 -s "Read from client: 1 bytes read"
2312
2313run_test "Small packet TLS 1.2 AEAD" \
2314 "$P_SRV" \
2315 "$P_CLI request_size=1 force_version=tls1_2 \
2316 force_ciphersuite=TLS-RSA-WITH-AES-256-CCM" \
2317 0 \
2318 -s "Read from client: 1 bytes read"
2319
2320run_test "Small packet TLS 1.2 AEAD shorter tag" \
2321 "$P_SRV" \
2322 "$P_CLI request_size=1 force_version=tls1_2 \
2323 force_ciphersuite=TLS-RSA-WITH-AES-256-CCM-8" \
2324 0 \
2325 -s "Read from client: 1 bytes read"
2326
Manuel Pégourié-Gonnard8920f692014-06-18 22:05:08 +02002327# Test for large packets
2328
2329run_test "Large packet SSLv3 BlockCipher" \
2330 "$P_SRV" \
2331 "$P_CLI request_size=16384 force_version=ssl3 \
2332 force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
2333 0 \
2334 -s "Read from client: 16384 bytes read"
2335
2336run_test "Large packet SSLv3 StreamCipher" \
2337 "$P_SRV" \
2338 "$P_CLI request_size=16384 force_version=ssl3 \
2339 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
2340 0 \
2341 -s "Read from client: 16384 bytes read"
2342
2343run_test "Large packet TLS 1.0 BlockCipher" \
2344 "$P_SRV" \
2345 "$P_CLI request_size=16384 force_version=tls1 \
2346 force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
2347 0 \
2348 -s "Read from client: 16384 bytes read"
2349
2350run_test "Large packet TLS 1.0 BlockCipher truncated MAC" \
2351 "$P_SRV" \
2352 "$P_CLI request_size=16384 force_version=tls1 \
2353 force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA \
2354 trunc_hmac=1" \
2355 0 \
2356 -s "Read from client: 16384 bytes read"
2357
2358run_test "Large packet TLS 1.0 StreamCipher truncated MAC" \
2359 "$P_SRV" \
2360 "$P_CLI request_size=16384 force_version=tls1 \
2361 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \
2362 trunc_hmac=1" \
2363 0 \
2364 -s "Read from client: 16384 bytes read"
2365
2366run_test "Large packet TLS 1.1 BlockCipher" \
2367 "$P_SRV" \
2368 "$P_CLI request_size=16384 force_version=tls1_1 \
2369 force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
2370 0 \
2371 -s "Read from client: 16384 bytes read"
2372
2373run_test "Large packet TLS 1.1 StreamCipher" \
2374 "$P_SRV" \
2375 "$P_CLI request_size=16384 force_version=tls1_1 \
2376 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
2377 0 \
2378 -s "Read from client: 16384 bytes read"
2379
2380run_test "Large packet TLS 1.1 BlockCipher truncated MAC" \
2381 "$P_SRV" \
2382 "$P_CLI request_size=16384 force_version=tls1_1 \
2383 force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA \
2384 trunc_hmac=1" \
2385 0 \
2386 -s "Read from client: 16384 bytes read"
2387
2388run_test "Large packet TLS 1.1 StreamCipher truncated MAC" \
2389 "$P_SRV" \
2390 "$P_CLI request_size=16384 force_version=tls1_1 \
2391 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \
2392 trunc_hmac=1" \
2393 0 \
2394 -s "Read from client: 16384 bytes read"
2395
2396run_test "Large packet TLS 1.2 BlockCipher" \
2397 "$P_SRV" \
2398 "$P_CLI request_size=16384 force_version=tls1_2 \
2399 force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
2400 0 \
2401 -s "Read from client: 16384 bytes read"
2402
2403run_test "Large packet TLS 1.2 BlockCipher larger MAC" \
2404 "$P_SRV" \
2405 "$P_CLI request_size=16384 force_version=tls1_2 force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384" \
2406 0 \
2407 -s "Read from client: 16384 bytes read"
2408
2409run_test "Large packet TLS 1.2 BlockCipher truncated MAC" \
2410 "$P_SRV" \
2411 "$P_CLI request_size=16384 force_version=tls1_2 \
2412 force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA \
2413 trunc_hmac=1" \
2414 0 \
2415 -s "Read from client: 16384 bytes read"
2416
2417run_test "Large packet TLS 1.2 StreamCipher" \
2418 "$P_SRV" \
2419 "$P_CLI request_size=16384 force_version=tls1_2 \
2420 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
2421 0 \
2422 -s "Read from client: 16384 bytes read"
2423
2424run_test "Large packet TLS 1.2 StreamCipher truncated MAC" \
2425 "$P_SRV" \
2426 "$P_CLI request_size=16384 force_version=tls1_2 \
2427 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \
2428 trunc_hmac=1" \
2429 0 \
2430 -s "Read from client: 16384 bytes read"
2431
2432run_test "Large packet TLS 1.2 AEAD" \
2433 "$P_SRV" \
2434 "$P_CLI request_size=16384 force_version=tls1_2 \
2435 force_ciphersuite=TLS-RSA-WITH-AES-256-CCM" \
2436 0 \
2437 -s "Read from client: 16384 bytes read"
2438
2439run_test "Large packet TLS 1.2 AEAD shorter tag" \
2440 "$P_SRV" \
2441 "$P_CLI request_size=16384 force_version=tls1_2 \
2442 force_ciphersuite=TLS-RSA-WITH-AES-256-CCM-8" \
2443 0 \
2444 -s "Read from client: 16384 bytes read"
2445
Manuel Pégourié-Gonnard0eb6cab2014-07-23 20:17:47 +02002446# Tests for DTLS HelloVerifyRequest
2447
2448run_test "DTLS cookie: enabled" \
2449 "$P_SRV dtls=1 debug_level=2" \
2450 "$P_CLI dtls=1 debug_level=2" \
2451 0 \
2452 -s "cookie verification failed" \
2453 -s "cookie verification passed" \
2454 -S "cookie verification skipped" \
2455 -c "received hello verify request" \
Manuel Pégourié-Gonnardcaecdae2014-10-13 19:04:37 +02002456 -s "hello verification requested" \
Manuel Pégourié-Gonnard0eb6cab2014-07-23 20:17:47 +02002457 -S "SSL - The requested feature is not available"
2458
2459run_test "DTLS cookie: disabled" \
2460 "$P_SRV dtls=1 debug_level=2 cookies=0" \
2461 "$P_CLI dtls=1 debug_level=2" \
2462 0 \
2463 -S "cookie verification failed" \
2464 -S "cookie verification passed" \
2465 -s "cookie verification skipped" \
2466 -C "received hello verify request" \
Manuel Pégourié-Gonnardcaecdae2014-10-13 19:04:37 +02002467 -S "hello verification requested" \
Manuel Pégourié-Gonnard0eb6cab2014-07-23 20:17:47 +02002468 -S "SSL - The requested feature is not available"
2469
Manuel Pégourié-Gonnardcaecdae2014-10-13 19:04:37 +02002470run_test "DTLS cookie: default (failing)" \
2471 "$P_SRV dtls=1 debug_level=2 cookies=-1" \
2472 "$P_CLI dtls=1 debug_level=2 hs_timeout=100-400" \
2473 1 \
2474 -s "cookie verification failed" \
2475 -S "cookie verification passed" \
2476 -S "cookie verification skipped" \
2477 -C "received hello verify request" \
2478 -S "hello verification requested" \
2479 -s "SSL - The requested feature is not available"
Manuel Pégourié-Gonnard0eb6cab2014-07-23 20:17:47 +02002480
2481requires_ipv6
2482run_test "DTLS cookie: enabled, IPv6" \
2483 "$P_SRV dtls=1 debug_level=2 server_addr=::1" \
2484 "$P_CLI dtls=1 debug_level=2 server_addr=::1" \
2485 0 \
2486 -s "cookie verification failed" \
2487 -s "cookie verification passed" \
2488 -S "cookie verification skipped" \
2489 -c "received hello verify request" \
Manuel Pégourié-Gonnardcaecdae2014-10-13 19:04:37 +02002490 -s "hello verification requested" \
Manuel Pégourié-Gonnard0eb6cab2014-07-23 20:17:47 +02002491 -S "SSL - The requested feature is not available"
2492
Manuel Pégourié-Gonnard579950c2014-09-29 17:47:33 +02002493run_test "DTLS cookie: enabled, nbio" \
2494 "$P_SRV dtls=1 nbio=2 debug_level=2" \
2495 "$P_CLI dtls=1 nbio=2 debug_level=2" \
2496 0 \
2497 -s "cookie verification failed" \
2498 -s "cookie verification passed" \
2499 -S "cookie verification skipped" \
2500 -c "received hello verify request" \
Manuel Pégourié-Gonnardcaecdae2014-10-13 19:04:37 +02002501 -s "hello verification requested" \
Manuel Pégourié-Gonnard579950c2014-09-29 17:47:33 +02002502 -S "SSL - The requested feature is not available"
2503
Manuel Pégourié-Gonnard08a1d4b2014-09-26 10:35:50 +02002504# Tests for various cases of client authentication with DTLS
2505# (focused on handshake flows and message parsing)
2506
2507run_test "DTLS client auth: required" \
2508 "$P_SRV dtls=1 auth_mode=required" \
2509 "$P_CLI dtls=1" \
2510 0 \
2511 -s "Verifying peer X.509 certificate... ok"
2512
2513run_test "DTLS client auth: optional, client has no cert" \
2514 "$P_SRV dtls=1 auth_mode=optional" \
2515 "$P_CLI dtls=1 crt_file=none key_file=none" \
2516 0 \
2517 -s "! no client certificate sent"
2518
2519run_test "DTLS client auth: optional, client has no cert" \
2520 "$P_SRV dtls=1 auth_mode=none" \
2521 "$P_CLI dtls=1 crt_file=none key_file=none debug_level=2" \
2522 0 \
2523 -c "skip write certificate$" \
2524 -s "! no client certificate sent"
2525
Manuel Pégourié-Gonnard502bf302014-08-20 13:12:58 +02002526# Tests for receiving fragmented handshake messages with DTLS
2527
2528requires_gnutls
2529run_test "DTLS reassembly: no fragmentation (gnutls server)" \
2530 "$G_SRV -u --mtu 2048 -a" \
2531 "$P_CLI dtls=1 debug_level=2" \
2532 0 \
2533 -C "found fragmented DTLS handshake message" \
2534 -C "error"
2535
2536requires_gnutls
2537run_test "DTLS reassembly: some fragmentation (gnutls server)" \
2538 "$G_SRV -u --mtu 512" \
2539 "$P_CLI dtls=1 debug_level=2" \
2540 0 \
2541 -c "found fragmented DTLS handshake message" \
2542 -C "error"
2543
2544requires_gnutls
2545run_test "DTLS reassembly: more fragmentation (gnutls server)" \
2546 "$G_SRV -u --mtu 128" \
2547 "$P_CLI dtls=1 debug_level=2" \
2548 0 \
2549 -c "found fragmented DTLS handshake message" \
2550 -C "error"
2551
2552requires_gnutls
2553run_test "DTLS reassembly: more fragmentation, nbio (gnutls server)" \
2554 "$G_SRV -u --mtu 128" \
2555 "$P_CLI dtls=1 nbio=2 debug_level=2" \
2556 0 \
2557 -c "found fragmented DTLS handshake message" \
2558 -C "error"
2559
Manuel Pégourié-Gonnard0c4cbc72014-09-02 14:47:31 +02002560requires_gnutls
Manuel Pégourié-Gonnard0c4cbc72014-09-02 14:47:31 +02002561run_test "DTLS reassembly: fragmentation, renego (gnutls server)" \
2562 "$G_SRV -u --mtu 256" \
2563 "$P_CLI debug_level=3 dtls=1 renegotiation=1 renegotiate=1" \
2564 0 \
2565 -c "found fragmented DTLS handshake message" \
2566 -c "client hello, adding renegotiation extension" \
2567 -c "found renegotiation extension" \
2568 -c "=> renegotiate" \
2569 -C "ssl_handshake returned" \
2570 -C "error" \
2571 -s "Extra-header:"
2572
2573requires_gnutls
Manuel Pégourié-Gonnard0c4cbc72014-09-02 14:47:31 +02002574run_test "DTLS reassembly: fragmentation, nbio, renego (gnutls server)" \
2575 "$G_SRV -u --mtu 256" \
2576 "$P_CLI debug_level=3 nbio=2 dtls=1 renegotiation=1 renegotiate=1" \
2577 0 \
2578 -c "found fragmented DTLS handshake message" \
2579 -c "client hello, adding renegotiation extension" \
2580 -c "found renegotiation extension" \
2581 -c "=> renegotiate" \
2582 -C "ssl_handshake returned" \
2583 -C "error" \
2584 -s "Extra-header:"
2585
Manuel Pégourié-Gonnarda7756172014-08-31 18:37:01 +02002586run_test "DTLS reassembly: no fragmentation (openssl server)" \
2587 "$O_SRV -dtls1 -mtu 2048" \
2588 "$P_CLI dtls=1 debug_level=2" \
2589 0 \
2590 -C "found fragmented DTLS handshake message" \
2591 -C "error"
2592
Manuel Pégourié-Gonnard825a49e2014-09-23 11:00:37 +02002593run_test "DTLS reassembly: some fragmentation (openssl server)" \
2594 "$O_SRV -dtls1 -mtu 768" \
Manuel Pégourié-Gonnard64dffc52014-09-02 13:39:16 +02002595 "$P_CLI dtls=1 debug_level=2" \
2596 0 \
2597 -c "found fragmented DTLS handshake message" \
2598 -C "error"
2599
Manuel Pégourié-Gonnard825a49e2014-09-23 11:00:37 +02002600run_test "DTLS reassembly: more fragmentation (openssl server)" \
Manuel Pégourié-Gonnard64dffc52014-09-02 13:39:16 +02002601 "$O_SRV -dtls1 -mtu 256" \
2602 "$P_CLI dtls=1 debug_level=2" \
2603 0 \
2604 -c "found fragmented DTLS handshake message" \
2605 -C "error"
2606
2607run_test "DTLS reassembly: fragmentation, nbio (openssl server)" \
2608 "$O_SRV -dtls1 -mtu 256" \
2609 "$P_CLI dtls=1 nbio=2 debug_level=2" \
2610 0 \
2611 -c "found fragmented DTLS handshake message" \
2612 -C "error"
Manuel Pégourié-Gonnarda7756172014-08-31 18:37:01 +02002613
Manuel Pégourié-Gonnard7a66cbc2014-09-26 16:31:46 +02002614# Tests for specific things with "unreliable" UDP connection
Manuel Pégourié-Gonnardbe9eb872014-09-05 17:45:19 +02002615
Manuel Pégourié-Gonnard76fe9e42014-09-24 15:17:31 +02002616not_with_valgrind # spurious resend due to timeout
Manuel Pégourié-Gonnard990f9e42014-09-06 12:27:02 +02002617run_test "DTLS proxy: reference" \
Manuel Pégourié-Gonnardbe9eb872014-09-05 17:45:19 +02002618 -p "$P_PXY" \
Manuel Pégourié-Gonnard76fe9e42014-09-24 15:17:31 +02002619 "$P_SRV dtls=1 debug_level=2" \
2620 "$P_CLI dtls=1 debug_level=2" \
Manuel Pégourié-Gonnard990f9e42014-09-06 12:27:02 +02002621 0 \
Manuel Pégourié-Gonnard246c13a2014-09-24 13:56:09 +02002622 -C "replayed record" \
2623 -S "replayed record" \
2624 -C "record from another epoch" \
2625 -S "record from another epoch" \
2626 -C "discarding invalid record" \
2627 -S "discarding invalid record" \
Manuel Pégourié-Gonnard76fe9e42014-09-24 15:17:31 +02002628 -S "resend" \
Manuel Pégourié-Gonnard63eca932014-09-08 16:39:08 +02002629 -s "Extra-header:" \
Manuel Pégourié-Gonnard990f9e42014-09-06 12:27:02 +02002630 -c "HTTP/1.0 200 OK"
2631
Manuel Pégourié-Gonnard76fe9e42014-09-24 15:17:31 +02002632not_with_valgrind # spurious resend due to timeout
Manuel Pégourié-Gonnardb47368a2014-09-24 13:29:58 +02002633run_test "DTLS proxy: duplicate every packet" \
Manuel Pégourié-Gonnard990f9e42014-09-06 12:27:02 +02002634 -p "$P_PXY duplicate=1" \
Manuel Pégourié-Gonnard76fe9e42014-09-24 15:17:31 +02002635 "$P_SRV dtls=1 debug_level=2" \
2636 "$P_CLI dtls=1 debug_level=2" \
Manuel Pégourié-Gonnard990f9e42014-09-06 12:27:02 +02002637 0 \
Manuel Pégourié-Gonnardb47368a2014-09-24 13:29:58 +02002638 -c "replayed record" \
2639 -s "replayed record" \
Manuel Pégourié-Gonnard246c13a2014-09-24 13:56:09 +02002640 -c "discarding invalid record" \
2641 -s "discarding invalid record" \
Manuel Pégourié-Gonnard76fe9e42014-09-24 15:17:31 +02002642 -S "resend" \
Manuel Pégourié-Gonnard63eca932014-09-08 16:39:08 +02002643 -s "Extra-header:" \
2644 -c "HTTP/1.0 200 OK"
2645
Manuel Pégourié-Gonnard27393132014-09-24 14:41:11 +02002646run_test "DTLS proxy: duplicate every packet, server anti-replay off" \
2647 -p "$P_PXY duplicate=1" \
Manuel Pégourié-Gonnard76fe9e42014-09-24 15:17:31 +02002648 "$P_SRV dtls=1 debug_level=2 anti_replay=0" \
2649 "$P_CLI dtls=1 debug_level=2" \
Manuel Pégourié-Gonnard27393132014-09-24 14:41:11 +02002650 0 \
2651 -c "replayed record" \
2652 -S "replayed record" \
2653 -c "discarding invalid record" \
2654 -s "discarding invalid record" \
Manuel Pégourié-Gonnard76fe9e42014-09-24 15:17:31 +02002655 -c "resend" \
2656 -s "resend" \
Manuel Pégourié-Gonnard27393132014-09-24 14:41:11 +02002657 -s "Extra-header:" \
2658 -c "HTTP/1.0 200 OK"
2659
Manuel Pégourié-Gonnarde698f592014-10-14 19:36:36 +02002660run_test "DTLS proxy: inject invalid AD record, default badmac_limit" \
Manuel Pégourié-Gonnard63eca932014-09-08 16:39:08 +02002661 -p "$P_PXY bad_ad=1" \
Manuel Pégourié-Gonnard246c13a2014-09-24 13:56:09 +02002662 "$P_SRV dtls=1 debug_level=1" \
Manuel Pégourié-Gonnarde698f592014-10-14 19:36:36 +02002663 "$P_CLI dtls=1 debug_level=1 read_timeout=100" \
Manuel Pégourié-Gonnard825a49e2014-09-23 11:00:37 +02002664 0 \
Manuel Pégourié-Gonnard74a13782014-10-14 22:34:08 +02002665 -c "discarding invalid record (mac)" \
2666 -s "discarding invalid record (mac)" \
Manuel Pégourié-Gonnard825a49e2014-09-23 11:00:37 +02002667 -s "Extra-header:" \
Manuel Pégourié-Gonnarde698f592014-10-14 19:36:36 +02002668 -c "HTTP/1.0 200 OK" \
2669 -S "too many records with bad MAC" \
2670 -S "Verification of the message MAC failed"
2671
2672run_test "DTLS proxy: inject invalid AD record, badmac_limit 1" \
2673 -p "$P_PXY bad_ad=1" \
2674 "$P_SRV dtls=1 debug_level=1 badmac_limit=1" \
2675 "$P_CLI dtls=1 debug_level=1 read_timeout=100" \
2676 1 \
Manuel Pégourié-Gonnard74a13782014-10-14 22:34:08 +02002677 -C "discarding invalid record (mac)" \
2678 -S "discarding invalid record (mac)" \
Manuel Pégourié-Gonnarde698f592014-10-14 19:36:36 +02002679 -S "Extra-header:" \
2680 -C "HTTP/1.0 200 OK" \
2681 -s "too many records with bad MAC" \
2682 -s "Verification of the message MAC failed"
2683
2684run_test "DTLS proxy: inject invalid AD record, badmac_limit 2" \
2685 -p "$P_PXY bad_ad=1" \
2686 "$P_SRV dtls=1 debug_level=1 badmac_limit=2" \
2687 "$P_CLI dtls=1 debug_level=1 read_timeout=100" \
2688 0 \
Manuel Pégourié-Gonnard74a13782014-10-14 22:34:08 +02002689 -c "discarding invalid record (mac)" \
2690 -s "discarding invalid record (mac)" \
Manuel Pégourié-Gonnarde698f592014-10-14 19:36:36 +02002691 -s "Extra-header:" \
2692 -c "HTTP/1.0 200 OK" \
2693 -S "too many records with bad MAC" \
2694 -S "Verification of the message MAC failed"
2695
2696run_test "DTLS proxy: inject invalid AD record, badmac_limit 2, exchanges 2"\
2697 -p "$P_PXY bad_ad=1" \
2698 "$P_SRV dtls=1 debug_level=1 badmac_limit=2 exchanges=2" \
2699 "$P_CLI dtls=1 debug_level=1 read_timeout=100 exchanges=2" \
2700 1 \
Manuel Pégourié-Gonnard74a13782014-10-14 22:34:08 +02002701 -c "discarding invalid record (mac)" \
2702 -s "discarding invalid record (mac)" \
Manuel Pégourié-Gonnarde698f592014-10-14 19:36:36 +02002703 -s "Extra-header:" \
2704 -c "HTTP/1.0 200 OK" \
2705 -s "too many records with bad MAC" \
2706 -s "Verification of the message MAC failed"
Manuel Pégourié-Gonnard825a49e2014-09-23 11:00:37 +02002707
2708run_test "DTLS proxy: delay ChangeCipherSpec" \
Manuel Pégourié-Gonnard246c13a2014-09-24 13:56:09 +02002709 -p "$P_PXY delay_ccs=1" \
2710 "$P_SRV dtls=1 debug_level=1" \
2711 "$P_CLI dtls=1 debug_level=1" \
Manuel Pégourié-Gonnard825a49e2014-09-23 11:00:37 +02002712 0 \
Manuel Pégourié-Gonnard246c13a2014-09-24 13:56:09 +02002713 -c "record from another epoch" \
2714 -s "record from another epoch" \
Manuel Pégourié-Gonnard825a49e2014-09-23 11:00:37 +02002715 -c "discarding invalid record" \
Manuel Pégourié-Gonnard246c13a2014-09-24 13:56:09 +02002716 -s "discarding invalid record" \
Manuel Pégourié-Gonnard825a49e2014-09-23 11:00:37 +02002717 -s "Extra-header:" \
2718 -c "HTTP/1.0 200 OK"
2719
Manuel Pégourié-Gonnard7a66cbc2014-09-26 16:31:46 +02002720# Tests for "randomly unreliable connection": try a variety of flows and peers
Manuel Pégourié-Gonnard18e519a2014-09-24 19:09:17 +02002721
Manuel Pégourié-Gonnard825a49e2014-09-23 11:00:37 +02002722needs_more_time 2
Manuel Pégourié-Gonnard18e519a2014-09-24 19:09:17 +02002723run_test "DTLS proxy: 3d (drop, delay, duplicate), \"short\" PSK handshake" \
Manuel Pégourié-Gonnard825a49e2014-09-23 11:00:37 +02002724 -p "$P_PXY drop=5 delay=5 duplicate=5" \
Manuel Pégourié-Gonnard37a4de22014-10-01 16:38:03 +02002725 "$P_SRV dtls=1 hs_timeout=250-10000 tickets=0 auth_mode=none \
2726 psk=abc123" \
2727 "$P_CLI dtls=1 hs_timeout=250-10000 tickets=0 psk=abc123 \
Manuel Pégourié-Gonnard18e519a2014-09-24 19:09:17 +02002728 force_ciphersuite=TLS-PSK-WITH-AES-128-CCM-8" \
2729 0 \
2730 -s "Extra-header:" \
2731 -c "HTTP/1.0 200 OK"
2732
2733needs_more_time 2
2734run_test "DTLS proxy: 3d, \"short\" RSA handshake" \
2735 -p "$P_PXY drop=5 delay=5 duplicate=5" \
Manuel Pégourié-Gonnard37a4de22014-10-01 16:38:03 +02002736 "$P_SRV dtls=1 hs_timeout=250-10000 tickets=0 auth_mode=none" \
2737 "$P_CLI dtls=1 hs_timeout=250-10000 tickets=0 \
Manuel Pégourié-Gonnard18e519a2014-09-24 19:09:17 +02002738 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
2739 0 \
2740 -s "Extra-header:" \
2741 -c "HTTP/1.0 200 OK"
2742
2743needs_more_time 2
2744run_test "DTLS proxy: 3d, \"short\" (no ticket, no cli_auth) FS handshake" \
2745 -p "$P_PXY drop=5 delay=5 duplicate=5" \
Manuel Pégourié-Gonnard37a4de22014-10-01 16:38:03 +02002746 "$P_SRV dtls=1 hs_timeout=250-10000 tickets=0 auth_mode=none" \
2747 "$P_CLI dtls=1 hs_timeout=250-10000 tickets=0" \
Manuel Pégourié-Gonnard18e519a2014-09-24 19:09:17 +02002748 0 \
2749 -s "Extra-header:" \
2750 -c "HTTP/1.0 200 OK"
2751
2752needs_more_time 2
2753run_test "DTLS proxy: 3d, FS, client auth" \
2754 -p "$P_PXY drop=5 delay=5 duplicate=5" \
Manuel Pégourié-Gonnard37a4de22014-10-01 16:38:03 +02002755 "$P_SRV dtls=1 hs_timeout=250-10000 tickets=0 auth_mode=required" \
2756 "$P_CLI dtls=1 hs_timeout=250-10000 tickets=0" \
Manuel Pégourié-Gonnard18e519a2014-09-24 19:09:17 +02002757 0 \
2758 -s "Extra-header:" \
2759 -c "HTTP/1.0 200 OK"
2760
2761needs_more_time 2
2762run_test "DTLS proxy: 3d, FS, ticket" \
2763 -p "$P_PXY drop=5 delay=5 duplicate=5" \
Manuel Pégourié-Gonnard37a4de22014-10-01 16:38:03 +02002764 "$P_SRV dtls=1 hs_timeout=250-10000 tickets=1 auth_mode=none" \
2765 "$P_CLI dtls=1 hs_timeout=250-10000 tickets=1" \
Manuel Pégourié-Gonnard18e519a2014-09-24 19:09:17 +02002766 0 \
2767 -s "Extra-header:" \
2768 -c "HTTP/1.0 200 OK"
2769
2770needs_more_time 2
2771run_test "DTLS proxy: 3d, max handshake (FS, ticket + client auth)" \
2772 -p "$P_PXY drop=5 delay=5 duplicate=5" \
Manuel Pégourié-Gonnard37a4de22014-10-01 16:38:03 +02002773 "$P_SRV dtls=1 hs_timeout=250-10000 tickets=1 auth_mode=required" \
2774 "$P_CLI dtls=1 hs_timeout=250-10000 tickets=1" \
Manuel Pégourié-Gonnard825a49e2014-09-23 11:00:37 +02002775 0 \
2776 -s "Extra-header:" \
2777 -c "HTTP/1.0 200 OK"
2778
Manuel Pégourié-Gonnard6093d812014-09-29 17:52:57 +02002779needs_more_time 2
2780run_test "DTLS proxy: 3d, max handshake, nbio" \
2781 -p "$P_PXY drop=5 delay=5 duplicate=5" \
Manuel Pégourié-Gonnard37a4de22014-10-01 16:38:03 +02002782 "$P_SRV dtls=1 hs_timeout=250-10000 nbio=2 tickets=1 \
2783 auth_mode=required" \
2784 "$P_CLI dtls=1 hs_timeout=250-10000 nbio=2 tickets=1" \
Manuel Pégourié-Gonnard6093d812014-09-29 17:52:57 +02002785 0 \
2786 -s "Extra-header:" \
2787 -c "HTTP/1.0 200 OK"
2788
Manuel Pégourié-Gonnard1b753f12014-09-25 16:09:36 +02002789needs_more_time 4
Manuel Pégourié-Gonnard7a26d732014-10-02 14:50:46 +02002790run_test "DTLS proxy: 3d, min handshake, resumption" \
2791 -p "$P_PXY drop=5 delay=5 duplicate=5" \
2792 "$P_SRV dtls=1 hs_timeout=250-10000 tickets=0 auth_mode=none \
2793 psk=abc123 debug_level=3" \
2794 "$P_CLI dtls=1 hs_timeout=250-10000 tickets=0 psk=abc123 \
2795 debug_level=3 reconnect=1 read_timeout=1000 max_resend=10 \
2796 force_ciphersuite=TLS-PSK-WITH-AES-128-CCM-8" \
2797 0 \
2798 -s "a session has been resumed" \
2799 -c "a session has been resumed" \
2800 -s "Extra-header:" \
2801 -c "HTTP/1.0 200 OK"
2802
2803needs_more_time 4
Manuel Pégourié-Gonnard85beb302014-10-02 17:59:19 +02002804run_test "DTLS proxy: 3d, min handshake, resumption, nbio" \
2805 -p "$P_PXY drop=5 delay=5 duplicate=5" \
2806 "$P_SRV dtls=1 hs_timeout=250-10000 tickets=0 auth_mode=none \
2807 psk=abc123 debug_level=3 nbio=2" \
2808 "$P_CLI dtls=1 hs_timeout=250-10000 tickets=0 psk=abc123 \
2809 debug_level=3 reconnect=1 read_timeout=1000 max_resend=10 \
2810 force_ciphersuite=TLS-PSK-WITH-AES-128-CCM-8 nbio=2" \
2811 0 \
2812 -s "a session has been resumed" \
2813 -c "a session has been resumed" \
2814 -s "Extra-header:" \
2815 -c "HTTP/1.0 200 OK"
2816
2817needs_more_time 4
Manuel Pégourié-Gonnard6093d812014-09-29 17:52:57 +02002818run_test "DTLS proxy: 3d, min handshake, client-initiated renego" \
Manuel Pégourié-Gonnard1b753f12014-09-25 16:09:36 +02002819 -p "$P_PXY drop=5 delay=5 duplicate=5" \
Manuel Pégourié-Gonnard37a4de22014-10-01 16:38:03 +02002820 "$P_SRV dtls=1 hs_timeout=250-10000 tickets=0 auth_mode=none \
2821 psk=abc123 renegotiation=1 debug_level=2" \
2822 "$P_CLI dtls=1 hs_timeout=250-10000 tickets=0 psk=abc123 \
2823 renegotiate=1 debug_level=2 \
Manuel Pégourié-Gonnard1b753f12014-09-25 16:09:36 +02002824 force_ciphersuite=TLS-PSK-WITH-AES-128-CCM-8" \
2825 0 \
2826 -c "=> renegotiate" \
2827 -s "=> renegotiate" \
2828 -s "Extra-header:" \
2829 -c "HTTP/1.0 200 OK"
2830
Manuel Pégourié-Gonnard6093d812014-09-29 17:52:57 +02002831needs_more_time 4
2832run_test "DTLS proxy: 3d, min handshake, client-initiated renego, nbio" \
2833 -p "$P_PXY drop=5 delay=5 duplicate=5" \
Manuel Pégourié-Gonnard37a4de22014-10-01 16:38:03 +02002834 "$P_SRV dtls=1 hs_timeout=250-10000 tickets=0 auth_mode=none \
2835 psk=abc123 renegotiation=1 debug_level=2" \
2836 "$P_CLI dtls=1 hs_timeout=250-10000 tickets=0 psk=abc123 \
2837 renegotiate=1 debug_level=2 \
Manuel Pégourié-Gonnard6093d812014-09-29 17:52:57 +02002838 force_ciphersuite=TLS-PSK-WITH-AES-128-CCM-8" \
2839 0 \
2840 -c "=> renegotiate" \
2841 -s "=> renegotiate" \
2842 -s "Extra-header:" \
2843 -c "HTTP/1.0 200 OK"
2844
Manuel Pégourié-Gonnardba958b82014-10-09 16:13:44 +02002845needs_more_time 4
2846run_test "DTLS proxy: 3d, min handshake, server-initiated renego" \
Manuel Pégourié-Gonnarda6ace042014-10-15 12:44:41 +02002847 -p "$P_PXY drop=5 delay=5 duplicate=5" \
Manuel Pégourié-Gonnardba958b82014-10-09 16:13:44 +02002848 "$P_SRV dtls=1 hs_timeout=250-10000 tickets=0 auth_mode=none \
Manuel Pégourié-Gonnarda6ace042014-10-15 12:44:41 +02002849 psk=abc123 renegotiate=1 renegotiation=1 exchanges=4 \
Manuel Pégourié-Gonnardba958b82014-10-09 16:13:44 +02002850 debug_level=2" \
2851 "$P_CLI dtls=1 hs_timeout=250-10000 tickets=0 psk=abc123 \
Manuel Pégourié-Gonnarda6ace042014-10-15 12:44:41 +02002852 renegotiation=1 exchanges=4 debug_level=2 \
Manuel Pégourié-Gonnardba958b82014-10-09 16:13:44 +02002853 force_ciphersuite=TLS-PSK-WITH-AES-128-CCM-8" \
2854 0 \
2855 -c "=> renegotiate" \
2856 -s "=> renegotiate" \
2857 -s "Extra-header:" \
2858 -c "HTTP/1.0 200 OK"
2859
2860needs_more_time 4
2861run_test "DTLS proxy: 3d, min handshake, server-initiated renego, nbio" \
Manuel Pégourié-Gonnarda6ace042014-10-15 12:44:41 +02002862 -p "$P_PXY drop=5 delay=5 duplicate=5" \
Manuel Pégourié-Gonnardba958b82014-10-09 16:13:44 +02002863 "$P_SRV dtls=1 hs_timeout=250-10000 tickets=0 auth_mode=none \
Manuel Pégourié-Gonnarda6ace042014-10-15 12:44:41 +02002864 psk=abc123 renegotiate=1 renegotiation=1 exchanges=4 \
Manuel Pégourié-Gonnardba958b82014-10-09 16:13:44 +02002865 debug_level=2 nbio=2" \
2866 "$P_CLI dtls=1 hs_timeout=250-10000 tickets=0 psk=abc123 \
Manuel Pégourié-Gonnarda6ace042014-10-15 12:44:41 +02002867 renegotiation=1 exchanges=4 debug_level=2 nbio=2 \
Manuel Pégourié-Gonnardba958b82014-10-09 16:13:44 +02002868 force_ciphersuite=TLS-PSK-WITH-AES-128-CCM-8" \
2869 0 \
2870 -c "=> renegotiate" \
2871 -s "=> renegotiate" \
2872 -s "Extra-header:" \
2873 -c "HTTP/1.0 200 OK"
2874
Manuel Pégourié-Gonnard127ab882014-10-09 17:59:32 +02002875needs_more_time 6
Manuel Pégourié-Gonnard9590e0a2014-09-26 16:27:59 +02002876run_test "DTLS proxy: 3d, openssl server" \
Manuel Pégourié-Gonnardd0fd1da2014-09-25 17:00:27 +02002877 -p "$P_PXY drop=5 delay=5 duplicate=5 protect_hvr=1" \
2878 "$O_SRV -dtls1 -mtu 2048" \
Manuel Pégourié-Gonnardf1384472014-10-14 22:57:46 +02002879 "$P_CLI dtls=1 hs_timeout=250-60000" \
Manuel Pégourié-Gonnardd0fd1da2014-09-25 17:00:27 +02002880 0 \
2881 -s "Extra-header:" \
2882 -c "HTTP/1.0 200 OK"
2883
Manuel Pégourié-Gonnard127ab882014-10-09 17:59:32 +02002884needs_more_time 6
Manuel Pégourié-Gonnard9590e0a2014-09-26 16:27:59 +02002885run_test "DTLS proxy: 3d, openssl server, fragmentation" \
2886 -p "$P_PXY drop=5 delay=5 duplicate=5 protect_hvr=1" \
2887 "$O_SRV -dtls1 -mtu 768" \
Manuel Pégourié-Gonnardf1384472014-10-14 22:57:46 +02002888 "$P_CLI dtls=1 hs_timeout=250-60000" \
Manuel Pégourié-Gonnard9590e0a2014-09-26 16:27:59 +02002889 0 \
2890 -s "Extra-header:" \
2891 -c "HTTP/1.0 200 OK"
2892
Manuel Pégourié-Gonnard127ab882014-10-09 17:59:32 +02002893needs_more_time 6
Manuel Pégourié-Gonnard6093d812014-09-29 17:52:57 +02002894run_test "DTLS proxy: 3d, openssl server, fragmentation, nbio" \
2895 -p "$P_PXY drop=5 delay=5 duplicate=5 protect_hvr=1" \
2896 "$O_SRV -dtls1 -mtu 768" \
Manuel Pégourié-Gonnardf1384472014-10-14 22:57:46 +02002897 "$P_CLI dtls=1 hs_timeout=250-60000 nbio=2" \
Manuel Pégourié-Gonnard6093d812014-09-29 17:52:57 +02002898 0 \
2899 -s "Extra-header:" \
2900 -c "HTTP/1.0 200 OK"
2901
Manuel Pégourié-Gonnard127ab882014-10-09 17:59:32 +02002902needs_more_time 6
Manuel Pégourié-Gonnard9590e0a2014-09-26 16:27:59 +02002903run_test "DTLS proxy: 3d, gnutls server" \
2904 -p "$P_PXY drop=5 delay=5 duplicate=5" \
2905 "$G_SRV -u --mtu 2048 -a" \
Manuel Pégourié-Gonnardf1384472014-10-14 22:57:46 +02002906 "$P_CLI dtls=1 hs_timeout=250-60000" \
Manuel Pégourié-Gonnard9590e0a2014-09-26 16:27:59 +02002907 0 \
2908 -s "Extra-header:" \
2909 -c "Extra-header:"
2910
Manuel Pégourié-Gonnard127ab882014-10-09 17:59:32 +02002911needs_more_time 6
Manuel Pégourié-Gonnard9590e0a2014-09-26 16:27:59 +02002912run_test "DTLS proxy: 3d, gnutls server, fragmentation" \
2913 -p "$P_PXY drop=5 delay=5 duplicate=5" \
2914 "$G_SRV -u --mtu 512" \
Manuel Pégourié-Gonnardf1384472014-10-14 22:57:46 +02002915 "$P_CLI dtls=1 hs_timeout=250-60000" \
Manuel Pégourié-Gonnard9590e0a2014-09-26 16:27:59 +02002916 0 \
2917 -s "Extra-header:" \
2918 -c "Extra-header:"
2919
Manuel Pégourié-Gonnard127ab882014-10-09 17:59:32 +02002920needs_more_time 6
Manuel Pégourié-Gonnard6093d812014-09-29 17:52:57 +02002921run_test "DTLS proxy: 3d, gnutls server, fragmentation, nbio" \
2922 -p "$P_PXY drop=5 delay=5 duplicate=5" \
2923 "$G_SRV -u --mtu 512" \
Manuel Pégourié-Gonnardf1384472014-10-14 22:57:46 +02002924 "$P_CLI dtls=1 hs_timeout=250-60000 nbio=2" \
Manuel Pégourié-Gonnard6093d812014-09-29 17:52:57 +02002925 0 \
2926 -s "Extra-header:" \
2927 -c "Extra-header:"
2928
Manuel Pégourié-Gonnard8520dac2014-02-21 12:12:23 +01002929# Final report
2930
Manuel Pégourié-Gonnard33a752e2014-02-21 09:47:37 +01002931echo "------------------------------------------------------------------------"
2932
2933if [ $FAILS = 0 ]; then
Manuel Pégourié-Gonnardf46f1282014-12-11 11:51:28 +01002934 printf "PASSED"
Manuel Pégourié-Gonnard33a752e2014-02-21 09:47:37 +01002935else
Manuel Pégourié-Gonnardf46f1282014-12-11 11:51:28 +01002936 printf "FAILED"
Manuel Pégourié-Gonnard33a752e2014-02-21 09:47:37 +01002937fi
Manuel Pégourié-Gonnard72e51ee2014-08-31 10:22:11 +02002938PASSES=$(( $TESTS - $FAILS ))
Manuel Pégourié-Gonnard6f4fbbb2014-08-14 14:31:29 +02002939echo " ($PASSES / $TESTS tests ($SKIPS skipped))"
Manuel Pégourié-Gonnard33a752e2014-02-21 09:47:37 +01002940
2941exit $FAILS