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 | |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 24 | if cd $( dirname $0 ); then :; else |
| 25 | echo "cd $( dirname $0 ) failed" >&2 |
| 26 | exit 1 |
| 27 | fi |
| 28 | |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 29 | # default values, can be overriden by the environment |
| 30 | : ${P_SRV:=../programs/ssl/ssl_server2} |
| 31 | : ${P_CLI:=../programs/ssl/ssl_client2} |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 32 | : ${P_PXY:=../programs/test/udp_proxy} |
Manuel Pégourié-Gonnard | 74faf3c | 2014-03-13 18:47:44 +0100 | [diff] [blame] | 33 | : ${OPENSSL_CMD:=openssl} # OPENSSL would conflict with the build system |
Manuel Pégourié-Gonnard | baa7f07 | 2014-08-20 20:15:53 +0200 | [diff] [blame] | 34 | : ${GNUTLS_CLI:=gnutls-cli} |
| 35 | : ${GNUTLS_SERV:=gnutls-serv} |
Gilles Peskine | d50177f | 2017-05-16 17:53:03 +0200 | [diff] [blame] | 36 | : ${PERL:=perl} |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 37 | |
Manuel Pégourié-Gonnard | fa60f12 | 2014-09-26 16:07:29 +0200 | [diff] [blame] | 38 | 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] | 39 | 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] | 40 | 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] | 41 | 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] | 42 | TCP_CLIENT="$PERL scripts/tcp_client.pl" |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 43 | |
Manuel Pégourié-Gonnard | 38110df | 2018-08-17 12:44:54 +0200 | [diff] [blame] | 44 | # alternative versions of OpenSSL and GnuTLS (no default path) |
| 45 | |
| 46 | if [ -n "${OPENSSL_LEGACY:-}" ]; then |
| 47 | O_LEGACY_SRV="$OPENSSL_LEGACY s_server -www -cert data_files/server5.crt -key data_files/server5.key" |
| 48 | O_LEGACY_CLI="echo 'GET / HTTP/1.0' | $OPENSSL_LEGACY s_client" |
| 49 | else |
| 50 | O_LEGACY_SRV=false |
| 51 | O_LEGACY_CLI=false |
| 52 | fi |
| 53 | |
Hanno Becker | 58e9dc3 | 2018-08-17 15:53:21 +0100 | [diff] [blame] | 54 | if [ -n "${GNUTLS_NEXT_SERV:-}" ]; then |
Manuel Pégourié-Gonnard | 38110df | 2018-08-17 12:44:54 +0200 | [diff] [blame] | 55 | G_NEXT_SRV="$GNUTLS_NEXT_SERV --x509certfile data_files/server5.crt --x509keyfile data_files/server5.key" |
| 56 | else |
| 57 | G_NEXT_SRV=false |
| 58 | fi |
| 59 | |
Hanno Becker | 58e9dc3 | 2018-08-17 15:53:21 +0100 | [diff] [blame] | 60 | if [ -n "${GNUTLS_NEXT_CLI:-}" ]; then |
Manuel Pégourié-Gonnard | 38110df | 2018-08-17 12:44:54 +0200 | [diff] [blame] | 61 | G_NEXT_CLI="echo 'GET / HTTP/1.0' | $GNUTLS_NEXT_CLI --x509cafile data_files/test-ca_cat12.crt" |
| 62 | else |
| 63 | G_NEXT_CLI=false |
| 64 | fi |
| 65 | |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 66 | TESTS=0 |
| 67 | FAILS=0 |
Manuel Pégourié-Gonnard | 6f4fbbb | 2014-08-14 14:31:29 +0200 | [diff] [blame] | 68 | SKIPS=0 |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 69 | |
Manuel Pégourié-Gonnard | 7f80997 | 2015-03-09 17:05:11 +0000 | [diff] [blame] | 70 | CONFIG_H='../include/mbedtls/config.h' |
Manuel Pégourié-Gonnard | 83d8c73 | 2014-04-07 13:24:21 +0200 | [diff] [blame] | 71 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 72 | MEMCHECK=0 |
Manuel Pégourié-Gonnard | 417d46c | 2014-03-13 19:17:53 +0100 | [diff] [blame] | 73 | FILTER='.*' |
Manuel Pégourié-Gonnard | 6f4fbbb | 2014-08-14 14:31:29 +0200 | [diff] [blame] | 74 | EXCLUDE='^$' |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 75 | |
Paul Bakker | e20310a | 2016-05-10 11:18:17 +0100 | [diff] [blame] | 76 | SHOW_TEST_NUMBER=0 |
Paul Bakker | b7584a5 | 2016-05-10 10:50:43 +0100 | [diff] [blame] | 77 | RUN_TEST_NUMBER='' |
| 78 | |
Paul Bakker | acaac85 | 2016-05-10 11:47:13 +0100 | [diff] [blame] | 79 | PRESERVE_LOGS=0 |
| 80 | |
Gilles Peskine | f93c7d3 | 2017-04-14 17:55:28 +0200 | [diff] [blame] | 81 | # Pick a "unique" server port in the range 10000-19999, and a proxy |
| 82 | # port which is this plus 10000. Each port number may be independently |
| 83 | # overridden by a command line option. |
| 84 | SRV_PORT=$(($$ % 10000 + 10000)) |
| 85 | PXY_PORT=$((SRV_PORT + 10000)) |
| 86 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 87 | print_usage() { |
| 88 | echo "Usage: $0 [options]" |
Manuel Pégourié-Gonnard | f46f128 | 2014-12-11 11:51:28 +0100 | [diff] [blame] | 89 | printf " -h|--help\tPrint this help.\n" |
| 90 | printf " -m|--memcheck\tCheck memory leaks and errors.\n" |
Gilles Peskine | f93c7d3 | 2017-04-14 17:55:28 +0200 | [diff] [blame] | 91 | printf " -f|--filter\tOnly matching tests are executed (BRE; default: '$FILTER')\n" |
| 92 | printf " -e|--exclude\tMatching tests are excluded (BRE; default: '$EXCLUDE')\n" |
Paul Bakker | b7584a5 | 2016-05-10 10:50:43 +0100 | [diff] [blame] | 93 | 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] | 94 | 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] | 95 | printf " -p|--preserve-logs\tPreserve logs of successful tests as well\n" |
Gilles Peskine | f93c7d3 | 2017-04-14 17:55:28 +0200 | [diff] [blame] | 96 | printf " --port\tTCP/UDP port (default: randomish 1xxxx)\n" |
| 97 | printf " --proxy-port\tTCP/UDP proxy port (default: randomish 2xxxx)\n" |
Andres AG | f04f54d | 2016-10-10 15:46:20 +0100 | [diff] [blame] | 98 | 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] | 99 | } |
| 100 | |
| 101 | get_options() { |
| 102 | while [ $# -gt 0 ]; do |
| 103 | case "$1" in |
Manuel Pégourié-Gonnard | 417d46c | 2014-03-13 19:17:53 +0100 | [diff] [blame] | 104 | -f|--filter) |
| 105 | shift; FILTER=$1 |
| 106 | ;; |
| 107 | -e|--exclude) |
| 108 | shift; EXCLUDE=$1 |
| 109 | ;; |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 110 | -m|--memcheck) |
| 111 | MEMCHECK=1 |
| 112 | ;; |
Paul Bakker | b7584a5 | 2016-05-10 10:50:43 +0100 | [diff] [blame] | 113 | -n|--number) |
| 114 | shift; RUN_TEST_NUMBER=$1 |
| 115 | ;; |
Paul Bakker | e20310a | 2016-05-10 11:18:17 +0100 | [diff] [blame] | 116 | -s|--show-numbers) |
| 117 | SHOW_TEST_NUMBER=1 |
| 118 | ;; |
Paul Bakker | acaac85 | 2016-05-10 11:47:13 +0100 | [diff] [blame] | 119 | -p|--preserve-logs) |
| 120 | PRESERVE_LOGS=1 |
| 121 | ;; |
Gilles Peskine | f93c7d3 | 2017-04-14 17:55:28 +0200 | [diff] [blame] | 122 | --port) |
| 123 | shift; SRV_PORT=$1 |
| 124 | ;; |
| 125 | --proxy-port) |
| 126 | shift; PXY_PORT=$1 |
| 127 | ;; |
Andres AG | f04f54d | 2016-10-10 15:46:20 +0100 | [diff] [blame] | 128 | --seed) |
| 129 | shift; SEED="$1" |
| 130 | ;; |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 131 | -h|--help) |
| 132 | print_usage |
| 133 | exit 0 |
| 134 | ;; |
| 135 | *) |
Paul Bakker | 1ebc0c5 | 2014-05-22 15:47:58 +0200 | [diff] [blame] | 136 | echo "Unknown argument: '$1'" |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 137 | print_usage |
| 138 | exit 1 |
| 139 | ;; |
| 140 | esac |
| 141 | shift |
| 142 | done |
| 143 | } |
| 144 | |
Manuel Pégourié-Gonnard | 988209f | 2015-03-24 10:43:55 +0100 | [diff] [blame] | 145 | # skip next test if the flag is not enabled in config.h |
| 146 | requires_config_enabled() { |
| 147 | if grep "^#define $1" $CONFIG_H > /dev/null; then :; else |
| 148 | SKIP_NEXT="YES" |
| 149 | fi |
| 150 | } |
| 151 | |
Manuel Pégourié-Gonnard | af63c21 | 2017-06-08 17:51:08 +0200 | [diff] [blame] | 152 | # skip next test if the flag is enabled in config.h |
| 153 | requires_config_disabled() { |
| 154 | if grep "^#define $1" $CONFIG_H > /dev/null; then |
| 155 | SKIP_NEXT="YES" |
| 156 | fi |
| 157 | } |
| 158 | |
Manuel Pégourié-Gonnard | 1cbd39d | 2014-10-20 13:34:59 +0200 | [diff] [blame] | 159 | # skip next test if OpenSSL doesn't support FALLBACK_SCSV |
| 160 | requires_openssl_with_fallback_scsv() { |
| 161 | if [ -z "${OPENSSL_HAS_FBSCSV:-}" ]; then |
| 162 | if $OPENSSL_CMD s_client -help 2>&1 | grep fallback_scsv >/dev/null |
| 163 | then |
| 164 | OPENSSL_HAS_FBSCSV="YES" |
| 165 | else |
| 166 | OPENSSL_HAS_FBSCSV="NO" |
| 167 | fi |
| 168 | fi |
| 169 | if [ "$OPENSSL_HAS_FBSCSV" = "NO" ]; then |
| 170 | SKIP_NEXT="YES" |
| 171 | fi |
| 172 | } |
| 173 | |
Manuel Pégourié-Gonnard | baa7f07 | 2014-08-20 20:15:53 +0200 | [diff] [blame] | 174 | # skip next test if GnuTLS isn't available |
| 175 | requires_gnutls() { |
| 176 | if [ -z "${GNUTLS_AVAILABLE:-}" ]; then |
Manuel Pégourié-Gonnard | 03db6b0 | 2015-06-26 15:45:30 +0200 | [diff] [blame] | 177 | 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] | 178 | GNUTLS_AVAILABLE="YES" |
| 179 | else |
| 180 | GNUTLS_AVAILABLE="NO" |
| 181 | fi |
| 182 | fi |
| 183 | if [ "$GNUTLS_AVAILABLE" = "NO" ]; then |
| 184 | SKIP_NEXT="YES" |
| 185 | fi |
| 186 | } |
| 187 | |
Manuel Pégourié-Gonnard | 38110df | 2018-08-17 12:44:54 +0200 | [diff] [blame] | 188 | # skip next test if GnuTLS-next isn't available |
| 189 | requires_gnutls_next() { |
| 190 | if [ -z "${GNUTLS_NEXT_AVAILABLE:-}" ]; then |
| 191 | if ( which "${GNUTLS_NEXT_CLI:-}" && which "${GNUTLS_NEXT_SERV:-}" ) >/dev/null 2>&1; then |
| 192 | GNUTLS_NEXT_AVAILABLE="YES" |
| 193 | else |
| 194 | GNUTLS_NEXT_AVAILABLE="NO" |
| 195 | fi |
| 196 | fi |
| 197 | if [ "$GNUTLS_NEXT_AVAILABLE" = "NO" ]; then |
| 198 | SKIP_NEXT="YES" |
| 199 | fi |
| 200 | } |
| 201 | |
| 202 | # skip next test if OpenSSL-legacy isn't available |
| 203 | requires_openssl_legacy() { |
| 204 | if [ -z "${OPENSSL_LEGACY_AVAILABLE:-}" ]; then |
| 205 | if which "${OPENSSL_LEGACY:-}" >/dev/null 2>&1; then |
| 206 | OPENSSL_LEGACY_AVAILABLE="YES" |
| 207 | else |
| 208 | OPENSSL_LEGACY_AVAILABLE="NO" |
| 209 | fi |
| 210 | fi |
| 211 | if [ "$OPENSSL_LEGACY_AVAILABLE" = "NO" ]; then |
| 212 | SKIP_NEXT="YES" |
| 213 | fi |
| 214 | } |
| 215 | |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 216 | # skip next test if IPv6 isn't available on this host |
| 217 | requires_ipv6() { |
| 218 | if [ -z "${HAS_IPV6:-}" ]; then |
| 219 | $P_SRV server_addr='::1' > $SRV_OUT 2>&1 & |
| 220 | SRV_PID=$! |
| 221 | sleep 1 |
| 222 | kill $SRV_PID >/dev/null 2>&1 |
| 223 | if grep "NET - Binding of the socket failed" $SRV_OUT >/dev/null; then |
| 224 | HAS_IPV6="NO" |
| 225 | else |
| 226 | HAS_IPV6="YES" |
| 227 | fi |
| 228 | rm -r $SRV_OUT |
| 229 | fi |
| 230 | |
| 231 | if [ "$HAS_IPV6" = "NO" ]; then |
| 232 | SKIP_NEXT="YES" |
| 233 | fi |
| 234 | } |
| 235 | |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 236 | # Calculate the input & output maximum content lengths set in the config |
| 237 | MAX_CONTENT_LEN=$( ../scripts/config.pl get MBEDTLS_SSL_MAX_CONTENT_LEN || echo "16384") |
| 238 | MAX_IN_LEN=$( ../scripts/config.pl get MBEDTLS_SSL_IN_CONTENT_LEN || echo "$MAX_CONTENT_LEN") |
| 239 | MAX_OUT_LEN=$( ../scripts/config.pl get MBEDTLS_SSL_OUT_CONTENT_LEN || echo "$MAX_CONTENT_LEN") |
| 240 | |
| 241 | if [ "$MAX_IN_LEN" -lt "$MAX_CONTENT_LEN" ]; then |
| 242 | MAX_CONTENT_LEN="$MAX_IN_LEN" |
| 243 | fi |
| 244 | if [ "$MAX_OUT_LEN" -lt "$MAX_CONTENT_LEN" ]; then |
| 245 | MAX_CONTENT_LEN="$MAX_OUT_LEN" |
| 246 | fi |
| 247 | |
| 248 | # skip the next test if the SSL output buffer is less than 16KB |
| 249 | requires_full_size_output_buffer() { |
| 250 | if [ "$MAX_OUT_LEN" -ne 16384 ]; then |
| 251 | SKIP_NEXT="YES" |
| 252 | fi |
| 253 | } |
| 254 | |
Manuel Pégourié-Gonnard | 76fe9e4 | 2014-09-24 15:17:31 +0200 | [diff] [blame] | 255 | # skip the next test if valgrind is in use |
| 256 | not_with_valgrind() { |
| 257 | if [ "$MEMCHECK" -gt 0 ]; then |
| 258 | SKIP_NEXT="YES" |
| 259 | fi |
| 260 | } |
| 261 | |
Paul Bakker | 362689d | 2016-05-13 10:33:25 +0100 | [diff] [blame] | 262 | # skip the next test if valgrind is NOT in use |
| 263 | only_with_valgrind() { |
| 264 | if [ "$MEMCHECK" -eq 0 ]; then |
| 265 | SKIP_NEXT="YES" |
| 266 | fi |
| 267 | } |
| 268 | |
Manuel Pégourié-Gonnard | a071972 | 2014-09-20 12:46:27 +0200 | [diff] [blame] | 269 | # 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] | 270 | client_needs_more_time() { |
Manuel Pégourié-Gonnard | a071972 | 2014-09-20 12:46:27 +0200 | [diff] [blame] | 271 | CLI_DELAY_FACTOR=$1 |
| 272 | } |
| 273 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 274 | # wait for the given seconds after the client finished in the next test |
| 275 | server_needs_more_time() { |
| 276 | SRV_DELAY_SECONDS=$1 |
| 277 | } |
| 278 | |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 279 | # print_name <name> |
| 280 | print_name() { |
Paul Bakker | e20310a | 2016-05-10 11:18:17 +0100 | [diff] [blame] | 281 | TESTS=$(( $TESTS + 1 )) |
| 282 | LINE="" |
| 283 | |
| 284 | if [ "$SHOW_TEST_NUMBER" -gt 0 ]; then |
| 285 | LINE="$TESTS " |
| 286 | fi |
| 287 | |
| 288 | LINE="$LINE$1" |
| 289 | printf "$LINE " |
| 290 | LEN=$(( 72 - `echo "$LINE" | wc -c` )) |
Manuel Pégourié-Gonnard | f46f128 | 2014-12-11 11:51:28 +0100 | [diff] [blame] | 291 | for i in `seq 1 $LEN`; do printf '.'; done |
| 292 | printf ' ' |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 293 | |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 294 | } |
| 295 | |
| 296 | # fail <message> |
| 297 | fail() { |
| 298 | echo "FAIL" |
Manuel Pégourié-Gonnard | 3eec604 | 2014-02-27 15:37:24 +0100 | [diff] [blame] | 299 | echo " ! $1" |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 300 | |
Manuel Pégourié-Gonnard | c2b0092 | 2014-08-31 16:46:04 +0200 | [diff] [blame] | 301 | mv $SRV_OUT o-srv-${TESTS}.log |
| 302 | mv $CLI_OUT o-cli-${TESTS}.log |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 303 | if [ -n "$PXY_CMD" ]; then |
| 304 | mv $PXY_OUT o-pxy-${TESTS}.log |
| 305 | fi |
| 306 | echo " ! outputs saved to o-XXX-${TESTS}.log" |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 307 | |
Azim Khan | 19d1373 | 2018-03-29 11:04:20 +0100 | [diff] [blame] | 308 | if [ "X${USER:-}" = Xbuildbot -o "X${LOGNAME:-}" = Xbuildbot -o "${LOG_FAILURE_ON_STDOUT:-0}" != 0 ]; then |
Manuel Pégourié-Gonnard | 7fa6772 | 2014-08-31 17:42:53 +0200 | [diff] [blame] | 309 | echo " ! server output:" |
| 310 | cat o-srv-${TESTS}.log |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 311 | echo " ! ========================================================" |
Manuel Pégourié-Gonnard | 7fa6772 | 2014-08-31 17:42:53 +0200 | [diff] [blame] | 312 | echo " ! client output:" |
| 313 | cat o-cli-${TESTS}.log |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 314 | if [ -n "$PXY_CMD" ]; then |
| 315 | echo " ! ========================================================" |
| 316 | echo " ! proxy output:" |
| 317 | cat o-pxy-${TESTS}.log |
| 318 | fi |
| 319 | echo "" |
Manuel Pégourié-Gonnard | 7fa6772 | 2014-08-31 17:42:53 +0200 | [diff] [blame] | 320 | fi |
| 321 | |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 322 | FAILS=$(( $FAILS + 1 )) |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 323 | } |
| 324 | |
Manuel Pégourié-Gonnard | 677884d | 2014-02-25 16:42:31 +0100 | [diff] [blame] | 325 | # is_polar <cmd_line> |
| 326 | is_polar() { |
| 327 | echo "$1" | grep 'ssl_server2\|ssl_client2' > /dev/null |
| 328 | } |
| 329 | |
Manuel Pégourié-Gonnard | fa60f12 | 2014-09-26 16:07:29 +0200 | [diff] [blame] | 330 | # openssl s_server doesn't have -www with DTLS |
| 331 | check_osrv_dtls() { |
| 332 | if echo "$SRV_CMD" | grep 's_server.*-dtls' >/dev/null; then |
| 333 | NEEDS_INPUT=1 |
| 334 | SRV_CMD="$( echo $SRV_CMD | sed s/-www// )" |
| 335 | else |
| 336 | NEEDS_INPUT=0 |
| 337 | fi |
| 338 | } |
| 339 | |
| 340 | # provide input to commands that need it |
| 341 | provide_input() { |
| 342 | if [ $NEEDS_INPUT -eq 0 ]; then |
| 343 | return |
| 344 | fi |
| 345 | |
| 346 | while true; do |
| 347 | echo "HTTP/1.0 200 OK" |
| 348 | sleep 1 |
| 349 | done |
| 350 | } |
| 351 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 352 | # has_mem_err <log_file_name> |
| 353 | has_mem_err() { |
| 354 | if ( grep -F 'All heap blocks were freed -- no leaks are possible' "$1" && |
| 355 | grep -F 'ERROR SUMMARY: 0 errors from 0 contexts' "$1" ) > /dev/null |
| 356 | then |
| 357 | return 1 # false: does not have errors |
| 358 | else |
| 359 | return 0 # true: has errors |
| 360 | fi |
| 361 | } |
| 362 | |
Gilles Peskine | 418b536 | 2017-12-14 18:58:42 +0100 | [diff] [blame] | 363 | # Wait for process $2 to be listening on port $1 |
| 364 | if type lsof >/dev/null 2>/dev/null; then |
| 365 | wait_server_start() { |
| 366 | START_TIME=$(date +%s) |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 367 | if [ "$DTLS" -eq 1 ]; then |
Gilles Peskine | 418b536 | 2017-12-14 18:58:42 +0100 | [diff] [blame] | 368 | proto=UDP |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 369 | else |
Gilles Peskine | 418b536 | 2017-12-14 18:58:42 +0100 | [diff] [blame] | 370 | proto=TCP |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 371 | fi |
Gilles Peskine | 418b536 | 2017-12-14 18:58:42 +0100 | [diff] [blame] | 372 | # Make a tight loop, server normally takes less than 1s to start. |
| 373 | while ! lsof -a -n -b -i "$proto:$1" -p "$2" >/dev/null 2>/dev/null; do |
| 374 | if [ $(( $(date +%s) - $START_TIME )) -gt $DOG_DELAY ]; then |
| 375 | echo "SERVERSTART TIMEOUT" |
| 376 | echo "SERVERSTART TIMEOUT" >> $SRV_OUT |
| 377 | break |
| 378 | fi |
| 379 | # Linux and *BSD support decimal arguments to sleep. On other |
| 380 | # OSes this may be a tight loop. |
| 381 | sleep 0.1 2>/dev/null || true |
| 382 | done |
| 383 | } |
| 384 | else |
Gilles Peskine | a931265 | 2018-06-29 15:48:13 +0200 | [diff] [blame] | 385 | echo "Warning: lsof not available, wait_server_start = sleep" |
Gilles Peskine | 418b536 | 2017-12-14 18:58:42 +0100 | [diff] [blame] | 386 | wait_server_start() { |
Manuel Pégourié-Gonnard | 0c1ec47 | 2014-06-20 18:41:11 +0200 | [diff] [blame] | 387 | sleep "$START_DELAY" |
Gilles Peskine | 418b536 | 2017-12-14 18:58:42 +0100 | [diff] [blame] | 388 | } |
| 389 | fi |
Manuel Pégourié-Gonnard | 0c1ec47 | 2014-06-20 18:41:11 +0200 | [diff] [blame] | 390 | |
Andres Amaya Garcia | b84c40b | 2017-09-06 15:44:01 +0100 | [diff] [blame] | 391 | # Given the client or server debug output, parse the unix timestamp that is |
Andres Amaya Garcia | 3b1bdff | 2017-09-14 12:41:29 +0100 | [diff] [blame] | 392 | # included in the first 4 bytes of the random bytes and check that it's within |
Andres Amaya Garcia | b84c40b | 2017-09-06 15:44:01 +0100 | [diff] [blame] | 393 | # acceptable bounds |
| 394 | check_server_hello_time() { |
| 395 | # Extract the time from the debug (lvl 3) output of the client |
Andres Amaya Garcia | 67d8da5 | 2017-09-15 15:49:24 +0100 | [diff] [blame] | 396 | SERVER_HELLO_TIME="$(sed -n 's/.*server hello, current time: //p' < "$1")" |
Andres Amaya Garcia | b84c40b | 2017-09-06 15:44:01 +0100 | [diff] [blame] | 397 | # Get the Unix timestamp for now |
| 398 | CUR_TIME=$(date +'%s') |
| 399 | THRESHOLD_IN_SECS=300 |
| 400 | |
| 401 | # Check if the ServerHello time was printed |
| 402 | if [ -z "$SERVER_HELLO_TIME" ]; then |
| 403 | return 1 |
| 404 | fi |
| 405 | |
| 406 | # Check the time in ServerHello is within acceptable bounds |
| 407 | if [ $SERVER_HELLO_TIME -lt $(( $CUR_TIME - $THRESHOLD_IN_SECS )) ]; then |
| 408 | # The time in ServerHello is at least 5 minutes before now |
| 409 | return 1 |
| 410 | elif [ $SERVER_HELLO_TIME -gt $(( $CUR_TIME + $THRESHOLD_IN_SECS )) ]; then |
Andres Amaya Garcia | 3b1bdff | 2017-09-14 12:41:29 +0100 | [diff] [blame] | 411 | # The time in ServerHello is at least 5 minutes later than now |
Andres Amaya Garcia | b84c40b | 2017-09-06 15:44:01 +0100 | [diff] [blame] | 412 | return 1 |
| 413 | else |
| 414 | return 0 |
| 415 | fi |
| 416 | } |
| 417 | |
Manuel Pégourié-Gonnard | c0f6a69 | 2014-08-30 22:41:47 +0200 | [diff] [blame] | 418 | # wait for client to terminate and set CLI_EXIT |
| 419 | # must be called right after starting the client |
| 420 | wait_client_done() { |
| 421 | CLI_PID=$! |
| 422 | |
Manuel Pégourié-Gonnard | a071972 | 2014-09-20 12:46:27 +0200 | [diff] [blame] | 423 | CLI_DELAY=$(( $DOG_DELAY * $CLI_DELAY_FACTOR )) |
| 424 | CLI_DELAY_FACTOR=1 |
| 425 | |
Manuel Pégourié-Gonnard | a365add | 2015-08-04 20:57:59 +0200 | [diff] [blame] | 426 | ( 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] | 427 | DOG_PID=$! |
Manuel Pégourié-Gonnard | c0f6a69 | 2014-08-30 22:41:47 +0200 | [diff] [blame] | 428 | |
| 429 | wait $CLI_PID |
| 430 | CLI_EXIT=$? |
| 431 | |
Manuel Pégourié-Gonnard | a6189f0 | 2014-09-20 13:15:43 +0200 | [diff] [blame] | 432 | kill $DOG_PID >/dev/null 2>&1 |
| 433 | wait $DOG_PID |
Manuel Pégourié-Gonnard | c0f6a69 | 2014-08-30 22:41:47 +0200 | [diff] [blame] | 434 | |
| 435 | echo "EXIT: $CLI_EXIT" >> $CLI_OUT |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 436 | |
| 437 | sleep $SRV_DELAY_SECONDS |
| 438 | SRV_DELAY_SECONDS=0 |
Manuel Pégourié-Gonnard | c0f6a69 | 2014-08-30 22:41:47 +0200 | [diff] [blame] | 439 | } |
| 440 | |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 441 | # check if the given command uses dtls and sets global variable DTLS |
| 442 | detect_dtls() { |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 443 | 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] | 444 | DTLS=1 |
| 445 | else |
| 446 | DTLS=0 |
| 447 | fi |
| 448 | } |
| 449 | |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 450 | # 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] | 451 | # Options: -s pattern pattern that must be present in server output |
| 452 | # -c pattern pattern that must be present in client output |
Simon Butcher | 8e00410 | 2016-10-14 00:48:33 +0100 | [diff] [blame] | 453 | # -u pattern lines after pattern must be unique in client output |
Andres Amaya Garcia | 93993de | 2017-09-06 15:38:07 +0100 | [diff] [blame] | 454 | # -f call shell function on client output |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 455 | # -S pattern pattern that must be absent in server output |
| 456 | # -C pattern pattern that must be absent in client output |
Simon Butcher | 8e00410 | 2016-10-14 00:48:33 +0100 | [diff] [blame] | 457 | # -U pattern lines after pattern must be unique in server output |
Andres Amaya Garcia | 93993de | 2017-09-06 15:38:07 +0100 | [diff] [blame] | 458 | # -F call shell function on server output |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 459 | run_test() { |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 460 | NAME="$1" |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 461 | shift 1 |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 462 | |
Manuel Pégourié-Gonnard | 417d46c | 2014-03-13 19:17:53 +0100 | [diff] [blame] | 463 | if echo "$NAME" | grep "$FILTER" | grep -v "$EXCLUDE" >/dev/null; then : |
| 464 | else |
Manuel Pégourié-Gonnard | 74a1378 | 2014-10-14 22:34:08 +0200 | [diff] [blame] | 465 | SKIP_NEXT="NO" |
Manuel Pégourié-Gonnard | 417d46c | 2014-03-13 19:17:53 +0100 | [diff] [blame] | 466 | return |
| 467 | fi |
| 468 | |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 469 | print_name "$NAME" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 470 | |
Paul Bakker | b7584a5 | 2016-05-10 10:50:43 +0100 | [diff] [blame] | 471 | # Do we only run numbered tests? |
| 472 | if [ "X$RUN_TEST_NUMBER" = "X" ]; then : |
| 473 | elif echo ",$RUN_TEST_NUMBER," | grep ",$TESTS," >/dev/null; then : |
| 474 | else |
| 475 | SKIP_NEXT="YES" |
| 476 | fi |
| 477 | |
Manuel Pégourié-Gonnard | 6f4fbbb | 2014-08-14 14:31:29 +0200 | [diff] [blame] | 478 | # should we skip? |
| 479 | if [ "X$SKIP_NEXT" = "XYES" ]; then |
| 480 | SKIP_NEXT="NO" |
| 481 | echo "SKIP" |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 482 | SKIPS=$(( $SKIPS + 1 )) |
Manuel Pégourié-Gonnard | 6f4fbbb | 2014-08-14 14:31:29 +0200 | [diff] [blame] | 483 | return |
| 484 | fi |
| 485 | |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 486 | # does this test use a proxy? |
| 487 | if [ "X$1" = "X-p" ]; then |
| 488 | PXY_CMD="$2" |
| 489 | shift 2 |
| 490 | else |
| 491 | PXY_CMD="" |
| 492 | fi |
| 493 | |
| 494 | # get commands and client output |
| 495 | SRV_CMD="$1" |
| 496 | CLI_CMD="$2" |
| 497 | CLI_EXPECT="$3" |
| 498 | shift 3 |
| 499 | |
| 500 | # fix client port |
| 501 | if [ -n "$PXY_CMD" ]; then |
| 502 | CLI_CMD=$( echo "$CLI_CMD" | sed s/+SRV_PORT/$PXY_PORT/g ) |
| 503 | else |
| 504 | CLI_CMD=$( echo "$CLI_CMD" | sed s/+SRV_PORT/$SRV_PORT/g ) |
| 505 | fi |
| 506 | |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 507 | # update DTLS variable |
| 508 | detect_dtls "$SRV_CMD" |
| 509 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 510 | # prepend valgrind to our commands if active |
| 511 | if [ "$MEMCHECK" -gt 0 ]; then |
| 512 | if is_polar "$SRV_CMD"; then |
| 513 | SRV_CMD="valgrind --leak-check=full $SRV_CMD" |
| 514 | fi |
| 515 | if is_polar "$CLI_CMD"; then |
| 516 | CLI_CMD="valgrind --leak-check=full $CLI_CMD" |
| 517 | fi |
| 518 | fi |
| 519 | |
Manuel Pégourié-Gonnard | a365add | 2015-08-04 20:57:59 +0200 | [diff] [blame] | 520 | TIMES_LEFT=2 |
| 521 | while [ $TIMES_LEFT -gt 0 ]; do |
Manuel Pégourié-Gonnard | ab5f7b4 | 2015-08-04 21:01:37 +0200 | [diff] [blame] | 522 | TIMES_LEFT=$(( $TIMES_LEFT - 1 )) |
Manuel Pégourié-Gonnard | a365add | 2015-08-04 20:57:59 +0200 | [diff] [blame] | 523 | |
Manuel Pégourié-Gonnard | ab5f7b4 | 2015-08-04 21:01:37 +0200 | [diff] [blame] | 524 | # run the commands |
| 525 | if [ -n "$PXY_CMD" ]; then |
| 526 | echo "$PXY_CMD" > $PXY_OUT |
| 527 | $PXY_CMD >> $PXY_OUT 2>&1 & |
| 528 | PXY_PID=$! |
| 529 | # assume proxy starts faster than server |
| 530 | fi |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 531 | |
Manuel Pégourié-Gonnard | ab5f7b4 | 2015-08-04 21:01:37 +0200 | [diff] [blame] | 532 | check_osrv_dtls |
| 533 | echo "$SRV_CMD" > $SRV_OUT |
| 534 | provide_input | $SRV_CMD >> $SRV_OUT 2>&1 & |
| 535 | SRV_PID=$! |
Gilles Peskine | 418b536 | 2017-12-14 18:58:42 +0100 | [diff] [blame] | 536 | wait_server_start "$SRV_PORT" "$SRV_PID" |
Manuel Pégourié-Gonnard | c0f6a69 | 2014-08-30 22:41:47 +0200 | [diff] [blame] | 537 | |
Manuel Pégourié-Gonnard | ab5f7b4 | 2015-08-04 21:01:37 +0200 | [diff] [blame] | 538 | echo "$CLI_CMD" > $CLI_OUT |
| 539 | eval "$CLI_CMD" >> $CLI_OUT 2>&1 & |
| 540 | wait_client_done |
Manuel Pégourié-Gonnard | e01af4c | 2014-03-25 14:16:44 +0100 | [diff] [blame] | 541 | |
Hanno Becker | cadb5bb | 2017-05-26 13:56:10 +0100 | [diff] [blame] | 542 | sleep 0.05 |
| 543 | |
Manuel Pégourié-Gonnard | ab5f7b4 | 2015-08-04 21:01:37 +0200 | [diff] [blame] | 544 | # terminate the server (and the proxy) |
| 545 | kill $SRV_PID |
| 546 | wait $SRV_PID |
Hanno Becker | d82d846 | 2017-05-29 21:37:46 +0100 | [diff] [blame] | 547 | |
Manuel Pégourié-Gonnard | ab5f7b4 | 2015-08-04 21:01:37 +0200 | [diff] [blame] | 548 | if [ -n "$PXY_CMD" ]; then |
| 549 | kill $PXY_PID >/dev/null 2>&1 |
| 550 | wait $PXY_PID |
| 551 | fi |
Manuel Pégourié-Gonnard | 677884d | 2014-02-25 16:42:31 +0100 | [diff] [blame] | 552 | |
Manuel Pégourié-Gonnard | ab5f7b4 | 2015-08-04 21:01:37 +0200 | [diff] [blame] | 553 | # retry only on timeouts |
| 554 | if grep '===CLIENT_TIMEOUT===' $CLI_OUT >/dev/null; then |
| 555 | printf "RETRY " |
| 556 | else |
| 557 | TIMES_LEFT=0 |
| 558 | fi |
Manuel Pégourié-Gonnard | a365add | 2015-08-04 20:57:59 +0200 | [diff] [blame] | 559 | done |
| 560 | |
Manuel Pégourié-Gonnard | 677884d | 2014-02-25 16:42:31 +0100 | [diff] [blame] | 561 | # 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] | 562 | # (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] | 563 | # expected client exit to incorrectly succeed in case of catastrophic |
| 564 | # failure) |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 565 | if is_polar "$SRV_CMD"; then |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 566 | 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] | 567 | else |
Manuel Pégourié-Gonnard | 699cafa | 2014-10-27 13:57:03 +0100 | [diff] [blame] | 568 | fail "server or client failed to reach handshake stage" |
Manuel Pégourié-Gonnard | 677884d | 2014-02-25 16:42:31 +0100 | [diff] [blame] | 569 | return |
| 570 | fi |
| 571 | fi |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 572 | if is_polar "$CLI_CMD"; then |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 573 | 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] | 574 | else |
Manuel Pégourié-Gonnard | 699cafa | 2014-10-27 13:57:03 +0100 | [diff] [blame] | 575 | fail "server or client failed to reach handshake stage" |
Manuel Pégourié-Gonnard | 677884d | 2014-02-25 16:42:31 +0100 | [diff] [blame] | 576 | return |
| 577 | fi |
| 578 | fi |
| 579 | |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 580 | # check server exit code |
| 581 | if [ $? != 0 ]; then |
| 582 | fail "server fail" |
| 583 | return |
| 584 | fi |
| 585 | |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 586 | # check client exit code |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 587 | if [ \( "$CLI_EXPECT" = 0 -a "$CLI_EXIT" != 0 \) -o \ |
| 588 | \( "$CLI_EXPECT" != 0 -a "$CLI_EXIT" = 0 \) ] |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 589 | then |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 590 | 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] | 591 | return |
| 592 | fi |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 593 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 594 | # check other assertions |
Manuel Pégourié-Gonnard | 480905d | 2014-08-21 19:38:32 +0200 | [diff] [blame] | 595 | # lines beginning with == are added by valgrind, ignore them |
Paul Bakker | 1f65092 | 2016-05-13 10:16:46 +0100 | [diff] [blame] | 596 | # 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] | 597 | while [ $# -gt 0 ] |
| 598 | do |
| 599 | case $1 in |
| 600 | "-s") |
Paul Bakker | 1f65092 | 2016-05-13 10:16:46 +0100 | [diff] [blame] | 601 | 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] | 602 | fail "pattern '$2' MUST be present in the Server output" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 603 | return |
| 604 | fi |
| 605 | ;; |
| 606 | |
| 607 | "-c") |
Paul Bakker | 1f65092 | 2016-05-13 10:16:46 +0100 | [diff] [blame] | 608 | 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] | 609 | fail "pattern '$2' MUST be present in the Client output" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 610 | return |
| 611 | fi |
| 612 | ;; |
| 613 | |
| 614 | "-S") |
Paul Bakker | 1f65092 | 2016-05-13 10:16:46 +0100 | [diff] [blame] | 615 | 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] | 616 | 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] | 617 | return |
| 618 | fi |
| 619 | ;; |
| 620 | |
| 621 | "-C") |
Paul Bakker | 1f65092 | 2016-05-13 10:16:46 +0100 | [diff] [blame] | 622 | 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] | 623 | fail "pattern '$2' MUST NOT be present in the Client output" |
| 624 | return |
| 625 | fi |
| 626 | ;; |
| 627 | |
| 628 | # The filtering in the following two options (-u and -U) do the following |
| 629 | # - ignore valgrind output |
| 630 | # - filter out everything but lines right after the pattern occurances |
| 631 | # - keep one of each non-unique line |
| 632 | # - count how many lines remain |
| 633 | # A line with '--' will remain in the result from previous outputs, so the number of lines in the result will be 1 |
| 634 | # if there were no duplicates. |
| 635 | "-U") |
| 636 | 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 |
| 637 | fail "lines following pattern '$2' must be unique in Server output" |
| 638 | return |
| 639 | fi |
| 640 | ;; |
| 641 | |
| 642 | "-u") |
| 643 | 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 |
| 644 | 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] | 645 | return |
| 646 | fi |
| 647 | ;; |
Andres Amaya Garcia | 93993de | 2017-09-06 15:38:07 +0100 | [diff] [blame] | 648 | "-F") |
| 649 | if ! $2 "$SRV_OUT"; then |
| 650 | fail "function call to '$2' failed on Server output" |
| 651 | return |
| 652 | fi |
| 653 | ;; |
| 654 | "-f") |
| 655 | if ! $2 "$CLI_OUT"; then |
| 656 | fail "function call to '$2' failed on Client output" |
| 657 | return |
| 658 | fi |
| 659 | ;; |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 660 | |
| 661 | *) |
Paul Bakker | 1ebc0c5 | 2014-05-22 15:47:58 +0200 | [diff] [blame] | 662 | echo "Unknown test: $1" >&2 |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 663 | exit 1 |
| 664 | esac |
| 665 | shift 2 |
| 666 | done |
| 667 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 668 | # check valgrind's results |
| 669 | if [ "$MEMCHECK" -gt 0 ]; then |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 670 | 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] | 671 | fail "Server has memory errors" |
| 672 | return |
| 673 | fi |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 674 | 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] | 675 | fail "Client has memory errors" |
| 676 | return |
| 677 | fi |
| 678 | fi |
| 679 | |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 680 | # if we're here, everything is ok |
| 681 | echo "PASS" |
Paul Bakker | acaac85 | 2016-05-10 11:47:13 +0100 | [diff] [blame] | 682 | if [ "$PRESERVE_LOGS" -gt 0 ]; then |
| 683 | mv $SRV_OUT o-srv-${TESTS}.log |
| 684 | mv $CLI_OUT o-cli-${TESTS}.log |
| 685 | fi |
| 686 | |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 687 | rm -f $SRV_OUT $CLI_OUT $PXY_OUT |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 688 | } |
| 689 | |
Manuel Pégourié-Gonnard | a9062e9 | 2014-02-25 16:21:22 +0100 | [diff] [blame] | 690 | cleanup() { |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 691 | rm -f $CLI_OUT $SRV_OUT $PXY_OUT $SESSION |
Manuel Pégourié-Gonnard | a6189f0 | 2014-09-20 13:15:43 +0200 | [diff] [blame] | 692 | test -n "${SRV_PID:-}" && kill $SRV_PID >/dev/null 2>&1 |
| 693 | test -n "${PXY_PID:-}" && kill $PXY_PID >/dev/null 2>&1 |
| 694 | test -n "${CLI_PID:-}" && kill $CLI_PID >/dev/null 2>&1 |
| 695 | 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] | 696 | exit 1 |
| 697 | } |
| 698 | |
Manuel Pégourié-Gonnard | 9dea8bd | 2014-02-26 18:21:02 +0100 | [diff] [blame] | 699 | # |
| 700 | # MAIN |
| 701 | # |
| 702 | |
Manuel Pégourié-Gonnard | 913030c | 2014-03-28 10:12:38 +0100 | [diff] [blame] | 703 | get_options "$@" |
| 704 | |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 705 | # sanity checks, avoid an avalanche of errors |
Hanno Becker | 4ac73e7 | 2017-10-23 15:27:37 +0100 | [diff] [blame] | 706 | P_SRV_BIN="${P_SRV%%[ ]*}" |
| 707 | P_CLI_BIN="${P_CLI%%[ ]*}" |
| 708 | P_PXY_BIN="${P_PXY%%[ ]*}" |
Hanno Becker | 17c0493 | 2017-10-10 14:44:53 +0100 | [diff] [blame] | 709 | if [ ! -x "$P_SRV_BIN" ]; then |
| 710 | echo "Command '$P_SRV_BIN' is not an executable file" |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 711 | exit 1 |
| 712 | fi |
Hanno Becker | 17c0493 | 2017-10-10 14:44:53 +0100 | [diff] [blame] | 713 | if [ ! -x "$P_CLI_BIN" ]; then |
| 714 | echo "Command '$P_CLI_BIN' is not an executable file" |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 715 | exit 1 |
| 716 | fi |
Hanno Becker | 17c0493 | 2017-10-10 14:44:53 +0100 | [diff] [blame] | 717 | if [ ! -x "$P_PXY_BIN" ]; then |
| 718 | echo "Command '$P_PXY_BIN' is not an executable file" |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 719 | exit 1 |
| 720 | fi |
Simon Butcher | 3c0d7b8 | 2016-05-23 11:13:17 +0100 | [diff] [blame] | 721 | if [ "$MEMCHECK" -gt 0 ]; then |
| 722 | if which valgrind >/dev/null 2>&1; then :; else |
| 723 | echo "Memcheck not possible. Valgrind not found" |
| 724 | exit 1 |
| 725 | fi |
| 726 | fi |
Manuel Pégourié-Gonnard | 74faf3c | 2014-03-13 18:47:44 +0100 | [diff] [blame] | 727 | if which $OPENSSL_CMD >/dev/null 2>&1; then :; else |
| 728 | echo "Command '$OPENSSL_CMD' not found" |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 729 | exit 1 |
| 730 | fi |
| 731 | |
Manuel Pégourié-Gonnard | 32f8f4d | 2014-05-29 11:31:20 +0200 | [diff] [blame] | 732 | # used by watchdog |
| 733 | MAIN_PID="$$" |
| 734 | |
Manuel Pégourié-Gonnard | 0d225da | 2018-01-22 10:22:09 +0100 | [diff] [blame] | 735 | # We use somewhat arbitrary delays for tests: |
| 736 | # - how long do we wait for the server to start (when lsof not available)? |
| 737 | # - how long do we allow for the client to finish? |
| 738 | # (not to check performance, just to avoid waiting indefinitely) |
| 739 | # Things are slower with valgrind, so give extra time here. |
| 740 | # |
| 741 | # Note: without lsof, there is a trade-off between the running time of this |
| 742 | # script and the risk of spurious errors because we didn't wait long enough. |
| 743 | # The watchdog delay on the other hand doesn't affect normal running time of |
| 744 | # the script, only the case where a client or server gets stuck. |
Manuel Pégourié-Gonnard | 0c1ec47 | 2014-06-20 18:41:11 +0200 | [diff] [blame] | 745 | if [ "$MEMCHECK" -gt 0 ]; then |
Manuel Pégourié-Gonnard | 0d225da | 2018-01-22 10:22:09 +0100 | [diff] [blame] | 746 | START_DELAY=6 |
| 747 | DOG_DELAY=60 |
Manuel Pégourié-Gonnard | 0c1ec47 | 2014-06-20 18:41:11 +0200 | [diff] [blame] | 748 | else |
Manuel Pégourié-Gonnard | 0d225da | 2018-01-22 10:22:09 +0100 | [diff] [blame] | 749 | START_DELAY=2 |
| 750 | DOG_DELAY=20 |
Manuel Pégourié-Gonnard | 0c1ec47 | 2014-06-20 18:41:11 +0200 | [diff] [blame] | 751 | fi |
Manuel Pégourié-Gonnard | 0d225da | 2018-01-22 10:22:09 +0100 | [diff] [blame] | 752 | |
| 753 | # some particular tests need more time: |
| 754 | # - for the client, we multiply the usual watchdog limit by a factor |
| 755 | # - for the server, we sleep for a number of seconds after the client exits |
| 756 | # see client_need_more_time() and server_needs_more_time() |
Manuel Pégourié-Gonnard | a071972 | 2014-09-20 12:46:27 +0200 | [diff] [blame] | 757 | CLI_DELAY_FACTOR=1 |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 758 | SRV_DELAY_SECONDS=0 |
Manuel Pégourié-Gonnard | 0c1ec47 | 2014-06-20 18:41:11 +0200 | [diff] [blame] | 759 | |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 760 | # 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] | 761 | # +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] | 762 | P_SRV="$P_SRV server_addr=127.0.0.1 server_port=$SRV_PORT" |
| 763 | 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] | 764 | 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] | 765 | 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] | 766 | O_CLI="$O_CLI -connect localhost:+SRV_PORT" |
| 767 | G_SRV="$G_SRV -p $SRV_PORT" |
Manuel Pégourié-Gonnard | 0af1ba3 | 2015-01-21 11:44:33 +0000 | [diff] [blame] | 768 | G_CLI="$G_CLI -p +SRV_PORT localhost" |
Manuel Pégourié-Gonnard | 8066b81 | 2014-05-28 22:59:30 +0200 | [diff] [blame] | 769 | |
Manuel Pégourié-Gonnard | 38110df | 2018-08-17 12:44:54 +0200 | [diff] [blame] | 770 | if [ -n "${OPENSSL_LEGACY:-}" ]; then |
| 771 | O_LEGACY_SRV="$O_LEGACY_SRV -accept $SRV_PORT -dhparam data_files/dhparams.pem" |
| 772 | O_LEGACY_CLI="$O_LEGACY_CLI -connect localhost:+SRV_PORT" |
| 773 | fi |
| 774 | |
Hanno Becker | 58e9dc3 | 2018-08-17 15:53:21 +0100 | [diff] [blame] | 775 | if [ -n "${GNUTLS_NEXT_SERV:-}" ]; then |
Manuel Pégourié-Gonnard | 38110df | 2018-08-17 12:44:54 +0200 | [diff] [blame] | 776 | G_NEXT_SRV="$G_NEXT_SRV -p $SRV_PORT" |
| 777 | fi |
| 778 | |
Hanno Becker | 58e9dc3 | 2018-08-17 15:53:21 +0100 | [diff] [blame] | 779 | if [ -n "${GNUTLS_NEXT_CLI:-}" ]; then |
Manuel Pégourié-Gonnard | 38110df | 2018-08-17 12:44:54 +0200 | [diff] [blame] | 780 | G_NEXT_CLI="$G_NEXT_CLI -p +SRV_PORT localhost" |
| 781 | fi |
| 782 | |
Gilles Peskine | 62469d9 | 2017-05-10 10:13:59 +0200 | [diff] [blame] | 783 | # Allow SHA-1, because many of our test certificates use it |
| 784 | P_SRV="$P_SRV allow_sha1=1" |
| 785 | P_CLI="$P_CLI allow_sha1=1" |
| 786 | |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 787 | # Also pick a unique name for intermediate files |
| 788 | SRV_OUT="srv_out.$$" |
| 789 | CLI_OUT="cli_out.$$" |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 790 | PXY_OUT="pxy_out.$$" |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 791 | SESSION="session.$$" |
| 792 | |
Manuel Pégourié-Gonnard | 6f4fbbb | 2014-08-14 14:31:29 +0200 | [diff] [blame] | 793 | SKIP_NEXT="NO" |
| 794 | |
Manuel Pégourié-Gonnard | a9062e9 | 2014-02-25 16:21:22 +0100 | [diff] [blame] | 795 | trap cleanup INT TERM HUP |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 796 | |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 797 | # Basic test |
| 798 | |
Manuel Pégourié-Gonnard | 480905d | 2014-08-21 19:38:32 +0200 | [diff] [blame] | 799 | # Checks that: |
| 800 | # - things work with all ciphersuites active (used with config-full in all.sh) |
| 801 | # - the expected (highest security) parameters are selected |
| 802 | # ("signature_algorithm ext: 6" means SHA-512 (highest common hash)) |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 803 | run_test "Default" \ |
Manuel Pégourié-Gonnard | 480905d | 2014-08-21 19:38:32 +0200 | [diff] [blame] | 804 | "$P_SRV debug_level=3" \ |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 805 | "$P_CLI" \ |
| 806 | 0 \ |
Manuel Pégourié-Gonnard | 480905d | 2014-08-21 19:38:32 +0200 | [diff] [blame] | 807 | -s "Protocol is TLSv1.2" \ |
Manuel Pégourié-Gonnard | ce66d5e | 2018-06-14 11:11:15 +0200 | [diff] [blame] | 808 | -s "Ciphersuite is TLS-ECDHE-RSA-WITH-CHACHA20-POLY1305-SHA256" \ |
Manuel Pégourié-Gonnard | 480905d | 2014-08-21 19:38:32 +0200 | [diff] [blame] | 809 | -s "client hello v3, signature_algorithm ext: 6" \ |
| 810 | -s "ECDHE curve: secp521r1" \ |
| 811 | -S "error" \ |
| 812 | -C "error" |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 813 | |
Manuel Pégourié-Gonnard | 3bb0801 | 2015-01-22 13:34:21 +0000 | [diff] [blame] | 814 | run_test "Default, DTLS" \ |
| 815 | "$P_SRV dtls=1" \ |
| 816 | "$P_CLI dtls=1" \ |
| 817 | 0 \ |
| 818 | -s "Protocol is DTLSv1.2" \ |
Manuel Pégourié-Gonnard | ce66d5e | 2018-06-14 11:11:15 +0200 | [diff] [blame] | 819 | -s "Ciphersuite is TLS-ECDHE-RSA-WITH-CHACHA20-POLY1305-SHA256" |
Manuel Pégourié-Gonnard | 3bb0801 | 2015-01-22 13:34:21 +0000 | [diff] [blame] | 820 | |
Andres Amaya Garcia | b84c40b | 2017-09-06 15:44:01 +0100 | [diff] [blame] | 821 | # Test current time in ServerHello |
| 822 | requires_config_enabled MBEDTLS_HAVE_TIME |
Manuel Pégourié-Gonnard | ce66d5e | 2018-06-14 11:11:15 +0200 | [diff] [blame] | 823 | run_test "ServerHello contains gmt_unix_time" \ |
Andres Amaya Garcia | b84c40b | 2017-09-06 15:44:01 +0100 | [diff] [blame] | 824 | "$P_SRV debug_level=3" \ |
| 825 | "$P_CLI debug_level=3" \ |
| 826 | 0 \ |
Andres Amaya Garcia | b84c40b | 2017-09-06 15:44:01 +0100 | [diff] [blame] | 827 | -f "check_server_hello_time" \ |
| 828 | -F "check_server_hello_time" |
| 829 | |
Simon Butcher | 8e00410 | 2016-10-14 00:48:33 +0100 | [diff] [blame] | 830 | # Test for uniqueness of IVs in AEAD ciphersuites |
| 831 | run_test "Unique IV in GCM" \ |
| 832 | "$P_SRV exchanges=20 debug_level=4" \ |
| 833 | "$P_CLI exchanges=20 debug_level=4 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384" \ |
| 834 | 0 \ |
| 835 | -u "IV used" \ |
| 836 | -U "IV used" |
| 837 | |
Manuel Pégourié-Gonnard | bd47a58 | 2015-01-12 13:43:29 +0100 | [diff] [blame] | 838 | # Tests for rc4 option |
| 839 | |
Simon Butcher | a410af5 | 2016-05-19 22:12:18 +0100 | [diff] [blame] | 840 | requires_config_enabled MBEDTLS_REMOVE_ARC4_CIPHERSUITES |
Manuel Pégourié-Gonnard | bd47a58 | 2015-01-12 13:43:29 +0100 | [diff] [blame] | 841 | run_test "RC4: server disabled, client enabled" \ |
| 842 | "$P_SRV" \ |
| 843 | "$P_CLI force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 844 | 1 \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 845 | -s "SSL - The server has no ciphersuites in common" |
| 846 | |
Simon Butcher | a410af5 | 2016-05-19 22:12:18 +0100 | [diff] [blame] | 847 | requires_config_enabled MBEDTLS_REMOVE_ARC4_CIPHERSUITES |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 848 | run_test "RC4: server half, client enabled" \ |
| 849 | "$P_SRV arc4=1" \ |
| 850 | "$P_CLI force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 851 | 1 \ |
| 852 | -s "SSL - The server has no ciphersuites in common" |
Manuel Pégourié-Gonnard | bd47a58 | 2015-01-12 13:43:29 +0100 | [diff] [blame] | 853 | |
| 854 | run_test "RC4: server enabled, client disabled" \ |
| 855 | "$P_SRV force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 856 | "$P_CLI" \ |
| 857 | 1 \ |
| 858 | -s "SSL - The server has no ciphersuites in common" |
| 859 | |
| 860 | run_test "RC4: both enabled" \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 861 | "$P_SRV force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
Manuel Pégourié-Gonnard | bd47a58 | 2015-01-12 13:43:29 +0100 | [diff] [blame] | 862 | "$P_CLI force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 863 | 0 \ |
Manuel Pégourié-Gonnard | 51d8166 | 2015-01-14 17:20:46 +0100 | [diff] [blame] | 864 | -S "SSL - None of the common ciphersuites is usable" \ |
Manuel Pégourié-Gonnard | bd47a58 | 2015-01-12 13:43:29 +0100 | [diff] [blame] | 865 | -S "SSL - The server has no ciphersuites in common" |
| 866 | |
Gilles Peskine | bc70a18 | 2017-05-09 15:59:24 +0200 | [diff] [blame] | 867 | # Tests for SHA-1 support |
| 868 | |
Manuel Pégourié-Gonnard | af63c21 | 2017-06-08 17:51:08 +0200 | [diff] [blame] | 869 | requires_config_disabled MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES |
Gilles Peskine | bc70a18 | 2017-05-09 15:59:24 +0200 | [diff] [blame] | 870 | run_test "SHA-1 forbidden by default in server certificate" \ |
| 871 | "$P_SRV key_file=data_files/server2.key crt_file=data_files/server2.crt" \ |
| 872 | "$P_CLI debug_level=2 allow_sha1=0" \ |
| 873 | 1 \ |
| 874 | -c "The certificate is signed with an unacceptable hash" |
| 875 | |
Manuel Pégourié-Gonnard | af63c21 | 2017-06-08 17:51:08 +0200 | [diff] [blame] | 876 | requires_config_enabled MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES |
| 877 | run_test "SHA-1 forbidden by default in server certificate" \ |
| 878 | "$P_SRV key_file=data_files/server2.key crt_file=data_files/server2.crt" \ |
| 879 | "$P_CLI debug_level=2 allow_sha1=0" \ |
| 880 | 0 |
| 881 | |
Gilles Peskine | bc70a18 | 2017-05-09 15:59:24 +0200 | [diff] [blame] | 882 | run_test "SHA-1 explicitly allowed in server certificate" \ |
| 883 | "$P_SRV key_file=data_files/server2.key crt_file=data_files/server2.crt" \ |
| 884 | "$P_CLI allow_sha1=1" \ |
| 885 | 0 |
| 886 | |
| 887 | run_test "SHA-256 allowed by default in server certificate" \ |
| 888 | "$P_SRV key_file=data_files/server2.key crt_file=data_files/server2-sha256.crt" \ |
| 889 | "$P_CLI allow_sha1=0" \ |
| 890 | 0 |
| 891 | |
Manuel Pégourié-Gonnard | af63c21 | 2017-06-08 17:51:08 +0200 | [diff] [blame] | 892 | requires_config_disabled MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES |
Gilles Peskine | bc70a18 | 2017-05-09 15:59:24 +0200 | [diff] [blame] | 893 | run_test "SHA-1 forbidden by default in client certificate" \ |
| 894 | "$P_SRV auth_mode=required allow_sha1=0" \ |
| 895 | "$P_CLI key_file=data_files/cli-rsa.key crt_file=data_files/cli-rsa-sha1.crt" \ |
| 896 | 1 \ |
| 897 | -s "The certificate is signed with an unacceptable hash" |
| 898 | |
Manuel Pégourié-Gonnard | af63c21 | 2017-06-08 17:51:08 +0200 | [diff] [blame] | 899 | requires_config_enabled MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES |
| 900 | run_test "SHA-1 forbidden by default in client certificate" \ |
| 901 | "$P_SRV auth_mode=required allow_sha1=0" \ |
| 902 | "$P_CLI key_file=data_files/cli-rsa.key crt_file=data_files/cli-rsa-sha1.crt" \ |
| 903 | 0 |
| 904 | |
Gilles Peskine | bc70a18 | 2017-05-09 15:59:24 +0200 | [diff] [blame] | 905 | run_test "SHA-1 explicitly allowed in client certificate" \ |
| 906 | "$P_SRV auth_mode=required allow_sha1=1" \ |
| 907 | "$P_CLI key_file=data_files/cli-rsa.key crt_file=data_files/cli-rsa-sha1.crt" \ |
| 908 | 0 |
| 909 | |
| 910 | run_test "SHA-256 allowed by default in client certificate" \ |
| 911 | "$P_SRV auth_mode=required allow_sha1=0" \ |
| 912 | "$P_CLI key_file=data_files/cli-rsa.key crt_file=data_files/cli-rsa-sha256.crt" \ |
| 913 | 0 |
| 914 | |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 915 | # Tests for Truncated HMAC extension |
| 916 | |
Manuel Pégourié-Gonnard | e117a8f | 2015-01-09 12:39:35 +0100 | [diff] [blame] | 917 | run_test "Truncated HMAC: client default, server default" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 918 | "$P_SRV debug_level=4" \ |
Manuel Pégourié-Gonnard | e117a8f | 2015-01-09 12:39:35 +0100 | [diff] [blame] | 919 | "$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] | 920 | 0 \ |
Hanno Becker | 992b687 | 2017-11-09 18:57:39 +0000 | [diff] [blame] | 921 | -s "dumping 'expected mac' (20 bytes)" \ |
| 922 | -S "dumping 'expected mac' (10 bytes)" |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 923 | |
Hanno Becker | 32c5501 | 2017-11-10 08:42:54 +0000 | [diff] [blame] | 924 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
Manuel Pégourié-Gonnard | e117a8f | 2015-01-09 12:39:35 +0100 | [diff] [blame] | 925 | run_test "Truncated HMAC: client disabled, server default" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 926 | "$P_SRV debug_level=4" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 927 | "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA trunc_hmac=0" \ |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 928 | 0 \ |
Hanno Becker | 992b687 | 2017-11-09 18:57:39 +0000 | [diff] [blame] | 929 | -s "dumping 'expected mac' (20 bytes)" \ |
| 930 | -S "dumping 'expected mac' (10 bytes)" |
Manuel Pégourié-Gonnard | e117a8f | 2015-01-09 12:39:35 +0100 | [diff] [blame] | 931 | |
Hanno Becker | 32c5501 | 2017-11-10 08:42:54 +0000 | [diff] [blame] | 932 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
Manuel Pégourié-Gonnard | e117a8f | 2015-01-09 12:39:35 +0100 | [diff] [blame] | 933 | run_test "Truncated HMAC: client enabled, server default" \ |
| 934 | "$P_SRV debug_level=4" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 935 | "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA trunc_hmac=1" \ |
Manuel Pégourié-Gonnard | e117a8f | 2015-01-09 12:39:35 +0100 | [diff] [blame] | 936 | 0 \ |
Hanno Becker | 992b687 | 2017-11-09 18:57:39 +0000 | [diff] [blame] | 937 | -s "dumping 'expected mac' (20 bytes)" \ |
| 938 | -S "dumping 'expected mac' (10 bytes)" |
Manuel Pégourié-Gonnard | e117a8f | 2015-01-09 12:39:35 +0100 | [diff] [blame] | 939 | |
Hanno Becker | 32c5501 | 2017-11-10 08:42:54 +0000 | [diff] [blame] | 940 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
Manuel Pégourié-Gonnard | e117a8f | 2015-01-09 12:39:35 +0100 | [diff] [blame] | 941 | run_test "Truncated HMAC: client enabled, server disabled" \ |
| 942 | "$P_SRV debug_level=4 trunc_hmac=0" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 943 | "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA trunc_hmac=1" \ |
Manuel Pégourié-Gonnard | e117a8f | 2015-01-09 12:39:35 +0100 | [diff] [blame] | 944 | 0 \ |
Hanno Becker | 992b687 | 2017-11-09 18:57:39 +0000 | [diff] [blame] | 945 | -s "dumping 'expected mac' (20 bytes)" \ |
| 946 | -S "dumping 'expected mac' (10 bytes)" |
Manuel Pégourié-Gonnard | e117a8f | 2015-01-09 12:39:35 +0100 | [diff] [blame] | 947 | |
Hanno Becker | 32c5501 | 2017-11-10 08:42:54 +0000 | [diff] [blame] | 948 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
Hanno Becker | 34d0c3f | 2017-11-17 15:46:24 +0000 | [diff] [blame] | 949 | run_test "Truncated HMAC: client disabled, server enabled" \ |
| 950 | "$P_SRV debug_level=4 trunc_hmac=1" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 951 | "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA trunc_hmac=0" \ |
Hanno Becker | 34d0c3f | 2017-11-17 15:46:24 +0000 | [diff] [blame] | 952 | 0 \ |
| 953 | -s "dumping 'expected mac' (20 bytes)" \ |
| 954 | -S "dumping 'expected mac' (10 bytes)" |
| 955 | |
| 956 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
Manuel Pégourié-Gonnard | e117a8f | 2015-01-09 12:39:35 +0100 | [diff] [blame] | 957 | run_test "Truncated HMAC: client enabled, server enabled" \ |
| 958 | "$P_SRV debug_level=4 trunc_hmac=1" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 959 | "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA trunc_hmac=1" \ |
Manuel Pégourié-Gonnard | e117a8f | 2015-01-09 12:39:35 +0100 | [diff] [blame] | 960 | 0 \ |
Hanno Becker | 992b687 | 2017-11-09 18:57:39 +0000 | [diff] [blame] | 961 | -S "dumping 'expected mac' (20 bytes)" \ |
| 962 | -s "dumping 'expected mac' (10 bytes)" |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 963 | |
Hanno Becker | 4c4f410 | 2017-11-10 09:16:05 +0000 | [diff] [blame] | 964 | run_test "Truncated HMAC, DTLS: client default, server default" \ |
| 965 | "$P_SRV dtls=1 debug_level=4" \ |
| 966 | "$P_CLI dtls=1 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| 967 | 0 \ |
| 968 | -s "dumping 'expected mac' (20 bytes)" \ |
| 969 | -S "dumping 'expected mac' (10 bytes)" |
| 970 | |
| 971 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
| 972 | run_test "Truncated HMAC, DTLS: client disabled, server default" \ |
| 973 | "$P_SRV dtls=1 debug_level=4" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 974 | "$P_CLI dtls=1 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA trunc_hmac=0" \ |
Hanno Becker | 4c4f410 | 2017-11-10 09:16:05 +0000 | [diff] [blame] | 975 | 0 \ |
| 976 | -s "dumping 'expected mac' (20 bytes)" \ |
| 977 | -S "dumping 'expected mac' (10 bytes)" |
| 978 | |
| 979 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
| 980 | run_test "Truncated HMAC, DTLS: client enabled, server default" \ |
| 981 | "$P_SRV dtls=1 debug_level=4" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 982 | "$P_CLI dtls=1 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA trunc_hmac=1" \ |
Hanno Becker | 4c4f410 | 2017-11-10 09:16:05 +0000 | [diff] [blame] | 983 | 0 \ |
| 984 | -s "dumping 'expected mac' (20 bytes)" \ |
| 985 | -S "dumping 'expected mac' (10 bytes)" |
| 986 | |
| 987 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
| 988 | run_test "Truncated HMAC, DTLS: client enabled, server disabled" \ |
| 989 | "$P_SRV dtls=1 debug_level=4 trunc_hmac=0" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 990 | "$P_CLI dtls=1 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA trunc_hmac=1" \ |
Hanno Becker | 4c4f410 | 2017-11-10 09:16:05 +0000 | [diff] [blame] | 991 | 0 \ |
| 992 | -s "dumping 'expected mac' (20 bytes)" \ |
| 993 | -S "dumping 'expected mac' (10 bytes)" |
| 994 | |
| 995 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
| 996 | run_test "Truncated HMAC, DTLS: client disabled, server enabled" \ |
| 997 | "$P_SRV dtls=1 debug_level=4 trunc_hmac=1" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 998 | "$P_CLI dtls=1 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA trunc_hmac=0" \ |
Hanno Becker | 4c4f410 | 2017-11-10 09:16:05 +0000 | [diff] [blame] | 999 | 0 \ |
| 1000 | -s "dumping 'expected mac' (20 bytes)" \ |
| 1001 | -S "dumping 'expected mac' (10 bytes)" |
| 1002 | |
| 1003 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
| 1004 | run_test "Truncated HMAC, DTLS: client enabled, server enabled" \ |
| 1005 | "$P_SRV dtls=1 debug_level=4 trunc_hmac=1" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 1006 | "$P_CLI dtls=1 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA trunc_hmac=1" \ |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 1007 | 0 \ |
| 1008 | -S "dumping 'expected mac' (20 bytes)" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 1009 | -s "dumping 'expected mac' (10 bytes)" |
| 1010 | |
Manuel Pégourié-Gonnard | 699cafa | 2014-10-27 13:57:03 +0100 | [diff] [blame] | 1011 | # Tests for Encrypt-then-MAC extension |
| 1012 | |
| 1013 | run_test "Encrypt then MAC: default" \ |
Manuel Pégourié-Gonnard | 0098e7d | 2014-10-28 13:08:59 +0100 | [diff] [blame] | 1014 | "$P_SRV debug_level=3 \ |
| 1015 | force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
Manuel Pégourié-Gonnard | 699cafa | 2014-10-27 13:57:03 +0100 | [diff] [blame] | 1016 | "$P_CLI debug_level=3" \ |
| 1017 | 0 \ |
| 1018 | -c "client hello, adding encrypt_then_mac extension" \ |
| 1019 | -s "found encrypt then mac extension" \ |
| 1020 | -s "server hello, adding encrypt then mac extension" \ |
| 1021 | -c "found encrypt_then_mac extension" \ |
| 1022 | -c "using encrypt then mac" \ |
| 1023 | -s "using encrypt then mac" |
| 1024 | |
| 1025 | run_test "Encrypt then MAC: client enabled, server disabled" \ |
Manuel Pégourié-Gonnard | 0098e7d | 2014-10-28 13:08:59 +0100 | [diff] [blame] | 1026 | "$P_SRV debug_level=3 etm=0 \ |
| 1027 | force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
Manuel Pégourié-Gonnard | 699cafa | 2014-10-27 13:57:03 +0100 | [diff] [blame] | 1028 | "$P_CLI debug_level=3 etm=1" \ |
| 1029 | 0 \ |
| 1030 | -c "client hello, adding encrypt_then_mac extension" \ |
| 1031 | -s "found encrypt then mac extension" \ |
| 1032 | -S "server hello, adding encrypt then mac extension" \ |
| 1033 | -C "found encrypt_then_mac extension" \ |
| 1034 | -C "using encrypt then mac" \ |
| 1035 | -S "using encrypt then mac" |
| 1036 | |
Manuel Pégourié-Gonnard | 78e745f | 2014-11-04 15:44:06 +0100 | [diff] [blame] | 1037 | run_test "Encrypt then MAC: client enabled, aead cipher" \ |
| 1038 | "$P_SRV debug_level=3 etm=1 \ |
| 1039 | force_ciphersuite=TLS-RSA-WITH-AES-128-GCM-SHA256" \ |
| 1040 | "$P_CLI debug_level=3 etm=1" \ |
| 1041 | 0 \ |
| 1042 | -c "client hello, adding encrypt_then_mac extension" \ |
| 1043 | -s "found encrypt then mac extension" \ |
| 1044 | -S "server hello, adding encrypt then mac extension" \ |
| 1045 | -C "found encrypt_then_mac extension" \ |
| 1046 | -C "using encrypt then mac" \ |
| 1047 | -S "using encrypt then mac" |
| 1048 | |
| 1049 | run_test "Encrypt then MAC: client enabled, stream cipher" \ |
| 1050 | "$P_SRV debug_level=3 etm=1 \ |
| 1051 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 1052 | "$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] | 1053 | 0 \ |
| 1054 | -c "client hello, adding encrypt_then_mac extension" \ |
| 1055 | -s "found encrypt then mac extension" \ |
| 1056 | -S "server hello, adding encrypt then mac extension" \ |
| 1057 | -C "found encrypt_then_mac extension" \ |
| 1058 | -C "using encrypt then mac" \ |
| 1059 | -S "using encrypt then mac" |
| 1060 | |
Manuel Pégourié-Gonnard | 699cafa | 2014-10-27 13:57:03 +0100 | [diff] [blame] | 1061 | run_test "Encrypt then MAC: client disabled, server enabled" \ |
Manuel Pégourié-Gonnard | 0098e7d | 2014-10-28 13:08:59 +0100 | [diff] [blame] | 1062 | "$P_SRV debug_level=3 etm=1 \ |
| 1063 | force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
Manuel Pégourié-Gonnard | 699cafa | 2014-10-27 13:57:03 +0100 | [diff] [blame] | 1064 | "$P_CLI debug_level=3 etm=0" \ |
| 1065 | 0 \ |
| 1066 | -C "client hello, adding encrypt_then_mac extension" \ |
| 1067 | -S "found encrypt then mac extension" \ |
| 1068 | -S "server hello, adding encrypt then mac extension" \ |
| 1069 | -C "found encrypt_then_mac extension" \ |
| 1070 | -C "using encrypt then mac" \ |
| 1071 | -S "using encrypt then mac" |
| 1072 | |
Janos Follath | e2681a4 | 2016-03-07 15:57:05 +0000 | [diff] [blame] | 1073 | requires_config_enabled MBEDTLS_SSL_PROTO_SSL3 |
Manuel Pégourié-Gonnard | 699cafa | 2014-10-27 13:57:03 +0100 | [diff] [blame] | 1074 | run_test "Encrypt then MAC: client SSLv3, server enabled" \ |
Manuel Pégourié-Gonnard | 51d8166 | 2015-01-14 17:20:46 +0100 | [diff] [blame] | 1075 | "$P_SRV debug_level=3 min_version=ssl3 \ |
Manuel Pégourié-Gonnard | 0098e7d | 2014-10-28 13:08:59 +0100 | [diff] [blame] | 1076 | force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
Manuel Pégourié-Gonnard | 699cafa | 2014-10-27 13:57:03 +0100 | [diff] [blame] | 1077 | "$P_CLI debug_level=3 force_version=ssl3" \ |
| 1078 | 0 \ |
| 1079 | -C "client hello, adding encrypt_then_mac extension" \ |
| 1080 | -S "found encrypt then mac extension" \ |
| 1081 | -S "server hello, adding encrypt then mac extension" \ |
| 1082 | -C "found encrypt_then_mac extension" \ |
| 1083 | -C "using encrypt then mac" \ |
| 1084 | -S "using encrypt then mac" |
| 1085 | |
Janos Follath | e2681a4 | 2016-03-07 15:57:05 +0000 | [diff] [blame] | 1086 | requires_config_enabled MBEDTLS_SSL_PROTO_SSL3 |
Manuel Pégourié-Gonnard | 699cafa | 2014-10-27 13:57:03 +0100 | [diff] [blame] | 1087 | run_test "Encrypt then MAC: client enabled, server SSLv3" \ |
Manuel Pégourié-Gonnard | 0098e7d | 2014-10-28 13:08:59 +0100 | [diff] [blame] | 1088 | "$P_SRV debug_level=3 force_version=ssl3 \ |
| 1089 | force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
Manuel Pégourié-Gonnard | 51d8166 | 2015-01-14 17:20:46 +0100 | [diff] [blame] | 1090 | "$P_CLI debug_level=3 min_version=ssl3" \ |
Manuel Pégourié-Gonnard | 699cafa | 2014-10-27 13:57:03 +0100 | [diff] [blame] | 1091 | 0 \ |
| 1092 | -c "client hello, adding encrypt_then_mac extension" \ |
Janos Follath | 00efff7 | 2016-05-06 13:48:23 +0100 | [diff] [blame] | 1093 | -S "found encrypt then mac extension" \ |
Manuel Pégourié-Gonnard | 699cafa | 2014-10-27 13:57:03 +0100 | [diff] [blame] | 1094 | -S "server hello, adding encrypt then mac extension" \ |
| 1095 | -C "found encrypt_then_mac extension" \ |
| 1096 | -C "using encrypt then mac" \ |
| 1097 | -S "using encrypt then mac" |
| 1098 | |
Manuel Pégourié-Gonnard | 367381f | 2014-10-20 18:40:56 +0200 | [diff] [blame] | 1099 | # Tests for Extended Master Secret extension |
| 1100 | |
| 1101 | run_test "Extended Master Secret: default" \ |
| 1102 | "$P_SRV debug_level=3" \ |
| 1103 | "$P_CLI debug_level=3" \ |
| 1104 | 0 \ |
| 1105 | -c "client hello, adding extended_master_secret extension" \ |
| 1106 | -s "found extended master secret extension" \ |
| 1107 | -s "server hello, adding extended master secret extension" \ |
| 1108 | -c "found extended_master_secret extension" \ |
| 1109 | -c "using extended master secret" \ |
| 1110 | -s "using extended master secret" |
| 1111 | |
| 1112 | run_test "Extended Master Secret: client enabled, server disabled" \ |
| 1113 | "$P_SRV debug_level=3 extended_ms=0" \ |
| 1114 | "$P_CLI debug_level=3 extended_ms=1" \ |
| 1115 | 0 \ |
| 1116 | -c "client hello, adding extended_master_secret extension" \ |
| 1117 | -s "found extended master secret extension" \ |
| 1118 | -S "server hello, adding extended master secret extension" \ |
| 1119 | -C "found extended_master_secret extension" \ |
| 1120 | -C "using extended master secret" \ |
| 1121 | -S "using extended master secret" |
| 1122 | |
| 1123 | run_test "Extended Master Secret: client disabled, server enabled" \ |
| 1124 | "$P_SRV debug_level=3 extended_ms=1" \ |
| 1125 | "$P_CLI debug_level=3 extended_ms=0" \ |
| 1126 | 0 \ |
| 1127 | -C "client hello, adding extended_master_secret extension" \ |
| 1128 | -S "found extended master secret extension" \ |
| 1129 | -S "server hello, adding extended master secret extension" \ |
| 1130 | -C "found extended_master_secret extension" \ |
| 1131 | -C "using extended master secret" \ |
| 1132 | -S "using extended master secret" |
| 1133 | |
Janos Follath | e2681a4 | 2016-03-07 15:57:05 +0000 | [diff] [blame] | 1134 | requires_config_enabled MBEDTLS_SSL_PROTO_SSL3 |
Manuel Pégourié-Gonnard | b575b54 | 2014-10-24 15:12:31 +0200 | [diff] [blame] | 1135 | run_test "Extended Master Secret: client SSLv3, server enabled" \ |
Manuel Pégourié-Gonnard | 51d8166 | 2015-01-14 17:20:46 +0100 | [diff] [blame] | 1136 | "$P_SRV debug_level=3 min_version=ssl3" \ |
Manuel Pégourié-Gonnard | b575b54 | 2014-10-24 15:12:31 +0200 | [diff] [blame] | 1137 | "$P_CLI debug_level=3 force_version=ssl3" \ |
| 1138 | 0 \ |
| 1139 | -C "client hello, adding extended_master_secret extension" \ |
| 1140 | -S "found extended master secret extension" \ |
| 1141 | -S "server hello, adding extended master secret extension" \ |
| 1142 | -C "found extended_master_secret extension" \ |
| 1143 | -C "using extended master secret" \ |
| 1144 | -S "using extended master secret" |
| 1145 | |
Janos Follath | e2681a4 | 2016-03-07 15:57:05 +0000 | [diff] [blame] | 1146 | requires_config_enabled MBEDTLS_SSL_PROTO_SSL3 |
Manuel Pégourié-Gonnard | b575b54 | 2014-10-24 15:12:31 +0200 | [diff] [blame] | 1147 | run_test "Extended Master Secret: client enabled, server SSLv3" \ |
| 1148 | "$P_SRV debug_level=3 force_version=ssl3" \ |
Manuel Pégourié-Gonnard | 51d8166 | 2015-01-14 17:20:46 +0100 | [diff] [blame] | 1149 | "$P_CLI debug_level=3 min_version=ssl3" \ |
Manuel Pégourié-Gonnard | b575b54 | 2014-10-24 15:12:31 +0200 | [diff] [blame] | 1150 | 0 \ |
| 1151 | -c "client hello, adding extended_master_secret extension" \ |
Janos Follath | 00efff7 | 2016-05-06 13:48:23 +0100 | [diff] [blame] | 1152 | -S "found extended master secret extension" \ |
Manuel Pégourié-Gonnard | b575b54 | 2014-10-24 15:12:31 +0200 | [diff] [blame] | 1153 | -S "server hello, adding extended master secret extension" \ |
| 1154 | -C "found extended_master_secret extension" \ |
| 1155 | -C "using extended master secret" \ |
| 1156 | -S "using extended master secret" |
| 1157 | |
Manuel Pégourié-Gonnard | 1cbd39d | 2014-10-20 13:34:59 +0200 | [diff] [blame] | 1158 | # Tests for FALLBACK_SCSV |
| 1159 | |
| 1160 | run_test "Fallback SCSV: default" \ |
Manuel Pégourié-Gonnard | 4268ae0 | 2015-08-04 12:44:10 +0200 | [diff] [blame] | 1161 | "$P_SRV debug_level=2" \ |
Manuel Pégourié-Gonnard | 1cbd39d | 2014-10-20 13:34:59 +0200 | [diff] [blame] | 1162 | "$P_CLI debug_level=3 force_version=tls1_1" \ |
| 1163 | 0 \ |
| 1164 | -C "adding FALLBACK_SCSV" \ |
Manuel Pégourié-Gonnard | 01b2699 | 2014-10-20 14:05:28 +0200 | [diff] [blame] | 1165 | -S "received FALLBACK_SCSV" \ |
| 1166 | -S "inapropriate fallback" \ |
Manuel Pégourié-Gonnard | 1cbd39d | 2014-10-20 13:34:59 +0200 | [diff] [blame] | 1167 | -C "is a fatal alert message (msg 86)" |
| 1168 | |
| 1169 | run_test "Fallback SCSV: explicitly disabled" \ |
Manuel Pégourié-Gonnard | 4268ae0 | 2015-08-04 12:44:10 +0200 | [diff] [blame] | 1170 | "$P_SRV debug_level=2" \ |
Manuel Pégourié-Gonnard | 1cbd39d | 2014-10-20 13:34:59 +0200 | [diff] [blame] | 1171 | "$P_CLI debug_level=3 force_version=tls1_1 fallback=0" \ |
| 1172 | 0 \ |
| 1173 | -C "adding FALLBACK_SCSV" \ |
Manuel Pégourié-Gonnard | 01b2699 | 2014-10-20 14:05:28 +0200 | [diff] [blame] | 1174 | -S "received FALLBACK_SCSV" \ |
| 1175 | -S "inapropriate fallback" \ |
Manuel Pégourié-Gonnard | 1cbd39d | 2014-10-20 13:34:59 +0200 | [diff] [blame] | 1176 | -C "is a fatal alert message (msg 86)" |
| 1177 | |
| 1178 | run_test "Fallback SCSV: enabled" \ |
Manuel Pégourié-Gonnard | 4268ae0 | 2015-08-04 12:44:10 +0200 | [diff] [blame] | 1179 | "$P_SRV debug_level=2" \ |
Manuel Pégourié-Gonnard | 1cbd39d | 2014-10-20 13:34:59 +0200 | [diff] [blame] | 1180 | "$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] | 1181 | 1 \ |
| 1182 | -c "adding FALLBACK_SCSV" \ |
| 1183 | -s "received FALLBACK_SCSV" \ |
| 1184 | -s "inapropriate fallback" \ |
| 1185 | -c "is a fatal alert message (msg 86)" |
| 1186 | |
| 1187 | run_test "Fallback SCSV: enabled, max version" \ |
Manuel Pégourié-Gonnard | 4268ae0 | 2015-08-04 12:44:10 +0200 | [diff] [blame] | 1188 | "$P_SRV debug_level=2" \ |
Manuel Pégourié-Gonnard | 01b2699 | 2014-10-20 14:05:28 +0200 | [diff] [blame] | 1189 | "$P_CLI debug_level=3 fallback=1" \ |
Manuel Pégourié-Gonnard | 1cbd39d | 2014-10-20 13:34:59 +0200 | [diff] [blame] | 1190 | 0 \ |
| 1191 | -c "adding FALLBACK_SCSV" \ |
Manuel Pégourié-Gonnard | 01b2699 | 2014-10-20 14:05:28 +0200 | [diff] [blame] | 1192 | -s "received FALLBACK_SCSV" \ |
| 1193 | -S "inapropriate fallback" \ |
Manuel Pégourié-Gonnard | 1cbd39d | 2014-10-20 13:34:59 +0200 | [diff] [blame] | 1194 | -C "is a fatal alert message (msg 86)" |
| 1195 | |
| 1196 | requires_openssl_with_fallback_scsv |
| 1197 | run_test "Fallback SCSV: default, openssl server" \ |
| 1198 | "$O_SRV" \ |
| 1199 | "$P_CLI debug_level=3 force_version=tls1_1 fallback=0" \ |
| 1200 | 0 \ |
| 1201 | -C "adding FALLBACK_SCSV" \ |
| 1202 | -C "is a fatal alert message (msg 86)" |
| 1203 | |
| 1204 | requires_openssl_with_fallback_scsv |
| 1205 | run_test "Fallback SCSV: enabled, openssl server" \ |
| 1206 | "$O_SRV" \ |
| 1207 | "$P_CLI debug_level=3 force_version=tls1_1 fallback=1" \ |
| 1208 | 1 \ |
| 1209 | -c "adding FALLBACK_SCSV" \ |
| 1210 | -c "is a fatal alert message (msg 86)" |
| 1211 | |
Manuel Pégourié-Gonnard | 01b2699 | 2014-10-20 14:05:28 +0200 | [diff] [blame] | 1212 | requires_openssl_with_fallback_scsv |
| 1213 | run_test "Fallback SCSV: disabled, openssl client" \ |
Manuel Pégourié-Gonnard | 4268ae0 | 2015-08-04 12:44:10 +0200 | [diff] [blame] | 1214 | "$P_SRV debug_level=2" \ |
Manuel Pégourié-Gonnard | 01b2699 | 2014-10-20 14:05:28 +0200 | [diff] [blame] | 1215 | "$O_CLI -tls1_1" \ |
| 1216 | 0 \ |
| 1217 | -S "received FALLBACK_SCSV" \ |
| 1218 | -S "inapropriate fallback" |
| 1219 | |
| 1220 | requires_openssl_with_fallback_scsv |
| 1221 | run_test "Fallback SCSV: enabled, openssl client" \ |
Manuel Pégourié-Gonnard | 4268ae0 | 2015-08-04 12:44:10 +0200 | [diff] [blame] | 1222 | "$P_SRV debug_level=2" \ |
Manuel Pégourié-Gonnard | 01b2699 | 2014-10-20 14:05:28 +0200 | [diff] [blame] | 1223 | "$O_CLI -tls1_1 -fallback_scsv" \ |
| 1224 | 1 \ |
| 1225 | -s "received FALLBACK_SCSV" \ |
| 1226 | -s "inapropriate fallback" |
| 1227 | |
| 1228 | requires_openssl_with_fallback_scsv |
| 1229 | run_test "Fallback SCSV: enabled, max version, openssl client" \ |
Manuel Pégourié-Gonnard | 4268ae0 | 2015-08-04 12:44:10 +0200 | [diff] [blame] | 1230 | "$P_SRV debug_level=2" \ |
Manuel Pégourié-Gonnard | 01b2699 | 2014-10-20 14:05:28 +0200 | [diff] [blame] | 1231 | "$O_CLI -fallback_scsv" \ |
| 1232 | 0 \ |
| 1233 | -s "received FALLBACK_SCSV" \ |
| 1234 | -S "inapropriate fallback" |
| 1235 | |
Andres Amaya Garcia | 4c761fa | 2018-07-10 20:08:04 +0100 | [diff] [blame] | 1236 | # Test sending and receiving empty application data records |
| 1237 | |
| 1238 | run_test "Encrypt then MAC: empty application data record" \ |
| 1239 | "$P_SRV auth_mode=none debug_level=4 etm=1" \ |
| 1240 | "$P_CLI auth_mode=none etm=1 request_size=0 force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA" \ |
| 1241 | 0 \ |
| 1242 | -S "0000: 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f" \ |
| 1243 | -s "dumping 'input payload after decrypt' (0 bytes)" \ |
| 1244 | -c "0 bytes written in 1 fragments" |
| 1245 | |
| 1246 | run_test "Default, no Encrypt then MAC: empty application data record" \ |
| 1247 | "$P_SRV auth_mode=none debug_level=4 etm=0" \ |
| 1248 | "$P_CLI auth_mode=none etm=0 request_size=0" \ |
| 1249 | 0 \ |
| 1250 | -s "dumping 'input payload after decrypt' (0 bytes)" \ |
| 1251 | -c "0 bytes written in 1 fragments" |
| 1252 | |
| 1253 | run_test "Encrypt then MAC, DTLS: empty application data record" \ |
| 1254 | "$P_SRV auth_mode=none debug_level=4 etm=1 dtls=1" \ |
| 1255 | "$P_CLI auth_mode=none etm=1 request_size=0 force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA dtls=1" \ |
| 1256 | 0 \ |
| 1257 | -S "0000: 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f" \ |
| 1258 | -s "dumping 'input payload after decrypt' (0 bytes)" \ |
| 1259 | -c "0 bytes written in 1 fragments" |
| 1260 | |
| 1261 | run_test "Default, no Encrypt then MAC, DTLS: empty application data record" \ |
| 1262 | "$P_SRV auth_mode=none debug_level=4 etm=0 dtls=1" \ |
| 1263 | "$P_CLI auth_mode=none etm=0 request_size=0 dtls=1" \ |
| 1264 | 0 \ |
| 1265 | -s "dumping 'input payload after decrypt' (0 bytes)" \ |
| 1266 | -c "0 bytes written in 1 fragments" |
| 1267 | |
Gilles Peskine | d50177f | 2017-05-16 17:53:03 +0200 | [diff] [blame] | 1268 | ## ClientHello generated with |
| 1269 | ## "openssl s_client -CAfile tests/data_files/test-ca.crt -tls1_1 -connect localhost:4433 -cipher ..." |
| 1270 | ## then manually twiddling the ciphersuite list. |
| 1271 | ## The ClientHello content is spelled out below as a hex string as |
| 1272 | ## "prefix ciphersuite1 ciphersuite2 ciphersuite3 ciphersuite4 suffix". |
| 1273 | ## The expected response is an inappropriate_fallback alert. |
| 1274 | requires_openssl_with_fallback_scsv |
| 1275 | run_test "Fallback SCSV: beginning of list" \ |
| 1276 | "$P_SRV debug_level=2" \ |
| 1277 | "$TCP_CLIENT localhost $SRV_PORT '160301003e0100003a03022aafb94308dc22ca1086c65acc00e414384d76b61ecab37df1633b1ae1034dbe000008 5600 0031 0032 0033 0100000900230000000f000101' '15030200020256'" \ |
| 1278 | 0 \ |
| 1279 | -s "received FALLBACK_SCSV" \ |
| 1280 | -s "inapropriate fallback" |
| 1281 | |
| 1282 | requires_openssl_with_fallback_scsv |
| 1283 | run_test "Fallback SCSV: end of list" \ |
| 1284 | "$P_SRV debug_level=2" \ |
| 1285 | "$TCP_CLIENT localhost $SRV_PORT '160301003e0100003a03022aafb94308dc22ca1086c65acc00e414384d76b61ecab37df1633b1ae1034dbe000008 0031 0032 0033 5600 0100000900230000000f000101' '15030200020256'" \ |
| 1286 | 0 \ |
| 1287 | -s "received FALLBACK_SCSV" \ |
| 1288 | -s "inapropriate fallback" |
| 1289 | |
| 1290 | ## Here the expected response is a valid ServerHello prefix, up to the random. |
| 1291 | requires_openssl_with_fallback_scsv |
| 1292 | run_test "Fallback SCSV: not in list" \ |
| 1293 | "$P_SRV debug_level=2" \ |
| 1294 | "$TCP_CLIENT localhost $SRV_PORT '160301003e0100003a03022aafb94308dc22ca1086c65acc00e414384d76b61ecab37df1633b1ae1034dbe000008 0056 0031 0032 0033 0100000900230000000f000101' '16030200300200002c0302'" \ |
| 1295 | 0 \ |
| 1296 | -S "received FALLBACK_SCSV" \ |
| 1297 | -S "inapropriate fallback" |
| 1298 | |
Manuel Pégourié-Gonnard | 3ff7823 | 2015-01-08 11:15:09 +0100 | [diff] [blame] | 1299 | # Tests for CBC 1/n-1 record splitting |
| 1300 | |
| 1301 | run_test "CBC Record splitting: TLS 1.2, no splitting" \ |
| 1302 | "$P_SRV" \ |
| 1303 | "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA \ |
| 1304 | request_size=123 force_version=tls1_2" \ |
| 1305 | 0 \ |
| 1306 | -s "Read from client: 123 bytes read" \ |
| 1307 | -S "Read from client: 1 bytes read" \ |
| 1308 | -S "122 bytes read" |
| 1309 | |
| 1310 | run_test "CBC Record splitting: TLS 1.1, no splitting" \ |
| 1311 | "$P_SRV" \ |
| 1312 | "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA \ |
| 1313 | request_size=123 force_version=tls1_1" \ |
| 1314 | 0 \ |
| 1315 | -s "Read from client: 123 bytes read" \ |
| 1316 | -S "Read from client: 1 bytes read" \ |
| 1317 | -S "122 bytes read" |
| 1318 | |
| 1319 | run_test "CBC Record splitting: TLS 1.0, splitting" \ |
| 1320 | "$P_SRV" \ |
| 1321 | "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA \ |
| 1322 | request_size=123 force_version=tls1" \ |
| 1323 | 0 \ |
| 1324 | -S "Read from client: 123 bytes read" \ |
| 1325 | -s "Read from client: 1 bytes read" \ |
| 1326 | -s "122 bytes read" |
| 1327 | |
Janos Follath | e2681a4 | 2016-03-07 15:57:05 +0000 | [diff] [blame] | 1328 | requires_config_enabled MBEDTLS_SSL_PROTO_SSL3 |
Manuel Pégourié-Gonnard | 3ff7823 | 2015-01-08 11:15:09 +0100 | [diff] [blame] | 1329 | run_test "CBC Record splitting: SSLv3, splitting" \ |
Manuel Pégourié-Gonnard | 51d8166 | 2015-01-14 17:20:46 +0100 | [diff] [blame] | 1330 | "$P_SRV min_version=ssl3" \ |
Manuel Pégourié-Gonnard | 3ff7823 | 2015-01-08 11:15:09 +0100 | [diff] [blame] | 1331 | "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA \ |
| 1332 | request_size=123 force_version=ssl3" \ |
| 1333 | 0 \ |
| 1334 | -S "Read from client: 123 bytes read" \ |
| 1335 | -s "Read from client: 1 bytes read" \ |
| 1336 | -s "122 bytes read" |
| 1337 | |
| 1338 | 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] | 1339 | "$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] | 1340 | "$P_CLI force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \ |
| 1341 | request_size=123 force_version=tls1" \ |
| 1342 | 0 \ |
| 1343 | -s "Read from client: 123 bytes read" \ |
| 1344 | -S "Read from client: 1 bytes read" \ |
| 1345 | -S "122 bytes read" |
| 1346 | |
| 1347 | run_test "CBC Record splitting: TLS 1.0, splitting disabled" \ |
| 1348 | "$P_SRV" \ |
| 1349 | "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA \ |
| 1350 | request_size=123 force_version=tls1 recsplit=0" \ |
| 1351 | 0 \ |
| 1352 | -s "Read from client: 123 bytes read" \ |
| 1353 | -S "Read from client: 1 bytes read" \ |
| 1354 | -S "122 bytes read" |
| 1355 | |
Manuel Pégourié-Gonnard | a852cf4 | 2015-01-13 20:56:15 +0100 | [diff] [blame] | 1356 | run_test "CBC Record splitting: TLS 1.0, splitting, nbio" \ |
| 1357 | "$P_SRV nbio=2" \ |
| 1358 | "$P_CLI nbio=2 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA \ |
| 1359 | request_size=123 force_version=tls1" \ |
| 1360 | 0 \ |
| 1361 | -S "Read from client: 123 bytes read" \ |
| 1362 | -s "Read from client: 1 bytes read" \ |
| 1363 | -s "122 bytes read" |
| 1364 | |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 1365 | # Tests for Session Tickets |
| 1366 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1367 | run_test "Session resume using tickets: basic" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1368 | "$P_SRV debug_level=3 tickets=1" \ |
| 1369 | "$P_CLI debug_level=3 tickets=1 reconnect=1" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 1370 | 0 \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 1371 | -c "client hello, adding session ticket extension" \ |
| 1372 | -s "found session ticket extension" \ |
| 1373 | -s "server hello, adding session ticket extension" \ |
| 1374 | -c "found session_ticket extension" \ |
| 1375 | -c "parse new session ticket" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 1376 | -S "session successfully restored from cache" \ |
| 1377 | -s "session successfully restored from ticket" \ |
| 1378 | -s "a session has been resumed" \ |
| 1379 | -c "a session has been resumed" |
| 1380 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1381 | run_test "Session resume using tickets: cache disabled" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1382 | "$P_SRV debug_level=3 tickets=1 cache_max=0" \ |
| 1383 | "$P_CLI debug_level=3 tickets=1 reconnect=1" \ |
Manuel Pégourié-Gonnard | dbe1ee1 | 2014-02-21 09:18:13 +0100 | [diff] [blame] | 1384 | 0 \ |
| 1385 | -c "client hello, adding session ticket extension" \ |
| 1386 | -s "found session ticket extension" \ |
| 1387 | -s "server hello, adding session ticket extension" \ |
| 1388 | -c "found session_ticket extension" \ |
| 1389 | -c "parse new session ticket" \ |
| 1390 | -S "session successfully restored from cache" \ |
| 1391 | -s "session successfully restored from ticket" \ |
| 1392 | -s "a session has been resumed" \ |
| 1393 | -c "a session has been resumed" |
| 1394 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1395 | run_test "Session resume using tickets: timeout" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1396 | "$P_SRV debug_level=3 tickets=1 cache_max=0 ticket_timeout=1" \ |
| 1397 | "$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] | 1398 | 0 \ |
| 1399 | -c "client hello, adding session ticket extension" \ |
| 1400 | -s "found session ticket extension" \ |
| 1401 | -s "server hello, adding session ticket extension" \ |
| 1402 | -c "found session_ticket extension" \ |
| 1403 | -c "parse new session ticket" \ |
| 1404 | -S "session successfully restored from cache" \ |
| 1405 | -S "session successfully restored from ticket" \ |
| 1406 | -S "a session has been resumed" \ |
| 1407 | -C "a session has been resumed" |
| 1408 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1409 | run_test "Session resume using tickets: openssl server" \ |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 1410 | "$O_SRV" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1411 | "$P_CLI debug_level=3 tickets=1 reconnect=1" \ |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 1412 | 0 \ |
| 1413 | -c "client hello, adding session ticket extension" \ |
| 1414 | -c "found session_ticket extension" \ |
| 1415 | -c "parse new session ticket" \ |
| 1416 | -c "a session has been resumed" |
| 1417 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1418 | run_test "Session resume using tickets: openssl client" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1419 | "$P_SRV debug_level=3 tickets=1" \ |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 1420 | "( $O_CLI -sess_out $SESSION; \ |
| 1421 | $O_CLI -sess_in $SESSION; \ |
| 1422 | rm -f $SESSION )" \ |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 1423 | 0 \ |
| 1424 | -s "found session ticket extension" \ |
| 1425 | -s "server hello, adding session ticket extension" \ |
| 1426 | -S "session successfully restored from cache" \ |
| 1427 | -s "session successfully restored from ticket" \ |
| 1428 | -s "a session has been resumed" |
| 1429 | |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 1430 | # Tests for Session Resume based on session-ID and cache |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 1431 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1432 | run_test "Session resume using cache: tickets enabled on client" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1433 | "$P_SRV debug_level=3 tickets=0" \ |
| 1434 | "$P_CLI debug_level=3 tickets=1 reconnect=1" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 1435 | 0 \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 1436 | -c "client hello, adding session ticket extension" \ |
| 1437 | -s "found session ticket extension" \ |
| 1438 | -S "server hello, adding session ticket extension" \ |
| 1439 | -C "found session_ticket extension" \ |
| 1440 | -C "parse new session ticket" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 1441 | -s "session successfully restored from cache" \ |
| 1442 | -S "session successfully restored from ticket" \ |
| 1443 | -s "a session has been resumed" \ |
| 1444 | -c "a session has been resumed" |
| 1445 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1446 | run_test "Session resume using cache: tickets enabled on server" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1447 | "$P_SRV debug_level=3 tickets=1" \ |
| 1448 | "$P_CLI debug_level=3 tickets=0 reconnect=1" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 1449 | 0 \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 1450 | -C "client hello, adding session ticket extension" \ |
| 1451 | -S "found session ticket extension" \ |
| 1452 | -S "server hello, adding session ticket extension" \ |
| 1453 | -C "found session_ticket extension" \ |
| 1454 | -C "parse new session ticket" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 1455 | -s "session successfully restored from cache" \ |
| 1456 | -S "session successfully restored from ticket" \ |
| 1457 | -s "a session has been resumed" \ |
| 1458 | -c "a session has been resumed" |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 1459 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1460 | run_test "Session resume using cache: cache_max=0" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1461 | "$P_SRV debug_level=3 tickets=0 cache_max=0" \ |
| 1462 | "$P_CLI debug_level=3 tickets=0 reconnect=1" \ |
Manuel Pégourié-Gonnard | 4c88345 | 2014-02-20 21:32:41 +0100 | [diff] [blame] | 1463 | 0 \ |
| 1464 | -S "session successfully restored from cache" \ |
| 1465 | -S "session successfully restored from ticket" \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 1466 | -S "a session has been resumed" \ |
| 1467 | -C "a session has been resumed" |
Manuel Pégourié-Gonnard | 4c88345 | 2014-02-20 21:32:41 +0100 | [diff] [blame] | 1468 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1469 | run_test "Session resume using cache: cache_max=1" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1470 | "$P_SRV debug_level=3 tickets=0 cache_max=1" \ |
| 1471 | "$P_CLI debug_level=3 tickets=0 reconnect=1" \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 1472 | 0 \ |
| 1473 | -s "session successfully restored from cache" \ |
| 1474 | -S "session successfully restored from ticket" \ |
| 1475 | -s "a session has been resumed" \ |
| 1476 | -c "a session has been resumed" |
| 1477 | |
Manuel Pégourié-Gonnard | 6df3196 | 2015-05-04 10:55:47 +0200 | [diff] [blame] | 1478 | run_test "Session resume using cache: timeout > delay" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1479 | "$P_SRV debug_level=3 tickets=0" \ |
| 1480 | "$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] | 1481 | 0 \ |
| 1482 | -s "session successfully restored from cache" \ |
| 1483 | -S "session successfully restored from ticket" \ |
| 1484 | -s "a session has been resumed" \ |
| 1485 | -c "a session has been resumed" |
| 1486 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1487 | run_test "Session resume using cache: timeout < delay" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1488 | "$P_SRV debug_level=3 tickets=0 cache_timeout=1" \ |
| 1489 | "$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] | 1490 | 0 \ |
| 1491 | -S "session successfully restored from cache" \ |
| 1492 | -S "session successfully restored from ticket" \ |
| 1493 | -S "a session has been resumed" \ |
| 1494 | -C "a session has been resumed" |
| 1495 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1496 | run_test "Session resume using cache: no timeout" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1497 | "$P_SRV debug_level=3 tickets=0 cache_timeout=0" \ |
| 1498 | "$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] | 1499 | 0 \ |
| 1500 | -s "session successfully restored from cache" \ |
| 1501 | -S "session successfully restored from ticket" \ |
| 1502 | -s "a session has been resumed" \ |
| 1503 | -c "a session has been resumed" |
| 1504 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1505 | run_test "Session resume using cache: openssl client" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1506 | "$P_SRV debug_level=3 tickets=0" \ |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 1507 | "( $O_CLI -sess_out $SESSION; \ |
| 1508 | $O_CLI -sess_in $SESSION; \ |
| 1509 | rm -f $SESSION )" \ |
Manuel Pégourié-Gonnard | db735f6 | 2014-02-25 17:57:59 +0100 | [diff] [blame] | 1510 | 0 \ |
| 1511 | -s "found session ticket extension" \ |
| 1512 | -S "server hello, adding session ticket extension" \ |
| 1513 | -s "session successfully restored from cache" \ |
| 1514 | -S "session successfully restored from ticket" \ |
| 1515 | -s "a session has been resumed" |
| 1516 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1517 | run_test "Session resume using cache: openssl server" \ |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 1518 | "$O_SRV" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1519 | "$P_CLI debug_level=3 tickets=0 reconnect=1" \ |
Manuel Pégourié-Gonnard | db735f6 | 2014-02-25 17:57:59 +0100 | [diff] [blame] | 1520 | 0 \ |
| 1521 | -C "found session_ticket extension" \ |
| 1522 | -C "parse new session ticket" \ |
| 1523 | -c "a session has been resumed" |
| 1524 | |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 1525 | # Tests for Max Fragment Length extension |
| 1526 | |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 1527 | if [ "$MAX_CONTENT_LEN" -lt "4096" ]; then |
| 1528 | printf "${CONFIG_H} defines MBEDTLS_SSL_MAX_CONTENT_LEN to be less than 4096. Fragment length tests will fail.\n" |
Hanno Becker | 6428f8d | 2017-09-22 16:58:50 +0100 | [diff] [blame] | 1529 | exit 1 |
| 1530 | fi |
| 1531 | |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 1532 | if [ $MAX_CONTENT_LEN -ne 16384 ]; then |
| 1533 | printf "Using non-default maximum content length $MAX_CONTENT_LEN\n" |
| 1534 | fi |
| 1535 | |
Hanno Becker | 4aed27e | 2017-09-18 15:00:34 +0100 | [diff] [blame] | 1536 | requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
Hanno Becker | c526696 | 2017-09-18 15:01:50 +0100 | [diff] [blame] | 1537 | run_test "Max fragment length: enabled, default" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1538 | "$P_SRV debug_level=3" \ |
| 1539 | "$P_CLI debug_level=3" \ |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 1540 | 0 \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 1541 | -c "Maximum fragment length is $MAX_CONTENT_LEN" \ |
| 1542 | -s "Maximum fragment length is $MAX_CONTENT_LEN" \ |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 1543 | -C "client hello, adding max_fragment_length extension" \ |
| 1544 | -S "found max fragment length extension" \ |
| 1545 | -S "server hello, max_fragment_length extension" \ |
| 1546 | -C "found max_fragment_length extension" |
| 1547 | |
Hanno Becker | 4aed27e | 2017-09-18 15:00:34 +0100 | [diff] [blame] | 1548 | requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
Hanno Becker | c526696 | 2017-09-18 15:01:50 +0100 | [diff] [blame] | 1549 | run_test "Max fragment length: enabled, default, larger message" \ |
| 1550 | "$P_SRV debug_level=3" \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 1551 | "$P_CLI debug_level=3 request_size=$(( $MAX_CONTENT_LEN + 1))" \ |
Hanno Becker | c526696 | 2017-09-18 15:01:50 +0100 | [diff] [blame] | 1552 | 0 \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 1553 | -c "Maximum fragment length is $MAX_CONTENT_LEN" \ |
| 1554 | -s "Maximum fragment length is $MAX_CONTENT_LEN" \ |
Hanno Becker | c526696 | 2017-09-18 15:01:50 +0100 | [diff] [blame] | 1555 | -C "client hello, adding max_fragment_length extension" \ |
| 1556 | -S "found max fragment length extension" \ |
| 1557 | -S "server hello, max_fragment_length extension" \ |
| 1558 | -C "found max_fragment_length extension" \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 1559 | -c "$(( $MAX_CONTENT_LEN + 1)) bytes written in 2 fragments" \ |
| 1560 | -s "$MAX_CONTENT_LEN bytes read" \ |
Hanno Becker | 9cfabe3 | 2017-10-18 14:42:01 +0100 | [diff] [blame] | 1561 | -s "1 bytes read" |
Hanno Becker | c526696 | 2017-09-18 15:01:50 +0100 | [diff] [blame] | 1562 | |
| 1563 | requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| 1564 | run_test "Max fragment length, DTLS: enabled, default, larger message" \ |
| 1565 | "$P_SRV debug_level=3 dtls=1" \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 1566 | "$P_CLI debug_level=3 dtls=1 request_size=$(( $MAX_CONTENT_LEN + 1))" \ |
Hanno Becker | c526696 | 2017-09-18 15:01:50 +0100 | [diff] [blame] | 1567 | 1 \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 1568 | -c "Maximum fragment length is $MAX_CONTENT_LEN" \ |
| 1569 | -s "Maximum fragment length is $MAX_CONTENT_LEN" \ |
Hanno Becker | c526696 | 2017-09-18 15:01:50 +0100 | [diff] [blame] | 1570 | -C "client hello, adding max_fragment_length extension" \ |
| 1571 | -S "found max fragment length extension" \ |
| 1572 | -S "server hello, max_fragment_length extension" \ |
| 1573 | -C "found max_fragment_length extension" \ |
| 1574 | -c "fragment larger than.*maximum " |
| 1575 | |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 1576 | # Run some tests with MBEDTLS_SSL_MAX_FRAGMENT_LENGTH disabled |
| 1577 | # (session fragment length will be 16384 regardless of mbedtls |
| 1578 | # content length configuration.) |
| 1579 | |
Hanno Becker | c526696 | 2017-09-18 15:01:50 +0100 | [diff] [blame] | 1580 | requires_config_disabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| 1581 | run_test "Max fragment length: disabled, larger message" \ |
| 1582 | "$P_SRV debug_level=3" \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 1583 | "$P_CLI debug_level=3 request_size=$(( $MAX_CONTENT_LEN + 1))" \ |
Hanno Becker | c526696 | 2017-09-18 15:01:50 +0100 | [diff] [blame] | 1584 | 0 \ |
| 1585 | -C "Maximum fragment length is 16384" \ |
| 1586 | -S "Maximum fragment length is 16384" \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 1587 | -c "$(( $MAX_CONTENT_LEN + 1)) bytes written in 2 fragments" \ |
| 1588 | -s "$MAX_CONTENT_LEN bytes read" \ |
Hanno Becker | 9cfabe3 | 2017-10-18 14:42:01 +0100 | [diff] [blame] | 1589 | -s "1 bytes read" |
Hanno Becker | c526696 | 2017-09-18 15:01:50 +0100 | [diff] [blame] | 1590 | |
| 1591 | requires_config_disabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| 1592 | run_test "Max fragment length DTLS: disabled, larger message" \ |
| 1593 | "$P_SRV debug_level=3 dtls=1" \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 1594 | "$P_CLI debug_level=3 dtls=1 request_size=$(( $MAX_CONTENT_LEN + 1))" \ |
Hanno Becker | c526696 | 2017-09-18 15:01:50 +0100 | [diff] [blame] | 1595 | 1 \ |
| 1596 | -C "Maximum fragment length is 16384" \ |
| 1597 | -S "Maximum fragment length is 16384" \ |
| 1598 | -c "fragment larger than.*maximum " |
| 1599 | |
| 1600 | requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1601 | run_test "Max fragment length: used by client" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1602 | "$P_SRV debug_level=3" \ |
| 1603 | "$P_CLI debug_level=3 max_frag_len=4096" \ |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 1604 | 0 \ |
Manuel Pégourié-Gonnard | a2cda6b | 2015-08-31 18:30:52 +0200 | [diff] [blame] | 1605 | -c "Maximum fragment length is 4096" \ |
| 1606 | -s "Maximum fragment length is 4096" \ |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 1607 | -c "client hello, adding max_fragment_length extension" \ |
| 1608 | -s "found max fragment length extension" \ |
| 1609 | -s "server hello, max_fragment_length extension" \ |
| 1610 | -c "found max_fragment_length extension" |
| 1611 | |
Hanno Becker | 4aed27e | 2017-09-18 15:00:34 +0100 | [diff] [blame] | 1612 | requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1613 | run_test "Max fragment length: used by server" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1614 | "$P_SRV debug_level=3 max_frag_len=4096" \ |
| 1615 | "$P_CLI debug_level=3" \ |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 1616 | 0 \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 1617 | -c "Maximum fragment length is $MAX_CONTENT_LEN" \ |
Manuel Pégourié-Gonnard | a2cda6b | 2015-08-31 18:30:52 +0200 | [diff] [blame] | 1618 | -s "Maximum fragment length is 4096" \ |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 1619 | -C "client hello, adding max_fragment_length extension" \ |
| 1620 | -S "found max fragment length extension" \ |
| 1621 | -S "server hello, max_fragment_length extension" \ |
| 1622 | -C "found max_fragment_length extension" |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 1623 | |
Hanno Becker | 4aed27e | 2017-09-18 15:00:34 +0100 | [diff] [blame] | 1624 | requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1625 | requires_gnutls |
| 1626 | run_test "Max fragment length: gnutls server" \ |
Manuel Pégourié-Gonnard | baa7f07 | 2014-08-20 20:15:53 +0200 | [diff] [blame] | 1627 | "$G_SRV" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1628 | "$P_CLI debug_level=3 max_frag_len=4096" \ |
Manuel Pégourié-Gonnard | baa7f07 | 2014-08-20 20:15:53 +0200 | [diff] [blame] | 1629 | 0 \ |
Manuel Pégourié-Gonnard | a2cda6b | 2015-08-31 18:30:52 +0200 | [diff] [blame] | 1630 | -c "Maximum fragment length is 4096" \ |
Manuel Pégourié-Gonnard | baa7f07 | 2014-08-20 20:15:53 +0200 | [diff] [blame] | 1631 | -c "client hello, adding max_fragment_length extension" \ |
| 1632 | -c "found max_fragment_length extension" |
| 1633 | |
Hanno Becker | 4aed27e | 2017-09-18 15:00:34 +0100 | [diff] [blame] | 1634 | requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
Manuel Pégourié-Gonnard | 37e08e1 | 2014-10-13 17:55:52 +0200 | [diff] [blame] | 1635 | run_test "Max fragment length: client, message just fits" \ |
| 1636 | "$P_SRV debug_level=3" \ |
| 1637 | "$P_CLI debug_level=3 max_frag_len=2048 request_size=2048" \ |
| 1638 | 0 \ |
Manuel Pégourié-Gonnard | a2cda6b | 2015-08-31 18:30:52 +0200 | [diff] [blame] | 1639 | -c "Maximum fragment length is 2048" \ |
| 1640 | -s "Maximum fragment length is 2048" \ |
Manuel Pégourié-Gonnard | 37e08e1 | 2014-10-13 17:55:52 +0200 | [diff] [blame] | 1641 | -c "client hello, adding max_fragment_length extension" \ |
| 1642 | -s "found max fragment length extension" \ |
| 1643 | -s "server hello, max_fragment_length extension" \ |
| 1644 | -c "found max_fragment_length extension" \ |
| 1645 | -c "2048 bytes written in 1 fragments" \ |
| 1646 | -s "2048 bytes read" |
| 1647 | |
Hanno Becker | 4aed27e | 2017-09-18 15:00:34 +0100 | [diff] [blame] | 1648 | requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
Manuel Pégourié-Gonnard | 37e08e1 | 2014-10-13 17:55:52 +0200 | [diff] [blame] | 1649 | run_test "Max fragment length: client, larger message" \ |
| 1650 | "$P_SRV debug_level=3" \ |
| 1651 | "$P_CLI debug_level=3 max_frag_len=2048 request_size=2345" \ |
| 1652 | 0 \ |
Manuel Pégourié-Gonnard | a2cda6b | 2015-08-31 18:30:52 +0200 | [diff] [blame] | 1653 | -c "Maximum fragment length is 2048" \ |
| 1654 | -s "Maximum fragment length is 2048" \ |
Manuel Pégourié-Gonnard | 37e08e1 | 2014-10-13 17:55:52 +0200 | [diff] [blame] | 1655 | -c "client hello, adding max_fragment_length extension" \ |
| 1656 | -s "found max fragment length extension" \ |
| 1657 | -s "server hello, max_fragment_length extension" \ |
| 1658 | -c "found max_fragment_length extension" \ |
| 1659 | -c "2345 bytes written in 2 fragments" \ |
| 1660 | -s "2048 bytes read" \ |
| 1661 | -s "297 bytes read" |
| 1662 | |
Hanno Becker | 4aed27e | 2017-09-18 15:00:34 +0100 | [diff] [blame] | 1663 | requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
Manuel Pégourié-Gonnard | 23eb74d | 2015-01-21 14:37:13 +0000 | [diff] [blame] | 1664 | run_test "Max fragment length: DTLS client, larger message" \ |
Manuel Pégourié-Gonnard | 37e08e1 | 2014-10-13 17:55:52 +0200 | [diff] [blame] | 1665 | "$P_SRV debug_level=3 dtls=1" \ |
| 1666 | "$P_CLI debug_level=3 dtls=1 max_frag_len=2048 request_size=2345" \ |
| 1667 | 1 \ |
Manuel Pégourié-Gonnard | a2cda6b | 2015-08-31 18:30:52 +0200 | [diff] [blame] | 1668 | -c "Maximum fragment length is 2048" \ |
| 1669 | -s "Maximum fragment length is 2048" \ |
Manuel Pégourié-Gonnard | 37e08e1 | 2014-10-13 17:55:52 +0200 | [diff] [blame] | 1670 | -c "client hello, adding max_fragment_length extension" \ |
| 1671 | -s "found max fragment length extension" \ |
| 1672 | -s "server hello, max_fragment_length extension" \ |
| 1673 | -c "found max_fragment_length extension" \ |
| 1674 | -c "fragment larger than.*maximum" |
| 1675 | |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 1676 | # Tests for renegotiation |
| 1677 | |
Hanno Becker | 6a24364 | 2017-10-12 15:18:45 +0100 | [diff] [blame] | 1678 | # Renegotiation SCSV always added, regardless of SSL_RENEGOTIATION |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1679 | run_test "Renegotiation: none, for reference" \ |
Manuel Pégourié-Gonnard | fa44f20 | 2015-03-27 17:52:25 +0100 | [diff] [blame] | 1680 | "$P_SRV debug_level=3 exchanges=2 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1681 | "$P_CLI debug_level=3 exchanges=2" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 1682 | 0 \ |
| 1683 | -C "client hello, adding renegotiation extension" \ |
| 1684 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1685 | -S "found renegotiation extension" \ |
| 1686 | -s "server hello, secure renegotiation extension" \ |
| 1687 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 1688 | -C "=> renegotiate" \ |
| 1689 | -S "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 1690 | -S "write hello request" |
| 1691 | |
Hanno Becker | 6a24364 | 2017-10-12 15:18:45 +0100 | [diff] [blame] | 1692 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1693 | run_test "Renegotiation: client-initiated" \ |
Manuel Pégourié-Gonnard | fa44f20 | 2015-03-27 17:52:25 +0100 | [diff] [blame] | 1694 | "$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] | 1695 | "$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] | 1696 | 0 \ |
| 1697 | -c "client hello, adding renegotiation extension" \ |
| 1698 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1699 | -s "found renegotiation extension" \ |
| 1700 | -s "server hello, secure renegotiation extension" \ |
| 1701 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 1702 | -c "=> renegotiate" \ |
| 1703 | -s "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 1704 | -S "write hello request" |
| 1705 | |
Hanno Becker | 6a24364 | 2017-10-12 15:18:45 +0100 | [diff] [blame] | 1706 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1707 | run_test "Renegotiation: server-initiated" \ |
Manuel Pégourié-Gonnard | fa44f20 | 2015-03-27 17:52:25 +0100 | [diff] [blame] | 1708 | "$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] | 1709 | "$P_CLI debug_level=3 exchanges=2 renegotiation=1" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 1710 | 0 \ |
| 1711 | -c "client hello, adding renegotiation extension" \ |
| 1712 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1713 | -s "found renegotiation extension" \ |
| 1714 | -s "server hello, secure renegotiation extension" \ |
| 1715 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 1716 | -c "=> renegotiate" \ |
| 1717 | -s "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 1718 | -s "write hello request" |
| 1719 | |
Janos Follath | b0f148c | 2017-10-05 12:29:42 +0100 | [diff] [blame] | 1720 | # Checks that no Signature Algorithm with SHA-1 gets negotiated. Negotiating SHA-1 would mean that |
| 1721 | # the server did not parse the Signature Algorithm extension. This test is valid only if an MD |
| 1722 | # algorithm stronger than SHA-1 is enabled in config.h |
Hanno Becker | 6a24364 | 2017-10-12 15:18:45 +0100 | [diff] [blame] | 1723 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
Janos Follath | b0f148c | 2017-10-05 12:29:42 +0100 | [diff] [blame] | 1724 | run_test "Renegotiation: Signature Algorithms parsing, client-initiated" \ |
| 1725 | "$P_SRV debug_level=3 exchanges=2 renegotiation=1 auth_mode=optional" \ |
| 1726 | "$P_CLI debug_level=3 exchanges=2 renegotiation=1 renegotiate=1" \ |
| 1727 | 0 \ |
| 1728 | -c "client hello, adding renegotiation extension" \ |
| 1729 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1730 | -s "found renegotiation extension" \ |
| 1731 | -s "server hello, secure renegotiation extension" \ |
| 1732 | -c "found renegotiation extension" \ |
| 1733 | -c "=> renegotiate" \ |
| 1734 | -s "=> renegotiate" \ |
| 1735 | -S "write hello request" \ |
| 1736 | -S "client hello v3, signature_algorithm ext: 2" # Is SHA-1 negotiated? |
| 1737 | |
| 1738 | # Checks that no Signature Algorithm with SHA-1 gets negotiated. Negotiating SHA-1 would mean that |
| 1739 | # the server did not parse the Signature Algorithm extension. This test is valid only if an MD |
| 1740 | # algorithm stronger than SHA-1 is enabled in config.h |
Hanno Becker | 6a24364 | 2017-10-12 15:18:45 +0100 | [diff] [blame] | 1741 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
Janos Follath | b0f148c | 2017-10-05 12:29:42 +0100 | [diff] [blame] | 1742 | run_test "Renegotiation: Signature Algorithms parsing, server-initiated" \ |
| 1743 | "$P_SRV debug_level=3 exchanges=2 renegotiation=1 auth_mode=optional renegotiate=1" \ |
| 1744 | "$P_CLI debug_level=3 exchanges=2 renegotiation=1" \ |
| 1745 | 0 \ |
| 1746 | -c "client hello, adding renegotiation extension" \ |
| 1747 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1748 | -s "found renegotiation extension" \ |
| 1749 | -s "server hello, secure renegotiation extension" \ |
| 1750 | -c "found renegotiation extension" \ |
| 1751 | -c "=> renegotiate" \ |
| 1752 | -s "=> renegotiate" \ |
| 1753 | -s "write hello request" \ |
| 1754 | -S "client hello v3, signature_algorithm ext: 2" # Is SHA-1 negotiated? |
| 1755 | |
Hanno Becker | 6a24364 | 2017-10-12 15:18:45 +0100 | [diff] [blame] | 1756 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1757 | run_test "Renegotiation: double" \ |
Manuel Pégourié-Gonnard | fa44f20 | 2015-03-27 17:52:25 +0100 | [diff] [blame] | 1758 | "$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] | 1759 | "$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] | 1760 | 0 \ |
| 1761 | -c "client hello, adding renegotiation extension" \ |
| 1762 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1763 | -s "found renegotiation extension" \ |
| 1764 | -s "server hello, secure renegotiation extension" \ |
| 1765 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 1766 | -c "=> renegotiate" \ |
| 1767 | -s "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 1768 | -s "write hello request" |
| 1769 | |
Hanno Becker | 6a24364 | 2017-10-12 15:18:45 +0100 | [diff] [blame] | 1770 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1771 | run_test "Renegotiation: client-initiated, server-rejected" \ |
Manuel Pégourié-Gonnard | fa44f20 | 2015-03-27 17:52:25 +0100 | [diff] [blame] | 1772 | "$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] | 1773 | "$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] | 1774 | 1 \ |
| 1775 | -c "client hello, adding renegotiation extension" \ |
| 1776 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1777 | -S "found renegotiation extension" \ |
| 1778 | -s "server hello, secure renegotiation extension" \ |
| 1779 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 1780 | -c "=> renegotiate" \ |
| 1781 | -S "=> renegotiate" \ |
Manuel Pégourié-Gonnard | fae355e | 2014-07-04 14:32:27 +0200 | [diff] [blame] | 1782 | -S "write hello request" \ |
Manuel Pégourié-Gonnard | 6591962 | 2014-08-19 12:50:30 +0200 | [diff] [blame] | 1783 | -c "SSL - Unexpected message at ServerHello in renegotiation" \ |
Manuel Pégourié-Gonnard | fae355e | 2014-07-04 14:32:27 +0200 | [diff] [blame] | 1784 | -c "failed" |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 1785 | |
Hanno Becker | 6a24364 | 2017-10-12 15:18:45 +0100 | [diff] [blame] | 1786 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1787 | run_test "Renegotiation: server-initiated, client-rejected, default" \ |
Manuel Pégourié-Gonnard | fa44f20 | 2015-03-27 17:52:25 +0100 | [diff] [blame] | 1788 | "$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] | 1789 | "$P_CLI debug_level=3 exchanges=2 renegotiation=0" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 1790 | 0 \ |
| 1791 | -C "client hello, adding renegotiation extension" \ |
| 1792 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1793 | -S "found renegotiation extension" \ |
| 1794 | -s "server hello, secure renegotiation extension" \ |
| 1795 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 1796 | -C "=> renegotiate" \ |
| 1797 | -S "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 1798 | -s "write hello request" \ |
Manuel Pégourié-Gonnard | a9964db | 2014-07-03 19:29:16 +0200 | [diff] [blame] | 1799 | -S "SSL - An unexpected message was received from our peer" \ |
| 1800 | -S "failed" |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 1801 | |
Hanno Becker | 6a24364 | 2017-10-12 15:18:45 +0100 | [diff] [blame] | 1802 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1803 | run_test "Renegotiation: server-initiated, client-rejected, not enforced" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1804 | "$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] | 1805 | renego_delay=-1 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1806 | "$P_CLI debug_level=3 exchanges=2 renegotiation=0" \ |
Manuel Pégourié-Gonnard | fae355e | 2014-07-04 14:32:27 +0200 | [diff] [blame] | 1807 | 0 \ |
| 1808 | -C "client hello, adding renegotiation extension" \ |
| 1809 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1810 | -S "found renegotiation extension" \ |
| 1811 | -s "server hello, secure renegotiation extension" \ |
| 1812 | -c "found renegotiation extension" \ |
| 1813 | -C "=> renegotiate" \ |
| 1814 | -S "=> renegotiate" \ |
| 1815 | -s "write hello request" \ |
| 1816 | -S "SSL - An unexpected message was received from our peer" \ |
| 1817 | -S "failed" |
| 1818 | |
Manuel Pégourié-Gonnard | a8c0a0d | 2014-08-15 12:07:38 +0200 | [diff] [blame] | 1819 | # delay 2 for 1 alert record + 1 application data record |
Hanno Becker | 6a24364 | 2017-10-12 15:18:45 +0100 | [diff] [blame] | 1820 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1821 | run_test "Renegotiation: server-initiated, client-rejected, delay 2" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1822 | "$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] | 1823 | renego_delay=2 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1824 | "$P_CLI debug_level=3 exchanges=2 renegotiation=0" \ |
Manuel Pégourié-Gonnard | fae355e | 2014-07-04 14:32:27 +0200 | [diff] [blame] | 1825 | 0 \ |
| 1826 | -C "client hello, adding renegotiation extension" \ |
| 1827 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1828 | -S "found renegotiation extension" \ |
| 1829 | -s "server hello, secure renegotiation extension" \ |
| 1830 | -c "found renegotiation extension" \ |
| 1831 | -C "=> renegotiate" \ |
| 1832 | -S "=> renegotiate" \ |
| 1833 | -s "write hello request" \ |
| 1834 | -S "SSL - An unexpected message was received from our peer" \ |
| 1835 | -S "failed" |
| 1836 | |
Hanno Becker | 6a24364 | 2017-10-12 15:18:45 +0100 | [diff] [blame] | 1837 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1838 | run_test "Renegotiation: server-initiated, client-rejected, delay 0" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1839 | "$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] | 1840 | renego_delay=0 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1841 | "$P_CLI debug_level=3 exchanges=2 renegotiation=0" \ |
Manuel Pégourié-Gonnard | fae355e | 2014-07-04 14:32:27 +0200 | [diff] [blame] | 1842 | 0 \ |
| 1843 | -C "client hello, adding renegotiation extension" \ |
| 1844 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1845 | -S "found renegotiation extension" \ |
| 1846 | -s "server hello, secure renegotiation extension" \ |
| 1847 | -c "found renegotiation extension" \ |
| 1848 | -C "=> renegotiate" \ |
| 1849 | -S "=> renegotiate" \ |
| 1850 | -s "write hello request" \ |
Manuel Pégourié-Gonnard | a8c0a0d | 2014-08-15 12:07:38 +0200 | [diff] [blame] | 1851 | -s "SSL - An unexpected message was received from our peer" |
Manuel Pégourié-Gonnard | fae355e | 2014-07-04 14:32:27 +0200 | [diff] [blame] | 1852 | |
Hanno Becker | 6a24364 | 2017-10-12 15:18:45 +0100 | [diff] [blame] | 1853 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1854 | run_test "Renegotiation: server-initiated, client-accepted, delay 0" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1855 | "$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] | 1856 | renego_delay=0 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1857 | "$P_CLI debug_level=3 exchanges=2 renegotiation=1" \ |
Manuel Pégourié-Gonnard | fae355e | 2014-07-04 14:32:27 +0200 | [diff] [blame] | 1858 | 0 \ |
| 1859 | -c "client hello, adding renegotiation extension" \ |
| 1860 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1861 | -s "found renegotiation extension" \ |
| 1862 | -s "server hello, secure renegotiation extension" \ |
| 1863 | -c "found renegotiation extension" \ |
| 1864 | -c "=> renegotiate" \ |
| 1865 | -s "=> renegotiate" \ |
| 1866 | -s "write hello request" \ |
| 1867 | -S "SSL - An unexpected message was received from our peer" \ |
| 1868 | -S "failed" |
| 1869 | |
Hanno Becker | 6a24364 | 2017-10-12 15:18:45 +0100 | [diff] [blame] | 1870 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
Manuel Pégourié-Gonnard | 590f416 | 2014-11-05 14:23:03 +0100 | [diff] [blame] | 1871 | run_test "Renegotiation: periodic, just below period" \ |
Manuel Pégourié-Gonnard | fa44f20 | 2015-03-27 17:52:25 +0100 | [diff] [blame] | 1872 | "$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] | 1873 | "$P_CLI debug_level=3 exchanges=2 renegotiation=1" \ |
| 1874 | 0 \ |
| 1875 | -C "client hello, adding renegotiation extension" \ |
| 1876 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1877 | -S "found renegotiation extension" \ |
| 1878 | -s "server hello, secure renegotiation extension" \ |
| 1879 | -c "found renegotiation extension" \ |
| 1880 | -S "record counter limit reached: renegotiate" \ |
| 1881 | -C "=> renegotiate" \ |
| 1882 | -S "=> renegotiate" \ |
| 1883 | -S "write hello request" \ |
| 1884 | -S "SSL - An unexpected message was received from our peer" \ |
| 1885 | -S "failed" |
| 1886 | |
Manuel Pégourié-Gonnard | 9835bc0 | 2015-01-14 14:41:58 +0100 | [diff] [blame] | 1887 | # one extra exchange to be able to complete renego |
Hanno Becker | 6a24364 | 2017-10-12 15:18:45 +0100 | [diff] [blame] | 1888 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
Manuel Pégourié-Gonnard | 590f416 | 2014-11-05 14:23:03 +0100 | [diff] [blame] | 1889 | run_test "Renegotiation: periodic, just above period" \ |
Manuel Pégourié-Gonnard | fa44f20 | 2015-03-27 17:52:25 +0100 | [diff] [blame] | 1890 | "$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] | 1891 | "$P_CLI debug_level=3 exchanges=4 renegotiation=1" \ |
Manuel Pégourié-Gonnard | 590f416 | 2014-11-05 14:23:03 +0100 | [diff] [blame] | 1892 | 0 \ |
| 1893 | -c "client hello, adding renegotiation extension" \ |
| 1894 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1895 | -s "found renegotiation extension" \ |
| 1896 | -s "server hello, secure renegotiation extension" \ |
| 1897 | -c "found renegotiation extension" \ |
| 1898 | -s "record counter limit reached: renegotiate" \ |
| 1899 | -c "=> renegotiate" \ |
| 1900 | -s "=> renegotiate" \ |
| 1901 | -s "write hello request" \ |
| 1902 | -S "SSL - An unexpected message was received from our peer" \ |
| 1903 | -S "failed" |
| 1904 | |
Hanno Becker | 6a24364 | 2017-10-12 15:18:45 +0100 | [diff] [blame] | 1905 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
Manuel Pégourié-Gonnard | 590f416 | 2014-11-05 14:23:03 +0100 | [diff] [blame] | 1906 | run_test "Renegotiation: periodic, two times period" \ |
Manuel Pégourié-Gonnard | fa44f20 | 2015-03-27 17:52:25 +0100 | [diff] [blame] | 1907 | "$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] | 1908 | "$P_CLI debug_level=3 exchanges=7 renegotiation=1" \ |
Manuel Pégourié-Gonnard | 590f416 | 2014-11-05 14:23:03 +0100 | [diff] [blame] | 1909 | 0 \ |
| 1910 | -c "client hello, adding renegotiation extension" \ |
| 1911 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1912 | -s "found renegotiation extension" \ |
| 1913 | -s "server hello, secure renegotiation extension" \ |
| 1914 | -c "found renegotiation extension" \ |
| 1915 | -s "record counter limit reached: renegotiate" \ |
| 1916 | -c "=> renegotiate" \ |
| 1917 | -s "=> renegotiate" \ |
| 1918 | -s "write hello request" \ |
| 1919 | -S "SSL - An unexpected message was received from our peer" \ |
| 1920 | -S "failed" |
| 1921 | |
Hanno Becker | 6a24364 | 2017-10-12 15:18:45 +0100 | [diff] [blame] | 1922 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
Manuel Pégourié-Gonnard | 590f416 | 2014-11-05 14:23:03 +0100 | [diff] [blame] | 1923 | run_test "Renegotiation: periodic, above period, disabled" \ |
Manuel Pégourié-Gonnard | fa44f20 | 2015-03-27 17:52:25 +0100 | [diff] [blame] | 1924 | "$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] | 1925 | "$P_CLI debug_level=3 exchanges=4 renegotiation=1" \ |
| 1926 | 0 \ |
| 1927 | -C "client hello, adding renegotiation extension" \ |
| 1928 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1929 | -S "found renegotiation extension" \ |
| 1930 | -s "server hello, secure renegotiation extension" \ |
| 1931 | -c "found renegotiation extension" \ |
| 1932 | -S "record counter limit reached: renegotiate" \ |
| 1933 | -C "=> renegotiate" \ |
| 1934 | -S "=> renegotiate" \ |
| 1935 | -S "write hello request" \ |
| 1936 | -S "SSL - An unexpected message was received from our peer" \ |
| 1937 | -S "failed" |
| 1938 | |
Hanno Becker | 6a24364 | 2017-10-12 15:18:45 +0100 | [diff] [blame] | 1939 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1940 | run_test "Renegotiation: nbio, client-initiated" \ |
Manuel Pégourié-Gonnard | fa44f20 | 2015-03-27 17:52:25 +0100 | [diff] [blame] | 1941 | "$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] | 1942 | "$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] | 1943 | 0 \ |
| 1944 | -c "client hello, adding renegotiation extension" \ |
| 1945 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1946 | -s "found renegotiation extension" \ |
| 1947 | -s "server hello, secure renegotiation extension" \ |
| 1948 | -c "found renegotiation extension" \ |
| 1949 | -c "=> renegotiate" \ |
| 1950 | -s "=> renegotiate" \ |
| 1951 | -S "write hello request" |
| 1952 | |
Hanno Becker | 6a24364 | 2017-10-12 15:18:45 +0100 | [diff] [blame] | 1953 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1954 | run_test "Renegotiation: nbio, server-initiated" \ |
Manuel Pégourié-Gonnard | fa44f20 | 2015-03-27 17:52:25 +0100 | [diff] [blame] | 1955 | "$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] | 1956 | "$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] | 1957 | 0 \ |
| 1958 | -c "client hello, adding renegotiation extension" \ |
| 1959 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 1960 | -s "found renegotiation extension" \ |
| 1961 | -s "server hello, secure renegotiation extension" \ |
| 1962 | -c "found renegotiation extension" \ |
| 1963 | -c "=> renegotiate" \ |
| 1964 | -s "=> renegotiate" \ |
| 1965 | -s "write hello request" |
| 1966 | |
Hanno Becker | 6a24364 | 2017-10-12 15:18:45 +0100 | [diff] [blame] | 1967 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1968 | run_test "Renegotiation: openssl server, client-initiated" \ |
Manuel Pégourié-Gonnard | a775617 | 2014-08-31 18:37:01 +0200 | [diff] [blame] | 1969 | "$O_SRV -www" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1970 | "$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] | 1971 | 0 \ |
| 1972 | -c "client hello, adding renegotiation extension" \ |
| 1973 | -c "found renegotiation extension" \ |
| 1974 | -c "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 85d915b | 2014-11-03 20:10:36 +0100 | [diff] [blame] | 1975 | -C "ssl_hanshake() returned" \ |
Manuel Pégourié-Gonnard | 5136296 | 2014-08-30 21:22:47 +0200 | [diff] [blame] | 1976 | -C "error" \ |
| 1977 | -c "HTTP/1.0 200 [Oo][Kk]" |
| 1978 | |
Paul Bakker | 539d972 | 2015-02-08 16:18:35 +0100 | [diff] [blame] | 1979 | requires_gnutls |
Hanno Becker | 6a24364 | 2017-10-12 15:18:45 +0100 | [diff] [blame] | 1980 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
Manuel Pégourié-Gonnard | 85d915b | 2014-11-03 20:10:36 +0100 | [diff] [blame] | 1981 | run_test "Renegotiation: gnutls server strict, client-initiated" \ |
| 1982 | "$G_SRV --priority=NORMAL:%SAFE_RENEGOTIATION" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1983 | "$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] | 1984 | 0 \ |
| 1985 | -c "client hello, adding renegotiation extension" \ |
| 1986 | -c "found renegotiation extension" \ |
| 1987 | -c "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 85d915b | 2014-11-03 20:10:36 +0100 | [diff] [blame] | 1988 | -C "ssl_hanshake() returned" \ |
Manuel Pégourié-Gonnard | 5136296 | 2014-08-30 21:22:47 +0200 | [diff] [blame] | 1989 | -C "error" \ |
| 1990 | -c "HTTP/1.0 200 [Oo][Kk]" |
| 1991 | |
Paul Bakker | 539d972 | 2015-02-08 16:18:35 +0100 | [diff] [blame] | 1992 | requires_gnutls |
Hanno Becker | 6a24364 | 2017-10-12 15:18:45 +0100 | [diff] [blame] | 1993 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
Manuel Pégourié-Gonnard | 85d915b | 2014-11-03 20:10:36 +0100 | [diff] [blame] | 1994 | run_test "Renegotiation: gnutls server unsafe, client-initiated default" \ |
| 1995 | "$G_SRV --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION" \ |
| 1996 | "$P_CLI debug_level=3 exchanges=1 renegotiation=1 renegotiate=1" \ |
| 1997 | 1 \ |
| 1998 | -c "client hello, adding renegotiation extension" \ |
| 1999 | -C "found renegotiation extension" \ |
| 2000 | -c "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2001 | -c "mbedtls_ssl_handshake() returned" \ |
Manuel Pégourié-Gonnard | 85d915b | 2014-11-03 20:10:36 +0100 | [diff] [blame] | 2002 | -c "error" \ |
| 2003 | -C "HTTP/1.0 200 [Oo][Kk]" |
| 2004 | |
Paul Bakker | 539d972 | 2015-02-08 16:18:35 +0100 | [diff] [blame] | 2005 | requires_gnutls |
Hanno Becker | 6a24364 | 2017-10-12 15:18:45 +0100 | [diff] [blame] | 2006 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
Manuel Pégourié-Gonnard | 85d915b | 2014-11-03 20:10:36 +0100 | [diff] [blame] | 2007 | run_test "Renegotiation: gnutls server unsafe, client-inititated no legacy" \ |
| 2008 | "$G_SRV --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION" \ |
| 2009 | "$P_CLI debug_level=3 exchanges=1 renegotiation=1 renegotiate=1 \ |
| 2010 | allow_legacy=0" \ |
| 2011 | 1 \ |
| 2012 | -c "client hello, adding renegotiation extension" \ |
| 2013 | -C "found renegotiation extension" \ |
| 2014 | -c "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2015 | -c "mbedtls_ssl_handshake() returned" \ |
Manuel Pégourié-Gonnard | 85d915b | 2014-11-03 20:10:36 +0100 | [diff] [blame] | 2016 | -c "error" \ |
| 2017 | -C "HTTP/1.0 200 [Oo][Kk]" |
| 2018 | |
Paul Bakker | 539d972 | 2015-02-08 16:18:35 +0100 | [diff] [blame] | 2019 | requires_gnutls |
Hanno Becker | 6a24364 | 2017-10-12 15:18:45 +0100 | [diff] [blame] | 2020 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
Manuel Pégourié-Gonnard | 85d915b | 2014-11-03 20:10:36 +0100 | [diff] [blame] | 2021 | run_test "Renegotiation: gnutls server unsafe, client-inititated legacy" \ |
| 2022 | "$G_SRV --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION" \ |
| 2023 | "$P_CLI debug_level=3 exchanges=1 renegotiation=1 renegotiate=1 \ |
| 2024 | allow_legacy=1" \ |
| 2025 | 0 \ |
| 2026 | -c "client hello, adding renegotiation extension" \ |
| 2027 | -C "found renegotiation extension" \ |
| 2028 | -c "=> renegotiate" \ |
| 2029 | -C "ssl_hanshake() returned" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 2030 | -C "error" \ |
| 2031 | -c "HTTP/1.0 200 [Oo][Kk]" |
| 2032 | |
Hanno Becker | 6a24364 | 2017-10-12 15:18:45 +0100 | [diff] [blame] | 2033 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
Manuel Pégourié-Gonnard | 30d16eb | 2014-08-19 17:43:50 +0200 | [diff] [blame] | 2034 | run_test "Renegotiation: DTLS, client-initiated" \ |
| 2035 | "$P_SRV debug_level=3 dtls=1 exchanges=2 renegotiation=1" \ |
| 2036 | "$P_CLI debug_level=3 dtls=1 exchanges=2 renegotiation=1 renegotiate=1" \ |
| 2037 | 0 \ |
| 2038 | -c "client hello, adding renegotiation extension" \ |
| 2039 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 2040 | -s "found renegotiation extension" \ |
| 2041 | -s "server hello, secure renegotiation extension" \ |
| 2042 | -c "found renegotiation extension" \ |
| 2043 | -c "=> renegotiate" \ |
| 2044 | -s "=> renegotiate" \ |
| 2045 | -S "write hello request" |
| 2046 | |
Hanno Becker | 6a24364 | 2017-10-12 15:18:45 +0100 | [diff] [blame] | 2047 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
Manuel Pégourié-Gonnard | c392b24 | 2014-08-19 17:53:11 +0200 | [diff] [blame] | 2048 | run_test "Renegotiation: DTLS, server-initiated" \ |
| 2049 | "$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] | 2050 | "$P_CLI debug_level=3 dtls=1 exchanges=2 renegotiation=1 \ |
| 2051 | read_timeout=1000 max_resend=2" \ |
Manuel Pégourié-Gonnard | c392b24 | 2014-08-19 17:53:11 +0200 | [diff] [blame] | 2052 | 0 \ |
| 2053 | -c "client hello, adding renegotiation extension" \ |
| 2054 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 2055 | -s "found renegotiation extension" \ |
| 2056 | -s "server hello, secure renegotiation extension" \ |
| 2057 | -c "found renegotiation extension" \ |
| 2058 | -c "=> renegotiate" \ |
| 2059 | -s "=> renegotiate" \ |
| 2060 | -s "write hello request" |
| 2061 | |
Hanno Becker | 6a24364 | 2017-10-12 15:18:45 +0100 | [diff] [blame] | 2062 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
Andres AG | 692ad84 | 2017-01-19 16:30:57 +0000 | [diff] [blame] | 2063 | run_test "Renegotiation: DTLS, renego_period overflow" \ |
| 2064 | "$P_SRV debug_level=3 dtls=1 exchanges=4 renegotiation=1 renego_period=18446462598732840962 auth_mode=optional" \ |
| 2065 | "$P_CLI debug_level=3 dtls=1 exchanges=4 renegotiation=1" \ |
| 2066 | 0 \ |
| 2067 | -c "client hello, adding renegotiation extension" \ |
| 2068 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 2069 | -s "found renegotiation extension" \ |
| 2070 | -s "server hello, secure renegotiation extension" \ |
| 2071 | -s "record counter limit reached: renegotiate" \ |
| 2072 | -c "=> renegotiate" \ |
| 2073 | -s "=> renegotiate" \ |
Hanno Becker | 6a24364 | 2017-10-12 15:18:45 +0100 | [diff] [blame] | 2074 | -s "write hello request" |
Andres AG | 692ad84 | 2017-01-19 16:30:57 +0000 | [diff] [blame] | 2075 | |
Manuel Pégourié-Gonnard | 9699996 | 2015-02-17 16:02:37 +0000 | [diff] [blame] | 2076 | requires_gnutls |
Hanno Becker | 6a24364 | 2017-10-12 15:18:45 +0100 | [diff] [blame] | 2077 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
Manuel Pégourié-Gonnard | f1499f6 | 2014-08-31 17:13:13 +0200 | [diff] [blame] | 2078 | run_test "Renegotiation: DTLS, gnutls server, client-initiated" \ |
| 2079 | "$G_SRV -u --mtu 4096" \ |
| 2080 | "$P_CLI debug_level=3 dtls=1 exchanges=1 renegotiation=1 renegotiate=1" \ |
| 2081 | 0 \ |
| 2082 | -c "client hello, adding renegotiation extension" \ |
| 2083 | -c "found renegotiation extension" \ |
| 2084 | -c "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2085 | -C "mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | f1499f6 | 2014-08-31 17:13:13 +0200 | [diff] [blame] | 2086 | -C "error" \ |
| 2087 | -s "Extra-header:" |
| 2088 | |
Manuel Pégourié-Gonnard | 85d915b | 2014-11-03 20:10:36 +0100 | [diff] [blame] | 2089 | # Test for the "secure renegotation" extension only (no actual renegotiation) |
| 2090 | |
Paul Bakker | 539d972 | 2015-02-08 16:18:35 +0100 | [diff] [blame] | 2091 | requires_gnutls |
Manuel Pégourié-Gonnard | 85d915b | 2014-11-03 20:10:36 +0100 | [diff] [blame] | 2092 | run_test "Renego ext: gnutls server strict, client default" \ |
| 2093 | "$G_SRV --priority=NORMAL:%SAFE_RENEGOTIATION" \ |
| 2094 | "$P_CLI debug_level=3" \ |
| 2095 | 0 \ |
| 2096 | -c "found renegotiation extension" \ |
| 2097 | -C "error" \ |
| 2098 | -c "HTTP/1.0 200 [Oo][Kk]" |
| 2099 | |
Paul Bakker | 539d972 | 2015-02-08 16:18:35 +0100 | [diff] [blame] | 2100 | requires_gnutls |
Manuel Pégourié-Gonnard | 85d915b | 2014-11-03 20:10:36 +0100 | [diff] [blame] | 2101 | run_test "Renego ext: gnutls server unsafe, client default" \ |
| 2102 | "$G_SRV --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION" \ |
| 2103 | "$P_CLI debug_level=3" \ |
| 2104 | 0 \ |
| 2105 | -C "found renegotiation extension" \ |
| 2106 | -C "error" \ |
| 2107 | -c "HTTP/1.0 200 [Oo][Kk]" |
| 2108 | |
Paul Bakker | 539d972 | 2015-02-08 16:18:35 +0100 | [diff] [blame] | 2109 | requires_gnutls |
Manuel Pégourié-Gonnard | 85d915b | 2014-11-03 20:10:36 +0100 | [diff] [blame] | 2110 | run_test "Renego ext: gnutls server unsafe, client break legacy" \ |
| 2111 | "$G_SRV --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION" \ |
| 2112 | "$P_CLI debug_level=3 allow_legacy=-1" \ |
| 2113 | 1 \ |
| 2114 | -C "found renegotiation extension" \ |
| 2115 | -c "error" \ |
| 2116 | -C "HTTP/1.0 200 [Oo][Kk]" |
| 2117 | |
Paul Bakker | 539d972 | 2015-02-08 16:18:35 +0100 | [diff] [blame] | 2118 | requires_gnutls |
Manuel Pégourié-Gonnard | 85d915b | 2014-11-03 20:10:36 +0100 | [diff] [blame] | 2119 | run_test "Renego ext: gnutls client strict, server default" \ |
| 2120 | "$P_SRV debug_level=3" \ |
| 2121 | "$G_CLI --priority=NORMAL:%SAFE_RENEGOTIATION" \ |
| 2122 | 0 \ |
| 2123 | -s "received TLS_EMPTY_RENEGOTIATION_INFO\|found renegotiation extension" \ |
| 2124 | -s "server hello, secure renegotiation extension" |
| 2125 | |
Paul Bakker | 539d972 | 2015-02-08 16:18:35 +0100 | [diff] [blame] | 2126 | requires_gnutls |
Manuel Pégourié-Gonnard | 85d915b | 2014-11-03 20:10:36 +0100 | [diff] [blame] | 2127 | run_test "Renego ext: gnutls client unsafe, server default" \ |
| 2128 | "$P_SRV debug_level=3" \ |
| 2129 | "$G_CLI --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION" \ |
| 2130 | 0 \ |
| 2131 | -S "received TLS_EMPTY_RENEGOTIATION_INFO\|found renegotiation extension" \ |
| 2132 | -S "server hello, secure renegotiation extension" |
| 2133 | |
Paul Bakker | 539d972 | 2015-02-08 16:18:35 +0100 | [diff] [blame] | 2134 | requires_gnutls |
Manuel Pégourié-Gonnard | 85d915b | 2014-11-03 20:10:36 +0100 | [diff] [blame] | 2135 | run_test "Renego ext: gnutls client unsafe, server break legacy" \ |
| 2136 | "$P_SRV debug_level=3 allow_legacy=-1" \ |
| 2137 | "$G_CLI --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION" \ |
| 2138 | 1 \ |
| 2139 | -S "received TLS_EMPTY_RENEGOTIATION_INFO\|found renegotiation extension" \ |
| 2140 | -S "server hello, secure renegotiation extension" |
| 2141 | |
Janos Follath | 0b24234 | 2016-02-17 10:11:21 +0000 | [diff] [blame] | 2142 | # Tests for silently dropping trailing extra bytes in .der certificates |
| 2143 | |
| 2144 | requires_gnutls |
| 2145 | run_test "DER format: no trailing bytes" \ |
| 2146 | "$P_SRV crt_file=data_files/server5-der0.crt \ |
| 2147 | key_file=data_files/server5.key" \ |
| 2148 | "$G_CLI " \ |
| 2149 | 0 \ |
| 2150 | -c "Handshake was completed" \ |
| 2151 | |
| 2152 | requires_gnutls |
| 2153 | run_test "DER format: with a trailing zero byte" \ |
| 2154 | "$P_SRV crt_file=data_files/server5-der1a.crt \ |
| 2155 | key_file=data_files/server5.key" \ |
| 2156 | "$G_CLI " \ |
| 2157 | 0 \ |
| 2158 | -c "Handshake was completed" \ |
| 2159 | |
| 2160 | requires_gnutls |
| 2161 | run_test "DER format: with a trailing random byte" \ |
| 2162 | "$P_SRV crt_file=data_files/server5-der1b.crt \ |
| 2163 | key_file=data_files/server5.key" \ |
| 2164 | "$G_CLI " \ |
| 2165 | 0 \ |
| 2166 | -c "Handshake was completed" \ |
| 2167 | |
| 2168 | requires_gnutls |
| 2169 | run_test "DER format: with 2 trailing random bytes" \ |
| 2170 | "$P_SRV crt_file=data_files/server5-der2.crt \ |
| 2171 | key_file=data_files/server5.key" \ |
| 2172 | "$G_CLI " \ |
| 2173 | 0 \ |
| 2174 | -c "Handshake was completed" \ |
| 2175 | |
| 2176 | requires_gnutls |
| 2177 | run_test "DER format: with 4 trailing random bytes" \ |
| 2178 | "$P_SRV crt_file=data_files/server5-der4.crt \ |
| 2179 | key_file=data_files/server5.key" \ |
| 2180 | "$G_CLI " \ |
| 2181 | 0 \ |
| 2182 | -c "Handshake was completed" \ |
| 2183 | |
| 2184 | requires_gnutls |
| 2185 | run_test "DER format: with 8 trailing random bytes" \ |
| 2186 | "$P_SRV crt_file=data_files/server5-der8.crt \ |
| 2187 | key_file=data_files/server5.key" \ |
| 2188 | "$G_CLI " \ |
| 2189 | 0 \ |
| 2190 | -c "Handshake was completed" \ |
| 2191 | |
| 2192 | requires_gnutls |
| 2193 | run_test "DER format: with 9 trailing random bytes" \ |
| 2194 | "$P_SRV crt_file=data_files/server5-der9.crt \ |
| 2195 | key_file=data_files/server5.key" \ |
| 2196 | "$G_CLI " \ |
| 2197 | 0 \ |
| 2198 | -c "Handshake was completed" \ |
| 2199 | |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 2200 | # Tests for auth_mode |
| 2201 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2202 | run_test "Authentication: server badcert, client required" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 2203 | "$P_SRV crt_file=data_files/server5-badsign.crt \ |
| 2204 | key_file=data_files/server5.key" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2205 | "$P_CLI debug_level=1 auth_mode=required" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 2206 | 1 \ |
| 2207 | -c "x509_verify_cert() returned" \ |
Manuel Pégourié-Gonnard | 89addc4 | 2015-04-20 10:56:18 +0100 | [diff] [blame] | 2208 | -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] | 2209 | -c "! mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 2210 | -c "X509 - Certificate verification failed" |
| 2211 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2212 | run_test "Authentication: server badcert, client optional" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 2213 | "$P_SRV crt_file=data_files/server5-badsign.crt \ |
| 2214 | key_file=data_files/server5.key" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2215 | "$P_CLI debug_level=1 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 2216 | 0 \ |
| 2217 | -c "x509_verify_cert() returned" \ |
Manuel Pégourié-Gonnard | 89addc4 | 2015-04-20 10:56:18 +0100 | [diff] [blame] | 2218 | -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] | 2219 | -C "! mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 2220 | -C "X509 - Certificate verification failed" |
| 2221 | |
Hanno Becker | e6706e6 | 2017-05-15 16:05:15 +0100 | [diff] [blame] | 2222 | run_test "Authentication: server goodcert, client optional, no trusted CA" \ |
| 2223 | "$P_SRV" \ |
| 2224 | "$P_CLI debug_level=3 auth_mode=optional ca_file=none ca_path=none" \ |
| 2225 | 0 \ |
| 2226 | -c "x509_verify_cert() returned" \ |
| 2227 | -c "! The certificate is not correctly signed by the trusted CA" \ |
| 2228 | -c "! Certificate verification flags"\ |
| 2229 | -C "! mbedtls_ssl_handshake returned" \ |
| 2230 | -C "X509 - Certificate verification failed" \ |
| 2231 | -C "SSL - No CA Chain is set, but required to operate" |
| 2232 | |
| 2233 | run_test "Authentication: server goodcert, client required, no trusted CA" \ |
| 2234 | "$P_SRV" \ |
| 2235 | "$P_CLI debug_level=3 auth_mode=required ca_file=none ca_path=none" \ |
| 2236 | 1 \ |
| 2237 | -c "x509_verify_cert() returned" \ |
| 2238 | -c "! The certificate is not correctly signed by the trusted CA" \ |
| 2239 | -c "! Certificate verification flags"\ |
| 2240 | -c "! mbedtls_ssl_handshake returned" \ |
| 2241 | -c "SSL - No CA Chain is set, but required to operate" |
| 2242 | |
| 2243 | # The purpose of the next two tests is to test the client's behaviour when receiving a server |
| 2244 | # certificate with an unsupported elliptic curve. This should usually not happen because |
| 2245 | # the client informs the server about the supported curves - it does, though, in the |
| 2246 | # corner case of a static ECDH suite, because the server doesn't check the curve on that |
| 2247 | # occasion (to be fixed). If that bug's fixed, the test needs to be altered to use a |
| 2248 | # different means to have the server ignoring the client's supported curve list. |
| 2249 | |
| 2250 | requires_config_enabled MBEDTLS_ECP_C |
| 2251 | run_test "Authentication: server ECDH p256v1, client required, p256v1 unsupported" \ |
| 2252 | "$P_SRV debug_level=1 key_file=data_files/server5.key \ |
| 2253 | crt_file=data_files/server5.ku-ka.crt" \ |
| 2254 | "$P_CLI debug_level=3 auth_mode=required curves=secp521r1" \ |
| 2255 | 1 \ |
| 2256 | -c "bad certificate (EC key curve)"\ |
| 2257 | -c "! Certificate verification flags"\ |
| 2258 | -C "bad server certificate (ECDH curve)" # Expect failure at earlier verification stage |
| 2259 | |
| 2260 | requires_config_enabled MBEDTLS_ECP_C |
| 2261 | run_test "Authentication: server ECDH p256v1, client optional, p256v1 unsupported" \ |
| 2262 | "$P_SRV debug_level=1 key_file=data_files/server5.key \ |
| 2263 | crt_file=data_files/server5.ku-ka.crt" \ |
| 2264 | "$P_CLI debug_level=3 auth_mode=optional curves=secp521r1" \ |
| 2265 | 1 \ |
| 2266 | -c "bad certificate (EC key curve)"\ |
| 2267 | -c "! Certificate verification flags"\ |
| 2268 | -c "bad server certificate (ECDH curve)" # Expect failure only at ECDH params check |
| 2269 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2270 | run_test "Authentication: server badcert, client none" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 2271 | "$P_SRV crt_file=data_files/server5-badsign.crt \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 2272 | key_file=data_files/server5.key" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2273 | "$P_CLI debug_level=1 auth_mode=none" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 2274 | 0 \ |
| 2275 | -C "x509_verify_cert() returned" \ |
Manuel Pégourié-Gonnard | 89addc4 | 2015-04-20 10:56:18 +0100 | [diff] [blame] | 2276 | -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] | 2277 | -C "! mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 2278 | -C "X509 - Certificate verification failed" |
| 2279 | |
Simon Butcher | 9900014 | 2016-10-13 17:21:01 +0100 | [diff] [blame] | 2280 | run_test "Authentication: client SHA256, server required" \ |
| 2281 | "$P_SRV auth_mode=required" \ |
| 2282 | "$P_CLI debug_level=3 crt_file=data_files/server6.crt \ |
| 2283 | key_file=data_files/server6.key \ |
| 2284 | force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384" \ |
| 2285 | 0 \ |
| 2286 | -c "Supported Signature Algorithm found: 4," \ |
| 2287 | -c "Supported Signature Algorithm found: 5," |
| 2288 | |
| 2289 | run_test "Authentication: client SHA384, server required" \ |
| 2290 | "$P_SRV auth_mode=required" \ |
| 2291 | "$P_CLI debug_level=3 crt_file=data_files/server6.crt \ |
| 2292 | key_file=data_files/server6.key \ |
| 2293 | force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256" \ |
| 2294 | 0 \ |
| 2295 | -c "Supported Signature Algorithm found: 4," \ |
| 2296 | -c "Supported Signature Algorithm found: 5," |
| 2297 | |
Gilles Peskine | fd8332e | 2017-05-03 16:25:07 +0200 | [diff] [blame] | 2298 | requires_config_enabled MBEDTLS_SSL_PROTO_SSL3 |
| 2299 | run_test "Authentication: client has no cert, server required (SSLv3)" \ |
| 2300 | "$P_SRV debug_level=3 min_version=ssl3 auth_mode=required" \ |
| 2301 | "$P_CLI debug_level=3 force_version=ssl3 crt_file=none \ |
| 2302 | key_file=data_files/server5.key" \ |
| 2303 | 1 \ |
| 2304 | -S "skip write certificate request" \ |
| 2305 | -C "skip parse certificate request" \ |
| 2306 | -c "got a certificate request" \ |
| 2307 | -c "got no certificate to send" \ |
| 2308 | -S "x509_verify_cert() returned" \ |
| 2309 | -s "client has no certificate" \ |
| 2310 | -s "! mbedtls_ssl_handshake returned" \ |
| 2311 | -c "! mbedtls_ssl_handshake returned" \ |
| 2312 | -s "No client certification received from the client, but required by the authentication mode" |
| 2313 | |
| 2314 | run_test "Authentication: client has no cert, server required (TLS)" \ |
| 2315 | "$P_SRV debug_level=3 auth_mode=required" \ |
| 2316 | "$P_CLI debug_level=3 crt_file=none \ |
| 2317 | key_file=data_files/server5.key" \ |
| 2318 | 1 \ |
| 2319 | -S "skip write certificate request" \ |
| 2320 | -C "skip parse certificate request" \ |
| 2321 | -c "got a certificate request" \ |
| 2322 | -c "= write certificate$" \ |
| 2323 | -C "skip write certificate$" \ |
| 2324 | -S "x509_verify_cert() returned" \ |
| 2325 | -s "client has no certificate" \ |
| 2326 | -s "! mbedtls_ssl_handshake returned" \ |
| 2327 | -c "! mbedtls_ssl_handshake returned" \ |
| 2328 | -s "No client certification received from the client, but required by the authentication mode" |
| 2329 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2330 | run_test "Authentication: client badcert, server required" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2331 | "$P_SRV debug_level=3 auth_mode=required" \ |
| 2332 | "$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] | 2333 | key_file=data_files/server5.key" \ |
| 2334 | 1 \ |
| 2335 | -S "skip write certificate request" \ |
| 2336 | -C "skip parse certificate request" \ |
| 2337 | -c "got a certificate request" \ |
| 2338 | -C "skip write certificate" \ |
| 2339 | -C "skip write certificate verify" \ |
| 2340 | -S "skip parse certificate verify" \ |
| 2341 | -s "x509_verify_cert() returned" \ |
Manuel Pégourié-Gonnard | 6ea831d | 2015-06-22 16:50:52 +0200 | [diff] [blame] | 2342 | -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] | 2343 | -s "! mbedtls_ssl_handshake returned" \ |
Gilles Peskine | 1cc8e34 | 2017-05-03 16:28:34 +0200 | [diff] [blame] | 2344 | -s "send alert level=2 message=48" \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2345 | -c "! mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 2346 | -s "X509 - Certificate verification failed" |
Gilles Peskine | 1cc8e34 | 2017-05-03 16:28:34 +0200 | [diff] [blame] | 2347 | # We don't check that the client receives the alert because it might |
| 2348 | # detect that its write end of the connection is closed and abort |
| 2349 | # before reading the alert message. |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 2350 | |
Janos Follath | 89baba2 | 2017-04-10 14:34:35 +0100 | [diff] [blame] | 2351 | run_test "Authentication: client cert not trusted, server required" \ |
| 2352 | "$P_SRV debug_level=3 auth_mode=required" \ |
| 2353 | "$P_CLI debug_level=3 crt_file=data_files/server5-selfsigned.crt \ |
| 2354 | key_file=data_files/server5.key" \ |
| 2355 | 1 \ |
| 2356 | -S "skip write certificate request" \ |
| 2357 | -C "skip parse certificate request" \ |
| 2358 | -c "got a certificate request" \ |
| 2359 | -C "skip write certificate" \ |
| 2360 | -C "skip write certificate verify" \ |
| 2361 | -S "skip parse certificate verify" \ |
| 2362 | -s "x509_verify_cert() returned" \ |
| 2363 | -s "! The certificate is not correctly signed by the trusted CA" \ |
| 2364 | -s "! mbedtls_ssl_handshake returned" \ |
| 2365 | -c "! mbedtls_ssl_handshake returned" \ |
| 2366 | -s "X509 - Certificate verification failed" |
| 2367 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2368 | run_test "Authentication: client badcert, server optional" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2369 | "$P_SRV debug_level=3 auth_mode=optional" \ |
| 2370 | "$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] | 2371 | key_file=data_files/server5.key" \ |
| 2372 | 0 \ |
| 2373 | -S "skip write certificate request" \ |
| 2374 | -C "skip parse certificate request" \ |
| 2375 | -c "got a certificate request" \ |
| 2376 | -C "skip write certificate" \ |
| 2377 | -C "skip write certificate verify" \ |
| 2378 | -S "skip parse certificate verify" \ |
| 2379 | -s "x509_verify_cert() returned" \ |
Manuel Pégourié-Gonnard | 89addc4 | 2015-04-20 10:56:18 +0100 | [diff] [blame] | 2380 | -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] | 2381 | -S "! mbedtls_ssl_handshake returned" \ |
| 2382 | -C "! mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 2383 | -S "X509 - Certificate verification failed" |
| 2384 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2385 | run_test "Authentication: client badcert, server none" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2386 | "$P_SRV debug_level=3 auth_mode=none" \ |
| 2387 | "$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] | 2388 | key_file=data_files/server5.key" \ |
| 2389 | 0 \ |
| 2390 | -s "skip write certificate request" \ |
| 2391 | -C "skip parse certificate request" \ |
| 2392 | -c "got no certificate request" \ |
| 2393 | -c "skip write certificate" \ |
| 2394 | -c "skip write certificate verify" \ |
| 2395 | -s "skip parse certificate verify" \ |
| 2396 | -S "x509_verify_cert() returned" \ |
Manuel Pégourié-Gonnard | 89addc4 | 2015-04-20 10:56:18 +0100 | [diff] [blame] | 2397 | -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] | 2398 | -S "! mbedtls_ssl_handshake returned" \ |
| 2399 | -C "! mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 2400 | -S "X509 - Certificate verification failed" |
| 2401 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2402 | run_test "Authentication: client no cert, server optional" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2403 | "$P_SRV debug_level=3 auth_mode=optional" \ |
| 2404 | "$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] | 2405 | 0 \ |
| 2406 | -S "skip write certificate request" \ |
| 2407 | -C "skip parse certificate request" \ |
| 2408 | -c "got a certificate request" \ |
| 2409 | -C "skip write certificate$" \ |
| 2410 | -C "got no certificate to send" \ |
| 2411 | -S "SSLv3 client has no certificate" \ |
| 2412 | -c "skip write certificate verify" \ |
| 2413 | -s "skip parse certificate verify" \ |
Manuel Pégourié-Gonnard | 89addc4 | 2015-04-20 10:56:18 +0100 | [diff] [blame] | 2414 | -s "! Certificate was missing" \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2415 | -S "! mbedtls_ssl_handshake returned" \ |
| 2416 | -C "! mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | de515cc | 2014-02-27 14:58:26 +0100 | [diff] [blame] | 2417 | -S "X509 - Certificate verification failed" |
| 2418 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2419 | run_test "Authentication: openssl client no cert, server optional" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2420 | "$P_SRV debug_level=3 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | de515cc | 2014-02-27 14:58:26 +0100 | [diff] [blame] | 2421 | "$O_CLI" \ |
| 2422 | 0 \ |
| 2423 | -S "skip write certificate request" \ |
| 2424 | -s "skip parse certificate verify" \ |
Manuel Pégourié-Gonnard | 89addc4 | 2015-04-20 10:56:18 +0100 | [diff] [blame] | 2425 | -s "! Certificate was missing" \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2426 | -S "! mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | de515cc | 2014-02-27 14:58:26 +0100 | [diff] [blame] | 2427 | -S "X509 - Certificate verification failed" |
| 2428 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2429 | run_test "Authentication: client no cert, openssl server optional" \ |
Manuel Pégourié-Gonnard | de515cc | 2014-02-27 14:58:26 +0100 | [diff] [blame] | 2430 | "$O_SRV -verify 10" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2431 | "$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] | 2432 | 0 \ |
| 2433 | -C "skip parse certificate request" \ |
| 2434 | -c "got a certificate request" \ |
| 2435 | -C "skip write certificate$" \ |
| 2436 | -c "skip write certificate verify" \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2437 | -C "! mbedtls_ssl_handshake returned" |
Manuel Pégourié-Gonnard | de515cc | 2014-02-27 14:58:26 +0100 | [diff] [blame] | 2438 | |
Gilles Peskine | fd8332e | 2017-05-03 16:25:07 +0200 | [diff] [blame] | 2439 | run_test "Authentication: client no cert, openssl server required" \ |
| 2440 | "$O_SRV -Verify 10" \ |
| 2441 | "$P_CLI debug_level=3 crt_file=none key_file=none" \ |
| 2442 | 1 \ |
| 2443 | -C "skip parse certificate request" \ |
| 2444 | -c "got a certificate request" \ |
| 2445 | -C "skip write certificate$" \ |
| 2446 | -c "skip write certificate verify" \ |
| 2447 | -c "! mbedtls_ssl_handshake returned" |
| 2448 | |
Janos Follath | e2681a4 | 2016-03-07 15:57:05 +0000 | [diff] [blame] | 2449 | requires_config_enabled MBEDTLS_SSL_PROTO_SSL3 |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2450 | run_test "Authentication: client no cert, ssl3" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 2451 | "$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] | 2452 | "$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] | 2453 | 0 \ |
| 2454 | -S "skip write certificate request" \ |
| 2455 | -C "skip parse certificate request" \ |
| 2456 | -c "got a certificate request" \ |
| 2457 | -C "skip write certificate$" \ |
| 2458 | -c "skip write certificate verify" \ |
| 2459 | -c "got no certificate to send" \ |
| 2460 | -s "SSLv3 client has no certificate" \ |
| 2461 | -s "skip parse certificate verify" \ |
Manuel Pégourié-Gonnard | 89addc4 | 2015-04-20 10:56:18 +0100 | [diff] [blame] | 2462 | -s "! Certificate was missing" \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2463 | -S "! mbedtls_ssl_handshake returned" \ |
| 2464 | -C "! mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | de515cc | 2014-02-27 14:58:26 +0100 | [diff] [blame] | 2465 | -S "X509 - Certificate verification failed" |
| 2466 | |
Manuel Pégourié-Gonnard | 9107b5f | 2017-07-06 12:16:25 +0200 | [diff] [blame] | 2467 | # The "max_int chain" tests assume that MAX_INTERMEDIATE_CA is set to its |
| 2468 | # default value (8) |
Hanno Becker | a6bca9f | 2017-07-26 13:35:11 +0100 | [diff] [blame] | 2469 | |
Simon Butcher | bcfa6f4 | 2017-07-28 15:59:35 +0100 | [diff] [blame] | 2470 | MAX_IM_CA='8' |
Simon Butcher | 06b7863 | 2017-07-28 01:00:17 +0100 | [diff] [blame] | 2471 | 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] | 2472 | |
Simon Butcher | bcfa6f4 | 2017-07-28 15:59:35 +0100 | [diff] [blame] | 2473 | 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] | 2474 | 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] | 2475 | 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] | 2476 | printf "test value of ${MAX_IM_CA}. \n" |
| 2477 | printf "\n" |
Simon Butcher | bcfa6f4 | 2017-07-28 15:59:35 +0100 | [diff] [blame] | 2478 | printf "The tests assume this value and if it changes, the tests in this\n" |
| 2479 | printf "script should also be adjusted.\n" |
Simon Butcher | 06b7863 | 2017-07-28 01:00:17 +0100 | [diff] [blame] | 2480 | printf "\n" |
Simon Butcher | 06b7863 | 2017-07-28 01:00:17 +0100 | [diff] [blame] | 2481 | |
| 2482 | exit 1 |
Hanno Becker | a6bca9f | 2017-07-26 13:35:11 +0100 | [diff] [blame] | 2483 | fi |
| 2484 | |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 2485 | requires_full_size_output_buffer |
Manuel Pégourié-Gonnard | 81bb6b6 | 2017-06-26 10:45:33 +0200 | [diff] [blame] | 2486 | run_test "Authentication: server max_int chain, client default" \ |
| 2487 | "$P_SRV crt_file=data_files/dir-maxpath/c09.pem \ |
| 2488 | key_file=data_files/dir-maxpath/09.key" \ |
| 2489 | "$P_CLI server_name=CA09 ca_file=data_files/dir-maxpath/00.crt" \ |
| 2490 | 0 \ |
| 2491 | -C "X509 - A fatal error occured" |
| 2492 | |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 2493 | requires_full_size_output_buffer |
Manuel Pégourié-Gonnard | 81bb6b6 | 2017-06-26 10:45:33 +0200 | [diff] [blame] | 2494 | run_test "Authentication: server max_int+1 chain, client default" \ |
| 2495 | "$P_SRV crt_file=data_files/dir-maxpath/c10.pem \ |
| 2496 | key_file=data_files/dir-maxpath/10.key" \ |
| 2497 | "$P_CLI server_name=CA10 ca_file=data_files/dir-maxpath/00.crt" \ |
| 2498 | 1 \ |
| 2499 | -c "X509 - A fatal error occured" |
| 2500 | |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 2501 | requires_full_size_output_buffer |
Manuel Pégourié-Gonnard | 81bb6b6 | 2017-06-26 10:45:33 +0200 | [diff] [blame] | 2502 | run_test "Authentication: server max_int+1 chain, client optional" \ |
| 2503 | "$P_SRV crt_file=data_files/dir-maxpath/c10.pem \ |
| 2504 | key_file=data_files/dir-maxpath/10.key" \ |
| 2505 | "$P_CLI server_name=CA10 ca_file=data_files/dir-maxpath/00.crt \ |
| 2506 | auth_mode=optional" \ |
| 2507 | 1 \ |
| 2508 | -c "X509 - A fatal error occured" |
| 2509 | |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 2510 | requires_full_size_output_buffer |
Manuel Pégourié-Gonnard | 81bb6b6 | 2017-06-26 10:45:33 +0200 | [diff] [blame] | 2511 | run_test "Authentication: server max_int+1 chain, client none" \ |
| 2512 | "$P_SRV crt_file=data_files/dir-maxpath/c10.pem \ |
| 2513 | key_file=data_files/dir-maxpath/10.key" \ |
| 2514 | "$P_CLI server_name=CA10 ca_file=data_files/dir-maxpath/00.crt \ |
| 2515 | auth_mode=none" \ |
| 2516 | 0 \ |
| 2517 | -C "X509 - A fatal error occured" |
| 2518 | |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 2519 | requires_full_size_output_buffer |
Manuel Pégourié-Gonnard | 81bb6b6 | 2017-06-26 10:45:33 +0200 | [diff] [blame] | 2520 | run_test "Authentication: client max_int+1 chain, server default" \ |
| 2521 | "$P_SRV ca_file=data_files/dir-maxpath/00.crt" \ |
| 2522 | "$P_CLI crt_file=data_files/dir-maxpath/c10.pem \ |
| 2523 | key_file=data_files/dir-maxpath/10.key" \ |
| 2524 | 0 \ |
| 2525 | -S "X509 - A fatal error occured" |
| 2526 | |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 2527 | requires_full_size_output_buffer |
Manuel Pégourié-Gonnard | 81bb6b6 | 2017-06-26 10:45:33 +0200 | [diff] [blame] | 2528 | run_test "Authentication: client max_int+1 chain, server optional" \ |
| 2529 | "$P_SRV ca_file=data_files/dir-maxpath/00.crt auth_mode=optional" \ |
| 2530 | "$P_CLI crt_file=data_files/dir-maxpath/c10.pem \ |
| 2531 | key_file=data_files/dir-maxpath/10.key" \ |
| 2532 | 1 \ |
| 2533 | -s "X509 - A fatal error occured" |
| 2534 | |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 2535 | requires_full_size_output_buffer |
Manuel Pégourié-Gonnard | 81bb6b6 | 2017-06-26 10:45:33 +0200 | [diff] [blame] | 2536 | run_test "Authentication: client max_int+1 chain, server required" \ |
| 2537 | "$P_SRV ca_file=data_files/dir-maxpath/00.crt auth_mode=required" \ |
| 2538 | "$P_CLI crt_file=data_files/dir-maxpath/c10.pem \ |
| 2539 | key_file=data_files/dir-maxpath/10.key" \ |
| 2540 | 1 \ |
| 2541 | -s "X509 - A fatal error occured" |
| 2542 | |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 2543 | requires_full_size_output_buffer |
Manuel Pégourié-Gonnard | 81bb6b6 | 2017-06-26 10:45:33 +0200 | [diff] [blame] | 2544 | run_test "Authentication: client max_int chain, server required" \ |
| 2545 | "$P_SRV ca_file=data_files/dir-maxpath/00.crt auth_mode=required" \ |
| 2546 | "$P_CLI crt_file=data_files/dir-maxpath/c09.pem \ |
| 2547 | key_file=data_files/dir-maxpath/09.key" \ |
| 2548 | 0 \ |
| 2549 | -S "X509 - A fatal error occured" |
| 2550 | |
Janos Follath | 89baba2 | 2017-04-10 14:34:35 +0100 | [diff] [blame] | 2551 | # Tests for CA list in CertificateRequest messages |
| 2552 | |
| 2553 | run_test "Authentication: send CA list in CertificateRequest (default)" \ |
| 2554 | "$P_SRV debug_level=3 auth_mode=required" \ |
| 2555 | "$P_CLI crt_file=data_files/server6.crt \ |
| 2556 | key_file=data_files/server6.key" \ |
| 2557 | 0 \ |
| 2558 | -s "requested DN" |
| 2559 | |
| 2560 | run_test "Authentication: do not send CA list in CertificateRequest" \ |
| 2561 | "$P_SRV debug_level=3 auth_mode=required cert_req_ca_list=0" \ |
| 2562 | "$P_CLI crt_file=data_files/server6.crt \ |
| 2563 | key_file=data_files/server6.key" \ |
| 2564 | 0 \ |
| 2565 | -S "requested DN" |
| 2566 | |
| 2567 | run_test "Authentication: send CA list in CertificateRequest, client self signed" \ |
| 2568 | "$P_SRV debug_level=3 auth_mode=required cert_req_ca_list=0" \ |
| 2569 | "$P_CLI debug_level=3 crt_file=data_files/server5-selfsigned.crt \ |
| 2570 | key_file=data_files/server5.key" \ |
| 2571 | 1 \ |
| 2572 | -S "requested DN" \ |
| 2573 | -s "x509_verify_cert() returned" \ |
| 2574 | -s "! The certificate is not correctly signed by the trusted CA" \ |
| 2575 | -s "! mbedtls_ssl_handshake returned" \ |
| 2576 | -c "! mbedtls_ssl_handshake returned" \ |
| 2577 | -s "X509 - Certificate verification failed" |
| 2578 | |
Manuel Pégourié-Gonnard | df331a5 | 2015-01-08 16:43:07 +0100 | [diff] [blame] | 2579 | # Tests for certificate selection based on SHA verson |
| 2580 | |
| 2581 | run_test "Certificate hash: client TLS 1.2 -> SHA-2" \ |
| 2582 | "$P_SRV crt_file=data_files/server5.crt \ |
| 2583 | key_file=data_files/server5.key \ |
| 2584 | crt_file2=data_files/server5-sha1.crt \ |
| 2585 | key_file2=data_files/server5.key" \ |
| 2586 | "$P_CLI force_version=tls1_2" \ |
| 2587 | 0 \ |
| 2588 | -c "signed using.*ECDSA with SHA256" \ |
| 2589 | -C "signed using.*ECDSA with SHA1" |
| 2590 | |
| 2591 | run_test "Certificate hash: client TLS 1.1 -> SHA-1" \ |
| 2592 | "$P_SRV crt_file=data_files/server5.crt \ |
| 2593 | key_file=data_files/server5.key \ |
| 2594 | crt_file2=data_files/server5-sha1.crt \ |
| 2595 | key_file2=data_files/server5.key" \ |
| 2596 | "$P_CLI force_version=tls1_1" \ |
| 2597 | 0 \ |
| 2598 | -C "signed using.*ECDSA with SHA256" \ |
| 2599 | -c "signed using.*ECDSA with SHA1" |
| 2600 | |
| 2601 | run_test "Certificate hash: client TLS 1.0 -> SHA-1" \ |
| 2602 | "$P_SRV crt_file=data_files/server5.crt \ |
| 2603 | key_file=data_files/server5.key \ |
| 2604 | crt_file2=data_files/server5-sha1.crt \ |
| 2605 | key_file2=data_files/server5.key" \ |
| 2606 | "$P_CLI force_version=tls1" \ |
| 2607 | 0 \ |
| 2608 | -C "signed using.*ECDSA with SHA256" \ |
| 2609 | -c "signed using.*ECDSA with SHA1" |
| 2610 | |
| 2611 | run_test "Certificate hash: client TLS 1.1, no SHA-1 -> SHA-2 (order 1)" \ |
| 2612 | "$P_SRV crt_file=data_files/server5.crt \ |
| 2613 | key_file=data_files/server5.key \ |
| 2614 | crt_file2=data_files/server6.crt \ |
| 2615 | key_file2=data_files/server6.key" \ |
| 2616 | "$P_CLI force_version=tls1_1" \ |
| 2617 | 0 \ |
| 2618 | -c "serial number.*09" \ |
| 2619 | -c "signed using.*ECDSA with SHA256" \ |
| 2620 | -C "signed using.*ECDSA with SHA1" |
| 2621 | |
| 2622 | run_test "Certificate hash: client TLS 1.1, no SHA-1 -> SHA-2 (order 2)" \ |
| 2623 | "$P_SRV crt_file=data_files/server6.crt \ |
| 2624 | key_file=data_files/server6.key \ |
| 2625 | crt_file2=data_files/server5.crt \ |
| 2626 | key_file2=data_files/server5.key" \ |
| 2627 | "$P_CLI force_version=tls1_1" \ |
| 2628 | 0 \ |
| 2629 | -c "serial number.*0A" \ |
| 2630 | -c "signed using.*ECDSA with SHA256" \ |
| 2631 | -C "signed using.*ECDSA with SHA1" |
| 2632 | |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 2633 | # tests for SNI |
| 2634 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2635 | run_test "SNI: no SNI callback" \ |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 2636 | "$P_SRV debug_level=3 \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 2637 | 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] | 2638 | "$P_CLI server_name=localhost" \ |
Manuel Pégourié-Gonnard | 6ea831d | 2015-06-22 16:50:52 +0200 | [diff] [blame] | 2639 | 0 \ |
| 2640 | -S "parse ServerName extension" \ |
| 2641 | -c "issuer name *: C=NL, O=PolarSSL, CN=Polarssl Test EC CA" \ |
| 2642 | -c "subject name *: C=NL, O=PolarSSL, CN=localhost" |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 2643 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2644 | run_test "SNI: matching cert 1" \ |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 2645 | "$P_SRV debug_level=3 \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 2646 | 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] | 2647 | 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] | 2648 | "$P_CLI server_name=localhost" \ |
Manuel Pégourié-Gonnard | 6ea831d | 2015-06-22 16:50:52 +0200 | [diff] [blame] | 2649 | 0 \ |
| 2650 | -s "parse ServerName extension" \ |
| 2651 | -c "issuer name *: C=NL, O=PolarSSL, CN=PolarSSL Test CA" \ |
| 2652 | -c "subject name *: C=NL, O=PolarSSL, CN=localhost" |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 2653 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2654 | run_test "SNI: matching cert 2" \ |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 2655 | "$P_SRV debug_level=3 \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 2656 | 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] | 2657 | 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] | 2658 | "$P_CLI server_name=polarssl.example" \ |
Manuel Pégourié-Gonnard | 6ea831d | 2015-06-22 16:50:52 +0200 | [diff] [blame] | 2659 | 0 \ |
| 2660 | -s "parse ServerName extension" \ |
| 2661 | -c "issuer name *: C=NL, O=PolarSSL, CN=PolarSSL Test CA" \ |
| 2662 | -c "subject name *: C=NL, O=PolarSSL, CN=polarssl.example" |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 2663 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2664 | run_test "SNI: no matching cert" \ |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 2665 | "$P_SRV debug_level=3 \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 2666 | 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] | 2667 | 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] | 2668 | "$P_CLI server_name=nonesuch.example" \ |
Manuel Pégourié-Gonnard | 6ea831d | 2015-06-22 16:50:52 +0200 | [diff] [blame] | 2669 | 1 \ |
| 2670 | -s "parse ServerName extension" \ |
| 2671 | -s "ssl_sni_wrapper() returned" \ |
| 2672 | -s "mbedtls_ssl_handshake returned" \ |
| 2673 | -c "mbedtls_ssl_handshake returned" \ |
| 2674 | -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] | 2675 | |
Manuel Pégourié-Gonnard | c948a79 | 2015-06-22 16:04:20 +0200 | [diff] [blame] | 2676 | run_test "SNI: client auth no override: optional" \ |
| 2677 | "$P_SRV debug_level=3 auth_mode=optional \ |
| 2678 | crt_file=data_files/server5.crt key_file=data_files/server5.key \ |
| 2679 | sni=localhost,data_files/server2.crt,data_files/server2.key,-,-,-" \ |
| 2680 | "$P_CLI debug_level=3 server_name=localhost" \ |
Manuel Pégourié-Gonnard | 6ea831d | 2015-06-22 16:50:52 +0200 | [diff] [blame] | 2681 | 0 \ |
Manuel Pégourié-Gonnard | c948a79 | 2015-06-22 16:04:20 +0200 | [diff] [blame] | 2682 | -S "skip write certificate request" \ |
| 2683 | -C "skip parse certificate request" \ |
| 2684 | -c "got a certificate request" \ |
| 2685 | -C "skip write certificate" \ |
| 2686 | -C "skip write certificate verify" \ |
| 2687 | -S "skip parse certificate verify" |
| 2688 | |
| 2689 | run_test "SNI: client auth override: none -> optional" \ |
| 2690 | "$P_SRV debug_level=3 auth_mode=none \ |
| 2691 | crt_file=data_files/server5.crt key_file=data_files/server5.key \ |
| 2692 | sni=localhost,data_files/server2.crt,data_files/server2.key,-,-,optional" \ |
| 2693 | "$P_CLI debug_level=3 server_name=localhost" \ |
Manuel Pégourié-Gonnard | 6ea831d | 2015-06-22 16:50:52 +0200 | [diff] [blame] | 2694 | 0 \ |
Manuel Pégourié-Gonnard | c948a79 | 2015-06-22 16:04:20 +0200 | [diff] [blame] | 2695 | -S "skip write certificate request" \ |
| 2696 | -C "skip parse certificate request" \ |
| 2697 | -c "got a certificate request" \ |
| 2698 | -C "skip write certificate" \ |
| 2699 | -C "skip write certificate verify" \ |
| 2700 | -S "skip parse certificate verify" |
| 2701 | |
| 2702 | run_test "SNI: client auth override: optional -> none" \ |
| 2703 | "$P_SRV debug_level=3 auth_mode=optional \ |
| 2704 | crt_file=data_files/server5.crt key_file=data_files/server5.key \ |
| 2705 | sni=localhost,data_files/server2.crt,data_files/server2.key,-,-,none" \ |
| 2706 | "$P_CLI debug_level=3 server_name=localhost" \ |
Manuel Pégourié-Gonnard | 6ea831d | 2015-06-22 16:50:52 +0200 | [diff] [blame] | 2707 | 0 \ |
Manuel Pégourié-Gonnard | c948a79 | 2015-06-22 16:04:20 +0200 | [diff] [blame] | 2708 | -s "skip write certificate request" \ |
| 2709 | -C "skip parse certificate request" \ |
| 2710 | -c "got no certificate request" \ |
| 2711 | -c "skip write certificate" \ |
| 2712 | -c "skip write certificate verify" \ |
| 2713 | -s "skip parse certificate verify" |
| 2714 | |
Manuel Pégourié-Gonnard | 6ea831d | 2015-06-22 16:50:52 +0200 | [diff] [blame] | 2715 | run_test "SNI: CA no override" \ |
| 2716 | "$P_SRV debug_level=3 auth_mode=optional \ |
| 2717 | crt_file=data_files/server5.crt key_file=data_files/server5.key \ |
| 2718 | ca_file=data_files/test-ca.crt \ |
| 2719 | sni=localhost,data_files/server2.crt,data_files/server2.key,-,-,required" \ |
| 2720 | "$P_CLI debug_level=3 server_name=localhost \ |
| 2721 | crt_file=data_files/server6.crt key_file=data_files/server6.key" \ |
| 2722 | 1 \ |
| 2723 | -S "skip write certificate request" \ |
| 2724 | -C "skip parse certificate request" \ |
| 2725 | -c "got a certificate request" \ |
| 2726 | -C "skip write certificate" \ |
| 2727 | -C "skip write certificate verify" \ |
| 2728 | -S "skip parse certificate verify" \ |
| 2729 | -s "x509_verify_cert() returned" \ |
| 2730 | -s "! The certificate is not correctly signed by the trusted CA" \ |
| 2731 | -S "The certificate has been revoked (is on a CRL)" |
| 2732 | |
| 2733 | run_test "SNI: CA override" \ |
| 2734 | "$P_SRV debug_level=3 auth_mode=optional \ |
| 2735 | crt_file=data_files/server5.crt key_file=data_files/server5.key \ |
| 2736 | ca_file=data_files/test-ca.crt \ |
| 2737 | sni=localhost,data_files/server2.crt,data_files/server2.key,data_files/test-ca2.crt,-,required" \ |
| 2738 | "$P_CLI debug_level=3 server_name=localhost \ |
| 2739 | crt_file=data_files/server6.crt key_file=data_files/server6.key" \ |
| 2740 | 0 \ |
| 2741 | -S "skip write certificate request" \ |
| 2742 | -C "skip parse certificate request" \ |
| 2743 | -c "got a certificate request" \ |
| 2744 | -C "skip write certificate" \ |
| 2745 | -C "skip write certificate verify" \ |
| 2746 | -S "skip parse certificate verify" \ |
| 2747 | -S "x509_verify_cert() returned" \ |
| 2748 | -S "! The certificate is not correctly signed by the trusted CA" \ |
| 2749 | -S "The certificate has been revoked (is on a CRL)" |
| 2750 | |
| 2751 | run_test "SNI: CA override with CRL" \ |
| 2752 | "$P_SRV debug_level=3 auth_mode=optional \ |
| 2753 | crt_file=data_files/server5.crt key_file=data_files/server5.key \ |
| 2754 | ca_file=data_files/test-ca.crt \ |
| 2755 | sni=localhost,data_files/server2.crt,data_files/server2.key,data_files/test-ca2.crt,data_files/crl-ec-sha256.pem,required" \ |
| 2756 | "$P_CLI debug_level=3 server_name=localhost \ |
| 2757 | crt_file=data_files/server6.crt key_file=data_files/server6.key" \ |
| 2758 | 1 \ |
| 2759 | -S "skip write certificate request" \ |
| 2760 | -C "skip parse certificate request" \ |
| 2761 | -c "got a certificate request" \ |
| 2762 | -C "skip write certificate" \ |
| 2763 | -C "skip write certificate verify" \ |
| 2764 | -S "skip parse certificate verify" \ |
| 2765 | -s "x509_verify_cert() returned" \ |
| 2766 | -S "! The certificate is not correctly signed by the trusted CA" \ |
| 2767 | -s "The certificate has been revoked (is on a CRL)" |
| 2768 | |
Andres AG | 1a83445 | 2016-12-07 10:01:30 +0000 | [diff] [blame] | 2769 | # Tests for SNI and DTLS |
| 2770 | |
Andres Amaya Garcia | 54306c1 | 2018-05-01 20:27:37 +0100 | [diff] [blame] | 2771 | run_test "SNI: DTLS, no SNI callback" \ |
| 2772 | "$P_SRV debug_level=3 dtls=1 \ |
| 2773 | crt_file=data_files/server5.crt key_file=data_files/server5.key" \ |
| 2774 | "$P_CLI server_name=localhost dtls=1" \ |
| 2775 | 0 \ |
| 2776 | -S "parse ServerName extension" \ |
| 2777 | -c "issuer name *: C=NL, O=PolarSSL, CN=Polarssl Test EC CA" \ |
| 2778 | -c "subject name *: C=NL, O=PolarSSL, CN=localhost" |
| 2779 | |
Andres Amaya Garcia | f77d3d3 | 2018-05-01 20:26:47 +0100 | [diff] [blame] | 2780 | run_test "SNI: DTLS, matching cert 1" \ |
Andres AG | 1a83445 | 2016-12-07 10:01:30 +0000 | [diff] [blame] | 2781 | "$P_SRV debug_level=3 dtls=1 \ |
| 2782 | crt_file=data_files/server5.crt key_file=data_files/server5.key \ |
| 2783 | sni=localhost,data_files/server2.crt,data_files/server2.key,-,-,-,polarssl.example,data_files/server1-nospace.crt,data_files/server1.key,-,-,-" \ |
| 2784 | "$P_CLI server_name=localhost dtls=1" \ |
| 2785 | 0 \ |
| 2786 | -s "parse ServerName extension" \ |
| 2787 | -c "issuer name *: C=NL, O=PolarSSL, CN=PolarSSL Test CA" \ |
| 2788 | -c "subject name *: C=NL, O=PolarSSL, CN=localhost" |
| 2789 | |
Andres Amaya Garcia | 54306c1 | 2018-05-01 20:27:37 +0100 | [diff] [blame] | 2790 | run_test "SNI: DTLS, matching cert 2" \ |
| 2791 | "$P_SRV debug_level=3 dtls=1 \ |
| 2792 | crt_file=data_files/server5.crt key_file=data_files/server5.key \ |
| 2793 | sni=localhost,data_files/server2.crt,data_files/server2.key,-,-,-,polarssl.example,data_files/server1-nospace.crt,data_files/server1.key,-,-,-" \ |
| 2794 | "$P_CLI server_name=polarssl.example dtls=1" \ |
| 2795 | 0 \ |
| 2796 | -s "parse ServerName extension" \ |
| 2797 | -c "issuer name *: C=NL, O=PolarSSL, CN=PolarSSL Test CA" \ |
| 2798 | -c "subject name *: C=NL, O=PolarSSL, CN=polarssl.example" |
| 2799 | |
| 2800 | run_test "SNI: DTLS, no matching cert" \ |
| 2801 | "$P_SRV debug_level=3 dtls=1 \ |
| 2802 | crt_file=data_files/server5.crt key_file=data_files/server5.key \ |
| 2803 | sni=localhost,data_files/server2.crt,data_files/server2.key,-,-,-,polarssl.example,data_files/server1-nospace.crt,data_files/server1.key,-,-,-" \ |
| 2804 | "$P_CLI server_name=nonesuch.example dtls=1" \ |
| 2805 | 1 \ |
| 2806 | -s "parse ServerName extension" \ |
| 2807 | -s "ssl_sni_wrapper() returned" \ |
| 2808 | -s "mbedtls_ssl_handshake returned" \ |
| 2809 | -c "mbedtls_ssl_handshake returned" \ |
| 2810 | -c "SSL - A fatal alert message was received from our peer" |
| 2811 | |
| 2812 | run_test "SNI: DTLS, client auth no override: optional" \ |
| 2813 | "$P_SRV debug_level=3 auth_mode=optional dtls=1 \ |
| 2814 | crt_file=data_files/server5.crt key_file=data_files/server5.key \ |
| 2815 | sni=localhost,data_files/server2.crt,data_files/server2.key,-,-,-" \ |
| 2816 | "$P_CLI debug_level=3 server_name=localhost dtls=1" \ |
| 2817 | 0 \ |
| 2818 | -S "skip write certificate request" \ |
| 2819 | -C "skip parse certificate request" \ |
| 2820 | -c "got a certificate request" \ |
| 2821 | -C "skip write certificate" \ |
| 2822 | -C "skip write certificate verify" \ |
| 2823 | -S "skip parse certificate verify" |
| 2824 | |
| 2825 | run_test "SNI: DTLS, client auth override: none -> optional" \ |
| 2826 | "$P_SRV debug_level=3 auth_mode=none dtls=1 \ |
| 2827 | crt_file=data_files/server5.crt key_file=data_files/server5.key \ |
| 2828 | sni=localhost,data_files/server2.crt,data_files/server2.key,-,-,optional" \ |
| 2829 | "$P_CLI debug_level=3 server_name=localhost dtls=1" \ |
| 2830 | 0 \ |
| 2831 | -S "skip write certificate request" \ |
| 2832 | -C "skip parse certificate request" \ |
| 2833 | -c "got a certificate request" \ |
| 2834 | -C "skip write certificate" \ |
| 2835 | -C "skip write certificate verify" \ |
| 2836 | -S "skip parse certificate verify" |
| 2837 | |
| 2838 | run_test "SNI: DTLS, client auth override: optional -> none" \ |
| 2839 | "$P_SRV debug_level=3 auth_mode=optional dtls=1 \ |
| 2840 | crt_file=data_files/server5.crt key_file=data_files/server5.key \ |
| 2841 | sni=localhost,data_files/server2.crt,data_files/server2.key,-,-,none" \ |
| 2842 | "$P_CLI debug_level=3 server_name=localhost dtls=1" \ |
| 2843 | 0 \ |
| 2844 | -s "skip write certificate request" \ |
| 2845 | -C "skip parse certificate request" \ |
| 2846 | -c "got no certificate request" \ |
| 2847 | -c "skip write certificate" \ |
| 2848 | -c "skip write certificate verify" \ |
| 2849 | -s "skip parse certificate verify" |
| 2850 | |
| 2851 | run_test "SNI: DTLS, CA no override" \ |
| 2852 | "$P_SRV debug_level=3 auth_mode=optional dtls=1 \ |
| 2853 | crt_file=data_files/server5.crt key_file=data_files/server5.key \ |
| 2854 | ca_file=data_files/test-ca.crt \ |
| 2855 | sni=localhost,data_files/server2.crt,data_files/server2.key,-,-,required" \ |
| 2856 | "$P_CLI debug_level=3 server_name=localhost dtls=1 \ |
| 2857 | crt_file=data_files/server6.crt key_file=data_files/server6.key" \ |
| 2858 | 1 \ |
| 2859 | -S "skip write certificate request" \ |
| 2860 | -C "skip parse certificate request" \ |
| 2861 | -c "got a certificate request" \ |
| 2862 | -C "skip write certificate" \ |
| 2863 | -C "skip write certificate verify" \ |
| 2864 | -S "skip parse certificate verify" \ |
| 2865 | -s "x509_verify_cert() returned" \ |
| 2866 | -s "! The certificate is not correctly signed by the trusted CA" \ |
| 2867 | -S "The certificate has been revoked (is on a CRL)" |
| 2868 | |
Andres Amaya Garcia | f77d3d3 | 2018-05-01 20:26:47 +0100 | [diff] [blame] | 2869 | run_test "SNI: DTLS, CA override" \ |
Andres AG | 1a83445 | 2016-12-07 10:01:30 +0000 | [diff] [blame] | 2870 | "$P_SRV debug_level=3 auth_mode=optional dtls=1 \ |
| 2871 | crt_file=data_files/server5.crt key_file=data_files/server5.key \ |
| 2872 | ca_file=data_files/test-ca.crt \ |
| 2873 | sni=localhost,data_files/server2.crt,data_files/server2.key,data_files/test-ca2.crt,-,required" \ |
| 2874 | "$P_CLI debug_level=3 server_name=localhost dtls=1 \ |
| 2875 | crt_file=data_files/server6.crt key_file=data_files/server6.key" \ |
| 2876 | 0 \ |
| 2877 | -S "skip write certificate request" \ |
| 2878 | -C "skip parse certificate request" \ |
| 2879 | -c "got a certificate request" \ |
| 2880 | -C "skip write certificate" \ |
| 2881 | -C "skip write certificate verify" \ |
| 2882 | -S "skip parse certificate verify" \ |
| 2883 | -S "x509_verify_cert() returned" \ |
| 2884 | -S "! The certificate is not correctly signed by the trusted CA" \ |
| 2885 | -S "The certificate has been revoked (is on a CRL)" |
| 2886 | |
Andres Amaya Garcia | f77d3d3 | 2018-05-01 20:26:47 +0100 | [diff] [blame] | 2887 | run_test "SNI: DTLS, CA override with CRL" \ |
Andres AG | 1a83445 | 2016-12-07 10:01:30 +0000 | [diff] [blame] | 2888 | "$P_SRV debug_level=3 auth_mode=optional \ |
| 2889 | crt_file=data_files/server5.crt key_file=data_files/server5.key dtls=1 \ |
| 2890 | ca_file=data_files/test-ca.crt \ |
| 2891 | sni=localhost,data_files/server2.crt,data_files/server2.key,data_files/test-ca2.crt,data_files/crl-ec-sha256.pem,required" \ |
| 2892 | "$P_CLI debug_level=3 server_name=localhost dtls=1 \ |
| 2893 | crt_file=data_files/server6.crt key_file=data_files/server6.key" \ |
| 2894 | 1 \ |
| 2895 | -S "skip write certificate request" \ |
| 2896 | -C "skip parse certificate request" \ |
| 2897 | -c "got a certificate request" \ |
| 2898 | -C "skip write certificate" \ |
| 2899 | -C "skip write certificate verify" \ |
| 2900 | -S "skip parse certificate verify" \ |
| 2901 | -s "x509_verify_cert() returned" \ |
| 2902 | -S "! The certificate is not correctly signed by the trusted CA" \ |
| 2903 | -s "The certificate has been revoked (is on a CRL)" |
| 2904 | |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 2905 | # Tests for non-blocking I/O: exercise a variety of handshake flows |
| 2906 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2907 | run_test "Non-blocking I/O: basic handshake" \ |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 2908 | "$P_SRV nbio=2 tickets=0 auth_mode=none" \ |
| 2909 | "$P_CLI nbio=2 tickets=0" \ |
| 2910 | 0 \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2911 | -S "mbedtls_ssl_handshake returned" \ |
| 2912 | -C "mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 2913 | -c "Read from server: .* bytes read" |
| 2914 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2915 | run_test "Non-blocking I/O: client auth" \ |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 2916 | "$P_SRV nbio=2 tickets=0 auth_mode=required" \ |
| 2917 | "$P_CLI nbio=2 tickets=0" \ |
| 2918 | 0 \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2919 | -S "mbedtls_ssl_handshake returned" \ |
| 2920 | -C "mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 2921 | -c "Read from server: .* bytes read" |
| 2922 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2923 | run_test "Non-blocking I/O: ticket" \ |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 2924 | "$P_SRV nbio=2 tickets=1 auth_mode=none" \ |
| 2925 | "$P_CLI nbio=2 tickets=1" \ |
| 2926 | 0 \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2927 | -S "mbedtls_ssl_handshake returned" \ |
| 2928 | -C "mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 2929 | -c "Read from server: .* bytes read" |
| 2930 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2931 | run_test "Non-blocking I/O: ticket + client auth" \ |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 2932 | "$P_SRV nbio=2 tickets=1 auth_mode=required" \ |
| 2933 | "$P_CLI nbio=2 tickets=1" \ |
| 2934 | 0 \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2935 | -S "mbedtls_ssl_handshake returned" \ |
| 2936 | -C "mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 2937 | -c "Read from server: .* bytes read" |
| 2938 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2939 | run_test "Non-blocking I/O: ticket + client auth + resume" \ |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 2940 | "$P_SRV nbio=2 tickets=1 auth_mode=required" \ |
| 2941 | "$P_CLI nbio=2 tickets=1 reconnect=1" \ |
| 2942 | 0 \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2943 | -S "mbedtls_ssl_handshake returned" \ |
| 2944 | -C "mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 2945 | -c "Read from server: .* bytes read" |
| 2946 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2947 | run_test "Non-blocking I/O: ticket + resume" \ |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 2948 | "$P_SRV nbio=2 tickets=1 auth_mode=none" \ |
| 2949 | "$P_CLI nbio=2 tickets=1 reconnect=1" \ |
| 2950 | 0 \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2951 | -S "mbedtls_ssl_handshake returned" \ |
| 2952 | -C "mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 2953 | -c "Read from server: .* bytes read" |
| 2954 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 2955 | run_test "Non-blocking I/O: session-id resume" \ |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 2956 | "$P_SRV nbio=2 tickets=0 auth_mode=none" \ |
| 2957 | "$P_CLI nbio=2 tickets=0 reconnect=1" \ |
| 2958 | 0 \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2959 | -S "mbedtls_ssl_handshake returned" \ |
| 2960 | -C "mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 2961 | -c "Read from server: .* bytes read" |
| 2962 | |
Hanno Becker | 0007671 | 2017-11-15 16:39:08 +0000 | [diff] [blame] | 2963 | # Tests for event-driven I/O: exercise a variety of handshake flows |
| 2964 | |
| 2965 | run_test "Event-driven I/O: basic handshake" \ |
| 2966 | "$P_SRV event=1 tickets=0 auth_mode=none" \ |
| 2967 | "$P_CLI event=1 tickets=0" \ |
| 2968 | 0 \ |
| 2969 | -S "mbedtls_ssl_handshake returned" \ |
| 2970 | -C "mbedtls_ssl_handshake returned" \ |
| 2971 | -c "Read from server: .* bytes read" |
| 2972 | |
| 2973 | run_test "Event-driven I/O: client auth" \ |
| 2974 | "$P_SRV event=1 tickets=0 auth_mode=required" \ |
| 2975 | "$P_CLI event=1 tickets=0" \ |
| 2976 | 0 \ |
| 2977 | -S "mbedtls_ssl_handshake returned" \ |
| 2978 | -C "mbedtls_ssl_handshake returned" \ |
| 2979 | -c "Read from server: .* bytes read" |
| 2980 | |
| 2981 | run_test "Event-driven I/O: ticket" \ |
| 2982 | "$P_SRV event=1 tickets=1 auth_mode=none" \ |
| 2983 | "$P_CLI event=1 tickets=1" \ |
| 2984 | 0 \ |
| 2985 | -S "mbedtls_ssl_handshake returned" \ |
| 2986 | -C "mbedtls_ssl_handshake returned" \ |
| 2987 | -c "Read from server: .* bytes read" |
| 2988 | |
| 2989 | run_test "Event-driven I/O: ticket + client auth" \ |
| 2990 | "$P_SRV event=1 tickets=1 auth_mode=required" \ |
| 2991 | "$P_CLI event=1 tickets=1" \ |
| 2992 | 0 \ |
| 2993 | -S "mbedtls_ssl_handshake returned" \ |
| 2994 | -C "mbedtls_ssl_handshake returned" \ |
| 2995 | -c "Read from server: .* bytes read" |
| 2996 | |
| 2997 | run_test "Event-driven I/O: ticket + client auth + resume" \ |
| 2998 | "$P_SRV event=1 tickets=1 auth_mode=required" \ |
| 2999 | "$P_CLI event=1 tickets=1 reconnect=1" \ |
| 3000 | 0 \ |
| 3001 | -S "mbedtls_ssl_handshake returned" \ |
| 3002 | -C "mbedtls_ssl_handshake returned" \ |
| 3003 | -c "Read from server: .* bytes read" |
| 3004 | |
| 3005 | run_test "Event-driven I/O: ticket + resume" \ |
| 3006 | "$P_SRV event=1 tickets=1 auth_mode=none" \ |
| 3007 | "$P_CLI event=1 tickets=1 reconnect=1" \ |
| 3008 | 0 \ |
| 3009 | -S "mbedtls_ssl_handshake returned" \ |
| 3010 | -C "mbedtls_ssl_handshake returned" \ |
| 3011 | -c "Read from server: .* bytes read" |
| 3012 | |
| 3013 | run_test "Event-driven I/O: session-id resume" \ |
| 3014 | "$P_SRV event=1 tickets=0 auth_mode=none" \ |
| 3015 | "$P_CLI event=1 tickets=0 reconnect=1" \ |
| 3016 | 0 \ |
| 3017 | -S "mbedtls_ssl_handshake returned" \ |
| 3018 | -C "mbedtls_ssl_handshake returned" \ |
| 3019 | -c "Read from server: .* bytes read" |
| 3020 | |
Hanno Becker | 6a33f59 | 2018-03-13 11:38:46 +0000 | [diff] [blame] | 3021 | run_test "Event-driven I/O, DTLS: basic handshake" \ |
| 3022 | "$P_SRV dtls=1 event=1 tickets=0 auth_mode=none" \ |
| 3023 | "$P_CLI dtls=1 event=1 tickets=0" \ |
| 3024 | 0 \ |
| 3025 | -c "Read from server: .* bytes read" |
| 3026 | |
| 3027 | run_test "Event-driven I/O, DTLS: client auth" \ |
| 3028 | "$P_SRV dtls=1 event=1 tickets=0 auth_mode=required" \ |
| 3029 | "$P_CLI dtls=1 event=1 tickets=0" \ |
| 3030 | 0 \ |
| 3031 | -c "Read from server: .* bytes read" |
| 3032 | |
| 3033 | run_test "Event-driven I/O, DTLS: ticket" \ |
| 3034 | "$P_SRV dtls=1 event=1 tickets=1 auth_mode=none" \ |
| 3035 | "$P_CLI dtls=1 event=1 tickets=1" \ |
| 3036 | 0 \ |
| 3037 | -c "Read from server: .* bytes read" |
| 3038 | |
| 3039 | run_test "Event-driven I/O, DTLS: ticket + client auth" \ |
| 3040 | "$P_SRV dtls=1 event=1 tickets=1 auth_mode=required" \ |
| 3041 | "$P_CLI dtls=1 event=1 tickets=1" \ |
| 3042 | 0 \ |
| 3043 | -c "Read from server: .* bytes read" |
| 3044 | |
| 3045 | run_test "Event-driven I/O, DTLS: ticket + client auth + resume" \ |
| 3046 | "$P_SRV dtls=1 event=1 tickets=1 auth_mode=required" \ |
| 3047 | "$P_CLI dtls=1 event=1 tickets=1 reconnect=1" \ |
| 3048 | 0 \ |
| 3049 | -c "Read from server: .* bytes read" |
| 3050 | |
| 3051 | run_test "Event-driven I/O, DTLS: ticket + resume" \ |
| 3052 | "$P_SRV dtls=1 event=1 tickets=1 auth_mode=none" \ |
| 3053 | "$P_CLI dtls=1 event=1 tickets=1 reconnect=1" \ |
| 3054 | 0 \ |
| 3055 | -c "Read from server: .* bytes read" |
| 3056 | |
| 3057 | run_test "Event-driven I/O, DTLS: session-id resume" \ |
| 3058 | "$P_SRV dtls=1 event=1 tickets=0 auth_mode=none" \ |
| 3059 | "$P_CLI dtls=1 event=1 tickets=0 reconnect=1" \ |
| 3060 | 0 \ |
| 3061 | -c "Read from server: .* bytes read" |
Hanno Becker | bc6c110 | 2018-03-13 11:39:40 +0000 | [diff] [blame] | 3062 | |
| 3063 | # This test demonstrates the need for the mbedtls_ssl_check_pending function. |
| 3064 | # During session resumption, the client will send its ApplicationData record |
| 3065 | # within the same datagram as the Finished messages. In this situation, the |
| 3066 | # server MUST NOT idle on the underlying transport after handshake completion, |
| 3067 | # because the ApplicationData request has already been queued internally. |
| 3068 | run_test "Event-driven I/O, DTLS: session-id resume, UDP packing" \ |
Hanno Becker | 8d83218 | 2018-03-15 10:14:19 +0000 | [diff] [blame] | 3069 | -p "$P_PXY pack=50" \ |
Hanno Becker | bc6c110 | 2018-03-13 11:39:40 +0000 | [diff] [blame] | 3070 | "$P_SRV dtls=1 event=1 tickets=0 auth_mode=required" \ |
| 3071 | "$P_CLI dtls=1 event=1 tickets=0 reconnect=1" \ |
| 3072 | 0 \ |
| 3073 | -c "Read from server: .* bytes read" |
| 3074 | |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 3075 | # Tests for version negotiation |
| 3076 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3077 | run_test "Version check: all -> 1.2" \ |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 3078 | "$P_SRV" \ |
| 3079 | "$P_CLI" \ |
| 3080 | 0 \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 3081 | -S "mbedtls_ssl_handshake returned" \ |
| 3082 | -C "mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 3083 | -s "Protocol is TLSv1.2" \ |
| 3084 | -c "Protocol is TLSv1.2" |
| 3085 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3086 | run_test "Version check: cli max 1.1 -> 1.1" \ |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 3087 | "$P_SRV" \ |
| 3088 | "$P_CLI max_version=tls1_1" \ |
| 3089 | 0 \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 3090 | -S "mbedtls_ssl_handshake returned" \ |
| 3091 | -C "mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 3092 | -s "Protocol is TLSv1.1" \ |
| 3093 | -c "Protocol is TLSv1.1" |
| 3094 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3095 | run_test "Version check: srv max 1.1 -> 1.1" \ |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 3096 | "$P_SRV max_version=tls1_1" \ |
| 3097 | "$P_CLI" \ |
| 3098 | 0 \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 3099 | -S "mbedtls_ssl_handshake returned" \ |
| 3100 | -C "mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 3101 | -s "Protocol is TLSv1.1" \ |
| 3102 | -c "Protocol is TLSv1.1" |
| 3103 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3104 | 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] | 3105 | "$P_SRV max_version=tls1_1" \ |
| 3106 | "$P_CLI max_version=tls1_1" \ |
| 3107 | 0 \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 3108 | -S "mbedtls_ssl_handshake returned" \ |
| 3109 | -C "mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 3110 | -s "Protocol is TLSv1.1" \ |
| 3111 | -c "Protocol is TLSv1.1" |
| 3112 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3113 | 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] | 3114 | "$P_SRV min_version=tls1_1" \ |
| 3115 | "$P_CLI max_version=tls1_1" \ |
| 3116 | 0 \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 3117 | -S "mbedtls_ssl_handshake returned" \ |
| 3118 | -C "mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 3119 | -s "Protocol is TLSv1.1" \ |
| 3120 | -c "Protocol is TLSv1.1" |
| 3121 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3122 | 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] | 3123 | "$P_SRV max_version=tls1_1" \ |
| 3124 | "$P_CLI min_version=tls1_1" \ |
| 3125 | 0 \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 3126 | -S "mbedtls_ssl_handshake returned" \ |
| 3127 | -C "mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 3128 | -s "Protocol is TLSv1.1" \ |
| 3129 | -c "Protocol is TLSv1.1" |
| 3130 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3131 | 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] | 3132 | "$P_SRV max_version=tls1_1" \ |
| 3133 | "$P_CLI min_version=tls1_2" \ |
| 3134 | 1 \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 3135 | -s "mbedtls_ssl_handshake returned" \ |
| 3136 | -c "mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 3137 | -c "SSL - Handshake protocol not within min/max boundaries" |
| 3138 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3139 | 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] | 3140 | "$P_SRV min_version=tls1_2" \ |
| 3141 | "$P_CLI max_version=tls1_1" \ |
| 3142 | 1 \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 3143 | -s "mbedtls_ssl_handshake returned" \ |
| 3144 | -c "mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 3145 | -s "SSL - Handshake protocol not within min/max boundaries" |
| 3146 | |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 3147 | # Tests for ALPN extension |
| 3148 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3149 | run_test "ALPN: none" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 3150 | "$P_SRV debug_level=3" \ |
| 3151 | "$P_CLI debug_level=3" \ |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 3152 | 0 \ |
| 3153 | -C "client hello, adding alpn extension" \ |
| 3154 | -S "found alpn extension" \ |
| 3155 | -C "got an alert message, type: \\[2:120]" \ |
| 3156 | -S "server hello, adding alpn extension" \ |
| 3157 | -C "found alpn extension " \ |
| 3158 | -C "Application Layer Protocol is" \ |
| 3159 | -S "Application Layer Protocol is" |
| 3160 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3161 | run_test "ALPN: client only" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 3162 | "$P_SRV debug_level=3" \ |
| 3163 | "$P_CLI debug_level=3 alpn=abc,1234" \ |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 3164 | 0 \ |
| 3165 | -c "client hello, adding alpn extension" \ |
| 3166 | -s "found alpn extension" \ |
| 3167 | -C "got an alert message, type: \\[2:120]" \ |
| 3168 | -S "server hello, adding alpn extension" \ |
| 3169 | -C "found alpn extension " \ |
| 3170 | -c "Application Layer Protocol is (none)" \ |
| 3171 | -S "Application Layer Protocol is" |
| 3172 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3173 | run_test "ALPN: server only" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 3174 | "$P_SRV debug_level=3 alpn=abc,1234" \ |
| 3175 | "$P_CLI debug_level=3" \ |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 3176 | 0 \ |
| 3177 | -C "client hello, adding alpn extension" \ |
| 3178 | -S "found alpn extension" \ |
| 3179 | -C "got an alert message, type: \\[2:120]" \ |
| 3180 | -S "server hello, adding alpn extension" \ |
| 3181 | -C "found alpn extension " \ |
| 3182 | -C "Application Layer Protocol is" \ |
| 3183 | -s "Application Layer Protocol is (none)" |
| 3184 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3185 | run_test "ALPN: both, common cli1-srv1" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 3186 | "$P_SRV debug_level=3 alpn=abc,1234" \ |
| 3187 | "$P_CLI debug_level=3 alpn=abc,1234" \ |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 3188 | 0 \ |
| 3189 | -c "client hello, adding alpn extension" \ |
| 3190 | -s "found alpn extension" \ |
| 3191 | -C "got an alert message, type: \\[2:120]" \ |
| 3192 | -s "server hello, adding alpn extension" \ |
| 3193 | -c "found alpn extension" \ |
| 3194 | -c "Application Layer Protocol is abc" \ |
| 3195 | -s "Application Layer Protocol is abc" |
| 3196 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3197 | run_test "ALPN: both, common cli2-srv1" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 3198 | "$P_SRV debug_level=3 alpn=abc,1234" \ |
| 3199 | "$P_CLI debug_level=3 alpn=1234,abc" \ |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 3200 | 0 \ |
| 3201 | -c "client hello, adding alpn extension" \ |
| 3202 | -s "found alpn extension" \ |
| 3203 | -C "got an alert message, type: \\[2:120]" \ |
| 3204 | -s "server hello, adding alpn extension" \ |
| 3205 | -c "found alpn extension" \ |
| 3206 | -c "Application Layer Protocol is abc" \ |
| 3207 | -s "Application Layer Protocol is abc" |
| 3208 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3209 | run_test "ALPN: both, common cli1-srv2" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 3210 | "$P_SRV debug_level=3 alpn=abc,1234" \ |
| 3211 | "$P_CLI debug_level=3 alpn=1234,abcde" \ |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 3212 | 0 \ |
| 3213 | -c "client hello, adding alpn extension" \ |
| 3214 | -s "found alpn extension" \ |
| 3215 | -C "got an alert message, type: \\[2:120]" \ |
| 3216 | -s "server hello, adding alpn extension" \ |
| 3217 | -c "found alpn extension" \ |
| 3218 | -c "Application Layer Protocol is 1234" \ |
| 3219 | -s "Application Layer Protocol is 1234" |
| 3220 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3221 | run_test "ALPN: both, no common" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 3222 | "$P_SRV debug_level=3 alpn=abc,123" \ |
| 3223 | "$P_CLI debug_level=3 alpn=1234,abcde" \ |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 3224 | 1 \ |
| 3225 | -c "client hello, adding alpn extension" \ |
| 3226 | -s "found alpn extension" \ |
| 3227 | -c "got an alert message, type: \\[2:120]" \ |
| 3228 | -S "server hello, adding alpn extension" \ |
| 3229 | -C "found alpn extension" \ |
| 3230 | -C "Application Layer Protocol is 1234" \ |
| 3231 | -S "Application Layer Protocol is 1234" |
| 3232 | |
Manuel Pégourié-Gonnard | 83d8c73 | 2014-04-07 13:24:21 +0200 | [diff] [blame] | 3233 | |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 3234 | # Tests for keyUsage in leaf certificates, part 1: |
| 3235 | # server-side certificate/suite selection |
| 3236 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3237 | run_test "keyUsage srv: RSA, digitalSignature -> (EC)DHE-RSA" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 3238 | "$P_SRV key_file=data_files/server2.key \ |
| 3239 | crt_file=data_files/server2.ku-ds.crt" \ |
| 3240 | "$P_CLI" \ |
| 3241 | 0 \ |
Manuel Pégourié-Gonnard | 17cde5f | 2014-05-22 14:42:39 +0200 | [diff] [blame] | 3242 | -c "Ciphersuite is TLS-[EC]*DHE-RSA-WITH-" |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 3243 | |
| 3244 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3245 | run_test "keyUsage srv: RSA, keyEncipherment -> RSA" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 3246 | "$P_SRV key_file=data_files/server2.key \ |
| 3247 | crt_file=data_files/server2.ku-ke.crt" \ |
| 3248 | "$P_CLI" \ |
| 3249 | 0 \ |
| 3250 | -c "Ciphersuite is TLS-RSA-WITH-" |
| 3251 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3252 | run_test "keyUsage srv: RSA, keyAgreement -> fail" \ |
Manuel Pégourié-Gonnard | f2629b9 | 2014-08-30 14:20:14 +0200 | [diff] [blame] | 3253 | "$P_SRV key_file=data_files/server2.key \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 3254 | crt_file=data_files/server2.ku-ka.crt" \ |
Manuel Pégourié-Gonnard | f2629b9 | 2014-08-30 14:20:14 +0200 | [diff] [blame] | 3255 | "$P_CLI" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 3256 | 1 \ |
| 3257 | -C "Ciphersuite is " |
| 3258 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3259 | run_test "keyUsage srv: ECDSA, digitalSignature -> ECDHE-ECDSA" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 3260 | "$P_SRV key_file=data_files/server5.key \ |
| 3261 | crt_file=data_files/server5.ku-ds.crt" \ |
| 3262 | "$P_CLI" \ |
| 3263 | 0 \ |
| 3264 | -c "Ciphersuite is TLS-ECDHE-ECDSA-WITH-" |
| 3265 | |
| 3266 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3267 | run_test "keyUsage srv: ECDSA, keyAgreement -> ECDH-" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 3268 | "$P_SRV key_file=data_files/server5.key \ |
| 3269 | crt_file=data_files/server5.ku-ka.crt" \ |
| 3270 | "$P_CLI" \ |
| 3271 | 0 \ |
| 3272 | -c "Ciphersuite is TLS-ECDH-" |
| 3273 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3274 | run_test "keyUsage srv: ECDSA, keyEncipherment -> fail" \ |
Manuel Pégourié-Gonnard | f2629b9 | 2014-08-30 14:20:14 +0200 | [diff] [blame] | 3275 | "$P_SRV key_file=data_files/server5.key \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 3276 | crt_file=data_files/server5.ku-ke.crt" \ |
Manuel Pégourié-Gonnard | f2629b9 | 2014-08-30 14:20:14 +0200 | [diff] [blame] | 3277 | "$P_CLI" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 3278 | 1 \ |
| 3279 | -C "Ciphersuite is " |
| 3280 | |
| 3281 | # Tests for keyUsage in leaf certificates, part 2: |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 3282 | # client-side checking of server cert |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 3283 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3284 | run_test "keyUsage cli: DigitalSignature+KeyEncipherment, RSA: OK" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 3285 | "$O_SRV -key data_files/server2.key \ |
| 3286 | -cert data_files/server2.ku-ds_ke.crt" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 3287 | "$P_CLI debug_level=1 \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 3288 | force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| 3289 | 0 \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 3290 | -C "bad certificate (usage extensions)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 3291 | -C "Processing of the Certificate handshake message failed" \ |
| 3292 | -c "Ciphersuite is TLS-" |
| 3293 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3294 | run_test "keyUsage cli: DigitalSignature+KeyEncipherment, DHE-RSA: OK" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 3295 | "$O_SRV -key data_files/server2.key \ |
| 3296 | -cert data_files/server2.ku-ds_ke.crt" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 3297 | "$P_CLI debug_level=1 \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 3298 | force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA" \ |
| 3299 | 0 \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 3300 | -C "bad certificate (usage extensions)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 3301 | -C "Processing of the Certificate handshake message failed" \ |
| 3302 | -c "Ciphersuite is TLS-" |
| 3303 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3304 | run_test "keyUsage cli: KeyEncipherment, RSA: OK" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 3305 | "$O_SRV -key data_files/server2.key \ |
| 3306 | -cert data_files/server2.ku-ke.crt" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 3307 | "$P_CLI debug_level=1 \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 3308 | force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| 3309 | 0 \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 3310 | -C "bad certificate (usage extensions)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 3311 | -C "Processing of the Certificate handshake message failed" \ |
| 3312 | -c "Ciphersuite is TLS-" |
| 3313 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3314 | run_test "keyUsage cli: KeyEncipherment, DHE-RSA: fail" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 3315 | "$O_SRV -key data_files/server2.key \ |
| 3316 | -cert data_files/server2.ku-ke.crt" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 3317 | "$P_CLI debug_level=1 \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 3318 | force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA" \ |
| 3319 | 1 \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 3320 | -c "bad certificate (usage extensions)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 3321 | -c "Processing of the Certificate handshake message failed" \ |
| 3322 | -C "Ciphersuite is TLS-" |
| 3323 | |
Manuel Pégourié-Gonnard | e6efa6f | 2015-04-20 11:01:48 +0100 | [diff] [blame] | 3324 | run_test "keyUsage cli: KeyEncipherment, DHE-RSA: fail, soft" \ |
| 3325 | "$O_SRV -key data_files/server2.key \ |
| 3326 | -cert data_files/server2.ku-ke.crt" \ |
| 3327 | "$P_CLI debug_level=1 auth_mode=optional \ |
| 3328 | force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA" \ |
| 3329 | 0 \ |
| 3330 | -c "bad certificate (usage extensions)" \ |
| 3331 | -C "Processing of the Certificate handshake message failed" \ |
| 3332 | -c "Ciphersuite is TLS-" \ |
| 3333 | -c "! Usage does not match the keyUsage extension" |
| 3334 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3335 | run_test "keyUsage cli: DigitalSignature, DHE-RSA: OK" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 3336 | "$O_SRV -key data_files/server2.key \ |
| 3337 | -cert data_files/server2.ku-ds.crt" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 3338 | "$P_CLI debug_level=1 \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 3339 | force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA" \ |
| 3340 | 0 \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 3341 | -C "bad certificate (usage extensions)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 3342 | -C "Processing of the Certificate handshake message failed" \ |
| 3343 | -c "Ciphersuite is TLS-" |
| 3344 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3345 | run_test "keyUsage cli: DigitalSignature, RSA: fail" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 3346 | "$O_SRV -key data_files/server2.key \ |
| 3347 | -cert data_files/server2.ku-ds.crt" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 3348 | "$P_CLI debug_level=1 \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 3349 | force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| 3350 | 1 \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 3351 | -c "bad certificate (usage extensions)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 3352 | -c "Processing of the Certificate handshake message failed" \ |
| 3353 | -C "Ciphersuite is TLS-" |
| 3354 | |
Manuel Pégourié-Gonnard | e6efa6f | 2015-04-20 11:01:48 +0100 | [diff] [blame] | 3355 | run_test "keyUsage cli: DigitalSignature, RSA: fail, soft" \ |
| 3356 | "$O_SRV -key data_files/server2.key \ |
| 3357 | -cert data_files/server2.ku-ds.crt" \ |
| 3358 | "$P_CLI debug_level=1 auth_mode=optional \ |
| 3359 | force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| 3360 | 0 \ |
| 3361 | -c "bad certificate (usage extensions)" \ |
| 3362 | -C "Processing of the Certificate handshake message failed" \ |
| 3363 | -c "Ciphersuite is TLS-" \ |
| 3364 | -c "! Usage does not match the keyUsage extension" |
| 3365 | |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 3366 | # Tests for keyUsage in leaf certificates, part 3: |
| 3367 | # server-side checking of client cert |
| 3368 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3369 | run_test "keyUsage cli-auth: RSA, DigitalSignature: OK" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 3370 | "$P_SRV debug_level=1 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 3371 | "$O_CLI -key data_files/server2.key \ |
| 3372 | -cert data_files/server2.ku-ds.crt" \ |
| 3373 | 0 \ |
| 3374 | -S "bad certificate (usage extensions)" \ |
| 3375 | -S "Processing of the Certificate handshake message failed" |
| 3376 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3377 | run_test "keyUsage cli-auth: RSA, KeyEncipherment: fail (soft)" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 3378 | "$P_SRV debug_level=1 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 3379 | "$O_CLI -key data_files/server2.key \ |
| 3380 | -cert data_files/server2.ku-ke.crt" \ |
| 3381 | 0 \ |
| 3382 | -s "bad certificate (usage extensions)" \ |
| 3383 | -S "Processing of the Certificate handshake message failed" |
| 3384 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3385 | run_test "keyUsage cli-auth: RSA, KeyEncipherment: fail (hard)" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 3386 | "$P_SRV debug_level=1 auth_mode=required" \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 3387 | "$O_CLI -key data_files/server2.key \ |
| 3388 | -cert data_files/server2.ku-ke.crt" \ |
| 3389 | 1 \ |
| 3390 | -s "bad certificate (usage extensions)" \ |
| 3391 | -s "Processing of the Certificate handshake message failed" |
| 3392 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3393 | run_test "keyUsage cli-auth: ECDSA, DigitalSignature: OK" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 3394 | "$P_SRV debug_level=1 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 3395 | "$O_CLI -key data_files/server5.key \ |
| 3396 | -cert data_files/server5.ku-ds.crt" \ |
| 3397 | 0 \ |
| 3398 | -S "bad certificate (usage extensions)" \ |
| 3399 | -S "Processing of the Certificate handshake message failed" |
| 3400 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3401 | run_test "keyUsage cli-auth: ECDSA, KeyAgreement: fail (soft)" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 3402 | "$P_SRV debug_level=1 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 3403 | "$O_CLI -key data_files/server5.key \ |
| 3404 | -cert data_files/server5.ku-ka.crt" \ |
| 3405 | 0 \ |
| 3406 | -s "bad certificate (usage extensions)" \ |
| 3407 | -S "Processing of the Certificate handshake message failed" |
| 3408 | |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 3409 | # Tests for extendedKeyUsage, part 1: server-side certificate/suite selection |
| 3410 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3411 | run_test "extKeyUsage srv: serverAuth -> OK" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 3412 | "$P_SRV key_file=data_files/server5.key \ |
| 3413 | crt_file=data_files/server5.eku-srv.crt" \ |
| 3414 | "$P_CLI" \ |
| 3415 | 0 |
| 3416 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3417 | run_test "extKeyUsage srv: serverAuth,clientAuth -> OK" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 3418 | "$P_SRV key_file=data_files/server5.key \ |
| 3419 | crt_file=data_files/server5.eku-srv.crt" \ |
| 3420 | "$P_CLI" \ |
| 3421 | 0 |
| 3422 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3423 | run_test "extKeyUsage srv: codeSign,anyEKU -> OK" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 3424 | "$P_SRV key_file=data_files/server5.key \ |
| 3425 | crt_file=data_files/server5.eku-cs_any.crt" \ |
| 3426 | "$P_CLI" \ |
| 3427 | 0 |
| 3428 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3429 | run_test "extKeyUsage srv: codeSign -> fail" \ |
Manuel Pégourié-Gonnard | 7eb58cb | 2015-07-07 11:54:14 +0200 | [diff] [blame] | 3430 | "$P_SRV key_file=data_files/server5.key \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 3431 | crt_file=data_files/server5.eku-cli.crt" \ |
Manuel Pégourié-Gonnard | 7eb58cb | 2015-07-07 11:54:14 +0200 | [diff] [blame] | 3432 | "$P_CLI" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 3433 | 1 |
| 3434 | |
| 3435 | # Tests for extendedKeyUsage, part 2: client-side checking of server cert |
| 3436 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3437 | run_test "extKeyUsage cli: serverAuth -> OK" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 3438 | "$O_SRV -key data_files/server5.key \ |
| 3439 | -cert data_files/server5.eku-srv.crt" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 3440 | "$P_CLI debug_level=1" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 3441 | 0 \ |
| 3442 | -C "bad certificate (usage extensions)" \ |
| 3443 | -C "Processing of the Certificate handshake message failed" \ |
| 3444 | -c "Ciphersuite is TLS-" |
| 3445 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3446 | run_test "extKeyUsage cli: serverAuth,clientAuth -> OK" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 3447 | "$O_SRV -key data_files/server5.key \ |
| 3448 | -cert data_files/server5.eku-srv_cli.crt" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 3449 | "$P_CLI debug_level=1" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 3450 | 0 \ |
| 3451 | -C "bad certificate (usage extensions)" \ |
| 3452 | -C "Processing of the Certificate handshake message failed" \ |
| 3453 | -c "Ciphersuite is TLS-" |
| 3454 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3455 | run_test "extKeyUsage cli: codeSign,anyEKU -> OK" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 3456 | "$O_SRV -key data_files/server5.key \ |
| 3457 | -cert data_files/server5.eku-cs_any.crt" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 3458 | "$P_CLI debug_level=1" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 3459 | 0 \ |
| 3460 | -C "bad certificate (usage extensions)" \ |
| 3461 | -C "Processing of the Certificate handshake message failed" \ |
| 3462 | -c "Ciphersuite is TLS-" |
| 3463 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3464 | run_test "extKeyUsage cli: codeSign -> fail" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 3465 | "$O_SRV -key data_files/server5.key \ |
| 3466 | -cert data_files/server5.eku-cs.crt" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 3467 | "$P_CLI debug_level=1" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 3468 | 1 \ |
| 3469 | -c "bad certificate (usage extensions)" \ |
| 3470 | -c "Processing of the Certificate handshake message failed" \ |
| 3471 | -C "Ciphersuite is TLS-" |
| 3472 | |
| 3473 | # Tests for extendedKeyUsage, part 3: server-side checking of client cert |
| 3474 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3475 | run_test "extKeyUsage cli-auth: clientAuth -> OK" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 3476 | "$P_SRV debug_level=1 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 3477 | "$O_CLI -key data_files/server5.key \ |
| 3478 | -cert data_files/server5.eku-cli.crt" \ |
| 3479 | 0 \ |
| 3480 | -S "bad certificate (usage extensions)" \ |
| 3481 | -S "Processing of the Certificate handshake message failed" |
| 3482 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3483 | run_test "extKeyUsage cli-auth: serverAuth,clientAuth -> OK" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 3484 | "$P_SRV debug_level=1 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 3485 | "$O_CLI -key data_files/server5.key \ |
| 3486 | -cert data_files/server5.eku-srv_cli.crt" \ |
| 3487 | 0 \ |
| 3488 | -S "bad certificate (usage extensions)" \ |
| 3489 | -S "Processing of the Certificate handshake message failed" |
| 3490 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3491 | run_test "extKeyUsage cli-auth: codeSign,anyEKU -> OK" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 3492 | "$P_SRV debug_level=1 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 3493 | "$O_CLI -key data_files/server5.key \ |
| 3494 | -cert data_files/server5.eku-cs_any.crt" \ |
| 3495 | 0 \ |
| 3496 | -S "bad certificate (usage extensions)" \ |
| 3497 | -S "Processing of the Certificate handshake message failed" |
| 3498 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3499 | run_test "extKeyUsage cli-auth: codeSign -> fail (soft)" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 3500 | "$P_SRV debug_level=1 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 3501 | "$O_CLI -key data_files/server5.key \ |
| 3502 | -cert data_files/server5.eku-cs.crt" \ |
| 3503 | 0 \ |
| 3504 | -s "bad certificate (usage extensions)" \ |
| 3505 | -S "Processing of the Certificate handshake message failed" |
| 3506 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3507 | run_test "extKeyUsage cli-auth: codeSign -> fail (hard)" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 3508 | "$P_SRV debug_level=1 auth_mode=required" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 3509 | "$O_CLI -key data_files/server5.key \ |
| 3510 | -cert data_files/server5.eku-cs.crt" \ |
| 3511 | 1 \ |
| 3512 | -s "bad certificate (usage extensions)" \ |
| 3513 | -s "Processing of the Certificate handshake message failed" |
| 3514 | |
Manuel Pégourié-Gonnard | 0cc7e31 | 2014-06-09 11:36:47 +0200 | [diff] [blame] | 3515 | # Tests for DHM parameters loading |
| 3516 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3517 | run_test "DHM parameters: reference" \ |
Manuel Pégourié-Gonnard | 0cc7e31 | 2014-06-09 11:36:47 +0200 | [diff] [blame] | 3518 | "$P_SRV" \ |
| 3519 | "$P_CLI force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA \ |
| 3520 | debug_level=3" \ |
| 3521 | 0 \ |
| 3522 | -c "value of 'DHM: P ' (2048 bits)" \ |
Hanno Becker | 13be990 | 2017-09-27 17:17:30 +0100 | [diff] [blame] | 3523 | -c "value of 'DHM: G ' (2 bits)" |
Manuel Pégourié-Gonnard | 0cc7e31 | 2014-06-09 11:36:47 +0200 | [diff] [blame] | 3524 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3525 | run_test "DHM parameters: other parameters" \ |
Manuel Pégourié-Gonnard | 0cc7e31 | 2014-06-09 11:36:47 +0200 | [diff] [blame] | 3526 | "$P_SRV dhm_file=data_files/dhparams.pem" \ |
| 3527 | "$P_CLI force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA \ |
| 3528 | debug_level=3" \ |
| 3529 | 0 \ |
| 3530 | -c "value of 'DHM: P ' (1024 bits)" \ |
| 3531 | -c "value of 'DHM: G ' (2 bits)" |
| 3532 | |
Manuel Pégourié-Gonnard | 7a010aa | 2015-06-12 11:19:10 +0200 | [diff] [blame] | 3533 | # Tests for DHM client-side size checking |
| 3534 | |
| 3535 | run_test "DHM size: server default, client default, OK" \ |
| 3536 | "$P_SRV" \ |
| 3537 | "$P_CLI force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA \ |
| 3538 | debug_level=1" \ |
| 3539 | 0 \ |
| 3540 | -C "DHM prime too short:" |
| 3541 | |
| 3542 | run_test "DHM size: server default, client 2048, OK" \ |
| 3543 | "$P_SRV" \ |
| 3544 | "$P_CLI force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA \ |
| 3545 | debug_level=1 dhmlen=2048" \ |
| 3546 | 0 \ |
| 3547 | -C "DHM prime too short:" |
| 3548 | |
| 3549 | run_test "DHM size: server 1024, client default, OK" \ |
| 3550 | "$P_SRV dhm_file=data_files/dhparams.pem" \ |
| 3551 | "$P_CLI force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA \ |
| 3552 | debug_level=1" \ |
| 3553 | 0 \ |
| 3554 | -C "DHM prime too short:" |
| 3555 | |
| 3556 | run_test "DHM size: server 1000, client default, rejected" \ |
| 3557 | "$P_SRV dhm_file=data_files/dh.1000.pem" \ |
| 3558 | "$P_CLI force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA \ |
| 3559 | debug_level=1" \ |
| 3560 | 1 \ |
| 3561 | -c "DHM prime too short:" |
| 3562 | |
| 3563 | run_test "DHM size: server default, client 2049, rejected" \ |
| 3564 | "$P_SRV" \ |
| 3565 | "$P_CLI force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA \ |
| 3566 | debug_level=1 dhmlen=2049" \ |
| 3567 | 1 \ |
| 3568 | -c "DHM prime too short:" |
| 3569 | |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 3570 | # Tests for PSK callback |
| 3571 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3572 | run_test "PSK callback: psk, no callback" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 3573 | "$P_SRV psk=abc123 psk_identity=foo" \ |
| 3574 | "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \ |
| 3575 | psk_identity=foo psk=abc123" \ |
| 3576 | 0 \ |
Manuel Pégourié-Gonnard | f01768c | 2015-01-08 17:06:16 +0100 | [diff] [blame] | 3577 | -S "SSL - None of the common ciphersuites is usable" \ |
Manuel Pégourié-Gonnard | 10c3c9f | 2014-06-10 15:28:52 +0200 | [diff] [blame] | 3578 | -S "SSL - Unknown identity received" \ |
| 3579 | -S "SSL - Verification of the message MAC failed" |
| 3580 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3581 | run_test "PSK callback: no psk, no callback" \ |
Manuel Pégourié-Gonnard | 10c3c9f | 2014-06-10 15:28:52 +0200 | [diff] [blame] | 3582 | "$P_SRV" \ |
| 3583 | "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \ |
| 3584 | psk_identity=foo psk=abc123" \ |
| 3585 | 1 \ |
Manuel Pégourié-Gonnard | f01768c | 2015-01-08 17:06:16 +0100 | [diff] [blame] | 3586 | -s "SSL - None of the common ciphersuites is usable" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 3587 | -S "SSL - Unknown identity received" \ |
| 3588 | -S "SSL - Verification of the message MAC failed" |
| 3589 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3590 | run_test "PSK callback: callback overrides other settings" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 3591 | "$P_SRV psk=abc123 psk_identity=foo psk_list=abc,dead,def,beef" \ |
| 3592 | "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \ |
| 3593 | psk_identity=foo psk=abc123" \ |
| 3594 | 1 \ |
Manuel Pégourié-Gonnard | f01768c | 2015-01-08 17:06:16 +0100 | [diff] [blame] | 3595 | -S "SSL - None of the common ciphersuites is usable" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 3596 | -s "SSL - Unknown identity received" \ |
| 3597 | -S "SSL - Verification of the message MAC failed" |
| 3598 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3599 | run_test "PSK callback: first id matches" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 3600 | "$P_SRV psk_list=abc,dead,def,beef" \ |
| 3601 | "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \ |
| 3602 | psk_identity=abc psk=dead" \ |
| 3603 | 0 \ |
Manuel Pégourié-Gonnard | f01768c | 2015-01-08 17:06:16 +0100 | [diff] [blame] | 3604 | -S "SSL - None of the common ciphersuites is usable" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 3605 | -S "SSL - Unknown identity received" \ |
| 3606 | -S "SSL - Verification of the message MAC failed" |
| 3607 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3608 | run_test "PSK callback: second id matches" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 3609 | "$P_SRV psk_list=abc,dead,def,beef" \ |
| 3610 | "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \ |
| 3611 | psk_identity=def psk=beef" \ |
| 3612 | 0 \ |
Manuel Pégourié-Gonnard | f01768c | 2015-01-08 17:06:16 +0100 | [diff] [blame] | 3613 | -S "SSL - None of the common ciphersuites is usable" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 3614 | -S "SSL - Unknown identity received" \ |
| 3615 | -S "SSL - Verification of the message MAC failed" |
| 3616 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3617 | run_test "PSK callback: no match" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 3618 | "$P_SRV psk_list=abc,dead,def,beef" \ |
| 3619 | "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \ |
| 3620 | psk_identity=ghi psk=beef" \ |
| 3621 | 1 \ |
Manuel Pégourié-Gonnard | f01768c | 2015-01-08 17:06:16 +0100 | [diff] [blame] | 3622 | -S "SSL - None of the common ciphersuites is usable" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 3623 | -s "SSL - Unknown identity received" \ |
| 3624 | -S "SSL - Verification of the message MAC failed" |
| 3625 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3626 | run_test "PSK callback: wrong key" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 3627 | "$P_SRV psk_list=abc,dead,def,beef" \ |
| 3628 | "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \ |
| 3629 | psk_identity=abc psk=beef" \ |
| 3630 | 1 \ |
Manuel Pégourié-Gonnard | f01768c | 2015-01-08 17:06:16 +0100 | [diff] [blame] | 3631 | -S "SSL - None of the common ciphersuites is usable" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 3632 | -S "SSL - Unknown identity received" \ |
| 3633 | -s "SSL - Verification of the message MAC failed" |
Manuel Pégourié-Gonnard | 0cc7e31 | 2014-06-09 11:36:47 +0200 | [diff] [blame] | 3634 | |
Manuel Pégourié-Gonnard | e511b4e | 2015-09-16 14:11:09 +0200 | [diff] [blame] | 3635 | # Tests for EC J-PAKE |
| 3636 | |
Manuel Pégourié-Gonnard | 12ca6f5 | 2015-10-20 15:24:51 +0200 | [diff] [blame] | 3637 | requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE |
Manuel Pégourié-Gonnard | e511b4e | 2015-09-16 14:11:09 +0200 | [diff] [blame] | 3638 | run_test "ECJPAKE: client not configured" \ |
| 3639 | "$P_SRV debug_level=3" \ |
| 3640 | "$P_CLI debug_level=3" \ |
| 3641 | 0 \ |
| 3642 | -C "add ciphersuite: c0ff" \ |
| 3643 | -C "adding ecjpake_kkpp extension" \ |
Manuel Pégourié-Gonnard | bf57be6 | 2015-09-16 15:04:01 +0200 | [diff] [blame] | 3644 | -S "found ecjpake kkpp extension" \ |
| 3645 | -S "skip ecjpake kkpp extension" \ |
Manuel Pégourié-Gonnard | e511b4e | 2015-09-16 14:11:09 +0200 | [diff] [blame] | 3646 | -S "ciphersuite mismatch: ecjpake not configured" \ |
Manuel Pégourié-Gonnard | 55c7f99 | 2015-09-16 15:35:27 +0200 | [diff] [blame] | 3647 | -S "server hello, ecjpake kkpp extension" \ |
Manuel Pégourié-Gonnard | 0a1324a | 2015-09-16 16:01:00 +0200 | [diff] [blame] | 3648 | -C "found ecjpake_kkpp extension" \ |
Manuel Pégourié-Gonnard | e511b4e | 2015-09-16 14:11:09 +0200 | [diff] [blame] | 3649 | -S "None of the common ciphersuites is usable" |
| 3650 | |
Manuel Pégourié-Gonnard | 12ca6f5 | 2015-10-20 15:24:51 +0200 | [diff] [blame] | 3651 | requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE |
Manuel Pégourié-Gonnard | e511b4e | 2015-09-16 14:11:09 +0200 | [diff] [blame] | 3652 | run_test "ECJPAKE: server not configured" \ |
| 3653 | "$P_SRV debug_level=3" \ |
| 3654 | "$P_CLI debug_level=3 ecjpake_pw=bla \ |
| 3655 | force_ciphersuite=TLS-ECJPAKE-WITH-AES-128-CCM-8" \ |
| 3656 | 1 \ |
| 3657 | -c "add ciphersuite: c0ff" \ |
| 3658 | -c "adding ecjpake_kkpp extension" \ |
Manuel Pégourié-Gonnard | bf57be6 | 2015-09-16 15:04:01 +0200 | [diff] [blame] | 3659 | -s "found ecjpake kkpp extension" \ |
| 3660 | -s "skip ecjpake kkpp extension" \ |
Manuel Pégourié-Gonnard | e511b4e | 2015-09-16 14:11:09 +0200 | [diff] [blame] | 3661 | -s "ciphersuite mismatch: ecjpake not configured" \ |
Manuel Pégourié-Gonnard | 55c7f99 | 2015-09-16 15:35:27 +0200 | [diff] [blame] | 3662 | -S "server hello, ecjpake kkpp extension" \ |
Manuel Pégourié-Gonnard | 0a1324a | 2015-09-16 16:01:00 +0200 | [diff] [blame] | 3663 | -C "found ecjpake_kkpp extension" \ |
Manuel Pégourié-Gonnard | e511b4e | 2015-09-16 14:11:09 +0200 | [diff] [blame] | 3664 | -s "None of the common ciphersuites is usable" |
| 3665 | |
Manuel Pégourié-Gonnard | 12ca6f5 | 2015-10-20 15:24:51 +0200 | [diff] [blame] | 3666 | requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE |
Manuel Pégourié-Gonnard | bf57be6 | 2015-09-16 15:04:01 +0200 | [diff] [blame] | 3667 | run_test "ECJPAKE: working, TLS" \ |
| 3668 | "$P_SRV debug_level=3 ecjpake_pw=bla" \ |
| 3669 | "$P_CLI debug_level=3 ecjpake_pw=bla \ |
| 3670 | force_ciphersuite=TLS-ECJPAKE-WITH-AES-128-CCM-8" \ |
Manuel Pégourié-Gonnard | 0f1660a | 2015-09-16 22:41:06 +0200 | [diff] [blame] | 3671 | 0 \ |
Manuel Pégourié-Gonnard | bf57be6 | 2015-09-16 15:04:01 +0200 | [diff] [blame] | 3672 | -c "add ciphersuite: c0ff" \ |
| 3673 | -c "adding ecjpake_kkpp extension" \ |
Manuel Pégourié-Gonnard | d0d8cb3 | 2015-09-17 14:16:30 +0200 | [diff] [blame] | 3674 | -C "re-using cached ecjpake parameters" \ |
Manuel Pégourié-Gonnard | bf57be6 | 2015-09-16 15:04:01 +0200 | [diff] [blame] | 3675 | -s "found ecjpake kkpp extension" \ |
| 3676 | -S "skip ecjpake kkpp extension" \ |
| 3677 | -S "ciphersuite mismatch: ecjpake not configured" \ |
Manuel Pégourié-Gonnard | 55c7f99 | 2015-09-16 15:35:27 +0200 | [diff] [blame] | 3678 | -s "server hello, ecjpake kkpp extension" \ |
Manuel Pégourié-Gonnard | 0a1324a | 2015-09-16 16:01:00 +0200 | [diff] [blame] | 3679 | -c "found ecjpake_kkpp extension" \ |
Manuel Pégourié-Gonnard | 921f2d0 | 2015-09-16 22:52:18 +0200 | [diff] [blame] | 3680 | -S "None of the common ciphersuites is usable" \ |
| 3681 | -S "SSL - Verification of the message MAC failed" |
| 3682 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 3683 | server_needs_more_time 1 |
Manuel Pégourié-Gonnard | 12ca6f5 | 2015-10-20 15:24:51 +0200 | [diff] [blame] | 3684 | requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE |
Manuel Pégourié-Gonnard | 921f2d0 | 2015-09-16 22:52:18 +0200 | [diff] [blame] | 3685 | run_test "ECJPAKE: password mismatch, TLS" \ |
| 3686 | "$P_SRV debug_level=3 ecjpake_pw=bla" \ |
| 3687 | "$P_CLI debug_level=3 ecjpake_pw=bad \ |
| 3688 | force_ciphersuite=TLS-ECJPAKE-WITH-AES-128-CCM-8" \ |
| 3689 | 1 \ |
Manuel Pégourié-Gonnard | d0d8cb3 | 2015-09-17 14:16:30 +0200 | [diff] [blame] | 3690 | -C "re-using cached ecjpake parameters" \ |
Manuel Pégourié-Gonnard | 921f2d0 | 2015-09-16 22:52:18 +0200 | [diff] [blame] | 3691 | -s "SSL - Verification of the message MAC failed" |
| 3692 | |
Manuel Pégourié-Gonnard | 12ca6f5 | 2015-10-20 15:24:51 +0200 | [diff] [blame] | 3693 | requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE |
Manuel Pégourié-Gonnard | 921f2d0 | 2015-09-16 22:52:18 +0200 | [diff] [blame] | 3694 | run_test "ECJPAKE: working, DTLS" \ |
| 3695 | "$P_SRV debug_level=3 dtls=1 ecjpake_pw=bla" \ |
| 3696 | "$P_CLI debug_level=3 dtls=1 ecjpake_pw=bla \ |
| 3697 | force_ciphersuite=TLS-ECJPAKE-WITH-AES-128-CCM-8" \ |
| 3698 | 0 \ |
Manuel Pégourié-Gonnard | d0d8cb3 | 2015-09-17 14:16:30 +0200 | [diff] [blame] | 3699 | -c "re-using cached ecjpake parameters" \ |
| 3700 | -S "SSL - Verification of the message MAC failed" |
| 3701 | |
Manuel Pégourié-Gonnard | 12ca6f5 | 2015-10-20 15:24:51 +0200 | [diff] [blame] | 3702 | requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE |
Manuel Pégourié-Gonnard | d0d8cb3 | 2015-09-17 14:16:30 +0200 | [diff] [blame] | 3703 | run_test "ECJPAKE: working, DTLS, no cookie" \ |
| 3704 | "$P_SRV debug_level=3 dtls=1 ecjpake_pw=bla cookies=0" \ |
| 3705 | "$P_CLI debug_level=3 dtls=1 ecjpake_pw=bla \ |
| 3706 | force_ciphersuite=TLS-ECJPAKE-WITH-AES-128-CCM-8" \ |
| 3707 | 0 \ |
| 3708 | -C "re-using cached ecjpake parameters" \ |
Manuel Pégourié-Gonnard | 921f2d0 | 2015-09-16 22:52:18 +0200 | [diff] [blame] | 3709 | -S "SSL - Verification of the message MAC failed" |
| 3710 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 3711 | server_needs_more_time 1 |
Manuel Pégourié-Gonnard | 12ca6f5 | 2015-10-20 15:24:51 +0200 | [diff] [blame] | 3712 | requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE |
Manuel Pégourié-Gonnard | 921f2d0 | 2015-09-16 22:52:18 +0200 | [diff] [blame] | 3713 | run_test "ECJPAKE: password mismatch, DTLS" \ |
| 3714 | "$P_SRV debug_level=3 dtls=1 ecjpake_pw=bla" \ |
| 3715 | "$P_CLI debug_level=3 dtls=1 ecjpake_pw=bad \ |
| 3716 | force_ciphersuite=TLS-ECJPAKE-WITH-AES-128-CCM-8" \ |
| 3717 | 1 \ |
Manuel Pégourié-Gonnard | d0d8cb3 | 2015-09-17 14:16:30 +0200 | [diff] [blame] | 3718 | -c "re-using cached ecjpake parameters" \ |
Manuel Pégourié-Gonnard | 921f2d0 | 2015-09-16 22:52:18 +0200 | [diff] [blame] | 3719 | -s "SSL - Verification of the message MAC failed" |
Manuel Pégourié-Gonnard | bf57be6 | 2015-09-16 15:04:01 +0200 | [diff] [blame] | 3720 | |
Manuel Pégourié-Gonnard | ca700b2 | 2015-10-20 14:47:00 +0200 | [diff] [blame] | 3721 | # for tests with configs/config-thread.h |
Manuel Pégourié-Gonnard | 12ca6f5 | 2015-10-20 15:24:51 +0200 | [diff] [blame] | 3722 | requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE |
Manuel Pégourié-Gonnard | ca700b2 | 2015-10-20 14:47:00 +0200 | [diff] [blame] | 3723 | run_test "ECJPAKE: working, DTLS, nolog" \ |
| 3724 | "$P_SRV dtls=1 ecjpake_pw=bla" \ |
| 3725 | "$P_CLI dtls=1 ecjpake_pw=bla \ |
| 3726 | force_ciphersuite=TLS-ECJPAKE-WITH-AES-128-CCM-8" \ |
| 3727 | 0 |
| 3728 | |
Manuel Pégourié-Gonnard | 90805a8 | 2014-06-11 14:06:01 +0200 | [diff] [blame] | 3729 | # Tests for ciphersuites per version |
| 3730 | |
Janos Follath | e2681a4 | 2016-03-07 15:57:05 +0000 | [diff] [blame] | 3731 | requires_config_enabled MBEDTLS_SSL_PROTO_SSL3 |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3732 | run_test "Per-version suites: SSL3" \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 3733 | "$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] | 3734 | "$P_CLI force_version=ssl3" \ |
| 3735 | 0 \ |
| 3736 | -c "Ciphersuite is TLS-RSA-WITH-3DES-EDE-CBC-SHA" |
| 3737 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3738 | run_test "Per-version suites: TLS 1.0" \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 3739 | "$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] | 3740 | "$P_CLI force_version=tls1 arc4=1" \ |
Manuel Pégourié-Gonnard | 90805a8 | 2014-06-11 14:06:01 +0200 | [diff] [blame] | 3741 | 0 \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 3742 | -c "Ciphersuite is TLS-RSA-WITH-AES-256-CBC-SHA" |
Manuel Pégourié-Gonnard | 90805a8 | 2014-06-11 14:06:01 +0200 | [diff] [blame] | 3743 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3744 | run_test "Per-version suites: TLS 1.1" \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 3745 | "$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] | 3746 | "$P_CLI force_version=tls1_1" \ |
| 3747 | 0 \ |
| 3748 | -c "Ciphersuite is TLS-RSA-WITH-AES-128-CBC-SHA" |
| 3749 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 3750 | run_test "Per-version suites: TLS 1.2" \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 3751 | "$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] | 3752 | "$P_CLI force_version=tls1_2" \ |
| 3753 | 0 \ |
| 3754 | -c "Ciphersuite is TLS-RSA-WITH-AES-128-GCM-SHA256" |
| 3755 | |
Manuel Pégourié-Gonnard | 4cc8c63 | 2015-07-23 12:24:03 +0200 | [diff] [blame] | 3756 | # Test for ClientHello without extensions |
| 3757 | |
Manuel Pégourié-Gonnard | d55bc20 | 2015-08-04 16:22:30 +0200 | [diff] [blame] | 3758 | requires_gnutls |
Gilles Peskine | 5d2511c | 2017-05-12 13:16:40 +0200 | [diff] [blame] | 3759 | run_test "ClientHello without extensions, SHA-1 allowed" \ |
Manuel Pégourié-Gonnard | 4cc8c63 | 2015-07-23 12:24:03 +0200 | [diff] [blame] | 3760 | "$P_SRV debug_level=3" \ |
| 3761 | "$G_CLI --priority=NORMAL:%NO_EXTENSIONS:%DISABLE_SAFE_RENEGOTIATION" \ |
| 3762 | 0 \ |
| 3763 | -s "dumping 'client hello extensions' (0 bytes)" |
| 3764 | |
Gilles Peskine | 5d2511c | 2017-05-12 13:16:40 +0200 | [diff] [blame] | 3765 | requires_gnutls |
| 3766 | run_test "ClientHello without extensions, SHA-1 forbidden in certificates on server" \ |
| 3767 | "$P_SRV debug_level=3 key_file=data_files/server2.key crt_file=data_files/server2.crt allow_sha1=0" \ |
| 3768 | "$G_CLI --priority=NORMAL:%NO_EXTENSIONS:%DISABLE_SAFE_RENEGOTIATION" \ |
| 3769 | 0 \ |
| 3770 | -s "dumping 'client hello extensions' (0 bytes)" |
| 3771 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 3772 | # Tests for mbedtls_ssl_get_bytes_avail() |
Manuel Pégourié-Gonnard | 95c0a63 | 2014-06-11 18:32:36 +0200 | [diff] [blame] | 3773 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 3774 | run_test "mbedtls_ssl_get_bytes_avail: no extra data" \ |
Manuel Pégourié-Gonnard | 95c0a63 | 2014-06-11 18:32:36 +0200 | [diff] [blame] | 3775 | "$P_SRV" \ |
| 3776 | "$P_CLI request_size=100" \ |
| 3777 | 0 \ |
| 3778 | -s "Read from client: 100 bytes read$" |
| 3779 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 3780 | run_test "mbedtls_ssl_get_bytes_avail: extra data" \ |
Manuel Pégourié-Gonnard | 95c0a63 | 2014-06-11 18:32:36 +0200 | [diff] [blame] | 3781 | "$P_SRV" \ |
| 3782 | "$P_CLI request_size=500" \ |
| 3783 | 0 \ |
| 3784 | -s "Read from client: 500 bytes read (.*+.*)" |
Manuel Pégourié-Gonnard | 90805a8 | 2014-06-11 14:06:01 +0200 | [diff] [blame] | 3785 | |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3786 | # Tests for small packets |
| 3787 | |
Janos Follath | e2681a4 | 2016-03-07 15:57:05 +0000 | [diff] [blame] | 3788 | requires_config_enabled MBEDTLS_SSL_PROTO_SSL3 |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3789 | run_test "Small packet SSLv3 BlockCipher" \ |
Manuel Pégourié-Gonnard | 448ea50 | 2015-01-12 11:40:14 +0100 | [diff] [blame] | 3790 | "$P_SRV min_version=ssl3" \ |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3791 | "$P_CLI request_size=1 force_version=ssl3 \ |
| 3792 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 3793 | 0 \ |
| 3794 | -s "Read from client: 1 bytes read" |
| 3795 | |
Janos Follath | e2681a4 | 2016-03-07 15:57:05 +0000 | [diff] [blame] | 3796 | requires_config_enabled MBEDTLS_SSL_PROTO_SSL3 |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3797 | run_test "Small packet SSLv3 StreamCipher" \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 3798 | "$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] | 3799 | "$P_CLI request_size=1 force_version=ssl3 \ |
| 3800 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 3801 | 0 \ |
| 3802 | -s "Read from client: 1 bytes read" |
| 3803 | |
| 3804 | run_test "Small packet TLS 1.0 BlockCipher" \ |
| 3805 | "$P_SRV" \ |
| 3806 | "$P_CLI request_size=1 force_version=tls1 \ |
| 3807 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 3808 | 0 \ |
| 3809 | -s "Read from client: 1 bytes read" |
| 3810 | |
Hanno Becker | 8501f98 | 2017-11-10 08:59:04 +0000 | [diff] [blame] | 3811 | run_test "Small packet TLS 1.0 BlockCipher, without EtM" \ |
Manuel Pégourié-Gonnard | 169dd6a | 2014-11-04 16:15:39 +0100 | [diff] [blame] | 3812 | "$P_SRV" \ |
| 3813 | "$P_CLI request_size=1 force_version=tls1 etm=0 \ |
| 3814 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 3815 | 0 \ |
| 3816 | -s "Read from client: 1 bytes read" |
| 3817 | |
Hanno Becker | 32c5501 | 2017-11-10 08:42:54 +0000 | [diff] [blame] | 3818 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
Hanno Becker | 8501f98 | 2017-11-10 08:59:04 +0000 | [diff] [blame] | 3819 | run_test "Small packet TLS 1.0 BlockCipher, truncated MAC" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 3820 | "$P_SRV trunc_hmac=1" \ |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3821 | "$P_CLI request_size=1 force_version=tls1 \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 3822 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1" \ |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3823 | 0 \ |
| 3824 | -s "Read from client: 1 bytes read" |
| 3825 | |
Hanno Becker | 32c5501 | 2017-11-10 08:42:54 +0000 | [diff] [blame] | 3826 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
Hanno Becker | 8501f98 | 2017-11-10 08:59:04 +0000 | [diff] [blame] | 3827 | run_test "Small packet TLS 1.0 BlockCipher, without EtM, truncated MAC" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 3828 | "$P_SRV trunc_hmac=1" \ |
Hanno Becker | 8501f98 | 2017-11-10 08:59:04 +0000 | [diff] [blame] | 3829 | "$P_CLI request_size=1 force_version=tls1 \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 3830 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1 etm=0" \ |
Hanno Becker | 8501f98 | 2017-11-10 08:59:04 +0000 | [diff] [blame] | 3831 | 0 \ |
| 3832 | -s "Read from client: 1 bytes read" |
| 3833 | |
| 3834 | run_test "Small packet TLS 1.0 StreamCipher" \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 3835 | "$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] | 3836 | "$P_CLI request_size=1 force_version=tls1 \ |
Hanno Becker | 8501f98 | 2017-11-10 08:59:04 +0000 | [diff] [blame] | 3837 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 3838 | 0 \ |
| 3839 | -s "Read from client: 1 bytes read" |
| 3840 | |
| 3841 | run_test "Small packet TLS 1.0 StreamCipher, without EtM" \ |
| 3842 | "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 3843 | "$P_CLI request_size=1 force_version=tls1 \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 3844 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA etm=0" \ |
Hanno Becker | 8501f98 | 2017-11-10 08:59:04 +0000 | [diff] [blame] | 3845 | 0 \ |
| 3846 | -s "Read from client: 1 bytes read" |
| 3847 | |
| 3848 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
| 3849 | run_test "Small packet TLS 1.0 StreamCipher, truncated MAC" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 3850 | "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \ |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3851 | "$P_CLI request_size=1 force_version=tls1 \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 3852 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \ |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3853 | 0 \ |
| 3854 | -s "Read from client: 1 bytes read" |
| 3855 | |
Hanno Becker | 8501f98 | 2017-11-10 08:59:04 +0000 | [diff] [blame] | 3856 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
| 3857 | run_test "Small packet TLS 1.0 StreamCipher, without EtM, truncated MAC" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 3858 | "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \ |
| 3859 | "$P_CLI request_size=1 force_version=tls1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \ |
| 3860 | trunc_hmac=1 etm=0" \ |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3861 | 0 \ |
| 3862 | -s "Read from client: 1 bytes read" |
| 3863 | |
| 3864 | run_test "Small packet TLS 1.1 BlockCipher" \ |
| 3865 | "$P_SRV" \ |
| 3866 | "$P_CLI request_size=1 force_version=tls1_1 \ |
| 3867 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 3868 | 0 \ |
| 3869 | -s "Read from client: 1 bytes read" |
| 3870 | |
Hanno Becker | 8501f98 | 2017-11-10 08:59:04 +0000 | [diff] [blame] | 3871 | run_test "Small packet TLS 1.1 BlockCipher, without EtM" \ |
Manuel Pégourié-Gonnard | 169dd6a | 2014-11-04 16:15:39 +0100 | [diff] [blame] | 3872 | "$P_SRV" \ |
Hanno Becker | 8501f98 | 2017-11-10 08:59:04 +0000 | [diff] [blame] | 3873 | "$P_CLI request_size=1 force_version=tls1_1 \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 3874 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA etm=0" \ |
Hanno Becker | 8501f98 | 2017-11-10 08:59:04 +0000 | [diff] [blame] | 3875 | 0 \ |
| 3876 | -s "Read from client: 1 bytes read" |
| 3877 | |
| 3878 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
| 3879 | run_test "Small packet TLS 1.1 BlockCipher, truncated MAC" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 3880 | "$P_SRV trunc_hmac=1" \ |
Hanno Becker | 8501f98 | 2017-11-10 08:59:04 +0000 | [diff] [blame] | 3881 | "$P_CLI request_size=1 force_version=tls1_1 \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 3882 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1" \ |
Hanno Becker | 8501f98 | 2017-11-10 08:59:04 +0000 | [diff] [blame] | 3883 | 0 \ |
| 3884 | -s "Read from client: 1 bytes read" |
| 3885 | |
| 3886 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
| 3887 | run_test "Small packet TLS 1.1 BlockCipher, without EtM, truncated MAC" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 3888 | "$P_SRV trunc_hmac=1" \ |
Hanno Becker | 8501f98 | 2017-11-10 08:59:04 +0000 | [diff] [blame] | 3889 | "$P_CLI request_size=1 force_version=tls1_1 \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 3890 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1 etm=0" \ |
Manuel Pégourié-Gonnard | 169dd6a | 2014-11-04 16:15:39 +0100 | [diff] [blame] | 3891 | 0 \ |
| 3892 | -s "Read from client: 1 bytes read" |
| 3893 | |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3894 | run_test "Small packet TLS 1.1 StreamCipher" \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 3895 | "$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] | 3896 | "$P_CLI request_size=1 force_version=tls1_1 \ |
| 3897 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 3898 | 0 \ |
| 3899 | -s "Read from client: 1 bytes read" |
| 3900 | |
Hanno Becker | 8501f98 | 2017-11-10 08:59:04 +0000 | [diff] [blame] | 3901 | run_test "Small packet TLS 1.1 StreamCipher, without EtM" \ |
| 3902 | "$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] | 3903 | "$P_CLI request_size=1 force_version=tls1_1 \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 3904 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA etm=0" \ |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3905 | 0 \ |
| 3906 | -s "Read from client: 1 bytes read" |
| 3907 | |
Hanno Becker | 8501f98 | 2017-11-10 08:59:04 +0000 | [diff] [blame] | 3908 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
| 3909 | run_test "Small packet TLS 1.1 StreamCipher, truncated MAC" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 3910 | "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \ |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3911 | "$P_CLI request_size=1 force_version=tls1_1 \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 3912 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \ |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3913 | 0 \ |
| 3914 | -s "Read from client: 1 bytes read" |
| 3915 | |
Hanno Becker | 32c5501 | 2017-11-10 08:42:54 +0000 | [diff] [blame] | 3916 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
Hanno Becker | 8501f98 | 2017-11-10 08:59:04 +0000 | [diff] [blame] | 3917 | run_test "Small packet TLS 1.1 StreamCipher, without EtM, truncated MAC" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 3918 | "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \ |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3919 | "$P_CLI request_size=1 force_version=tls1_1 \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 3920 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1 etm=0" \ |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3921 | 0 \ |
| 3922 | -s "Read from client: 1 bytes read" |
| 3923 | |
| 3924 | run_test "Small packet TLS 1.2 BlockCipher" \ |
| 3925 | "$P_SRV" \ |
| 3926 | "$P_CLI request_size=1 force_version=tls1_2 \ |
| 3927 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 3928 | 0 \ |
| 3929 | -s "Read from client: 1 bytes read" |
| 3930 | |
Hanno Becker | 8501f98 | 2017-11-10 08:59:04 +0000 | [diff] [blame] | 3931 | run_test "Small packet TLS 1.2 BlockCipher, without EtM" \ |
Manuel Pégourié-Gonnard | 169dd6a | 2014-11-04 16:15:39 +0100 | [diff] [blame] | 3932 | "$P_SRV" \ |
Hanno Becker | 8501f98 | 2017-11-10 08:59:04 +0000 | [diff] [blame] | 3933 | "$P_CLI request_size=1 force_version=tls1_2 \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 3934 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA etm=0" \ |
Manuel Pégourié-Gonnard | 169dd6a | 2014-11-04 16:15:39 +0100 | [diff] [blame] | 3935 | 0 \ |
| 3936 | -s "Read from client: 1 bytes read" |
| 3937 | |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3938 | run_test "Small packet TLS 1.2 BlockCipher larger MAC" \ |
| 3939 | "$P_SRV" \ |
Manuel Pégourié-Gonnard | c82ee35 | 2015-01-07 16:35:25 +0100 | [diff] [blame] | 3940 | "$P_CLI request_size=1 force_version=tls1_2 \ |
| 3941 | force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384" \ |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3942 | 0 \ |
| 3943 | -s "Read from client: 1 bytes read" |
| 3944 | |
Hanno Becker | 32c5501 | 2017-11-10 08:42:54 +0000 | [diff] [blame] | 3945 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
Hanno Becker | 8501f98 | 2017-11-10 08:59:04 +0000 | [diff] [blame] | 3946 | run_test "Small packet TLS 1.2 BlockCipher, truncated MAC" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 3947 | "$P_SRV trunc_hmac=1" \ |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3948 | "$P_CLI request_size=1 force_version=tls1_2 \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 3949 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1" \ |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3950 | 0 \ |
| 3951 | -s "Read from client: 1 bytes read" |
| 3952 | |
Hanno Becker | 8501f98 | 2017-11-10 08:59:04 +0000 | [diff] [blame] | 3953 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
| 3954 | run_test "Small packet TLS 1.2 BlockCipher, without EtM, truncated MAC" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 3955 | "$P_SRV trunc_hmac=1" \ |
Hanno Becker | 8501f98 | 2017-11-10 08:59:04 +0000 | [diff] [blame] | 3956 | "$P_CLI request_size=1 force_version=tls1_2 \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 3957 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1 etm=0" \ |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3958 | 0 \ |
| 3959 | -s "Read from client: 1 bytes read" |
| 3960 | |
| 3961 | run_test "Small packet TLS 1.2 StreamCipher" \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 3962 | "$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] | 3963 | "$P_CLI request_size=1 force_version=tls1_2 \ |
| 3964 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 3965 | 0 \ |
| 3966 | -s "Read from client: 1 bytes read" |
| 3967 | |
Hanno Becker | 8501f98 | 2017-11-10 08:59:04 +0000 | [diff] [blame] | 3968 | run_test "Small packet TLS 1.2 StreamCipher, without EtM" \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 3969 | "$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] | 3970 | "$P_CLI request_size=1 force_version=tls1_2 \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 3971 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA etm=0" \ |
Hanno Becker | 8501f98 | 2017-11-10 08:59:04 +0000 | [diff] [blame] | 3972 | 0 \ |
| 3973 | -s "Read from client: 1 bytes read" |
| 3974 | |
Hanno Becker | 32c5501 | 2017-11-10 08:42:54 +0000 | [diff] [blame] | 3975 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
Hanno Becker | 8501f98 | 2017-11-10 08:59:04 +0000 | [diff] [blame] | 3976 | run_test "Small packet TLS 1.2 StreamCipher, truncated MAC" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 3977 | "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \ |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3978 | "$P_CLI request_size=1 force_version=tls1_2 \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 3979 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \ |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3980 | 0 \ |
| 3981 | -s "Read from client: 1 bytes read" |
| 3982 | |
Hanno Becker | 8501f98 | 2017-11-10 08:59:04 +0000 | [diff] [blame] | 3983 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
| 3984 | run_test "Small packet TLS 1.2 StreamCipher, without EtM, truncated MAC" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 3985 | "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \ |
Hanno Becker | 8501f98 | 2017-11-10 08:59:04 +0000 | [diff] [blame] | 3986 | "$P_CLI request_size=1 force_version=tls1_2 \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 3987 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1 etm=0" \ |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 3988 | 0 \ |
| 3989 | -s "Read from client: 1 bytes read" |
| 3990 | |
| 3991 | run_test "Small packet TLS 1.2 AEAD" \ |
| 3992 | "$P_SRV" \ |
| 3993 | "$P_CLI request_size=1 force_version=tls1_2 \ |
| 3994 | force_ciphersuite=TLS-RSA-WITH-AES-256-CCM" \ |
| 3995 | 0 \ |
| 3996 | -s "Read from client: 1 bytes read" |
| 3997 | |
| 3998 | run_test "Small packet TLS 1.2 AEAD shorter tag" \ |
| 3999 | "$P_SRV" \ |
| 4000 | "$P_CLI request_size=1 force_version=tls1_2 \ |
| 4001 | force_ciphersuite=TLS-RSA-WITH-AES-256-CCM-8" \ |
| 4002 | 0 \ |
| 4003 | -s "Read from client: 1 bytes read" |
| 4004 | |
Hanno Becker | e214804 | 2017-11-10 08:59:18 +0000 | [diff] [blame] | 4005 | # Tests for small packets in DTLS |
| 4006 | |
| 4007 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 4008 | run_test "Small packet DTLS 1.0" \ |
| 4009 | "$P_SRV dtls=1 force_version=dtls1" \ |
| 4010 | "$P_CLI dtls=1 request_size=1 \ |
| 4011 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 4012 | 0 \ |
| 4013 | -s "Read from client: 1 bytes read" |
| 4014 | |
| 4015 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 4016 | run_test "Small packet DTLS 1.0, without EtM" \ |
| 4017 | "$P_SRV dtls=1 force_version=dtls1 etm=0" \ |
| 4018 | "$P_CLI dtls=1 request_size=1 \ |
| 4019 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 4020 | 0 \ |
| 4021 | -s "Read from client: 1 bytes read" |
| 4022 | |
| 4023 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 4024 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
| 4025 | run_test "Small packet DTLS 1.0, truncated hmac" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 4026 | "$P_SRV dtls=1 force_version=dtls1 trunc_hmac=1" \ |
| 4027 | "$P_CLI dtls=1 request_size=1 trunc_hmac=1 \ |
Hanno Becker | e214804 | 2017-11-10 08:59:18 +0000 | [diff] [blame] | 4028 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 4029 | 0 \ |
| 4030 | -s "Read from client: 1 bytes read" |
| 4031 | |
| 4032 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 4033 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
| 4034 | run_test "Small packet DTLS 1.0, without EtM, truncated MAC" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 4035 | "$P_SRV dtls=1 force_version=dtls1 trunc_hmac=1 etm=0" \ |
Hanno Becker | e214804 | 2017-11-10 08:59:18 +0000 | [diff] [blame] | 4036 | "$P_CLI dtls=1 request_size=1 \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 4037 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1"\ |
Hanno Becker | e214804 | 2017-11-10 08:59:18 +0000 | [diff] [blame] | 4038 | 0 \ |
| 4039 | -s "Read from client: 1 bytes read" |
| 4040 | |
| 4041 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 4042 | run_test "Small packet DTLS 1.2" \ |
| 4043 | "$P_SRV dtls=1 force_version=dtls1_2" \ |
| 4044 | "$P_CLI dtls=1 request_size=1 \ |
| 4045 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 4046 | 0 \ |
| 4047 | -s "Read from client: 1 bytes read" |
| 4048 | |
| 4049 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 4050 | run_test "Small packet DTLS 1.2, without EtM" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 4051 | "$P_SRV dtls=1 force_version=dtls1_2 etm=0" \ |
Hanno Becker | e214804 | 2017-11-10 08:59:18 +0000 | [diff] [blame] | 4052 | "$P_CLI dtls=1 request_size=1 \ |
| 4053 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 4054 | 0 \ |
| 4055 | -s "Read from client: 1 bytes read" |
| 4056 | |
| 4057 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 4058 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
| 4059 | run_test "Small packet DTLS 1.2, truncated hmac" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 4060 | "$P_SRV dtls=1 force_version=dtls1_2 trunc_hmac=1" \ |
Hanno Becker | e214804 | 2017-11-10 08:59:18 +0000 | [diff] [blame] | 4061 | "$P_CLI dtls=1 request_size=1 \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 4062 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1" \ |
Hanno Becker | e214804 | 2017-11-10 08:59:18 +0000 | [diff] [blame] | 4063 | 0 \ |
| 4064 | -s "Read from client: 1 bytes read" |
| 4065 | |
| 4066 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 4067 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
| 4068 | run_test "Small packet DTLS 1.2, without EtM, truncated MAC" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 4069 | "$P_SRV dtls=1 force_version=dtls1_2 trunc_hmac=1 etm=0" \ |
Hanno Becker | e214804 | 2017-11-10 08:59:18 +0000 | [diff] [blame] | 4070 | "$P_CLI dtls=1 request_size=1 \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 4071 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1"\ |
Hanno Becker | e214804 | 2017-11-10 08:59:18 +0000 | [diff] [blame] | 4072 | 0 \ |
| 4073 | -s "Read from client: 1 bytes read" |
| 4074 | |
Janos Follath | 00efff7 | 2016-05-06 13:48:23 +0100 | [diff] [blame] | 4075 | # A test for extensions in SSLv3 |
| 4076 | |
| 4077 | requires_config_enabled MBEDTLS_SSL_PROTO_SSL3 |
| 4078 | run_test "SSLv3 with extensions, server side" \ |
| 4079 | "$P_SRV min_version=ssl3 debug_level=3" \ |
| 4080 | "$P_CLI force_version=ssl3 tickets=1 max_frag_len=4096 alpn=abc,1234" \ |
| 4081 | 0 \ |
| 4082 | -S "dumping 'client hello extensions'" \ |
| 4083 | -S "server hello, total extension length:" |
| 4084 | |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4085 | # Test for large packets |
| 4086 | |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 4087 | # How many fragments do we expect to write $1 bytes? |
| 4088 | fragments_for_write() { |
| 4089 | echo "$(( ( $1 + $MAX_OUT_LEN - 1 ) / $MAX_OUT_LEN ))" |
| 4090 | } |
| 4091 | |
Janos Follath | e2681a4 | 2016-03-07 15:57:05 +0000 | [diff] [blame] | 4092 | requires_config_enabled MBEDTLS_SSL_PROTO_SSL3 |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4093 | run_test "Large packet SSLv3 BlockCipher" \ |
Manuel Pégourié-Gonnard | 448ea50 | 2015-01-12 11:40:14 +0100 | [diff] [blame] | 4094 | "$P_SRV min_version=ssl3" \ |
Manuel Pégourié-Gonnard | c82ee35 | 2015-01-07 16:35:25 +0100 | [diff] [blame] | 4095 | "$P_CLI request_size=16384 force_version=ssl3 recsplit=0 \ |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4096 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 4097 | 0 \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 4098 | -c "16384 bytes written in $(fragments_for_write 16384) fragments" \ |
| 4099 | -s "Read from client: $MAX_CONTENT_LEN bytes read" |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4100 | |
Janos Follath | e2681a4 | 2016-03-07 15:57:05 +0000 | [diff] [blame] | 4101 | requires_config_enabled MBEDTLS_SSL_PROTO_SSL3 |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4102 | run_test "Large packet SSLv3 StreamCipher" \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 4103 | "$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] | 4104 | "$P_CLI request_size=16384 force_version=ssl3 \ |
| 4105 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 4106 | 0 \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 4107 | -c "16384 bytes written in $(fragments_for_write 16384) fragments" \ |
| 4108 | -s "Read from client: $MAX_CONTENT_LEN bytes read" |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4109 | |
| 4110 | run_test "Large packet TLS 1.0 BlockCipher" \ |
| 4111 | "$P_SRV" \ |
Manuel Pégourié-Gonnard | c82ee35 | 2015-01-07 16:35:25 +0100 | [diff] [blame] | 4112 | "$P_CLI request_size=16384 force_version=tls1 recsplit=0 \ |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4113 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 4114 | 0 \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 4115 | -c "16384 bytes written in $(fragments_for_write 16384) fragments" \ |
| 4116 | -s "Read from client: $MAX_CONTENT_LEN bytes read" |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4117 | |
Hanno Becker | 278fc7a | 2017-11-10 09:16:28 +0000 | [diff] [blame] | 4118 | run_test "Large packet TLS 1.0 BlockCipher, without EtM" \ |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4119 | "$P_SRV" \ |
Hanno Becker | 278fc7a | 2017-11-10 09:16:28 +0000 | [diff] [blame] | 4120 | "$P_CLI request_size=16384 force_version=tls1 etm=0 recsplit=0 \ |
| 4121 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 4122 | 0 \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 4123 | -s "Read from client: $MAX_CONTENT_LEN bytes read" |
Hanno Becker | 278fc7a | 2017-11-10 09:16:28 +0000 | [diff] [blame] | 4124 | |
Hanno Becker | 32c5501 | 2017-11-10 08:42:54 +0000 | [diff] [blame] | 4125 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
Hanno Becker | 278fc7a | 2017-11-10 09:16:28 +0000 | [diff] [blame] | 4126 | run_test "Large packet TLS 1.0 BlockCipher, truncated MAC" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 4127 | "$P_SRV trunc_hmac=1" \ |
Manuel Pégourié-Gonnard | c82ee35 | 2015-01-07 16:35:25 +0100 | [diff] [blame] | 4128 | "$P_CLI request_size=16384 force_version=tls1 recsplit=0 \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 4129 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1" \ |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4130 | 0 \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 4131 | -c "16384 bytes written in $(fragments_for_write 16384) fragments" \ |
| 4132 | -s "Read from client: $MAX_CONTENT_LEN bytes read" |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4133 | |
Hanno Becker | 32c5501 | 2017-11-10 08:42:54 +0000 | [diff] [blame] | 4134 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
Hanno Becker | 278fc7a | 2017-11-10 09:16:28 +0000 | [diff] [blame] | 4135 | run_test "Large packet TLS 1.0 BlockCipher, without EtM, truncated MAC" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 4136 | "$P_SRV trunc_hmac=1" \ |
Hanno Becker | 278fc7a | 2017-11-10 09:16:28 +0000 | [diff] [blame] | 4137 | "$P_CLI request_size=16384 force_version=tls1 etm=0 recsplit=0 \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 4138 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1" \ |
Hanno Becker | 278fc7a | 2017-11-10 09:16:28 +0000 | [diff] [blame] | 4139 | 0 \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 4140 | -s "Read from client: $MAX_CONTENT_LEN bytes read" |
Hanno Becker | 278fc7a | 2017-11-10 09:16:28 +0000 | [diff] [blame] | 4141 | |
| 4142 | run_test "Large packet TLS 1.0 StreamCipher" \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 4143 | "$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] | 4144 | "$P_CLI request_size=16384 force_version=tls1 \ |
Hanno Becker | 278fc7a | 2017-11-10 09:16:28 +0000 | [diff] [blame] | 4145 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 4146 | 0 \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 4147 | -s "Read from client: $MAX_CONTENT_LEN bytes read" |
Hanno Becker | 278fc7a | 2017-11-10 09:16:28 +0000 | [diff] [blame] | 4148 | |
| 4149 | run_test "Large packet TLS 1.0 StreamCipher, without EtM" \ |
| 4150 | "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 4151 | "$P_CLI request_size=16384 force_version=tls1 \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 4152 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA etm=0" \ |
Hanno Becker | 278fc7a | 2017-11-10 09:16:28 +0000 | [diff] [blame] | 4153 | 0 \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 4154 | -s "Read from client: $MAX_CONTENT_LEN bytes read" |
Hanno Becker | 278fc7a | 2017-11-10 09:16:28 +0000 | [diff] [blame] | 4155 | |
| 4156 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
| 4157 | run_test "Large packet TLS 1.0 StreamCipher, truncated MAC" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 4158 | "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \ |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4159 | "$P_CLI request_size=16384 force_version=tls1 \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 4160 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \ |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4161 | 0 \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 4162 | -s "Read from client: $MAX_CONTENT_LEN bytes read" |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4163 | |
Hanno Becker | 278fc7a | 2017-11-10 09:16:28 +0000 | [diff] [blame] | 4164 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
| 4165 | run_test "Large packet TLS 1.0 StreamCipher, without EtM, truncated MAC" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 4166 | "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \ |
Hanno Becker | 278fc7a | 2017-11-10 09:16:28 +0000 | [diff] [blame] | 4167 | "$P_CLI request_size=16384 force_version=tls1 \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 4168 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1 etm=0" \ |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4169 | 0 \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 4170 | -c "16384 bytes written in $(fragments_for_write 16384) fragments" \ |
| 4171 | -s "Read from client: $MAX_CONTENT_LEN bytes read" |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4172 | |
| 4173 | run_test "Large packet TLS 1.1 BlockCipher" \ |
| 4174 | "$P_SRV" \ |
| 4175 | "$P_CLI request_size=16384 force_version=tls1_1 \ |
| 4176 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 4177 | 0 \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 4178 | -c "16384 bytes written in $(fragments_for_write 16384) fragments" \ |
| 4179 | -s "Read from client: $MAX_CONTENT_LEN bytes read" |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4180 | |
Hanno Becker | 278fc7a | 2017-11-10 09:16:28 +0000 | [diff] [blame] | 4181 | run_test "Large packet TLS 1.1 BlockCipher, without EtM" \ |
| 4182 | "$P_SRV" \ |
| 4183 | "$P_CLI request_size=16384 force_version=tls1_1 etm=0 \ |
| 4184 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4185 | 0 \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 4186 | -s "Read from client: $MAX_CONTENT_LEN bytes read" |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4187 | |
Hanno Becker | 32c5501 | 2017-11-10 08:42:54 +0000 | [diff] [blame] | 4188 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
Hanno Becker | 278fc7a | 2017-11-10 09:16:28 +0000 | [diff] [blame] | 4189 | run_test "Large packet TLS 1.1 BlockCipher, truncated MAC" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 4190 | "$P_SRV trunc_hmac=1" \ |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4191 | "$P_CLI request_size=16384 force_version=tls1_1 \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 4192 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1" \ |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4193 | 0 \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 4194 | -s "Read from client: $MAX_CONTENT_LEN bytes read" |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4195 | |
Hanno Becker | 32c5501 | 2017-11-10 08:42:54 +0000 | [diff] [blame] | 4196 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
Hanno Becker | 278fc7a | 2017-11-10 09:16:28 +0000 | [diff] [blame] | 4197 | run_test "Large packet TLS 1.1 BlockCipher, without EtM, truncated MAC" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 4198 | "$P_SRV trunc_hmac=1" \ |
Hanno Becker | 278fc7a | 2017-11-10 09:16:28 +0000 | [diff] [blame] | 4199 | "$P_CLI request_size=16384 force_version=tls1_1 \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 4200 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1 etm=0" \ |
Hanno Becker | 278fc7a | 2017-11-10 09:16:28 +0000 | [diff] [blame] | 4201 | 0 \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 4202 | -s "Read from client: $MAX_CONTENT_LEN bytes read" |
Hanno Becker | 278fc7a | 2017-11-10 09:16:28 +0000 | [diff] [blame] | 4203 | |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4204 | run_test "Large packet TLS 1.1 StreamCipher" \ |
| 4205 | "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 4206 | "$P_CLI request_size=16384 force_version=tls1_1 \ |
| 4207 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 4208 | 0 \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 4209 | -c "16384 bytes written in $(fragments_for_write 16384) fragments" \ |
| 4210 | -s "Read from client: $MAX_CONTENT_LEN bytes read" |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4211 | |
Hanno Becker | 278fc7a | 2017-11-10 09:16:28 +0000 | [diff] [blame] | 4212 | run_test "Large packet TLS 1.1 StreamCipher, without EtM" \ |
| 4213 | "$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] | 4214 | "$P_CLI request_size=16384 force_version=tls1_1 \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 4215 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA etm=0" \ |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4216 | 0 \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 4217 | -c "16384 bytes written in $(fragments_for_write 16384) fragments" \ |
| 4218 | -s "Read from client: $MAX_CONTENT_LEN bytes read" |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4219 | |
Hanno Becker | 278fc7a | 2017-11-10 09:16:28 +0000 | [diff] [blame] | 4220 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
| 4221 | run_test "Large packet TLS 1.1 StreamCipher, truncated MAC" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 4222 | "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \ |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4223 | "$P_CLI request_size=16384 force_version=tls1_1 \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 4224 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \ |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4225 | 0 \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 4226 | -s "Read from client: $MAX_CONTENT_LEN bytes read" |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4227 | |
Hanno Becker | 278fc7a | 2017-11-10 09:16:28 +0000 | [diff] [blame] | 4228 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
| 4229 | run_test "Large packet TLS 1.1 StreamCipher, without EtM, truncated MAC" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 4230 | "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \ |
Hanno Becker | 278fc7a | 2017-11-10 09:16:28 +0000 | [diff] [blame] | 4231 | "$P_CLI request_size=16384 force_version=tls1_1 \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 4232 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1 etm=0" \ |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4233 | 0 \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 4234 | -c "16384 bytes written in $(fragments_for_write 16384) fragments" \ |
| 4235 | -s "Read from client: $MAX_CONTENT_LEN bytes read" |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4236 | |
| 4237 | run_test "Large packet TLS 1.2 BlockCipher" \ |
| 4238 | "$P_SRV" \ |
| 4239 | "$P_CLI request_size=16384 force_version=tls1_2 \ |
| 4240 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 4241 | 0 \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 4242 | -c "16384 bytes written in $(fragments_for_write 16384) fragments" \ |
| 4243 | -s "Read from client: $MAX_CONTENT_LEN bytes read" |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4244 | |
Hanno Becker | 278fc7a | 2017-11-10 09:16:28 +0000 | [diff] [blame] | 4245 | run_test "Large packet TLS 1.2 BlockCipher, without EtM" \ |
| 4246 | "$P_SRV" \ |
| 4247 | "$P_CLI request_size=16384 force_version=tls1_2 etm=0 \ |
| 4248 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 4249 | 0 \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 4250 | -s "Read from client: $MAX_CONTENT_LEN bytes read" |
Hanno Becker | 278fc7a | 2017-11-10 09:16:28 +0000 | [diff] [blame] | 4251 | |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4252 | run_test "Large packet TLS 1.2 BlockCipher larger MAC" \ |
| 4253 | "$P_SRV" \ |
Manuel Pégourié-Gonnard | c82ee35 | 2015-01-07 16:35:25 +0100 | [diff] [blame] | 4254 | "$P_CLI request_size=16384 force_version=tls1_2 \ |
| 4255 | force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384" \ |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4256 | 0 \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 4257 | -c "16384 bytes written in $(fragments_for_write 16384) fragments" \ |
| 4258 | -s "Read from client: $MAX_CONTENT_LEN bytes read" |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4259 | |
Hanno Becker | 32c5501 | 2017-11-10 08:42:54 +0000 | [diff] [blame] | 4260 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
Hanno Becker | 278fc7a | 2017-11-10 09:16:28 +0000 | [diff] [blame] | 4261 | run_test "Large packet TLS 1.2 BlockCipher, truncated MAC" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 4262 | "$P_SRV trunc_hmac=1" \ |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4263 | "$P_CLI request_size=16384 force_version=tls1_2 \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 4264 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1" \ |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4265 | 0 \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 4266 | -s "Read from client: $MAX_CONTENT_LEN bytes read" |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4267 | |
Hanno Becker | 278fc7a | 2017-11-10 09:16:28 +0000 | [diff] [blame] | 4268 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
| 4269 | run_test "Large packet TLS 1.2 BlockCipher, without EtM, truncated MAC" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 4270 | "$P_SRV trunc_hmac=1" \ |
Hanno Becker | 278fc7a | 2017-11-10 09:16:28 +0000 | [diff] [blame] | 4271 | "$P_CLI request_size=16384 force_version=tls1_2 \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 4272 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1 etm=0" \ |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4273 | 0 \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 4274 | -c "16384 bytes written in $(fragments_for_write 16384) fragments" \ |
| 4275 | -s "Read from client: $MAX_CONTENT_LEN bytes read" |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4276 | |
| 4277 | run_test "Large packet TLS 1.2 StreamCipher" \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 4278 | "$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] | 4279 | "$P_CLI request_size=16384 force_version=tls1_2 \ |
| 4280 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 4281 | 0 \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 4282 | -c "16384 bytes written in $(fragments_for_write 16384) fragments" \ |
| 4283 | -s "Read from client: $MAX_CONTENT_LEN bytes read" |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4284 | |
Hanno Becker | 278fc7a | 2017-11-10 09:16:28 +0000 | [diff] [blame] | 4285 | run_test "Large packet TLS 1.2 StreamCipher, without EtM" \ |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 4286 | "$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] | 4287 | "$P_CLI request_size=16384 force_version=tls1_2 \ |
Hanno Becker | 278fc7a | 2017-11-10 09:16:28 +0000 | [diff] [blame] | 4288 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA etm=0" \ |
| 4289 | 0 \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 4290 | -s "Read from client: $MAX_CONTENT_LEN bytes read" |
Hanno Becker | 278fc7a | 2017-11-10 09:16:28 +0000 | [diff] [blame] | 4291 | |
Hanno Becker | 32c5501 | 2017-11-10 08:42:54 +0000 | [diff] [blame] | 4292 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
Hanno Becker | 278fc7a | 2017-11-10 09:16:28 +0000 | [diff] [blame] | 4293 | run_test "Large packet TLS 1.2 StreamCipher, truncated MAC" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 4294 | "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \ |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4295 | "$P_CLI request_size=16384 force_version=tls1_2 \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 4296 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \ |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4297 | 0 \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 4298 | -s "Read from client: $MAX_CONTENT_LEN bytes read" |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4299 | |
Hanno Becker | 278fc7a | 2017-11-10 09:16:28 +0000 | [diff] [blame] | 4300 | requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
| 4301 | run_test "Large packet TLS 1.2 StreamCipher, without EtM, truncated MAC" \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 4302 | "$P_SRV arc4=1 force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1" \ |
Hanno Becker | 278fc7a | 2017-11-10 09:16:28 +0000 | [diff] [blame] | 4303 | "$P_CLI request_size=16384 force_version=tls1_2 \ |
Hanno Becker | 909f9a3 | 2017-11-21 17:10:12 +0000 | [diff] [blame] | 4304 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA trunc_hmac=1 etm=0" \ |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4305 | 0 \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 4306 | -c "16384 bytes written in $(fragments_for_write 16384) fragments" \ |
| 4307 | -s "Read from client: $MAX_CONTENT_LEN bytes read" |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4308 | |
| 4309 | run_test "Large packet TLS 1.2 AEAD" \ |
| 4310 | "$P_SRV" \ |
| 4311 | "$P_CLI request_size=16384 force_version=tls1_2 \ |
| 4312 | force_ciphersuite=TLS-RSA-WITH-AES-256-CCM" \ |
| 4313 | 0 \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 4314 | -c "16384 bytes written in $(fragments_for_write 16384) fragments" \ |
| 4315 | -s "Read from client: $MAX_CONTENT_LEN bytes read" |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4316 | |
| 4317 | run_test "Large packet TLS 1.2 AEAD shorter tag" \ |
| 4318 | "$P_SRV" \ |
| 4319 | "$P_CLI request_size=16384 force_version=tls1_2 \ |
| 4320 | force_ciphersuite=TLS-RSA-WITH-AES-256-CCM-8" \ |
| 4321 | 0 \ |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 4322 | -c "16384 bytes written in $(fragments_for_write 16384) fragments" \ |
| 4323 | -s "Read from client: $MAX_CONTENT_LEN bytes read" |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 4324 | |
Gilles Peskine | 3665f1d | 2018-01-05 21:22:12 +0100 | [diff] [blame] | 4325 | # Tests of asynchronous private key support in SSL |
| 4326 | |
Gilles Peskine | b74a1c7 | 2018-04-24 13:09:22 +0200 | [diff] [blame] | 4327 | requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE |
Gilles Peskine | fcca9d8 | 2018-01-12 13:47:48 +0100 | [diff] [blame] | 4328 | run_test "SSL async private: sign, delay=0" \ |
| 4329 | "$P_SRV \ |
| 4330 | async_operations=s async_private_delay1=0 async_private_delay2=0" \ |
Gilles Peskine | 3665f1d | 2018-01-05 21:22:12 +0100 | [diff] [blame] | 4331 | "$P_CLI" \ |
| 4332 | 0 \ |
| 4333 | -s "Async sign callback: using key slot " \ |
Gilles Peskine | fcca9d8 | 2018-01-12 13:47:48 +0100 | [diff] [blame] | 4334 | -s "Async resume (slot [0-9]): sign done, status=0" |
Gilles Peskine | 3665f1d | 2018-01-05 21:22:12 +0100 | [diff] [blame] | 4335 | |
Gilles Peskine | b74a1c7 | 2018-04-24 13:09:22 +0200 | [diff] [blame] | 4336 | requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE |
Gilles Peskine | fcca9d8 | 2018-01-12 13:47:48 +0100 | [diff] [blame] | 4337 | run_test "SSL async private: sign, delay=1" \ |
| 4338 | "$P_SRV \ |
| 4339 | async_operations=s async_private_delay1=1 async_private_delay2=1" \ |
Gilles Peskine | 3665f1d | 2018-01-05 21:22:12 +0100 | [diff] [blame] | 4340 | "$P_CLI" \ |
| 4341 | 0 \ |
| 4342 | -s "Async sign callback: using key slot " \ |
| 4343 | -s "Async resume (slot [0-9]): call 0 more times." \ |
Gilles Peskine | fcca9d8 | 2018-01-12 13:47:48 +0100 | [diff] [blame] | 4344 | -s "Async resume (slot [0-9]): sign done, status=0" |
| 4345 | |
Gilles Peskine | 12d0cc1 | 2018-04-26 15:06:56 +0200 | [diff] [blame] | 4346 | requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE |
| 4347 | run_test "SSL async private: sign, delay=2" \ |
| 4348 | "$P_SRV \ |
| 4349 | async_operations=s async_private_delay1=2 async_private_delay2=2" \ |
| 4350 | "$P_CLI" \ |
| 4351 | 0 \ |
| 4352 | -s "Async sign callback: using key slot " \ |
| 4353 | -U "Async sign callback: using key slot " \ |
| 4354 | -s "Async resume (slot [0-9]): call 1 more times." \ |
| 4355 | -s "Async resume (slot [0-9]): call 0 more times." \ |
| 4356 | -s "Async resume (slot [0-9]): sign done, status=0" |
| 4357 | |
Gilles Peskine | d326883 | 2018-04-26 06:23:59 +0200 | [diff] [blame] | 4358 | # Test that the async callback correctly signs the 36-byte hash of TLS 1.0/1.1 |
| 4359 | # with RSA PKCS#1v1.5 as used in TLS 1.0/1.1. |
| 4360 | requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE |
| 4361 | requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_1 |
| 4362 | run_test "SSL async private: sign, RSA, TLS 1.1" \ |
| 4363 | "$P_SRV key_file=data_files/server2.key crt_file=data_files/server2.crt \ |
| 4364 | async_operations=s async_private_delay1=0 async_private_delay2=0" \ |
| 4365 | "$P_CLI force_version=tls1_1" \ |
| 4366 | 0 \ |
| 4367 | -s "Async sign callback: using key slot " \ |
| 4368 | -s "Async resume (slot [0-9]): sign done, status=0" |
| 4369 | |
Gilles Peskine | b74a1c7 | 2018-04-24 13:09:22 +0200 | [diff] [blame] | 4370 | requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE |
Gilles Peskine | 807d74a | 2018-04-30 10:30:49 +0200 | [diff] [blame] | 4371 | run_test "SSL async private: sign, SNI" \ |
| 4372 | "$P_SRV debug_level=3 \ |
| 4373 | async_operations=s async_private_delay1=0 async_private_delay2=0 \ |
| 4374 | crt_file=data_files/server5.crt key_file=data_files/server5.key \ |
| 4375 | sni=localhost,data_files/server2.crt,data_files/server2.key,-,-,-,polarssl.example,data_files/server1-nospace.crt,data_files/server1.key,-,-,-" \ |
| 4376 | "$P_CLI server_name=polarssl.example" \ |
| 4377 | 0 \ |
| 4378 | -s "Async sign callback: using key slot " \ |
| 4379 | -s "Async resume (slot [0-9]): sign done, status=0" \ |
| 4380 | -s "parse ServerName extension" \ |
| 4381 | -c "issuer name *: C=NL, O=PolarSSL, CN=PolarSSL Test CA" \ |
| 4382 | -c "subject name *: C=NL, O=PolarSSL, CN=polarssl.example" |
| 4383 | |
| 4384 | requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE |
Gilles Peskine | fcca9d8 | 2018-01-12 13:47:48 +0100 | [diff] [blame] | 4385 | run_test "SSL async private: decrypt, delay=0" \ |
| 4386 | "$P_SRV \ |
| 4387 | async_operations=d async_private_delay1=0 async_private_delay2=0" \ |
| 4388 | "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| 4389 | 0 \ |
| 4390 | -s "Async decrypt callback: using key slot " \ |
| 4391 | -s "Async resume (slot [0-9]): decrypt done, status=0" |
| 4392 | |
Gilles Peskine | b74a1c7 | 2018-04-24 13:09:22 +0200 | [diff] [blame] | 4393 | requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE |
Gilles Peskine | fcca9d8 | 2018-01-12 13:47:48 +0100 | [diff] [blame] | 4394 | run_test "SSL async private: decrypt, delay=1" \ |
| 4395 | "$P_SRV \ |
| 4396 | async_operations=d async_private_delay1=1 async_private_delay2=1" \ |
| 4397 | "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| 4398 | 0 \ |
| 4399 | -s "Async decrypt callback: using key slot " \ |
| 4400 | -s "Async resume (slot [0-9]): call 0 more times." \ |
| 4401 | -s "Async resume (slot [0-9]): decrypt done, status=0" |
| 4402 | |
Gilles Peskine | b74a1c7 | 2018-04-24 13:09:22 +0200 | [diff] [blame] | 4403 | requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE |
Gilles Peskine | fcca9d8 | 2018-01-12 13:47:48 +0100 | [diff] [blame] | 4404 | run_test "SSL async private: decrypt RSA-PSK, delay=0" \ |
| 4405 | "$P_SRV psk=abc123 \ |
| 4406 | async_operations=d async_private_delay1=0 async_private_delay2=0" \ |
| 4407 | "$P_CLI psk=abc123 \ |
| 4408 | force_ciphersuite=TLS-RSA-PSK-WITH-AES-128-CBC-SHA256" \ |
| 4409 | 0 \ |
| 4410 | -s "Async decrypt callback: using key slot " \ |
| 4411 | -s "Async resume (slot [0-9]): decrypt done, status=0" |
| 4412 | |
Gilles Peskine | b74a1c7 | 2018-04-24 13:09:22 +0200 | [diff] [blame] | 4413 | requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE |
Gilles Peskine | fcca9d8 | 2018-01-12 13:47:48 +0100 | [diff] [blame] | 4414 | run_test "SSL async private: decrypt RSA-PSK, delay=1" \ |
| 4415 | "$P_SRV psk=abc123 \ |
| 4416 | async_operations=d async_private_delay1=1 async_private_delay2=1" \ |
| 4417 | "$P_CLI psk=abc123 \ |
| 4418 | force_ciphersuite=TLS-RSA-PSK-WITH-AES-128-CBC-SHA256" \ |
| 4419 | 0 \ |
| 4420 | -s "Async decrypt callback: using key slot " \ |
| 4421 | -s "Async resume (slot [0-9]): call 0 more times." \ |
| 4422 | -s "Async resume (slot [0-9]): decrypt done, status=0" |
| 4423 | |
Gilles Peskine | b74a1c7 | 2018-04-24 13:09:22 +0200 | [diff] [blame] | 4424 | requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE |
Gilles Peskine | fcca9d8 | 2018-01-12 13:47:48 +0100 | [diff] [blame] | 4425 | run_test "SSL async private: sign callback not present" \ |
| 4426 | "$P_SRV \ |
| 4427 | async_operations=d async_private_delay1=1 async_private_delay2=1" \ |
| 4428 | "$P_CLI; [ \$? -eq 1 ] && |
| 4429 | $P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| 4430 | 0 \ |
| 4431 | -S "Async sign callback" \ |
| 4432 | -s "! mbedtls_ssl_handshake returned" \ |
| 4433 | -s "The own private key or pre-shared key is not set, but needed" \ |
| 4434 | -s "Async resume (slot [0-9]): decrypt done, status=0" \ |
| 4435 | -s "Successful connection" |
| 4436 | |
Gilles Peskine | b74a1c7 | 2018-04-24 13:09:22 +0200 | [diff] [blame] | 4437 | requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE |
Gilles Peskine | fcca9d8 | 2018-01-12 13:47:48 +0100 | [diff] [blame] | 4438 | run_test "SSL async private: decrypt callback not present" \ |
| 4439 | "$P_SRV debug_level=1 \ |
| 4440 | async_operations=s async_private_delay1=1 async_private_delay2=1" \ |
| 4441 | "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA; |
| 4442 | [ \$? -eq 1 ] && $P_CLI" \ |
| 4443 | 0 \ |
| 4444 | -S "Async decrypt callback" \ |
| 4445 | -s "! mbedtls_ssl_handshake returned" \ |
| 4446 | -s "got no RSA private key" \ |
| 4447 | -s "Async resume (slot [0-9]): sign done, status=0" \ |
| 4448 | -s "Successful connection" |
Gilles Peskine | 3665f1d | 2018-01-05 21:22:12 +0100 | [diff] [blame] | 4449 | |
| 4450 | # key1: ECDSA, key2: RSA; use key1 from slot 0 |
Gilles Peskine | b74a1c7 | 2018-04-24 13:09:22 +0200 | [diff] [blame] | 4451 | requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE |
Gilles Peskine | 3665f1d | 2018-01-05 21:22:12 +0100 | [diff] [blame] | 4452 | run_test "SSL async private: slot 0 used with key1" \ |
Gilles Peskine | fcca9d8 | 2018-01-12 13:47:48 +0100 | [diff] [blame] | 4453 | "$P_SRV \ |
| 4454 | async_operations=s async_private_delay1=1 \ |
| 4455 | key_file=data_files/server5.key crt_file=data_files/server5.crt \ |
| 4456 | key_file2=data_files/server2.key crt_file2=data_files/server2.crt" \ |
Gilles Peskine | 3665f1d | 2018-01-05 21:22:12 +0100 | [diff] [blame] | 4457 | "$P_CLI force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256" \ |
| 4458 | 0 \ |
| 4459 | -s "Async sign callback: using key slot 0," \ |
| 4460 | -s "Async resume (slot 0): call 0 more times." \ |
Gilles Peskine | fcca9d8 | 2018-01-12 13:47:48 +0100 | [diff] [blame] | 4461 | -s "Async resume (slot 0): sign done, status=0" |
Gilles Peskine | 3665f1d | 2018-01-05 21:22:12 +0100 | [diff] [blame] | 4462 | |
| 4463 | # key1: ECDSA, key2: RSA; use key2 from slot 0 |
Gilles Peskine | b74a1c7 | 2018-04-24 13:09:22 +0200 | [diff] [blame] | 4464 | requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE |
Gilles Peskine | 3665f1d | 2018-01-05 21:22:12 +0100 | [diff] [blame] | 4465 | run_test "SSL async private: slot 0 used with key2" \ |
Gilles Peskine | fcca9d8 | 2018-01-12 13:47:48 +0100 | [diff] [blame] | 4466 | "$P_SRV \ |
| 4467 | async_operations=s async_private_delay2=1 \ |
| 4468 | key_file=data_files/server5.key crt_file=data_files/server5.crt \ |
| 4469 | key_file2=data_files/server2.key crt_file2=data_files/server2.crt" \ |
Gilles Peskine | 3665f1d | 2018-01-05 21:22:12 +0100 | [diff] [blame] | 4470 | "$P_CLI force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA256" \ |
| 4471 | 0 \ |
| 4472 | -s "Async sign callback: using key slot 0," \ |
| 4473 | -s "Async resume (slot 0): call 0 more times." \ |
Gilles Peskine | fcca9d8 | 2018-01-12 13:47:48 +0100 | [diff] [blame] | 4474 | -s "Async resume (slot 0): sign done, status=0" |
Gilles Peskine | 3665f1d | 2018-01-05 21:22:12 +0100 | [diff] [blame] | 4475 | |
| 4476 | # key1: ECDSA, key2: RSA; use key2 from slot 1 |
Gilles Peskine | b74a1c7 | 2018-04-24 13:09:22 +0200 | [diff] [blame] | 4477 | requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE |
Gilles Peskine | ad28bf0 | 2018-04-26 00:19:16 +0200 | [diff] [blame] | 4478 | run_test "SSL async private: slot 1 used with key2" \ |
Gilles Peskine | fcca9d8 | 2018-01-12 13:47:48 +0100 | [diff] [blame] | 4479 | "$P_SRV \ |
Gilles Peskine | 168dae8 | 2018-04-25 23:35:42 +0200 | [diff] [blame] | 4480 | async_operations=s async_private_delay1=1 async_private_delay2=1 \ |
Gilles Peskine | fcca9d8 | 2018-01-12 13:47:48 +0100 | [diff] [blame] | 4481 | key_file=data_files/server5.key crt_file=data_files/server5.crt \ |
| 4482 | key_file2=data_files/server2.key crt_file2=data_files/server2.crt" \ |
Gilles Peskine | 3665f1d | 2018-01-05 21:22:12 +0100 | [diff] [blame] | 4483 | "$P_CLI force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA256" \ |
| 4484 | 0 \ |
| 4485 | -s "Async sign callback: using key slot 1," \ |
| 4486 | -s "Async resume (slot 1): call 0 more times." \ |
Gilles Peskine | fcca9d8 | 2018-01-12 13:47:48 +0100 | [diff] [blame] | 4487 | -s "Async resume (slot 1): sign done, status=0" |
Gilles Peskine | 3665f1d | 2018-01-05 21:22:12 +0100 | [diff] [blame] | 4488 | |
| 4489 | # key1: ECDSA, key2: RSA; use key2 directly |
Gilles Peskine | b74a1c7 | 2018-04-24 13:09:22 +0200 | [diff] [blame] | 4490 | requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE |
Gilles Peskine | 3665f1d | 2018-01-05 21:22:12 +0100 | [diff] [blame] | 4491 | run_test "SSL async private: fall back to transparent key" \ |
Gilles Peskine | fcca9d8 | 2018-01-12 13:47:48 +0100 | [diff] [blame] | 4492 | "$P_SRV \ |
| 4493 | async_operations=s async_private_delay1=1 \ |
| 4494 | key_file=data_files/server5.key crt_file=data_files/server5.crt \ |
| 4495 | key_file2=data_files/server2.key crt_file2=data_files/server2.crt " \ |
Gilles Peskine | 3665f1d | 2018-01-05 21:22:12 +0100 | [diff] [blame] | 4496 | "$P_CLI force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA256" \ |
| 4497 | 0 \ |
| 4498 | -s "Async sign callback: no key matches this certificate." |
| 4499 | |
Gilles Peskine | b74a1c7 | 2018-04-24 13:09:22 +0200 | [diff] [blame] | 4500 | requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE |
Gilles Peskine | 725f1cb | 2018-06-12 15:06:40 +0200 | [diff] [blame] | 4501 | run_test "SSL async private: sign, error in start" \ |
Gilles Peskine | fcca9d8 | 2018-01-12 13:47:48 +0100 | [diff] [blame] | 4502 | "$P_SRV \ |
| 4503 | async_operations=s async_private_delay1=1 async_private_delay2=1 \ |
| 4504 | async_private_error=1" \ |
Gilles Peskine | 3665f1d | 2018-01-05 21:22:12 +0100 | [diff] [blame] | 4505 | "$P_CLI" \ |
| 4506 | 1 \ |
| 4507 | -s "Async sign callback: injected error" \ |
| 4508 | -S "Async resume" \ |
Gilles Peskine | 37289cd | 2018-04-27 11:50:14 +0200 | [diff] [blame] | 4509 | -S "Async cancel" \ |
Gilles Peskine | 3665f1d | 2018-01-05 21:22:12 +0100 | [diff] [blame] | 4510 | -s "! mbedtls_ssl_handshake returned" |
| 4511 | |
Gilles Peskine | b74a1c7 | 2018-04-24 13:09:22 +0200 | [diff] [blame] | 4512 | requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE |
Gilles Peskine | 725f1cb | 2018-06-12 15:06:40 +0200 | [diff] [blame] | 4513 | run_test "SSL async private: sign, cancel after start" \ |
Gilles Peskine | fcca9d8 | 2018-01-12 13:47:48 +0100 | [diff] [blame] | 4514 | "$P_SRV \ |
| 4515 | async_operations=s async_private_delay1=1 async_private_delay2=1 \ |
| 4516 | async_private_error=2" \ |
Gilles Peskine | 3665f1d | 2018-01-05 21:22:12 +0100 | [diff] [blame] | 4517 | "$P_CLI" \ |
| 4518 | 1 \ |
| 4519 | -s "Async sign callback: using key slot " \ |
| 4520 | -S "Async resume" \ |
| 4521 | -s "Async cancel" |
| 4522 | |
Gilles Peskine | b74a1c7 | 2018-04-24 13:09:22 +0200 | [diff] [blame] | 4523 | requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE |
Gilles Peskine | 725f1cb | 2018-06-12 15:06:40 +0200 | [diff] [blame] | 4524 | run_test "SSL async private: sign, error in resume" \ |
Gilles Peskine | fcca9d8 | 2018-01-12 13:47:48 +0100 | [diff] [blame] | 4525 | "$P_SRV \ |
| 4526 | async_operations=s async_private_delay1=1 async_private_delay2=1 \ |
| 4527 | async_private_error=3" \ |
Gilles Peskine | 3665f1d | 2018-01-05 21:22:12 +0100 | [diff] [blame] | 4528 | "$P_CLI" \ |
| 4529 | 1 \ |
| 4530 | -s "Async sign callback: using key slot " \ |
Gilles Peskine | fcca9d8 | 2018-01-12 13:47:48 +0100 | [diff] [blame] | 4531 | -s "Async resume callback: sign done but injected error" \ |
Gilles Peskine | 37289cd | 2018-04-27 11:50:14 +0200 | [diff] [blame] | 4532 | -S "Async cancel" \ |
Gilles Peskine | 3665f1d | 2018-01-05 21:22:12 +0100 | [diff] [blame] | 4533 | -s "! mbedtls_ssl_handshake returned" |
| 4534 | |
Gilles Peskine | b74a1c7 | 2018-04-24 13:09:22 +0200 | [diff] [blame] | 4535 | requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE |
Gilles Peskine | 725f1cb | 2018-06-12 15:06:40 +0200 | [diff] [blame] | 4536 | run_test "SSL async private: decrypt, error in start" \ |
| 4537 | "$P_SRV \ |
| 4538 | async_operations=d async_private_delay1=1 async_private_delay2=1 \ |
| 4539 | async_private_error=1" \ |
| 4540 | "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| 4541 | 1 \ |
| 4542 | -s "Async decrypt callback: injected error" \ |
| 4543 | -S "Async resume" \ |
| 4544 | -S "Async cancel" \ |
| 4545 | -s "! mbedtls_ssl_handshake returned" |
| 4546 | |
| 4547 | requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE |
| 4548 | run_test "SSL async private: decrypt, cancel after start" \ |
| 4549 | "$P_SRV \ |
| 4550 | async_operations=d async_private_delay1=1 async_private_delay2=1 \ |
| 4551 | async_private_error=2" \ |
| 4552 | "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| 4553 | 1 \ |
| 4554 | -s "Async decrypt callback: using key slot " \ |
| 4555 | -S "Async resume" \ |
| 4556 | -s "Async cancel" |
| 4557 | |
| 4558 | requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE |
| 4559 | run_test "SSL async private: decrypt, error in resume" \ |
| 4560 | "$P_SRV \ |
| 4561 | async_operations=d async_private_delay1=1 async_private_delay2=1 \ |
| 4562 | async_private_error=3" \ |
| 4563 | "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| 4564 | 1 \ |
| 4565 | -s "Async decrypt callback: using key slot " \ |
| 4566 | -s "Async resume callback: decrypt done but injected error" \ |
| 4567 | -S "Async cancel" \ |
| 4568 | -s "! mbedtls_ssl_handshake returned" |
| 4569 | |
| 4570 | requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE |
Gilles Peskine | 60ee4ca | 2018-01-08 11:28:05 +0100 | [diff] [blame] | 4571 | run_test "SSL async private: cancel after start then operate correctly" \ |
Gilles Peskine | fcca9d8 | 2018-01-12 13:47:48 +0100 | [diff] [blame] | 4572 | "$P_SRV \ |
| 4573 | async_operations=s async_private_delay1=1 async_private_delay2=1 \ |
| 4574 | async_private_error=-2" \ |
Gilles Peskine | 60ee4ca | 2018-01-08 11:28:05 +0100 | [diff] [blame] | 4575 | "$P_CLI; [ \$? -eq 1 ] && $P_CLI" \ |
| 4576 | 0 \ |
| 4577 | -s "Async cancel" \ |
| 4578 | -s "! mbedtls_ssl_handshake returned" \ |
| 4579 | -s "Async resume" \ |
| 4580 | -s "Successful connection" |
| 4581 | |
Gilles Peskine | b74a1c7 | 2018-04-24 13:09:22 +0200 | [diff] [blame] | 4582 | requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE |
Gilles Peskine | 60ee4ca | 2018-01-08 11:28:05 +0100 | [diff] [blame] | 4583 | run_test "SSL async private: error in resume then operate correctly" \ |
Gilles Peskine | fcca9d8 | 2018-01-12 13:47:48 +0100 | [diff] [blame] | 4584 | "$P_SRV \ |
| 4585 | async_operations=s async_private_delay1=1 async_private_delay2=1 \ |
| 4586 | async_private_error=-3" \ |
Gilles Peskine | 60ee4ca | 2018-01-08 11:28:05 +0100 | [diff] [blame] | 4587 | "$P_CLI; [ \$? -eq 1 ] && $P_CLI" \ |
| 4588 | 0 \ |
| 4589 | -s "! mbedtls_ssl_handshake returned" \ |
| 4590 | -s "Async resume" \ |
| 4591 | -s "Successful connection" |
| 4592 | |
| 4593 | # key1: ECDSA, key2: RSA; use key1 through async, then key2 directly |
Gilles Peskine | b74a1c7 | 2018-04-24 13:09:22 +0200 | [diff] [blame] | 4594 | requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE |
Gilles Peskine | 60ee4ca | 2018-01-08 11:28:05 +0100 | [diff] [blame] | 4595 | run_test "SSL async private: cancel after start then fall back to transparent key" \ |
Gilles Peskine | fcca9d8 | 2018-01-12 13:47:48 +0100 | [diff] [blame] | 4596 | "$P_SRV \ |
| 4597 | async_operations=s async_private_delay1=1 async_private_error=-2 \ |
| 4598 | key_file=data_files/server5.key crt_file=data_files/server5.crt \ |
| 4599 | key_file2=data_files/server2.key crt_file2=data_files/server2.crt" \ |
Gilles Peskine | 60ee4ca | 2018-01-08 11:28:05 +0100 | [diff] [blame] | 4600 | "$P_CLI force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256; |
| 4601 | [ \$? -eq 1 ] && |
| 4602 | $P_CLI force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA256" \ |
| 4603 | 0 \ |
Gilles Peskine | deda75a | 2018-04-30 10:02:45 +0200 | [diff] [blame] | 4604 | -s "Async sign callback: using key slot 0" \ |
Gilles Peskine | 60ee4ca | 2018-01-08 11:28:05 +0100 | [diff] [blame] | 4605 | -S "Async resume" \ |
| 4606 | -s "Async cancel" \ |
| 4607 | -s "! mbedtls_ssl_handshake returned" \ |
| 4608 | -s "Async sign callback: no key matches this certificate." \ |
| 4609 | -s "Successful connection" |
| 4610 | |
| 4611 | # key1: ECDSA, key2: RSA; use key1 through async, then key2 directly |
Gilles Peskine | b74a1c7 | 2018-04-24 13:09:22 +0200 | [diff] [blame] | 4612 | requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE |
Gilles Peskine | 725f1cb | 2018-06-12 15:06:40 +0200 | [diff] [blame] | 4613 | run_test "SSL async private: sign, error in resume then fall back to transparent key" \ |
Gilles Peskine | fcca9d8 | 2018-01-12 13:47:48 +0100 | [diff] [blame] | 4614 | "$P_SRV \ |
| 4615 | async_operations=s async_private_delay1=1 async_private_error=-3 \ |
| 4616 | key_file=data_files/server5.key crt_file=data_files/server5.crt \ |
| 4617 | key_file2=data_files/server2.key crt_file2=data_files/server2.crt" \ |
Gilles Peskine | 60ee4ca | 2018-01-08 11:28:05 +0100 | [diff] [blame] | 4618 | "$P_CLI force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256; |
| 4619 | [ \$? -eq 1 ] && |
| 4620 | $P_CLI force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA256" \ |
| 4621 | 0 \ |
| 4622 | -s "Async resume" \ |
| 4623 | -s "! mbedtls_ssl_handshake returned" \ |
| 4624 | -s "Async sign callback: no key matches this certificate." \ |
| 4625 | -s "Successful connection" |
| 4626 | |
Gilles Peskine | b74a1c7 | 2018-04-24 13:09:22 +0200 | [diff] [blame] | 4627 | requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE |
Gilles Peskine | 3665f1d | 2018-01-05 21:22:12 +0100 | [diff] [blame] | 4628 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
Gilles Peskine | fcca9d8 | 2018-01-12 13:47:48 +0100 | [diff] [blame] | 4629 | run_test "SSL async private: renegotiation: client-initiated; sign" \ |
| 4630 | "$P_SRV \ |
| 4631 | async_operations=s async_private_delay1=1 async_private_delay2=1 \ |
Gilles Peskine | 3665f1d | 2018-01-05 21:22:12 +0100 | [diff] [blame] | 4632 | exchanges=2 renegotiation=1" \ |
| 4633 | "$P_CLI exchanges=2 renegotiation=1 renegotiate=1" \ |
| 4634 | 0 \ |
| 4635 | -s "Async sign callback: using key slot " \ |
Gilles Peskine | fcca9d8 | 2018-01-12 13:47:48 +0100 | [diff] [blame] | 4636 | -s "Async resume (slot [0-9]): sign done, status=0" |
Gilles Peskine | 3665f1d | 2018-01-05 21:22:12 +0100 | [diff] [blame] | 4637 | |
Gilles Peskine | b74a1c7 | 2018-04-24 13:09:22 +0200 | [diff] [blame] | 4638 | requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE |
Gilles Peskine | 3665f1d | 2018-01-05 21:22:12 +0100 | [diff] [blame] | 4639 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
Gilles Peskine | fcca9d8 | 2018-01-12 13:47:48 +0100 | [diff] [blame] | 4640 | run_test "SSL async private: renegotiation: server-initiated; sign" \ |
| 4641 | "$P_SRV \ |
| 4642 | async_operations=s async_private_delay1=1 async_private_delay2=1 \ |
Gilles Peskine | 3665f1d | 2018-01-05 21:22:12 +0100 | [diff] [blame] | 4643 | exchanges=2 renegotiation=1 renegotiate=1" \ |
| 4644 | "$P_CLI exchanges=2 renegotiation=1" \ |
| 4645 | 0 \ |
| 4646 | -s "Async sign callback: using key slot " \ |
Gilles Peskine | fcca9d8 | 2018-01-12 13:47:48 +0100 | [diff] [blame] | 4647 | -s "Async resume (slot [0-9]): sign done, status=0" |
| 4648 | |
Gilles Peskine | b74a1c7 | 2018-04-24 13:09:22 +0200 | [diff] [blame] | 4649 | requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE |
Gilles Peskine | fcca9d8 | 2018-01-12 13:47:48 +0100 | [diff] [blame] | 4650 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| 4651 | run_test "SSL async private: renegotiation: client-initiated; decrypt" \ |
| 4652 | "$P_SRV \ |
| 4653 | async_operations=d async_private_delay1=1 async_private_delay2=1 \ |
| 4654 | exchanges=2 renegotiation=1" \ |
| 4655 | "$P_CLI exchanges=2 renegotiation=1 renegotiate=1 \ |
| 4656 | force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| 4657 | 0 \ |
| 4658 | -s "Async decrypt callback: using key slot " \ |
| 4659 | -s "Async resume (slot [0-9]): decrypt done, status=0" |
| 4660 | |
Gilles Peskine | b74a1c7 | 2018-04-24 13:09:22 +0200 | [diff] [blame] | 4661 | requires_config_enabled MBEDTLS_SSL_ASYNC_PRIVATE |
Gilles Peskine | fcca9d8 | 2018-01-12 13:47:48 +0100 | [diff] [blame] | 4662 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| 4663 | run_test "SSL async private: renegotiation: server-initiated; decrypt" \ |
| 4664 | "$P_SRV \ |
| 4665 | async_operations=d async_private_delay1=1 async_private_delay2=1 \ |
| 4666 | exchanges=2 renegotiation=1 renegotiate=1" \ |
| 4667 | "$P_CLI exchanges=2 renegotiation=1 \ |
| 4668 | force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| 4669 | 0 \ |
| 4670 | -s "Async decrypt callback: using key slot " \ |
| 4671 | -s "Async resume (slot [0-9]): decrypt done, status=0" |
Gilles Peskine | 3665f1d | 2018-01-05 21:22:12 +0100 | [diff] [blame] | 4672 | |
Ron Eldor | 58093c8 | 2018-06-28 13:22:05 +0300 | [diff] [blame] | 4673 | # Tests for ECC extensions (rfc 4492) |
| 4674 | |
Ron Eldor | 643df7c | 2018-06-28 16:17:00 +0300 | [diff] [blame] | 4675 | requires_config_enabled MBEDTLS_AES_C |
| 4676 | requires_config_enabled MBEDTLS_CIPHER_MODE_CBC |
| 4677 | requires_config_enabled MBEDTLS_SHA256_C |
| 4678 | requires_config_enabled MBEDTLS_KEY_EXCHANGE_RSA_ENABLED |
Ron Eldor | 58093c8 | 2018-06-28 13:22:05 +0300 | [diff] [blame] | 4679 | run_test "Force a non ECC ciphersuite in the client side" \ |
| 4680 | "$P_SRV debug_level=3" \ |
Ron Eldor | 643df7c | 2018-06-28 16:17:00 +0300 | [diff] [blame] | 4681 | "$P_CLI debug_level=3 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA256" \ |
Ron Eldor | 58093c8 | 2018-06-28 13:22:05 +0300 | [diff] [blame] | 4682 | 0 \ |
| 4683 | -C "client hello, adding supported_elliptic_curves extension" \ |
| 4684 | -C "client hello, adding supported_point_formats extension" \ |
| 4685 | -S "found supported elliptic curves extension" \ |
| 4686 | -S "found supported point formats extension" |
| 4687 | |
Ron Eldor | 643df7c | 2018-06-28 16:17:00 +0300 | [diff] [blame] | 4688 | requires_config_enabled MBEDTLS_AES_C |
| 4689 | requires_config_enabled MBEDTLS_CIPHER_MODE_CBC |
| 4690 | requires_config_enabled MBEDTLS_SHA256_C |
| 4691 | requires_config_enabled MBEDTLS_KEY_EXCHANGE_RSA_ENABLED |
Ron Eldor | 58093c8 | 2018-06-28 13:22:05 +0300 | [diff] [blame] | 4692 | run_test "Force a non ECC ciphersuite in the server side" \ |
Ron Eldor | 643df7c | 2018-06-28 16:17:00 +0300 | [diff] [blame] | 4693 | "$P_SRV debug_level=3 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA256" \ |
Ron Eldor | 58093c8 | 2018-06-28 13:22:05 +0300 | [diff] [blame] | 4694 | "$P_CLI debug_level=3" \ |
| 4695 | 0 \ |
| 4696 | -C "found supported_point_formats extension" \ |
| 4697 | -S "server hello, supported_point_formats extension" |
| 4698 | |
Ron Eldor | 643df7c | 2018-06-28 16:17:00 +0300 | [diff] [blame] | 4699 | requires_config_enabled MBEDTLS_AES_C |
| 4700 | requires_config_enabled MBEDTLS_CIPHER_MODE_CBC |
| 4701 | requires_config_enabled MBEDTLS_SHA256_C |
| 4702 | requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED |
Ron Eldor | 58093c8 | 2018-06-28 13:22:05 +0300 | [diff] [blame] | 4703 | run_test "Force an ECC ciphersuite in the client side" \ |
| 4704 | "$P_SRV debug_level=3" \ |
| 4705 | "$P_CLI debug_level=3 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256" \ |
| 4706 | 0 \ |
| 4707 | -c "client hello, adding supported_elliptic_curves extension" \ |
| 4708 | -c "client hello, adding supported_point_formats extension" \ |
| 4709 | -s "found supported elliptic curves extension" \ |
| 4710 | -s "found supported point formats extension" |
| 4711 | |
Ron Eldor | 643df7c | 2018-06-28 16:17:00 +0300 | [diff] [blame] | 4712 | requires_config_enabled MBEDTLS_AES_C |
| 4713 | requires_config_enabled MBEDTLS_CIPHER_MODE_CBC |
| 4714 | requires_config_enabled MBEDTLS_SHA256_C |
| 4715 | requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED |
Ron Eldor | 58093c8 | 2018-06-28 13:22:05 +0300 | [diff] [blame] | 4716 | run_test "Force an ECC ciphersuite in the server side" \ |
| 4717 | "$P_SRV debug_level=3 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256" \ |
| 4718 | "$P_CLI debug_level=3" \ |
| 4719 | 0 \ |
| 4720 | -c "found supported_point_formats extension" \ |
| 4721 | -s "server hello, supported_point_formats extension" |
| 4722 | |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 4723 | # Tests for DTLS HelloVerifyRequest |
| 4724 | |
| 4725 | run_test "DTLS cookie: enabled" \ |
| 4726 | "$P_SRV dtls=1 debug_level=2" \ |
| 4727 | "$P_CLI dtls=1 debug_level=2" \ |
| 4728 | 0 \ |
| 4729 | -s "cookie verification failed" \ |
| 4730 | -s "cookie verification passed" \ |
| 4731 | -S "cookie verification skipped" \ |
| 4732 | -c "received hello verify request" \ |
Manuel Pégourié-Gonnard | caecdae | 2014-10-13 19:04:37 +0200 | [diff] [blame] | 4733 | -s "hello verification requested" \ |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 4734 | -S "SSL - The requested feature is not available" |
| 4735 | |
| 4736 | run_test "DTLS cookie: disabled" \ |
| 4737 | "$P_SRV dtls=1 debug_level=2 cookies=0" \ |
| 4738 | "$P_CLI dtls=1 debug_level=2" \ |
| 4739 | 0 \ |
| 4740 | -S "cookie verification failed" \ |
| 4741 | -S "cookie verification passed" \ |
| 4742 | -s "cookie verification skipped" \ |
| 4743 | -C "received hello verify request" \ |
Manuel Pégourié-Gonnard | caecdae | 2014-10-13 19:04:37 +0200 | [diff] [blame] | 4744 | -S "hello verification requested" \ |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 4745 | -S "SSL - The requested feature is not available" |
| 4746 | |
Manuel Pégourié-Gonnard | caecdae | 2014-10-13 19:04:37 +0200 | [diff] [blame] | 4747 | run_test "DTLS cookie: default (failing)" \ |
| 4748 | "$P_SRV dtls=1 debug_level=2 cookies=-1" \ |
| 4749 | "$P_CLI dtls=1 debug_level=2 hs_timeout=100-400" \ |
| 4750 | 1 \ |
| 4751 | -s "cookie verification failed" \ |
| 4752 | -S "cookie verification passed" \ |
| 4753 | -S "cookie verification skipped" \ |
| 4754 | -C "received hello verify request" \ |
| 4755 | -S "hello verification requested" \ |
| 4756 | -s "SSL - The requested feature is not available" |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 4757 | |
| 4758 | requires_ipv6 |
| 4759 | run_test "DTLS cookie: enabled, IPv6" \ |
| 4760 | "$P_SRV dtls=1 debug_level=2 server_addr=::1" \ |
| 4761 | "$P_CLI dtls=1 debug_level=2 server_addr=::1" \ |
| 4762 | 0 \ |
| 4763 | -s "cookie verification failed" \ |
| 4764 | -s "cookie verification passed" \ |
| 4765 | -S "cookie verification skipped" \ |
| 4766 | -c "received hello verify request" \ |
Manuel Pégourié-Gonnard | caecdae | 2014-10-13 19:04:37 +0200 | [diff] [blame] | 4767 | -s "hello verification requested" \ |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 4768 | -S "SSL - The requested feature is not available" |
| 4769 | |
Manuel Pégourié-Gonnard | 579950c | 2014-09-29 17:47:33 +0200 | [diff] [blame] | 4770 | run_test "DTLS cookie: enabled, nbio" \ |
| 4771 | "$P_SRV dtls=1 nbio=2 debug_level=2" \ |
| 4772 | "$P_CLI dtls=1 nbio=2 debug_level=2" \ |
| 4773 | 0 \ |
| 4774 | -s "cookie verification failed" \ |
| 4775 | -s "cookie verification passed" \ |
| 4776 | -S "cookie verification skipped" \ |
| 4777 | -c "received hello verify request" \ |
Manuel Pégourié-Gonnard | caecdae | 2014-10-13 19:04:37 +0200 | [diff] [blame] | 4778 | -s "hello verification requested" \ |
Manuel Pégourié-Gonnard | 579950c | 2014-09-29 17:47:33 +0200 | [diff] [blame] | 4779 | -S "SSL - The requested feature is not available" |
| 4780 | |
Manuel Pégourié-Gonnard | d745a1a | 2015-09-08 12:40:43 +0200 | [diff] [blame] | 4781 | # Tests for client reconnecting from the same port with DTLS |
| 4782 | |
Manuel Pégourié-Gonnard | 259db91 | 2015-09-09 11:37:17 +0200 | [diff] [blame] | 4783 | not_with_valgrind # spurious resend |
Manuel Pégourié-Gonnard | d745a1a | 2015-09-08 12:40:43 +0200 | [diff] [blame] | 4784 | run_test "DTLS client reconnect from same port: reference" \ |
Manuel Pégourié-Gonnard | 259db91 | 2015-09-09 11:37:17 +0200 | [diff] [blame] | 4785 | "$P_SRV dtls=1 exchanges=2 read_timeout=1000" \ |
| 4786 | "$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] | 4787 | 0 \ |
| 4788 | -C "resend" \ |
Manuel Pégourié-Gonnard | 259db91 | 2015-09-09 11:37:17 +0200 | [diff] [blame] | 4789 | -S "The operation timed out" \ |
Manuel Pégourié-Gonnard | d745a1a | 2015-09-08 12:40:43 +0200 | [diff] [blame] | 4790 | -S "Client initiated reconnection from same port" |
| 4791 | |
Manuel Pégourié-Gonnard | 259db91 | 2015-09-09 11:37:17 +0200 | [diff] [blame] | 4792 | not_with_valgrind # spurious resend |
Manuel Pégourié-Gonnard | d745a1a | 2015-09-08 12:40:43 +0200 | [diff] [blame] | 4793 | run_test "DTLS client reconnect from same port: reconnect" \ |
Manuel Pégourié-Gonnard | 259db91 | 2015-09-09 11:37:17 +0200 | [diff] [blame] | 4794 | "$P_SRV dtls=1 exchanges=2 read_timeout=1000" \ |
| 4795 | "$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] | 4796 | 0 \ |
| 4797 | -C "resend" \ |
Manuel Pégourié-Gonnard | 259db91 | 2015-09-09 11:37:17 +0200 | [diff] [blame] | 4798 | -S "The operation timed out" \ |
Manuel Pégourié-Gonnard | d745a1a | 2015-09-08 12:40:43 +0200 | [diff] [blame] | 4799 | -s "Client initiated reconnection from same port" |
| 4800 | |
Paul Bakker | 362689d | 2016-05-13 10:33:25 +0100 | [diff] [blame] | 4801 | not_with_valgrind # server/client too slow to respond in time (next test has higher timeouts) |
| 4802 | 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] | 4803 | "$P_SRV dtls=1 exchanges=2 read_timeout=1000 nbio=2" \ |
| 4804 | "$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] | 4805 | 0 \ |
Manuel Pégourié-Gonnard | 259db91 | 2015-09-09 11:37:17 +0200 | [diff] [blame] | 4806 | -S "The operation timed out" \ |
Manuel Pégourié-Gonnard | d745a1a | 2015-09-08 12:40:43 +0200 | [diff] [blame] | 4807 | -s "Client initiated reconnection from same port" |
| 4808 | |
Paul Bakker | 362689d | 2016-05-13 10:33:25 +0100 | [diff] [blame] | 4809 | only_with_valgrind # Only with valgrind, do previous test but with higher read_timeout and hs_timeout |
| 4810 | run_test "DTLS client reconnect from same port: reconnect, nbio, valgrind" \ |
| 4811 | "$P_SRV dtls=1 exchanges=2 read_timeout=2000 nbio=2 hs_timeout=1500-6000" \ |
| 4812 | "$P_CLI dtls=1 exchanges=2 debug_level=2 hs_timeout=1500-3000 reconnect_hard=1" \ |
| 4813 | 0 \ |
| 4814 | -S "The operation timed out" \ |
| 4815 | -s "Client initiated reconnection from same port" |
| 4816 | |
Manuel Pégourié-Gonnard | 259db91 | 2015-09-09 11:37:17 +0200 | [diff] [blame] | 4817 | run_test "DTLS client reconnect from same port: no cookies" \ |
| 4818 | "$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] | 4819 | "$P_CLI dtls=1 exchanges=2 debug_level=2 hs_timeout=500-8000 reconnect_hard=1" \ |
| 4820 | 0 \ |
Manuel Pégourié-Gonnard | 259db91 | 2015-09-09 11:37:17 +0200 | [diff] [blame] | 4821 | -s "The operation timed out" \ |
| 4822 | -S "Client initiated reconnection from same port" |
| 4823 | |
Manuel Pégourié-Gonnard | 08a1d4b | 2014-09-26 10:35:50 +0200 | [diff] [blame] | 4824 | # Tests for various cases of client authentication with DTLS |
| 4825 | # (focused on handshake flows and message parsing) |
| 4826 | |
| 4827 | run_test "DTLS client auth: required" \ |
| 4828 | "$P_SRV dtls=1 auth_mode=required" \ |
| 4829 | "$P_CLI dtls=1" \ |
| 4830 | 0 \ |
| 4831 | -s "Verifying peer X.509 certificate... ok" |
| 4832 | |
| 4833 | run_test "DTLS client auth: optional, client has no cert" \ |
| 4834 | "$P_SRV dtls=1 auth_mode=optional" \ |
| 4835 | "$P_CLI dtls=1 crt_file=none key_file=none" \ |
| 4836 | 0 \ |
Manuel Pégourié-Gonnard | 89addc4 | 2015-04-20 10:56:18 +0100 | [diff] [blame] | 4837 | -s "! Certificate was missing" |
Manuel Pégourié-Gonnard | 08a1d4b | 2014-09-26 10:35:50 +0200 | [diff] [blame] | 4838 | |
Manuel Pégourié-Gonnard | 89addc4 | 2015-04-20 10:56:18 +0100 | [diff] [blame] | 4839 | run_test "DTLS client auth: none, client has no cert" \ |
Manuel Pégourié-Gonnard | 08a1d4b | 2014-09-26 10:35:50 +0200 | [diff] [blame] | 4840 | "$P_SRV dtls=1 auth_mode=none" \ |
| 4841 | "$P_CLI dtls=1 crt_file=none key_file=none debug_level=2" \ |
| 4842 | 0 \ |
| 4843 | -c "skip write certificate$" \ |
Manuel Pégourié-Gonnard | 89addc4 | 2015-04-20 10:56:18 +0100 | [diff] [blame] | 4844 | -s "! Certificate verification was skipped" |
Manuel Pégourié-Gonnard | 08a1d4b | 2014-09-26 10:35:50 +0200 | [diff] [blame] | 4845 | |
Manuel Pégourié-Gonnard | 0a88574 | 2015-08-04 12:08:35 +0200 | [diff] [blame] | 4846 | run_test "DTLS wrong PSK: badmac alert" \ |
| 4847 | "$P_SRV dtls=1 psk=abc123 force_ciphersuite=TLS-PSK-WITH-AES-128-GCM-SHA256" \ |
| 4848 | "$P_CLI dtls=1 psk=abc124" \ |
| 4849 | 1 \ |
| 4850 | -s "SSL - Verification of the message MAC failed" \ |
| 4851 | -c "SSL - A fatal alert message was received from our peer" |
| 4852 | |
Manuel Pégourié-Gonnard | 502bf30 | 2014-08-20 13:12:58 +0200 | [diff] [blame] | 4853 | # Tests for receiving fragmented handshake messages with DTLS |
| 4854 | |
| 4855 | requires_gnutls |
| 4856 | run_test "DTLS reassembly: no fragmentation (gnutls server)" \ |
| 4857 | "$G_SRV -u --mtu 2048 -a" \ |
| 4858 | "$P_CLI dtls=1 debug_level=2" \ |
| 4859 | 0 \ |
| 4860 | -C "found fragmented DTLS handshake message" \ |
| 4861 | -C "error" |
| 4862 | |
| 4863 | requires_gnutls |
| 4864 | run_test "DTLS reassembly: some fragmentation (gnutls server)" \ |
| 4865 | "$G_SRV -u --mtu 512" \ |
| 4866 | "$P_CLI dtls=1 debug_level=2" \ |
| 4867 | 0 \ |
| 4868 | -c "found fragmented DTLS handshake message" \ |
| 4869 | -C "error" |
| 4870 | |
| 4871 | requires_gnutls |
| 4872 | run_test "DTLS reassembly: more fragmentation (gnutls server)" \ |
| 4873 | "$G_SRV -u --mtu 128" \ |
| 4874 | "$P_CLI dtls=1 debug_level=2" \ |
| 4875 | 0 \ |
| 4876 | -c "found fragmented DTLS handshake message" \ |
| 4877 | -C "error" |
| 4878 | |
| 4879 | requires_gnutls |
| 4880 | run_test "DTLS reassembly: more fragmentation, nbio (gnutls server)" \ |
| 4881 | "$G_SRV -u --mtu 128" \ |
| 4882 | "$P_CLI dtls=1 nbio=2 debug_level=2" \ |
| 4883 | 0 \ |
| 4884 | -c "found fragmented DTLS handshake message" \ |
| 4885 | -C "error" |
| 4886 | |
Manuel Pégourié-Gonnard | 0c4cbc7 | 2014-09-02 14:47:31 +0200 | [diff] [blame] | 4887 | requires_gnutls |
Hanno Becker | 6a24364 | 2017-10-12 15:18:45 +0100 | [diff] [blame] | 4888 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
Manuel Pégourié-Gonnard | 0c4cbc7 | 2014-09-02 14:47:31 +0200 | [diff] [blame] | 4889 | run_test "DTLS reassembly: fragmentation, renego (gnutls server)" \ |
| 4890 | "$G_SRV -u --mtu 256" \ |
| 4891 | "$P_CLI debug_level=3 dtls=1 renegotiation=1 renegotiate=1" \ |
| 4892 | 0 \ |
| 4893 | -c "found fragmented DTLS handshake message" \ |
| 4894 | -c "client hello, adding renegotiation extension" \ |
| 4895 | -c "found renegotiation extension" \ |
| 4896 | -c "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 4897 | -C "mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | 0c4cbc7 | 2014-09-02 14:47:31 +0200 | [diff] [blame] | 4898 | -C "error" \ |
| 4899 | -s "Extra-header:" |
| 4900 | |
| 4901 | requires_gnutls |
Hanno Becker | 6a24364 | 2017-10-12 15:18:45 +0100 | [diff] [blame] | 4902 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
Manuel Pégourié-Gonnard | 0c4cbc7 | 2014-09-02 14:47:31 +0200 | [diff] [blame] | 4903 | run_test "DTLS reassembly: fragmentation, nbio, renego (gnutls server)" \ |
| 4904 | "$G_SRV -u --mtu 256" \ |
| 4905 | "$P_CLI debug_level=3 nbio=2 dtls=1 renegotiation=1 renegotiate=1" \ |
| 4906 | 0 \ |
| 4907 | -c "found fragmented DTLS handshake message" \ |
| 4908 | -c "client hello, adding renegotiation extension" \ |
| 4909 | -c "found renegotiation extension" \ |
| 4910 | -c "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 4911 | -C "mbedtls_ssl_handshake returned" \ |
Manuel Pégourié-Gonnard | 0c4cbc7 | 2014-09-02 14:47:31 +0200 | [diff] [blame] | 4912 | -C "error" \ |
| 4913 | -s "Extra-header:" |
| 4914 | |
Manuel Pégourié-Gonnard | a775617 | 2014-08-31 18:37:01 +0200 | [diff] [blame] | 4915 | run_test "DTLS reassembly: no fragmentation (openssl server)" \ |
| 4916 | "$O_SRV -dtls1 -mtu 2048" \ |
| 4917 | "$P_CLI dtls=1 debug_level=2" \ |
| 4918 | 0 \ |
| 4919 | -C "found fragmented DTLS handshake message" \ |
| 4920 | -C "error" |
| 4921 | |
Manuel Pégourié-Gonnard | 825a49e | 2014-09-23 11:00:37 +0200 | [diff] [blame] | 4922 | run_test "DTLS reassembly: some fragmentation (openssl server)" \ |
| 4923 | "$O_SRV -dtls1 -mtu 768" \ |
Manuel Pégourié-Gonnard | 64dffc5 | 2014-09-02 13:39:16 +0200 | [diff] [blame] | 4924 | "$P_CLI dtls=1 debug_level=2" \ |
| 4925 | 0 \ |
| 4926 | -c "found fragmented DTLS handshake message" \ |
| 4927 | -C "error" |
| 4928 | |
Manuel Pégourié-Gonnard | 825a49e | 2014-09-23 11:00:37 +0200 | [diff] [blame] | 4929 | run_test "DTLS reassembly: more fragmentation (openssl server)" \ |
Manuel Pégourié-Gonnard | 64dffc5 | 2014-09-02 13:39:16 +0200 | [diff] [blame] | 4930 | "$O_SRV -dtls1 -mtu 256" \ |
| 4931 | "$P_CLI dtls=1 debug_level=2" \ |
| 4932 | 0 \ |
| 4933 | -c "found fragmented DTLS handshake message" \ |
| 4934 | -C "error" |
| 4935 | |
| 4936 | run_test "DTLS reassembly: fragmentation, nbio (openssl server)" \ |
| 4937 | "$O_SRV -dtls1 -mtu 256" \ |
| 4938 | "$P_CLI dtls=1 nbio=2 debug_level=2" \ |
| 4939 | 0 \ |
| 4940 | -c "found fragmented DTLS handshake message" \ |
| 4941 | -C "error" |
Manuel Pégourié-Gonnard | a775617 | 2014-08-31 18:37:01 +0200 | [diff] [blame] | 4942 | |
Manuel Pégourié-Gonnard | 2cb17e2 | 2017-09-19 13:00:47 +0200 | [diff] [blame] | 4943 | # Tests for sending fragmented handshake messages with DTLS |
| 4944 | # |
| 4945 | # Use client auth when we need the client to send large messages, |
| 4946 | # and use large cert chains on both sides too (the long chains we have all use |
| 4947 | # both RSA and ECDSA, but ideally we should have long chains with either). |
| 4948 | # Sizes reached (UDP payload): |
| 4949 | # - 2037B for server certificate |
| 4950 | # - 1542B for client certificate |
| 4951 | # - 1013B for newsessionticket |
| 4952 | # - all others below 512B |
| 4953 | # All those tests assume MAX_CONTENT_LEN is at least 2048 |
| 4954 | |
| 4955 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 4956 | requires_config_enabled MBEDTLS_RSA_C |
| 4957 | requires_config_enabled MBEDTLS_ECDSA_C |
| 4958 | requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| 4959 | run_test "DTLS fragmenting: none (for reference)" \ |
| 4960 | "$P_SRV dtls=1 debug_level=2 auth_mode=required \ |
| 4961 | crt_file=data_files/server7_int-ca.crt \ |
| 4962 | key_file=data_files/server7.key \ |
| 4963 | max_frag_len=2048" \ |
| 4964 | "$P_CLI dtls=1 debug_level=2 \ |
| 4965 | crt_file=data_files/server8_int-ca2.crt \ |
| 4966 | key_file=data_files/server8.key \ |
| 4967 | max_frag_len=2048" \ |
| 4968 | 0 \ |
| 4969 | -S "found fragmented DTLS handshake message" \ |
| 4970 | -C "found fragmented DTLS handshake message" \ |
| 4971 | -C "error" |
| 4972 | |
| 4973 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 4974 | requires_config_enabled MBEDTLS_RSA_C |
| 4975 | requires_config_enabled MBEDTLS_ECDSA_C |
| 4976 | requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
Manuel Pégourié-Gonnard | b747c6c | 2018-08-12 13:28:53 +0200 | [diff] [blame] | 4977 | run_test "DTLS fragmenting: server only (max_frag_len)" \ |
Manuel Pégourié-Gonnard | 2cb17e2 | 2017-09-19 13:00:47 +0200 | [diff] [blame] | 4978 | "$P_SRV dtls=1 debug_level=2 auth_mode=required \ |
| 4979 | crt_file=data_files/server7_int-ca.crt \ |
| 4980 | key_file=data_files/server7.key \ |
| 4981 | max_frag_len=1024" \ |
| 4982 | "$P_CLI dtls=1 debug_level=2 \ |
| 4983 | crt_file=data_files/server8_int-ca2.crt \ |
| 4984 | key_file=data_files/server8.key \ |
| 4985 | max_frag_len=2048" \ |
| 4986 | 0 \ |
| 4987 | -S "found fragmented DTLS handshake message" \ |
| 4988 | -c "found fragmented DTLS handshake message" \ |
| 4989 | -C "error" |
| 4990 | |
| 4991 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 4992 | requires_config_enabled MBEDTLS_RSA_C |
| 4993 | requires_config_enabled MBEDTLS_ECDSA_C |
| 4994 | requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
Manuel Pégourié-Gonnard | b747c6c | 2018-08-12 13:28:53 +0200 | [diff] [blame] | 4995 | run_test "DTLS fragmenting: server only (more) (max_frag_len)" \ |
Manuel Pégourié-Gonnard | 2cb17e2 | 2017-09-19 13:00:47 +0200 | [diff] [blame] | 4996 | "$P_SRV dtls=1 debug_level=2 auth_mode=required \ |
| 4997 | crt_file=data_files/server7_int-ca.crt \ |
| 4998 | key_file=data_files/server7.key \ |
| 4999 | max_frag_len=512" \ |
| 5000 | "$P_CLI dtls=1 debug_level=2 \ |
| 5001 | crt_file=data_files/server8_int-ca2.crt \ |
| 5002 | key_file=data_files/server8.key \ |
| 5003 | max_frag_len=2048" \ |
| 5004 | 0 \ |
| 5005 | -S "found fragmented DTLS handshake message" \ |
| 5006 | -c "found fragmented DTLS handshake message" \ |
| 5007 | -C "error" |
| 5008 | |
| 5009 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 5010 | requires_config_enabled MBEDTLS_RSA_C |
| 5011 | requires_config_enabled MBEDTLS_ECDSA_C |
| 5012 | requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
Manuel Pégourié-Gonnard | b747c6c | 2018-08-12 13:28:53 +0200 | [diff] [blame] | 5013 | run_test "DTLS fragmenting: client-initiated, server only (max_frag_len)" \ |
Manuel Pégourié-Gonnard | 2cb17e2 | 2017-09-19 13:00:47 +0200 | [diff] [blame] | 5014 | "$P_SRV dtls=1 debug_level=2 auth_mode=none \ |
| 5015 | crt_file=data_files/server7_int-ca.crt \ |
| 5016 | key_file=data_files/server7.key \ |
| 5017 | max_frag_len=2048" \ |
| 5018 | "$P_CLI dtls=1 debug_level=2 \ |
| 5019 | crt_file=data_files/server8_int-ca2.crt \ |
| 5020 | key_file=data_files/server8.key \ |
| 5021 | max_frag_len=512" \ |
| 5022 | 0 \ |
| 5023 | -S "found fragmented DTLS handshake message" \ |
| 5024 | -c "found fragmented DTLS handshake message" \ |
| 5025 | -C "error" |
| 5026 | |
| 5027 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 5028 | requires_config_enabled MBEDTLS_RSA_C |
| 5029 | requires_config_enabled MBEDTLS_ECDSA_C |
| 5030 | requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
Manuel Pégourié-Gonnard | b747c6c | 2018-08-12 13:28:53 +0200 | [diff] [blame] | 5031 | run_test "DTLS fragmenting: client-initiated, both (max_frag_len)" \ |
Manuel Pégourié-Gonnard | 2cb17e2 | 2017-09-19 13:00:47 +0200 | [diff] [blame] | 5032 | "$P_SRV dtls=1 debug_level=2 auth_mode=required \ |
| 5033 | crt_file=data_files/server7_int-ca.crt \ |
| 5034 | key_file=data_files/server7.key \ |
| 5035 | max_frag_len=2048" \ |
| 5036 | "$P_CLI dtls=1 debug_level=2 \ |
| 5037 | crt_file=data_files/server8_int-ca2.crt \ |
| 5038 | key_file=data_files/server8.key \ |
| 5039 | max_frag_len=512" \ |
| 5040 | 0 \ |
| 5041 | -s "found fragmented DTLS handshake message" \ |
| 5042 | -c "found fragmented DTLS handshake message" \ |
| 5043 | -C "error" |
| 5044 | |
Manuel Pégourié-Gonnard | b747c6c | 2018-08-12 13:28:53 +0200 | [diff] [blame] | 5045 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 5046 | requires_config_enabled MBEDTLS_RSA_C |
| 5047 | requires_config_enabled MBEDTLS_ECDSA_C |
| 5048 | run_test "DTLS fragmenting: none (for reference) (MTU)" \ |
| 5049 | "$P_SRV dtls=1 debug_level=2 auth_mode=required \ |
| 5050 | crt_file=data_files/server7_int-ca.crt \ |
| 5051 | key_file=data_files/server7.key \ |
| 5052 | mtu=2048" \ |
| 5053 | "$P_CLI dtls=1 debug_level=2 \ |
| 5054 | crt_file=data_files/server8_int-ca2.crt \ |
| 5055 | key_file=data_files/server8.key \ |
| 5056 | mtu=2048" \ |
| 5057 | 0 \ |
| 5058 | -S "found fragmented DTLS handshake message" \ |
| 5059 | -C "found fragmented DTLS handshake message" \ |
| 5060 | -C "error" |
| 5061 | |
| 5062 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 5063 | requires_config_enabled MBEDTLS_RSA_C |
| 5064 | requires_config_enabled MBEDTLS_ECDSA_C |
| 5065 | run_test "DTLS fragmenting: client (MTU)" \ |
| 5066 | "$P_SRV dtls=1 debug_level=2 auth_mode=required \ |
| 5067 | crt_file=data_files/server7_int-ca.crt \ |
| 5068 | key_file=data_files/server7.key \ |
| 5069 | mtu=2048" \ |
| 5070 | "$P_CLI dtls=1 debug_level=2 \ |
| 5071 | crt_file=data_files/server8_int-ca2.crt \ |
| 5072 | key_file=data_files/server8.key \ |
| 5073 | mtu=512" \ |
| 5074 | 0 \ |
| 5075 | -s "found fragmented DTLS handshake message" \ |
| 5076 | -C "found fragmented DTLS handshake message" \ |
| 5077 | -C "error" |
| 5078 | |
| 5079 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 5080 | requires_config_enabled MBEDTLS_RSA_C |
| 5081 | requires_config_enabled MBEDTLS_ECDSA_C |
| 5082 | run_test "DTLS fragmenting: server (MTU)" \ |
| 5083 | "$P_SRV dtls=1 debug_level=2 auth_mode=required \ |
| 5084 | crt_file=data_files/server7_int-ca.crt \ |
| 5085 | key_file=data_files/server7.key \ |
| 5086 | mtu=512" \ |
| 5087 | "$P_CLI dtls=1 debug_level=2 \ |
| 5088 | crt_file=data_files/server8_int-ca2.crt \ |
| 5089 | key_file=data_files/server8.key \ |
| 5090 | mtu=2048" \ |
| 5091 | 0 \ |
| 5092 | -S "found fragmented DTLS handshake message" \ |
| 5093 | -c "found fragmented DTLS handshake message" \ |
| 5094 | -C "error" |
| 5095 | |
| 5096 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 5097 | requires_config_enabled MBEDTLS_RSA_C |
| 5098 | requires_config_enabled MBEDTLS_ECDSA_C |
| 5099 | run_test "DTLS fragmenting: both (MTU)" \ |
Manuel Pégourié-Gonnard | 4532329 | 2018-08-20 11:52:24 +0200 | [diff] [blame] | 5100 | -p "$P_PXY mtu=512" \ |
Manuel Pégourié-Gonnard | b747c6c | 2018-08-12 13:28:53 +0200 | [diff] [blame] | 5101 | "$P_SRV dtls=1 debug_level=2 auth_mode=required \ |
| 5102 | crt_file=data_files/server7_int-ca.crt \ |
| 5103 | key_file=data_files/server7.key \ |
| 5104 | mtu=512" \ |
| 5105 | "$P_CLI dtls=1 debug_level=2 \ |
| 5106 | crt_file=data_files/server8_int-ca2.crt \ |
| 5107 | key_file=data_files/server8.key \ |
| 5108 | mtu=512" \ |
| 5109 | 0 \ |
| 5110 | -s "found fragmented DTLS handshake message" \ |
| 5111 | -c "found fragmented DTLS handshake message" \ |
| 5112 | -C "error" |
| 5113 | |
Manuel Pégourié-Gonnard | b8eec19 | 2018-08-20 09:34:02 +0200 | [diff] [blame] | 5114 | # Test for automatic MTU reduction on repeated resend |
Hanno Becker | 37029eb | 2018-08-29 17:01:40 +0100 | [diff] [blame^] | 5115 | not_with_valgrind |
Manuel Pégourié-Gonnard | b8eec19 | 2018-08-20 09:34:02 +0200 | [diff] [blame] | 5116 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 5117 | requires_config_enabled MBEDTLS_RSA_C |
| 5118 | requires_config_enabled MBEDTLS_ECDSA_C |
| 5119 | run_test "DTLS fragmenting: proxy MTU: auto-reduction" \ |
| 5120 | -p "$P_PXY mtu=508" \ |
| 5121 | "$P_SRV dtls=1 debug_level=2 auth_mode=required \ |
| 5122 | crt_file=data_files/server7_int-ca.crt \ |
| 5123 | key_file=data_files/server7.key\ |
| 5124 | hs_timeout=100-400" \ |
| 5125 | "$P_CLI dtls=1 debug_level=2 \ |
| 5126 | crt_file=data_files/server8_int-ca2.crt \ |
| 5127 | key_file=data_files/server8.key \ |
| 5128 | hs_timeout=100-400" \ |
| 5129 | 0 \ |
| 5130 | -s "found fragmented DTLS handshake message" \ |
| 5131 | -c "found fragmented DTLS handshake message" \ |
| 5132 | -C "error" |
| 5133 | |
Manuel Pégourié-Gonnard | 72c2707 | 2018-08-13 12:37:51 +0200 | [diff] [blame] | 5134 | # the proxy shouldn't drop or mess up anything, so we shouldn't need to resend |
Manuel Pégourié-Gonnard | 3d183ce | 2018-08-22 09:56:22 +0200 | [diff] [blame] | 5135 | # OTOH the client might resend if the server is to slow to reset after sending |
| 5136 | # a HelloVerifyRequest, so only check for no retransmission server-side |
Manuel Pégourié-Gonnard | 0794d49 | 2018-08-17 10:54:24 +0200 | [diff] [blame] | 5137 | not_with_valgrind # spurious resend due to timeout |
Manuel Pégourié-Gonnard | 72c2707 | 2018-08-13 12:37:51 +0200 | [diff] [blame] | 5138 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 5139 | requires_config_enabled MBEDTLS_RSA_C |
| 5140 | requires_config_enabled MBEDTLS_ECDSA_C |
| 5141 | run_test "DTLS fragmenting: proxy MTU, simple handshake" \ |
| 5142 | -p "$P_PXY mtu=512" \ |
| 5143 | "$P_SRV dtls=1 debug_level=2 auth_mode=required \ |
| 5144 | crt_file=data_files/server7_int-ca.crt \ |
| 5145 | key_file=data_files/server7.key \ |
| 5146 | mtu=512" \ |
| 5147 | "$P_CLI dtls=1 debug_level=2 \ |
| 5148 | crt_file=data_files/server8_int-ca2.crt \ |
| 5149 | key_file=data_files/server8.key \ |
| 5150 | mtu=512" \ |
| 5151 | 0 \ |
| 5152 | -S "resend" \ |
Manuel Pégourié-Gonnard | 72c2707 | 2018-08-13 12:37:51 +0200 | [diff] [blame] | 5153 | -s "found fragmented DTLS handshake message" \ |
| 5154 | -c "found fragmented DTLS handshake message" \ |
| 5155 | -C "error" |
| 5156 | |
Manuel Pégourié-Gonnard | c1d54b7 | 2018-08-22 10:02:59 +0200 | [diff] [blame] | 5157 | not_with_valgrind # spurious resend due to timeout |
| 5158 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 5159 | requires_config_enabled MBEDTLS_RSA_C |
| 5160 | requires_config_enabled MBEDTLS_ECDSA_C |
| 5161 | run_test "DTLS fragmenting: proxy MTU, simple handshake, nbio" \ |
| 5162 | -p "$P_PXY mtu=512" \ |
| 5163 | "$P_SRV dtls=1 debug_level=2 auth_mode=required \ |
| 5164 | crt_file=data_files/server7_int-ca.crt \ |
| 5165 | key_file=data_files/server7.key \ |
| 5166 | mtu=512 nbio=2" \ |
| 5167 | "$P_CLI dtls=1 debug_level=2 \ |
| 5168 | crt_file=data_files/server8_int-ca2.crt \ |
| 5169 | key_file=data_files/server8.key \ |
| 5170 | mtu=512 nbio=2" \ |
| 5171 | 0 \ |
| 5172 | -S "resend" \ |
| 5173 | -s "found fragmented DTLS handshake message" \ |
| 5174 | -c "found fragmented DTLS handshake message" \ |
| 5175 | -C "error" |
| 5176 | |
Manuel Pégourié-Gonnard | 19c62f9 | 2018-08-16 10:50:39 +0200 | [diff] [blame] | 5177 | # This ensures things still work after session_reset(), |
| 5178 | # for example it would have caught #1941. |
| 5179 | # It also exercises the "resumed hanshake" flow. |
| 5180 | # Since we don't support reading fragmented ClientHello yet, |
| 5181 | # up the MTU to 1450 (larger than ClientHello with session ticket, |
| 5182 | # but still smaller than client's Certificate to ensure fragmentation). |
Manuel Pégourié-Gonnard | 2f2d902 | 2018-08-21 12:17:54 +0200 | [diff] [blame] | 5183 | # reco_delay avoids races where the client reconnects before the server has |
| 5184 | # resumed listening, which would result in a spurious resend. |
Manuel Pégourié-Gonnard | 0794d49 | 2018-08-17 10:54:24 +0200 | [diff] [blame] | 5185 | not_with_valgrind # spurious resend due to timeout |
Manuel Pégourié-Gonnard | 19c62f9 | 2018-08-16 10:50:39 +0200 | [diff] [blame] | 5186 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 5187 | requires_config_enabled MBEDTLS_RSA_C |
| 5188 | requires_config_enabled MBEDTLS_ECDSA_C |
| 5189 | run_test "DTLS fragmenting: proxy MTU, resumed handshake" \ |
| 5190 | -p "$P_PXY mtu=1450" \ |
| 5191 | "$P_SRV dtls=1 debug_level=2 auth_mode=required \ |
| 5192 | crt_file=data_files/server7_int-ca.crt \ |
| 5193 | key_file=data_files/server7.key \ |
| 5194 | mtu=1450" \ |
| 5195 | "$P_CLI dtls=1 debug_level=2 \ |
| 5196 | crt_file=data_files/server8_int-ca2.crt \ |
| 5197 | key_file=data_files/server8.key \ |
Manuel Pégourié-Gonnard | 2f2d902 | 2018-08-21 12:17:54 +0200 | [diff] [blame] | 5198 | mtu=1450 reconnect=1 reco_delay=1" \ |
Manuel Pégourié-Gonnard | 19c62f9 | 2018-08-16 10:50:39 +0200 | [diff] [blame] | 5199 | 0 \ |
| 5200 | -S "resend" \ |
Manuel Pégourié-Gonnard | 19c62f9 | 2018-08-16 10:50:39 +0200 | [diff] [blame] | 5201 | -s "found fragmented DTLS handshake message" \ |
| 5202 | -c "found fragmented DTLS handshake message" \ |
| 5203 | -C "error" |
| 5204 | |
Manuel Pégourié-Gonnard | 0794d49 | 2018-08-17 10:54:24 +0200 | [diff] [blame] | 5205 | not_with_valgrind # spurious resend due to timeout |
Manuel Pégourié-Gonnard | 72c2707 | 2018-08-13 12:37:51 +0200 | [diff] [blame] | 5206 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 5207 | requires_config_enabled MBEDTLS_RSA_C |
| 5208 | requires_config_enabled MBEDTLS_ECDSA_C |
| 5209 | requires_config_enabled MBEDTLS_SHA256_C |
| 5210 | requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA |
| 5211 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| 5212 | requires_config_enabled MBEDTLS_CHACHAPOLY_C |
| 5213 | run_test "DTLS fragmenting: proxy MTU, ChachaPoly renego" \ |
| 5214 | -p "$P_PXY mtu=512" \ |
| 5215 | "$P_SRV dtls=1 debug_level=2 auth_mode=required \ |
| 5216 | crt_file=data_files/server7_int-ca.crt \ |
| 5217 | key_file=data_files/server7.key \ |
| 5218 | exchanges=2 renegotiation=1 \ |
| 5219 | force_ciphersuite=TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256 \ |
| 5220 | mtu=512" \ |
| 5221 | "$P_CLI dtls=1 debug_level=2 \ |
| 5222 | crt_file=data_files/server8_int-ca2.crt \ |
| 5223 | key_file=data_files/server8.key \ |
| 5224 | exchanges=2 renegotiation=1 renegotiate=1 \ |
| 5225 | mtu=512" \ |
| 5226 | 0 \ |
| 5227 | -S "resend" \ |
Manuel Pégourié-Gonnard | 72c2707 | 2018-08-13 12:37:51 +0200 | [diff] [blame] | 5228 | -s "found fragmented DTLS handshake message" \ |
| 5229 | -c "found fragmented DTLS handshake message" \ |
| 5230 | -C "error" |
| 5231 | |
Manuel Pégourié-Gonnard | 0794d49 | 2018-08-17 10:54:24 +0200 | [diff] [blame] | 5232 | not_with_valgrind # spurious resend due to timeout |
Manuel Pégourié-Gonnard | 72c2707 | 2018-08-13 12:37:51 +0200 | [diff] [blame] | 5233 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 5234 | requires_config_enabled MBEDTLS_RSA_C |
| 5235 | requires_config_enabled MBEDTLS_ECDSA_C |
| 5236 | requires_config_enabled MBEDTLS_SHA256_C |
| 5237 | requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA |
| 5238 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| 5239 | requires_config_enabled MBEDTLS_AES_C |
| 5240 | requires_config_enabled MBEDTLS_GCM_C |
| 5241 | run_test "DTLS fragmenting: proxy MTU, AES-GCM renego" \ |
| 5242 | -p "$P_PXY mtu=512" \ |
| 5243 | "$P_SRV dtls=1 debug_level=2 auth_mode=required \ |
| 5244 | crt_file=data_files/server7_int-ca.crt \ |
| 5245 | key_file=data_files/server7.key \ |
| 5246 | exchanges=2 renegotiation=1 \ |
| 5247 | force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256 \ |
| 5248 | mtu=512" \ |
| 5249 | "$P_CLI dtls=1 debug_level=2 \ |
| 5250 | crt_file=data_files/server8_int-ca2.crt \ |
| 5251 | key_file=data_files/server8.key \ |
| 5252 | exchanges=2 renegotiation=1 renegotiate=1 \ |
| 5253 | mtu=512" \ |
| 5254 | 0 \ |
| 5255 | -S "resend" \ |
Manuel Pégourié-Gonnard | 72c2707 | 2018-08-13 12:37:51 +0200 | [diff] [blame] | 5256 | -s "found fragmented DTLS handshake message" \ |
| 5257 | -c "found fragmented DTLS handshake message" \ |
| 5258 | -C "error" |
| 5259 | |
Manuel Pégourié-Gonnard | 0794d49 | 2018-08-17 10:54:24 +0200 | [diff] [blame] | 5260 | not_with_valgrind # spurious resend due to timeout |
Manuel Pégourié-Gonnard | 72c2707 | 2018-08-13 12:37:51 +0200 | [diff] [blame] | 5261 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 5262 | requires_config_enabled MBEDTLS_RSA_C |
| 5263 | requires_config_enabled MBEDTLS_ECDSA_C |
| 5264 | requires_config_enabled MBEDTLS_SHA256_C |
| 5265 | requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA |
| 5266 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| 5267 | requires_config_enabled MBEDTLS_AES_C |
| 5268 | requires_config_enabled MBEDTLS_CCM_C |
| 5269 | run_test "DTLS fragmenting: proxy MTU, AES-CCM renego" \ |
| 5270 | -p "$P_PXY mtu=512" \ |
| 5271 | "$P_SRV dtls=1 debug_level=2 auth_mode=required \ |
| 5272 | crt_file=data_files/server7_int-ca.crt \ |
| 5273 | key_file=data_files/server7.key \ |
| 5274 | exchanges=2 renegotiation=1 \ |
| 5275 | force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8 \ |
| 5276 | mtu=512" \ |
| 5277 | "$P_CLI dtls=1 debug_level=2 \ |
| 5278 | crt_file=data_files/server8_int-ca2.crt \ |
| 5279 | key_file=data_files/server8.key \ |
| 5280 | exchanges=2 renegotiation=1 renegotiate=1 \ |
| 5281 | mtu=512" \ |
| 5282 | 0 \ |
| 5283 | -S "resend" \ |
Manuel Pégourié-Gonnard | 72c2707 | 2018-08-13 12:37:51 +0200 | [diff] [blame] | 5284 | -s "found fragmented DTLS handshake message" \ |
| 5285 | -c "found fragmented DTLS handshake message" \ |
| 5286 | -C "error" |
| 5287 | |
Manuel Pégourié-Gonnard | 0794d49 | 2018-08-17 10:54:24 +0200 | [diff] [blame] | 5288 | not_with_valgrind # spurious resend due to timeout |
Manuel Pégourié-Gonnard | 72c2707 | 2018-08-13 12:37:51 +0200 | [diff] [blame] | 5289 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 5290 | requires_config_enabled MBEDTLS_RSA_C |
| 5291 | requires_config_enabled MBEDTLS_ECDSA_C |
| 5292 | requires_config_enabled MBEDTLS_SHA256_C |
| 5293 | requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA |
| 5294 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| 5295 | requires_config_enabled MBEDTLS_AES_C |
| 5296 | requires_config_enabled MBEDTLS_CIPHER_MODE_CBC |
| 5297 | requires_config_enabled MBEDTLS_SSL_ENCRYPT_THEN_MAC |
| 5298 | run_test "DTLS fragmenting: proxy MTU, AES-CBC EtM renego" \ |
| 5299 | -p "$P_PXY mtu=512" \ |
| 5300 | "$P_SRV dtls=1 debug_level=2 auth_mode=required \ |
| 5301 | crt_file=data_files/server7_int-ca.crt \ |
| 5302 | key_file=data_files/server7.key \ |
| 5303 | exchanges=2 renegotiation=1 \ |
| 5304 | force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256 \ |
| 5305 | mtu=512" \ |
| 5306 | "$P_CLI dtls=1 debug_level=2 \ |
| 5307 | crt_file=data_files/server8_int-ca2.crt \ |
| 5308 | key_file=data_files/server8.key \ |
| 5309 | exchanges=2 renegotiation=1 renegotiate=1 \ |
| 5310 | mtu=512" \ |
| 5311 | 0 \ |
| 5312 | -S "resend" \ |
Manuel Pégourié-Gonnard | 72c2707 | 2018-08-13 12:37:51 +0200 | [diff] [blame] | 5313 | -s "found fragmented DTLS handshake message" \ |
| 5314 | -c "found fragmented DTLS handshake message" \ |
| 5315 | -C "error" |
| 5316 | |
Manuel Pégourié-Gonnard | 0794d49 | 2018-08-17 10:54:24 +0200 | [diff] [blame] | 5317 | not_with_valgrind # spurious resend due to timeout |
Manuel Pégourié-Gonnard | 72c2707 | 2018-08-13 12:37:51 +0200 | [diff] [blame] | 5318 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 5319 | requires_config_enabled MBEDTLS_RSA_C |
| 5320 | requires_config_enabled MBEDTLS_ECDSA_C |
| 5321 | requires_config_enabled MBEDTLS_SHA256_C |
| 5322 | requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA |
| 5323 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| 5324 | requires_config_enabled MBEDTLS_AES_C |
| 5325 | requires_config_enabled MBEDTLS_CIPHER_MODE_CBC |
| 5326 | run_test "DTLS fragmenting: proxy MTU, AES-CBC non-EtM renego" \ |
| 5327 | -p "$P_PXY mtu=512" \ |
| 5328 | "$P_SRV dtls=1 debug_level=2 auth_mode=required \ |
| 5329 | crt_file=data_files/server7_int-ca.crt \ |
| 5330 | key_file=data_files/server7.key \ |
| 5331 | exchanges=2 renegotiation=1 \ |
| 5332 | force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256 etm=0 \ |
| 5333 | mtu=512" \ |
| 5334 | "$P_CLI dtls=1 debug_level=2 \ |
| 5335 | crt_file=data_files/server8_int-ca2.crt \ |
| 5336 | key_file=data_files/server8.key \ |
| 5337 | exchanges=2 renegotiation=1 renegotiate=1 \ |
| 5338 | mtu=512" \ |
| 5339 | 0 \ |
| 5340 | -S "resend" \ |
Manuel Pégourié-Gonnard | 72c2707 | 2018-08-13 12:37:51 +0200 | [diff] [blame] | 5341 | -s "found fragmented DTLS handshake message" \ |
| 5342 | -c "found fragmented DTLS handshake message" \ |
| 5343 | -C "error" |
| 5344 | |
Manuel Pégourié-Gonnard | 2d56f0d | 2018-08-16 11:09:03 +0200 | [diff] [blame] | 5345 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 5346 | requires_config_enabled MBEDTLS_RSA_C |
| 5347 | requires_config_enabled MBEDTLS_ECDSA_C |
| 5348 | client_needs_more_time 2 |
| 5349 | run_test "DTLS fragmenting: proxy MTU + 3d" \ |
| 5350 | -p "$P_PXY mtu=512 drop=8 delay=8 duplicate=8" \ |
| 5351 | "$P_SRV dtls=1 debug_level=2 auth_mode=required \ |
| 5352 | crt_file=data_files/server7_int-ca.crt \ |
| 5353 | key_file=data_files/server7.key \ |
Manuel Pégourié-Gonnard | 02f3a8a | 2018-08-20 10:49:28 +0200 | [diff] [blame] | 5354 | hs_timeout=250-10000 mtu=512" \ |
Manuel Pégourié-Gonnard | 2d56f0d | 2018-08-16 11:09:03 +0200 | [diff] [blame] | 5355 | "$P_CLI dtls=1 debug_level=2 \ |
| 5356 | crt_file=data_files/server8_int-ca2.crt \ |
| 5357 | key_file=data_files/server8.key \ |
Manuel Pégourié-Gonnard | 02f3a8a | 2018-08-20 10:49:28 +0200 | [diff] [blame] | 5358 | hs_timeout=250-10000 mtu=512" \ |
Manuel Pégourié-Gonnard | 2d56f0d | 2018-08-16 11:09:03 +0200 | [diff] [blame] | 5359 | 0 \ |
| 5360 | -s "found fragmented DTLS handshake message" \ |
| 5361 | -c "found fragmented DTLS handshake message" \ |
| 5362 | -C "error" |
| 5363 | |
Manuel Pégourié-Gonnard | c1d54b7 | 2018-08-22 10:02:59 +0200 | [diff] [blame] | 5364 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 5365 | requires_config_enabled MBEDTLS_RSA_C |
| 5366 | requires_config_enabled MBEDTLS_ECDSA_C |
| 5367 | client_needs_more_time 2 |
| 5368 | run_test "DTLS fragmenting: proxy MTU + 3d, nbio" \ |
| 5369 | -p "$P_PXY mtu=512 drop=8 delay=8 duplicate=8" \ |
| 5370 | "$P_SRV dtls=1 debug_level=2 auth_mode=required \ |
| 5371 | crt_file=data_files/server7_int-ca.crt \ |
| 5372 | key_file=data_files/server7.key \ |
| 5373 | hs_timeout=250-10000 mtu=512 nbio=2" \ |
| 5374 | "$P_CLI dtls=1 debug_level=2 \ |
| 5375 | crt_file=data_files/server8_int-ca2.crt \ |
| 5376 | key_file=data_files/server8.key \ |
| 5377 | hs_timeout=250-10000 mtu=512 nbio=2" \ |
| 5378 | 0 \ |
| 5379 | -s "found fragmented DTLS handshake message" \ |
| 5380 | -c "found fragmented DTLS handshake message" \ |
| 5381 | -C "error" |
| 5382 | |
Manuel Pégourié-Gonnard | 38110df | 2018-08-17 12:44:54 +0200 | [diff] [blame] | 5383 | # interop tests for DTLS fragmentating with reliable connection |
| 5384 | # |
Manuel Pégourié-Gonnard | 1218bc0 | 2018-08-17 10:51:26 +0200 | [diff] [blame] | 5385 | # here and below we just want to test that the we fragment in a way that |
| 5386 | # pleases other implementations, so we don't need the peer to fragment |
| 5387 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 5388 | requires_config_enabled MBEDTLS_RSA_C |
| 5389 | requires_config_enabled MBEDTLS_ECDSA_C |
| 5390 | requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2 |
Manuel Pégourié-Gonnard | 6151298 | 2018-08-21 09:40:07 +0200 | [diff] [blame] | 5391 | requires_gnutls |
Manuel Pégourié-Gonnard | 1218bc0 | 2018-08-17 10:51:26 +0200 | [diff] [blame] | 5392 | run_test "DTLS fragmenting: gnutls server, DTLS 1.2" \ |
| 5393 | "$G_SRV -u" \ |
| 5394 | "$P_CLI dtls=1 debug_level=2 \ |
| 5395 | crt_file=data_files/server8_int-ca2.crt \ |
| 5396 | key_file=data_files/server8.key \ |
| 5397 | mtu=512 force_version=dtls1_2" \ |
| 5398 | 0 \ |
| 5399 | -c "fragmenting handshake message" \ |
| 5400 | -C "error" |
| 5401 | |
| 5402 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 5403 | requires_config_enabled MBEDTLS_RSA_C |
| 5404 | requires_config_enabled MBEDTLS_ECDSA_C |
| 5405 | requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_1 |
Manuel Pégourié-Gonnard | 6151298 | 2018-08-21 09:40:07 +0200 | [diff] [blame] | 5406 | requires_gnutls |
Manuel Pégourié-Gonnard | 1218bc0 | 2018-08-17 10:51:26 +0200 | [diff] [blame] | 5407 | run_test "DTLS fragmenting: gnutls server, DTLS 1.0" \ |
| 5408 | "$G_SRV -u" \ |
| 5409 | "$P_CLI dtls=1 debug_level=2 \ |
| 5410 | crt_file=data_files/server8_int-ca2.crt \ |
| 5411 | key_file=data_files/server8.key \ |
Manuel Pégourié-Gonnard | 02f3a8a | 2018-08-20 10:49:28 +0200 | [diff] [blame] | 5412 | mtu=512 force_version=dtls1" \ |
Manuel Pégourié-Gonnard | 1218bc0 | 2018-08-17 10:51:26 +0200 | [diff] [blame] | 5413 | 0 \ |
| 5414 | -c "fragmenting handshake message" \ |
| 5415 | -C "error" |
| 5416 | |
| 5417 | # gnutls-cli always tries IPv6 first, and doesn't fall back to IPv4 with DTLS |
| 5418 | requires_ipv6 |
| 5419 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 5420 | requires_config_enabled MBEDTLS_RSA_C |
| 5421 | requires_config_enabled MBEDTLS_ECDSA_C |
| 5422 | requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2 |
Manuel Pégourié-Gonnard | 6151298 | 2018-08-21 09:40:07 +0200 | [diff] [blame] | 5423 | requires_gnutls |
Manuel Pégourié-Gonnard | 1218bc0 | 2018-08-17 10:51:26 +0200 | [diff] [blame] | 5424 | run_test "DTLS fragmenting: gnutls client, DTLS 1.2" \ |
| 5425 | "$P_SRV dtls=1 debug_level=2 server_addr=::1 \ |
| 5426 | crt_file=data_files/server7_int-ca.crt \ |
| 5427 | key_file=data_files/server7.key \ |
| 5428 | mtu=512 force_version=dtls1_2" \ |
| 5429 | "$G_CLI -u" \ |
| 5430 | 0 \ |
| 5431 | -s "fragmenting handshake message" |
| 5432 | |
| 5433 | # gnutls-cli always tries IPv6 first, and doesn't fall back to IPv4 with DTLS |
| 5434 | requires_ipv6 |
| 5435 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 5436 | requires_config_enabled MBEDTLS_RSA_C |
| 5437 | requires_config_enabled MBEDTLS_ECDSA_C |
| 5438 | requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_1 |
Manuel Pégourié-Gonnard | 6151298 | 2018-08-21 09:40:07 +0200 | [diff] [blame] | 5439 | requires_gnutls |
Manuel Pégourié-Gonnard | 1218bc0 | 2018-08-17 10:51:26 +0200 | [diff] [blame] | 5440 | run_test "DTLS fragmenting: gnutls client, DTLS 1.0" \ |
| 5441 | "$P_SRV dtls=1 debug_level=2 server_addr=::1 \ |
| 5442 | crt_file=data_files/server7_int-ca.crt \ |
| 5443 | key_file=data_files/server7.key \ |
| 5444 | mtu=512 force_version=dtls1" \ |
| 5445 | "$G_CLI -u" \ |
| 5446 | 0 \ |
| 5447 | -s "fragmenting handshake message" |
| 5448 | |
| 5449 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 5450 | requires_config_enabled MBEDTLS_RSA_C |
| 5451 | requires_config_enabled MBEDTLS_ECDSA_C |
| 5452 | requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2 |
| 5453 | run_test "DTLS fragmenting: openssl server, DTLS 1.2" \ |
| 5454 | "$O_SRV -dtls1_2 -verify 10" \ |
| 5455 | "$P_CLI dtls=1 debug_level=2 \ |
| 5456 | crt_file=data_files/server8_int-ca2.crt \ |
| 5457 | key_file=data_files/server8.key \ |
| 5458 | mtu=512 force_version=dtls1_2" \ |
| 5459 | 0 \ |
| 5460 | -c "fragmenting handshake message" \ |
| 5461 | -C "error" |
| 5462 | |
| 5463 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 5464 | requires_config_enabled MBEDTLS_RSA_C |
| 5465 | requires_config_enabled MBEDTLS_ECDSA_C |
| 5466 | requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_1 |
| 5467 | run_test "DTLS fragmenting: openssl server, DTLS 1.0" \ |
| 5468 | "$O_SRV -dtls1 -verify 10" \ |
| 5469 | "$P_CLI dtls=1 debug_level=2 \ |
| 5470 | crt_file=data_files/server8_int-ca2.crt \ |
| 5471 | key_file=data_files/server8.key \ |
| 5472 | mtu=512 force_version=dtls1" \ |
| 5473 | 0 \ |
| 5474 | -c "fragmenting handshake message" \ |
| 5475 | -C "error" |
| 5476 | |
| 5477 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 5478 | requires_config_enabled MBEDTLS_RSA_C |
| 5479 | requires_config_enabled MBEDTLS_ECDSA_C |
| 5480 | requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2 |
| 5481 | run_test "DTLS fragmenting: openssl client, DTLS 1.2" \ |
| 5482 | "$P_SRV dtls=1 debug_level=2 \ |
| 5483 | crt_file=data_files/server7_int-ca.crt \ |
| 5484 | key_file=data_files/server7.key \ |
| 5485 | mtu=512 force_version=dtls1_2" \ |
| 5486 | "$O_CLI -dtls1_2" \ |
| 5487 | 0 \ |
| 5488 | -s "fragmenting handshake message" |
| 5489 | |
| 5490 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 5491 | requires_config_enabled MBEDTLS_RSA_C |
| 5492 | requires_config_enabled MBEDTLS_ECDSA_C |
| 5493 | requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_1 |
| 5494 | run_test "DTLS fragmenting: openssl client, DTLS 1.0" \ |
| 5495 | "$P_SRV dtls=1 debug_level=2 \ |
| 5496 | crt_file=data_files/server7_int-ca.crt \ |
| 5497 | key_file=data_files/server7.key \ |
| 5498 | mtu=512 force_version=dtls1" \ |
| 5499 | "$O_CLI -dtls1" \ |
| 5500 | 0 \ |
| 5501 | -s "fragmenting handshake message" |
| 5502 | |
Manuel Pégourié-Gonnard | 38110df | 2018-08-17 12:44:54 +0200 | [diff] [blame] | 5503 | # interop tests for DTLS fragmentating with unreliable connection |
| 5504 | # |
| 5505 | # again we just want to test that the we fragment in a way that |
| 5506 | # pleases other implementations, so we don't need the peer to fragment |
| 5507 | requires_gnutls_next |
| 5508 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 5509 | requires_config_enabled MBEDTLS_RSA_C |
| 5510 | requires_config_enabled MBEDTLS_ECDSA_C |
| 5511 | requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2 |
Manuel Pégourié-Gonnard | 02f3a8a | 2018-08-20 10:49:28 +0200 | [diff] [blame] | 5512 | client_needs_more_time 4 |
Manuel Pégourié-Gonnard | 38110df | 2018-08-17 12:44:54 +0200 | [diff] [blame] | 5513 | run_test "DTLS fragmenting: 3d, gnutls server, DTLS 1.2" \ |
| 5514 | -p "$P_PXY drop=8 delay=8 duplicate=8" \ |
| 5515 | "$G_NEXT_SRV -u" \ |
| 5516 | "$P_CLI dtls=1 debug_level=2 \ |
| 5517 | crt_file=data_files/server8_int-ca2.crt \ |
| 5518 | key_file=data_files/server8.key \ |
Manuel Pégourié-Gonnard | 02f3a8a | 2018-08-20 10:49:28 +0200 | [diff] [blame] | 5519 | hs_timeout=250-60000 mtu=512 force_version=dtls1_2" \ |
Manuel Pégourié-Gonnard | 38110df | 2018-08-17 12:44:54 +0200 | [diff] [blame] | 5520 | 0 \ |
| 5521 | -c "fragmenting handshake message" \ |
| 5522 | -C "error" |
| 5523 | |
| 5524 | requires_gnutls_next |
| 5525 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 5526 | requires_config_enabled MBEDTLS_RSA_C |
| 5527 | requires_config_enabled MBEDTLS_ECDSA_C |
| 5528 | requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_1 |
Manuel Pégourié-Gonnard | 02f3a8a | 2018-08-20 10:49:28 +0200 | [diff] [blame] | 5529 | client_needs_more_time 4 |
Manuel Pégourié-Gonnard | 38110df | 2018-08-17 12:44:54 +0200 | [diff] [blame] | 5530 | run_test "DTLS fragmenting: 3d, gnutls server, DTLS 1.0" \ |
| 5531 | -p "$P_PXY drop=8 delay=8 duplicate=8" \ |
| 5532 | "$G_NEXT_SRV -u" \ |
| 5533 | "$P_CLI dtls=1 debug_level=2 \ |
| 5534 | crt_file=data_files/server8_int-ca2.crt \ |
| 5535 | key_file=data_files/server8.key \ |
Manuel Pégourié-Gonnard | 02f3a8a | 2018-08-20 10:49:28 +0200 | [diff] [blame] | 5536 | hs_timeout=250-60000 mtu=512 force_version=dtls1" \ |
Manuel Pégourié-Gonnard | 38110df | 2018-08-17 12:44:54 +0200 | [diff] [blame] | 5537 | 0 \ |
| 5538 | -c "fragmenting handshake message" \ |
| 5539 | -C "error" |
| 5540 | |
| 5541 | ## The two tests below are disabled due to a bug in GnuTLS client that causes |
| 5542 | ## handshake failures when the NewSessionTicket message is lost, see |
| 5543 | ## https://gitlab.com/gnutls/gnutls/issues/543 |
| 5544 | ## We can re-enable them when a fixed version fo GnuTLS is available |
| 5545 | ## and installed in our CI system. |
| 5546 | ## |
| 5547 | ## # gnutls-cli always tries IPv6 first, and doesn't fall back to IPv4 with DTLS |
| 5548 | ## requires_ipv6 |
Manuel Pégourié-Gonnard | 6151298 | 2018-08-21 09:40:07 +0200 | [diff] [blame] | 5549 | ## requires_gnutls |
Manuel Pégourié-Gonnard | 38110df | 2018-08-17 12:44:54 +0200 | [diff] [blame] | 5550 | ## requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 5551 | ## requires_config_enabled MBEDTLS_RSA_C |
| 5552 | ## requires_config_enabled MBEDTLS_ECDSA_C |
| 5553 | ## requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2 |
Manuel Pégourié-Gonnard | 02f3a8a | 2018-08-20 10:49:28 +0200 | [diff] [blame] | 5554 | ## client_needs_more_time 4 |
Manuel Pégourié-Gonnard | 38110df | 2018-08-17 12:44:54 +0200 | [diff] [blame] | 5555 | ## run_test "DTLS fragmenting: 3d, gnutls client, DTLS 1.2" \ |
| 5556 | ## -p "$P_PXY drop=8 delay=8 duplicate=8" \ |
| 5557 | ## "$P_SRV dtls=1 debug_level=2 server_addr=::1 \ |
| 5558 | ## crt_file=data_files/server7_int-ca.crt \ |
| 5559 | ## key_file=data_files/server7.key \ |
Manuel Pégourié-Gonnard | 02f3a8a | 2018-08-20 10:49:28 +0200 | [diff] [blame] | 5560 | ## hs_timeout=250-60000 mtu=512 force_version=dtls1_2" \ |
Manuel Pégourié-Gonnard | 38110df | 2018-08-17 12:44:54 +0200 | [diff] [blame] | 5561 | ## "$G_CLI -u" \ |
| 5562 | ## 0 \ |
| 5563 | ## -s "fragmenting handshake message" |
| 5564 | ## |
| 5565 | ## # gnutls-cli always tries IPv6 first, and doesn't fall back to IPv4 with DTLS |
| 5566 | ## requires_ipv6 |
Manuel Pégourié-Gonnard | 6151298 | 2018-08-21 09:40:07 +0200 | [diff] [blame] | 5567 | ## requires_gnutls |
Manuel Pégourié-Gonnard | 38110df | 2018-08-17 12:44:54 +0200 | [diff] [blame] | 5568 | ## requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 5569 | ## requires_config_enabled MBEDTLS_RSA_C |
| 5570 | ## requires_config_enabled MBEDTLS_ECDSA_C |
| 5571 | ## requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_1 |
Manuel Pégourié-Gonnard | 02f3a8a | 2018-08-20 10:49:28 +0200 | [diff] [blame] | 5572 | ## client_needs_more_time 4 |
Manuel Pégourié-Gonnard | 38110df | 2018-08-17 12:44:54 +0200 | [diff] [blame] | 5573 | ## run_test "DTLS fragmenting: 3d, gnutls client, DTLS 1.0" \ |
| 5574 | ## -p "$P_PXY drop=8 delay=8 duplicate=8" \ |
| 5575 | ## "$P_SRV dtls=1 debug_level=2 server_addr=::1 \ |
| 5576 | ## crt_file=data_files/server7_int-ca.crt \ |
| 5577 | ## key_file=data_files/server7.key \ |
Manuel Pégourié-Gonnard | 02f3a8a | 2018-08-20 10:49:28 +0200 | [diff] [blame] | 5578 | ## hs_timeout=250-60000 mtu=512 force_version=dtls1" \ |
Manuel Pégourié-Gonnard | 38110df | 2018-08-17 12:44:54 +0200 | [diff] [blame] | 5579 | ## "$G_CLI -u" \ |
| 5580 | ## 0 \ |
| 5581 | ## -s "fragmenting handshake message" |
| 5582 | |
| 5583 | ## Interop test with OpenSSL might triger a bug in recent versions (that |
| 5584 | ## probably won't be fixed before 1.1.1X), so we use an old version that |
| 5585 | ## doesn't have this bug, but unfortunately it doesn't have support for DTLS |
| 5586 | ## 1.2 either, so the DTLS 1.2 tests are commented for now. |
| 5587 | ## Bug report: https://github.com/openssl/openssl/issues/6902 |
| 5588 | ## They should be re-enabled (and the DTLS 1.0 switched back to a non-legacy |
| 5589 | ## version of OpenSSL once a fixed version of OpenSSL is available) |
| 5590 | ## |
| 5591 | ## requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 5592 | ## requires_config_enabled MBEDTLS_RSA_C |
| 5593 | ## requires_config_enabled MBEDTLS_ECDSA_C |
| 5594 | ## requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2 |
Manuel Pégourié-Gonnard | 02f3a8a | 2018-08-20 10:49:28 +0200 | [diff] [blame] | 5595 | ## client_needs_more_time 4 |
Manuel Pégourié-Gonnard | 38110df | 2018-08-17 12:44:54 +0200 | [diff] [blame] | 5596 | ## run_test "DTLS fragmenting: 3d, openssl server, DTLS 1.2" \ |
| 5597 | ## -p "$P_PXY drop=8 delay=8 duplicate=8" \ |
| 5598 | ## "$O_SRV -dtls1_2 -verify 10" \ |
| 5599 | ## "$P_CLI dtls=1 debug_level=2 \ |
| 5600 | ## crt_file=data_files/server8_int-ca2.crt \ |
| 5601 | ## key_file=data_files/server8.key \ |
Manuel Pégourié-Gonnard | 02f3a8a | 2018-08-20 10:49:28 +0200 | [diff] [blame] | 5602 | ## hs_timeout=250-60000 mtu=512 force_version=dtls1_2" \ |
Manuel Pégourié-Gonnard | 38110df | 2018-08-17 12:44:54 +0200 | [diff] [blame] | 5603 | ## 0 \ |
| 5604 | ## -c "fragmenting handshake message" \ |
| 5605 | ## -C "error" |
| 5606 | |
| 5607 | requires_openssl_legacy |
| 5608 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 5609 | requires_config_enabled MBEDTLS_RSA_C |
| 5610 | requires_config_enabled MBEDTLS_ECDSA_C |
| 5611 | requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_1 |
Manuel Pégourié-Gonnard | 02f3a8a | 2018-08-20 10:49:28 +0200 | [diff] [blame] | 5612 | client_needs_more_time 4 |
Manuel Pégourié-Gonnard | 38110df | 2018-08-17 12:44:54 +0200 | [diff] [blame] | 5613 | run_test "DTLS fragmenting: 3d, openssl server, DTLS 1.0" \ |
| 5614 | -p "$P_PXY drop=8 delay=8 duplicate=8" \ |
| 5615 | "$O_LEGACY_SRV -dtls1 -verify 10" \ |
| 5616 | "$P_CLI dtls=1 debug_level=2 \ |
| 5617 | crt_file=data_files/server8_int-ca2.crt \ |
| 5618 | key_file=data_files/server8.key \ |
Manuel Pégourié-Gonnard | 02f3a8a | 2018-08-20 10:49:28 +0200 | [diff] [blame] | 5619 | hs_timeout=250-60000 mtu=512 force_version=dtls1" \ |
Manuel Pégourié-Gonnard | 38110df | 2018-08-17 12:44:54 +0200 | [diff] [blame] | 5620 | 0 \ |
| 5621 | -c "fragmenting handshake message" \ |
| 5622 | -C "error" |
| 5623 | |
| 5624 | ## see comment on the previous-previous test |
| 5625 | ## requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 5626 | ## requires_config_enabled MBEDTLS_RSA_C |
| 5627 | ## requires_config_enabled MBEDTLS_ECDSA_C |
| 5628 | ## requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2 |
Manuel Pégourié-Gonnard | 02f3a8a | 2018-08-20 10:49:28 +0200 | [diff] [blame] | 5629 | ## client_needs_more_time 4 |
Manuel Pégourié-Gonnard | 38110df | 2018-08-17 12:44:54 +0200 | [diff] [blame] | 5630 | ## run_test "DTLS fragmenting: 3d, openssl client, DTLS 1.2" \ |
| 5631 | ## -p "$P_PXY drop=8 delay=8 duplicate=8" \ |
| 5632 | ## "$P_SRV dtls=1 debug_level=2 \ |
| 5633 | ## crt_file=data_files/server7_int-ca.crt \ |
| 5634 | ## key_file=data_files/server7.key \ |
Manuel Pégourié-Gonnard | 02f3a8a | 2018-08-20 10:49:28 +0200 | [diff] [blame] | 5635 | ## hs_timeout=250-60000 mtu=512 force_version=dtls1_2" \ |
Manuel Pégourié-Gonnard | 38110df | 2018-08-17 12:44:54 +0200 | [diff] [blame] | 5636 | ## "$O_CLI -dtls1_2" \ |
| 5637 | ## 0 \ |
| 5638 | ## -s "fragmenting handshake message" |
| 5639 | |
| 5640 | # -nbio is added to prevent s_client from blocking in case of duplicated |
| 5641 | # messages at the end of the handshake |
Hanno Becker | 9829315 | 2018-08-17 16:10:47 +0100 | [diff] [blame] | 5642 | requires_openssl_legacy |
Manuel Pégourié-Gonnard | 38110df | 2018-08-17 12:44:54 +0200 | [diff] [blame] | 5643 | requires_config_enabled MBEDTLS_SSL_PROTO_DTLS |
| 5644 | requires_config_enabled MBEDTLS_RSA_C |
| 5645 | requires_config_enabled MBEDTLS_ECDSA_C |
| 5646 | requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_1 |
Manuel Pégourié-Gonnard | 02f3a8a | 2018-08-20 10:49:28 +0200 | [diff] [blame] | 5647 | client_needs_more_time 4 |
Manuel Pégourié-Gonnard | 38110df | 2018-08-17 12:44:54 +0200 | [diff] [blame] | 5648 | run_test "DTLS fragmenting: 3d, openssl client, DTLS 1.0" \ |
| 5649 | -p "$P_PXY drop=8 delay=8 duplicate=8" \ |
| 5650 | "$P_SRV dtls=1 debug_level=2 \ |
| 5651 | crt_file=data_files/server7_int-ca.crt \ |
| 5652 | key_file=data_files/server7.key \ |
Manuel Pégourié-Gonnard | 02f3a8a | 2018-08-20 10:49:28 +0200 | [diff] [blame] | 5653 | hs_timeout=250-60000 mtu=512 force_version=dtls1" \ |
Manuel Pégourié-Gonnard | 38110df | 2018-08-17 12:44:54 +0200 | [diff] [blame] | 5654 | "$O_LEGACY_CLI -nbio -dtls1" \ |
| 5655 | 0 \ |
| 5656 | -s "fragmenting handshake message" |
| 5657 | |
Manuel Pégourié-Gonnard | 7a66cbc | 2014-09-26 16:31:46 +0200 | [diff] [blame] | 5658 | # Tests for specific things with "unreliable" UDP connection |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 5659 | |
Manuel Pégourié-Gonnard | 76fe9e4 | 2014-09-24 15:17:31 +0200 | [diff] [blame] | 5660 | not_with_valgrind # spurious resend due to timeout |
Manuel Pégourié-Gonnard | 990f9e4 | 2014-09-06 12:27:02 +0200 | [diff] [blame] | 5661 | run_test "DTLS proxy: reference" \ |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 5662 | -p "$P_PXY" \ |
Manuel Pégourié-Gonnard | 76fe9e4 | 2014-09-24 15:17:31 +0200 | [diff] [blame] | 5663 | "$P_SRV dtls=1 debug_level=2" \ |
| 5664 | "$P_CLI dtls=1 debug_level=2" \ |
Manuel Pégourié-Gonnard | 990f9e4 | 2014-09-06 12:27:02 +0200 | [diff] [blame] | 5665 | 0 \ |
Manuel Pégourié-Gonnard | 246c13a | 2014-09-24 13:56:09 +0200 | [diff] [blame] | 5666 | -C "replayed record" \ |
| 5667 | -S "replayed record" \ |
| 5668 | -C "record from another epoch" \ |
| 5669 | -S "record from another epoch" \ |
| 5670 | -C "discarding invalid record" \ |
| 5671 | -S "discarding invalid record" \ |
Manuel Pégourié-Gonnard | 76fe9e4 | 2014-09-24 15:17:31 +0200 | [diff] [blame] | 5672 | -S "resend" \ |
Manuel Pégourié-Gonnard | 63eca93 | 2014-09-08 16:39:08 +0200 | [diff] [blame] | 5673 | -s "Extra-header:" \ |
Manuel Pégourié-Gonnard | 990f9e4 | 2014-09-06 12:27:02 +0200 | [diff] [blame] | 5674 | -c "HTTP/1.0 200 OK" |
| 5675 | |
Manuel Pégourié-Gonnard | 76fe9e4 | 2014-09-24 15:17:31 +0200 | [diff] [blame] | 5676 | not_with_valgrind # spurious resend due to timeout |
Manuel Pégourié-Gonnard | b47368a | 2014-09-24 13:29:58 +0200 | [diff] [blame] | 5677 | run_test "DTLS proxy: duplicate every packet" \ |
Manuel Pégourié-Gonnard | 990f9e4 | 2014-09-06 12:27:02 +0200 | [diff] [blame] | 5678 | -p "$P_PXY duplicate=1" \ |
Manuel Pégourié-Gonnard | 76fe9e4 | 2014-09-24 15:17:31 +0200 | [diff] [blame] | 5679 | "$P_SRV dtls=1 debug_level=2" \ |
| 5680 | "$P_CLI dtls=1 debug_level=2" \ |
Manuel Pégourié-Gonnard | 990f9e4 | 2014-09-06 12:27:02 +0200 | [diff] [blame] | 5681 | 0 \ |
Manuel Pégourié-Gonnard | b47368a | 2014-09-24 13:29:58 +0200 | [diff] [blame] | 5682 | -c "replayed record" \ |
| 5683 | -s "replayed record" \ |
Hanno Becker | 52c6dc6 | 2017-05-26 16:07:36 +0100 | [diff] [blame] | 5684 | -c "record from another epoch" \ |
| 5685 | -s "record from another epoch" \ |
Manuel Pégourié-Gonnard | 76fe9e4 | 2014-09-24 15:17:31 +0200 | [diff] [blame] | 5686 | -S "resend" \ |
Manuel Pégourié-Gonnard | 63eca93 | 2014-09-08 16:39:08 +0200 | [diff] [blame] | 5687 | -s "Extra-header:" \ |
| 5688 | -c "HTTP/1.0 200 OK" |
| 5689 | |
Manuel Pégourié-Gonnard | 2739313 | 2014-09-24 14:41:11 +0200 | [diff] [blame] | 5690 | run_test "DTLS proxy: duplicate every packet, server anti-replay off" \ |
| 5691 | -p "$P_PXY duplicate=1" \ |
Manuel Pégourié-Gonnard | 76fe9e4 | 2014-09-24 15:17:31 +0200 | [diff] [blame] | 5692 | "$P_SRV dtls=1 debug_level=2 anti_replay=0" \ |
| 5693 | "$P_CLI dtls=1 debug_level=2" \ |
Manuel Pégourié-Gonnard | 2739313 | 2014-09-24 14:41:11 +0200 | [diff] [blame] | 5694 | 0 \ |
| 5695 | -c "replayed record" \ |
| 5696 | -S "replayed record" \ |
Hanno Becker | 52c6dc6 | 2017-05-26 16:07:36 +0100 | [diff] [blame] | 5697 | -c "record from another epoch" \ |
| 5698 | -s "record from another epoch" \ |
Manuel Pégourié-Gonnard | 76fe9e4 | 2014-09-24 15:17:31 +0200 | [diff] [blame] | 5699 | -c "resend" \ |
| 5700 | -s "resend" \ |
Manuel Pégourié-Gonnard | 2739313 | 2014-09-24 14:41:11 +0200 | [diff] [blame] | 5701 | -s "Extra-header:" \ |
| 5702 | -c "HTTP/1.0 200 OK" |
| 5703 | |
Hanno Becker | 72a4f03 | 2017-11-15 16:39:20 +0000 | [diff] [blame] | 5704 | run_test "DTLS proxy: multiple records in same datagram" \ |
Hanno Becker | 8d83218 | 2018-03-15 10:14:19 +0000 | [diff] [blame] | 5705 | -p "$P_PXY pack=50" \ |
Hanno Becker | 72a4f03 | 2017-11-15 16:39:20 +0000 | [diff] [blame] | 5706 | "$P_SRV dtls=1 debug_level=2" \ |
| 5707 | "$P_CLI dtls=1 debug_level=2" \ |
| 5708 | 0 \ |
| 5709 | -c "next record in same datagram" \ |
| 5710 | -s "next record in same datagram" |
| 5711 | |
| 5712 | run_test "DTLS proxy: multiple records in same datagram, duplicate every packet" \ |
Hanno Becker | 8d83218 | 2018-03-15 10:14:19 +0000 | [diff] [blame] | 5713 | -p "$P_PXY pack=50 duplicate=1" \ |
Hanno Becker | 72a4f03 | 2017-11-15 16:39:20 +0000 | [diff] [blame] | 5714 | "$P_SRV dtls=1 debug_level=2" \ |
| 5715 | "$P_CLI dtls=1 debug_level=2" \ |
| 5716 | 0 \ |
| 5717 | -c "next record in same datagram" \ |
| 5718 | -s "next record in same datagram" |
| 5719 | |
Manuel Pégourié-Gonnard | e698f59 | 2014-10-14 19:36:36 +0200 | [diff] [blame] | 5720 | 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] | 5721 | -p "$P_PXY bad_ad=1" \ |
Manuel Pégourié-Gonnard | 246c13a | 2014-09-24 13:56:09 +0200 | [diff] [blame] | 5722 | "$P_SRV dtls=1 debug_level=1" \ |
Manuel Pégourié-Gonnard | e698f59 | 2014-10-14 19:36:36 +0200 | [diff] [blame] | 5723 | "$P_CLI dtls=1 debug_level=1 read_timeout=100" \ |
Manuel Pégourié-Gonnard | 825a49e | 2014-09-23 11:00:37 +0200 | [diff] [blame] | 5724 | 0 \ |
Manuel Pégourié-Gonnard | 74a1378 | 2014-10-14 22:34:08 +0200 | [diff] [blame] | 5725 | -c "discarding invalid record (mac)" \ |
| 5726 | -s "discarding invalid record (mac)" \ |
Manuel Pégourié-Gonnard | 825a49e | 2014-09-23 11:00:37 +0200 | [diff] [blame] | 5727 | -s "Extra-header:" \ |
Manuel Pégourié-Gonnard | e698f59 | 2014-10-14 19:36:36 +0200 | [diff] [blame] | 5728 | -c "HTTP/1.0 200 OK" \ |
| 5729 | -S "too many records with bad MAC" \ |
| 5730 | -S "Verification of the message MAC failed" |
| 5731 | |
| 5732 | run_test "DTLS proxy: inject invalid AD record, badmac_limit 1" \ |
| 5733 | -p "$P_PXY bad_ad=1" \ |
| 5734 | "$P_SRV dtls=1 debug_level=1 badmac_limit=1" \ |
| 5735 | "$P_CLI dtls=1 debug_level=1 read_timeout=100" \ |
| 5736 | 1 \ |
Manuel Pégourié-Gonnard | 74a1378 | 2014-10-14 22:34:08 +0200 | [diff] [blame] | 5737 | -C "discarding invalid record (mac)" \ |
| 5738 | -S "discarding invalid record (mac)" \ |
Manuel Pégourié-Gonnard | e698f59 | 2014-10-14 19:36:36 +0200 | [diff] [blame] | 5739 | -S "Extra-header:" \ |
| 5740 | -C "HTTP/1.0 200 OK" \ |
| 5741 | -s "too many records with bad MAC" \ |
| 5742 | -s "Verification of the message MAC failed" |
| 5743 | |
| 5744 | run_test "DTLS proxy: inject invalid AD record, badmac_limit 2" \ |
| 5745 | -p "$P_PXY bad_ad=1" \ |
| 5746 | "$P_SRV dtls=1 debug_level=1 badmac_limit=2" \ |
| 5747 | "$P_CLI dtls=1 debug_level=1 read_timeout=100" \ |
| 5748 | 0 \ |
Manuel Pégourié-Gonnard | 74a1378 | 2014-10-14 22:34:08 +0200 | [diff] [blame] | 5749 | -c "discarding invalid record (mac)" \ |
| 5750 | -s "discarding invalid record (mac)" \ |
Manuel Pégourié-Gonnard | e698f59 | 2014-10-14 19:36:36 +0200 | [diff] [blame] | 5751 | -s "Extra-header:" \ |
| 5752 | -c "HTTP/1.0 200 OK" \ |
| 5753 | -S "too many records with bad MAC" \ |
| 5754 | -S "Verification of the message MAC failed" |
| 5755 | |
| 5756 | run_test "DTLS proxy: inject invalid AD record, badmac_limit 2, exchanges 2"\ |
| 5757 | -p "$P_PXY bad_ad=1" \ |
| 5758 | "$P_SRV dtls=1 debug_level=1 badmac_limit=2 exchanges=2" \ |
| 5759 | "$P_CLI dtls=1 debug_level=1 read_timeout=100 exchanges=2" \ |
| 5760 | 1 \ |
Manuel Pégourié-Gonnard | 74a1378 | 2014-10-14 22:34:08 +0200 | [diff] [blame] | 5761 | -c "discarding invalid record (mac)" \ |
| 5762 | -s "discarding invalid record (mac)" \ |
Manuel Pégourié-Gonnard | e698f59 | 2014-10-14 19:36:36 +0200 | [diff] [blame] | 5763 | -s "Extra-header:" \ |
| 5764 | -c "HTTP/1.0 200 OK" \ |
| 5765 | -s "too many records with bad MAC" \ |
| 5766 | -s "Verification of the message MAC failed" |
Manuel Pégourié-Gonnard | 825a49e | 2014-09-23 11:00:37 +0200 | [diff] [blame] | 5767 | |
| 5768 | run_test "DTLS proxy: delay ChangeCipherSpec" \ |
Manuel Pégourié-Gonnard | 246c13a | 2014-09-24 13:56:09 +0200 | [diff] [blame] | 5769 | -p "$P_PXY delay_ccs=1" \ |
| 5770 | "$P_SRV dtls=1 debug_level=1" \ |
| 5771 | "$P_CLI dtls=1 debug_level=1" \ |
Manuel Pégourié-Gonnard | 825a49e | 2014-09-23 11:00:37 +0200 | [diff] [blame] | 5772 | 0 \ |
Manuel Pégourié-Gonnard | 246c13a | 2014-09-24 13:56:09 +0200 | [diff] [blame] | 5773 | -c "record from another epoch" \ |
| 5774 | -s "record from another epoch" \ |
Manuel Pégourié-Gonnard | 825a49e | 2014-09-23 11:00:37 +0200 | [diff] [blame] | 5775 | -s "Extra-header:" \ |
| 5776 | -c "HTTP/1.0 200 OK" |
| 5777 | |
Manuel Pégourié-Gonnard | 7a66cbc | 2014-09-26 16:31:46 +0200 | [diff] [blame] | 5778 | # 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] | 5779 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 5780 | client_needs_more_time 2 |
Manuel Pégourié-Gonnard | 18e519a | 2014-09-24 19:09:17 +0200 | [diff] [blame] | 5781 | 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] | 5782 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
Manuel Pégourié-Gonnard | 37a4de2 | 2014-10-01 16:38:03 +0200 | [diff] [blame] | 5783 | "$P_SRV dtls=1 hs_timeout=250-10000 tickets=0 auth_mode=none \ |
| 5784 | psk=abc123" \ |
| 5785 | "$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] | 5786 | force_ciphersuite=TLS-PSK-WITH-AES-128-CCM-8" \ |
| 5787 | 0 \ |
| 5788 | -s "Extra-header:" \ |
| 5789 | -c "HTTP/1.0 200 OK" |
| 5790 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 5791 | client_needs_more_time 2 |
Manuel Pégourié-Gonnard | 18e519a | 2014-09-24 19:09:17 +0200 | [diff] [blame] | 5792 | run_test "DTLS proxy: 3d, \"short\" RSA handshake" \ |
| 5793 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
Manuel Pégourié-Gonnard | 37a4de2 | 2014-10-01 16:38:03 +0200 | [diff] [blame] | 5794 | "$P_SRV dtls=1 hs_timeout=250-10000 tickets=0 auth_mode=none" \ |
| 5795 | "$P_CLI dtls=1 hs_timeout=250-10000 tickets=0 \ |
Manuel Pégourié-Gonnard | 18e519a | 2014-09-24 19:09:17 +0200 | [diff] [blame] | 5796 | force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| 5797 | 0 \ |
| 5798 | -s "Extra-header:" \ |
| 5799 | -c "HTTP/1.0 200 OK" |
| 5800 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 5801 | client_needs_more_time 2 |
Manuel Pégourié-Gonnard | 18e519a | 2014-09-24 19:09:17 +0200 | [diff] [blame] | 5802 | run_test "DTLS proxy: 3d, \"short\" (no ticket, no cli_auth) FS handshake" \ |
| 5803 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
Manuel Pégourié-Gonnard | 37a4de2 | 2014-10-01 16:38:03 +0200 | [diff] [blame] | 5804 | "$P_SRV dtls=1 hs_timeout=250-10000 tickets=0 auth_mode=none" \ |
| 5805 | "$P_CLI dtls=1 hs_timeout=250-10000 tickets=0" \ |
Manuel Pégourié-Gonnard | 18e519a | 2014-09-24 19:09:17 +0200 | [diff] [blame] | 5806 | 0 \ |
| 5807 | -s "Extra-header:" \ |
| 5808 | -c "HTTP/1.0 200 OK" |
| 5809 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 5810 | client_needs_more_time 2 |
Manuel Pégourié-Gonnard | 18e519a | 2014-09-24 19:09:17 +0200 | [diff] [blame] | 5811 | run_test "DTLS proxy: 3d, FS, client auth" \ |
| 5812 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
Manuel Pégourié-Gonnard | 37a4de2 | 2014-10-01 16:38:03 +0200 | [diff] [blame] | 5813 | "$P_SRV dtls=1 hs_timeout=250-10000 tickets=0 auth_mode=required" \ |
| 5814 | "$P_CLI dtls=1 hs_timeout=250-10000 tickets=0" \ |
Manuel Pégourié-Gonnard | 18e519a | 2014-09-24 19:09:17 +0200 | [diff] [blame] | 5815 | 0 \ |
| 5816 | -s "Extra-header:" \ |
| 5817 | -c "HTTP/1.0 200 OK" |
| 5818 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 5819 | client_needs_more_time 2 |
Manuel Pégourié-Gonnard | 18e519a | 2014-09-24 19:09:17 +0200 | [diff] [blame] | 5820 | run_test "DTLS proxy: 3d, FS, ticket" \ |
| 5821 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
Manuel Pégourié-Gonnard | 37a4de2 | 2014-10-01 16:38:03 +0200 | [diff] [blame] | 5822 | "$P_SRV dtls=1 hs_timeout=250-10000 tickets=1 auth_mode=none" \ |
| 5823 | "$P_CLI dtls=1 hs_timeout=250-10000 tickets=1" \ |
Manuel Pégourié-Gonnard | 18e519a | 2014-09-24 19:09:17 +0200 | [diff] [blame] | 5824 | 0 \ |
| 5825 | -s "Extra-header:" \ |
| 5826 | -c "HTTP/1.0 200 OK" |
| 5827 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 5828 | client_needs_more_time 2 |
Manuel Pégourié-Gonnard | 18e519a | 2014-09-24 19:09:17 +0200 | [diff] [blame] | 5829 | run_test "DTLS proxy: 3d, max handshake (FS, ticket + client auth)" \ |
| 5830 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
Manuel Pégourié-Gonnard | 37a4de2 | 2014-10-01 16:38:03 +0200 | [diff] [blame] | 5831 | "$P_SRV dtls=1 hs_timeout=250-10000 tickets=1 auth_mode=required" \ |
| 5832 | "$P_CLI dtls=1 hs_timeout=250-10000 tickets=1" \ |
Manuel Pégourié-Gonnard | 825a49e | 2014-09-23 11:00:37 +0200 | [diff] [blame] | 5833 | 0 \ |
| 5834 | -s "Extra-header:" \ |
| 5835 | -c "HTTP/1.0 200 OK" |
| 5836 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 5837 | client_needs_more_time 2 |
Manuel Pégourié-Gonnard | 6093d81 | 2014-09-29 17:52:57 +0200 | [diff] [blame] | 5838 | run_test "DTLS proxy: 3d, max handshake, nbio" \ |
| 5839 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
Manuel Pégourié-Gonnard | 37a4de2 | 2014-10-01 16:38:03 +0200 | [diff] [blame] | 5840 | "$P_SRV dtls=1 hs_timeout=250-10000 nbio=2 tickets=1 \ |
| 5841 | auth_mode=required" \ |
| 5842 | "$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] | 5843 | 0 \ |
| 5844 | -s "Extra-header:" \ |
| 5845 | -c "HTTP/1.0 200 OK" |
| 5846 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 5847 | client_needs_more_time 4 |
Manuel Pégourié-Gonnard | 7a26d73 | 2014-10-02 14:50:46 +0200 | [diff] [blame] | 5848 | run_test "DTLS proxy: 3d, min handshake, resumption" \ |
| 5849 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
| 5850 | "$P_SRV dtls=1 hs_timeout=250-10000 tickets=0 auth_mode=none \ |
| 5851 | psk=abc123 debug_level=3" \ |
| 5852 | "$P_CLI dtls=1 hs_timeout=250-10000 tickets=0 psk=abc123 \ |
| 5853 | debug_level=3 reconnect=1 read_timeout=1000 max_resend=10 \ |
| 5854 | force_ciphersuite=TLS-PSK-WITH-AES-128-CCM-8" \ |
| 5855 | 0 \ |
| 5856 | -s "a session has been resumed" \ |
| 5857 | -c "a session has been resumed" \ |
| 5858 | -s "Extra-header:" \ |
| 5859 | -c "HTTP/1.0 200 OK" |
| 5860 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 5861 | client_needs_more_time 4 |
Manuel Pégourié-Gonnard | 85beb30 | 2014-10-02 17:59:19 +0200 | [diff] [blame] | 5862 | run_test "DTLS proxy: 3d, min handshake, resumption, nbio" \ |
| 5863 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
| 5864 | "$P_SRV dtls=1 hs_timeout=250-10000 tickets=0 auth_mode=none \ |
| 5865 | psk=abc123 debug_level=3 nbio=2" \ |
| 5866 | "$P_CLI dtls=1 hs_timeout=250-10000 tickets=0 psk=abc123 \ |
| 5867 | debug_level=3 reconnect=1 read_timeout=1000 max_resend=10 \ |
| 5868 | force_ciphersuite=TLS-PSK-WITH-AES-128-CCM-8 nbio=2" \ |
| 5869 | 0 \ |
| 5870 | -s "a session has been resumed" \ |
| 5871 | -c "a session has been resumed" \ |
| 5872 | -s "Extra-header:" \ |
| 5873 | -c "HTTP/1.0 200 OK" |
| 5874 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 5875 | client_needs_more_time 4 |
Hanno Becker | 6a24364 | 2017-10-12 15:18:45 +0100 | [diff] [blame] | 5876 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
Manuel Pégourié-Gonnard | 6093d81 | 2014-09-29 17:52:57 +0200 | [diff] [blame] | 5877 | run_test "DTLS proxy: 3d, min handshake, client-initiated renego" \ |
Manuel Pégourié-Gonnard | 1b753f1 | 2014-09-25 16:09:36 +0200 | [diff] [blame] | 5878 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
Manuel Pégourié-Gonnard | 37a4de2 | 2014-10-01 16:38:03 +0200 | [diff] [blame] | 5879 | "$P_SRV dtls=1 hs_timeout=250-10000 tickets=0 auth_mode=none \ |
| 5880 | psk=abc123 renegotiation=1 debug_level=2" \ |
| 5881 | "$P_CLI dtls=1 hs_timeout=250-10000 tickets=0 psk=abc123 \ |
| 5882 | renegotiate=1 debug_level=2 \ |
Manuel Pégourié-Gonnard | 1b753f1 | 2014-09-25 16:09:36 +0200 | [diff] [blame] | 5883 | force_ciphersuite=TLS-PSK-WITH-AES-128-CCM-8" \ |
| 5884 | 0 \ |
| 5885 | -c "=> renegotiate" \ |
| 5886 | -s "=> renegotiate" \ |
| 5887 | -s "Extra-header:" \ |
| 5888 | -c "HTTP/1.0 200 OK" |
| 5889 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 5890 | client_needs_more_time 4 |
Hanno Becker | 6a24364 | 2017-10-12 15:18:45 +0100 | [diff] [blame] | 5891 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
Manuel Pégourié-Gonnard | 6093d81 | 2014-09-29 17:52:57 +0200 | [diff] [blame] | 5892 | run_test "DTLS proxy: 3d, min handshake, client-initiated renego, nbio" \ |
| 5893 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
Manuel Pégourié-Gonnard | 37a4de2 | 2014-10-01 16:38:03 +0200 | [diff] [blame] | 5894 | "$P_SRV dtls=1 hs_timeout=250-10000 tickets=0 auth_mode=none \ |
| 5895 | psk=abc123 renegotiation=1 debug_level=2" \ |
| 5896 | "$P_CLI dtls=1 hs_timeout=250-10000 tickets=0 psk=abc123 \ |
| 5897 | renegotiate=1 debug_level=2 \ |
Manuel Pégourié-Gonnard | 6093d81 | 2014-09-29 17:52:57 +0200 | [diff] [blame] | 5898 | force_ciphersuite=TLS-PSK-WITH-AES-128-CCM-8" \ |
| 5899 | 0 \ |
| 5900 | -c "=> renegotiate" \ |
| 5901 | -s "=> renegotiate" \ |
| 5902 | -s "Extra-header:" \ |
| 5903 | -c "HTTP/1.0 200 OK" |
| 5904 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 5905 | client_needs_more_time 4 |
Hanno Becker | 6a24364 | 2017-10-12 15:18:45 +0100 | [diff] [blame] | 5906 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
Manuel Pégourié-Gonnard | ba958b8 | 2014-10-09 16:13:44 +0200 | [diff] [blame] | 5907 | run_test "DTLS proxy: 3d, min handshake, server-initiated renego" \ |
Manuel Pégourié-Gonnard | a6ace04 | 2014-10-15 12:44:41 +0200 | [diff] [blame] | 5908 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
Manuel Pégourié-Gonnard | ba958b8 | 2014-10-09 16:13:44 +0200 | [diff] [blame] | 5909 | "$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] | 5910 | psk=abc123 renegotiate=1 renegotiation=1 exchanges=4 \ |
Manuel Pégourié-Gonnard | ba958b8 | 2014-10-09 16:13:44 +0200 | [diff] [blame] | 5911 | debug_level=2" \ |
| 5912 | "$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] | 5913 | renegotiation=1 exchanges=4 debug_level=2 \ |
Manuel Pégourié-Gonnard | ba958b8 | 2014-10-09 16:13:44 +0200 | [diff] [blame] | 5914 | force_ciphersuite=TLS-PSK-WITH-AES-128-CCM-8" \ |
| 5915 | 0 \ |
| 5916 | -c "=> renegotiate" \ |
| 5917 | -s "=> renegotiate" \ |
| 5918 | -s "Extra-header:" \ |
| 5919 | -c "HTTP/1.0 200 OK" |
| 5920 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 5921 | client_needs_more_time 4 |
Hanno Becker | 6a24364 | 2017-10-12 15:18:45 +0100 | [diff] [blame] | 5922 | requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
Manuel Pégourié-Gonnard | ba958b8 | 2014-10-09 16:13:44 +0200 | [diff] [blame] | 5923 | 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] | 5924 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
Manuel Pégourié-Gonnard | ba958b8 | 2014-10-09 16:13:44 +0200 | [diff] [blame] | 5925 | "$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] | 5926 | psk=abc123 renegotiate=1 renegotiation=1 exchanges=4 \ |
Manuel Pégourié-Gonnard | ba958b8 | 2014-10-09 16:13:44 +0200 | [diff] [blame] | 5927 | debug_level=2 nbio=2" \ |
| 5928 | "$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] | 5929 | renegotiation=1 exchanges=4 debug_level=2 nbio=2 \ |
Manuel Pégourié-Gonnard | ba958b8 | 2014-10-09 16:13:44 +0200 | [diff] [blame] | 5930 | force_ciphersuite=TLS-PSK-WITH-AES-128-CCM-8" \ |
| 5931 | 0 \ |
| 5932 | -c "=> renegotiate" \ |
| 5933 | -s "=> renegotiate" \ |
| 5934 | -s "Extra-header:" \ |
| 5935 | -c "HTTP/1.0 200 OK" |
| 5936 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 5937 | client_needs_more_time 6 |
Manuel Pégourié-Gonnard | d68434e | 2015-08-31 12:48:22 +0200 | [diff] [blame] | 5938 | not_with_valgrind # risk of non-mbedtls peer timing out |
Manuel Pégourié-Gonnard | 9590e0a | 2014-09-26 16:27:59 +0200 | [diff] [blame] | 5939 | run_test "DTLS proxy: 3d, openssl server" \ |
Manuel Pégourié-Gonnard | d0fd1da | 2014-09-25 17:00:27 +0200 | [diff] [blame] | 5940 | -p "$P_PXY drop=5 delay=5 duplicate=5 protect_hvr=1" \ |
| 5941 | "$O_SRV -dtls1 -mtu 2048" \ |
Manuel Pégourié-Gonnard | 8fe411e | 2015-03-09 16:09:53 +0000 | [diff] [blame] | 5942 | "$P_CLI dtls=1 hs_timeout=250-60000 tickets=0" \ |
Manuel Pégourié-Gonnard | d0fd1da | 2014-09-25 17:00:27 +0200 | [diff] [blame] | 5943 | 0 \ |
Manuel Pégourié-Gonnard | d0fd1da | 2014-09-25 17:00:27 +0200 | [diff] [blame] | 5944 | -c "HTTP/1.0 200 OK" |
| 5945 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 5946 | client_needs_more_time 8 |
Manuel Pégourié-Gonnard | d68434e | 2015-08-31 12:48:22 +0200 | [diff] [blame] | 5947 | not_with_valgrind # risk of non-mbedtls peer timing out |
Manuel Pégourié-Gonnard | 9590e0a | 2014-09-26 16:27:59 +0200 | [diff] [blame] | 5948 | run_test "DTLS proxy: 3d, openssl server, fragmentation" \ |
| 5949 | -p "$P_PXY drop=5 delay=5 duplicate=5 protect_hvr=1" \ |
| 5950 | "$O_SRV -dtls1 -mtu 768" \ |
Manuel Pégourié-Gonnard | 8fe411e | 2015-03-09 16:09:53 +0000 | [diff] [blame] | 5951 | "$P_CLI dtls=1 hs_timeout=250-60000 tickets=0" \ |
Manuel Pégourié-Gonnard | 9590e0a | 2014-09-26 16:27:59 +0200 | [diff] [blame] | 5952 | 0 \ |
Manuel Pégourié-Gonnard | 9590e0a | 2014-09-26 16:27:59 +0200 | [diff] [blame] | 5953 | -c "HTTP/1.0 200 OK" |
| 5954 | |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 5955 | client_needs_more_time 8 |
Manuel Pégourié-Gonnard | d68434e | 2015-08-31 12:48:22 +0200 | [diff] [blame] | 5956 | not_with_valgrind # risk of non-mbedtls peer timing out |
Manuel Pégourié-Gonnard | 6093d81 | 2014-09-29 17:52:57 +0200 | [diff] [blame] | 5957 | run_test "DTLS proxy: 3d, openssl server, fragmentation, nbio" \ |
| 5958 | -p "$P_PXY drop=5 delay=5 duplicate=5 protect_hvr=1" \ |
| 5959 | "$O_SRV -dtls1 -mtu 768" \ |
Manuel Pégourié-Gonnard | 8fe411e | 2015-03-09 16:09:53 +0000 | [diff] [blame] | 5960 | "$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] | 5961 | 0 \ |
Manuel Pégourié-Gonnard | 6093d81 | 2014-09-29 17:52:57 +0200 | [diff] [blame] | 5962 | -c "HTTP/1.0 200 OK" |
| 5963 | |
Manuel Pégourié-Gonnard | 9699996 | 2015-02-17 16:02:37 +0000 | [diff] [blame] | 5964 | requires_gnutls |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 5965 | client_needs_more_time 6 |
Manuel Pégourié-Gonnard | d68434e | 2015-08-31 12:48:22 +0200 | [diff] [blame] | 5966 | not_with_valgrind # risk of non-mbedtls peer timing out |
Manuel Pégourié-Gonnard | 9590e0a | 2014-09-26 16:27:59 +0200 | [diff] [blame] | 5967 | run_test "DTLS proxy: 3d, gnutls server" \ |
| 5968 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
| 5969 | "$G_SRV -u --mtu 2048 -a" \ |
Manuel Pégourié-Gonnard | f138447 | 2014-10-14 22:57:46 +0200 | [diff] [blame] | 5970 | "$P_CLI dtls=1 hs_timeout=250-60000" \ |
Manuel Pégourié-Gonnard | 9590e0a | 2014-09-26 16:27:59 +0200 | [diff] [blame] | 5971 | 0 \ |
| 5972 | -s "Extra-header:" \ |
| 5973 | -c "Extra-header:" |
| 5974 | |
Manuel Pégourié-Gonnard | 9699996 | 2015-02-17 16:02:37 +0000 | [diff] [blame] | 5975 | requires_gnutls |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 5976 | client_needs_more_time 8 |
Manuel Pégourié-Gonnard | d68434e | 2015-08-31 12:48:22 +0200 | [diff] [blame] | 5977 | not_with_valgrind # risk of non-mbedtls peer timing out |
Manuel Pégourié-Gonnard | 9590e0a | 2014-09-26 16:27:59 +0200 | [diff] [blame] | 5978 | run_test "DTLS proxy: 3d, gnutls server, fragmentation" \ |
| 5979 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
| 5980 | "$G_SRV -u --mtu 512" \ |
Manuel Pégourié-Gonnard | f138447 | 2014-10-14 22:57:46 +0200 | [diff] [blame] | 5981 | "$P_CLI dtls=1 hs_timeout=250-60000" \ |
Manuel Pégourié-Gonnard | 9590e0a | 2014-09-26 16:27:59 +0200 | [diff] [blame] | 5982 | 0 \ |
| 5983 | -s "Extra-header:" \ |
| 5984 | -c "Extra-header:" |
| 5985 | |
Manuel Pégourié-Gonnard | 9699996 | 2015-02-17 16:02:37 +0000 | [diff] [blame] | 5986 | requires_gnutls |
Janos Follath | 74537a6 | 2016-09-02 13:45:28 +0100 | [diff] [blame] | 5987 | client_needs_more_time 8 |
Manuel Pégourié-Gonnard | d68434e | 2015-08-31 12:48:22 +0200 | [diff] [blame] | 5988 | not_with_valgrind # risk of non-mbedtls peer timing out |
Manuel Pégourié-Gonnard | 6093d81 | 2014-09-29 17:52:57 +0200 | [diff] [blame] | 5989 | run_test "DTLS proxy: 3d, gnutls server, fragmentation, nbio" \ |
| 5990 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
| 5991 | "$G_SRV -u --mtu 512" \ |
Manuel Pégourié-Gonnard | f138447 | 2014-10-14 22:57:46 +0200 | [diff] [blame] | 5992 | "$P_CLI dtls=1 hs_timeout=250-60000 nbio=2" \ |
Manuel Pégourié-Gonnard | 6093d81 | 2014-09-29 17:52:57 +0200 | [diff] [blame] | 5993 | 0 \ |
| 5994 | -s "Extra-header:" \ |
| 5995 | -c "Extra-header:" |
| 5996 | |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 5997 | # Final report |
| 5998 | |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 5999 | echo "------------------------------------------------------------------------" |
| 6000 | |
| 6001 | if [ $FAILS = 0 ]; then |
Manuel Pégourié-Gonnard | f46f128 | 2014-12-11 11:51:28 +0100 | [diff] [blame] | 6002 | printf "PASSED" |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 6003 | else |
Manuel Pégourié-Gonnard | f46f128 | 2014-12-11 11:51:28 +0100 | [diff] [blame] | 6004 | printf "FAILED" |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 6005 | fi |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 6006 | PASSES=$(( $TESTS - $FAILS )) |
Manuel Pégourié-Gonnard | 6f4fbbb | 2014-08-14 14:31:29 +0200 | [diff] [blame] | 6007 | echo " ($PASSES / $TESTS tests ($SKIPS skipped))" |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 6008 | |
| 6009 | exit $FAILS |