Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
Simon Butcher | 58eddef | 2016-05-19 23:43:11 +0100 | [diff] [blame] | 3 | # ssl-opt.sh |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 4 | # |
Simon Butcher | 58eddef | 2016-05-19 23:43:11 +0100 | [diff] [blame] | 5 | # This file is part of mbed TLS (https://tls.mbed.org) |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 6 | # |
Simon Butcher | 58eddef | 2016-05-19 23:43:11 +0100 | [diff] [blame] | 7 | # Copyright (c) 2016, ARM Limited, All Rights Reserved |
| 8 | # |
| 9 | # Purpose |
| 10 | # |
| 11 | # Executes tests to prove various TLS/SSL options and extensions. |
| 12 | # |
| 13 | # The goal is not to cover every ciphersuite/version, but instead to cover |
| 14 | # specific options (max fragment length, truncated hmac, etc) or procedures |
| 15 | # (session resumption from cache or ticket, renego, etc). |
| 16 | # |
| 17 | # The tests assume a build with default options, with exceptions expressed |
| 18 | # with a dependency. The tests focus on functionality and do not consider |
| 19 | # performance. |
| 20 | # |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 21 | |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 22 | set -u |
| 23 | |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 24 | # default values, can be overriden by the environment |
| 25 | : ${P_SRV:=../programs/ssl/ssl_server2} |
| 26 | : ${P_CLI:=../programs/ssl/ssl_client2} |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 27 | : ${P_PXY:=../programs/test/udp_proxy} |
Manuel Pégourié-Gonnard | 74faf3c | 2014-03-13 18:47:44 +0100 | [diff] [blame] | 28 | : ${OPENSSL_CMD:=openssl} # OPENSSL would conflict with the build system |
Manuel Pégourié-Gonnard | baa7f07 | 2014-08-20 20:15:53 +0200 | [diff] [blame] | 29 | : ${GNUTLS_CLI:=gnutls-cli} |
| 30 | : ${GNUTLS_SERV:=gnutls-serv} |
Gilles Peskine | d50177f | 2017-05-16 17:53:03 +0200 | [diff] [blame] | 31 | : ${PERL:=perl} |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 32 | |
Manuel Pégourié-Gonnard | fa60f12 | 2014-09-26 16:07:29 +0200 | [diff] [blame] | 33 | O_SRV="$OPENSSL_CMD s_server -www -cert data_files/server5.crt -key data_files/server5.key" |
Manuel Pégourié-Gonnard | 74faf3c | 2014-03-13 18:47:44 +0100 | [diff] [blame] | 34 | O_CLI="echo 'GET / HTTP/1.0' | $OPENSSL_CMD s_client" |
Manuel Pégourié-Gonnard | baa7f07 | 2014-08-20 20:15:53 +0200 | [diff] [blame] | 35 | G_SRV="$GNUTLS_SERV --x509certfile data_files/server5.crt --x509keyfile data_files/server5.key" |
Manuel Pégourié-Gonnard | 85d915b | 2014-11-03 20:10:36 +0100 | [diff] [blame] | 36 | G_CLI="echo 'GET / HTTP/1.0' | $GNUTLS_CLI --x509cafile data_files/test-ca_cat12.crt" |
Gilles Peskine | d50177f | 2017-05-16 17:53:03 +0200 | [diff] [blame] | 37 | TCP_CLIENT="$PERL scripts/tcp_client.pl" |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 38 | |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 39 | TESTS=0 |
| 40 | FAILS=0 |
Manuel Pégourié-Gonnard | 6f4fbbb | 2014-08-14 14:31:29 +0200 | [diff] [blame] | 41 | SKIPS=0 |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 42 | |
Manuel Pégourié-Gonnard | 7f80997 | 2015-03-09 17:05:11 +0000 | [diff] [blame] | 43 | CONFIG_H='../include/mbedtls/config.h' |
Manuel Pégourié-Gonnard | 83d8c73 | 2014-04-07 13:24:21 +0200 | [diff] [blame] | 44 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 45 | MEMCHECK=0 |
Manuel Pégourié-Gonnard | 417d46c | 2014-03-13 19:17:53 +0100 | [diff] [blame] | 46 | FILTER='.*' |
Manuel Pégourié-Gonnard | 6f4fbbb | 2014-08-14 14:31:29 +0200 | [diff] [blame] | 47 | EXCLUDE='^$' |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 48 | |
Paul Bakker | e20310a | 2016-05-10 11:18:17 +0100 | [diff] [blame] | 49 | SHOW_TEST_NUMBER=0 |
Paul Bakker | b7584a5 | 2016-05-10 10:50:43 +0100 | [diff] [blame] | 50 | RUN_TEST_NUMBER='' |
| 51 | |
Paul Bakker | acaac85 | 2016-05-10 11:47:13 +0100 | [diff] [blame] | 52 | PRESERVE_LOGS=0 |
| 53 | |
Gilles Peskine | f93c7d3 | 2017-04-14 17:55:28 +0200 | [diff] [blame] | 54 | # Pick a "unique" server port in the range 10000-19999, and a proxy |
| 55 | # port which is this plus 10000. Each port number may be independently |
| 56 | # overridden by a command line option. |
| 57 | SRV_PORT=$(($$ % 10000 + 10000)) |
| 58 | PXY_PORT=$((SRV_PORT + 10000)) |
| 59 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 60 | print_usage() { |
| 61 | echo "Usage: $0 [options]" |
Manuel Pégourié-Gonnard | f46f128 | 2014-12-11 11:51:28 +0100 | [diff] [blame] | 62 | printf " -h|--help\tPrint this help.\n" |
| 63 | printf " -m|--memcheck\tCheck memory leaks and errors.\n" |
Gilles Peskine | f93c7d3 | 2017-04-14 17:55:28 +0200 | [diff] [blame] | 64 | printf " -f|--filter\tOnly matching tests are executed (BRE; default: '$FILTER')\n" |
| 65 | printf " -e|--exclude\tMatching tests are excluded (BRE; default: '$EXCLUDE')\n" |
Paul Bakker | b7584a5 | 2016-05-10 10:50:43 +0100 | [diff] [blame] | 66 | printf " -n|--number\tExecute only numbered test (comma-separated, e.g. '245,256')\n" |
Paul Bakker | e20310a | 2016-05-10 11:18:17 +0100 | [diff] [blame] | 67 | printf " -s|--show-numbers\tShow test numbers in front of test names\n" |
Paul Bakker | acaac85 | 2016-05-10 11:47:13 +0100 | [diff] [blame] | 68 | printf " -p|--preserve-logs\tPreserve logs of successful tests as well\n" |
Gilles Peskine | f93c7d3 | 2017-04-14 17:55:28 +0200 | [diff] [blame] | 69 | printf " --port\tTCP/UDP port (default: randomish 1xxxx)\n" |
| 70 | printf " --proxy-port\tTCP/UDP proxy port (default: randomish 2xxxx)\n" |
Andres AG | f04f54d | 2016-10-10 15:46:20 +0100 | [diff] [blame] | 71 | printf " --seed\tInteger seed value to use for this test run\n" |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 72 | } |
| 73 | |
| 74 | get_options() { |
| 75 | while [ $# -gt 0 ]; do |
| 76 | case "$1" in |
Manuel Pégourié-Gonnard | 417d46c | 2014-03-13 19:17:53 +0100 | [diff] [blame] | 77 | -f|--filter) |
| 78 | shift; FILTER=$1 |
| 79 | ;; |
| 80 | -e|--exclude) |
| 81 | shift; EXCLUDE=$1 |
| 82 | ;; |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 83 | -m|--memcheck) |
| 84 | MEMCHECK=1 |
| 85 | ;; |
Paul Bakker | b7584a5 | 2016-05-10 10:50:43 +0100 | [diff] [blame] | 86 | -n|--number) |
| 87 | shift; RUN_TEST_NUMBER=$1 |
| 88 | ;; |
Paul Bakker | e20310a | 2016-05-10 11:18:17 +0100 | [diff] [blame] | 89 | -s|--show-numbers) |
| 90 | SHOW_TEST_NUMBER=1 |
| 91 | ;; |
Paul Bakker | acaac85 | 2016-05-10 11:47:13 +0100 | [diff] [blame] | 92 | -p|--preserve-logs) |
| 93 | PRESERVE_LOGS=1 |
| 94 | ;; |
Gilles Peskine | f93c7d3 | 2017-04-14 17:55:28 +0200 | [diff] [blame] | 95 | --port) |
| 96 | shift; SRV_PORT=$1 |
| 97 | ;; |
| 98 | --proxy-port) |
| 99 | shift; PXY_PORT=$1 |
| 100 | ;; |
Andres AG | f04f54d | 2016-10-10 15:46:20 +0100 | [diff] [blame] | 101 | --seed) |
| 102 | shift; SEED="$1" |
| 103 | ;; |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 104 | -h|--help) |
| 105 | print_usage |
| 106 | exit 0 |
| 107 | ;; |
| 108 | *) |
Paul Bakker | 1ebc0c5 | 2014-05-22 15:47:58 +0200 | [diff] [blame] | 109 | echo "Unknown argument: '$1'" |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 110 | print_usage |
| 111 | exit 1 |
| 112 | ;; |
| 113 | esac |
| 114 | shift |
| 115 | done |
| 116 | } |
| 117 | |
Manuel Pégourié-Gonnard | 988209f | 2015-03-24 10:43:55 +0100 | [diff] [blame] | 118 | # skip next test if the flag is not enabled in config.h |
| 119 | requires_config_enabled() { |
| 120 | if grep "^#define $1" $CONFIG_H > /dev/null; then :; else |
| 121 | SKIP_NEXT="YES" |
| 122 | fi |
| 123 | } |
| 124 | |
Manuel Pégourié-Gonnard | af63c21 | 2017-06-08 17:51:08 +0200 | [diff] [blame] | 125 | # skip next test if the flag is enabled in config.h |
| 126 | requires_config_disabled() { |
| 127 | if grep "^#define $1" $CONFIG_H > /dev/null; then |
| 128 | SKIP_NEXT="YES" |
| 129 | fi |
| 130 | } |
| 131 | |
Manuel Pégourié-Gonnard | 1cbd39d | 2014-10-20 13:34:59 +0200 | [diff] [blame] | 132 | # skip next test if OpenSSL doesn't support FALLBACK_SCSV |
| 133 | requires_openssl_with_fallback_scsv() { |
| 134 | if [ -z "${OPENSSL_HAS_FBSCSV:-}" ]; then |
| 135 | if $OPENSSL_CMD s_client -help 2>&1 | grep fallback_scsv >/dev/null |
| 136 | then |
| 137 | OPENSSL_HAS_FBSCSV="YES" |
| 138 | else |
| 139 | OPENSSL_HAS_FBSCSV="NO" |
| 140 | fi |
| 141 | fi |
| 142 | if [ "$OPENSSL_HAS_FBSCSV" = "NO" ]; then |
| 143 | SKIP_NEXT="YES" |
| 144 | fi |
| 145 | } |
| 146 | |
Manuel Pégourié-Gonnard | baa7f07 | 2014-08-20 20:15:53 +0200 | [diff] [blame] | 147 | # skip next test if GnuTLS isn't available |
| 148 | requires_gnutls() { |
| 149 | if [ -z "${GNUTLS_AVAILABLE:-}" ]; then |
Manuel Pégourié-Gonnard | 03db6b0 | 2015-06-26 15:45:30 +0200 | [diff] [blame] | 150 | if ( which "$GNUTLS_CLI" && which "$GNUTLS_SERV" ) >/dev/null 2>&1; then |
Manuel Pégourié-Gonnard | baa7f07 | 2014-08-20 20:15:53 +0200 | [diff] [blame] | 151 | GNUTLS_AVAILABLE="YES" |
| 152 | else |
| 153 | GNUTLS_AVAILABLE="NO" |
| 154 | fi |
| 155 | fi |
| 156 | if [ "$GNUTLS_AVAILABLE" = "NO" ]; then |
| 157 | SKIP_NEXT="YES" |
| 158 | fi |
| 159 | } |
| 160 | |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 161 | # skip next test if IPv6 isn't available on this host |
| 162 | requires_ipv6() { |
| 163 | if [ -z "${HAS_IPV6:-}" ]; then |
| 164 | $P_SRV server_addr='::1' > $SRV_OUT 2>&1 & |
| 165 | SRV_PID=$! |
| 166 | sleep 1 |
| 167 | kill $SRV_PID >/dev/null 2>&1 |
| 168 | if grep "NET - Binding of the socket failed" $SRV_OUT >/dev/null; then |
| 169 | HAS_IPV6="NO" |
| 170 | else |
| 171 | HAS_IPV6="YES" |
| 172 | fi |
| 173 | rm -r $SRV_OUT |
| 174 | fi |
| 175 | |
| 176 | if [ "$HAS_IPV6" = "NO" ]; then |
| 177 | SKIP_NEXT="YES" |
| 178 | fi |
| 179 | } |
| 180 | |
Manuel Pégourié-Gonnard | 76fe9e4 | 2014-09-24 15:17:31 +0200 | [diff] [blame] | 181 | # skip the next test if valgrind is in use |
| 182 | not_with_valgrind() { |
| 183 | if [ "$MEMCHECK" -gt 0 ]; then |
| 184 | SKIP_NEXT="YES" |
| 185 | fi |
| 186 | } |
| 187 | |
Paul Bakker | 362689d | 2016-05-13 10:33:25 +0100 | [diff] [blame] | 188 | # skip the next test if valgrind is NOT in use |
| 189 | only_with_valgrind() { |
| 190 | if [ "$MEMCHECK" -eq 0 ]; then |
| 191 | SKIP_NEXT="YES" |
| 192 | fi |
| 193 | } |
| 194 | |
Manuel Pégourié-Gonnard | a071972 | 2014-09-20 12:46:27 +0200 | [diff] [blame] | 195 | # multiply the client timeout delay by the given factor for the next test |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 196 | client_needs_more_time() { |
Manuel Pégourié-Gonnard | a071972 | 2014-09-20 12:46:27 +0200 | [diff] [blame] | 197 | CLI_DELAY_FACTOR=$1 |
| 198 | } |
| 199 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 200 | # wait for the given seconds after the client finished in the next test |
| 201 | server_needs_more_time() { |
| 202 | SRV_DELAY_SECONDS=$1 |
| 203 | } |
| 204 | |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 205 | # print_name <name> |
| 206 | print_name() { |
Paul Bakker | e20310a | 2016-05-10 11:18:17 +0100 | [diff] [blame] | 207 | TESTS=$(( $TESTS + 1 )) |
| 208 | LINE="" |
| 209 | |
| 210 | if [ "$SHOW_TEST_NUMBER" -gt 0 ]; then |
| 211 | LINE="$TESTS " |
| 212 | fi |
| 213 | |
| 214 | LINE="$LINE$1" |
| 215 | printf "$LINE " |
| 216 | LEN=$(( 72 - `echo "$LINE" | wc -c` )) |
Manuel Pégourié-Gonnard | f46f128 | 2014-12-11 11:51:28 +0100 | [diff] [blame] | 217 | for i in `seq 1 $LEN`; do printf '.'; done |
| 218 | printf ' ' |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 219 | |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 220 | } |
| 221 | |
| 222 | # fail <message> |
| 223 | fail() { |
| 224 | echo "FAIL" |
Manuel Pégourié-Gonnard | 3eec604 | 2014-02-27 15:37:24 +0100 | [diff] [blame] | 225 | echo " ! $1" |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 226 | |
Manuel Pégourié-Gonnard | c2b0092 | 2014-08-31 16:46:04 +0200 | [diff] [blame] | 227 | mv $SRV_OUT o-srv-${TESTS}.log |
| 228 | mv $CLI_OUT o-cli-${TESTS}.log |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 229 | if [ -n "$PXY_CMD" ]; then |
| 230 | mv $PXY_OUT o-pxy-${TESTS}.log |
| 231 | fi |
| 232 | echo " ! outputs saved to o-XXX-${TESTS}.log" |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 233 | |
Manuel Pégourié-Gonnard | 7fa6772 | 2014-08-31 17:42:53 +0200 | [diff] [blame] | 234 | if [ "X${USER:-}" = Xbuildbot -o "X${LOGNAME:-}" = Xbuildbot ]; then |
| 235 | echo " ! server output:" |
| 236 | cat o-srv-${TESTS}.log |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 237 | echo " ! ========================================================" |
Manuel Pégourié-Gonnard | 7fa6772 | 2014-08-31 17:42:53 +0200 | [diff] [blame] | 238 | echo " ! client output:" |
| 239 | cat o-cli-${TESTS}.log |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 240 | if [ -n "$PXY_CMD" ]; then |
| 241 | echo " ! ========================================================" |
| 242 | echo " ! proxy output:" |
| 243 | cat o-pxy-${TESTS}.log |
| 244 | fi |
| 245 | echo "" |
Manuel Pégourié-Gonnard | 7fa6772 | 2014-08-31 17:42:53 +0200 | [diff] [blame] | 246 | fi |
| 247 | |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 248 | FAILS=$(( $FAILS + 1 )) |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 249 | } |
| 250 | |
Manuel Pégourié-Gonnard | 677884d | 2014-02-25 16:42:31 +0100 | [diff] [blame] | 251 | # is_polar <cmd_line> |
| 252 | is_polar() { |
| 253 | echo "$1" | grep 'ssl_server2\|ssl_client2' > /dev/null |
| 254 | } |
| 255 | |
Manuel Pégourié-Gonnard | fa60f12 | 2014-09-26 16:07:29 +0200 | [diff] [blame] | 256 | # openssl s_server doesn't have -www with DTLS |
| 257 | check_osrv_dtls() { |
| 258 | if echo "$SRV_CMD" | grep 's_server.*-dtls' >/dev/null; then |
| 259 | NEEDS_INPUT=1 |
| 260 | SRV_CMD="$( echo $SRV_CMD | sed s/-www// )" |
| 261 | else |
| 262 | NEEDS_INPUT=0 |
| 263 | fi |
| 264 | } |
| 265 | |
| 266 | # provide input to commands that need it |
| 267 | provide_input() { |
| 268 | if [ $NEEDS_INPUT -eq 0 ]; then |
| 269 | return |
| 270 | fi |
| 271 | |
| 272 | while true; do |
| 273 | echo "HTTP/1.0 200 OK" |
| 274 | sleep 1 |
| 275 | done |
| 276 | } |
| 277 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 278 | # has_mem_err <log_file_name> |
| 279 | has_mem_err() { |
| 280 | if ( grep -F 'All heap blocks were freed -- no leaks are possible' "$1" && |
| 281 | grep -F 'ERROR SUMMARY: 0 errors from 0 contexts' "$1" ) > /dev/null |
| 282 | then |
| 283 | return 1 # false: does not have errors |
| 284 | else |
| 285 | return 0 # true: has errors |
| 286 | fi |
| 287 | } |
| 288 | |
Manuel Pégourié-Gonnard | 0c1ec47 | 2014-06-20 18:41:11 +0200 | [diff] [blame] | 289 | # wait for server to start: two versions depending on lsof availability |
| 290 | wait_server_start() { |
Manuel Pégourié-Gonnard | 03db6b0 | 2015-06-26 15:45:30 +0200 | [diff] [blame] | 291 | if which lsof >/dev/null 2>&1; then |
Manuel Pégourié-Gonnard | 74681fa | 2015-08-04 20:34:39 +0200 | [diff] [blame] | 292 | START_TIME=$( date +%s ) |
| 293 | DONE=0 |
Manuel Pégourié-Gonnard | 0c1ec47 | 2014-06-20 18:41:11 +0200 | [diff] [blame] | 294 | |
| 295 | # make a tight loop, server usually takes less than 1 sec to start |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 296 | if [ "$DTLS" -eq 1 ]; then |
Manuel Pégourié-Gonnard | 74681fa | 2015-08-04 20:34:39 +0200 | [diff] [blame] | 297 | while [ $DONE -eq 0 ]; do |
| 298 | if lsof -nbi UDP:"$SRV_PORT" 2>/dev/null | grep UDP >/dev/null |
| 299 | then |
| 300 | DONE=1 |
| 301 | elif [ $(( $( date +%s ) - $START_TIME )) -gt $DOG_DELAY ]; then |
| 302 | echo "SERVERSTART TIMEOUT" |
| 303 | echo "SERVERSTART TIMEOUT" >> $SRV_OUT |
| 304 | DONE=1 |
| 305 | fi |
| 306 | done |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 307 | else |
Manuel Pégourié-Gonnard | 74681fa | 2015-08-04 20:34:39 +0200 | [diff] [blame] | 308 | while [ $DONE -eq 0 ]; do |
| 309 | if lsof -nbi TCP:"$SRV_PORT" 2>/dev/null | grep LISTEN >/dev/null |
| 310 | then |
| 311 | DONE=1 |
| 312 | elif [ $(( $( date +%s ) - $START_TIME )) -gt $DOG_DELAY ]; then |
| 313 | echo "SERVERSTART TIMEOUT" |
| 314 | echo "SERVERSTART TIMEOUT" >> $SRV_OUT |
| 315 | DONE=1 |
| 316 | fi |
| 317 | done |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 318 | fi |
Manuel Pégourié-Gonnard | 0c1ec47 | 2014-06-20 18:41:11 +0200 | [diff] [blame] | 319 | else |
| 320 | sleep "$START_DELAY" |
| 321 | fi |
| 322 | } |
| 323 | |
Manuel Pégourié-Gonnard | c0f6a69 | 2014-08-30 22:41:47 +0200 | [diff] [blame] | 324 | # wait for client to terminate and set CLI_EXIT |
| 325 | # must be called right after starting the client |
| 326 | wait_client_done() { |
| 327 | CLI_PID=$! |
| 328 | |
Manuel Pégourié-Gonnard | a071972 | 2014-09-20 12:46:27 +0200 | [diff] [blame] | 329 | CLI_DELAY=$(( $DOG_DELAY * $CLI_DELAY_FACTOR )) |
| 330 | CLI_DELAY_FACTOR=1 |
| 331 | |
Manuel Pégourié-Gonnard | a365add | 2015-08-04 20:57:59 +0200 | [diff] [blame] | 332 | ( sleep $CLI_DELAY; echo "===CLIENT_TIMEOUT===" >> $CLI_OUT; kill $CLI_PID ) & |
Manuel Pégourié-Gonnard | a6189f0 | 2014-09-20 13:15:43 +0200 | [diff] [blame] | 333 | DOG_PID=$! |
Manuel Pégourié-Gonnard | c0f6a69 | 2014-08-30 22:41:47 +0200 | [diff] [blame] | 334 | |
| 335 | wait $CLI_PID |
| 336 | CLI_EXIT=$? |
| 337 | |
Manuel Pégourié-Gonnard | a6189f0 | 2014-09-20 13:15:43 +0200 | [diff] [blame] | 338 | kill $DOG_PID >/dev/null 2>&1 |
| 339 | wait $DOG_PID |
Manuel Pégourié-Gonnard | c0f6a69 | 2014-08-30 22:41:47 +0200 | [diff] [blame] | 340 | |
| 341 | echo "EXIT: $CLI_EXIT" >> $CLI_OUT |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 342 | |
| 343 | sleep $SRV_DELAY_SECONDS |
| 344 | SRV_DELAY_SECONDS=0 |
Manuel Pégourié-Gonnard | c0f6a69 | 2014-08-30 22:41:47 +0200 | [diff] [blame] | 345 | } |
| 346 | |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 347 | # check if the given command uses dtls and sets global variable DTLS |
| 348 | detect_dtls() { |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 349 | if echo "$1" | grep 'dtls=1\|-dtls1\|-u' >/dev/null; then |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 350 | DTLS=1 |
| 351 | else |
| 352 | DTLS=0 |
| 353 | fi |
| 354 | } |
| 355 | |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 356 | # Usage: run_test name [-p proxy_cmd] srv_cmd cli_cmd cli_exit [option [...]] |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 357 | # Options: -s pattern pattern that must be present in server output |
| 358 | # -c pattern pattern that must be present in client output |
Simon Butcher | 8e00410 | 2016-10-14 00:48:33 +0100 | [diff] [blame] | 359 | # -u pattern lines after pattern must be unique in client output |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 360 | # -S pattern pattern that must be absent in server output |
| 361 | # -C pattern pattern that must be absent in client output |
Simon Butcher | 8e00410 | 2016-10-14 00:48:33 +0100 | [diff] [blame] | 362 | # -U pattern lines after pattern must be unique in server output |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 363 | run_test() { |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 364 | NAME="$1" |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 365 | shift 1 |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 366 | |
Manuel Pégourié-Gonnard | 417d46c | 2014-03-13 19:17:53 +0100 | [diff] [blame] | 367 | if echo "$NAME" | grep "$FILTER" | grep -v "$EXCLUDE" >/dev/null; then : |
| 368 | else |
Manuel Pégourié-Gonnard | 74a1378 | 2014-10-14 22:34:08 +0200 | [diff] [blame] | 369 | SKIP_NEXT="NO" |
Manuel Pégourié-Gonnard | 417d46c | 2014-03-13 19:17:53 +0100 | [diff] [blame] | 370 | return |
| 371 | fi |
| 372 | |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 373 | print_name "$NAME" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 374 | |
Paul Bakker | b7584a5 | 2016-05-10 10:50:43 +0100 | [diff] [blame] | 375 | # Do we only run numbered tests? |
| 376 | if [ "X$RUN_TEST_NUMBER" = "X" ]; then : |
| 377 | elif echo ",$RUN_TEST_NUMBER," | grep ",$TESTS," >/dev/null; then : |
| 378 | else |
| 379 | SKIP_NEXT="YES" |
| 380 | fi |
| 381 | |
Manuel Pégourié-Gonnard | 6f4fbbb | 2014-08-14 14:31:29 +0200 | [diff] [blame] | 382 | # should we skip? |
| 383 | if [ "X$SKIP_NEXT" = "XYES" ]; then |
| 384 | SKIP_NEXT="NO" |
| 385 | echo "SKIP" |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 386 | SKIPS=$(( $SKIPS + 1 )) |
Manuel Pégourié-Gonnard | 6f4fbbb | 2014-08-14 14:31:29 +0200 | [diff] [blame] | 387 | return |
| 388 | fi |
| 389 | |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 390 | # does this test use a proxy? |
| 391 | if [ "X$1" = "X-p" ]; then |
| 392 | PXY_CMD="$2" |
| 393 | shift 2 |
| 394 | else |
| 395 | PXY_CMD="" |
| 396 | fi |
| 397 | |
| 398 | # get commands and client output |
| 399 | SRV_CMD="$1" |
| 400 | CLI_CMD="$2" |
| 401 | CLI_EXPECT="$3" |
| 402 | shift 3 |
| 403 | |
| 404 | # fix client port |
| 405 | if [ -n "$PXY_CMD" ]; then |
| 406 | CLI_CMD=$( echo "$CLI_CMD" | sed s/+SRV_PORT/$PXY_PORT/g ) |
| 407 | else |
| 408 | CLI_CMD=$( echo "$CLI_CMD" | sed s/+SRV_PORT/$SRV_PORT/g ) |
| 409 | fi |
| 410 | |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 411 | # update DTLS variable |
| 412 | detect_dtls "$SRV_CMD" |
| 413 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 414 | # prepend valgrind to our commands if active |
| 415 | if [ "$MEMCHECK" -gt 0 ]; then |
| 416 | if is_polar "$SRV_CMD"; then |
| 417 | SRV_CMD="valgrind --leak-check=full $SRV_CMD" |
| 418 | fi |
| 419 | if is_polar "$CLI_CMD"; then |
| 420 | CLI_CMD="valgrind --leak-check=full $CLI_CMD" |
| 421 | fi |
| 422 | fi |
| 423 | |
Manuel Pégourié-Gonnard | a365add | 2015-08-04 20:57:59 +0200 | [diff] [blame] | 424 | TIMES_LEFT=2 |
| 425 | while [ $TIMES_LEFT -gt 0 ]; do |
Manuel Pégourié-Gonnard | ab5f7b4 | 2015-08-04 21:01:37 +0200 | [diff] [blame] | 426 | TIMES_LEFT=$(( $TIMES_LEFT - 1 )) |
Manuel Pégourié-Gonnard | a365add | 2015-08-04 20:57:59 +0200 | [diff] [blame] | 427 | |
Manuel Pégourié-Gonnard | ab5f7b4 | 2015-08-04 21:01:37 +0200 | [diff] [blame] | 428 | # run the commands |
| 429 | if [ -n "$PXY_CMD" ]; then |
| 430 | echo "$PXY_CMD" > $PXY_OUT |
| 431 | $PXY_CMD >> $PXY_OUT 2>&1 & |
| 432 | PXY_PID=$! |
| 433 | # assume proxy starts faster than server |
| 434 | fi |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 435 | |
Manuel Pégourié-Gonnard | ab5f7b4 | 2015-08-04 21:01:37 +0200 | [diff] [blame] | 436 | check_osrv_dtls |
| 437 | echo "$SRV_CMD" > $SRV_OUT |
| 438 | provide_input | $SRV_CMD >> $SRV_OUT 2>&1 & |
| 439 | SRV_PID=$! |
| 440 | wait_server_start |
Manuel Pégourié-Gonnard | c0f6a69 | 2014-08-30 22:41:47 +0200 | [diff] [blame] | 441 | |
Manuel Pégourié-Gonnard | ab5f7b4 | 2015-08-04 21:01:37 +0200 | [diff] [blame] | 442 | echo "$CLI_CMD" > $CLI_OUT |
| 443 | eval "$CLI_CMD" >> $CLI_OUT 2>&1 & |
| 444 | wait_client_done |
Manuel Pégourié-Gonnard | e01af4c | 2014-03-25 14:16:44 +0100 | [diff] [blame] | 445 | |
Manuel Pégourié-Gonnard | ab5f7b4 | 2015-08-04 21:01:37 +0200 | [diff] [blame] | 446 | # terminate the server (and the proxy) |
| 447 | kill $SRV_PID |
| 448 | wait $SRV_PID |
| 449 | if [ -n "$PXY_CMD" ]; then |
| 450 | kill $PXY_PID >/dev/null 2>&1 |
| 451 | wait $PXY_PID |
| 452 | fi |
Manuel Pégourié-Gonnard | 677884d | 2014-02-25 16:42:31 +0100 | [diff] [blame] | 453 | |
Manuel Pégourié-Gonnard | ab5f7b4 | 2015-08-04 21:01:37 +0200 | [diff] [blame] | 454 | # retry only on timeouts |
| 455 | if grep '===CLIENT_TIMEOUT===' $CLI_OUT >/dev/null; then |
| 456 | printf "RETRY " |
| 457 | else |
| 458 | TIMES_LEFT=0 |
| 459 | fi |
Manuel Pégourié-Gonnard | a365add | 2015-08-04 20:57:59 +0200 | [diff] [blame] | 460 | done |
| 461 | |
Manuel Pégourié-Gonnard | 677884d | 2014-02-25 16:42:31 +0100 | [diff] [blame] | 462 | # check if the client and server went at least to the handshake stage |
Paul Bakker | 1ebc0c5 | 2014-05-22 15:47:58 +0200 | [diff] [blame] | 463 | # (useful to avoid tests with only negative assertions and non-zero |
Manuel Pégourié-Gonnard | 677884d | 2014-02-25 16:42:31 +0100 | [diff] [blame] | 464 | # expected client exit to incorrectly succeed in case of catastrophic |
| 465 | # failure) |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 466 | if is_polar "$SRV_CMD"; then |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 467 | if grep "Performing the SSL/TLS handshake" $SRV_OUT >/dev/null; then :; |
Manuel Pégourié-Gonnard | 677884d | 2014-02-25 16:42:31 +0100 | [diff] [blame] | 468 | else |
Manuel Pégourié-Gonnard | 699cafa | 2014-10-27 13:57:03 +0100 | [diff] [blame] | 469 | fail "server or client failed to reach handshake stage" |
Manuel Pégourié-Gonnard | 677884d | 2014-02-25 16:42:31 +0100 | [diff] [blame] | 470 | return |
| 471 | fi |
| 472 | fi |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 473 | if is_polar "$CLI_CMD"; then |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 474 | if grep "Performing the SSL/TLS handshake" $CLI_OUT >/dev/null; then :; |
Manuel Pégourié-Gonnard | 677884d | 2014-02-25 16:42:31 +0100 | [diff] [blame] | 475 | else |
Manuel Pégourié-Gonnard | 699cafa | 2014-10-27 13:57:03 +0100 | [diff] [blame] | 476 | fail "server or client failed to reach handshake stage" |
Manuel Pégourié-Gonnard | 677884d | 2014-02-25 16:42:31 +0100 | [diff] [blame] | 477 | return |
| 478 | fi |
| 479 | fi |
| 480 | |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 481 | # check server exit code |
| 482 | if [ $? != 0 ]; then |
| 483 | fail "server fail" |
| 484 | return |
| 485 | fi |
| 486 | |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 487 | # check client exit code |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 488 | if [ \( "$CLI_EXPECT" = 0 -a "$CLI_EXIT" != 0 \) -o \ |
| 489 | \( "$CLI_EXPECT" != 0 -a "$CLI_EXIT" = 0 \) ] |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 490 | then |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 491 | fail "bad client exit code (expected $CLI_EXPECT, got $CLI_EXIT)" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 492 | return |
| 493 | fi |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 494 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 495 | # check other assertions |
Manuel Pégourié-Gonnard | 480905d | 2014-08-21 19:38:32 +0200 | [diff] [blame] | 496 | # lines beginning with == are added by valgrind, ignore them |
Paul Bakker | 1f65092 | 2016-05-13 10:16:46 +0100 | [diff] [blame] | 497 | # lines with 'Serious error when reading debug info', are valgrind issues as well |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 498 | while [ $# -gt 0 ] |
| 499 | do |
| 500 | case $1 in |
| 501 | "-s") |
Paul Bakker | 1f65092 | 2016-05-13 10:16:46 +0100 | [diff] [blame] | 502 | if grep -v '^==' $SRV_OUT | grep -v 'Serious error when reading debug info' | grep "$2" >/dev/null; then :; else |
Simon Butcher | 8e00410 | 2016-10-14 00:48:33 +0100 | [diff] [blame] | 503 | fail "pattern '$2' MUST be present in the Server output" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 504 | return |
| 505 | fi |
| 506 | ;; |
| 507 | |
| 508 | "-c") |
Paul Bakker | 1f65092 | 2016-05-13 10:16:46 +0100 | [diff] [blame] | 509 | if grep -v '^==' $CLI_OUT | grep -v 'Serious error when reading debug info' | grep "$2" >/dev/null; then :; else |
Simon Butcher | 8e00410 | 2016-10-14 00:48:33 +0100 | [diff] [blame] | 510 | fail "pattern '$2' MUST be present in the Client output" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 511 | return |
| 512 | fi |
| 513 | ;; |
| 514 | |
| 515 | "-S") |
Paul Bakker | 1f65092 | 2016-05-13 10:16:46 +0100 | [diff] [blame] | 516 | if grep -v '^==' $SRV_OUT | grep -v 'Serious error when reading debug info' | grep "$2" >/dev/null; then |
Simon Butcher | 8e00410 | 2016-10-14 00:48:33 +0100 | [diff] [blame] | 517 | fail "pattern '$2' MUST NOT be present in the Server output" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 518 | return |
| 519 | fi |
| 520 | ;; |
| 521 | |
| 522 | "-C") |
Paul Bakker | 1f65092 | 2016-05-13 10:16:46 +0100 | [diff] [blame] | 523 | if grep -v '^==' $CLI_OUT | grep -v 'Serious error when reading debug info' | grep "$2" >/dev/null; then |
Simon Butcher | 8e00410 | 2016-10-14 00:48:33 +0100 | [diff] [blame] | 524 | fail "pattern '$2' MUST NOT be present in the Client output" |
| 525 | return |
| 526 | fi |
| 527 | ;; |
| 528 | |
| 529 | # The filtering in the following two options (-u and -U) do the following |
| 530 | # - ignore valgrind output |
| 531 | # - filter out everything but lines right after the pattern occurances |
| 532 | # - keep one of each non-unique line |
| 533 | # - count how many lines remain |
| 534 | # A line with '--' will remain in the result from previous outputs, so the number of lines in the result will be 1 |
| 535 | # if there were no duplicates. |
| 536 | "-U") |
| 537 | if [ $(grep -v '^==' $SRV_OUT | grep -v 'Serious error when reading debug info' | grep -A1 "$2" | grep -v "$2" | sort | uniq -d | wc -l) -gt 1 ]; then |
| 538 | fail "lines following pattern '$2' must be unique in Server output" |
| 539 | return |
| 540 | fi |
| 541 | ;; |
| 542 | |
| 543 | "-u") |
| 544 | if [ $(grep -v '^==' $CLI_OUT | grep -v 'Serious error when reading debug info' | grep -A1 "$2" | grep -v "$2" | sort | uniq -d | wc -l) -gt 1 ]; then |
| 545 | fail "lines following pattern '$2' must be unique in Client output" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 546 | return |
| 547 | fi |
| 548 | ;; |
| 549 | |
| 550 | *) |
Paul Bakker | 1ebc0c5 | 2014-05-22 15:47:58 +0200 | [diff] [blame] | 551 | echo "Unknown test: $1" >&2 |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 552 | exit 1 |
| 553 | esac |
| 554 | shift 2 |
| 555 | done |
| 556 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 557 | # check valgrind's results |
| 558 | if [ "$MEMCHECK" -gt 0 ]; then |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 559 | if is_polar "$SRV_CMD" && has_mem_err $SRV_OUT; then |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 560 | fail "Server has memory errors" |
| 561 | return |
| 562 | fi |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 563 | if is_polar "$CLI_CMD" && has_mem_err $CLI_OUT; then |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 564 | fail "Client has memory errors" |
| 565 | return |
| 566 | fi |
| 567 | fi |
| 568 | |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 569 | # if we're here, everything is ok |
| 570 | echo "PASS" |
Paul Bakker | acaac85 | 2016-05-10 11:47:13 +0100 | [diff] [blame] | 571 | if [ "$PRESERVE_LOGS" -gt 0 ]; then |
| 572 | mv $SRV_OUT o-srv-${TESTS}.log |
| 573 | mv $CLI_OUT o-cli-${TESTS}.log |
| 574 | fi |
| 575 | |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 576 | rm -f $SRV_OUT $CLI_OUT $PXY_OUT |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 577 | } |
| 578 | |
Manuel Pégourié-Gonnard | a9062e9 | 2014-02-25 16:21:22 +0100 | [diff] [blame] | 579 | cleanup() { |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 580 | rm -f $CLI_OUT $SRV_OUT $PXY_OUT $SESSION |
Manuel Pégourié-Gonnard | a6189f0 | 2014-09-20 13:15:43 +0200 | [diff] [blame] | 581 | test -n "${SRV_PID:-}" && kill $SRV_PID >/dev/null 2>&1 |
| 582 | test -n "${PXY_PID:-}" && kill $PXY_PID >/dev/null 2>&1 |
| 583 | test -n "${CLI_PID:-}" && kill $CLI_PID >/dev/null 2>&1 |
| 584 | test -n "${DOG_PID:-}" && kill $DOG_PID >/dev/null 2>&1 |
Manuel Pégourié-Gonnard | a9062e9 | 2014-02-25 16:21:22 +0100 | [diff] [blame] | 585 | exit 1 |
| 586 | } |
| 587 | |
Manuel Pégourié-Gonnard | 9dea8bd | 2014-02-26 18:21:02 +0100 | [diff] [blame] | 588 | # |
| 589 | # MAIN |
| 590 | # |
| 591 | |
Manuel Pégourié-Gonnard | 19db8ea | 2015-03-10 13:41:04 +0000 | [diff] [blame] | 592 | if cd $( dirname $0 ); then :; else |
| 593 | echo "cd $( dirname $0 ) failed" >&2 |
| 594 | exit 1 |
| 595 | fi |
| 596 | |
Manuel Pégourié-Gonnard | 913030c | 2014-03-28 10:12:38 +0100 | [diff] [blame] | 597 | get_options "$@" |
| 598 | |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 599 | # sanity checks, avoid an avalanche of errors |
| 600 | if [ ! -x "$P_SRV" ]; then |
| 601 | echo "Command '$P_SRV' is not an executable file" |
| 602 | exit 1 |
| 603 | fi |
| 604 | if [ ! -x "$P_CLI" ]; then |
| 605 | echo "Command '$P_CLI' is not an executable file" |
| 606 | exit 1 |
| 607 | fi |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 608 | if [ ! -x "$P_PXY" ]; then |
| 609 | echo "Command '$P_PXY' is not an executable file" |
| 610 | exit 1 |
| 611 | fi |
Simon Butcher | 3c0d7b8 | 2016-05-23 11:13:17 +0100 | [diff] [blame] | 612 | if [ "$MEMCHECK" -gt 0 ]; then |
| 613 | if which valgrind >/dev/null 2>&1; then :; else |
| 614 | echo "Memcheck not possible. Valgrind not found" |
| 615 | exit 1 |
| 616 | fi |
| 617 | fi |
Manuel Pégourié-Gonnard | 74faf3c | 2014-03-13 18:47:44 +0100 | [diff] [blame] | 618 | if which $OPENSSL_CMD >/dev/null 2>&1; then :; else |
| 619 | echo "Command '$OPENSSL_CMD' not found" |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 620 | exit 1 |
| 621 | fi |
| 622 | |
Manuel Pégourié-Gonnard | 32f8f4d | 2014-05-29 11:31:20 +0200 | [diff] [blame] | 623 | # used by watchdog |
| 624 | MAIN_PID="$$" |
| 625 | |
Manuel Pégourié-Gonnard | 0c1ec47 | 2014-06-20 18:41:11 +0200 | [diff] [blame] | 626 | # be more patient with valgrind |
| 627 | if [ "$MEMCHECK" -gt 0 ]; then |
| 628 | START_DELAY=3 |
| 629 | DOG_DELAY=30 |
| 630 | else |
| 631 | START_DELAY=1 |
| 632 | DOG_DELAY=10 |
| 633 | fi |
Manuel Pégourié-Gonnard | a071972 | 2014-09-20 12:46:27 +0200 | [diff] [blame] | 634 | CLI_DELAY_FACTOR=1 |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 635 | SRV_DELAY_SECONDS=0 |
Manuel Pégourié-Gonnard | 0c1ec47 | 2014-06-20 18:41:11 +0200 | [diff] [blame] | 636 | |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 637 | # fix commands to use this port, force IPv4 while at it |
Manuel Pégourié-Gonnard | 0af1ba3 | 2015-01-21 11:44:33 +0000 | [diff] [blame] | 638 | # +SRV_PORT will be replaced by either $SRV_PORT or $PXY_PORT later |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 639 | P_SRV="$P_SRV server_addr=127.0.0.1 server_port=$SRV_PORT" |
| 640 | P_CLI="$P_CLI server_addr=127.0.0.1 server_port=+SRV_PORT" |
Andres AG | f04f54d | 2016-10-10 15:46:20 +0100 | [diff] [blame] | 641 | P_PXY="$P_PXY server_addr=127.0.0.1 server_port=$SRV_PORT listen_addr=127.0.0.1 listen_port=$PXY_PORT ${SEED:+"seed=$SEED"}" |
Manuel Pégourié-Gonnard | 6195767 | 2015-06-18 17:54:58 +0200 | [diff] [blame] | 642 | O_SRV="$O_SRV -accept $SRV_PORT -dhparam data_files/dhparams.pem" |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 643 | O_CLI="$O_CLI -connect localhost:+SRV_PORT" |
| 644 | G_SRV="$G_SRV -p $SRV_PORT" |
Manuel Pégourié-Gonnard | 0af1ba3 | 2015-01-21 11:44:33 +0000 | [diff] [blame] | 645 | G_CLI="$G_CLI -p +SRV_PORT localhost" |
Manuel Pégourié-Gonnard | 8066b81 | 2014-05-28 22:59:30 +0200 | [diff] [blame] | 646 | |
Gilles Peskine | 62469d9 | 2017-05-10 10:13:59 +0200 | [diff] [blame] | 647 | # Allow SHA-1, because many of our test certificates use it |
| 648 | P_SRV="$P_SRV allow_sha1=1" |
| 649 | P_CLI="$P_CLI allow_sha1=1" |
| 650 | |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 651 | # Also pick a unique name for intermediate files |
| 652 | SRV_OUT="srv_out.$$" |
| 653 | CLI_OUT="cli_out.$$" |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 654 | PXY_OUT="pxy_out.$$" |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 655 | SESSION="session.$$" |
| 656 | |
Manuel Pégourié-Gonnard | 6f4fbbb | 2014-08-14 14:31:29 +0200 | [diff] [blame] | 657 | SKIP_NEXT="NO" |
| 658 | |
Manuel Pégourié-Gonnard | a9062e9 | 2014-02-25 16:21:22 +0100 | [diff] [blame] | 659 | trap cleanup INT TERM HUP |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 660 | |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 661 | # Basic test |
| 662 | |
Manuel Pégourié-Gonnard | 480905d | 2014-08-21 19:38:32 +0200 | [diff] [blame] | 663 | # Checks that: |
| 664 | # - things work with all ciphersuites active (used with config-full in all.sh) |
| 665 | # - the expected (highest security) parameters are selected |
| 666 | # ("signature_algorithm ext: 6" means SHA-512 (highest common hash)) |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 667 | run_test "Default" \ |
Manuel Pégourié-Gonnard | 480905d | 2014-08-21 19:38:32 +0200 | [diff] [blame] | 668 | "$P_SRV debug_level=3" \ |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 669 | "$P_CLI" \ |
| 670 | 0 \ |
Manuel Pégourié-Gonnard | 480905d | 2014-08-21 19:38:32 +0200 | [diff] [blame] | 671 | -s "Protocol is TLSv1.2" \ |
| 672 | -s "Ciphersuite is TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384" \ |
| 673 | -s "client hello v3, signature_algorithm ext: 6" \ |
| 674 | -s "ECDHE curve: secp521r1" \ |
| 675 | -S "error" \ |
| 676 | -C "error" |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 677 | |
Manuel Pégourié-Gonnard | 3bb0801 | 2015-01-22 13:34:21 +0000 | [diff] [blame] | 678 | run_test "Default, DTLS" \ |
| 679 | "$P_SRV dtls=1" \ |
| 680 | "$P_CLI dtls=1" \ |
| 681 | 0 \ |
| 682 | -s "Protocol is DTLSv1.2" \ |
| 683 | -s "Ciphersuite is TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384" |
| 684 | |
Simon Butcher | 8e00410 | 2016-10-14 00:48:33 +0100 | [diff] [blame] | 685 | # Test for uniqueness of IVs in AEAD ciphersuites |
| 686 | run_test "Unique IV in GCM" \ |
| 687 | "$P_SRV exchanges=20 debug_level=4" \ |
| 688 | "$P_CLI exchanges=20 debug_level=4 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384" \ |
| 689 | 0 \ |
| 690 | -u "IV used" \ |
| 691 | -U "IV used" |
| 692 | |
Manuel Pégourié-Gonnard | bd47a58 | 2015-01-12 13:43:29 +0100 | [diff] [blame] | 693 | # Tests for rc4 option |
| 694 | |
Simon Butcher | a410af5 | 2016-05-19 22:12:18 +0100 | [diff] [blame] | 695 | requires_config_enabled MBEDTLS_REMOVE_ARC4_CIPHERSUITES |
Manuel Pégourié-Gonnard | bd47a58 | 2015-01-12 13:43:29 +0100 | [diff] [blame] | 696 | run_test "RC4: server disabled, client enabled" \ |
| 697 | "$P_SRV" \ |
| 698 | "$P_CLI force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 699 | 1 \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 700 | -s "SSL - The server has no ciphersuites in common" |
| 701 | |
Simon Butcher | a410af5 | 2016-05-19 22:12:18 +0100 | [diff] [blame] | 702 | requires_config_enabled MBEDTLS_REMOVE_ARC4_CIPHERSUITES |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 703 | run_test "RC4: server half, client enabled" \ |
| 704 | "$P_SRV arc4=1" \ |
| 705 | "$P_CLI force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 706 | 1 \ |
| 707 | -s "SSL - The server has no ciphersuites in common" |
Manuel Pégourié-Gonnard | bd47a58 | 2015-01-12 13:43:29 +0100 | [diff] [blame] | 708 | |
| 709 | run_test "RC4: server enabled, client disabled" \ |
| 710 | "$P_SRV force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 711 | "$P_CLI" \ |
| 712 | 1 \ |
| 713 | -s "SSL - The server has no ciphersuites in common" |
| 714 | |
| 715 | run_test "RC4: both enabled" \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 716 | "$P_SRV force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
Manuel Pégourié-Gonnard | bd47a58 | 2015-01-12 13:43:29 +0100 | [diff] [blame] | 717 | "$P_CLI force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 718 | 0 \ |
Manuel Pégourié-Gonnard | 51d8166 | 2015-01-14 17:20:46 +0100 | [diff] [blame] | 719 | -S "SSL - None of the common ciphersuites is usable" \ |
Manuel Pégourié-Gonnard | bd47a58 | 2015-01-12 13:43:29 +0100 | [diff] [blame] | 720 | -S "SSL - The server has no ciphersuites in common" |
| 721 | |
Gilles Peskine | bc70a18 | 2017-05-09 15:59:24 +0200 | [diff] [blame] | 722 | # Tests for SHA-1 support |
| 723 | |
Manuel Pégourié-Gonnard | af63c21 | 2017-06-08 17:51:08 +0200 | [diff] [blame] | 724 | requires_config_disabled MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES |
Gilles Peskine | bc70a18 | 2017-05-09 15:59:24 +0200 | [diff] [blame] | 725 | run_test "SHA-1 forbidden by default in server certificate" \ |
| 726 | "$P_SRV key_file=data_files/server2.key crt_file=data_files/server2.crt" \ |
| 727 | "$P_CLI debug_level=2 allow_sha1=0" \ |
| 728 | 1 \ |
| 729 | -c "The certificate is signed with an unacceptable hash" |
| 730 | |
Manuel Pégourié-Gonnard | af63c21 | 2017-06-08 17:51:08 +0200 | [diff] [blame] | 731 | requires_config_enabled MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES |
| 732 | run_test "SHA-1 forbidden by default in server certificate" \ |
| 733 | "$P_SRV key_file=data_files/server2.key crt_file=data_files/server2.crt" \ |
| 734 | "$P_CLI debug_level=2 allow_sha1=0" \ |
| 735 | 0 |
| 736 | |
Gilles Peskine | bc70a18 | 2017-05-09 15:59:24 +0200 | [diff] [blame] | 737 | run_test "SHA-1 explicitly allowed in server certificate" \ |
| 738 | "$P_SRV key_file=data_files/server2.key crt_file=data_files/server2.crt" \ |
| 739 | "$P_CLI allow_sha1=1" \ |
| 740 | 0 |
| 741 | |
| 742 | run_test "SHA-256 allowed by default in server certificate" \ |
| 743 | "$P_SRV key_file=data_files/server2.key crt_file=data_files/server2-sha256.crt" \ |
| 744 | "$P_CLI allow_sha1=0" \ |
| 745 | 0 |
| 746 | |
Manuel Pégourié-Gonnard | af63c21 | 2017-06-08 17:51:08 +0200 | [diff] [blame] | 747 | requires_config_disabled MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES |
Gilles Peskine | bc70a18 | 2017-05-09 15:59:24 +0200 | [diff] [blame] | 748 | run_test "SHA-1 forbidden by default in client certificate" \ |
| 749 | "$P_SRV auth_mode=required allow_sha1=0" \ |
| 750 | "$P_CLI key_file=data_files/cli-rsa.key crt_file=data_files/cli-rsa-sha1.crt" \ |
| 751 | 1 \ |
| 752 | -s "The certificate is signed with an unacceptable hash" |
| 753 | |
Manuel Pégourié-Gonnard | af63c21 | 2017-06-08 17:51:08 +0200 | [diff] [blame] | 754 | requires_config_enabled MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES |
| 755 | run_test "SHA-1 forbidden by default in client certificate" \ |
| 756 | "$P_SRV auth_mode=required allow_sha1=0" \ |
| 757 | "$P_CLI key_file=data_files/cli-rsa.key crt_file=data_files/cli-rsa-sha1.crt" \ |
| 758 | 0 |
| 759 | |
Gilles Peskine | bc70a18 | 2017-05-09 15:59:24 +0200 | [diff] [blame] | 760 | run_test "SHA-1 explicitly allowed in client certificate" \ |
| 761 | "$P_SRV auth_mode=required allow_sha1=1" \ |
| 762 | "$P_CLI key_file=data_files/cli-rsa.key crt_file=data_files/cli-rsa-sha1.crt" \ |
| 763 | 0 |
| 764 | |
| 765 | run_test "SHA-256 allowed by default in client certificate" \ |
| 766 | "$P_SRV auth_mode=required allow_sha1=0" \ |
| 767 | "$P_CLI key_file=data_files/cli-rsa.key crt_file=data_files/cli-rsa-sha256.crt" \ |
| 768 | 0 |
| 769 | |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 770 | # Tests for Truncated HMAC extension |
| 771 | |
Manuel Pégourié-Gonnard | e117a8f | 2015-01-09 12:39:35 +0100 | [diff] [blame] | 772 | run_test "Truncated HMAC: client default, server default" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 773 | "$P_SRV debug_level=4" \ |
Manuel Pégourié-Gonnard | e117a8f | 2015-01-09 12:39:35 +0100 | [diff] [blame] | 774 | "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 775 | 0 \ |
Manuel Pégourié-Gonnard | e117a8f | 2015-01-09 12:39:35 +0100 | [diff] [blame] | 776 | -s "dumping 'computed mac' (20 bytes)" \ |
| 777 | -S "dumping 'computed mac' (10 bytes)" |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 778 | |
Manuel Pégourié-Gonnard | e117a8f | 2015-01-09 12:39:35 +0100 | [diff] [blame] | 779 | run_test "Truncated HMAC: client disabled, server default" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 780 | "$P_SRV debug_level=4" \ |
Manuel Pégourié-Gonnard | e117a8f | 2015-01-09 12:39:35 +0100 | [diff] [blame] | 781 | "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA \ |
| 782 | trunc_hmac=0" \ |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 783 | 0 \ |
Manuel Pégourié-Gonnard | e117a8f | 2015-01-09 12:39:35 +0100 | [diff] [blame] | 784 | -s "dumping 'computed mac' (20 bytes)" \ |
| 785 | -S "dumping 'computed mac' (10 bytes)" |
| 786 | |
| 787 | run_test "Truncated HMAC: client enabled, server default" \ |
| 788 | "$P_SRV debug_level=4" \ |
| 789 | "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA \ |
| 790 | trunc_hmac=1" \ |
| 791 | 0 \ |
Manuel Pégourié-Gonnard | 662c6e8 | 2015-05-06 17:39:23 +0100 | [diff] [blame] | 792 | -s "dumping 'computed mac' (20 bytes)" \ |
| 793 | -S "dumping 'computed mac' (10 bytes)" |
Manuel Pégourié-Gonnard | e117a8f | 2015-01-09 12:39:35 +0100 | [diff] [blame] | 794 | |
| 795 | run_test "Truncated HMAC: client enabled, server disabled" \ |
| 796 | "$P_SRV debug_level=4 trunc_hmac=0" \ |
| 797 | "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA \ |
| 798 | trunc_hmac=1" \ |
| 799 | 0 \ |
| 800 | -s "dumping 'computed mac' (20 bytes)" \ |
| 801 | -S "dumping 'computed mac' (10 bytes)" |
| 802 | |
| 803 | run_test "Truncated HMAC: client enabled, server enabled" \ |
| 804 | "$P_SRV debug_level=4 trunc_hmac=1" \ |
| 805 | "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA \ |
| 806 | trunc_hmac=1" \ |
| 807 | 0 \ |
| 808 | -S "dumping 'computed mac' (20 bytes)" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 809 | -s "dumping 'computed mac' (10 bytes)" |
| 810 | |
Manuel Pégourié-Gonnard | 699cafa | 2014-10-27 13:57:03 +0100 | [diff] [blame] | 811 | # Tests for Encrypt-then-MAC extension |
| 812 | |
| 813 | run_test "Encrypt then MAC: default" \ |
Manuel Pégourié-Gonnard | 0098e7d | 2014-10-28 13:08:59 +0100 | [diff] [blame] | 814 | "$P_SRV debug_level=3 \ |
| 815 | force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
Manuel Pégourié-Gonnard | 699cafa | 2014-10-27 13:57:03 +0100 | [diff] [blame] | 816 | "$P_CLI debug_level=3" \ |
| 817 | 0 \ |
| 818 | -c "client hello, adding encrypt_then_mac extension" \ |
| 819 | -s "found encrypt then mac extension" \ |
| 820 | -s "server hello, adding encrypt then mac extension" \ |
| 821 | -c "found encrypt_then_mac extension" \ |
| 822 | -c "using encrypt then mac" \ |
| 823 | -s "using encrypt then mac" |
| 824 | |
| 825 | run_test "Encrypt then MAC: client enabled, server disabled" \ |
Manuel Pégourié-Gonnard | 0098e7d | 2014-10-28 13:08:59 +0100 | [diff] [blame] | 826 | "$P_SRV debug_level=3 etm=0 \ |
| 827 | force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
Manuel Pégourié-Gonnard | 699cafa | 2014-10-27 13:57:03 +0100 | [diff] [blame] | 828 | "$P_CLI debug_level=3 etm=1" \ |
| 829 | 0 \ |
| 830 | -c "client hello, adding encrypt_then_mac extension" \ |
| 831 | -s "found encrypt then mac extension" \ |
| 832 | -S "server hello, adding encrypt then mac extension" \ |
| 833 | -C "found encrypt_then_mac extension" \ |
| 834 | -C "using encrypt then mac" \ |
| 835 | -S "using encrypt then mac" |
| 836 | |
Manuel Pégourié-Gonnard | 78e745f | 2014-11-04 15:44:06 +0100 | [diff] [blame] | 837 | run_test "Encrypt then MAC: client enabled, aead cipher" \ |
| 838 | "$P_SRV debug_level=3 etm=1 \ |
| 839 | force_ciphersuite=TLS-RSA-WITH-AES-128-GCM-SHA256" \ |
| 840 | "$P_CLI debug_level=3 etm=1" \ |
| 841 | 0 \ |
| 842 | -c "client hello, adding encrypt_then_mac extension" \ |
| 843 | -s "found encrypt then mac extension" \ |
| 844 | -S "server hello, adding encrypt then mac extension" \ |
| 845 | -C "found encrypt_then_mac extension" \ |
| 846 | -C "using encrypt then mac" \ |
| 847 | -S "using encrypt then mac" |
| 848 | |
| 849 | run_test "Encrypt then MAC: client enabled, stream cipher" \ |
| 850 | "$P_SRV debug_level=3 etm=1 \ |
| 851 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 852 | "$P_CLI debug_level=3 etm=1 arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
Manuel Pégourié-Gonnard | 78e745f | 2014-11-04 15:44:06 +0100 | [diff] [blame] | 853 | 0 \ |
| 854 | -c "client hello, adding encrypt_then_mac extension" \ |
| 855 | -s "found encrypt then mac extension" \ |
| 856 | -S "server hello, adding encrypt then mac extension" \ |
| 857 | -C "found encrypt_then_mac extension" \ |
| 858 | -C "using encrypt then mac" \ |
| 859 | -S "using encrypt then mac" |
| 860 | |
Manuel Pégourié-Gonnard | 699cafa | 2014-10-27 13:57:03 +0100 | [diff] [blame] | 861 | run_test "Encrypt then MAC: client disabled, server enabled" \ |
Manuel Pégourié-Gonnard | 0098e7d | 2014-10-28 13:08:59 +0100 | [diff] [blame] | 862 | "$P_SRV debug_level=3 etm=1 \ |
| 863 | force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
Manuel Pégourié-Gonnard | 699cafa | 2014-10-27 13:57:03 +0100 | [diff] [blame] | 864 | "$P_CLI debug_level=3 etm=0" \ |
| 865 | 0 \ |
| 866 | -C "client hello, adding encrypt_then_mac extension" \ |
| 867 | -S "found encrypt then mac extension" \ |
| 868 | -S "server hello, adding encrypt then mac extension" \ |
| 869 | -C "found encrypt_then_mac extension" \ |
| 870 | -C "using encrypt then mac" \ |
| 871 | -S "using encrypt then mac" |
| 872 | |
Janos Follath | e2681a4 | 2016-03-07 15:57:05 +0000 | [diff] [blame] | 873 | requires_config_enabled MBEDTLS_SSL_PROTO_SSL3 |
Manuel Pégourié-Gonnard | 699cafa | 2014-10-27 13:57:03 +0100 | [diff] [blame] | 874 | run_test "Encrypt then MAC: client SSLv3, server enabled" \ |
Manuel Pégourié-Gonnard | 51d8166 | 2015-01-14 17:20:46 +0100 | [diff] [blame] | 875 | "$P_SRV debug_level=3 min_version=ssl3 \ |
Manuel Pégourié-Gonnard | 0098e7d | 2014-10-28 13:08:59 +0100 | [diff] [blame] | 876 | force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
Manuel Pégourié-Gonnard | 699cafa | 2014-10-27 13:57:03 +0100 | [diff] [blame] | 877 | "$P_CLI debug_level=3 force_version=ssl3" \ |
| 878 | 0 \ |
| 879 | -C "client hello, adding encrypt_then_mac extension" \ |
| 880 | -S "found encrypt then mac extension" \ |
| 881 | -S "server hello, adding encrypt then mac extension" \ |
| 882 | -C "found encrypt_then_mac extension" \ |
| 883 | -C "using encrypt then mac" \ |
| 884 | -S "using encrypt then mac" |
| 885 | |
Janos Follath | e2681a4 | 2016-03-07 15:57:05 +0000 | [diff] [blame] | 886 | requires_config_enabled MBEDTLS_SSL_PROTO_SSL3 |
Manuel Pégourié-Gonnard | 699cafa | 2014-10-27 13:57:03 +0100 | [diff] [blame] | 887 | run_test "Encrypt then MAC: client enabled, server SSLv3" \ |
Manuel Pégourié-Gonnard | 0098e7d | 2014-10-28 13:08:59 +0100 | [diff] [blame] | 888 | "$P_SRV debug_level=3 force_version=ssl3 \ |
| 889 | force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
Manuel Pégourié-Gonnard | 51d8166 | 2015-01-14 17:20:46 +0100 | [diff] [blame] | 890 | "$P_CLI debug_level=3 min_version=ssl3" \ |
Manuel Pégourié-Gonnard | 699cafa | 2014-10-27 13:57:03 +0100 | [diff] [blame] | 891 | 0 \ |
| 892 | -c "client hello, adding encrypt_then_mac extension" \ |
Janos Follath | 00efff7 | 2016-05-06 13:48:23 +0100 | [diff] [blame] | 893 | -S "found encrypt then mac extension" \ |
Manuel Pégourié-Gonnard | 699cafa | 2014-10-27 13:57:03 +0100 | [diff] [blame] | 894 | -S "server hello, adding encrypt then mac extension" \ |
| 895 | -C "found encrypt_then_mac extension" \ |
| 896 | -C "using encrypt then mac" \ |
| 897 | -S "using encrypt then mac" |
| 898 | |
Manuel Pégourié-Gonnard | 367381f | 2014-10-20 18:40:56 +0200 | [diff] [blame] | 899 | # Tests for Extended Master Secret extension |
| 900 | |
| 901 | run_test "Extended Master Secret: default" \ |
| 902 | "$P_SRV debug_level=3" \ |
| 903 | "$P_CLI debug_level=3" \ |
| 904 | 0 \ |
| 905 | -c "client hello, adding extended_master_secret extension" \ |
| 906 | -s "found extended master secret extension" \ |
| 907 | -s "server hello, adding extended master secret extension" \ |
| 908 | -c "found extended_master_secret extension" \ |
| 909 | -c "using extended master secret" \ |
| 910 | -s "using extended master secret" |
| 911 | |
| 912 | run_test "Extended Master Secret: client enabled, server disabled" \ |
| 913 | "$P_SRV debug_level=3 extended_ms=0" \ |
| 914 | "$P_CLI debug_level=3 extended_ms=1" \ |
| 915 | 0 \ |
| 916 | -c "client hello, adding extended_master_secret extension" \ |
| 917 | -s "found extended master secret extension" \ |
| 918 | -S "server hello, adding extended master secret extension" \ |
| 919 | -C "found extended_master_secret extension" \ |
| 920 | -C "using extended master secret" \ |
| 921 | -S "using extended master secret" |
| 922 | |
| 923 | run_test "Extended Master Secret: client disabled, server enabled" \ |
| 924 | "$P_SRV debug_level=3 extended_ms=1" \ |
| 925 | "$P_CLI debug_level=3 extended_ms=0" \ |
| 926 | 0 \ |
| 927 | -C "client hello, adding extended_master_secret extension" \ |
| 928 | -S "found extended master secret extension" \ |
| 929 | -S "server hello, adding extended master secret extension" \ |
| 930 | -C "found extended_master_secret extension" \ |
| 931 | -C "using extended master secret" \ |
| 932 | -S "using extended master secret" |
| 933 | |
Janos Follath | e2681a4 | 2016-03-07 15:57:05 +0000 | [diff] [blame] | 934 | requires_config_enabled MBEDTLS_SSL_PROTO_SSL3 |
Manuel Pégourié-Gonnard | b575b54 | 2014-10-24 15:12:31 +0200 | [diff] [blame] | 935 | run_test "Extended Master Secret: client SSLv3, server enabled" \ |
Manuel Pégourié-Gonnard | 51d8166 | 2015-01-14 17:20:46 +0100 | [diff] [blame] | 936 | "$P_SRV debug_level=3 min_version=ssl3" \ |
Manuel Pégourié-Gonnard | b575b54 | 2014-10-24 15:12:31 +0200 | [diff] [blame] | 937 | "$P_CLI debug_level=3 force_version=ssl3" \ |
| 938 | 0 \ |
| 939 | -C "client hello, adding extended_master_secret extension" \ |
| 940 | -S "found extended master secret extension" \ |
| 941 | -S "server hello, adding extended master secret extension" \ |
| 942 | -C "found extended_master_secret extension" \ |
| 943 | -C "using extended master secret" \ |
| 944 | -S "using extended master secret" |
| 945 | |
Janos Follath | e2681a4 | 2016-03-07 15:57:05 +0000 | [diff] [blame] | 946 | requires_config_enabled MBEDTLS_SSL_PROTO_SSL3 |
Manuel Pégourié-Gonnard | b575b54 | 2014-10-24 15:12:31 +0200 | [diff] [blame] | 947 | run_test "Extended Master Secret: client enabled, server SSLv3" \ |
| 948 | "$P_SRV debug_level=3 force_version=ssl3" \ |
Manuel Pégourié-Gonnard | 51d8166 | 2015-01-14 17:20:46 +0100 | [diff] [blame] | 949 | "$P_CLI debug_level=3 min_version=ssl3" \ |
Manuel Pégourié-Gonnard | b575b54 | 2014-10-24 15:12:31 +0200 | [diff] [blame] | 950 | 0 \ |
| 951 | -c "client hello, adding extended_master_secret extension" \ |
Janos Follath | 00efff7 | 2016-05-06 13:48:23 +0100 | [diff] [blame] | 952 | -S "found extended master secret extension" \ |
Manuel Pégourié-Gonnard | b575b54 | 2014-10-24 15:12:31 +0200 | [diff] [blame] | 953 | -S "server hello, adding extended master secret extension" \ |
| 954 | -C "found extended_master_secret extension" \ |
| 955 | -C "using extended master secret" \ |
| 956 | -S "using extended master secret" |
| 957 | |
Manuel Pégourié-Gonnard | 1cbd39d | 2014-10-20 13:34:59 +0200 | [diff] [blame] | 958 | # Tests for FALLBACK_SCSV |
| 959 | |
| 960 | run_test "Fallback SCSV: default" \ |
Manuel Pégourié-Gonnard | 4268ae0 | 2015-08-04 12:44:10 +0200 | [diff] [blame] | 961 | "$P_SRV debug_level=2" \ |
Manuel Pégourié-Gonnard | 1cbd39d | 2014-10-20 13:34:59 +0200 | [diff] [blame] | 962 | "$P_CLI debug_level=3 force_version=tls1_1" \ |
| 963 | 0 \ |
| 964 | -C "adding FALLBACK_SCSV" \ |
Manuel Pégourié-Gonnard | 01b2699 | 2014-10-20 14:05:28 +0200 | [diff] [blame] | 965 | -S "received FALLBACK_SCSV" \ |
| 966 | -S "inapropriate fallback" \ |
Manuel Pégourié-Gonnard | 1cbd39d | 2014-10-20 13:34:59 +0200 | [diff] [blame] | 967 | -C "is a fatal alert message (msg 86)" |
| 968 | |
| 969 | run_test "Fallback SCSV: explicitly disabled" \ |
Manuel Pégourié-Gonnard | 4268ae0 | 2015-08-04 12:44:10 +0200 | [diff] [blame] | 970 | "$P_SRV debug_level=2" \ |
Manuel Pégourié-Gonnard | 1cbd39d | 2014-10-20 13:34:59 +0200 | [diff] [blame] | 971 | "$P_CLI debug_level=3 force_version=tls1_1 fallback=0" \ |
| 972 | 0 \ |
| 973 | -C "adding FALLBACK_SCSV" \ |
Manuel Pégourié-Gonnard | 01b2699 | 2014-10-20 14:05:28 +0200 | [diff] [blame] | 974 | -S "received FALLBACK_SCSV" \ |
| 975 | -S "inapropriate fallback" \ |
Manuel Pégourié-Gonnard | 1cbd39d | 2014-10-20 13:34:59 +0200 | [diff] [blame] | 976 | -C "is a fatal alert message (msg 86)" |
| 977 | |
| 978 | run_test "Fallback SCSV: enabled" \ |
Manuel Pégourié-Gonnard | 4268ae0 | 2015-08-04 12:44:10 +0200 | [diff] [blame] | 979 | "$P_SRV debug_level=2" \ |
Manuel Pégourié-Gonnard | 1cbd39d | 2014-10-20 13:34:59 +0200 | [diff] [blame] | 980 | "$P_CLI debug_level=3 force_version=tls1_1 fallback=1" \ |
Manuel Pégourié-Gonnard | 01b2699 | 2014-10-20 14:05:28 +0200 | [diff] [blame] | 981 | 1 \ |
| 982 | -c "adding FALLBACK_SCSV" \ |
| 983 | -s "received FALLBACK_SCSV" \ |
| 984 | -s "inapropriate fallback" \ |
| 985 | -c "is a fatal alert message (msg 86)" |
| 986 | |
| 987 | run_test "Fallback SCSV: enabled, max version" \ |
Manuel Pégourié-Gonnard | 4268ae0 | 2015-08-04 12:44:10 +0200 | [diff] [blame] | 988 | "$P_SRV debug_level=2" \ |
Manuel Pégourié-Gonnard | 01b2699 | 2014-10-20 14:05:28 +0200 | [diff] [blame] | 989 | "$P_CLI debug_level=3 fallback=1" \ |
Manuel Pégourié-Gonnard | 1cbd39d | 2014-10-20 13:34:59 +0200 | [diff] [blame] | 990 | 0 \ |
| 991 | -c "adding FALLBACK_SCSV" \ |
Manuel Pégourié-Gonnard | 01b2699 | 2014-10-20 14:05:28 +0200 | [diff] [blame] | 992 | -s "received FALLBACK_SCSV" \ |
| 993 | -S "inapropriate fallback" \ |
Manuel Pégourié-Gonnard | 1cbd39d | 2014-10-20 13:34:59 +0200 | [diff] [blame] | 994 | -C "is a fatal alert message (msg 86)" |
| 995 | |
| 996 | requires_openssl_with_fallback_scsv |
| 997 | run_test "Fallback SCSV: default, openssl server" \ |
| 998 | "$O_SRV" \ |
| 999 | "$P_CLI debug_level=3 force_version=tls1_1 fallback=0" \ |
| 1000 | 0 \ |
| 1001 | -C "adding FALLBACK_SCSV" \ |
| 1002 | -C "is a fatal alert message (msg 86)" |
| 1003 | |
| 1004 | requires_openssl_with_fallback_scsv |
| 1005 | run_test "Fallback SCSV: enabled, openssl server" \ |
| 1006 | "$O_SRV" \ |
| 1007 | "$P_CLI debug_level=3 force_version=tls1_1 fallback=1" \ |
| 1008 | 1 \ |
| 1009 | -c "adding FALLBACK_SCSV" \ |
| 1010 | -c "is a fatal alert message (msg 86)" |
| 1011 | |
Manuel Pégourié-Gonnard | 01b2699 | 2014-10-20 14:05:28 +0200 | [diff] [blame] | 1012 | requires_openssl_with_fallback_scsv |
| 1013 | run_test "Fallback SCSV: disabled, openssl client" \ |
Manuel Pégourié-Gonnard | 4268ae0 | 2015-08-04 12:44:10 +0200 | [diff] [blame] | 1014 | "$P_SRV debug_level=2" \ |
Manuel Pégourié-Gonnard | 01b2699 | 2014-10-20 14:05:28 +0200 | [diff] [blame] | 1015 | "$O_CLI -tls1_1" \ |
| 1016 | 0 \ |
| 1017 | -S "received FALLBACK_SCSV" \ |
| 1018 | -S "inapropriate fallback" |
| 1019 | |
| 1020 | requires_openssl_with_fallback_scsv |
| 1021 | run_test "Fallback SCSV: enabled, openssl client" \ |
Manuel Pégourié-Gonnard | 4268ae0 | 2015-08-04 12:44:10 +0200 | [diff] [blame] | 1022 | "$P_SRV debug_level=2" \ |
Manuel Pégourié-Gonnard | 01b2699 | 2014-10-20 14:05:28 +0200 | [diff] [blame] | 1023 | "$O_CLI -tls1_1 -fallback_scsv" \ |
| 1024 | 1 \ |
| 1025 | -s "received FALLBACK_SCSV" \ |
| 1026 | -s "inapropriate fallback" |
| 1027 | |
| 1028 | requires_openssl_with_fallback_scsv |
| 1029 | run_test "Fallback SCSV: enabled, max version, openssl client" \ |
Manuel Pégourié-Gonnard | 4268ae0 | 2015-08-04 12:44:10 +0200 | [diff] [blame] | 1030 | "$P_SRV debug_level=2" \ |
Manuel Pégourié-Gonnard | 01b2699 | 2014-10-20 14:05:28 +0200 | [diff] [blame] | 1031 | "$O_CLI -fallback_scsv" \ |
| 1032 | 0 \ |
| 1033 | -s "received FALLBACK_SCSV" \ |
| 1034 | -S "inapropriate fallback" |
| 1035 | |
Gilles Peskine | d50177f | 2017-05-16 17:53:03 +0200 | [diff] [blame] | 1036 | ## ClientHello generated with |
| 1037 | ## "openssl s_client -CAfile tests/data_files/test-ca.crt -tls1_1 -connect localhost:4433 -cipher ..." |
| 1038 | ## then manually twiddling the ciphersuite list. |
| 1039 | ## The ClientHello content is spelled out below as a hex string as |
| 1040 | ## "prefix ciphersuite1 ciphersuite2 ciphersuite3 ciphersuite4 suffix". |
| 1041 | ## The expected response is an inappropriate_fallback alert. |
| 1042 | requires_openssl_with_fallback_scsv |
| 1043 | run_test "Fallback SCSV: beginning of list" \ |
| 1044 | "$P_SRV debug_level=2" \ |
| 1045 | "$TCP_CLIENT localhost $SRV_PORT '160301003e0100003a03022aafb94308dc22ca1086c65acc00e414384d76b61ecab37df1633b1ae1034dbe000008 5600 0031 0032 0033 0100000900230000000f000101' '15030200020256'" \ |
| 1046 | 0 \ |
| 1047 | -s "received FALLBACK_SCSV" \ |
| 1048 | -s "inapropriate fallback" |
| 1049 | |
| 1050 | requires_openssl_with_fallback_scsv |
| 1051 | run_test "Fallback SCSV: end of list" \ |
| 1052 | "$P_SRV debug_level=2" \ |
| 1053 | "$TCP_CLIENT localhost $SRV_PORT '160301003e0100003a03022aafb94308dc22ca1086c65acc00e414384d76b61ecab37df1633b1ae1034dbe000008 0031 0032 0033 5600 0100000900230000000f000101' '15030200020256'" \ |
| 1054 | 0 \ |
| 1055 | -s "received FALLBACK_SCSV" \ |
| 1056 | -s "inapropriate fallback" |
| 1057 | |
| 1058 | ## Here the expected response is a valid ServerHello prefix, up to the random. |
| 1059 | requires_openssl_with_fallback_scsv |
| 1060 | run_test "Fallback SCSV: not in list" \ |
| 1061 | "$P_SRV debug_level=2" \ |
| 1062 | "$TCP_CLIENT localhost $SRV_PORT '160301003e0100003a03022aafb94308dc22ca1086c65acc00e414384d76b61ecab37df1633b1ae1034dbe000008 0056 0031 0032 0033 0100000900230000000f000101' '16030200300200002c0302'" \ |
| 1063 | 0 \ |
| 1064 | -S "received FALLBACK_SCSV" \ |
| 1065 | -S "inapropriate fallback" |
| 1066 | |
Manuel Pégourié-Gonnard | 3ff7823 | 2015-01-08 11:15:09 +0100 | [diff] [blame] | 1067 | # Tests for CBC 1/n-1 record splitting |
| 1068 | |
| 1069 | run_test "CBC Record splitting: TLS 1.2, no splitting" \ |
| 1070 | "$P_SRV" \ |
| 1071 | "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA \ |
| 1072 | request_size=123 force_version=tls1_2" \ |
| 1073 | 0 \ |
| 1074 | -s "Read from client: 123 bytes read" \ |
| 1075 | -S "Read from client: 1 bytes read" \ |
| 1076 | -S "122 bytes read" |
| 1077 | |
| 1078 | run_test "CBC Record splitting: TLS 1.1, no splitting" \ |
| 1079 | "$P_SRV" \ |
| 1080 | "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA \ |
| 1081 | request_size=123 force_version=tls1_1" \ |
| 1082 | 0 \ |
| 1083 | -s "Read from client: 123 bytes read" \ |
| 1084 | -S "Read from client: 1 bytes read" \ |
| 1085 | -S "122 bytes read" |
| 1086 | |
| 1087 | run_test "CBC Record splitting: TLS 1.0, splitting" \ |
| 1088 | "$P_SRV" \ |
| 1089 | "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA \ |
| 1090 | request_size=123 force_version=tls1" \ |
| 1091 | 0 \ |
| 1092 | -S "Read from client: 123 bytes read" \ |
| 1093 | -s "Read from client: 1 bytes read" \ |
| 1094 | -s "122 bytes read" |
| 1095 | |
Janos Follath | e2681a4 | 2016-03-07 15:57:05 +0000 | [diff] [blame] | 1096 | requires_config_enabled MBEDTLS_SSL_PROTO_SSL3 |
Manuel Pégourié-Gonnard | 3ff7823 | 2015-01-08 11:15:09 +0100 | [diff] [blame] | 1097 | run_test "CBC Record splitting: SSLv3, splitting" \ |
Manuel Pégourié-Gonnard | 51d8166 | 2015-01-14 17:20:46 +0100 | [diff] [blame] | 1098 | "$P_SRV min_version=ssl3" \ |
Manuel Pégourié-Gonnard | 3ff7823 | 2015-01-08 11:15:09 +0100 | [diff] [blame] | 1099 | "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA \ |
| 1100 | request_size=123 force_version=ssl3" \ |
| 1101 | 0 \ |
| 1102 | -S "Read from client: 123 bytes read" \ |
| 1103 | -s "Read from client: 1 bytes read" \ |
| 1104 | -s "122 bytes read" |
| 1105 | |
| 1106 | run_test "CBC Record splitting: TLS 1.0 RC4, no splitting" \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 1107 | "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
Manuel Pégourié-Gonnard | 3ff7823 | 2015-01-08 11:15:09 +0100 | [diff] [blame] | 1108 | "$P_CLI force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \ |
| 1109 | request_size=123 force_version=tls1" \ |
| 1110 | 0 \ |
| 1111 | -s "Read from client: 123 bytes read" \ |
| 1112 | -S "Read from client: 1 bytes read" \ |
| 1113 | -S "122 bytes read" |
| 1114 | |
| 1115 | run_test "CBC Record splitting: TLS 1.0, splitting disabled" \ |
| 1116 | "$P_SRV" \ |
| 1117 | "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA \ |
| 1118 | request_size=123 force_version=tls1 recsplit=0" \ |
| 1119 | 0 \ |
| 1120 | -s "Read from client: 123 bytes read" \ |
| 1121 | -S "Read from client: 1 bytes read" \ |
| 1122 | -S "122 bytes read" |
| 1123 | |
Manuel Pégourié-Gonnard | a852cf4 | 2015-01-13 20:56:15 +0100 | [diff] [blame] | 1124 | run_test "CBC Record splitting: TLS 1.0, splitting, nbio" \ |
| 1125 | "$P_SRV nbio=2" \ |
| 1126 | "$P_CLI nbio=2 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA \ |
| 1127 | request_size=123 force_version=tls1" \ |
| 1128 | 0 \ |
| 1129 | -S "Read from client: 123 bytes read" \ |
| 1130 | -s "Read from client: 1 bytes read" \ |
| 1131 | -s "122 bytes read" |
| 1132 | |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 1133 | # Tests for Session Tickets |
| 1134 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1135 | run_test "Session resume using tickets: basic" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1136 | "$P_SRV debug_level=3 tickets=1" \ |
| 1137 | "$P_CLI debug_level=3 tickets=1 reconnect=1" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 1138 | 0 \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 1139 | -c "client hello, adding session ticket extension" \ |
| 1140 | -s "found session ticket extension" \ |
| 1141 | -s "server hello, adding session ticket extension" \ |
| 1142 | -c "found session_ticket extension" \ |
| 1143 | -c "parse new session ticket" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 1144 | -S "session successfully restored from cache" \ |
| 1145 | -s "session successfully restored from ticket" \ |
| 1146 | -s "a session has been resumed" \ |
| 1147 | -c "a session has been resumed" |
| 1148 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1149 | run_test "Session resume using tickets: cache disabled" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1150 | "$P_SRV debug_level=3 tickets=1 cache_max=0" \ |
| 1151 | "$P_CLI debug_level=3 tickets=1 reconnect=1" \ |
Manuel Pégourié-Gonnard | dbe1ee1 | 2014-02-21 09:18:13 +0100 | [diff] [blame] | 1152 | 0 \ |
| 1153 | -c "client hello, adding session ticket extension" \ |
| 1154 | -s "found session ticket extension" \ |
| 1155 | -s "server hello, adding session ticket extension" \ |
| 1156 | -c "found session_ticket extension" \ |
| 1157 | -c "parse new session ticket" \ |
| 1158 | -S "session successfully restored from cache" \ |
| 1159 | -s "session successfully restored from ticket" \ |
| 1160 | -s "a session has been resumed" \ |
| 1161 | -c "a session has been resumed" |
| 1162 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1163 | run_test "Session resume using tickets: timeout" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1164 | "$P_SRV debug_level=3 tickets=1 cache_max=0 ticket_timeout=1" \ |
| 1165 | "$P_CLI debug_level=3 tickets=1 reconnect=1 reco_delay=2" \ |
Manuel Pégourié-Gonnard | dbe1ee1 | 2014-02-21 09:18:13 +0100 | [diff] [blame] | 1166 | 0 \ |
| 1167 | -c "client hello, adding session ticket extension" \ |
| 1168 | -s "found session ticket extension" \ |
| 1169 | -s "server hello, adding session ticket extension" \ |
| 1170 | -c "found session_ticket extension" \ |
| 1171 | -c "parse new session ticket" \ |
| 1172 | -S "session successfully restored from cache" \ |
| 1173 | -S "session successfully restored from ticket" \ |
| 1174 | -S "a session has been resumed" \ |
| 1175 | -C "a session has been resumed" |
| 1176 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1177 | run_test "Session resume using tickets: openssl server" \ |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 1178 | "$O_SRV" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1179 | "$P_CLI debug_level=3 tickets=1 reconnect=1" \ |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 1180 | 0 \ |
| 1181 | -c "client hello, adding session ticket extension" \ |
| 1182 | -c "found session_ticket extension" \ |
| 1183 | -c "parse new session ticket" \ |
| 1184 | -c "a session has been resumed" |
| 1185 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1186 | run_test "Session resume using tickets: openssl client" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1187 | "$P_SRV debug_level=3 tickets=1" \ |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 1188 | "( $O_CLI -sess_out $SESSION; \ |
| 1189 | $O_CLI -sess_in $SESSION; \ |
| 1190 | rm -f $SESSION )" \ |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 1191 | 0 \ |
| 1192 | -s "found session ticket extension" \ |
| 1193 | -s "server hello, adding session ticket extension" \ |
| 1194 | -S "session successfully restored from cache" \ |
| 1195 | -s "session successfully restored from ticket" \ |
| 1196 | -s "a session has been resumed" |
| 1197 | |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 1198 | # Tests for Session Resume based on session-ID and cache |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 1199 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1200 | run_test "Session resume using cache: tickets enabled on client" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1201 | "$P_SRV debug_level=3 tickets=0" \ |
| 1202 | "$P_CLI debug_level=3 tickets=1 reconnect=1" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 1203 | 0 \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 1204 | -c "client hello, adding session ticket extension" \ |
| 1205 | -s "found session ticket extension" \ |
| 1206 | -S "server hello, adding session ticket extension" \ |
| 1207 | -C "found session_ticket extension" \ |
| 1208 | -C "parse new session ticket" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 1209 | -s "session successfully restored from cache" \ |
| 1210 | -S "session successfully restored from ticket" \ |
| 1211 | -s "a session has been resumed" \ |
| 1212 | -c "a session has been resumed" |
| 1213 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1214 | run_test "Session resume using cache: tickets enabled on server" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1215 | "$P_SRV debug_level=3 tickets=1" \ |
| 1216 | "$P_CLI debug_level=3 tickets=0 reconnect=1" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 1217 | 0 \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 1218 | -C "client hello, adding session ticket extension" \ |
| 1219 | -S "found session ticket extension" \ |
| 1220 | -S "server hello, adding session ticket extension" \ |
| 1221 | -C "found session_ticket extension" \ |
| 1222 | -C "parse new session ticket" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 1223 | -s "session successfully restored from cache" \ |
| 1224 | -S "session successfully restored from ticket" \ |
| 1225 | -s "a session has been resumed" \ |
| 1226 | -c "a session has been resumed" |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 1227 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1228 | run_test "Session resume using cache: cache_max=0" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1229 | "$P_SRV debug_level=3 tickets=0 cache_max=0" \ |
| 1230 | "$P_CLI debug_level=3 tickets=0 reconnect=1" \ |
Manuel Pégourié-Gonnard | 4c88345 | 2014-02-20 21:32:41 +0100 | [diff] [blame] | 1231 | 0 \ |
| 1232 | -S "session successfully restored from cache" \ |
| 1233 | -S "session successfully restored from ticket" \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 1234 | -S "a session has been resumed" \ |
| 1235 | -C "a session has been resumed" |
Manuel Pégourié-Gonnard | 4c88345 | 2014-02-20 21:32:41 +0100 | [diff] [blame] | 1236 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1237 | run_test "Session resume using cache: cache_max=1" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1238 | "$P_SRV debug_level=3 tickets=0 cache_max=1" \ |
| 1239 | "$P_CLI debug_level=3 tickets=0 reconnect=1" \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 1240 | 0 \ |
| 1241 | -s "session successfully restored from cache" \ |
| 1242 | -S "session successfully restored from ticket" \ |
| 1243 | -s "a session has been resumed" \ |
| 1244 | -c "a session has been resumed" |
| 1245 | |
Manuel Pégourié-Gonnard | 6df3196 | 2015-05-04 10:55:47 +0200 | [diff] [blame] | 1246 | run_test "Session resume using cache: timeout > delay" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1247 | "$P_SRV debug_level=3 tickets=0" \ |
| 1248 | "$P_CLI debug_level=3 tickets=0 reconnect=1 reco_delay=0" \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 1249 | 0 \ |
| 1250 | -s "session successfully restored from cache" \ |
| 1251 | -S "session successfully restored from ticket" \ |
| 1252 | -s "a session has been resumed" \ |
| 1253 | -c "a session has been resumed" |
| 1254 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1255 | run_test "Session resume using cache: timeout < delay" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1256 | "$P_SRV debug_level=3 tickets=0 cache_timeout=1" \ |
| 1257 | "$P_CLI debug_level=3 tickets=0 reconnect=1 reco_delay=2" \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 1258 | 0 \ |
| 1259 | -S "session successfully restored from cache" \ |
| 1260 | -S "session successfully restored from ticket" \ |
| 1261 | -S "a session has been resumed" \ |
| 1262 | -C "a session has been resumed" |
| 1263 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1264 | run_test "Session resume using cache: no timeout" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1265 | "$P_SRV debug_level=3 tickets=0 cache_timeout=0" \ |
| 1266 | "$P_CLI debug_level=3 tickets=0 reconnect=1 reco_delay=2" \ |
Manuel Pégourié-Gonnard | 4c88345 | 2014-02-20 21:32:41 +0100 | [diff] [blame] | 1267 | 0 \ |
| 1268 | -s "session successfully restored from cache" \ |
| 1269 | -S "session successfully restored from ticket" \ |
| 1270 | -s "a session has been resumed" \ |
| 1271 | -c "a session has been resumed" |
| 1272 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1273 | run_test "Session resume using cache: openssl client" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1274 | "$P_SRV debug_level=3 tickets=0" \ |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 1275 | "( $O_CLI -sess_out $SESSION; \ |
| 1276 | $O_CLI -sess_in $SESSION; \ |
| 1277 | rm -f $SESSION )" \ |
Manuel Pégourié-Gonnard | db735f6 | 2014-02-25 17:57:59 +0100 | [diff] [blame] | 1278 | 0 \ |
| 1279 | -s "found session ticket extension" \ |
| 1280 | -S "server hello, adding session ticket extension" \ |
| 1281 | -s "session successfully restored from cache" \ |
| 1282 | -S "session successfully restored from ticket" \ |
| 1283 | -s "a session has been resumed" |
| 1284 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1285 | run_test "Session resume using cache: openssl server" \ |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 1286 | "$O_SRV" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1287 | "$P_CLI debug_level=3 tickets=0 reconnect=1" \ |
Manuel Pégourié-Gonnard | db735f6 | 2014-02-25 17:57:59 +0100 | [diff] [blame] | 1288 | 0 \ |
| 1289 | -C "found session_ticket extension" \ |
| 1290 | -C "parse new session ticket" \ |
| 1291 | -c "a session has been resumed" |
| 1292 | |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 1293 | # Tests for Max Fragment Length extension |
| 1294 | |
Hanno Becker | 4aed27e | 2017-09-18 15:00:34 +0100 | [diff] [blame] | 1295 | requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
Hanno Becker | c526696 | 2017-09-18 15:01:50 +0100 | [diff] [blame^] | 1296 | run_test "Max fragment length: enabled, default" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1297 | "$P_SRV debug_level=3" \ |
| 1298 | "$P_CLI debug_level=3" \ |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 1299 | 0 \ |
Manuel Pégourié-Gonnard | a2cda6b | 2015-08-31 18:30:52 +0200 | [diff] [blame] | 1300 | -c "Maximum fragment length is 16384" \ |
| 1301 | -s "Maximum fragment length is 16384" \ |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 1302 | -C "client hello, adding max_fragment_length extension" \ |
| 1303 | -S "found max fragment length extension" \ |
| 1304 | -S "server hello, max_fragment_length extension" \ |
| 1305 | -C "found max_fragment_length extension" |
| 1306 | |
Hanno Becker | 4aed27e | 2017-09-18 15:00:34 +0100 | [diff] [blame] | 1307 | requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
Hanno Becker | c526696 | 2017-09-18 15:01:50 +0100 | [diff] [blame^] | 1308 | run_test "Max fragment length: enabled, default, larger message" \ |
| 1309 | "$P_SRV debug_level=3" \ |
| 1310 | "$P_CLI debug_level=3 request_size=20000" \ |
| 1311 | 0 \ |
| 1312 | -c "Maximum fragment length is 16384" \ |
| 1313 | -s "Maximum fragment length is 16384" \ |
| 1314 | -C "client hello, adding max_fragment_length extension" \ |
| 1315 | -S "found max fragment length extension" \ |
| 1316 | -S "server hello, max_fragment_length extension" \ |
| 1317 | -C "found max_fragment_length extension" \ |
| 1318 | -c "20000 bytes written in 2 fragments" \ |
| 1319 | -s "16384 bytes read" \ |
| 1320 | -s "3616 bytes read" |
| 1321 | |
| 1322 | requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| 1323 | run_test "Max fragment length, DTLS: enabled, default, larger message" \ |
| 1324 | "$P_SRV debug_level=3 dtls=1" \ |
| 1325 | "$P_CLI debug_level=3 dtls=1 request_size=20000" \ |
| 1326 | 1 \ |
| 1327 | -c "Maximum fragment length is 16384" \ |
| 1328 | -s "Maximum fragment length is 16384" \ |
| 1329 | -C "client hello, adding max_fragment_length extension" \ |
| 1330 | -S "found max fragment length extension" \ |
| 1331 | -S "server hello, max_fragment_length extension" \ |
| 1332 | -C "found max_fragment_length extension" \ |
| 1333 | -c "fragment larger than.*maximum " |
| 1334 | |
| 1335 | requires_config_disabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| 1336 | run_test "Max fragment length: disabled, larger message" \ |
| 1337 | "$P_SRV debug_level=3" \ |
| 1338 | "$P_CLI debug_level=3 request_size=20000" \ |
| 1339 | 0 \ |
| 1340 | -C "Maximum fragment length is 16384" \ |
| 1341 | -S "Maximum fragment length is 16384" \ |
| 1342 | -c "20000 bytes written in 2 fragments" \ |
| 1343 | -s "16384 bytes read" \ |
| 1344 | -s "3616 bytes read" |
| 1345 | |
| 1346 | requires_config_disabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| 1347 | run_test "Max fragment length DTLS: disabled, larger message" \ |
| 1348 | "$P_SRV debug_level=3 dtls=1" \ |
| 1349 | "$P_CLI debug_level=3 dtls=1 request_size=20000" \ |
| 1350 | 1 \ |
| 1351 | -C "Maximum fragment length is 16384" \ |
| 1352 | -S "Maximum fragment length is 16384" \ |
| 1353 | -c "fragment larger than.*maximum " |
| 1354 | |
| 1355 | requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1356 | run_test "Max fragment length: used by client" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1357 | "$P_SRV debug_level=3" \ |
| 1358 | "$P_CLI debug_level=3 max_frag_len=4096" \ |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 1359 | 0 \ |
Manuel Pégourié-Gonnard | a2cda6b | 2015-08-31 18:30:52 +0200 | [diff] [blame] | 1360 | -c "Maximum fragment length is 4096" \ |
| 1361 | -s "Maximum fragment length is 4096" \ |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 1362 | -c "client hello, adding max_fragment_length extension" \ |
| 1363 | -s "found max fragment length extension" \ |
| 1364 | -s "server hello, max_fragment_length extension" \ |
| 1365 | -c "found max_fragment_length extension" |
| 1366 | |
Hanno Becker | 4aed27e | 2017-09-18 15:00:34 +0100 | [diff] [blame] | 1367 | requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1368 | run_test "Max fragment length: used by server" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1369 | "$P_SRV debug_level=3 max_frag_len=4096" \ |
| 1370 | "$P_CLI debug_level=3" \ |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 1371 | 0 \ |
Manuel Pégourié-Gonnard | a2cda6b | 2015-08-31 18:30:52 +0200 | [diff] [blame] | 1372 | -c "Maximum fragment length is 16384" \ |
| 1373 | -s "Maximum fragment length is 4096" \ |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 1374 | -C "client hello, adding max_fragment_length extension" \ |
| 1375 | -S "found max fragment length extension" \ |
| 1376 | -S "server hello, max_fragment_length extension" \ |
| 1377 | -C "found max_fragment_length extension" |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 1378 | |
Hanno Becker | 4aed27e | 2017-09-18 15:00:34 +0100 | [diff] [blame] | 1379 | requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1380 | requires_gnutls |
| 1381 | run_test "Max fragment length: gnutls server" \ |
Manuel Pégourié-Gonnard | baa7f07 | 2014-08-20 20:15:53 +0200 | [diff] [blame] | 1382 | "$G_SRV" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1383 | "$P_CLI debug_level=3 max_frag_len=4096" \ |
Manuel Pégourié-Gonnard | baa7f07 | 2014-08-20 20:15:53 +0200 | [diff] [blame] | 1384 | 0 \ |
Manuel Pégourié-Gonnard | a2cda6b | 2015-08-31 18:30:52 +0200 | [diff] [blame] | 1385 | -c "Maximum fragment length is 4096" \ |
Manuel Pégourié-Gonnard | baa7f07 | 2014-08-20 20:15:53 +0200 | [diff] [blame] | 1386 | -c "client hello, adding max_fragment_length extension" \ |
| 1387 | -c "found max_fragment_length extension" |
| 1388 | |
Hanno Becker | 4aed27e | 2017-09-18 15:00:34 +0100 | [diff] [blame] | 1389 | requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
Manuel Pégourié-Gonnard | 37e08e1 | 2014-10-13 17:55:52 +0200 | [diff] [blame] | 1390 | run_test "Max fragment length: client, message just fits" \ |
| 1391 | "$P_SRV debug_level=3" \ |
| 1392 | "$P_CLI debug_level=3 max_frag_len=2048 request_size=2048" \ |
| 1393 | 0 \ |
Manuel Pégourié-Gonnard | a2cda6b | 2015-08-31 18:30:52 +0200 | [diff] [blame] | 1394 | -c "Maximum fragment length is 2048" \ |
| 1395 | -s "Maximum fragment length is 2048" \ |
Manuel Pégourié-Gonnard | 37e08e1 | 2014-10-13 17:55:52 +0200 | [diff] [blame] | 1396 | -c "client hello, adding max_fragment_length extension" \ |
| 1397 | -s "found max fragment length extension" \ |
| 1398 | -s "server hello, max_fragment_length extension" \ |
| 1399 | -c "found max_fragment_length extension" \ |
| 1400 | -c "2048 bytes written in 1 fragments" \ |
| 1401 | -s "2048 bytes read" |
| 1402 | |
Hanno Becker | 4aed27e | 2017-09-18 15:00:34 +0100 | [diff] [blame] | 1403 | requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
Manuel Pégourié-Gonnard | 37e08e1 | 2014-10-13 17:55:52 +0200 | [diff] [blame] | 1404 | run_test "Max fragment length: client, larger message" \ |
| 1405 | "$P_SRV debug_level=3" \ |
| 1406 | "$P_CLI debug_level=3 max_frag_len=2048 request_size=2345" \ |
| 1407 | 0 \ |
Manuel Pégourié-Gonnard | a2cda6b | 2015-08-31 18:30:52 +0200 | [diff] [blame] | 1408 | -c "Maximum fragment length is 2048" \ |
| 1409 | -s "Maximum fragment length is 2048" \ |
Manuel Pégourié-Gonnard | 37e08e1 | 2014-10-13 17:55:52 +0200 | [diff] [blame] | 1410 | -c "client hello, adding max_fragment_length extension" \ |
| 1411 | -s "found max fragment length extension" \ |
| 1412 | -s "server hello, max_fragment_length extension" \ |
| 1413 | -c "found max_fragment_length extension" \ |
| 1414 | -c "2345 bytes written in 2 fragments" \ |
| 1415 | -s "2048 bytes read" \ |
| 1416 | -s "297 bytes read" |
| 1417 | |
Hanno Becker | 4aed27e | 2017-09-18 15:00:34 +0100 | [diff] [blame] | 1418 | requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
Manuel Pégourié-Gonnard | 23eb74d | 2015-01-21 14:37:13 +0000 | [diff] [blame] | 1419 | run_test "Max fragment length: DTLS client, larger message" \ |
Manuel Pégourié-Gonnard | 37e08e1 | 2014-10-13 17:55:52 +0200 | [diff] [blame] | 1420 | "$P_SRV debug_level=3 dtls=1" \ |
| 1421 | "$P_CLI debug_level=3 dtls=1 max_frag_len=2048 request_size=2345" \ |
| 1422 | 1 \ |
Manuel Pégourié-Gonnard | a2cda6b | 2015-08-31 18:30:52 +0200 | [diff] [blame] | 1423 | -c "Maximum fragment length is 2048" \ |
| 1424 | -s "Maximum fragment length is 2048" \ |
Manuel Pégourié-Gonnard | 37e08e1 | 2014-10-13 17:55:52 +0200 | [diff] [blame] | 1425 | -c "client hello, adding max_fragment_length extension" \ |
| 1426 | -s "found max fragment length extension" \ |
| 1427 | -s "server hello, max_fragment_length extension" \ |
| 1428 | -c "found max_fragment_length extension" \ |
| 1429 | -c "fragment larger than.*maximum" |
| 1430 | |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 1431 | # Tests for renegotiation |
| 1432 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1433 | run_test "Renegotiation: none, for reference" \ |
Manuel Pégourié-Gonnard | fa44f20 | 2015-03-27 17:52:25 +0100 | [diff] [blame] | 1434 | "$P_SRV debug_level=3 exchanges=2 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1435 | "$P_CLI debug_level=3 exchanges=2" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 1436 | 0 \ |
| 1437 | -C "client hello, adding renegotiation extension" \ |
| 1438 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1439 | -S "found renegotiation extension" \ |
| 1440 | -s "server hello, secure renegotiation extension" \ |
| 1441 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 1442 | -C "=> renegotiate" \ |
| 1443 | -S "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 1444 | -S "write hello request" |
| 1445 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1446 | run_test "Renegotiation: client-initiated" \ |
Manuel Pégourié-Gonnard | fa44f20 | 2015-03-27 17:52:25 +0100 | [diff] [blame] | 1447 | "$P_SRV debug_level=3 exchanges=2 renegotiation=1 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1448 | "$P_CLI debug_level=3 exchanges=2 renegotiation=1 renegotiate=1" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 1449 | 0 \ |
| 1450 | -c "client hello, adding renegotiation extension" \ |
| 1451 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1452 | -s "found renegotiation extension" \ |
| 1453 | -s "server hello, secure renegotiation extension" \ |
| 1454 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 1455 | -c "=> renegotiate" \ |
| 1456 | -s "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 1457 | -S "write hello request" |
| 1458 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1459 | run_test "Renegotiation: server-initiated" \ |
Manuel Pégourié-Gonnard | fa44f20 | 2015-03-27 17:52:25 +0100 | [diff] [blame] | 1460 | "$P_SRV debug_level=3 exchanges=2 renegotiation=1 auth_mode=optional renegotiate=1" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1461 | "$P_CLI debug_level=3 exchanges=2 renegotiation=1" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 1462 | 0 \ |
| 1463 | -c "client hello, adding renegotiation extension" \ |
| 1464 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1465 | -s "found renegotiation extension" \ |
| 1466 | -s "server hello, secure renegotiation extension" \ |
| 1467 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 1468 | -c "=> renegotiate" \ |
| 1469 | -s "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 1470 | -s "write hello request" |
| 1471 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1472 | run_test "Renegotiation: double" \ |
Manuel Pégourié-Gonnard | fa44f20 | 2015-03-27 17:52:25 +0100 | [diff] [blame] | 1473 | "$P_SRV debug_level=3 exchanges=2 renegotiation=1 auth_mode=optional renegotiate=1" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1474 | "$P_CLI debug_level=3 exchanges=2 renegotiation=1 renegotiate=1" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 1475 | 0 \ |
| 1476 | -c "client hello, adding renegotiation extension" \ |
| 1477 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1478 | -s "found renegotiation extension" \ |
| 1479 | -s "server hello, secure renegotiation extension" \ |
| 1480 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 1481 | -c "=> renegotiate" \ |
| 1482 | -s "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 1483 | -s "write hello request" |
| 1484 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1485 | run_test "Renegotiation: client-initiated, server-rejected" \ |
Manuel Pégourié-Gonnard | fa44f20 | 2015-03-27 17:52:25 +0100 | [diff] [blame] | 1486 | "$P_SRV debug_level=3 exchanges=2 renegotiation=0 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1487 | "$P_CLI debug_level=3 exchanges=2 renegotiation=1 renegotiate=1" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 1488 | 1 \ |
| 1489 | -c "client hello, adding renegotiation extension" \ |
| 1490 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1491 | -S "found renegotiation extension" \ |
| 1492 | -s "server hello, secure renegotiation extension" \ |
| 1493 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 1494 | -c "=> renegotiate" \ |
| 1495 | -S "=> renegotiate" \ |
Manuel Pégourié-Gonnard | fae355e | 2014-07-04 14:32:27 +0200 | [diff] [blame] | 1496 | -S "write hello request" \ |
Manuel Pégourié-Gonnard | 6591962 | 2014-08-19 12:50:30 +0200 | [diff] [blame] | 1497 | -c "SSL - Unexpected message at ServerHello in renegotiation" \ |
Manuel Pégourié-Gonnard | fae355e | 2014-07-04 14:32:27 +0200 | [diff] [blame] | 1498 | -c "failed" |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 1499 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1500 | run_test "Renegotiation: server-initiated, client-rejected, default" \ |
Manuel Pégourié-Gonnard | fa44f20 | 2015-03-27 17:52:25 +0100 | [diff] [blame] | 1501 | "$P_SRV debug_level=3 exchanges=2 renegotiation=1 renegotiate=1 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1502 | "$P_CLI debug_level=3 exchanges=2 renegotiation=0" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 1503 | 0 \ |
| 1504 | -C "client hello, adding renegotiation extension" \ |
| 1505 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1506 | -S "found renegotiation extension" \ |
| 1507 | -s "server hello, secure renegotiation extension" \ |
| 1508 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 1509 | -C "=> renegotiate" \ |
| 1510 | -S "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 1511 | -s "write hello request" \ |
Manuel Pégourié-Gonnard | a9964db | 2014-07-03 19:29:16 +0200 | [diff] [blame] | 1512 | -S "SSL - An unexpected message was received from our peer" \ |
| 1513 | -S "failed" |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 1514 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1515 | run_test "Renegotiation: server-initiated, client-rejected, not enforced" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1516 | "$P_SRV debug_level=3 exchanges=2 renegotiation=1 renegotiate=1 \ |
Manuel Pégourié-Gonnard | fa44f20 | 2015-03-27 17:52:25 +0100 | [diff] [blame] | 1517 | renego_delay=-1 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1518 | "$P_CLI debug_level=3 exchanges=2 renegotiation=0" \ |
Manuel Pégourié-Gonnard | fae355e | 2014-07-04 14:32:27 +0200 | [diff] [blame] | 1519 | 0 \ |
| 1520 | -C "client hello, adding renegotiation extension" \ |
| 1521 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1522 | -S "found renegotiation extension" \ |
| 1523 | -s "server hello, secure renegotiation extension" \ |
| 1524 | -c "found renegotiation extension" \ |
| 1525 | -C "=> renegotiate" \ |
| 1526 | -S "=> renegotiate" \ |
| 1527 | -s "write hello request" \ |
| 1528 | -S "SSL - An unexpected message was received from our peer" \ |
| 1529 | -S "failed" |
| 1530 | |
Manuel Pégourié-Gonnard | a8c0a0d | 2014-08-15 12:07:38 +0200 | [diff] [blame] | 1531 | # delay 2 for 1 alert record + 1 application data record |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1532 | run_test "Renegotiation: server-initiated, client-rejected, delay 2" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1533 | "$P_SRV debug_level=3 exchanges=2 renegotiation=1 renegotiate=1 \ |
Manuel Pégourié-Gonnard | fa44f20 | 2015-03-27 17:52:25 +0100 | [diff] [blame] | 1534 | renego_delay=2 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1535 | "$P_CLI debug_level=3 exchanges=2 renegotiation=0" \ |
Manuel Pégourié-Gonnard | fae355e | 2014-07-04 14:32:27 +0200 | [diff] [blame] | 1536 | 0 \ |
| 1537 | -C "client hello, adding renegotiation extension" \ |
| 1538 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1539 | -S "found renegotiation extension" \ |
| 1540 | -s "server hello, secure renegotiation extension" \ |
| 1541 | -c "found renegotiation extension" \ |
| 1542 | -C "=> renegotiate" \ |
| 1543 | -S "=> renegotiate" \ |
| 1544 | -s "write hello request" \ |
| 1545 | -S "SSL - An unexpected message was received from our peer" \ |
| 1546 | -S "failed" |
| 1547 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1548 | run_test "Renegotiation: server-initiated, client-rejected, delay 0" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1549 | "$P_SRV debug_level=3 exchanges=2 renegotiation=1 renegotiate=1 \ |
Manuel Pégourié-Gonnard | fa44f20 | 2015-03-27 17:52:25 +0100 | [diff] [blame] | 1550 | renego_delay=0 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1551 | "$P_CLI debug_level=3 exchanges=2 renegotiation=0" \ |
Manuel Pégourié-Gonnard | fae355e | 2014-07-04 14:32:27 +0200 | [diff] [blame] | 1552 | 0 \ |
| 1553 | -C "client hello, adding renegotiation extension" \ |
| 1554 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1555 | -S "found renegotiation extension" \ |
| 1556 | -s "server hello, secure renegotiation extension" \ |
| 1557 | -c "found renegotiation extension" \ |
| 1558 | -C "=> renegotiate" \ |
| 1559 | -S "=> renegotiate" \ |
| 1560 | -s "write hello request" \ |
Manuel Pégourié-Gonnard | a8c0a0d | 2014-08-15 12:07:38 +0200 | [diff] [blame] | 1561 | -s "SSL - An unexpected message was received from our peer" |
Manuel Pégourié-Gonnard | fae355e | 2014-07-04 14:32:27 +0200 | [diff] [blame] | 1562 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1563 | run_test "Renegotiation: server-initiated, client-accepted, delay 0" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1564 | "$P_SRV debug_level=3 exchanges=2 renegotiation=1 renegotiate=1 \ |
Manuel Pégourié-Gonnard | fa44f20 | 2015-03-27 17:52:25 +0100 | [diff] [blame] | 1565 | renego_delay=0 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1566 | "$P_CLI debug_level=3 exchanges=2 renegotiation=1" \ |
Manuel Pégourié-Gonnard | fae355e | 2014-07-04 14:32:27 +0200 | [diff] [blame] | 1567 | 0 \ |
| 1568 | -c "client hello, adding renegotiation extension" \ |
| 1569 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1570 | -s "found renegotiation extension" \ |
| 1571 | -s "server hello, secure renegotiation extension" \ |
| 1572 | -c "found renegotiation extension" \ |
| 1573 | -c "=> renegotiate" \ |
| 1574 | -s "=> renegotiate" \ |
| 1575 | -s "write hello request" \ |
| 1576 | -S "SSL - An unexpected message was received from our peer" \ |
| 1577 | -S "failed" |
| 1578 | |
Manuel Pégourié-Gonnard | 590f416 | 2014-11-05 14:23:03 +0100 | [diff] [blame] | 1579 | run_test "Renegotiation: periodic, just below period" \ |
Manuel Pégourié-Gonnard | fa44f20 | 2015-03-27 17:52:25 +0100 | [diff] [blame] | 1580 | "$P_SRV debug_level=3 exchanges=9 renegotiation=1 renego_period=3 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 590f416 | 2014-11-05 14:23:03 +0100 | [diff] [blame] | 1581 | "$P_CLI debug_level=3 exchanges=2 renegotiation=1" \ |
| 1582 | 0 \ |
| 1583 | -C "client hello, adding renegotiation extension" \ |
| 1584 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1585 | -S "found renegotiation extension" \ |
| 1586 | -s "server hello, secure renegotiation extension" \ |
| 1587 | -c "found renegotiation extension" \ |
| 1588 | -S "record counter limit reached: renegotiate" \ |
| 1589 | -C "=> renegotiate" \ |
| 1590 | -S "=> renegotiate" \ |
| 1591 | -S "write hello request" \ |
| 1592 | -S "SSL - An unexpected message was received from our peer" \ |
| 1593 | -S "failed" |
| 1594 | |
Manuel Pégourié-Gonnard | 9835bc0 | 2015-01-14 14:41:58 +0100 | [diff] [blame] | 1595 | # one extra exchange to be able to complete renego |
Manuel Pégourié-Gonnard | 590f416 | 2014-11-05 14:23:03 +0100 | [diff] [blame] | 1596 | run_test "Renegotiation: periodic, just above period" \ |
Manuel Pégourié-Gonnard | fa44f20 | 2015-03-27 17:52:25 +0100 | [diff] [blame] | 1597 | "$P_SRV debug_level=3 exchanges=9 renegotiation=1 renego_period=3 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 9835bc0 | 2015-01-14 14:41:58 +0100 | [diff] [blame] | 1598 | "$P_CLI debug_level=3 exchanges=4 renegotiation=1" \ |
Manuel Pégourié-Gonnard | 590f416 | 2014-11-05 14:23:03 +0100 | [diff] [blame] | 1599 | 0 \ |
| 1600 | -c "client hello, adding renegotiation extension" \ |
| 1601 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1602 | -s "found renegotiation extension" \ |
| 1603 | -s "server hello, secure renegotiation extension" \ |
| 1604 | -c "found renegotiation extension" \ |
| 1605 | -s "record counter limit reached: renegotiate" \ |
| 1606 | -c "=> renegotiate" \ |
| 1607 | -s "=> renegotiate" \ |
| 1608 | -s "write hello request" \ |
| 1609 | -S "SSL - An unexpected message was received from our peer" \ |
| 1610 | -S "failed" |
| 1611 | |
| 1612 | run_test "Renegotiation: periodic, two times period" \ |
Manuel Pégourié-Gonnard | fa44f20 | 2015-03-27 17:52:25 +0100 | [diff] [blame] | 1613 | "$P_SRV debug_level=3 exchanges=9 renegotiation=1 renego_period=3 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 9835bc0 | 2015-01-14 14:41:58 +0100 | [diff] [blame] | 1614 | "$P_CLI debug_level=3 exchanges=7 renegotiation=1" \ |
Manuel Pégourié-Gonnard | 590f416 | 2014-11-05 14:23:03 +0100 | [diff] [blame] | 1615 | 0 \ |
| 1616 | -c "client hello, adding renegotiation extension" \ |
| 1617 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1618 | -s "found renegotiation extension" \ |
| 1619 | -s "server hello, secure renegotiation extension" \ |
| 1620 | -c "found renegotiation extension" \ |
| 1621 | -s "record counter limit reached: renegotiate" \ |
| 1622 | -c "=> renegotiate" \ |
| 1623 | -s "=> renegotiate" \ |
| 1624 | -s "write hello request" \ |
| 1625 | -S "SSL - An unexpected message was received from our peer" \ |
| 1626 | -S "failed" |
| 1627 | |
| 1628 | run_test "Renegotiation: periodic, above period, disabled" \ |
Manuel Pégourié-Gonnard | fa44f20 | 2015-03-27 17:52:25 +0100 | [diff] [blame] | 1629 | "$P_SRV debug_level=3 exchanges=9 renegotiation=0 renego_period=3 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 590f416 | 2014-11-05 14:23:03 +0100 | [diff] [blame] | 1630 | "$P_CLI debug_level=3 exchanges=4 renegotiation=1" \ |
| 1631 | 0 \ |
| 1632 | -C "client hello, adding renegotiation extension" \ |
| 1633 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1634 | -S "found renegotiation extension" \ |
| 1635 | -s "server hello, secure renegotiation extension" \ |
| 1636 | -c "found renegotiation extension" \ |
| 1637 | -S "record counter limit reached: renegotiate" \ |
| 1638 | -C "=> renegotiate" \ |
| 1639 | -S "=> renegotiate" \ |
| 1640 | -S "write hello request" \ |
| 1641 | -S "SSL - An unexpected message was received from our peer" \ |
| 1642 | -S "failed" |
| 1643 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1644 | run_test "Renegotiation: nbio, client-initiated" \ |
Manuel Pégourié-Gonnard | fa44f20 | 2015-03-27 17:52:25 +0100 | [diff] [blame] | 1645 | "$P_SRV debug_level=3 nbio=2 exchanges=2 renegotiation=1 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1646 | "$P_CLI debug_level=3 nbio=2 exchanges=2 renegotiation=1 renegotiate=1" \ |
Manuel Pégourié-Gonnard | f07f421 | 2014-08-15 19:04:47 +0200 | [diff] [blame] | 1647 | 0 \ |
| 1648 | -c "client hello, adding renegotiation extension" \ |
| 1649 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1650 | -s "found renegotiation extension" \ |
| 1651 | -s "server hello, secure renegotiation extension" \ |
| 1652 | -c "found renegotiation extension" \ |
| 1653 | -c "=> renegotiate" \ |
| 1654 | -s "=> renegotiate" \ |
| 1655 | -S "write hello request" |
| 1656 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1657 | run_test "Renegotiation: nbio, server-initiated" \ |
Manuel Pégourié-Gonnard | fa44f20 | 2015-03-27 17:52:25 +0100 | [diff] [blame] | 1658 | "$P_SRV debug_level=3 nbio=2 exchanges=2 renegotiation=1 renegotiate=1 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1659 | "$P_CLI debug_level=3 nbio=2 exchanges=2 renegotiation=1" \ |
Manuel Pégourié-Gonnard | f07f421 | 2014-08-15 19:04:47 +0200 | [diff] [blame] | 1660 | 0 \ |
| 1661 | -c "client hello, adding renegotiation extension" \ |
| 1662 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1663 | -s "found renegotiation extension" \ |
| 1664 | -s "server hello, secure renegotiation extension" \ |
| 1665 | -c "found renegotiation extension" \ |
| 1666 | -c "=> renegotiate" \ |
| 1667 | -s "=> renegotiate" \ |
| 1668 | -s "write hello request" |
| 1669 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1670 | run_test "Renegotiation: openssl server, client-initiated" \ |
Manuel Pégourié-Gonnard | a775617 | 2014-08-31 18:37:01 +0200 | [diff] [blame] | 1671 | "$O_SRV -www" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1672 | "$P_CLI debug_level=3 exchanges=1 renegotiation=1 renegotiate=1" \ |
Manuel Pégourié-Gonnard | 5136296 | 2014-08-30 21:22:47 +0200 | [diff] [blame] | 1673 | 0 \ |
| 1674 | -c "client hello, adding renegotiation extension" \ |
| 1675 | -c "found renegotiation extension" \ |
| 1676 | -c "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 85d915b | 2014-11-03 20:10:36 +0100 | [diff] [blame] | 1677 | -C "ssl_hanshake() returned" \ |
Manuel Pégourié-Gonnard | 5136296 | 2014-08-30 21:22:47 +0200 | [diff] [blame] | 1678 | -C "error" \ |
| 1679 | -c "HTTP/1.0 200 [Oo][Kk]" |
| 1680 | |
Paul Bakker | 539d972 | 2015-02-08 16:18:35 +0100 | [diff] [blame] | 1681 | requires_gnutls |
Manuel Pégourié-Gonnard | 85d915b | 2014-11-03 20:10:36 +0100 | [diff] [blame] | 1682 | run_test "Renegotiation: gnutls server strict, client-initiated" \ |
| 1683 | "$G_SRV --priority=NORMAL:%SAFE_RENEGOTIATION" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1684 | "$P_CLI debug_level=3 exchanges=1 renegotiation=1 renegotiate=1" \ |
Manuel Pégourié-Gonnard | 5136296 | 2014-08-30 21:22:47 +0200 | [diff] [blame] | 1685 | 0 \ |
| 1686 | -c "client hello, adding renegotiation extension" \ |
| 1687 | -c "found renegotiation extension" \ |
| 1688 | -c "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 85d915b | 2014-11-03 20:10:36 +0100 | [diff] [blame] | 1689 | -C "ssl_hanshake() returned" \ |
Manuel Pégourié-Gonnard | 5136296 | 2014-08-30 21:22:47 +0200 | [diff] [blame] | 1690 | -C "error" \ |
| 1691 | -c "HTTP/1.0 200 [Oo][Kk]" |
| 1692 | |
Paul Bakker | 539d972 | 2015-02-08 16:18:35 +0100 | [diff] [blame] | 1693 | requires_gnutls |
Manuel Pégourié-Gonnard | 85d915b | 2014-11-03 20:10:36 +0100 | [diff] [blame] | 1694 | run_test "Renegotiation: gnutls server unsafe, client-initiated default" \ |
| 1695 | "$G_SRV --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION" \ |
| 1696 | "$P_CLI debug_level=3 exchanges=1 renegotiation=1 renegotiate=1" \ |
| 1697 | 1 \ |
| 1698 | -c "client hello, adding renegotiation extension" \ |
| 1699 | -C "found renegotiation extension" \ |
| 1700 | -c "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 1701 | -c "mbedtls_ssl_handshake() returned" \ |
Manuel Pégourié-Gonnard | 85d915b | 2014-11-03 20:10:36 +0100 | [diff] [blame] | 1702 | -c "error" \ |
| 1703 | -C "HTTP/1.0 200 [Oo][Kk]" |
| 1704 | |
Paul Bakker | 539d972 | 2015-02-08 16:18:35 +0100 | [diff] [blame] | 1705 | requires_gnutls |
Manuel Pégourié-Gonnard | 85d915b | 2014-11-03 20:10:36 +0100 | [diff] [blame] | 1706 | run_test "Renegotiation: gnutls server unsafe, client-inititated no legacy" \ |
| 1707 | "$G_SRV --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION" \ |
| 1708 | "$P_CLI debug_level=3 exchanges=1 renegotiation=1 renegotiate=1 \ |
| 1709 | allow_legacy=0" \ |
| 1710 | 1 \ |
| 1711 | -c "client hello, adding renegotiation extension" \ |
| 1712 | -C "found renegotiation extension" \ |
| 1713 | -c "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 1714 | -c "mbedtls_ssl_handshake() returned" \ |
Manuel Pégourié-Gonnard | 85d915b | 2014-11-03 20:10:36 +0100 | [diff] [blame] | 1715 | -c "error" \ |
| 1716 | -C "HTTP/1.0 200 [Oo][Kk]" |
| 1717 | |
Paul Bakker | 539d972 | 2015-02-08 16:18:35 +0100 | [diff] [blame] | 1718 | requires_gnutls |
Manuel Pégourié-Gonnard | 85d915b | 2014-11-03 20:10:36 +0100 | [diff] [blame] | 1719 | run_test "Renegotiation: gnutls server unsafe, client-inititated legacy" \ |
| 1720 | "$G_SRV --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION" \ |
| 1721 | "$P_CLI debug_level=3 exchanges=1 renegotiation=1 renegotiate=1 \ |
| 1722 | allow_legacy=1" \ |
| 1723 | 0 \ |
| 1724 | -c "client hello, adding renegotiation extension" \ |
| 1725 | -C "found renegotiation extension" \ |
| 1726 | -c "=> renegotiate" \ |
| 1727 | -C "ssl_hanshake() returned" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 1728 | -C "error" \ |
| 1729 | -c "HTTP/1.0 200 [Oo][Kk]" |
| 1730 | |
Manuel Pégourié-Gonnard | 30d16eb | 2014-08-19 17:43:50 +0200 | [diff] [blame] | 1731 | run_test "Renegotiation: DTLS, client-initiated" \ |
| 1732 | "$P_SRV debug_level=3 dtls=1 exchanges=2 renegotiation=1" \ |
| 1733 | "$P_CLI debug_level=3 dtls=1 exchanges=2 renegotiation=1 renegotiate=1" \ |
| 1734 | 0 \ |
| 1735 | -c "client hello, adding renegotiation extension" \ |
| 1736 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1737 | -s "found renegotiation extension" \ |
| 1738 | -s "server hello, secure renegotiation extension" \ |
| 1739 | -c "found renegotiation extension" \ |
| 1740 | -c "=> renegotiate" \ |
| 1741 | -s "=> renegotiate" \ |
| 1742 | -S "write hello request" |
| 1743 | |
Manuel Pégourié-Gonnard | c392b24 | 2014-08-19 17:53:11 +0200 | [diff] [blame] | 1744 | run_test "Renegotiation: DTLS, server-initiated" \ |
| 1745 | "$P_SRV debug_level=3 dtls=1 exchanges=2 renegotiation=1 renegotiate=1" \ |
Manuel Pégourié-Gonnard | df9a0a8 | 2014-10-02 14:17:18 +0200 | [diff] [blame] | 1746 | "$P_CLI debug_level=3 dtls=1 exchanges=2 renegotiation=1 \ |
| 1747 | read_timeout=1000 max_resend=2" \ |
Manuel Pégourié-Gonnard | c392b24 | 2014-08-19 17:53:11 +0200 | [diff] [blame] | 1748 | 0 \ |
| 1749 | -c "client hello, adding renegotiation extension" \ |
| 1750 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1751 | -s "found renegotiation extension" \ |
| 1752 | -s "server hello, secure renegotiation extension" \ |
| 1753 | -c "found renegotiation extension" \ |
| 1754 | -c "=> renegotiate" \ |
| 1755 | -s "=> renegotiate" \ |
| 1756 | -s "write hello request" |
| 1757 | |
Andres AG | 692ad84 | 2017-01-19 16:30:57 +0000 | [diff] [blame] | 1758 | run_test "Renegotiation: DTLS, renego_period overflow" \ |
| 1759 | "$P_SRV debug_level=3 dtls=1 exchanges=4 renegotiation=1 renego_period=18446462598732840962 auth_mode=optional" \ |
| 1760 | "$P_CLI debug_level=3 dtls=1 exchanges=4 renegotiation=1" \ |
| 1761 | 0 \ |
| 1762 | -c "client hello, adding renegotiation extension" \ |
| 1763 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1764 | -s "found renegotiation extension" \ |
| 1765 | -s "server hello, secure renegotiation extension" \ |
| 1766 | -s "record counter limit reached: renegotiate" \ |
| 1767 | -c "=> renegotiate" \ |
| 1768 | -s "=> renegotiate" \ |
| 1769 | -s "write hello request" \ |
| 1770 | |
Manuel Pégourié-Gonnard | 9699996 | 2015-02-17 16:02:37 +0000 | [diff] [blame] | 1771 | requires_gnutls |
Manuel Pégourié-Gonnard | f1499f6 | 2014-08-31 17:13:13 +0200 | [diff] [blame] | 1772 | run_test "Renegotiation: DTLS, gnutls server, client-initiated" \ |
| 1773 | "$G_SRV -u --mtu 4096" \ |
| 1774 | "$P_CLI debug_level=3 dtls=1 exchanges=1 renegotiation=1 renegotiate=1" \ |
| 1775 | 0 \ |
| 1776 | -c "client hello, adding renegotiation extension" \ |
| 1777 | -c "found renegotiation extension" \ |
| 1778 | -c "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 1779 | -C "mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | f1499f6 | 2014-08-31 17:13:13 +0200 | [diff] [blame] | 1780 | -C "error" \ |
| 1781 | -s "Extra-header:" |
| 1782 | |
Manuel Pégourié-Gonnard | 85d915b | 2014-11-03 20:10:36 +0100 | [diff] [blame] | 1783 | # Test for the "secure renegotation" extension only (no actual renegotiation) |
| 1784 | |
Paul Bakker | 539d972 | 2015-02-08 16:18:35 +0100 | [diff] [blame] | 1785 | requires_gnutls |
Manuel Pégourié-Gonnard | 85d915b | 2014-11-03 20:10:36 +0100 | [diff] [blame] | 1786 | run_test "Renego ext: gnutls server strict, client default" \ |
| 1787 | "$G_SRV --priority=NORMAL:%SAFE_RENEGOTIATION" \ |
| 1788 | "$P_CLI debug_level=3" \ |
| 1789 | 0 \ |
| 1790 | -c "found renegotiation extension" \ |
| 1791 | -C "error" \ |
| 1792 | -c "HTTP/1.0 200 [Oo][Kk]" |
| 1793 | |
Paul Bakker | 539d972 | 2015-02-08 16:18:35 +0100 | [diff] [blame] | 1794 | requires_gnutls |
Manuel Pégourié-Gonnard | 85d915b | 2014-11-03 20:10:36 +0100 | [diff] [blame] | 1795 | run_test "Renego ext: gnutls server unsafe, client default" \ |
| 1796 | "$G_SRV --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION" \ |
| 1797 | "$P_CLI debug_level=3" \ |
| 1798 | 0 \ |
| 1799 | -C "found renegotiation extension" \ |
| 1800 | -C "error" \ |
| 1801 | -c "HTTP/1.0 200 [Oo][Kk]" |
| 1802 | |
Paul Bakker | 539d972 | 2015-02-08 16:18:35 +0100 | [diff] [blame] | 1803 | requires_gnutls |
Manuel Pégourié-Gonnard | 85d915b | 2014-11-03 20:10:36 +0100 | [diff] [blame] | 1804 | run_test "Renego ext: gnutls server unsafe, client break legacy" \ |
| 1805 | "$G_SRV --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION" \ |
| 1806 | "$P_CLI debug_level=3 allow_legacy=-1" \ |
| 1807 | 1 \ |
| 1808 | -C "found renegotiation extension" \ |
| 1809 | -c "error" \ |
| 1810 | -C "HTTP/1.0 200 [Oo][Kk]" |
| 1811 | |
Paul Bakker | 539d972 | 2015-02-08 16:18:35 +0100 | [diff] [blame] | 1812 | requires_gnutls |
Manuel Pégourié-Gonnard | 85d915b | 2014-11-03 20:10:36 +0100 | [diff] [blame] | 1813 | run_test "Renego ext: gnutls client strict, server default" \ |
| 1814 | "$P_SRV debug_level=3" \ |
| 1815 | "$G_CLI --priority=NORMAL:%SAFE_RENEGOTIATION" \ |
| 1816 | 0 \ |
| 1817 | -s "received TLS_EMPTY_RENEGOTIATION_INFO\|found renegotiation extension" \ |
| 1818 | -s "server hello, secure renegotiation extension" |
| 1819 | |
Paul Bakker | 539d972 | 2015-02-08 16:18:35 +0100 | [diff] [blame] | 1820 | requires_gnutls |
Manuel Pégourié-Gonnard | 85d915b | 2014-11-03 20:10:36 +0100 | [diff] [blame] | 1821 | run_test "Renego ext: gnutls client unsafe, server default" \ |
| 1822 | "$P_SRV debug_level=3" \ |
| 1823 | "$G_CLI --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION" \ |
| 1824 | 0 \ |
| 1825 | -S "received TLS_EMPTY_RENEGOTIATION_INFO\|found renegotiation extension" \ |
| 1826 | -S "server hello, secure renegotiation extension" |
| 1827 | |
Paul Bakker | 539d972 | 2015-02-08 16:18:35 +0100 | [diff] [blame] | 1828 | requires_gnutls |
Manuel Pégourié-Gonnard | 85d915b | 2014-11-03 20:10:36 +0100 | [diff] [blame] | 1829 | run_test "Renego ext: gnutls client unsafe, server break legacy" \ |
| 1830 | "$P_SRV debug_level=3 allow_legacy=-1" \ |
| 1831 | "$G_CLI --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION" \ |
| 1832 | 1 \ |
| 1833 | -S "received TLS_EMPTY_RENEGOTIATION_INFO\|found renegotiation extension" \ |
| 1834 | -S "server hello, secure renegotiation extension" |
| 1835 | |
Janos Follath | 0b24234 | 2016-02-17 10:11:21 +0000 | [diff] [blame] | 1836 | # Tests for silently dropping trailing extra bytes in .der certificates |
| 1837 | |
| 1838 | requires_gnutls |
| 1839 | run_test "DER format: no trailing bytes" \ |
| 1840 | "$P_SRV crt_file=data_files/server5-der0.crt \ |
| 1841 | key_file=data_files/server5.key" \ |
| 1842 | "$G_CLI " \ |
| 1843 | 0 \ |
| 1844 | -c "Handshake was completed" \ |
| 1845 | |
| 1846 | requires_gnutls |
| 1847 | run_test "DER format: with a trailing zero byte" \ |
| 1848 | "$P_SRV crt_file=data_files/server5-der1a.crt \ |
| 1849 | key_file=data_files/server5.key" \ |
| 1850 | "$G_CLI " \ |
| 1851 | 0 \ |
| 1852 | -c "Handshake was completed" \ |
| 1853 | |
| 1854 | requires_gnutls |
| 1855 | run_test "DER format: with a trailing random byte" \ |
| 1856 | "$P_SRV crt_file=data_files/server5-der1b.crt \ |
| 1857 | key_file=data_files/server5.key" \ |
| 1858 | "$G_CLI " \ |
| 1859 | 0 \ |
| 1860 | -c "Handshake was completed" \ |
| 1861 | |
| 1862 | requires_gnutls |
| 1863 | run_test "DER format: with 2 trailing random bytes" \ |
| 1864 | "$P_SRV crt_file=data_files/server5-der2.crt \ |
| 1865 | key_file=data_files/server5.key" \ |
| 1866 | "$G_CLI " \ |
| 1867 | 0 \ |
| 1868 | -c "Handshake was completed" \ |
| 1869 | |
| 1870 | requires_gnutls |
| 1871 | run_test "DER format: with 4 trailing random bytes" \ |
| 1872 | "$P_SRV crt_file=data_files/server5-der4.crt \ |
| 1873 | key_file=data_files/server5.key" \ |
| 1874 | "$G_CLI " \ |
| 1875 | 0 \ |
| 1876 | -c "Handshake was completed" \ |
| 1877 | |
| 1878 | requires_gnutls |
| 1879 | run_test "DER format: with 8 trailing random bytes" \ |
| 1880 | "$P_SRV crt_file=data_files/server5-der8.crt \ |
| 1881 | key_file=data_files/server5.key" \ |
| 1882 | "$G_CLI " \ |
| 1883 | 0 \ |
| 1884 | -c "Handshake was completed" \ |
| 1885 | |
| 1886 | requires_gnutls |
| 1887 | run_test "DER format: with 9 trailing random bytes" \ |
| 1888 | "$P_SRV crt_file=data_files/server5-der9.crt \ |
| 1889 | key_file=data_files/server5.key" \ |
| 1890 | "$G_CLI " \ |
| 1891 | 0 \ |
| 1892 | -c "Handshake was completed" \ |
| 1893 | |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 1894 | # Tests for auth_mode |
| 1895 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1896 | run_test "Authentication: server badcert, client required" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 1897 | "$P_SRV crt_file=data_files/server5-badsign.crt \ |
| 1898 | key_file=data_files/server5.key" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1899 | "$P_CLI debug_level=1 auth_mode=required" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 1900 | 1 \ |
| 1901 | -c "x509_verify_cert() returned" \ |
Manuel Pégourié-Gonnard | 89addc4 | 2015-04-20 10:56:18 +0100 | [diff] [blame] | 1902 | -c "! The certificate is not correctly signed by the trusted CA" \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 1903 | -c "! mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 1904 | -c "X509 - Certificate verification failed" |
| 1905 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1906 | run_test "Authentication: server badcert, client optional" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 1907 | "$P_SRV crt_file=data_files/server5-badsign.crt \ |
| 1908 | key_file=data_files/server5.key" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1909 | "$P_CLI debug_level=1 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 1910 | 0 \ |
| 1911 | -c "x509_verify_cert() returned" \ |
Manuel Pégourié-Gonnard | 89addc4 | 2015-04-20 10:56:18 +0100 | [diff] [blame] | 1912 | -c "! The certificate is not correctly signed by the trusted CA" \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 1913 | -C "! mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 1914 | -C "X509 - Certificate verification failed" |
| 1915 | |
Hanno Becker | e6706e6 | 2017-05-15 16:05:15 +0100 | [diff] [blame] | 1916 | run_test "Authentication: server goodcert, client optional, no trusted CA" \ |
| 1917 | "$P_SRV" \ |
| 1918 | "$P_CLI debug_level=3 auth_mode=optional ca_file=none ca_path=none" \ |
| 1919 | 0 \ |
| 1920 | -c "x509_verify_cert() returned" \ |
| 1921 | -c "! The certificate is not correctly signed by the trusted CA" \ |
| 1922 | -c "! Certificate verification flags"\ |
| 1923 | -C "! mbedtls_ssl_handshake returned" \ |
| 1924 | -C "X509 - Certificate verification failed" \ |
| 1925 | -C "SSL - No CA Chain is set, but required to operate" |
| 1926 | |
| 1927 | run_test "Authentication: server goodcert, client required, no trusted CA" \ |
| 1928 | "$P_SRV" \ |
| 1929 | "$P_CLI debug_level=3 auth_mode=required ca_file=none ca_path=none" \ |
| 1930 | 1 \ |
| 1931 | -c "x509_verify_cert() returned" \ |
| 1932 | -c "! The certificate is not correctly signed by the trusted CA" \ |
| 1933 | -c "! Certificate verification flags"\ |
| 1934 | -c "! mbedtls_ssl_handshake returned" \ |
| 1935 | -c "SSL - No CA Chain is set, but required to operate" |
| 1936 | |
| 1937 | # The purpose of the next two tests is to test the client's behaviour when receiving a server |
| 1938 | # certificate with an unsupported elliptic curve. This should usually not happen because |
| 1939 | # the client informs the server about the supported curves - it does, though, in the |
| 1940 | # corner case of a static ECDH suite, because the server doesn't check the curve on that |
| 1941 | # occasion (to be fixed). If that bug's fixed, the test needs to be altered to use a |
| 1942 | # different means to have the server ignoring the client's supported curve list. |
| 1943 | |
| 1944 | requires_config_enabled MBEDTLS_ECP_C |
| 1945 | run_test "Authentication: server ECDH p256v1, client required, p256v1 unsupported" \ |
| 1946 | "$P_SRV debug_level=1 key_file=data_files/server5.key \ |
| 1947 | crt_file=data_files/server5.ku-ka.crt" \ |
| 1948 | "$P_CLI debug_level=3 auth_mode=required curves=secp521r1" \ |
| 1949 | 1 \ |
| 1950 | -c "bad certificate (EC key curve)"\ |
| 1951 | -c "! Certificate verification flags"\ |
| 1952 | -C "bad server certificate (ECDH curve)" # Expect failure at earlier verification stage |
| 1953 | |
| 1954 | requires_config_enabled MBEDTLS_ECP_C |
| 1955 | run_test "Authentication: server ECDH p256v1, client optional, p256v1 unsupported" \ |
| 1956 | "$P_SRV debug_level=1 key_file=data_files/server5.key \ |
| 1957 | crt_file=data_files/server5.ku-ka.crt" \ |
| 1958 | "$P_CLI debug_level=3 auth_mode=optional curves=secp521r1" \ |
| 1959 | 1 \ |
| 1960 | -c "bad certificate (EC key curve)"\ |
| 1961 | -c "! Certificate verification flags"\ |
| 1962 | -c "bad server certificate (ECDH curve)" # Expect failure only at ECDH params check |
| 1963 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1964 | run_test "Authentication: server badcert, client none" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 1965 | "$P_SRV crt_file=data_files/server5-badsign.crt \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 1966 | key_file=data_files/server5.key" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1967 | "$P_CLI debug_level=1 auth_mode=none" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 1968 | 0 \ |
| 1969 | -C "x509_verify_cert() returned" \ |
Manuel Pégourié-Gonnard | 89addc4 | 2015-04-20 10:56:18 +0100 | [diff] [blame] | 1970 | -C "! The certificate is not correctly signed by the trusted CA" \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 1971 | -C "! mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 1972 | -C "X509 - Certificate verification failed" |
| 1973 | |
Simon Butcher | 9900014 | 2016-10-13 17:21:01 +0100 | [diff] [blame] | 1974 | run_test "Authentication: client SHA256, server required" \ |
| 1975 | "$P_SRV auth_mode=required" \ |
| 1976 | "$P_CLI debug_level=3 crt_file=data_files/server6.crt \ |
| 1977 | key_file=data_files/server6.key \ |
| 1978 | force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384" \ |
| 1979 | 0 \ |
| 1980 | -c "Supported Signature Algorithm found: 4," \ |
| 1981 | -c "Supported Signature Algorithm found: 5," |
| 1982 | |
| 1983 | run_test "Authentication: client SHA384, server required" \ |
| 1984 | "$P_SRV auth_mode=required" \ |
| 1985 | "$P_CLI debug_level=3 crt_file=data_files/server6.crt \ |
| 1986 | key_file=data_files/server6.key \ |
| 1987 | force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256" \ |
| 1988 | 0 \ |
| 1989 | -c "Supported Signature Algorithm found: 4," \ |
| 1990 | -c "Supported Signature Algorithm found: 5," |
| 1991 | |
Gilles Peskine | fd8332e | 2017-05-03 16:25:07 +0200 | [diff] [blame] | 1992 | requires_config_enabled MBEDTLS_SSL_PROTO_SSL3 |
| 1993 | run_test "Authentication: client has no cert, server required (SSLv3)" \ |
| 1994 | "$P_SRV debug_level=3 min_version=ssl3 auth_mode=required" \ |
| 1995 | "$P_CLI debug_level=3 force_version=ssl3 crt_file=none \ |
| 1996 | key_file=data_files/server5.key" \ |
| 1997 | 1 \ |
| 1998 | -S "skip write certificate request" \ |
| 1999 | -C "skip parse certificate request" \ |
| 2000 | -c "got a certificate request" \ |
| 2001 | -c "got no certificate to send" \ |
| 2002 | -S "x509_verify_cert() returned" \ |
| 2003 | -s "client has no certificate" \ |
| 2004 | -s "! mbedtls_ssl_handshake returned" \ |
| 2005 | -c "! mbedtls_ssl_handshake returned" \ |
| 2006 | -s "No client certification received from the client, but required by the authentication mode" |
| 2007 | |
| 2008 | run_test "Authentication: client has no cert, server required (TLS)" \ |
| 2009 | "$P_SRV debug_level=3 auth_mode=required" \ |
| 2010 | "$P_CLI debug_level=3 crt_file=none \ |
| 2011 | key_file=data_files/server5.key" \ |
| 2012 | 1 \ |
| 2013 | -S "skip write certificate request" \ |
| 2014 | -C "skip parse certificate request" \ |
| 2015 | -c "got a certificate request" \ |
| 2016 | -c "= write certificate$" \ |
| 2017 | -C "skip write certificate$" \ |
| 2018 | -S "x509_verify_cert() returned" \ |
| 2019 | -s "client has no certificate" \ |
| 2020 | -s "! mbedtls_ssl_handshake returned" \ |
| 2021 | -c "! mbedtls_ssl_handshake returned" \ |
| 2022 | -s "No client certification received from the client, but required by the authentication mode" |
| 2023 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2024 | run_test "Authentication: client badcert, server required" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2025 | "$P_SRV debug_level=3 auth_mode=required" \ |
| 2026 | "$P_CLI debug_level=3 crt_file=data_files/server5-badsign.crt \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 2027 | key_file=data_files/server5.key" \ |
| 2028 | 1 \ |
| 2029 | -S "skip write certificate request" \ |
| 2030 | -C "skip parse certificate request" \ |
| 2031 | -c "got a certificate request" \ |
| 2032 | -C "skip write certificate" \ |
| 2033 | -C "skip write certificate verify" \ |
| 2034 | -S "skip parse certificate verify" \ |
| 2035 | -s "x509_verify_cert() returned" \ |
Manuel Pégourié-Gonnard | 6ea831d | 2015-06-22 16:50:52 +0200 | [diff] [blame] | 2036 | -s "! The certificate is not correctly signed by the trusted CA" \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2037 | -s "! mbedtls_ssl_handshake returned" \ |
Gilles Peskine | 1cc8e34 | 2017-05-03 16:28:34 +0200 | [diff] [blame] | 2038 | -s "send alert level=2 message=48" \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2039 | -c "! mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 2040 | -s "X509 - Certificate verification failed" |
Gilles Peskine | 1cc8e34 | 2017-05-03 16:28:34 +0200 | [diff] [blame] | 2041 | # We don't check that the client receives the alert because it might |
| 2042 | # detect that its write end of the connection is closed and abort |
| 2043 | # before reading the alert message. |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 2044 | |
Janos Follath | 89baba2 | 2017-04-10 14:34:35 +0100 | [diff] [blame] | 2045 | run_test "Authentication: client cert not trusted, server required" \ |
| 2046 | "$P_SRV debug_level=3 auth_mode=required" \ |
| 2047 | "$P_CLI debug_level=3 crt_file=data_files/server5-selfsigned.crt \ |
| 2048 | key_file=data_files/server5.key" \ |
| 2049 | 1 \ |
| 2050 | -S "skip write certificate request" \ |
| 2051 | -C "skip parse certificate request" \ |
| 2052 | -c "got a certificate request" \ |
| 2053 | -C "skip write certificate" \ |
| 2054 | -C "skip write certificate verify" \ |
| 2055 | -S "skip parse certificate verify" \ |
| 2056 | -s "x509_verify_cert() returned" \ |
| 2057 | -s "! The certificate is not correctly signed by the trusted CA" \ |
| 2058 | -s "! mbedtls_ssl_handshake returned" \ |
| 2059 | -c "! mbedtls_ssl_handshake returned" \ |
| 2060 | -s "X509 - Certificate verification failed" |
| 2061 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2062 | run_test "Authentication: client badcert, server optional" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2063 | "$P_SRV debug_level=3 auth_mode=optional" \ |
| 2064 | "$P_CLI debug_level=3 crt_file=data_files/server5-badsign.crt \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 2065 | key_file=data_files/server5.key" \ |
| 2066 | 0 \ |
| 2067 | -S "skip write certificate request" \ |
| 2068 | -C "skip parse certificate request" \ |
| 2069 | -c "got a certificate request" \ |
| 2070 | -C "skip write certificate" \ |
| 2071 | -C "skip write certificate verify" \ |
| 2072 | -S "skip parse certificate verify" \ |
| 2073 | -s "x509_verify_cert() returned" \ |
Manuel Pégourié-Gonnard | 89addc4 | 2015-04-20 10:56:18 +0100 | [diff] [blame] | 2074 | -s "! The certificate is not correctly signed by the trusted CA" \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2075 | -S "! mbedtls_ssl_handshake returned" \ |
| 2076 | -C "! mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 2077 | -S "X509 - Certificate verification failed" |
| 2078 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2079 | run_test "Authentication: client badcert, server none" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2080 | "$P_SRV debug_level=3 auth_mode=none" \ |
| 2081 | "$P_CLI debug_level=3 crt_file=data_files/server5-badsign.crt \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 2082 | key_file=data_files/server5.key" \ |
| 2083 | 0 \ |
| 2084 | -s "skip write certificate request" \ |
| 2085 | -C "skip parse certificate request" \ |
| 2086 | -c "got no certificate request" \ |
| 2087 | -c "skip write certificate" \ |
| 2088 | -c "skip write certificate verify" \ |
| 2089 | -s "skip parse certificate verify" \ |
| 2090 | -S "x509_verify_cert() returned" \ |
Manuel Pégourié-Gonnard | 89addc4 | 2015-04-20 10:56:18 +0100 | [diff] [blame] | 2091 | -S "! The certificate is not correctly signed by the trusted CA" \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2092 | -S "! mbedtls_ssl_handshake returned" \ |
| 2093 | -C "! mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 2094 | -S "X509 - Certificate verification failed" |
| 2095 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2096 | run_test "Authentication: client no cert, server optional" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2097 | "$P_SRV debug_level=3 auth_mode=optional" \ |
| 2098 | "$P_CLI debug_level=3 crt_file=none key_file=none" \ |
Manuel Pégourié-Gonnard | de515cc | 2014-02-27 14:58:26 +0100 | [diff] [blame] | 2099 | 0 \ |
| 2100 | -S "skip write certificate request" \ |
| 2101 | -C "skip parse certificate request" \ |
| 2102 | -c "got a certificate request" \ |
| 2103 | -C "skip write certificate$" \ |
| 2104 | -C "got no certificate to send" \ |
| 2105 | -S "SSLv3 client has no certificate" \ |
| 2106 | -c "skip write certificate verify" \ |
| 2107 | -s "skip parse certificate verify" \ |
Manuel Pégourié-Gonnard | 89addc4 | 2015-04-20 10:56:18 +0100 | [diff] [blame] | 2108 | -s "! Certificate was missing" \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2109 | -S "! mbedtls_ssl_handshake returned" \ |
| 2110 | -C "! mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | de515cc | 2014-02-27 14:58:26 +0100 | [diff] [blame] | 2111 | -S "X509 - Certificate verification failed" |
| 2112 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2113 | run_test "Authentication: openssl client no cert, server optional" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2114 | "$P_SRV debug_level=3 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | de515cc | 2014-02-27 14:58:26 +0100 | [diff] [blame] | 2115 | "$O_CLI" \ |
| 2116 | 0 \ |
| 2117 | -S "skip write certificate request" \ |
| 2118 | -s "skip parse certificate verify" \ |
Manuel Pégourié-Gonnard | 89addc4 | 2015-04-20 10:56:18 +0100 | [diff] [blame] | 2119 | -s "! Certificate was missing" \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2120 | -S "! mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | de515cc | 2014-02-27 14:58:26 +0100 | [diff] [blame] | 2121 | -S "X509 - Certificate verification failed" |
| 2122 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2123 | run_test "Authentication: client no cert, openssl server optional" \ |
Manuel Pégourié-Gonnard | de515cc | 2014-02-27 14:58:26 +0100 | [diff] [blame] | 2124 | "$O_SRV -verify 10" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2125 | "$P_CLI debug_level=3 crt_file=none key_file=none" \ |
Manuel Pégourié-Gonnard | de515cc | 2014-02-27 14:58:26 +0100 | [diff] [blame] | 2126 | 0 \ |
| 2127 | -C "skip parse certificate request" \ |
| 2128 | -c "got a certificate request" \ |
| 2129 | -C "skip write certificate$" \ |
| 2130 | -c "skip write certificate verify" \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2131 | -C "! mbedtls_ssl_handshake returned" |
Manuel Pégourié-Gonnard | de515cc | 2014-02-27 14:58:26 +0100 | [diff] [blame] | 2132 | |
Gilles Peskine | fd8332e | 2017-05-03 16:25:07 +0200 | [diff] [blame] | 2133 | run_test "Authentication: client no cert, openssl server required" \ |
| 2134 | "$O_SRV -Verify 10" \ |
| 2135 | "$P_CLI debug_level=3 crt_file=none key_file=none" \ |
| 2136 | 1 \ |
| 2137 | -C "skip parse certificate request" \ |
| 2138 | -c "got a certificate request" \ |
| 2139 | -C "skip write certificate$" \ |
| 2140 | -c "skip write certificate verify" \ |
| 2141 | -c "! mbedtls_ssl_handshake returned" |
| 2142 | |
Janos Follath | e2681a4 | 2016-03-07 15:57:05 +0000 | [diff] [blame] | 2143 | requires_config_enabled MBEDTLS_SSL_PROTO_SSL3 |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2144 | run_test "Authentication: client no cert, ssl3" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2145 | "$P_SRV debug_level=3 auth_mode=optional force_version=ssl3" \ |
Manuel Pégourié-Gonnard | 448ea50 | 2015-01-12 11:40:14 +0100 | [diff] [blame] | 2146 | "$P_CLI debug_level=3 crt_file=none key_file=none min_version=ssl3" \ |
Manuel Pégourié-Gonnard | de515cc | 2014-02-27 14:58:26 +0100 | [diff] [blame] | 2147 | 0 \ |
| 2148 | -S "skip write certificate request" \ |
| 2149 | -C "skip parse certificate request" \ |
| 2150 | -c "got a certificate request" \ |
| 2151 | -C "skip write certificate$" \ |
| 2152 | -c "skip write certificate verify" \ |
| 2153 | -c "got no certificate to send" \ |
| 2154 | -s "SSLv3 client has no certificate" \ |
| 2155 | -s "skip parse certificate verify" \ |
Manuel Pégourié-Gonnard | 89addc4 | 2015-04-20 10:56:18 +0100 | [diff] [blame] | 2156 | -s "! Certificate was missing" \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2157 | -S "! mbedtls_ssl_handshake returned" \ |
| 2158 | -C "! mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | de515cc | 2014-02-27 14:58:26 +0100 | [diff] [blame] | 2159 | -S "X509 - Certificate verification failed" |
| 2160 | |
Manuel Pégourié-Gonnard | 9107b5f | 2017-07-06 12:16:25 +0200 | [diff] [blame] | 2161 | # The "max_int chain" tests assume that MAX_INTERMEDIATE_CA is set to its |
| 2162 | # default value (8) |
Hanno Becker | a6bca9f | 2017-07-26 13:35:11 +0100 | [diff] [blame] | 2163 | |
Simon Butcher | bcfa6f4 | 2017-07-28 15:59:35 +0100 | [diff] [blame] | 2164 | MAX_IM_CA='8' |
Simon Butcher | 06b7863 | 2017-07-28 01:00:17 +0100 | [diff] [blame] | 2165 | MAX_IM_CA_CONFIG=$( ../scripts/config.pl get MBEDTLS_X509_MAX_INTERMEDIATE_CA) |
Hanno Becker | a6bca9f | 2017-07-26 13:35:11 +0100 | [diff] [blame] | 2166 | |
Simon Butcher | bcfa6f4 | 2017-07-28 15:59:35 +0100 | [diff] [blame] | 2167 | if [ -n "$MAX_IM_CA_CONFIG" ] && [ "$MAX_IM_CA_CONFIG" -ne "$MAX_IM_CA" ]; then |
Simon Butcher | 06b7863 | 2017-07-28 01:00:17 +0100 | [diff] [blame] | 2168 | printf "The ${CONFIG_H} file contains a value for the configuration of\n" |
Simon Butcher | bcfa6f4 | 2017-07-28 15:59:35 +0100 | [diff] [blame] | 2169 | printf "MBEDTLS_X509_MAX_INTERMEDIATE_CA that is different from the script’s\n" |
Simon Butcher | 06b7863 | 2017-07-28 01:00:17 +0100 | [diff] [blame] | 2170 | printf "test value of ${MAX_IM_CA}. \n" |
| 2171 | printf "\n" |
Simon Butcher | bcfa6f4 | 2017-07-28 15:59:35 +0100 | [diff] [blame] | 2172 | printf "The tests assume this value and if it changes, the tests in this\n" |
| 2173 | printf "script should also be adjusted.\n" |
Simon Butcher | 06b7863 | 2017-07-28 01:00:17 +0100 | [diff] [blame] | 2174 | printf "\n" |
Simon Butcher | 06b7863 | 2017-07-28 01:00:17 +0100 | [diff] [blame] | 2175 | |
| 2176 | exit 1 |
Hanno Becker | a6bca9f | 2017-07-26 13:35:11 +0100 | [diff] [blame] | 2177 | fi |
| 2178 | |
Manuel Pégourié-Gonnard | 81bb6b6 | 2017-06-26 10:45:33 +0200 | [diff] [blame] | 2179 | run_test "Authentication: server max_int chain, client default" \ |
| 2180 | "$P_SRV crt_file=data_files/dir-maxpath/c09.pem \ |
| 2181 | key_file=data_files/dir-maxpath/09.key" \ |
| 2182 | "$P_CLI server_name=CA09 ca_file=data_files/dir-maxpath/00.crt" \ |
| 2183 | 0 \ |
| 2184 | -C "X509 - A fatal error occured" |
| 2185 | |
| 2186 | run_test "Authentication: server max_int+1 chain, client default" \ |
| 2187 | "$P_SRV crt_file=data_files/dir-maxpath/c10.pem \ |
| 2188 | key_file=data_files/dir-maxpath/10.key" \ |
| 2189 | "$P_CLI server_name=CA10 ca_file=data_files/dir-maxpath/00.crt" \ |
| 2190 | 1 \ |
| 2191 | -c "X509 - A fatal error occured" |
| 2192 | |
| 2193 | run_test "Authentication: server max_int+1 chain, client optional" \ |
| 2194 | "$P_SRV crt_file=data_files/dir-maxpath/c10.pem \ |
| 2195 | key_file=data_files/dir-maxpath/10.key" \ |
| 2196 | "$P_CLI server_name=CA10 ca_file=data_files/dir-maxpath/00.crt \ |
| 2197 | auth_mode=optional" \ |
| 2198 | 1 \ |
| 2199 | -c "X509 - A fatal error occured" |
| 2200 | |
| 2201 | run_test "Authentication: server max_int+1 chain, client none" \ |
| 2202 | "$P_SRV crt_file=data_files/dir-maxpath/c10.pem \ |
| 2203 | key_file=data_files/dir-maxpath/10.key" \ |
| 2204 | "$P_CLI server_name=CA10 ca_file=data_files/dir-maxpath/00.crt \ |
| 2205 | auth_mode=none" \ |
| 2206 | 0 \ |
| 2207 | -C "X509 - A fatal error occured" |
| 2208 | |
| 2209 | run_test "Authentication: client max_int+1 chain, server default" \ |
| 2210 | "$P_SRV ca_file=data_files/dir-maxpath/00.crt" \ |
| 2211 | "$P_CLI crt_file=data_files/dir-maxpath/c10.pem \ |
| 2212 | key_file=data_files/dir-maxpath/10.key" \ |
| 2213 | 0 \ |
| 2214 | -S "X509 - A fatal error occured" |
| 2215 | |
| 2216 | run_test "Authentication: client max_int+1 chain, server optional" \ |
| 2217 | "$P_SRV ca_file=data_files/dir-maxpath/00.crt auth_mode=optional" \ |
| 2218 | "$P_CLI crt_file=data_files/dir-maxpath/c10.pem \ |
| 2219 | key_file=data_files/dir-maxpath/10.key" \ |
| 2220 | 1 \ |
| 2221 | -s "X509 - A fatal error occured" |
| 2222 | |
| 2223 | run_test "Authentication: client max_int+1 chain, server required" \ |
| 2224 | "$P_SRV ca_file=data_files/dir-maxpath/00.crt auth_mode=required" \ |
| 2225 | "$P_CLI crt_file=data_files/dir-maxpath/c10.pem \ |
| 2226 | key_file=data_files/dir-maxpath/10.key" \ |
| 2227 | 1 \ |
| 2228 | -s "X509 - A fatal error occured" |
| 2229 | |
| 2230 | run_test "Authentication: client max_int chain, server required" \ |
| 2231 | "$P_SRV ca_file=data_files/dir-maxpath/00.crt auth_mode=required" \ |
| 2232 | "$P_CLI crt_file=data_files/dir-maxpath/c09.pem \ |
| 2233 | key_file=data_files/dir-maxpath/09.key" \ |
| 2234 | 0 \ |
| 2235 | -S "X509 - A fatal error occured" |
| 2236 | |
Janos Follath | 89baba2 | 2017-04-10 14:34:35 +0100 | [diff] [blame] | 2237 | # Tests for CA list in CertificateRequest messages |
| 2238 | |
| 2239 | run_test "Authentication: send CA list in CertificateRequest (default)" \ |
| 2240 | "$P_SRV debug_level=3 auth_mode=required" \ |
| 2241 | "$P_CLI crt_file=data_files/server6.crt \ |
| 2242 | key_file=data_files/server6.key" \ |
| 2243 | 0 \ |
| 2244 | -s "requested DN" |
| 2245 | |
| 2246 | run_test "Authentication: do not send CA list in CertificateRequest" \ |
| 2247 | "$P_SRV debug_level=3 auth_mode=required cert_req_ca_list=0" \ |
| 2248 | "$P_CLI crt_file=data_files/server6.crt \ |
| 2249 | key_file=data_files/server6.key" \ |
| 2250 | 0 \ |
| 2251 | -S "requested DN" |
| 2252 | |
| 2253 | run_test "Authentication: send CA list in CertificateRequest, client self signed" \ |
| 2254 | "$P_SRV debug_level=3 auth_mode=required cert_req_ca_list=0" \ |
| 2255 | "$P_CLI debug_level=3 crt_file=data_files/server5-selfsigned.crt \ |
| 2256 | key_file=data_files/server5.key" \ |
| 2257 | 1 \ |
| 2258 | -S "requested DN" \ |
| 2259 | -s "x509_verify_cert() returned" \ |
| 2260 | -s "! The certificate is not correctly signed by the trusted CA" \ |
| 2261 | -s "! mbedtls_ssl_handshake returned" \ |
| 2262 | -c "! mbedtls_ssl_handshake returned" \ |
| 2263 | -s "X509 - Certificate verification failed" |
| 2264 | |
Manuel Pégourié-Gonnard | df331a5 | 2015-01-08 16:43:07 +0100 | [diff] [blame] | 2265 | # Tests for certificate selection based on SHA verson |
| 2266 | |
| 2267 | run_test "Certificate hash: client TLS 1.2 -> SHA-2" \ |
| 2268 | "$P_SRV crt_file=data_files/server5.crt \ |
| 2269 | key_file=data_files/server5.key \ |
| 2270 | crt_file2=data_files/server5-sha1.crt \ |
| 2271 | key_file2=data_files/server5.key" \ |
| 2272 | "$P_CLI force_version=tls1_2" \ |
| 2273 | 0 \ |
| 2274 | -c "signed using.*ECDSA with SHA256" \ |
| 2275 | -C "signed using.*ECDSA with SHA1" |
| 2276 | |
| 2277 | run_test "Certificate hash: client TLS 1.1 -> SHA-1" \ |
| 2278 | "$P_SRV crt_file=data_files/server5.crt \ |
| 2279 | key_file=data_files/server5.key \ |
| 2280 | crt_file2=data_files/server5-sha1.crt \ |
| 2281 | key_file2=data_files/server5.key" \ |
| 2282 | "$P_CLI force_version=tls1_1" \ |
| 2283 | 0 \ |
| 2284 | -C "signed using.*ECDSA with SHA256" \ |
| 2285 | -c "signed using.*ECDSA with SHA1" |
| 2286 | |
| 2287 | run_test "Certificate hash: client TLS 1.0 -> SHA-1" \ |
| 2288 | "$P_SRV crt_file=data_files/server5.crt \ |
| 2289 | key_file=data_files/server5.key \ |
| 2290 | crt_file2=data_files/server5-sha1.crt \ |
| 2291 | key_file2=data_files/server5.key" \ |
| 2292 | "$P_CLI force_version=tls1" \ |
| 2293 | 0 \ |
| 2294 | -C "signed using.*ECDSA with SHA256" \ |
| 2295 | -c "signed using.*ECDSA with SHA1" |
| 2296 | |
| 2297 | run_test "Certificate hash: client TLS 1.1, no SHA-1 -> SHA-2 (order 1)" \ |
| 2298 | "$P_SRV crt_file=data_files/server5.crt \ |
| 2299 | key_file=data_files/server5.key \ |
| 2300 | crt_file2=data_files/server6.crt \ |
| 2301 | key_file2=data_files/server6.key" \ |
| 2302 | "$P_CLI force_version=tls1_1" \ |
| 2303 | 0 \ |
| 2304 | -c "serial number.*09" \ |
| 2305 | -c "signed using.*ECDSA with SHA256" \ |
| 2306 | -C "signed using.*ECDSA with SHA1" |
| 2307 | |
| 2308 | run_test "Certificate hash: client TLS 1.1, no SHA-1 -> SHA-2 (order 2)" \ |
| 2309 | "$P_SRV crt_file=data_files/server6.crt \ |
| 2310 | key_file=data_files/server6.key \ |
| 2311 | crt_file2=data_files/server5.crt \ |
| 2312 | key_file2=data_files/server5.key" \ |
| 2313 | "$P_CLI force_version=tls1_1" \ |
| 2314 | 0 \ |
| 2315 | -c "serial number.*0A" \ |
| 2316 | -c "signed using.*ECDSA with SHA256" \ |
| 2317 | -C "signed using.*ECDSA with SHA1" |
| 2318 | |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 2319 | # tests for SNI |
| 2320 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2321 | run_test "SNI: no SNI callback" \ |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 2322 | "$P_SRV debug_level=3 \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 2323 | crt_file=data_files/server5.crt key_file=data_files/server5.key" \ |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 2324 | "$P_CLI server_name=localhost" \ |
Manuel Pégourié-Gonnard | 6ea831d | 2015-06-22 16:50:52 +0200 | [diff] [blame] | 2325 | 0 \ |
| 2326 | -S "parse ServerName extension" \ |
| 2327 | -c "issuer name *: C=NL, O=PolarSSL, CN=Polarssl Test EC CA" \ |
| 2328 | -c "subject name *: C=NL, O=PolarSSL, CN=localhost" |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 2329 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2330 | run_test "SNI: matching cert 1" \ |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 2331 | "$P_SRV debug_level=3 \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 2332 | crt_file=data_files/server5.crt key_file=data_files/server5.key \ |
Manuel Pégourié-Gonnard | 4d6f178 | 2015-06-19 14:40:39 +0200 | [diff] [blame] | 2333 | sni=localhost,data_files/server2.crt,data_files/server2.key,-,-,-,polarssl.example,data_files/server1-nospace.crt,data_files/server1.key,-,-,-" \ |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 2334 | "$P_CLI server_name=localhost" \ |
Manuel Pégourié-Gonnard | 6ea831d | 2015-06-22 16:50:52 +0200 | [diff] [blame] | 2335 | 0 \ |
| 2336 | -s "parse ServerName extension" \ |
| 2337 | -c "issuer name *: C=NL, O=PolarSSL, CN=PolarSSL Test CA" \ |
| 2338 | -c "subject name *: C=NL, O=PolarSSL, CN=localhost" |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 2339 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2340 | run_test "SNI: matching cert 2" \ |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 2341 | "$P_SRV debug_level=3 \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 2342 | crt_file=data_files/server5.crt key_file=data_files/server5.key \ |
Manuel Pégourié-Gonnard | 4d6f178 | 2015-06-19 14:40:39 +0200 | [diff] [blame] | 2343 | sni=localhost,data_files/server2.crt,data_files/server2.key,-,-,-,polarssl.example,data_files/server1-nospace.crt,data_files/server1.key,-,-,-" \ |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 2344 | "$P_CLI server_name=polarssl.example" \ |
Manuel Pégourié-Gonnard | 6ea831d | 2015-06-22 16:50:52 +0200 | [diff] [blame] | 2345 | 0 \ |
| 2346 | -s "parse ServerName extension" \ |
| 2347 | -c "issuer name *: C=NL, O=PolarSSL, CN=PolarSSL Test CA" \ |
| 2348 | -c "subject name *: C=NL, O=PolarSSL, CN=polarssl.example" |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 2349 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2350 | run_test "SNI: no matching cert" \ |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 2351 | "$P_SRV debug_level=3 \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 2352 | crt_file=data_files/server5.crt key_file=data_files/server5.key \ |
Manuel Pégourié-Gonnard | 4d6f178 | 2015-06-19 14:40:39 +0200 | [diff] [blame] | 2353 | sni=localhost,data_files/server2.crt,data_files/server2.key,-,-,-,polarssl.example,data_files/server1-nospace.crt,data_files/server1.key,-,-,-" \ |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 2354 | "$P_CLI server_name=nonesuch.example" \ |
Manuel Pégourié-Gonnard | 6ea831d | 2015-06-22 16:50:52 +0200 | [diff] [blame] | 2355 | 1 \ |
| 2356 | -s "parse ServerName extension" \ |
| 2357 | -s "ssl_sni_wrapper() returned" \ |
| 2358 | -s "mbedtls_ssl_handshake returned" \ |
| 2359 | -c "mbedtls_ssl_handshake returned" \ |
| 2360 | -c "SSL - A fatal alert message was received from our peer" |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 2361 | |
Manuel Pégourié-Gonnard | c948a79 | 2015-06-22 16:04:20 +0200 | [diff] [blame] | 2362 | run_test "SNI: client auth no override: optional" \ |
| 2363 | "$P_SRV debug_level=3 auth_mode=optional \ |
| 2364 | crt_file=data_files/server5.crt key_file=data_files/server5.key \ |
| 2365 | sni=localhost,data_files/server2.crt,data_files/server2.key,-,-,-" \ |
| 2366 | "$P_CLI debug_level=3 server_name=localhost" \ |
Manuel Pégourié-Gonnard | 6ea831d | 2015-06-22 16:50:52 +0200 | [diff] [blame] | 2367 | 0 \ |
Manuel Pégourié-Gonnard | c948a79 | 2015-06-22 16:04:20 +0200 | [diff] [blame] | 2368 | -S "skip write certificate request" \ |
| 2369 | -C "skip parse certificate request" \ |
| 2370 | -c "got a certificate request" \ |
| 2371 | -C "skip write certificate" \ |
| 2372 | -C "skip write certificate verify" \ |
| 2373 | -S "skip parse certificate verify" |
| 2374 | |
| 2375 | run_test "SNI: client auth override: none -> optional" \ |
| 2376 | "$P_SRV debug_level=3 auth_mode=none \ |
| 2377 | crt_file=data_files/server5.crt key_file=data_files/server5.key \ |
| 2378 | sni=localhost,data_files/server2.crt,data_files/server2.key,-,-,optional" \ |
| 2379 | "$P_CLI debug_level=3 server_name=localhost" \ |
Manuel Pégourié-Gonnard | 6ea831d | 2015-06-22 16:50:52 +0200 | [diff] [blame] | 2380 | 0 \ |
Manuel Pégourié-Gonnard | c948a79 | 2015-06-22 16:04:20 +0200 | [diff] [blame] | 2381 | -S "skip write certificate request" \ |
| 2382 | -C "skip parse certificate request" \ |
| 2383 | -c "got a certificate request" \ |
| 2384 | -C "skip write certificate" \ |
| 2385 | -C "skip write certificate verify" \ |
| 2386 | -S "skip parse certificate verify" |
| 2387 | |
| 2388 | run_test "SNI: client auth override: optional -> none" \ |
| 2389 | "$P_SRV debug_level=3 auth_mode=optional \ |
| 2390 | crt_file=data_files/server5.crt key_file=data_files/server5.key \ |
| 2391 | sni=localhost,data_files/server2.crt,data_files/server2.key,-,-,none" \ |
| 2392 | "$P_CLI debug_level=3 server_name=localhost" \ |
Manuel Pégourié-Gonnard | 6ea831d | 2015-06-22 16:50:52 +0200 | [diff] [blame] | 2393 | 0 \ |
Manuel Pégourié-Gonnard | c948a79 | 2015-06-22 16:04:20 +0200 | [diff] [blame] | 2394 | -s "skip write certificate request" \ |
| 2395 | -C "skip parse certificate request" \ |
| 2396 | -c "got no certificate request" \ |
| 2397 | -c "skip write certificate" \ |
| 2398 | -c "skip write certificate verify" \ |
| 2399 | -s "skip parse certificate verify" |
| 2400 | |
Manuel Pégourié-Gonnard | 6ea831d | 2015-06-22 16:50:52 +0200 | [diff] [blame] | 2401 | run_test "SNI: CA no override" \ |
| 2402 | "$P_SRV debug_level=3 auth_mode=optional \ |
| 2403 | crt_file=data_files/server5.crt key_file=data_files/server5.key \ |
| 2404 | ca_file=data_files/test-ca.crt \ |
| 2405 | sni=localhost,data_files/server2.crt,data_files/server2.key,-,-,required" \ |
| 2406 | "$P_CLI debug_level=3 server_name=localhost \ |
| 2407 | crt_file=data_files/server6.crt key_file=data_files/server6.key" \ |
| 2408 | 1 \ |
| 2409 | -S "skip write certificate request" \ |
| 2410 | -C "skip parse certificate request" \ |
| 2411 | -c "got a certificate request" \ |
| 2412 | -C "skip write certificate" \ |
| 2413 | -C "skip write certificate verify" \ |
| 2414 | -S "skip parse certificate verify" \ |
| 2415 | -s "x509_verify_cert() returned" \ |
| 2416 | -s "! The certificate is not correctly signed by the trusted CA" \ |
| 2417 | -S "The certificate has been revoked (is on a CRL)" |
| 2418 | |
| 2419 | run_test "SNI: CA override" \ |
| 2420 | "$P_SRV debug_level=3 auth_mode=optional \ |
| 2421 | crt_file=data_files/server5.crt key_file=data_files/server5.key \ |
| 2422 | ca_file=data_files/test-ca.crt \ |
| 2423 | sni=localhost,data_files/server2.crt,data_files/server2.key,data_files/test-ca2.crt,-,required" \ |
| 2424 | "$P_CLI debug_level=3 server_name=localhost \ |
| 2425 | crt_file=data_files/server6.crt key_file=data_files/server6.key" \ |
| 2426 | 0 \ |
| 2427 | -S "skip write certificate request" \ |
| 2428 | -C "skip parse certificate request" \ |
| 2429 | -c "got a certificate request" \ |
| 2430 | -C "skip write certificate" \ |
| 2431 | -C "skip write certificate verify" \ |
| 2432 | -S "skip parse certificate verify" \ |
| 2433 | -S "x509_verify_cert() returned" \ |
| 2434 | -S "! The certificate is not correctly signed by the trusted CA" \ |
| 2435 | -S "The certificate has been revoked (is on a CRL)" |
| 2436 | |
| 2437 | run_test "SNI: CA override with CRL" \ |
| 2438 | "$P_SRV debug_level=3 auth_mode=optional \ |
| 2439 | crt_file=data_files/server5.crt key_file=data_files/server5.key \ |
| 2440 | ca_file=data_files/test-ca.crt \ |
| 2441 | sni=localhost,data_files/server2.crt,data_files/server2.key,data_files/test-ca2.crt,data_files/crl-ec-sha256.pem,required" \ |
| 2442 | "$P_CLI debug_level=3 server_name=localhost \ |
| 2443 | crt_file=data_files/server6.crt key_file=data_files/server6.key" \ |
| 2444 | 1 \ |
| 2445 | -S "skip write certificate request" \ |
| 2446 | -C "skip parse certificate request" \ |
| 2447 | -c "got a certificate request" \ |
| 2448 | -C "skip write certificate" \ |
| 2449 | -C "skip write certificate verify" \ |
| 2450 | -S "skip parse certificate verify" \ |
| 2451 | -s "x509_verify_cert() returned" \ |
| 2452 | -S "! The certificate is not correctly signed by the trusted CA" \ |
| 2453 | -s "The certificate has been revoked (is on a CRL)" |
| 2454 | |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 2455 | # Tests for non-blocking I/O: exercise a variety of handshake flows |
| 2456 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2457 | run_test "Non-blocking I/O: basic handshake" \ |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 2458 | "$P_SRV nbio=2 tickets=0 auth_mode=none" \ |
| 2459 | "$P_CLI nbio=2 tickets=0" \ |
| 2460 | 0 \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2461 | -S "mbedtls_ssl_handshake returned" \ |
| 2462 | -C "mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 2463 | -c "Read from server: .* bytes read" |
| 2464 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2465 | run_test "Non-blocking I/O: client auth" \ |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 2466 | "$P_SRV nbio=2 tickets=0 auth_mode=required" \ |
| 2467 | "$P_CLI nbio=2 tickets=0" \ |
| 2468 | 0 \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2469 | -S "mbedtls_ssl_handshake returned" \ |
| 2470 | -C "mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 2471 | -c "Read from server: .* bytes read" |
| 2472 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2473 | run_test "Non-blocking I/O: ticket" \ |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 2474 | "$P_SRV nbio=2 tickets=1 auth_mode=none" \ |
| 2475 | "$P_CLI nbio=2 tickets=1" \ |
| 2476 | 0 \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2477 | -S "mbedtls_ssl_handshake returned" \ |
| 2478 | -C "mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 2479 | -c "Read from server: .* bytes read" |
| 2480 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2481 | run_test "Non-blocking I/O: ticket + client auth" \ |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 2482 | "$P_SRV nbio=2 tickets=1 auth_mode=required" \ |
| 2483 | "$P_CLI nbio=2 tickets=1" \ |
| 2484 | 0 \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2485 | -S "mbedtls_ssl_handshake returned" \ |
| 2486 | -C "mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 2487 | -c "Read from server: .* bytes read" |
| 2488 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2489 | run_test "Non-blocking I/O: ticket + client auth + resume" \ |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 2490 | "$P_SRV nbio=2 tickets=1 auth_mode=required" \ |
| 2491 | "$P_CLI nbio=2 tickets=1 reconnect=1" \ |
| 2492 | 0 \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2493 | -S "mbedtls_ssl_handshake returned" \ |
| 2494 | -C "mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 2495 | -c "Read from server: .* bytes read" |
| 2496 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2497 | run_test "Non-blocking I/O: ticket + resume" \ |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 2498 | "$P_SRV nbio=2 tickets=1 auth_mode=none" \ |
| 2499 | "$P_CLI nbio=2 tickets=1 reconnect=1" \ |
| 2500 | 0 \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2501 | -S "mbedtls_ssl_handshake returned" \ |
| 2502 | -C "mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 2503 | -c "Read from server: .* bytes read" |
| 2504 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2505 | run_test "Non-blocking I/O: session-id resume" \ |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 2506 | "$P_SRV nbio=2 tickets=0 auth_mode=none" \ |
| 2507 | "$P_CLI nbio=2 tickets=0 reconnect=1" \ |
| 2508 | 0 \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2509 | -S "mbedtls_ssl_handshake returned" \ |
| 2510 | -C "mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 2511 | -c "Read from server: .* bytes read" |
| 2512 | |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 2513 | # Tests for version negotiation |
| 2514 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2515 | run_test "Version check: all -> 1.2" \ |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 2516 | "$P_SRV" \ |
| 2517 | "$P_CLI" \ |
| 2518 | 0 \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2519 | -S "mbedtls_ssl_handshake returned" \ |
| 2520 | -C "mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 2521 | -s "Protocol is TLSv1.2" \ |
| 2522 | -c "Protocol is TLSv1.2" |
| 2523 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2524 | run_test "Version check: cli max 1.1 -> 1.1" \ |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 2525 | "$P_SRV" \ |
| 2526 | "$P_CLI max_version=tls1_1" \ |
| 2527 | 0 \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2528 | -S "mbedtls_ssl_handshake returned" \ |
| 2529 | -C "mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 2530 | -s "Protocol is TLSv1.1" \ |
| 2531 | -c "Protocol is TLSv1.1" |
| 2532 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2533 | run_test "Version check: srv max 1.1 -> 1.1" \ |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 2534 | "$P_SRV max_version=tls1_1" \ |
| 2535 | "$P_CLI" \ |
| 2536 | 0 \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2537 | -S "mbedtls_ssl_handshake returned" \ |
| 2538 | -C "mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 2539 | -s "Protocol is TLSv1.1" \ |
| 2540 | -c "Protocol is TLSv1.1" |
| 2541 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2542 | run_test "Version check: cli+srv max 1.1 -> 1.1" \ |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 2543 | "$P_SRV max_version=tls1_1" \ |
| 2544 | "$P_CLI max_version=tls1_1" \ |
| 2545 | 0 \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2546 | -S "mbedtls_ssl_handshake returned" \ |
| 2547 | -C "mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 2548 | -s "Protocol is TLSv1.1" \ |
| 2549 | -c "Protocol is TLSv1.1" |
| 2550 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2551 | run_test "Version check: cli max 1.1, srv min 1.1 -> 1.1" \ |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 2552 | "$P_SRV min_version=tls1_1" \ |
| 2553 | "$P_CLI max_version=tls1_1" \ |
| 2554 | 0 \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2555 | -S "mbedtls_ssl_handshake returned" \ |
| 2556 | -C "mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 2557 | -s "Protocol is TLSv1.1" \ |
| 2558 | -c "Protocol is TLSv1.1" |
| 2559 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2560 | run_test "Version check: cli min 1.1, srv max 1.1 -> 1.1" \ |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 2561 | "$P_SRV max_version=tls1_1" \ |
| 2562 | "$P_CLI min_version=tls1_1" \ |
| 2563 | 0 \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2564 | -S "mbedtls_ssl_handshake returned" \ |
| 2565 | -C "mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 2566 | -s "Protocol is TLSv1.1" \ |
| 2567 | -c "Protocol is TLSv1.1" |
| 2568 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2569 | run_test "Version check: cli min 1.2, srv max 1.1 -> fail" \ |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 2570 | "$P_SRV max_version=tls1_1" \ |
| 2571 | "$P_CLI min_version=tls1_2" \ |
| 2572 | 1 \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2573 | -s "mbedtls_ssl_handshake returned" \ |
| 2574 | -c "mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 2575 | -c "SSL - Handshake protocol not within min/max boundaries" |
| 2576 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2577 | run_test "Version check: srv min 1.2, cli max 1.1 -> fail" \ |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 2578 | "$P_SRV min_version=tls1_2" \ |
| 2579 | "$P_CLI max_version=tls1_1" \ |
| 2580 | 1 \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2581 | -s "mbedtls_ssl_handshake returned" \ |
| 2582 | -c "mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 2583 | -s "SSL - Handshake protocol not within min/max boundaries" |
| 2584 | |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 2585 | # Tests for ALPN extension |
| 2586 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2587 | run_test "ALPN: none" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2588 | "$P_SRV debug_level=3" \ |
| 2589 | "$P_CLI debug_level=3" \ |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 2590 | 0 \ |
| 2591 | -C "client hello, adding alpn extension" \ |
| 2592 | -S "found alpn extension" \ |
| 2593 | -C "got an alert message, type: \\[2:120]" \ |
| 2594 | -S "server hello, adding alpn extension" \ |
| 2595 | -C "found alpn extension " \ |
| 2596 | -C "Application Layer Protocol is" \ |
| 2597 | -S "Application Layer Protocol is" |
| 2598 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2599 | run_test "ALPN: client only" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2600 | "$P_SRV debug_level=3" \ |
| 2601 | "$P_CLI debug_level=3 alpn=abc,1234" \ |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 2602 | 0 \ |
| 2603 | -c "client hello, adding alpn extension" \ |
| 2604 | -s "found alpn extension" \ |
| 2605 | -C "got an alert message, type: \\[2:120]" \ |
| 2606 | -S "server hello, adding alpn extension" \ |
| 2607 | -C "found alpn extension " \ |
| 2608 | -c "Application Layer Protocol is (none)" \ |
| 2609 | -S "Application Layer Protocol is" |
| 2610 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2611 | run_test "ALPN: server only" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2612 | "$P_SRV debug_level=3 alpn=abc,1234" \ |
| 2613 | "$P_CLI debug_level=3" \ |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 2614 | 0 \ |
| 2615 | -C "client hello, adding alpn extension" \ |
| 2616 | -S "found alpn extension" \ |
| 2617 | -C "got an alert message, type: \\[2:120]" \ |
| 2618 | -S "server hello, adding alpn extension" \ |
| 2619 | -C "found alpn extension " \ |
| 2620 | -C "Application Layer Protocol is" \ |
| 2621 | -s "Application Layer Protocol is (none)" |
| 2622 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2623 | run_test "ALPN: both, common cli1-srv1" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2624 | "$P_SRV debug_level=3 alpn=abc,1234" \ |
| 2625 | "$P_CLI debug_level=3 alpn=abc,1234" \ |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 2626 | 0 \ |
| 2627 | -c "client hello, adding alpn extension" \ |
| 2628 | -s "found alpn extension" \ |
| 2629 | -C "got an alert message, type: \\[2:120]" \ |
| 2630 | -s "server hello, adding alpn extension" \ |
| 2631 | -c "found alpn extension" \ |
| 2632 | -c "Application Layer Protocol is abc" \ |
| 2633 | -s "Application Layer Protocol is abc" |
| 2634 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2635 | run_test "ALPN: both, common cli2-srv1" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2636 | "$P_SRV debug_level=3 alpn=abc,1234" \ |
| 2637 | "$P_CLI debug_level=3 alpn=1234,abc" \ |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 2638 | 0 \ |
| 2639 | -c "client hello, adding alpn extension" \ |
| 2640 | -s "found alpn extension" \ |
| 2641 | -C "got an alert message, type: \\[2:120]" \ |
| 2642 | -s "server hello, adding alpn extension" \ |
| 2643 | -c "found alpn extension" \ |
| 2644 | -c "Application Layer Protocol is abc" \ |
| 2645 | -s "Application Layer Protocol is abc" |
| 2646 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2647 | run_test "ALPN: both, common cli1-srv2" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2648 | "$P_SRV debug_level=3 alpn=abc,1234" \ |
| 2649 | "$P_CLI debug_level=3 alpn=1234,abcde" \ |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 2650 | 0 \ |
| 2651 | -c "client hello, adding alpn extension" \ |
| 2652 | -s "found alpn extension" \ |
| 2653 | -C "got an alert message, type: \\[2:120]" \ |
| 2654 | -s "server hello, adding alpn extension" \ |
| 2655 | -c "found alpn extension" \ |
| 2656 | -c "Application Layer Protocol is 1234" \ |
| 2657 | -s "Application Layer Protocol is 1234" |
| 2658 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2659 | run_test "ALPN: both, no common" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2660 | "$P_SRV debug_level=3 alpn=abc,123" \ |
| 2661 | "$P_CLI debug_level=3 alpn=1234,abcde" \ |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 2662 | 1 \ |
| 2663 | -c "client hello, adding alpn extension" \ |
| 2664 | -s "found alpn extension" \ |
| 2665 | -c "got an alert message, type: \\[2:120]" \ |
| 2666 | -S "server hello, adding alpn extension" \ |
| 2667 | -C "found alpn extension" \ |
| 2668 | -C "Application Layer Protocol is 1234" \ |
| 2669 | -S "Application Layer Protocol is 1234" |
| 2670 | |
Manuel Pégourié-Gonnard | 83d8c73 | 2014-04-07 13:24:21 +0200 | [diff] [blame] | 2671 | |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 2672 | # Tests for keyUsage in leaf certificates, part 1: |
| 2673 | # server-side certificate/suite selection |
| 2674 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2675 | run_test "keyUsage srv: RSA, digitalSignature -> (EC)DHE-RSA" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 2676 | "$P_SRV key_file=data_files/server2.key \ |
| 2677 | crt_file=data_files/server2.ku-ds.crt" \ |
| 2678 | "$P_CLI" \ |
| 2679 | 0 \ |
Manuel Pégourié-Gonnard | 17cde5f | 2014-05-22 14:42:39 +0200 | [diff] [blame] | 2680 | -c "Ciphersuite is TLS-[EC]*DHE-RSA-WITH-" |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 2681 | |
| 2682 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2683 | run_test "keyUsage srv: RSA, keyEncipherment -> RSA" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 2684 | "$P_SRV key_file=data_files/server2.key \ |
| 2685 | crt_file=data_files/server2.ku-ke.crt" \ |
| 2686 | "$P_CLI" \ |
| 2687 | 0 \ |
| 2688 | -c "Ciphersuite is TLS-RSA-WITH-" |
| 2689 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2690 | run_test "keyUsage srv: RSA, keyAgreement -> fail" \ |
Manuel Pégourié-Gonnard | f2629b9 | 2014-08-30 14:20:14 +0200 | [diff] [blame] | 2691 | "$P_SRV key_file=data_files/server2.key \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 2692 | crt_file=data_files/server2.ku-ka.crt" \ |
Manuel Pégourié-Gonnard | f2629b9 | 2014-08-30 14:20:14 +0200 | [diff] [blame] | 2693 | "$P_CLI" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 2694 | 1 \ |
| 2695 | -C "Ciphersuite is " |
| 2696 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2697 | run_test "keyUsage srv: ECDSA, digitalSignature -> ECDHE-ECDSA" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 2698 | "$P_SRV key_file=data_files/server5.key \ |
| 2699 | crt_file=data_files/server5.ku-ds.crt" \ |
| 2700 | "$P_CLI" \ |
| 2701 | 0 \ |
| 2702 | -c "Ciphersuite is TLS-ECDHE-ECDSA-WITH-" |
| 2703 | |
| 2704 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2705 | run_test "keyUsage srv: ECDSA, keyAgreement -> ECDH-" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 2706 | "$P_SRV key_file=data_files/server5.key \ |
| 2707 | crt_file=data_files/server5.ku-ka.crt" \ |
| 2708 | "$P_CLI" \ |
| 2709 | 0 \ |
| 2710 | -c "Ciphersuite is TLS-ECDH-" |
| 2711 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2712 | run_test "keyUsage srv: ECDSA, keyEncipherment -> fail" \ |
Manuel Pégourié-Gonnard | f2629b9 | 2014-08-30 14:20:14 +0200 | [diff] [blame] | 2713 | "$P_SRV key_file=data_files/server5.key \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 2714 | crt_file=data_files/server5.ku-ke.crt" \ |
Manuel Pégourié-Gonnard | f2629b9 | 2014-08-30 14:20:14 +0200 | [diff] [blame] | 2715 | "$P_CLI" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 2716 | 1 \ |
| 2717 | -C "Ciphersuite is " |
| 2718 | |
| 2719 | # Tests for keyUsage in leaf certificates, part 2: |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 2720 | # client-side checking of server cert |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 2721 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2722 | run_test "keyUsage cli: DigitalSignature+KeyEncipherment, RSA: OK" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 2723 | "$O_SRV -key data_files/server2.key \ |
| 2724 | -cert data_files/server2.ku-ds_ke.crt" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2725 | "$P_CLI debug_level=1 \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 2726 | force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| 2727 | 0 \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 2728 | -C "bad certificate (usage extensions)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 2729 | -C "Processing of the Certificate handshake message failed" \ |
| 2730 | -c "Ciphersuite is TLS-" |
| 2731 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2732 | run_test "keyUsage cli: DigitalSignature+KeyEncipherment, DHE-RSA: OK" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 2733 | "$O_SRV -key data_files/server2.key \ |
| 2734 | -cert data_files/server2.ku-ds_ke.crt" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2735 | "$P_CLI debug_level=1 \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 2736 | force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA" \ |
| 2737 | 0 \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 2738 | -C "bad certificate (usage extensions)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 2739 | -C "Processing of the Certificate handshake message failed" \ |
| 2740 | -c "Ciphersuite is TLS-" |
| 2741 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2742 | run_test "keyUsage cli: KeyEncipherment, RSA: OK" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 2743 | "$O_SRV -key data_files/server2.key \ |
| 2744 | -cert data_files/server2.ku-ke.crt" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2745 | "$P_CLI debug_level=1 \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 2746 | force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| 2747 | 0 \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 2748 | -C "bad certificate (usage extensions)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 2749 | -C "Processing of the Certificate handshake message failed" \ |
| 2750 | -c "Ciphersuite is TLS-" |
| 2751 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2752 | run_test "keyUsage cli: KeyEncipherment, DHE-RSA: fail" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 2753 | "$O_SRV -key data_files/server2.key \ |
| 2754 | -cert data_files/server2.ku-ke.crt" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2755 | "$P_CLI debug_level=1 \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 2756 | force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA" \ |
| 2757 | 1 \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 2758 | -c "bad certificate (usage extensions)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 2759 | -c "Processing of the Certificate handshake message failed" \ |
| 2760 | -C "Ciphersuite is TLS-" |
| 2761 | |
Manuel Pégourié-Gonnard | e6efa6f | 2015-04-20 11:01:48 +0100 | [diff] [blame] | 2762 | run_test "keyUsage cli: KeyEncipherment, DHE-RSA: fail, soft" \ |
| 2763 | "$O_SRV -key data_files/server2.key \ |
| 2764 | -cert data_files/server2.ku-ke.crt" \ |
| 2765 | "$P_CLI debug_level=1 auth_mode=optional \ |
| 2766 | force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA" \ |
| 2767 | 0 \ |
| 2768 | -c "bad certificate (usage extensions)" \ |
| 2769 | -C "Processing of the Certificate handshake message failed" \ |
| 2770 | -c "Ciphersuite is TLS-" \ |
| 2771 | -c "! Usage does not match the keyUsage extension" |
| 2772 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2773 | run_test "keyUsage cli: DigitalSignature, DHE-RSA: OK" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 2774 | "$O_SRV -key data_files/server2.key \ |
| 2775 | -cert data_files/server2.ku-ds.crt" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2776 | "$P_CLI debug_level=1 \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 2777 | force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA" \ |
| 2778 | 0 \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 2779 | -C "bad certificate (usage extensions)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 2780 | -C "Processing of the Certificate handshake message failed" \ |
| 2781 | -c "Ciphersuite is TLS-" |
| 2782 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2783 | run_test "keyUsage cli: DigitalSignature, RSA: fail" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 2784 | "$O_SRV -key data_files/server2.key \ |
| 2785 | -cert data_files/server2.ku-ds.crt" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2786 | "$P_CLI debug_level=1 \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 2787 | force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| 2788 | 1 \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 2789 | -c "bad certificate (usage extensions)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 2790 | -c "Processing of the Certificate handshake message failed" \ |
| 2791 | -C "Ciphersuite is TLS-" |
| 2792 | |
Manuel Pégourié-Gonnard | e6efa6f | 2015-04-20 11:01:48 +0100 | [diff] [blame] | 2793 | run_test "keyUsage cli: DigitalSignature, RSA: fail, soft" \ |
| 2794 | "$O_SRV -key data_files/server2.key \ |
| 2795 | -cert data_files/server2.ku-ds.crt" \ |
| 2796 | "$P_CLI debug_level=1 auth_mode=optional \ |
| 2797 | force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| 2798 | 0 \ |
| 2799 | -c "bad certificate (usage extensions)" \ |
| 2800 | -C "Processing of the Certificate handshake message failed" \ |
| 2801 | -c "Ciphersuite is TLS-" \ |
| 2802 | -c "! Usage does not match the keyUsage extension" |
| 2803 | |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 2804 | # Tests for keyUsage in leaf certificates, part 3: |
| 2805 | # server-side checking of client cert |
| 2806 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2807 | run_test "keyUsage cli-auth: RSA, DigitalSignature: OK" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2808 | "$P_SRV debug_level=1 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 2809 | "$O_CLI -key data_files/server2.key \ |
| 2810 | -cert data_files/server2.ku-ds.crt" \ |
| 2811 | 0 \ |
| 2812 | -S "bad certificate (usage extensions)" \ |
| 2813 | -S "Processing of the Certificate handshake message failed" |
| 2814 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2815 | run_test "keyUsage cli-auth: RSA, KeyEncipherment: fail (soft)" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2816 | "$P_SRV debug_level=1 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 2817 | "$O_CLI -key data_files/server2.key \ |
| 2818 | -cert data_files/server2.ku-ke.crt" \ |
| 2819 | 0 \ |
| 2820 | -s "bad certificate (usage extensions)" \ |
| 2821 | -S "Processing of the Certificate handshake message failed" |
| 2822 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2823 | run_test "keyUsage cli-auth: RSA, KeyEncipherment: fail (hard)" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2824 | "$P_SRV debug_level=1 auth_mode=required" \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 2825 | "$O_CLI -key data_files/server2.key \ |
| 2826 | -cert data_files/server2.ku-ke.crt" \ |
| 2827 | 1 \ |
| 2828 | -s "bad certificate (usage extensions)" \ |
| 2829 | -s "Processing of the Certificate handshake message failed" |
| 2830 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2831 | run_test "keyUsage cli-auth: ECDSA, DigitalSignature: OK" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2832 | "$P_SRV debug_level=1 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 2833 | "$O_CLI -key data_files/server5.key \ |
| 2834 | -cert data_files/server5.ku-ds.crt" \ |
| 2835 | 0 \ |
| 2836 | -S "bad certificate (usage extensions)" \ |
| 2837 | -S "Processing of the Certificate handshake message failed" |
| 2838 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2839 | run_test "keyUsage cli-auth: ECDSA, KeyAgreement: fail (soft)" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2840 | "$P_SRV debug_level=1 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 2841 | "$O_CLI -key data_files/server5.key \ |
| 2842 | -cert data_files/server5.ku-ka.crt" \ |
| 2843 | 0 \ |
| 2844 | -s "bad certificate (usage extensions)" \ |
| 2845 | -S "Processing of the Certificate handshake message failed" |
| 2846 | |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 2847 | # Tests for extendedKeyUsage, part 1: server-side certificate/suite selection |
| 2848 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2849 | run_test "extKeyUsage srv: serverAuth -> OK" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 2850 | "$P_SRV key_file=data_files/server5.key \ |
| 2851 | crt_file=data_files/server5.eku-srv.crt" \ |
| 2852 | "$P_CLI" \ |
| 2853 | 0 |
| 2854 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2855 | run_test "extKeyUsage srv: serverAuth,clientAuth -> OK" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 2856 | "$P_SRV key_file=data_files/server5.key \ |
| 2857 | crt_file=data_files/server5.eku-srv.crt" \ |
| 2858 | "$P_CLI" \ |
| 2859 | 0 |
| 2860 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2861 | run_test "extKeyUsage srv: codeSign,anyEKU -> OK" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 2862 | "$P_SRV key_file=data_files/server5.key \ |
| 2863 | crt_file=data_files/server5.eku-cs_any.crt" \ |
| 2864 | "$P_CLI" \ |
| 2865 | 0 |
| 2866 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2867 | run_test "extKeyUsage srv: codeSign -> fail" \ |
Manuel Pégourié-Gonnard | 7eb58cb | 2015-07-07 11:54:14 +0200 | [diff] [blame] | 2868 | "$P_SRV key_file=data_files/server5.key \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 2869 | crt_file=data_files/server5.eku-cli.crt" \ |
Manuel Pégourié-Gonnard | 7eb58cb | 2015-07-07 11:54:14 +0200 | [diff] [blame] | 2870 | "$P_CLI" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 2871 | 1 |
| 2872 | |
| 2873 | # Tests for extendedKeyUsage, part 2: client-side checking of server cert |
| 2874 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2875 | run_test "extKeyUsage cli: serverAuth -> OK" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 2876 | "$O_SRV -key data_files/server5.key \ |
| 2877 | -cert data_files/server5.eku-srv.crt" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2878 | "$P_CLI debug_level=1" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 2879 | 0 \ |
| 2880 | -C "bad certificate (usage extensions)" \ |
| 2881 | -C "Processing of the Certificate handshake message failed" \ |
| 2882 | -c "Ciphersuite is TLS-" |
| 2883 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2884 | run_test "extKeyUsage cli: serverAuth,clientAuth -> OK" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 2885 | "$O_SRV -key data_files/server5.key \ |
| 2886 | -cert data_files/server5.eku-srv_cli.crt" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2887 | "$P_CLI debug_level=1" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 2888 | 0 \ |
| 2889 | -C "bad certificate (usage extensions)" \ |
| 2890 | -C "Processing of the Certificate handshake message failed" \ |
| 2891 | -c "Ciphersuite is TLS-" |
| 2892 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2893 | run_test "extKeyUsage cli: codeSign,anyEKU -> OK" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 2894 | "$O_SRV -key data_files/server5.key \ |
| 2895 | -cert data_files/server5.eku-cs_any.crt" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2896 | "$P_CLI debug_level=1" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 2897 | 0 \ |
| 2898 | -C "bad certificate (usage extensions)" \ |
| 2899 | -C "Processing of the Certificate handshake message failed" \ |
| 2900 | -c "Ciphersuite is TLS-" |
| 2901 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2902 | run_test "extKeyUsage cli: codeSign -> fail" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 2903 | "$O_SRV -key data_files/server5.key \ |
| 2904 | -cert data_files/server5.eku-cs.crt" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2905 | "$P_CLI debug_level=1" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 2906 | 1 \ |
| 2907 | -c "bad certificate (usage extensions)" \ |
| 2908 | -c "Processing of the Certificate handshake message failed" \ |
| 2909 | -C "Ciphersuite is TLS-" |
| 2910 | |
| 2911 | # Tests for extendedKeyUsage, part 3: server-side checking of client cert |
| 2912 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2913 | run_test "extKeyUsage cli-auth: clientAuth -> OK" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2914 | "$P_SRV debug_level=1 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 2915 | "$O_CLI -key data_files/server5.key \ |
| 2916 | -cert data_files/server5.eku-cli.crt" \ |
| 2917 | 0 \ |
| 2918 | -S "bad certificate (usage extensions)" \ |
| 2919 | -S "Processing of the Certificate handshake message failed" |
| 2920 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2921 | run_test "extKeyUsage cli-auth: serverAuth,clientAuth -> OK" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2922 | "$P_SRV debug_level=1 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 2923 | "$O_CLI -key data_files/server5.key \ |
| 2924 | -cert data_files/server5.eku-srv_cli.crt" \ |
| 2925 | 0 \ |
| 2926 | -S "bad certificate (usage extensions)" \ |
| 2927 | -S "Processing of the Certificate handshake message failed" |
| 2928 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2929 | run_test "extKeyUsage cli-auth: codeSign,anyEKU -> OK" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2930 | "$P_SRV debug_level=1 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 2931 | "$O_CLI -key data_files/server5.key \ |
| 2932 | -cert data_files/server5.eku-cs_any.crt" \ |
| 2933 | 0 \ |
| 2934 | -S "bad certificate (usage extensions)" \ |
| 2935 | -S "Processing of the Certificate handshake message failed" |
| 2936 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2937 | run_test "extKeyUsage cli-auth: codeSign -> fail (soft)" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2938 | "$P_SRV debug_level=1 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 2939 | "$O_CLI -key data_files/server5.key \ |
| 2940 | -cert data_files/server5.eku-cs.crt" \ |
| 2941 | 0 \ |
| 2942 | -s "bad certificate (usage extensions)" \ |
| 2943 | -S "Processing of the Certificate handshake message failed" |
| 2944 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2945 | run_test "extKeyUsage cli-auth: codeSign -> fail (hard)" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2946 | "$P_SRV debug_level=1 auth_mode=required" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 2947 | "$O_CLI -key data_files/server5.key \ |
| 2948 | -cert data_files/server5.eku-cs.crt" \ |
| 2949 | 1 \ |
| 2950 | -s "bad certificate (usage extensions)" \ |
| 2951 | -s "Processing of the Certificate handshake message failed" |
| 2952 | |
Manuel Pégourié-Gonnard | 0cc7e31 | 2014-06-09 11:36:47 +0200 | [diff] [blame] | 2953 | # Tests for DHM parameters loading |
| 2954 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2955 | run_test "DHM parameters: reference" \ |
Manuel Pégourié-Gonnard | 0cc7e31 | 2014-06-09 11:36:47 +0200 | [diff] [blame] | 2956 | "$P_SRV" \ |
| 2957 | "$P_CLI force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA \ |
| 2958 | debug_level=3" \ |
| 2959 | 0 \ |
| 2960 | -c "value of 'DHM: P ' (2048 bits)" \ |
| 2961 | -c "value of 'DHM: G ' (2048 bits)" |
| 2962 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2963 | run_test "DHM parameters: other parameters" \ |
Manuel Pégourié-Gonnard | 0cc7e31 | 2014-06-09 11:36:47 +0200 | [diff] [blame] | 2964 | "$P_SRV dhm_file=data_files/dhparams.pem" \ |
| 2965 | "$P_CLI force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA \ |
| 2966 | debug_level=3" \ |
| 2967 | 0 \ |
| 2968 | -c "value of 'DHM: P ' (1024 bits)" \ |
| 2969 | -c "value of 'DHM: G ' (2 bits)" |
| 2970 | |
Manuel Pégourié-Gonnard | 7a010aa | 2015-06-12 11:19:10 +0200 | [diff] [blame] | 2971 | # Tests for DHM client-side size checking |
| 2972 | |
| 2973 | run_test "DHM size: server default, client default, OK" \ |
| 2974 | "$P_SRV" \ |
| 2975 | "$P_CLI force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA \ |
| 2976 | debug_level=1" \ |
| 2977 | 0 \ |
| 2978 | -C "DHM prime too short:" |
| 2979 | |
| 2980 | run_test "DHM size: server default, client 2048, OK" \ |
| 2981 | "$P_SRV" \ |
| 2982 | "$P_CLI force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA \ |
| 2983 | debug_level=1 dhmlen=2048" \ |
| 2984 | 0 \ |
| 2985 | -C "DHM prime too short:" |
| 2986 | |
| 2987 | run_test "DHM size: server 1024, client default, OK" \ |
| 2988 | "$P_SRV dhm_file=data_files/dhparams.pem" \ |
| 2989 | "$P_CLI force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA \ |
| 2990 | debug_level=1" \ |
| 2991 | 0 \ |
| 2992 | -C "DHM prime too short:" |
| 2993 | |
| 2994 | run_test "DHM size: server 1000, client default, rejected" \ |
| 2995 | "$P_SRV dhm_file=data_files/dh.1000.pem" \ |
| 2996 | "$P_CLI force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA \ |
| 2997 | debug_level=1" \ |
| 2998 | 1 \ |
| 2999 | -c "DHM prime too short:" |
| 3000 | |
| 3001 | run_test "DHM size: server default, client 2049, rejected" \ |
| 3002 | "$P_SRV" \ |
| 3003 | "$P_CLI force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA \ |
| 3004 | debug_level=1 dhmlen=2049" \ |
| 3005 | 1 \ |
| 3006 | -c "DHM prime too short:" |
| 3007 | |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 3008 | # Tests for PSK callback |
| 3009 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3010 | run_test "PSK callback: psk, no callback" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 3011 | "$P_SRV psk=abc123 psk_identity=foo" \ |
| 3012 | "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \ |
| 3013 | psk_identity=foo psk=abc123" \ |
| 3014 | 0 \ |
Manuel Pégourié-Gonnard | f01768c | 2015-01-08 17:06:16 +0100 | [diff] [blame] | 3015 | -S "SSL - None of the common ciphersuites is usable" \ |
Manuel Pégourié-Gonnard | 10c3c9f | 2014-06-10 15:28:52 +0200 | [diff] [blame] | 3016 | -S "SSL - Unknown identity received" \ |
| 3017 | -S "SSL - Verification of the message MAC failed" |
| 3018 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3019 | run_test "PSK callback: no psk, no callback" \ |
Manuel Pégourié-Gonnard | 10c3c9f | 2014-06-10 15:28:52 +0200 | [diff] [blame] | 3020 | "$P_SRV" \ |
| 3021 | "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \ |
| 3022 | psk_identity=foo psk=abc123" \ |
| 3023 | 1 \ |
Manuel Pégourié-Gonnard | f01768c | 2015-01-08 17:06:16 +0100 | [diff] [blame] | 3024 | -s "SSL - None of the common ciphersuites is usable" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 3025 | -S "SSL - Unknown identity received" \ |
| 3026 | -S "SSL - Verification of the message MAC failed" |
| 3027 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3028 | run_test "PSK callback: callback overrides other settings" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 3029 | "$P_SRV psk=abc123 psk_identity=foo psk_list=abc,dead,def,beef" \ |
| 3030 | "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \ |
| 3031 | psk_identity=foo psk=abc123" \ |
| 3032 | 1 \ |
Manuel Pégourié-Gonnard | f01768c | 2015-01-08 17:06:16 +0100 | [diff] [blame] | 3033 | -S "SSL - None of the common ciphersuites is usable" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 3034 | -s "SSL - Unknown identity received" \ |
| 3035 | -S "SSL - Verification of the message MAC failed" |
| 3036 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3037 | run_test "PSK callback: first id matches" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 3038 | "$P_SRV psk_list=abc,dead,def,beef" \ |
| 3039 | "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \ |
| 3040 | psk_identity=abc psk=dead" \ |
| 3041 | 0 \ |
Manuel Pégourié-Gonnard | f01768c | 2015-01-08 17:06:16 +0100 | [diff] [blame] | 3042 | -S "SSL - None of the common ciphersuites is usable" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 3043 | -S "SSL - Unknown identity received" \ |
| 3044 | -S "SSL - Verification of the message MAC failed" |
| 3045 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3046 | run_test "PSK callback: second id matches" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 3047 | "$P_SRV psk_list=abc,dead,def,beef" \ |
| 3048 | "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \ |
| 3049 | psk_identity=def psk=beef" \ |
| 3050 | 0 \ |
Manuel Pégourié-Gonnard | f01768c | 2015-01-08 17:06:16 +0100 | [diff] [blame] | 3051 | -S "SSL - None of the common ciphersuites is usable" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 3052 | -S "SSL - Unknown identity received" \ |
| 3053 | -S "SSL - Verification of the message MAC failed" |
| 3054 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3055 | run_test "PSK callback: no match" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 3056 | "$P_SRV psk_list=abc,dead,def,beef" \ |
| 3057 | "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \ |
| 3058 | psk_identity=ghi psk=beef" \ |
| 3059 | 1 \ |
Manuel Pégourié-Gonnard | f01768c | 2015-01-08 17:06:16 +0100 | [diff] [blame] | 3060 | -S "SSL - None of the common ciphersuites is usable" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 3061 | -s "SSL - Unknown identity received" \ |
| 3062 | -S "SSL - Verification of the message MAC failed" |
| 3063 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3064 | run_test "PSK callback: wrong key" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 3065 | "$P_SRV psk_list=abc,dead,def,beef" \ |
| 3066 | "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \ |
| 3067 | psk_identity=abc psk=beef" \ |
| 3068 | 1 \ |
Manuel Pégourié-Gonnard | f01768c | 2015-01-08 17:06:16 +0100 | [diff] [blame] | 3069 | -S "SSL - None of the common ciphersuites is usable" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 3070 | -S "SSL - Unknown identity received" \ |
| 3071 | -s "SSL - Verification of the message MAC failed" |
Manuel Pégourié-Gonnard | 0cc7e31 | 2014-06-09 11:36:47 +0200 | [diff] [blame] | 3072 | |
Manuel Pégourié-Gonnard | e511b4e | 2015-09-16 14:11:09 +0200 | [diff] [blame] | 3073 | # Tests for EC J-PAKE |
| 3074 | |
Manuel Pégourié-Gonnard | 12ca6f5 | 2015-10-20 15:24:51 +0200 | [diff] [blame] | 3075 | requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE |
Manuel Pégourié-Gonnard | e511b4e | 2015-09-16 14:11:09 +0200 | [diff] [blame] | 3076 | run_test "ECJPAKE: client not configured" \ |
| 3077 | "$P_SRV debug_level=3" \ |
| 3078 | "$P_CLI debug_level=3" \ |
| 3079 | 0 \ |
| 3080 | -C "add ciphersuite: c0ff" \ |
| 3081 | -C "adding ecjpake_kkpp extension" \ |
Manuel Pégourié-Gonnard | bf57be6 | 2015-09-16 15:04:01 +0200 | [diff] [blame] | 3082 | -S "found ecjpake kkpp extension" \ |
| 3083 | -S "skip ecjpake kkpp extension" \ |
Manuel Pégourié-Gonnard | e511b4e | 2015-09-16 14:11:09 +0200 | [diff] [blame] | 3084 | -S "ciphersuite mismatch: ecjpake not configured" \ |
Manuel Pégourié-Gonnard | 55c7f99 | 2015-09-16 15:35:27 +0200 | [diff] [blame] | 3085 | -S "server hello, ecjpake kkpp extension" \ |
Manuel Pégourié-Gonnard | 0a1324a | 2015-09-16 16:01:00 +0200 | [diff] [blame] | 3086 | -C "found ecjpake_kkpp extension" \ |
Manuel Pégourié-Gonnard | e511b4e | 2015-09-16 14:11:09 +0200 | [diff] [blame] | 3087 | -S "None of the common ciphersuites is usable" |
| 3088 | |
Manuel Pégourié-Gonnard | 12ca6f5 | 2015-10-20 15:24:51 +0200 | [diff] [blame] | 3089 | requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE |
Manuel Pégourié-Gonnard | e511b4e | 2015-09-16 14:11:09 +0200 | [diff] [blame] | 3090 | run_test "ECJPAKE: server not configured" \ |
| 3091 | "$P_SRV debug_level=3" \ |
| 3092 | "$P_CLI debug_level=3 ecjpake_pw=bla \ |
| 3093 | force_ciphersuite=TLS-ECJPAKE-WITH-AES-128-CCM-8" \ |
| 3094 | 1 \ |
| 3095 | -c "add ciphersuite: c0ff" \ |
| 3096 | -c "adding ecjpake_kkpp extension" \ |
Manuel Pégourié-Gonnard | bf57be6 | 2015-09-16 15:04:01 +0200 | [diff] [blame] | 3097 | -s "found ecjpake kkpp extension" \ |
| 3098 | -s "skip ecjpake kkpp extension" \ |
Manuel Pégourié-Gonnard | e511b4e | 2015-09-16 14:11:09 +0200 | [diff] [blame] | 3099 | -s "ciphersuite mismatch: ecjpake not configured" \ |
Manuel Pégourié-Gonnard | 55c7f99 | 2015-09-16 15:35:27 +0200 | [diff] [blame] | 3100 | -S "server hello, ecjpake kkpp extension" \ |
Manuel Pégourié-Gonnard | 0a1324a | 2015-09-16 16:01:00 +0200 | [diff] [blame] | 3101 | -C "found ecjpake_kkpp extension" \ |
Manuel Pégourié-Gonnard | e511b4e | 2015-09-16 14:11:09 +0200 | [diff] [blame] | 3102 | -s "None of the common ciphersuites is usable" |
| 3103 | |
Manuel Pégourié-Gonnard | 12ca6f5 | 2015-10-20 15:24:51 +0200 | [diff] [blame] | 3104 | requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE |
Manuel Pégourié-Gonnard | bf57be6 | 2015-09-16 15:04:01 +0200 | [diff] [blame] | 3105 | run_test "ECJPAKE: working, TLS" \ |
| 3106 | "$P_SRV debug_level=3 ecjpake_pw=bla" \ |
| 3107 | "$P_CLI debug_level=3 ecjpake_pw=bla \ |
| 3108 | force_ciphersuite=TLS-ECJPAKE-WITH-AES-128-CCM-8" \ |
Manuel Pégourié-Gonnard | 0f1660a | 2015-09-16 22:41:06 +0200 | [diff] [blame] | 3109 | 0 \ |
Manuel Pégourié-Gonnard | bf57be6 | 2015-09-16 15:04:01 +0200 | [diff] [blame] | 3110 | -c "add ciphersuite: c0ff" \ |
| 3111 | -c "adding ecjpake_kkpp extension" \ |
Manuel Pégourié-Gonnard | d0d8cb3 | 2015-09-17 14:16:30 +0200 | [diff] [blame] | 3112 | -C "re-using cached ecjpake parameters" \ |
Manuel Pégourié-Gonnard | bf57be6 | 2015-09-16 15:04:01 +0200 | [diff] [blame] | 3113 | -s "found ecjpake kkpp extension" \ |
| 3114 | -S "skip ecjpake kkpp extension" \ |
| 3115 | -S "ciphersuite mismatch: ecjpake not configured" \ |
Manuel Pégourié-Gonnard | 55c7f99 | 2015-09-16 15:35:27 +0200 | [diff] [blame] | 3116 | -s "server hello, ecjpake kkpp extension" \ |
Manuel Pégourié-Gonnard | 0a1324a | 2015-09-16 16:01:00 +0200 | [diff] [blame] | 3117 | -c "found ecjpake_kkpp extension" \ |
Manuel Pégourié-Gonnard | 921f2d0 | 2015-09-16 22:52:18 +0200 | [diff] [blame] | 3118 | -S "None of the common ciphersuites is usable" \ |
| 3119 | -S "SSL - Verification of the message MAC failed" |
| 3120 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 3121 | server_needs_more_time 1 |
Manuel Pégourié-Gonnard | 12ca6f5 | 2015-10-20 15:24:51 +0200 | [diff] [blame] | 3122 | requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE |
Manuel Pégourié-Gonnard | 921f2d0 | 2015-09-16 22:52:18 +0200 | [diff] [blame] | 3123 | run_test "ECJPAKE: password mismatch, TLS" \ |
| 3124 | "$P_SRV debug_level=3 ecjpake_pw=bla" \ |
| 3125 | "$P_CLI debug_level=3 ecjpake_pw=bad \ |
| 3126 | force_ciphersuite=TLS-ECJPAKE-WITH-AES-128-CCM-8" \ |
| 3127 | 1 \ |
Manuel Pégourié-Gonnard | d0d8cb3 | 2015-09-17 14:16:30 +0200 | [diff] [blame] | 3128 | -C "re-using cached ecjpake parameters" \ |
Manuel Pégourié-Gonnard | 921f2d0 | 2015-09-16 22:52:18 +0200 | [diff] [blame] | 3129 | -s "SSL - Verification of the message MAC failed" |
| 3130 | |
Manuel Pégourié-Gonnard | 12ca6f5 | 2015-10-20 15:24:51 +0200 | [diff] [blame] | 3131 | requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE |
Manuel Pégourié-Gonnard | 921f2d0 | 2015-09-16 22:52:18 +0200 | [diff] [blame] | 3132 | run_test "ECJPAKE: working, DTLS" \ |
| 3133 | "$P_SRV debug_level=3 dtls=1 ecjpake_pw=bla" \ |
| 3134 | "$P_CLI debug_level=3 dtls=1 ecjpake_pw=bla \ |
| 3135 | force_ciphersuite=TLS-ECJPAKE-WITH-AES-128-CCM-8" \ |
| 3136 | 0 \ |
Manuel Pégourié-Gonnard | d0d8cb3 | 2015-09-17 14:16:30 +0200 | [diff] [blame] | 3137 | -c "re-using cached ecjpake parameters" \ |
| 3138 | -S "SSL - Verification of the message MAC failed" |
| 3139 | |
Manuel Pégourié-Gonnard | 12ca6f5 | 2015-10-20 15:24:51 +0200 | [diff] [blame] | 3140 | requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE |
Manuel Pégourié-Gonnard | d0d8cb3 | 2015-09-17 14:16:30 +0200 | [diff] [blame] | 3141 | run_test "ECJPAKE: working, DTLS, no cookie" \ |
| 3142 | "$P_SRV debug_level=3 dtls=1 ecjpake_pw=bla cookies=0" \ |
| 3143 | "$P_CLI debug_level=3 dtls=1 ecjpake_pw=bla \ |
| 3144 | force_ciphersuite=TLS-ECJPAKE-WITH-AES-128-CCM-8" \ |
| 3145 | 0 \ |
| 3146 | -C "re-using cached ecjpake parameters" \ |
Manuel Pégourié-Gonnard | 921f2d0 | 2015-09-16 22:52:18 +0200 | [diff] [blame] | 3147 | -S "SSL - Verification of the message MAC failed" |
| 3148 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 3149 | server_needs_more_time 1 |
Manuel Pégourié-Gonnard | 12ca6f5 | 2015-10-20 15:24:51 +0200 | [diff] [blame] | 3150 | requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE |
Manuel Pégourié-Gonnard | 921f2d0 | 2015-09-16 22:52:18 +0200 | [diff] [blame] | 3151 | run_test "ECJPAKE: password mismatch, DTLS" \ |
| 3152 | "$P_SRV debug_level=3 dtls=1 ecjpake_pw=bla" \ |
| 3153 | "$P_CLI debug_level=3 dtls=1 ecjpake_pw=bad \ |
| 3154 | force_ciphersuite=TLS-ECJPAKE-WITH-AES-128-CCM-8" \ |
| 3155 | 1 \ |
Manuel Pégourié-Gonnard | d0d8cb3 | 2015-09-17 14:16:30 +0200 | [diff] [blame] | 3156 | -c "re-using cached ecjpake parameters" \ |
Manuel Pégourié-Gonnard | 921f2d0 | 2015-09-16 22:52:18 +0200 | [diff] [blame] | 3157 | -s "SSL - Verification of the message MAC failed" |
Manuel Pégourié-Gonnard | bf57be6 | 2015-09-16 15:04:01 +0200 | [diff] [blame] | 3158 | |
Manuel Pégourié-Gonnard | ca700b2 | 2015-10-20 14:47:00 +0200 | [diff] [blame] | 3159 | # for tests with configs/config-thread.h |
Manuel Pégourié-Gonnard | 12ca6f5 | 2015-10-20 15:24:51 +0200 | [diff] [blame] | 3160 | requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE |
Manuel Pégourié-Gonnard | ca700b2 | 2015-10-20 14:47:00 +0200 | [diff] [blame] | 3161 | run_test "ECJPAKE: working, DTLS, nolog" \ |
| 3162 | "$P_SRV dtls=1 ecjpake_pw=bla" \ |
| 3163 | "$P_CLI dtls=1 ecjpake_pw=bla \ |
| 3164 | force_ciphersuite=TLS-ECJPAKE-WITH-AES-128-CCM-8" \ |
| 3165 | 0 |
| 3166 | |
Manuel Pégourié-Gonnard | 90805a8 | 2014-06-11 14:06:01 +0200 | [diff] [blame] | 3167 | # Tests for ciphersuites per version |
| 3168 | |
Janos Follath | e2681a4 | 2016-03-07 15:57:05 +0000 | [diff] [blame] | 3169 | requires_config_enabled MBEDTLS_SSL_PROTO_SSL3 |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3170 | run_test "Per-version suites: SSL3" \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 3171 | "$P_SRV min_version=ssl3 version_suites=TLS-RSA-WITH-3DES-EDE-CBC-SHA,TLS-RSA-WITH-AES-256-CBC-SHA,TLS-RSA-WITH-AES-128-CBC-SHA,TLS-RSA-WITH-AES-128-GCM-SHA256" \ |
Manuel Pégourié-Gonnard | 90805a8 | 2014-06-11 14:06:01 +0200 | [diff] [blame] | 3172 | "$P_CLI force_version=ssl3" \ |
| 3173 | 0 \ |
| 3174 | -c "Ciphersuite is TLS-RSA-WITH-3DES-EDE-CBC-SHA" |
| 3175 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3176 | run_test "Per-version suites: TLS 1.0" \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 3177 | "$P_SRV arc4=1 version_suites=TLS-RSA-WITH-3DES-EDE-CBC-SHA,TLS-RSA-WITH-AES-256-CBC-SHA,TLS-RSA-WITH-AES-128-CBC-SHA,TLS-RSA-WITH-AES-128-GCM-SHA256" \ |
Manuel Pégourié-Gonnard | bd47a58 | 2015-01-12 13:43:29 +0100 | [diff] [blame] | 3178 | "$P_CLI force_version=tls1 arc4=1" \ |
Manuel Pégourié-Gonnard | 90805a8 | 2014-06-11 14:06:01 +0200 | [diff] [blame] | 3179 | 0 \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 3180 | -c "Ciphersuite is TLS-RSA-WITH-AES-256-CBC-SHA" |
Manuel Pégourié-Gonnard | 90805a8 | 2014-06-11 14:06:01 +0200 | [diff] [blame] | 3181 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3182 | run_test "Per-version suites: TLS 1.1" \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 3183 | "$P_SRV version_suites=TLS-RSA-WITH-3DES-EDE-CBC-SHA,TLS-RSA-WITH-AES-256-CBC-SHA,TLS-RSA-WITH-AES-128-CBC-SHA,TLS-RSA-WITH-AES-128-GCM-SHA256" \ |
Manuel Pégourié-Gonnard | 90805a8 | 2014-06-11 14:06:01 +0200 | [diff] [blame] | 3184 | "$P_CLI force_version=tls1_1" \ |
| 3185 | 0 \ |
| 3186 | -c "Ciphersuite is TLS-RSA-WITH-AES-128-CBC-SHA" |
| 3187 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3188 | run_test "Per-version suites: TLS 1.2" \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 3189 | "$P_SRV version_suites=TLS-RSA-WITH-3DES-EDE-CBC-SHA,TLS-RSA-WITH-AES-256-CBC-SHA,TLS-RSA-WITH-AES-128-CBC-SHA,TLS-RSA-WITH-AES-128-GCM-SHA256" \ |
Manuel Pégourié-Gonnard | 90805a8 | 2014-06-11 14:06:01 +0200 | [diff] [blame] | 3190 | "$P_CLI force_version=tls1_2" \ |
| 3191 | 0 \ |
| 3192 | -c "Ciphersuite is TLS-RSA-WITH-AES-128-GCM-SHA256" |
| 3193 | |
Manuel Pégourié-Gonnard | 4cc8c63 | 2015-07-23 12:24:03 +0200 | [diff] [blame] | 3194 | # Test for ClientHello without extensions |
| 3195 | |
Manuel Pégourié-Gonnard | d55bc20 | 2015-08-04 16:22:30 +0200 | [diff] [blame] | 3196 | requires_gnutls |
Gilles Peskine | 5d2511c | 2017-05-12 13:16:40 +0200 | [diff] [blame] | 3197 | run_test "ClientHello without extensions, SHA-1 allowed" \ |
Manuel Pégourié-Gonnard | 4cc8c63 | 2015-07-23 12:24:03 +0200 | [diff] [blame] | 3198 | "$P_SRV debug_level=3" \ |
| 3199 | "$G_CLI --priority=NORMAL:%NO_EXTENSIONS:%DISABLE_SAFE_RENEGOTIATION" \ |
| 3200 | 0 \ |
| 3201 | -s "dumping 'client hello extensions' (0 bytes)" |
| 3202 | |
Gilles Peskine | 5d2511c | 2017-05-12 13:16:40 +0200 | [diff] [blame] | 3203 | requires_gnutls |
| 3204 | run_test "ClientHello without extensions, SHA-1 forbidden in certificates on server" \ |
| 3205 | "$P_SRV debug_level=3 key_file=data_files/server2.key crt_file=data_files/server2.crt allow_sha1=0" \ |
| 3206 | "$G_CLI --priority=NORMAL:%NO_EXTENSIONS:%DISABLE_SAFE_RENEGOTIATION" \ |
| 3207 | 0 \ |
| 3208 | -s "dumping 'client hello extensions' (0 bytes)" |
| 3209 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 3210 | # Tests for mbedtls_ssl_get_bytes_avail() |
Manuel Pégourié-Gonnard | 95c0a63 | 2014-06-11 18:32:36 +0200 | [diff] [blame] | 3211 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 3212 | run_test "mbedtls_ssl_get_bytes_avail: no extra data" \ |
Manuel Pégourié-Gonnard | 95c0a63 | 2014-06-11 18:32:36 +0200 | [diff] [blame] | 3213 | "$P_SRV" \ |
| 3214 | "$P_CLI request_size=100" \ |
| 3215 | 0 \ |
| 3216 | -s "Read from client: 100 bytes read$" |
| 3217 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 3218 | run_test "mbedtls_ssl_get_bytes_avail: extra data" \ |
Manuel Pégourié-Gonnard | 95c0a63 | 2014-06-11 18:32:36 +0200 | [diff] [blame] | 3219 | "$P_SRV" \ |
| 3220 | "$P_CLI request_size=500" \ |
| 3221 | 0 \ |
| 3222 | -s "Read from client: 500 bytes read (.*+.*)" |
Manuel Pégourié-Gonnard | 90805a8 | 2014-06-11 14:06:01 +0200 | [diff] [blame] | 3223 | |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3224 | # Tests for small packets |
| 3225 | |
Janos Follath | e2681a4 | 2016-03-07 15:57:05 +0000 | [diff] [blame] | 3226 | requires_config_enabled MBEDTLS_SSL_PROTO_SSL3 |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3227 | run_test "Small packet SSLv3 BlockCipher" \ |
Manuel Pégourié-Gonnard | 448ea50 | 2015-01-12 11:40:14 +0100 | [diff] [blame] | 3228 | "$P_SRV min_version=ssl3" \ |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3229 | "$P_CLI request_size=1 force_version=ssl3 \ |
| 3230 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 3231 | 0 \ |
| 3232 | -s "Read from client: 1 bytes read" |
| 3233 | |
Janos Follath | e2681a4 | 2016-03-07 15:57:05 +0000 | [diff] [blame] | 3234 | requires_config_enabled MBEDTLS_SSL_PROTO_SSL3 |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3235 | run_test "Small packet SSLv3 StreamCipher" \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 3236 | "$P_SRV min_version=ssl3 arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3237 | "$P_CLI request_size=1 force_version=ssl3 \ |
| 3238 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 3239 | 0 \ |
| 3240 | -s "Read from client: 1 bytes read" |
| 3241 | |
| 3242 | run_test "Small packet TLS 1.0 BlockCipher" \ |
| 3243 | "$P_SRV" \ |
| 3244 | "$P_CLI request_size=1 force_version=tls1 \ |
| 3245 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 3246 | 0 \ |
| 3247 | -s "Read from client: 1 bytes read" |
| 3248 | |
Manuel Pégourié-Gonnard | 169dd6a | 2014-11-04 16:15:39 +0100 | [diff] [blame] | 3249 | run_test "Small packet TLS 1.0 BlockCipher without EtM" \ |
| 3250 | "$P_SRV" \ |
| 3251 | "$P_CLI request_size=1 force_version=tls1 etm=0 \ |
| 3252 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 3253 | 0 \ |
| 3254 | -s "Read from client: 1 bytes read" |
| 3255 | |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3256 | run_test "Small packet TLS 1.0 BlockCipher truncated MAC" \ |
| 3257 | "$P_SRV" \ |
| 3258 | "$P_CLI request_size=1 force_version=tls1 \ |
| 3259 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA \ |
| 3260 | trunc_hmac=1" \ |
| 3261 | 0 \ |
| 3262 | -s "Read from client: 1 bytes read" |
| 3263 | |
| 3264 | run_test "Small packet TLS 1.0 StreamCipher truncated MAC" \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 3265 | "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3266 | "$P_CLI request_size=1 force_version=tls1 \ |
| 3267 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \ |
| 3268 | trunc_hmac=1" \ |
| 3269 | 0 \ |
| 3270 | -s "Read from client: 1 bytes read" |
| 3271 | |
| 3272 | run_test "Small packet TLS 1.1 BlockCipher" \ |
| 3273 | "$P_SRV" \ |
| 3274 | "$P_CLI request_size=1 force_version=tls1_1 \ |
| 3275 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 3276 | 0 \ |
| 3277 | -s "Read from client: 1 bytes read" |
| 3278 | |
Manuel Pégourié-Gonnard | 169dd6a | 2014-11-04 16:15:39 +0100 | [diff] [blame] | 3279 | run_test "Small packet TLS 1.1 BlockCipher without EtM" \ |
| 3280 | "$P_SRV" \ |
| 3281 | "$P_CLI request_size=1 force_version=tls1_1 etm=0 \ |
| 3282 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 3283 | 0 \ |
| 3284 | -s "Read from client: 1 bytes read" |
| 3285 | |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3286 | run_test "Small packet TLS 1.1 StreamCipher" \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 3287 | "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3288 | "$P_CLI request_size=1 force_version=tls1_1 \ |
| 3289 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 3290 | 0 \ |
| 3291 | -s "Read from client: 1 bytes read" |
| 3292 | |
| 3293 | run_test "Small packet TLS 1.1 BlockCipher truncated MAC" \ |
| 3294 | "$P_SRV" \ |
| 3295 | "$P_CLI request_size=1 force_version=tls1_1 \ |
| 3296 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA \ |
| 3297 | trunc_hmac=1" \ |
| 3298 | 0 \ |
| 3299 | -s "Read from client: 1 bytes read" |
| 3300 | |
| 3301 | run_test "Small packet TLS 1.1 StreamCipher truncated MAC" \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 3302 | "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3303 | "$P_CLI request_size=1 force_version=tls1_1 \ |
| 3304 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \ |
| 3305 | trunc_hmac=1" \ |
| 3306 | 0 \ |
| 3307 | -s "Read from client: 1 bytes read" |
| 3308 | |
| 3309 | run_test "Small packet TLS 1.2 BlockCipher" \ |
| 3310 | "$P_SRV" \ |
| 3311 | "$P_CLI request_size=1 force_version=tls1_2 \ |
| 3312 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 3313 | 0 \ |
| 3314 | -s "Read from client: 1 bytes read" |
| 3315 | |
Manuel Pégourié-Gonnard | 169dd6a | 2014-11-04 16:15:39 +0100 | [diff] [blame] | 3316 | run_test "Small packet TLS 1.2 BlockCipher without EtM" \ |
| 3317 | "$P_SRV" \ |
| 3318 | "$P_CLI request_size=1 force_version=tls1_2 etm=0 \ |
| 3319 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 3320 | 0 \ |
| 3321 | -s "Read from client: 1 bytes read" |
| 3322 | |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3323 | run_test "Small packet TLS 1.2 BlockCipher larger MAC" \ |
| 3324 | "$P_SRV" \ |
Manuel Pégourié-Gonnard | c82ee35 | 2015-01-07 16:35:25 +0100 | [diff] [blame] | 3325 | "$P_CLI request_size=1 force_version=tls1_2 \ |
| 3326 | force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384" \ |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3327 | 0 \ |
| 3328 | -s "Read from client: 1 bytes read" |
| 3329 | |
| 3330 | run_test "Small packet TLS 1.2 BlockCipher truncated MAC" \ |
| 3331 | "$P_SRV" \ |
| 3332 | "$P_CLI request_size=1 force_version=tls1_2 \ |
| 3333 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA \ |
| 3334 | trunc_hmac=1" \ |
| 3335 | 0 \ |
| 3336 | -s "Read from client: 1 bytes read" |
| 3337 | |
| 3338 | run_test "Small packet TLS 1.2 StreamCipher" \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 3339 | "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3340 | "$P_CLI request_size=1 force_version=tls1_2 \ |
| 3341 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 3342 | 0 \ |
| 3343 | -s "Read from client: 1 bytes read" |
| 3344 | |
| 3345 | run_test "Small packet TLS 1.2 StreamCipher truncated MAC" \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 3346 | "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3347 | "$P_CLI request_size=1 force_version=tls1_2 \ |
| 3348 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \ |
| 3349 | trunc_hmac=1" \ |
| 3350 | 0 \ |
| 3351 | -s "Read from client: 1 bytes read" |
| 3352 | |
| 3353 | run_test "Small packet TLS 1.2 AEAD" \ |
| 3354 | "$P_SRV" \ |
| 3355 | "$P_CLI request_size=1 force_version=tls1_2 \ |
| 3356 | force_ciphersuite=TLS-RSA-WITH-AES-256-CCM" \ |
| 3357 | 0 \ |
| 3358 | -s "Read from client: 1 bytes read" |
| 3359 | |
| 3360 | run_test "Small packet TLS 1.2 AEAD shorter tag" \ |
| 3361 | "$P_SRV" \ |
| 3362 | "$P_CLI request_size=1 force_version=tls1_2 \ |
| 3363 | force_ciphersuite=TLS-RSA-WITH-AES-256-CCM-8" \ |
| 3364 | 0 \ |
| 3365 | -s "Read from client: 1 bytes read" |
| 3366 | |
Janos Follath | 00efff7 | 2016-05-06 13:48:23 +0100 | [diff] [blame] | 3367 | # A test for extensions in SSLv3 |
| 3368 | |
| 3369 | requires_config_enabled MBEDTLS_SSL_PROTO_SSL3 |
| 3370 | run_test "SSLv3 with extensions, server side" \ |
| 3371 | "$P_SRV min_version=ssl3 debug_level=3" \ |
| 3372 | "$P_CLI force_version=ssl3 tickets=1 max_frag_len=4096 alpn=abc,1234" \ |
| 3373 | 0 \ |
| 3374 | -S "dumping 'client hello extensions'" \ |
| 3375 | -S "server hello, total extension length:" |
| 3376 | |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 3377 | # Test for large packets |
| 3378 | |
Janos Follath | e2681a4 | 2016-03-07 15:57:05 +0000 | [diff] [blame] | 3379 | requires_config_enabled MBEDTLS_SSL_PROTO_SSL3 |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 3380 | run_test "Large packet SSLv3 BlockCipher" \ |
Manuel Pégourié-Gonnard | 448ea50 | 2015-01-12 11:40:14 +0100 | [diff] [blame] | 3381 | "$P_SRV min_version=ssl3" \ |
Manuel Pégourié-Gonnard | c82ee35 | 2015-01-07 16:35:25 +0100 | [diff] [blame] | 3382 | "$P_CLI request_size=16384 force_version=ssl3 recsplit=0 \ |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 3383 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 3384 | 0 \ |
| 3385 | -s "Read from client: 16384 bytes read" |
| 3386 | |
Janos Follath | e2681a4 | 2016-03-07 15:57:05 +0000 | [diff] [blame] | 3387 | requires_config_enabled MBEDTLS_SSL_PROTO_SSL3 |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 3388 | run_test "Large packet SSLv3 StreamCipher" \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 3389 | "$P_SRV min_version=ssl3 arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 3390 | "$P_CLI request_size=16384 force_version=ssl3 \ |
| 3391 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 3392 | 0 \ |
| 3393 | -s "Read from client: 16384 bytes read" |
| 3394 | |
| 3395 | run_test "Large packet TLS 1.0 BlockCipher" \ |
| 3396 | "$P_SRV" \ |
Manuel Pégourié-Gonnard | c82ee35 | 2015-01-07 16:35:25 +0100 | [diff] [blame] | 3397 | "$P_CLI request_size=16384 force_version=tls1 recsplit=0 \ |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 3398 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 3399 | 0 \ |
| 3400 | -s "Read from client: 16384 bytes read" |
| 3401 | |
| 3402 | run_test "Large packet TLS 1.0 BlockCipher truncated MAC" \ |
| 3403 | "$P_SRV" \ |
Manuel Pégourié-Gonnard | c82ee35 | 2015-01-07 16:35:25 +0100 | [diff] [blame] | 3404 | "$P_CLI request_size=16384 force_version=tls1 recsplit=0 \ |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 3405 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA \ |
| 3406 | trunc_hmac=1" \ |
| 3407 | 0 \ |
| 3408 | -s "Read from client: 16384 bytes read" |
| 3409 | |
| 3410 | run_test "Large packet TLS 1.0 StreamCipher truncated MAC" \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 3411 | "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 3412 | "$P_CLI request_size=16384 force_version=tls1 \ |
| 3413 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \ |
| 3414 | trunc_hmac=1" \ |
| 3415 | 0 \ |
| 3416 | -s "Read from client: 16384 bytes read" |
| 3417 | |
| 3418 | run_test "Large packet TLS 1.1 BlockCipher" \ |
| 3419 | "$P_SRV" \ |
| 3420 | "$P_CLI request_size=16384 force_version=tls1_1 \ |
| 3421 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 3422 | 0 \ |
| 3423 | -s "Read from client: 16384 bytes read" |
| 3424 | |
| 3425 | run_test "Large packet TLS 1.1 StreamCipher" \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 3426 | "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 3427 | "$P_CLI request_size=16384 force_version=tls1_1 \ |
| 3428 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 3429 | 0 \ |
| 3430 | -s "Read from client: 16384 bytes read" |
| 3431 | |
| 3432 | run_test "Large packet TLS 1.1 BlockCipher truncated MAC" \ |
| 3433 | "$P_SRV" \ |
| 3434 | "$P_CLI request_size=16384 force_version=tls1_1 \ |
| 3435 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA \ |
| 3436 | trunc_hmac=1" \ |
| 3437 | 0 \ |
| 3438 | -s "Read from client: 16384 bytes read" |
| 3439 | |
| 3440 | run_test "Large packet TLS 1.1 StreamCipher truncated MAC" \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 3441 | "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 3442 | "$P_CLI request_size=16384 force_version=tls1_1 \ |
| 3443 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \ |
| 3444 | trunc_hmac=1" \ |
| 3445 | 0 \ |
| 3446 | -s "Read from client: 16384 bytes read" |
| 3447 | |
| 3448 | run_test "Large packet TLS 1.2 BlockCipher" \ |
| 3449 | "$P_SRV" \ |
| 3450 | "$P_CLI request_size=16384 force_version=tls1_2 \ |
| 3451 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 3452 | 0 \ |
| 3453 | -s "Read from client: 16384 bytes read" |
| 3454 | |
| 3455 | run_test "Large packet TLS 1.2 BlockCipher larger MAC" \ |
| 3456 | "$P_SRV" \ |
Manuel Pégourié-Gonnard | c82ee35 | 2015-01-07 16:35:25 +0100 | [diff] [blame] | 3457 | "$P_CLI request_size=16384 force_version=tls1_2 \ |
| 3458 | force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384" \ |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 3459 | 0 \ |
| 3460 | -s "Read from client: 16384 bytes read" |
| 3461 | |
| 3462 | run_test "Large packet TLS 1.2 BlockCipher truncated MAC" \ |
| 3463 | "$P_SRV" \ |
| 3464 | "$P_CLI request_size=16384 force_version=tls1_2 \ |
| 3465 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA \ |
| 3466 | trunc_hmac=1" \ |
| 3467 | 0 \ |
| 3468 | -s "Read from client: 16384 bytes read" |
| 3469 | |
| 3470 | run_test "Large packet TLS 1.2 StreamCipher" \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 3471 | "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 3472 | "$P_CLI request_size=16384 force_version=tls1_2 \ |
| 3473 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 3474 | 0 \ |
| 3475 | -s "Read from client: 16384 bytes read" |
| 3476 | |
| 3477 | run_test "Large packet TLS 1.2 StreamCipher truncated MAC" \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 3478 | "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 3479 | "$P_CLI request_size=16384 force_version=tls1_2 \ |
| 3480 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \ |
| 3481 | trunc_hmac=1" \ |
| 3482 | 0 \ |
| 3483 | -s "Read from client: 16384 bytes read" |
| 3484 | |
| 3485 | run_test "Large packet TLS 1.2 AEAD" \ |
| 3486 | "$P_SRV" \ |
| 3487 | "$P_CLI request_size=16384 force_version=tls1_2 \ |
| 3488 | force_ciphersuite=TLS-RSA-WITH-AES-256-CCM" \ |
| 3489 | 0 \ |
| 3490 | -s "Read from client: 16384 bytes read" |
| 3491 | |
| 3492 | run_test "Large packet TLS 1.2 AEAD shorter tag" \ |
| 3493 | "$P_SRV" \ |
| 3494 | "$P_CLI request_size=16384 force_version=tls1_2 \ |
| 3495 | force_ciphersuite=TLS-RSA-WITH-AES-256-CCM-8" \ |
| 3496 | 0 \ |
| 3497 | -s "Read from client: 16384 bytes read" |
| 3498 | |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 3499 | # Tests for DTLS HelloVerifyRequest |
| 3500 | |
| 3501 | run_test "DTLS cookie: enabled" \ |
| 3502 | "$P_SRV dtls=1 debug_level=2" \ |
| 3503 | "$P_CLI dtls=1 debug_level=2" \ |
| 3504 | 0 \ |
| 3505 | -s "cookie verification failed" \ |
| 3506 | -s "cookie verification passed" \ |
| 3507 | -S "cookie verification skipped" \ |
| 3508 | -c "received hello verify request" \ |
Manuel Pégourié-Gonnard | caecdae | 2014-10-13 19:04:37 +0200 | [diff] [blame] | 3509 | -s "hello verification requested" \ |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 3510 | -S "SSL - The requested feature is not available" |
| 3511 | |
| 3512 | run_test "DTLS cookie: disabled" \ |
| 3513 | "$P_SRV dtls=1 debug_level=2 cookies=0" \ |
| 3514 | "$P_CLI dtls=1 debug_level=2" \ |
| 3515 | 0 \ |
| 3516 | -S "cookie verification failed" \ |
| 3517 | -S "cookie verification passed" \ |
| 3518 | -s "cookie verification skipped" \ |
| 3519 | -C "received hello verify request" \ |
Manuel Pégourié-Gonnard | caecdae | 2014-10-13 19:04:37 +0200 | [diff] [blame] | 3520 | -S "hello verification requested" \ |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 3521 | -S "SSL - The requested feature is not available" |
| 3522 | |
Manuel Pégourié-Gonnard | caecdae | 2014-10-13 19:04:37 +0200 | [diff] [blame] | 3523 | run_test "DTLS cookie: default (failing)" \ |
| 3524 | "$P_SRV dtls=1 debug_level=2 cookies=-1" \ |
| 3525 | "$P_CLI dtls=1 debug_level=2 hs_timeout=100-400" \ |
| 3526 | 1 \ |
| 3527 | -s "cookie verification failed" \ |
| 3528 | -S "cookie verification passed" \ |
| 3529 | -S "cookie verification skipped" \ |
| 3530 | -C "received hello verify request" \ |
| 3531 | -S "hello verification requested" \ |
| 3532 | -s "SSL - The requested feature is not available" |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 3533 | |
| 3534 | requires_ipv6 |
| 3535 | run_test "DTLS cookie: enabled, IPv6" \ |
| 3536 | "$P_SRV dtls=1 debug_level=2 server_addr=::1" \ |
| 3537 | "$P_CLI dtls=1 debug_level=2 server_addr=::1" \ |
| 3538 | 0 \ |
| 3539 | -s "cookie verification failed" \ |
| 3540 | -s "cookie verification passed" \ |
| 3541 | -S "cookie verification skipped" \ |
| 3542 | -c "received hello verify request" \ |
Manuel Pégourié-Gonnard | caecdae | 2014-10-13 19:04:37 +0200 | [diff] [blame] | 3543 | -s "hello verification requested" \ |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 3544 | -S "SSL - The requested feature is not available" |
| 3545 | |
Manuel Pégourié-Gonnard | 579950c | 2014-09-29 17:47:33 +0200 | [diff] [blame] | 3546 | run_test "DTLS cookie: enabled, nbio" \ |
| 3547 | "$P_SRV dtls=1 nbio=2 debug_level=2" \ |
| 3548 | "$P_CLI dtls=1 nbio=2 debug_level=2" \ |
| 3549 | 0 \ |
| 3550 | -s "cookie verification failed" \ |
| 3551 | -s "cookie verification passed" \ |
| 3552 | -S "cookie verification skipped" \ |
| 3553 | -c "received hello verify request" \ |
Manuel Pégourié-Gonnard | caecdae | 2014-10-13 19:04:37 +0200 | [diff] [blame] | 3554 | -s "hello verification requested" \ |
Manuel Pégourié-Gonnard | 579950c | 2014-09-29 17:47:33 +0200 | [diff] [blame] | 3555 | -S "SSL - The requested feature is not available" |
| 3556 | |
Manuel Pégourié-Gonnard | d745a1a | 2015-09-08 12:40:43 +0200 | [diff] [blame] | 3557 | # Tests for client reconnecting from the same port with DTLS |
| 3558 | |
Manuel Pégourié-Gonnard | 259db91 | 2015-09-09 11:37:17 +0200 | [diff] [blame] | 3559 | not_with_valgrind # spurious resend |
Manuel Pégourié-Gonnard | d745a1a | 2015-09-08 12:40:43 +0200 | [diff] [blame] | 3560 | run_test "DTLS client reconnect from same port: reference" \ |
Manuel Pégourié-Gonnard | 259db91 | 2015-09-09 11:37:17 +0200 | [diff] [blame] | 3561 | "$P_SRV dtls=1 exchanges=2 read_timeout=1000" \ |
| 3562 | "$P_CLI dtls=1 exchanges=2 debug_level=2 hs_timeout=500-1000" \ |
Manuel Pégourié-Gonnard | d745a1a | 2015-09-08 12:40:43 +0200 | [diff] [blame] | 3563 | 0 \ |
| 3564 | -C "resend" \ |
Manuel Pégourié-Gonnard | 259db91 | 2015-09-09 11:37:17 +0200 | [diff] [blame] | 3565 | -S "The operation timed out" \ |
Manuel Pégourié-Gonnard | d745a1a | 2015-09-08 12:40:43 +0200 | [diff] [blame] | 3566 | -S "Client initiated reconnection from same port" |
| 3567 | |
Manuel Pégourié-Gonnard | 259db91 | 2015-09-09 11:37:17 +0200 | [diff] [blame] | 3568 | not_with_valgrind # spurious resend |
Manuel Pégourié-Gonnard | d745a1a | 2015-09-08 12:40:43 +0200 | [diff] [blame] | 3569 | run_test "DTLS client reconnect from same port: reconnect" \ |
Manuel Pégourié-Gonnard | 259db91 | 2015-09-09 11:37:17 +0200 | [diff] [blame] | 3570 | "$P_SRV dtls=1 exchanges=2 read_timeout=1000" \ |
| 3571 | "$P_CLI dtls=1 exchanges=2 debug_level=2 hs_timeout=500-1000 reconnect_hard=1" \ |
Manuel Pégourié-Gonnard | d745a1a | 2015-09-08 12:40:43 +0200 | [diff] [blame] | 3572 | 0 \ |
| 3573 | -C "resend" \ |
Manuel Pégourié-Gonnard | 259db91 | 2015-09-09 11:37:17 +0200 | [diff] [blame] | 3574 | -S "The operation timed out" \ |
Manuel Pégourié-Gonnard | d745a1a | 2015-09-08 12:40:43 +0200 | [diff] [blame] | 3575 | -s "Client initiated reconnection from same port" |
| 3576 | |
Paul Bakker | 362689d | 2016-05-13 10:33:25 +0100 | [diff] [blame] | 3577 | not_with_valgrind # server/client too slow to respond in time (next test has higher timeouts) |
| 3578 | run_test "DTLS client reconnect from same port: reconnect, nbio, no valgrind" \ |
Manuel Pégourié-Gonnard | 259db91 | 2015-09-09 11:37:17 +0200 | [diff] [blame] | 3579 | "$P_SRV dtls=1 exchanges=2 read_timeout=1000 nbio=2" \ |
| 3580 | "$P_CLI dtls=1 exchanges=2 debug_level=2 hs_timeout=500-1000 reconnect_hard=1" \ |
Manuel Pégourié-Gonnard | d745a1a | 2015-09-08 12:40:43 +0200 | [diff] [blame] | 3581 | 0 \ |
Manuel Pégourié-Gonnard | 259db91 | 2015-09-09 11:37:17 +0200 | [diff] [blame] | 3582 | -S "The operation timed out" \ |
Manuel Pégourié-Gonnard | d745a1a | 2015-09-08 12:40:43 +0200 | [diff] [blame] | 3583 | -s "Client initiated reconnection from same port" |
| 3584 | |
Paul Bakker | 362689d | 2016-05-13 10:33:25 +0100 | [diff] [blame] | 3585 | only_with_valgrind # Only with valgrind, do previous test but with higher read_timeout and hs_timeout |
| 3586 | run_test "DTLS client reconnect from same port: reconnect, nbio, valgrind" \ |
| 3587 | "$P_SRV dtls=1 exchanges=2 read_timeout=2000 nbio=2 hs_timeout=1500-6000" \ |
| 3588 | "$P_CLI dtls=1 exchanges=2 debug_level=2 hs_timeout=1500-3000 reconnect_hard=1" \ |
| 3589 | 0 \ |
| 3590 | -S "The operation timed out" \ |
| 3591 | -s "Client initiated reconnection from same port" |
| 3592 | |
Manuel Pégourié-Gonnard | 259db91 | 2015-09-09 11:37:17 +0200 | [diff] [blame] | 3593 | run_test "DTLS client reconnect from same port: no cookies" \ |
| 3594 | "$P_SRV dtls=1 exchanges=2 read_timeout=1000 cookies=0" \ |
Manuel Pégourié-Gonnard | 6ad23b9 | 2015-09-15 12:57:46 +0200 | [diff] [blame] | 3595 | "$P_CLI dtls=1 exchanges=2 debug_level=2 hs_timeout=500-8000 reconnect_hard=1" \ |
| 3596 | 0 \ |
Manuel Pégourié-Gonnard | 259db91 | 2015-09-09 11:37:17 +0200 | [diff] [blame] | 3597 | -s "The operation timed out" \ |
| 3598 | -S "Client initiated reconnection from same port" |
| 3599 | |
Manuel Pégourié-Gonnard | 08a1d4b | 2014-09-26 10:35:50 +0200 | [diff] [blame] | 3600 | # Tests for various cases of client authentication with DTLS |
| 3601 | # (focused on handshake flows and message parsing) |
| 3602 | |
| 3603 | run_test "DTLS client auth: required" \ |
| 3604 | "$P_SRV dtls=1 auth_mode=required" \ |
| 3605 | "$P_CLI dtls=1" \ |
| 3606 | 0 \ |
| 3607 | -s "Verifying peer X.509 certificate... ok" |
| 3608 | |
| 3609 | run_test "DTLS client auth: optional, client has no cert" \ |
| 3610 | "$P_SRV dtls=1 auth_mode=optional" \ |
| 3611 | "$P_CLI dtls=1 crt_file=none key_file=none" \ |
| 3612 | 0 \ |
Manuel Pégourié-Gonnard | 89addc4 | 2015-04-20 10:56:18 +0100 | [diff] [blame] | 3613 | -s "! Certificate was missing" |
Manuel Pégourié-Gonnard | 08a1d4b | 2014-09-26 10:35:50 +0200 | [diff] [blame] | 3614 | |
Manuel Pégourié-Gonnard | 89addc4 | 2015-04-20 10:56:18 +0100 | [diff] [blame] | 3615 | run_test "DTLS client auth: none, client has no cert" \ |
Manuel Pégourié-Gonnard | 08a1d4b | 2014-09-26 10:35:50 +0200 | [diff] [blame] | 3616 | "$P_SRV dtls=1 auth_mode=none" \ |
| 3617 | "$P_CLI dtls=1 crt_file=none key_file=none debug_level=2" \ |
| 3618 | 0 \ |
| 3619 | -c "skip write certificate$" \ |
Manuel Pégourié-Gonnard | 89addc4 | 2015-04-20 10:56:18 +0100 | [diff] [blame] | 3620 | -s "! Certificate verification was skipped" |
Manuel Pégourié-Gonnard | 08a1d4b | 2014-09-26 10:35:50 +0200 | [diff] [blame] | 3621 | |
Manuel Pégourié-Gonnard | 0a88574 | 2015-08-04 12:08:35 +0200 | [diff] [blame] | 3622 | run_test "DTLS wrong PSK: badmac alert" \ |
| 3623 | "$P_SRV dtls=1 psk=abc123 force_ciphersuite=TLS-PSK-WITH-AES-128-GCM-SHA256" \ |
| 3624 | "$P_CLI dtls=1 psk=abc124" \ |
| 3625 | 1 \ |
| 3626 | -s "SSL - Verification of the message MAC failed" \ |
| 3627 | -c "SSL - A fatal alert message was received from our peer" |
| 3628 | |
Manuel Pégourié-Gonnard | 502bf30 | 2014-08-20 13:12:58 +0200 | [diff] [blame] | 3629 | # Tests for receiving fragmented handshake messages with DTLS |
| 3630 | |
| 3631 | requires_gnutls |
| 3632 | run_test "DTLS reassembly: no fragmentation (gnutls server)" \ |
| 3633 | "$G_SRV -u --mtu 2048 -a" \ |
| 3634 | "$P_CLI dtls=1 debug_level=2" \ |
| 3635 | 0 \ |
| 3636 | -C "found fragmented DTLS handshake message" \ |
| 3637 | -C "error" |
| 3638 | |
| 3639 | requires_gnutls |
| 3640 | run_test "DTLS reassembly: some fragmentation (gnutls server)" \ |
| 3641 | "$G_SRV -u --mtu 512" \ |
| 3642 | "$P_CLI dtls=1 debug_level=2" \ |
| 3643 | 0 \ |
| 3644 | -c "found fragmented DTLS handshake message" \ |
| 3645 | -C "error" |
| 3646 | |
| 3647 | requires_gnutls |
| 3648 | run_test "DTLS reassembly: more fragmentation (gnutls server)" \ |
| 3649 | "$G_SRV -u --mtu 128" \ |
| 3650 | "$P_CLI dtls=1 debug_level=2" \ |
| 3651 | 0 \ |
| 3652 | -c "found fragmented DTLS handshake message" \ |
| 3653 | -C "error" |
| 3654 | |
| 3655 | requires_gnutls |
| 3656 | run_test "DTLS reassembly: more fragmentation, nbio (gnutls server)" \ |
| 3657 | "$G_SRV -u --mtu 128" \ |
| 3658 | "$P_CLI dtls=1 nbio=2 debug_level=2" \ |
| 3659 | 0 \ |
| 3660 | -c "found fragmented DTLS handshake message" \ |
| 3661 | -C "error" |
| 3662 | |
Manuel Pégourié-Gonnard | 0c4cbc7 | 2014-09-02 14:47:31 +0200 | [diff] [blame] | 3663 | requires_gnutls |
Manuel Pégourié-Gonnard | 0c4cbc7 | 2014-09-02 14:47:31 +0200 | [diff] [blame] | 3664 | run_test "DTLS reassembly: fragmentation, renego (gnutls server)" \ |
| 3665 | "$G_SRV -u --mtu 256" \ |
| 3666 | "$P_CLI debug_level=3 dtls=1 renegotiation=1 renegotiate=1" \ |
| 3667 | 0 \ |
| 3668 | -c "found fragmented DTLS handshake message" \ |
| 3669 | -c "client hello, adding renegotiation extension" \ |
| 3670 | -c "found renegotiation extension" \ |
| 3671 | -c "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 3672 | -C "mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | 0c4cbc7 | 2014-09-02 14:47:31 +0200 | [diff] [blame] | 3673 | -C "error" \ |
| 3674 | -s "Extra-header:" |
| 3675 | |
| 3676 | requires_gnutls |
Manuel Pégourié-Gonnard | 0c4cbc7 | 2014-09-02 14:47:31 +0200 | [diff] [blame] | 3677 | run_test "DTLS reassembly: fragmentation, nbio, renego (gnutls server)" \ |
| 3678 | "$G_SRV -u --mtu 256" \ |
| 3679 | "$P_CLI debug_level=3 nbio=2 dtls=1 renegotiation=1 renegotiate=1" \ |
| 3680 | 0 \ |
| 3681 | -c "found fragmented DTLS handshake message" \ |
| 3682 | -c "client hello, adding renegotiation extension" \ |
| 3683 | -c "found renegotiation extension" \ |
| 3684 | -c "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 3685 | -C "mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | 0c4cbc7 | 2014-09-02 14:47:31 +0200 | [diff] [blame] | 3686 | -C "error" \ |
| 3687 | -s "Extra-header:" |
| 3688 | |
Manuel Pégourié-Gonnard | a775617 | 2014-08-31 18:37:01 +0200 | [diff] [blame] | 3689 | run_test "DTLS reassembly: no fragmentation (openssl server)" \ |
| 3690 | "$O_SRV -dtls1 -mtu 2048" \ |
| 3691 | "$P_CLI dtls=1 debug_level=2" \ |
| 3692 | 0 \ |
| 3693 | -C "found fragmented DTLS handshake message" \ |
| 3694 | -C "error" |
| 3695 | |
Manuel Pégourié-Gonnard | 825a49e | 2014-09-23 11:00:37 +0200 | [diff] [blame] | 3696 | run_test "DTLS reassembly: some fragmentation (openssl server)" \ |
| 3697 | "$O_SRV -dtls1 -mtu 768" \ |
Manuel Pégourié-Gonnard | 64dffc5 | 2014-09-02 13:39:16 +0200 | [diff] [blame] | 3698 | "$P_CLI dtls=1 debug_level=2" \ |
| 3699 | 0 \ |
| 3700 | -c "found fragmented DTLS handshake message" \ |
| 3701 | -C "error" |
| 3702 | |
Manuel Pégourié-Gonnard | 825a49e | 2014-09-23 11:00:37 +0200 | [diff] [blame] | 3703 | run_test "DTLS reassembly: more fragmentation (openssl server)" \ |
Manuel Pégourié-Gonnard | 64dffc5 | 2014-09-02 13:39:16 +0200 | [diff] [blame] | 3704 | "$O_SRV -dtls1 -mtu 256" \ |
| 3705 | "$P_CLI dtls=1 debug_level=2" \ |
| 3706 | 0 \ |
| 3707 | -c "found fragmented DTLS handshake message" \ |
| 3708 | -C "error" |
| 3709 | |
| 3710 | run_test "DTLS reassembly: fragmentation, nbio (openssl server)" \ |
| 3711 | "$O_SRV -dtls1 -mtu 256" \ |
| 3712 | "$P_CLI dtls=1 nbio=2 debug_level=2" \ |
| 3713 | 0 \ |
| 3714 | -c "found fragmented DTLS handshake message" \ |
| 3715 | -C "error" |
Manuel Pégourié-Gonnard | a775617 | 2014-08-31 18:37:01 +0200 | [diff] [blame] | 3716 | |
Manuel Pégourié-Gonnard | 7a66cbc | 2014-09-26 16:31:46 +0200 | [diff] [blame] | 3717 | # Tests for specific things with "unreliable" UDP connection |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 3718 | |
Manuel Pégourié-Gonnard | 76fe9e4 | 2014-09-24 15:17:31 +0200 | [diff] [blame] | 3719 | not_with_valgrind # spurious resend due to timeout |
Manuel Pégourié-Gonnard | 990f9e4 | 2014-09-06 12:27:02 +0200 | [diff] [blame] | 3720 | run_test "DTLS proxy: reference" \ |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 3721 | -p "$P_PXY" \ |
Manuel Pégourié-Gonnard | 76fe9e4 | 2014-09-24 15:17:31 +0200 | [diff] [blame] | 3722 | "$P_SRV dtls=1 debug_level=2" \ |
| 3723 | "$P_CLI dtls=1 debug_level=2" \ |
Manuel Pégourié-Gonnard | 990f9e4 | 2014-09-06 12:27:02 +0200 | [diff] [blame] | 3724 | 0 \ |
Manuel Pégourié-Gonnard | 246c13a | 2014-09-24 13:56:09 +0200 | [diff] [blame] | 3725 | -C "replayed record" \ |
| 3726 | -S "replayed record" \ |
| 3727 | -C "record from another epoch" \ |
| 3728 | -S "record from another epoch" \ |
| 3729 | -C "discarding invalid record" \ |
| 3730 | -S "discarding invalid record" \ |
Manuel Pégourié-Gonnard | 76fe9e4 | 2014-09-24 15:17:31 +0200 | [diff] [blame] | 3731 | -S "resend" \ |
Manuel Pégourié-Gonnard | 63eca93 | 2014-09-08 16:39:08 +0200 | [diff] [blame] | 3732 | -s "Extra-header:" \ |
Manuel Pégourié-Gonnard | 990f9e4 | 2014-09-06 12:27:02 +0200 | [diff] [blame] | 3733 | -c "HTTP/1.0 200 OK" |
| 3734 | |
Manuel Pégourié-Gonnard | 76fe9e4 | 2014-09-24 15:17:31 +0200 | [diff] [blame] | 3735 | not_with_valgrind # spurious resend due to timeout |
Manuel Pégourié-Gonnard | b47368a | 2014-09-24 13:29:58 +0200 | [diff] [blame] | 3736 | run_test "DTLS proxy: duplicate every packet" \ |
Manuel Pégourié-Gonnard | 990f9e4 | 2014-09-06 12:27:02 +0200 | [diff] [blame] | 3737 | -p "$P_PXY duplicate=1" \ |
Manuel Pégourié-Gonnard | 76fe9e4 | 2014-09-24 15:17:31 +0200 | [diff] [blame] | 3738 | "$P_SRV dtls=1 debug_level=2" \ |
| 3739 | "$P_CLI dtls=1 debug_level=2" \ |
Manuel Pégourié-Gonnard | 990f9e4 | 2014-09-06 12:27:02 +0200 | [diff] [blame] | 3740 | 0 \ |
Manuel Pégourié-Gonnard | b47368a | 2014-09-24 13:29:58 +0200 | [diff] [blame] | 3741 | -c "replayed record" \ |
| 3742 | -s "replayed record" \ |
Manuel Pégourié-Gonnard | 246c13a | 2014-09-24 13:56:09 +0200 | [diff] [blame] | 3743 | -c "discarding invalid record" \ |
| 3744 | -s "discarding invalid record" \ |
Manuel Pégourié-Gonnard | 76fe9e4 | 2014-09-24 15:17:31 +0200 | [diff] [blame] | 3745 | -S "resend" \ |
Manuel Pégourié-Gonnard | 63eca93 | 2014-09-08 16:39:08 +0200 | [diff] [blame] | 3746 | -s "Extra-header:" \ |
| 3747 | -c "HTTP/1.0 200 OK" |
| 3748 | |
Manuel Pégourié-Gonnard | 2739313 | 2014-09-24 14:41:11 +0200 | [diff] [blame] | 3749 | run_test "DTLS proxy: duplicate every packet, server anti-replay off" \ |
| 3750 | -p "$P_PXY duplicate=1" \ |
Manuel Pégourié-Gonnard | 76fe9e4 | 2014-09-24 15:17:31 +0200 | [diff] [blame] | 3751 | "$P_SRV dtls=1 debug_level=2 anti_replay=0" \ |
| 3752 | "$P_CLI dtls=1 debug_level=2" \ |
Manuel Pégourié-Gonnard | 2739313 | 2014-09-24 14:41:11 +0200 | [diff] [blame] | 3753 | 0 \ |
| 3754 | -c "replayed record" \ |
| 3755 | -S "replayed record" \ |
| 3756 | -c "discarding invalid record" \ |
| 3757 | -s "discarding invalid record" \ |
Manuel Pégourié-Gonnard | 76fe9e4 | 2014-09-24 15:17:31 +0200 | [diff] [blame] | 3758 | -c "resend" \ |
| 3759 | -s "resend" \ |
Manuel Pégourié-Gonnard | 2739313 | 2014-09-24 14:41:11 +0200 | [diff] [blame] | 3760 | -s "Extra-header:" \ |
| 3761 | -c "HTTP/1.0 200 OK" |
| 3762 | |
Manuel Pégourié-Gonnard | e698f59 | 2014-10-14 19:36:36 +0200 | [diff] [blame] | 3763 | run_test "DTLS proxy: inject invalid AD record, default badmac_limit" \ |
Manuel Pégourié-Gonnard | 63eca93 | 2014-09-08 16:39:08 +0200 | [diff] [blame] | 3764 | -p "$P_PXY bad_ad=1" \ |
Manuel Pégourié-Gonnard | 246c13a | 2014-09-24 13:56:09 +0200 | [diff] [blame] | 3765 | "$P_SRV dtls=1 debug_level=1" \ |
Manuel Pégourié-Gonnard | e698f59 | 2014-10-14 19:36:36 +0200 | [diff] [blame] | 3766 | "$P_CLI dtls=1 debug_level=1 read_timeout=100" \ |
Manuel Pégourié-Gonnard | 825a49e | 2014-09-23 11:00:37 +0200 | [diff] [blame] | 3767 | 0 \ |
Manuel Pégourié-Gonnard | 74a1378 | 2014-10-14 22:34:08 +0200 | [diff] [blame] | 3768 | -c "discarding invalid record (mac)" \ |
| 3769 | -s "discarding invalid record (mac)" \ |
Manuel Pégourié-Gonnard | 825a49e | 2014-09-23 11:00:37 +0200 | [diff] [blame] | 3770 | -s "Extra-header:" \ |
Manuel Pégourié-Gonnard | e698f59 | 2014-10-14 19:36:36 +0200 | [diff] [blame] | 3771 | -c "HTTP/1.0 200 OK" \ |
| 3772 | -S "too many records with bad MAC" \ |
| 3773 | -S "Verification of the message MAC failed" |
| 3774 | |
| 3775 | run_test "DTLS proxy: inject invalid AD record, badmac_limit 1" \ |
| 3776 | -p "$P_PXY bad_ad=1" \ |
| 3777 | "$P_SRV dtls=1 debug_level=1 badmac_limit=1" \ |
| 3778 | "$P_CLI dtls=1 debug_level=1 read_timeout=100" \ |
| 3779 | 1 \ |
Manuel Pégourié-Gonnard | 74a1378 | 2014-10-14 22:34:08 +0200 | [diff] [blame] | 3780 | -C "discarding invalid record (mac)" \ |
| 3781 | -S "discarding invalid record (mac)" \ |
Manuel Pégourié-Gonnard | e698f59 | 2014-10-14 19:36:36 +0200 | [diff] [blame] | 3782 | -S "Extra-header:" \ |
| 3783 | -C "HTTP/1.0 200 OK" \ |
| 3784 | -s "too many records with bad MAC" \ |
| 3785 | -s "Verification of the message MAC failed" |
| 3786 | |
| 3787 | run_test "DTLS proxy: inject invalid AD record, badmac_limit 2" \ |
| 3788 | -p "$P_PXY bad_ad=1" \ |
| 3789 | "$P_SRV dtls=1 debug_level=1 badmac_limit=2" \ |
| 3790 | "$P_CLI dtls=1 debug_level=1 read_timeout=100" \ |
| 3791 | 0 \ |
Manuel Pégourié-Gonnard | 74a1378 | 2014-10-14 22:34:08 +0200 | [diff] [blame] | 3792 | -c "discarding invalid record (mac)" \ |
| 3793 | -s "discarding invalid record (mac)" \ |
Manuel Pégourié-Gonnard | e698f59 | 2014-10-14 19:36:36 +0200 | [diff] [blame] | 3794 | -s "Extra-header:" \ |
| 3795 | -c "HTTP/1.0 200 OK" \ |
| 3796 | -S "too many records with bad MAC" \ |
| 3797 | -S "Verification of the message MAC failed" |
| 3798 | |
| 3799 | run_test "DTLS proxy: inject invalid AD record, badmac_limit 2, exchanges 2"\ |
| 3800 | -p "$P_PXY bad_ad=1" \ |
| 3801 | "$P_SRV dtls=1 debug_level=1 badmac_limit=2 exchanges=2" \ |
| 3802 | "$P_CLI dtls=1 debug_level=1 read_timeout=100 exchanges=2" \ |
| 3803 | 1 \ |
Manuel Pégourié-Gonnard | 74a1378 | 2014-10-14 22:34:08 +0200 | [diff] [blame] | 3804 | -c "discarding invalid record (mac)" \ |
| 3805 | -s "discarding invalid record (mac)" \ |
Manuel Pégourié-Gonnard | e698f59 | 2014-10-14 19:36:36 +0200 | [diff] [blame] | 3806 | -s "Extra-header:" \ |
| 3807 | -c "HTTP/1.0 200 OK" \ |
| 3808 | -s "too many records with bad MAC" \ |
| 3809 | -s "Verification of the message MAC failed" |
Manuel Pégourié-Gonnard | 825a49e | 2014-09-23 11:00:37 +0200 | [diff] [blame] | 3810 | |
| 3811 | run_test "DTLS proxy: delay ChangeCipherSpec" \ |
Manuel Pégourié-Gonnard | 246c13a | 2014-09-24 13:56:09 +0200 | [diff] [blame] | 3812 | -p "$P_PXY delay_ccs=1" \ |
| 3813 | "$P_SRV dtls=1 debug_level=1" \ |
| 3814 | "$P_CLI dtls=1 debug_level=1" \ |
Manuel Pégourié-Gonnard | 825a49e | 2014-09-23 11:00:37 +0200 | [diff] [blame] | 3815 | 0 \ |
Manuel Pégourié-Gonnard | 246c13a | 2014-09-24 13:56:09 +0200 | [diff] [blame] | 3816 | -c "record from another epoch" \ |
| 3817 | -s "record from another epoch" \ |
Manuel Pégourié-Gonnard | 825a49e | 2014-09-23 11:00:37 +0200 | [diff] [blame] | 3818 | -c "discarding invalid record" \ |
Manuel Pégourié-Gonnard | 246c13a | 2014-09-24 13:56:09 +0200 | [diff] [blame] | 3819 | -s "discarding invalid record" \ |
Manuel Pégourié-Gonnard | 825a49e | 2014-09-23 11:00:37 +0200 | [diff] [blame] | 3820 | -s "Extra-header:" \ |
| 3821 | -c "HTTP/1.0 200 OK" |
| 3822 | |
Manuel Pégourié-Gonnard | 7a66cbc | 2014-09-26 16:31:46 +0200 | [diff] [blame] | 3823 | # Tests for "randomly unreliable connection": try a variety of flows and peers |
Manuel Pégourié-Gonnard | 18e519a | 2014-09-24 19:09:17 +0200 | [diff] [blame] | 3824 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 3825 | client_needs_more_time 2 |
Manuel Pégourié-Gonnard | 18e519a | 2014-09-24 19:09:17 +0200 | [diff] [blame] | 3826 | run_test "DTLS proxy: 3d (drop, delay, duplicate), \"short\" PSK handshake" \ |
Manuel Pégourié-Gonnard | 825a49e | 2014-09-23 11:00:37 +0200 | [diff] [blame] | 3827 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
Manuel Pégourié-Gonnard | 37a4de2 | 2014-10-01 16:38:03 +0200 | [diff] [blame] | 3828 | "$P_SRV dtls=1 hs_timeout=250-10000 tickets=0 auth_mode=none \ |
| 3829 | psk=abc123" \ |
| 3830 | "$P_CLI dtls=1 hs_timeout=250-10000 tickets=0 psk=abc123 \ |
Manuel Pégourié-Gonnard | 18e519a | 2014-09-24 19:09:17 +0200 | [diff] [blame] | 3831 | force_ciphersuite=TLS-PSK-WITH-AES-128-CCM-8" \ |
| 3832 | 0 \ |
| 3833 | -s "Extra-header:" \ |
| 3834 | -c "HTTP/1.0 200 OK" |
| 3835 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 3836 | client_needs_more_time 2 |
Manuel Pégourié-Gonnard | 18e519a | 2014-09-24 19:09:17 +0200 | [diff] [blame] | 3837 | run_test "DTLS proxy: 3d, \"short\" RSA handshake" \ |
| 3838 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
Manuel Pégourié-Gonnard | 37a4de2 | 2014-10-01 16:38:03 +0200 | [diff] [blame] | 3839 | "$P_SRV dtls=1 hs_timeout=250-10000 tickets=0 auth_mode=none" \ |
| 3840 | "$P_CLI dtls=1 hs_timeout=250-10000 tickets=0 \ |
Manuel Pégourié-Gonnard | 18e519a | 2014-09-24 19:09:17 +0200 | [diff] [blame] | 3841 | force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| 3842 | 0 \ |
| 3843 | -s "Extra-header:" \ |
| 3844 | -c "HTTP/1.0 200 OK" |
| 3845 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 3846 | client_needs_more_time 2 |
Manuel Pégourié-Gonnard | 18e519a | 2014-09-24 19:09:17 +0200 | [diff] [blame] | 3847 | run_test "DTLS proxy: 3d, \"short\" (no ticket, no cli_auth) FS handshake" \ |
| 3848 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
Manuel Pégourié-Gonnard | 37a4de2 | 2014-10-01 16:38:03 +0200 | [diff] [blame] | 3849 | "$P_SRV dtls=1 hs_timeout=250-10000 tickets=0 auth_mode=none" \ |
| 3850 | "$P_CLI dtls=1 hs_timeout=250-10000 tickets=0" \ |
Manuel Pégourié-Gonnard | 18e519a | 2014-09-24 19:09:17 +0200 | [diff] [blame] | 3851 | 0 \ |
| 3852 | -s "Extra-header:" \ |
| 3853 | -c "HTTP/1.0 200 OK" |
| 3854 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 3855 | client_needs_more_time 2 |
Manuel Pégourié-Gonnard | 18e519a | 2014-09-24 19:09:17 +0200 | [diff] [blame] | 3856 | run_test "DTLS proxy: 3d, FS, client auth" \ |
| 3857 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
Manuel Pégourié-Gonnard | 37a4de2 | 2014-10-01 16:38:03 +0200 | [diff] [blame] | 3858 | "$P_SRV dtls=1 hs_timeout=250-10000 tickets=0 auth_mode=required" \ |
| 3859 | "$P_CLI dtls=1 hs_timeout=250-10000 tickets=0" \ |
Manuel Pégourié-Gonnard | 18e519a | 2014-09-24 19:09:17 +0200 | [diff] [blame] | 3860 | 0 \ |
| 3861 | -s "Extra-header:" \ |
| 3862 | -c "HTTP/1.0 200 OK" |
| 3863 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 3864 | client_needs_more_time 2 |
Manuel Pégourié-Gonnard | 18e519a | 2014-09-24 19:09:17 +0200 | [diff] [blame] | 3865 | run_test "DTLS proxy: 3d, FS, ticket" \ |
| 3866 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
Manuel Pégourié-Gonnard | 37a4de2 | 2014-10-01 16:38:03 +0200 | [diff] [blame] | 3867 | "$P_SRV dtls=1 hs_timeout=250-10000 tickets=1 auth_mode=none" \ |
| 3868 | "$P_CLI dtls=1 hs_timeout=250-10000 tickets=1" \ |
Manuel Pégourié-Gonnard | 18e519a | 2014-09-24 19:09:17 +0200 | [diff] [blame] | 3869 | 0 \ |
| 3870 | -s "Extra-header:" \ |
| 3871 | -c "HTTP/1.0 200 OK" |
| 3872 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 3873 | client_needs_more_time 2 |
Manuel Pégourié-Gonnard | 18e519a | 2014-09-24 19:09:17 +0200 | [diff] [blame] | 3874 | run_test "DTLS proxy: 3d, max handshake (FS, ticket + client auth)" \ |
| 3875 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
Manuel Pégourié-Gonnard | 37a4de2 | 2014-10-01 16:38:03 +0200 | [diff] [blame] | 3876 | "$P_SRV dtls=1 hs_timeout=250-10000 tickets=1 auth_mode=required" \ |
| 3877 | "$P_CLI dtls=1 hs_timeout=250-10000 tickets=1" \ |
Manuel Pégourié-Gonnard | 825a49e | 2014-09-23 11:00:37 +0200 | [diff] [blame] | 3878 | 0 \ |
| 3879 | -s "Extra-header:" \ |
| 3880 | -c "HTTP/1.0 200 OK" |
| 3881 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 3882 | client_needs_more_time 2 |
Manuel Pégourié-Gonnard | 6093d81 | 2014-09-29 17:52:57 +0200 | [diff] [blame] | 3883 | run_test "DTLS proxy: 3d, max handshake, nbio" \ |
| 3884 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
Manuel Pégourié-Gonnard | 37a4de2 | 2014-10-01 16:38:03 +0200 | [diff] [blame] | 3885 | "$P_SRV dtls=1 hs_timeout=250-10000 nbio=2 tickets=1 \ |
| 3886 | auth_mode=required" \ |
| 3887 | "$P_CLI dtls=1 hs_timeout=250-10000 nbio=2 tickets=1" \ |
Manuel Pégourié-Gonnard | 6093d81 | 2014-09-29 17:52:57 +0200 | [diff] [blame] | 3888 | 0 \ |
| 3889 | -s "Extra-header:" \ |
| 3890 | -c "HTTP/1.0 200 OK" |
| 3891 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 3892 | client_needs_more_time 4 |
Manuel Pégourié-Gonnard | 7a26d73 | 2014-10-02 14:50:46 +0200 | [diff] [blame] | 3893 | run_test "DTLS proxy: 3d, min handshake, resumption" \ |
| 3894 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
| 3895 | "$P_SRV dtls=1 hs_timeout=250-10000 tickets=0 auth_mode=none \ |
| 3896 | psk=abc123 debug_level=3" \ |
| 3897 | "$P_CLI dtls=1 hs_timeout=250-10000 tickets=0 psk=abc123 \ |
| 3898 | debug_level=3 reconnect=1 read_timeout=1000 max_resend=10 \ |
| 3899 | force_ciphersuite=TLS-PSK-WITH-AES-128-CCM-8" \ |
| 3900 | 0 \ |
| 3901 | -s "a session has been resumed" \ |
| 3902 | -c "a session has been resumed" \ |
| 3903 | -s "Extra-header:" \ |
| 3904 | -c "HTTP/1.0 200 OK" |
| 3905 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 3906 | client_needs_more_time 4 |
Manuel Pégourié-Gonnard | 85beb30 | 2014-10-02 17:59:19 +0200 | [diff] [blame] | 3907 | run_test "DTLS proxy: 3d, min handshake, resumption, nbio" \ |
| 3908 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
| 3909 | "$P_SRV dtls=1 hs_timeout=250-10000 tickets=0 auth_mode=none \ |
| 3910 | psk=abc123 debug_level=3 nbio=2" \ |
| 3911 | "$P_CLI dtls=1 hs_timeout=250-10000 tickets=0 psk=abc123 \ |
| 3912 | debug_level=3 reconnect=1 read_timeout=1000 max_resend=10 \ |
| 3913 | force_ciphersuite=TLS-PSK-WITH-AES-128-CCM-8 nbio=2" \ |
| 3914 | 0 \ |
| 3915 | -s "a session has been resumed" \ |
| 3916 | -c "a session has been resumed" \ |
| 3917 | -s "Extra-header:" \ |
| 3918 | -c "HTTP/1.0 200 OK" |
| 3919 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 3920 | client_needs_more_time 4 |
Manuel Pégourié-Gonnard | 6093d81 | 2014-09-29 17:52:57 +0200 | [diff] [blame] | 3921 | run_test "DTLS proxy: 3d, min handshake, client-initiated renego" \ |
Manuel Pégourié-Gonnard | 1b753f1 | 2014-09-25 16:09:36 +0200 | [diff] [blame] | 3922 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
Manuel Pégourié-Gonnard | 37a4de2 | 2014-10-01 16:38:03 +0200 | [diff] [blame] | 3923 | "$P_SRV dtls=1 hs_timeout=250-10000 tickets=0 auth_mode=none \ |
| 3924 | psk=abc123 renegotiation=1 debug_level=2" \ |
| 3925 | "$P_CLI dtls=1 hs_timeout=250-10000 tickets=0 psk=abc123 \ |
| 3926 | renegotiate=1 debug_level=2 \ |
Manuel Pégourié-Gonnard | 1b753f1 | 2014-09-25 16:09:36 +0200 | [diff] [blame] | 3927 | force_ciphersuite=TLS-PSK-WITH-AES-128-CCM-8" \ |
| 3928 | 0 \ |
| 3929 | -c "=> renegotiate" \ |
| 3930 | -s "=> renegotiate" \ |
| 3931 | -s "Extra-header:" \ |
| 3932 | -c "HTTP/1.0 200 OK" |
| 3933 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 3934 | client_needs_more_time 4 |
Manuel Pégourié-Gonnard | 6093d81 | 2014-09-29 17:52:57 +0200 | [diff] [blame] | 3935 | run_test "DTLS proxy: 3d, min handshake, client-initiated renego, nbio" \ |
| 3936 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
Manuel Pégourié-Gonnard | 37a4de2 | 2014-10-01 16:38:03 +0200 | [diff] [blame] | 3937 | "$P_SRV dtls=1 hs_timeout=250-10000 tickets=0 auth_mode=none \ |
| 3938 | psk=abc123 renegotiation=1 debug_level=2" \ |
| 3939 | "$P_CLI dtls=1 hs_timeout=250-10000 tickets=0 psk=abc123 \ |
| 3940 | renegotiate=1 debug_level=2 \ |
Manuel Pégourié-Gonnard | 6093d81 | 2014-09-29 17:52:57 +0200 | [diff] [blame] | 3941 | force_ciphersuite=TLS-PSK-WITH-AES-128-CCM-8" \ |
| 3942 | 0 \ |
| 3943 | -c "=> renegotiate" \ |
| 3944 | -s "=> renegotiate" \ |
| 3945 | -s "Extra-header:" \ |
| 3946 | -c "HTTP/1.0 200 OK" |
| 3947 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 3948 | client_needs_more_time 4 |
Manuel Pégourié-Gonnard | ba958b8 | 2014-10-09 16:13:44 +0200 | [diff] [blame] | 3949 | run_test "DTLS proxy: 3d, min handshake, server-initiated renego" \ |
Manuel Pégourié-Gonnard | a6ace04 | 2014-10-15 12:44:41 +0200 | [diff] [blame] | 3950 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
Manuel Pégourié-Gonnard | ba958b8 | 2014-10-09 16:13:44 +0200 | [diff] [blame] | 3951 | "$P_SRV dtls=1 hs_timeout=250-10000 tickets=0 auth_mode=none \ |
Manuel Pégourié-Gonnard | a6ace04 | 2014-10-15 12:44:41 +0200 | [diff] [blame] | 3952 | psk=abc123 renegotiate=1 renegotiation=1 exchanges=4 \ |
Manuel Pégourié-Gonnard | ba958b8 | 2014-10-09 16:13:44 +0200 | [diff] [blame] | 3953 | debug_level=2" \ |
| 3954 | "$P_CLI dtls=1 hs_timeout=250-10000 tickets=0 psk=abc123 \ |
Manuel Pégourié-Gonnard | a6ace04 | 2014-10-15 12:44:41 +0200 | [diff] [blame] | 3955 | renegotiation=1 exchanges=4 debug_level=2 \ |
Manuel Pégourié-Gonnard | ba958b8 | 2014-10-09 16:13:44 +0200 | [diff] [blame] | 3956 | force_ciphersuite=TLS-PSK-WITH-AES-128-CCM-8" \ |
| 3957 | 0 \ |
| 3958 | -c "=> renegotiate" \ |
| 3959 | -s "=> renegotiate" \ |
| 3960 | -s "Extra-header:" \ |
| 3961 | -c "HTTP/1.0 200 OK" |
| 3962 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 3963 | client_needs_more_time 4 |
Manuel Pégourié-Gonnard | ba958b8 | 2014-10-09 16:13:44 +0200 | [diff] [blame] | 3964 | run_test "DTLS proxy: 3d, min handshake, server-initiated renego, nbio" \ |
Manuel Pégourié-Gonnard | a6ace04 | 2014-10-15 12:44:41 +0200 | [diff] [blame] | 3965 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
Manuel Pégourié-Gonnard | ba958b8 | 2014-10-09 16:13:44 +0200 | [diff] [blame] | 3966 | "$P_SRV dtls=1 hs_timeout=250-10000 tickets=0 auth_mode=none \ |
Manuel Pégourié-Gonnard | a6ace04 | 2014-10-15 12:44:41 +0200 | [diff] [blame] | 3967 | psk=abc123 renegotiate=1 renegotiation=1 exchanges=4 \ |
Manuel Pégourié-Gonnard | ba958b8 | 2014-10-09 16:13:44 +0200 | [diff] [blame] | 3968 | debug_level=2 nbio=2" \ |
| 3969 | "$P_CLI dtls=1 hs_timeout=250-10000 tickets=0 psk=abc123 \ |
Manuel Pégourié-Gonnard | a6ace04 | 2014-10-15 12:44:41 +0200 | [diff] [blame] | 3970 | renegotiation=1 exchanges=4 debug_level=2 nbio=2 \ |
Manuel Pégourié-Gonnard | ba958b8 | 2014-10-09 16:13:44 +0200 | [diff] [blame] | 3971 | force_ciphersuite=TLS-PSK-WITH-AES-128-CCM-8" \ |
| 3972 | 0 \ |
| 3973 | -c "=> renegotiate" \ |
| 3974 | -s "=> renegotiate" \ |
| 3975 | -s "Extra-header:" \ |
| 3976 | -c "HTTP/1.0 200 OK" |
| 3977 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 3978 | client_needs_more_time 6 |
Manuel Pégourié-Gonnard | d68434e | 2015-08-31 12:48:22 +0200 | [diff] [blame] | 3979 | not_with_valgrind # risk of non-mbedtls peer timing out |
Manuel Pégourié-Gonnard | 9590e0a | 2014-09-26 16:27:59 +0200 | [diff] [blame] | 3980 | run_test "DTLS proxy: 3d, openssl server" \ |
Manuel Pégourié-Gonnard | d0fd1da | 2014-09-25 17:00:27 +0200 | [diff] [blame] | 3981 | -p "$P_PXY drop=5 delay=5 duplicate=5 protect_hvr=1" \ |
| 3982 | "$O_SRV -dtls1 -mtu 2048" \ |
Manuel Pégourié-Gonnard | 8fe411e | 2015-03-09 16:09:53 +0000 | [diff] [blame] | 3983 | "$P_CLI dtls=1 hs_timeout=250-60000 tickets=0" \ |
Manuel Pégourié-Gonnard | d0fd1da | 2014-09-25 17:00:27 +0200 | [diff] [blame] | 3984 | 0 \ |
Manuel Pégourié-Gonnard | d0fd1da | 2014-09-25 17:00:27 +0200 | [diff] [blame] | 3985 | -c "HTTP/1.0 200 OK" |
| 3986 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 3987 | client_needs_more_time 8 |
Manuel Pégourié-Gonnard | d68434e | 2015-08-31 12:48:22 +0200 | [diff] [blame] | 3988 | not_with_valgrind # risk of non-mbedtls peer timing out |
Manuel Pégourié-Gonnard | 9590e0a | 2014-09-26 16:27:59 +0200 | [diff] [blame] | 3989 | run_test "DTLS proxy: 3d, openssl server, fragmentation" \ |
| 3990 | -p "$P_PXY drop=5 delay=5 duplicate=5 protect_hvr=1" \ |
| 3991 | "$O_SRV -dtls1 -mtu 768" \ |
Manuel Pégourié-Gonnard | 8fe411e | 2015-03-09 16:09:53 +0000 | [diff] [blame] | 3992 | "$P_CLI dtls=1 hs_timeout=250-60000 tickets=0" \ |
Manuel Pégourié-Gonnard | 9590e0a | 2014-09-26 16:27:59 +0200 | [diff] [blame] | 3993 | 0 \ |
Manuel Pégourié-Gonnard | 9590e0a | 2014-09-26 16:27:59 +0200 | [diff] [blame] | 3994 | -c "HTTP/1.0 200 OK" |
| 3995 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 3996 | client_needs_more_time 8 |
Manuel Pégourié-Gonnard | d68434e | 2015-08-31 12:48:22 +0200 | [diff] [blame] | 3997 | not_with_valgrind # risk of non-mbedtls peer timing out |
Manuel Pégourié-Gonnard | 6093d81 | 2014-09-29 17:52:57 +0200 | [diff] [blame] | 3998 | run_test "DTLS proxy: 3d, openssl server, fragmentation, nbio" \ |
| 3999 | -p "$P_PXY drop=5 delay=5 duplicate=5 protect_hvr=1" \ |
| 4000 | "$O_SRV -dtls1 -mtu 768" \ |
Manuel Pégourié-Gonnard | 8fe411e | 2015-03-09 16:09:53 +0000 | [diff] [blame] | 4001 | "$P_CLI dtls=1 hs_timeout=250-60000 nbio=2 tickets=0" \ |
Manuel Pégourié-Gonnard | 6093d81 | 2014-09-29 17:52:57 +0200 | [diff] [blame] | 4002 | 0 \ |
Manuel Pégourié-Gonnard | 6093d81 | 2014-09-29 17:52:57 +0200 | [diff] [blame] | 4003 | -c "HTTP/1.0 200 OK" |
| 4004 | |
Manuel Pégourié-Gonnard | 9699996 | 2015-02-17 16:02:37 +0000 | [diff] [blame] | 4005 | requires_gnutls |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 4006 | client_needs_more_time 6 |
Manuel Pégourié-Gonnard | d68434e | 2015-08-31 12:48:22 +0200 | [diff] [blame] | 4007 | not_with_valgrind # risk of non-mbedtls peer timing out |
Manuel Pégourié-Gonnard | 9590e0a | 2014-09-26 16:27:59 +0200 | [diff] [blame] | 4008 | run_test "DTLS proxy: 3d, gnutls server" \ |
| 4009 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
| 4010 | "$G_SRV -u --mtu 2048 -a" \ |
Manuel Pégourié-Gonnard | f138447 | 2014-10-14 22:57:46 +0200 | [diff] [blame] | 4011 | "$P_CLI dtls=1 hs_timeout=250-60000" \ |
Manuel Pégourié-Gonnard | 9590e0a | 2014-09-26 16:27:59 +0200 | [diff] [blame] | 4012 | 0 \ |
| 4013 | -s "Extra-header:" \ |
| 4014 | -c "Extra-header:" |
| 4015 | |
Manuel Pégourié-Gonnard | 9699996 | 2015-02-17 16:02:37 +0000 | [diff] [blame] | 4016 | requires_gnutls |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 4017 | client_needs_more_time 8 |
Manuel Pégourié-Gonnard | d68434e | 2015-08-31 12:48:22 +0200 | [diff] [blame] | 4018 | not_with_valgrind # risk of non-mbedtls peer timing out |
Manuel Pégourié-Gonnard | 9590e0a | 2014-09-26 16:27:59 +0200 | [diff] [blame] | 4019 | run_test "DTLS proxy: 3d, gnutls server, fragmentation" \ |
| 4020 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
| 4021 | "$G_SRV -u --mtu 512" \ |
Manuel Pégourié-Gonnard | f138447 | 2014-10-14 22:57:46 +0200 | [diff] [blame] | 4022 | "$P_CLI dtls=1 hs_timeout=250-60000" \ |
Manuel Pégourié-Gonnard | 9590e0a | 2014-09-26 16:27:59 +0200 | [diff] [blame] | 4023 | 0 \ |
| 4024 | -s "Extra-header:" \ |
| 4025 | -c "Extra-header:" |
| 4026 | |
Manuel Pégourié-Gonnard | 9699996 | 2015-02-17 16:02:37 +0000 | [diff] [blame] | 4027 | requires_gnutls |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 4028 | client_needs_more_time 8 |
Manuel Pégourié-Gonnard | d68434e | 2015-08-31 12:48:22 +0200 | [diff] [blame] | 4029 | not_with_valgrind # risk of non-mbedtls peer timing out |
Manuel Pégourié-Gonnard | 6093d81 | 2014-09-29 17:52:57 +0200 | [diff] [blame] | 4030 | run_test "DTLS proxy: 3d, gnutls server, fragmentation, nbio" \ |
| 4031 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
| 4032 | "$G_SRV -u --mtu 512" \ |
Manuel Pégourié-Gonnard | f138447 | 2014-10-14 22:57:46 +0200 | [diff] [blame] | 4033 | "$P_CLI dtls=1 hs_timeout=250-60000 nbio=2" \ |
Manuel Pégourié-Gonnard | 6093d81 | 2014-09-29 17:52:57 +0200 | [diff] [blame] | 4034 | 0 \ |
| 4035 | -s "Extra-header:" \ |
| 4036 | -c "Extra-header:" |
| 4037 | |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 4038 | # Final report |
| 4039 | |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 4040 | echo "------------------------------------------------------------------------" |
| 4041 | |
| 4042 | if [ $FAILS = 0 ]; then |
Manuel Pégourié-Gonnard | f46f128 | 2014-12-11 11:51:28 +0100 | [diff] [blame] | 4043 | printf "PASSED" |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 4044 | else |
Manuel Pégourié-Gonnard | f46f128 | 2014-12-11 11:51:28 +0100 | [diff] [blame] | 4045 | printf "FAILED" |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 4046 | fi |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 4047 | PASSES=$(( $TESTS - $FAILS )) |
Manuel Pégourié-Gonnard | 6f4fbbb | 2014-08-14 14:31:29 +0200 | [diff] [blame] | 4048 | echo " ($PASSES / $TESTS tests ($SKIPS skipped))" |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 4049 | |
| 4050 | exit $FAILS |