Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # Test various options that are not covered by compat.sh |
| 4 | # |
| 5 | # Here the goal is not to cover every ciphersuite/version, but |
| 6 | # rather specific options (max fragment length, truncated hmac, etc) |
| 7 | # or procedures (session resumption from cache or ticket, renego, etc). |
| 8 | # |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 9 | # Assumes a build with default options. |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 10 | |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 11 | set -u |
| 12 | |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 13 | # default values, can be overriden by the environment |
| 14 | : ${P_SRV:=../programs/ssl/ssl_server2} |
| 15 | : ${P_CLI:=../programs/ssl/ssl_client2} |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 16 | : ${P_PXY:=../programs/test/udp_proxy} |
Manuel Pégourié-Gonnard | 74faf3c | 2014-03-13 18:47:44 +0100 | [diff] [blame] | 17 | : ${OPENSSL_CMD:=openssl} # OPENSSL would conflict with the build system |
Manuel Pégourié-Gonnard | baa7f07 | 2014-08-20 20:15:53 +0200 | [diff] [blame] | 18 | : ${GNUTLS_CLI:=gnutls-cli} |
| 19 | : ${GNUTLS_SERV:=gnutls-serv} |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 20 | |
Manuel Pégourié-Gonnard | fa60f12 | 2014-09-26 16:07:29 +0200 | [diff] [blame^] | 21 | 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] | 22 | 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] | 23 | G_SRV="$GNUTLS_SERV --x509certfile data_files/server5.crt --x509keyfile data_files/server5.key" |
| 24 | G_CLI="$GNUTLS_CLI" |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 25 | |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 26 | TESTS=0 |
| 27 | FAILS=0 |
Manuel Pégourié-Gonnard | 6f4fbbb | 2014-08-14 14:31:29 +0200 | [diff] [blame] | 28 | SKIPS=0 |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 29 | |
Manuel Pégourié-Gonnard | 83d8c73 | 2014-04-07 13:24:21 +0200 | [diff] [blame] | 30 | CONFIG_H='../include/polarssl/config.h' |
| 31 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 32 | MEMCHECK=0 |
Manuel Pégourié-Gonnard | 417d46c | 2014-03-13 19:17:53 +0100 | [diff] [blame] | 33 | FILTER='.*' |
Manuel Pégourié-Gonnard | 6f4fbbb | 2014-08-14 14:31:29 +0200 | [diff] [blame] | 34 | EXCLUDE='^$' |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 35 | |
| 36 | print_usage() { |
| 37 | echo "Usage: $0 [options]" |
Manuel Pégourié-Gonnard | 417d46c | 2014-03-13 19:17:53 +0100 | [diff] [blame] | 38 | echo -e " -h|--help\tPrint this help." |
| 39 | echo -e " -m|--memcheck\tCheck memory leaks and errors." |
| 40 | echo -e " -f|--filter\tOnly matching tests are executed (default: '$FILTER')" |
| 41 | echo -e " -e|--exclude\tMatching tests are excluded (default: '$EXCLUDE')" |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | get_options() { |
| 45 | while [ $# -gt 0 ]; do |
| 46 | case "$1" in |
Manuel Pégourié-Gonnard | 417d46c | 2014-03-13 19:17:53 +0100 | [diff] [blame] | 47 | -f|--filter) |
| 48 | shift; FILTER=$1 |
| 49 | ;; |
| 50 | -e|--exclude) |
| 51 | shift; EXCLUDE=$1 |
| 52 | ;; |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 53 | -m|--memcheck) |
| 54 | MEMCHECK=1 |
| 55 | ;; |
| 56 | -h|--help) |
| 57 | print_usage |
| 58 | exit 0 |
| 59 | ;; |
| 60 | *) |
Paul Bakker | 1ebc0c5 | 2014-05-22 15:47:58 +0200 | [diff] [blame] | 61 | echo "Unknown argument: '$1'" |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 62 | print_usage |
| 63 | exit 1 |
| 64 | ;; |
| 65 | esac |
| 66 | shift |
| 67 | done |
| 68 | } |
| 69 | |
Manuel Pégourié-Gonnard | 6f4fbbb | 2014-08-14 14:31:29 +0200 | [diff] [blame] | 70 | # skip next test if OpenSSL can't send SSLv2 ClientHello |
| 71 | requires_openssl_with_sslv2() { |
| 72 | if [ -z "${OPENSSL_HAS_SSL2:-}" ]; then |
Manuel Pégourié-Gonnard | a4afadf | 2014-08-30 22:09:36 +0200 | [diff] [blame] | 73 | if $OPENSSL_CMD ciphers -ssl2 >/dev/null 2>&1; then |
Manuel Pégourié-Gonnard | 6f4fbbb | 2014-08-14 14:31:29 +0200 | [diff] [blame] | 74 | OPENSSL_HAS_SSL2="YES" |
| 75 | else |
| 76 | OPENSSL_HAS_SSL2="NO" |
| 77 | fi |
| 78 | fi |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 79 | |
Manuel Pégourié-Gonnard | 6f4fbbb | 2014-08-14 14:31:29 +0200 | [diff] [blame] | 80 | if [ "$OPENSSL_HAS_SSL2" = "NO" ]; then |
| 81 | SKIP_NEXT="YES" |
| 82 | fi |
| 83 | } |
| 84 | |
Manuel Pégourié-Gonnard | baa7f07 | 2014-08-20 20:15:53 +0200 | [diff] [blame] | 85 | # skip next test if GnuTLS isn't available |
| 86 | requires_gnutls() { |
| 87 | if [ -z "${GNUTLS_AVAILABLE:-}" ]; then |
| 88 | if ( which "$GNUTLS_CLI" && which "$GNUTLS_SERV" ) >/dev/null; then |
| 89 | GNUTLS_AVAILABLE="YES" |
| 90 | else |
| 91 | GNUTLS_AVAILABLE="NO" |
| 92 | fi |
| 93 | fi |
| 94 | if [ "$GNUTLS_AVAILABLE" = "NO" ]; then |
| 95 | SKIP_NEXT="YES" |
| 96 | fi |
| 97 | } |
| 98 | |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 99 | # skip next test if IPv6 isn't available on this host |
| 100 | requires_ipv6() { |
| 101 | if [ -z "${HAS_IPV6:-}" ]; then |
| 102 | $P_SRV server_addr='::1' > $SRV_OUT 2>&1 & |
| 103 | SRV_PID=$! |
| 104 | sleep 1 |
| 105 | kill $SRV_PID >/dev/null 2>&1 |
| 106 | if grep "NET - Binding of the socket failed" $SRV_OUT >/dev/null; then |
| 107 | HAS_IPV6="NO" |
| 108 | else |
| 109 | HAS_IPV6="YES" |
| 110 | fi |
| 111 | rm -r $SRV_OUT |
| 112 | fi |
| 113 | |
| 114 | if [ "$HAS_IPV6" = "NO" ]; then |
| 115 | SKIP_NEXT="YES" |
| 116 | fi |
| 117 | } |
| 118 | |
Manuel Pégourié-Gonnard | 76fe9e4 | 2014-09-24 15:17:31 +0200 | [diff] [blame] | 119 | # skip the next test if valgrind is in use |
| 120 | not_with_valgrind() { |
| 121 | if [ "$MEMCHECK" -gt 0 ]; then |
| 122 | SKIP_NEXT="YES" |
| 123 | fi |
| 124 | } |
| 125 | |
Manuel Pégourié-Gonnard | a071972 | 2014-09-20 12:46:27 +0200 | [diff] [blame] | 126 | # multiply the client timeout delay by the given factor for the next test |
| 127 | needs_more_time() { |
| 128 | CLI_DELAY_FACTOR=$1 |
| 129 | } |
| 130 | |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 131 | # print_name <name> |
| 132 | print_name() { |
| 133 | echo -n "$1 " |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 134 | LEN=$(( 72 - `echo "$1" | wc -c` )) |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 135 | for i in `seq 1 $LEN`; do echo -n '.'; done |
| 136 | echo -n ' ' |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 137 | |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 138 | TESTS=$(( $TESTS + 1 )) |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 139 | } |
| 140 | |
| 141 | # fail <message> |
| 142 | fail() { |
| 143 | echo "FAIL" |
Manuel Pégourié-Gonnard | 3eec604 | 2014-02-27 15:37:24 +0100 | [diff] [blame] | 144 | echo " ! $1" |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 145 | |
Manuel Pégourié-Gonnard | c2b0092 | 2014-08-31 16:46:04 +0200 | [diff] [blame] | 146 | mv $SRV_OUT o-srv-${TESTS}.log |
| 147 | mv $CLI_OUT o-cli-${TESTS}.log |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 148 | if [ -n "$PXY_CMD" ]; then |
| 149 | mv $PXY_OUT o-pxy-${TESTS}.log |
| 150 | fi |
| 151 | echo " ! outputs saved to o-XXX-${TESTS}.log" |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 152 | |
Manuel Pégourié-Gonnard | 7fa6772 | 2014-08-31 17:42:53 +0200 | [diff] [blame] | 153 | if [ "X${USER:-}" = Xbuildbot -o "X${LOGNAME:-}" = Xbuildbot ]; then |
| 154 | echo " ! server output:" |
| 155 | cat o-srv-${TESTS}.log |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 156 | echo " ! ========================================================" |
Manuel Pégourié-Gonnard | 7fa6772 | 2014-08-31 17:42:53 +0200 | [diff] [blame] | 157 | echo " ! client output:" |
| 158 | cat o-cli-${TESTS}.log |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 159 | if [ -n "$PXY_CMD" ]; then |
| 160 | echo " ! ========================================================" |
| 161 | echo " ! proxy output:" |
| 162 | cat o-pxy-${TESTS}.log |
| 163 | fi |
| 164 | echo "" |
Manuel Pégourié-Gonnard | 7fa6772 | 2014-08-31 17:42:53 +0200 | [diff] [blame] | 165 | fi |
| 166 | |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 167 | FAILS=$(( $FAILS + 1 )) |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 168 | } |
| 169 | |
Manuel Pégourié-Gonnard | 677884d | 2014-02-25 16:42:31 +0100 | [diff] [blame] | 170 | # is_polar <cmd_line> |
| 171 | is_polar() { |
| 172 | echo "$1" | grep 'ssl_server2\|ssl_client2' > /dev/null |
| 173 | } |
| 174 | |
Manuel Pégourié-Gonnard | fa60f12 | 2014-09-26 16:07:29 +0200 | [diff] [blame^] | 175 | # openssl s_server doesn't have -www with DTLS |
| 176 | check_osrv_dtls() { |
| 177 | if echo "$SRV_CMD" | grep 's_server.*-dtls' >/dev/null; then |
| 178 | NEEDS_INPUT=1 |
| 179 | SRV_CMD="$( echo $SRV_CMD | sed s/-www// )" |
| 180 | else |
| 181 | NEEDS_INPUT=0 |
| 182 | fi |
| 183 | } |
| 184 | |
| 185 | # provide input to commands that need it |
| 186 | provide_input() { |
| 187 | if [ $NEEDS_INPUT -eq 0 ]; then |
| 188 | return |
| 189 | fi |
| 190 | |
| 191 | while true; do |
| 192 | echo "HTTP/1.0 200 OK" |
| 193 | sleep 1 |
| 194 | done |
| 195 | } |
| 196 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 197 | # has_mem_err <log_file_name> |
| 198 | has_mem_err() { |
| 199 | if ( grep -F 'All heap blocks were freed -- no leaks are possible' "$1" && |
| 200 | grep -F 'ERROR SUMMARY: 0 errors from 0 contexts' "$1" ) > /dev/null |
| 201 | then |
| 202 | return 1 # false: does not have errors |
| 203 | else |
| 204 | return 0 # true: has errors |
| 205 | fi |
| 206 | } |
| 207 | |
Manuel Pégourié-Gonnard | 0c1ec47 | 2014-06-20 18:41:11 +0200 | [diff] [blame] | 208 | # wait for server to start: two versions depending on lsof availability |
| 209 | wait_server_start() { |
| 210 | if which lsof >/dev/null; then |
| 211 | # make sure we don't loop forever |
| 212 | ( sleep "$DOG_DELAY"; echo "SERVERSTART TIMEOUT"; kill $MAIN_PID ) & |
Manuel Pégourié-Gonnard | a6189f0 | 2014-09-20 13:15:43 +0200 | [diff] [blame] | 213 | DOG_PID=$! |
Manuel Pégourié-Gonnard | 0c1ec47 | 2014-06-20 18:41:11 +0200 | [diff] [blame] | 214 | |
| 215 | # make a tight loop, server usually takes less than 1 sec to start |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 216 | if [ "$DTLS" -eq 1 ]; then |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 217 | until lsof -nbi UDP:"$SRV_PORT" | grep UDP >/dev/null; do :; done |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 218 | else |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 219 | until lsof -nbi TCP:"$SRV_PORT" | grep LISTEN >/dev/null; do :; done |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 220 | fi |
Manuel Pégourié-Gonnard | 0c1ec47 | 2014-06-20 18:41:11 +0200 | [diff] [blame] | 221 | |
Manuel Pégourié-Gonnard | a6189f0 | 2014-09-20 13:15:43 +0200 | [diff] [blame] | 222 | kill $DOG_PID >/dev/null 2>&1 |
| 223 | wait $DOG_PID |
Manuel Pégourié-Gonnard | 0c1ec47 | 2014-06-20 18:41:11 +0200 | [diff] [blame] | 224 | else |
| 225 | sleep "$START_DELAY" |
| 226 | fi |
| 227 | } |
| 228 | |
Manuel Pégourié-Gonnard | c0f6a69 | 2014-08-30 22:41:47 +0200 | [diff] [blame] | 229 | # wait for client to terminate and set CLI_EXIT |
| 230 | # must be called right after starting the client |
| 231 | wait_client_done() { |
| 232 | CLI_PID=$! |
| 233 | |
Manuel Pégourié-Gonnard | a071972 | 2014-09-20 12:46:27 +0200 | [diff] [blame] | 234 | CLI_DELAY=$(( $DOG_DELAY * $CLI_DELAY_FACTOR )) |
| 235 | CLI_DELAY_FACTOR=1 |
| 236 | |
| 237 | ( sleep $CLI_DELAY; echo "TIMEOUT" >> $CLI_OUT; kill $CLI_PID ) & |
Manuel Pégourié-Gonnard | a6189f0 | 2014-09-20 13:15:43 +0200 | [diff] [blame] | 238 | DOG_PID=$! |
Manuel Pégourié-Gonnard | c0f6a69 | 2014-08-30 22:41:47 +0200 | [diff] [blame] | 239 | |
| 240 | wait $CLI_PID |
| 241 | CLI_EXIT=$? |
| 242 | |
Manuel Pégourié-Gonnard | a6189f0 | 2014-09-20 13:15:43 +0200 | [diff] [blame] | 243 | kill $DOG_PID >/dev/null 2>&1 |
| 244 | wait $DOG_PID |
Manuel Pégourié-Gonnard | c0f6a69 | 2014-08-30 22:41:47 +0200 | [diff] [blame] | 245 | |
| 246 | echo "EXIT: $CLI_EXIT" >> $CLI_OUT |
| 247 | } |
| 248 | |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 249 | # check if the given command uses dtls and sets global variable DTLS |
| 250 | detect_dtls() { |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 251 | 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] | 252 | DTLS=1 |
| 253 | else |
| 254 | DTLS=0 |
| 255 | fi |
| 256 | } |
| 257 | |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 258 | # 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] | 259 | # Options: -s pattern pattern that must be present in server output |
| 260 | # -c pattern pattern that must be present in client output |
| 261 | # -S pattern pattern that must be absent in server output |
| 262 | # -C pattern pattern that must be absent in client output |
| 263 | run_test() { |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 264 | NAME="$1" |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 265 | shift 1 |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 266 | |
Manuel Pégourié-Gonnard | 417d46c | 2014-03-13 19:17:53 +0100 | [diff] [blame] | 267 | if echo "$NAME" | grep "$FILTER" | grep -v "$EXCLUDE" >/dev/null; then : |
| 268 | else |
| 269 | return |
| 270 | fi |
| 271 | |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 272 | print_name "$NAME" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 273 | |
Manuel Pégourié-Gonnard | 6f4fbbb | 2014-08-14 14:31:29 +0200 | [diff] [blame] | 274 | # should we skip? |
| 275 | if [ "X$SKIP_NEXT" = "XYES" ]; then |
| 276 | SKIP_NEXT="NO" |
| 277 | echo "SKIP" |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 278 | SKIPS=$(( $SKIPS + 1 )) |
Manuel Pégourié-Gonnard | 6f4fbbb | 2014-08-14 14:31:29 +0200 | [diff] [blame] | 279 | return |
| 280 | fi |
| 281 | |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 282 | # does this test use a proxy? |
| 283 | if [ "X$1" = "X-p" ]; then |
| 284 | PXY_CMD="$2" |
| 285 | shift 2 |
| 286 | else |
| 287 | PXY_CMD="" |
| 288 | fi |
| 289 | |
| 290 | # get commands and client output |
| 291 | SRV_CMD="$1" |
| 292 | CLI_CMD="$2" |
| 293 | CLI_EXPECT="$3" |
| 294 | shift 3 |
| 295 | |
| 296 | # fix client port |
| 297 | if [ -n "$PXY_CMD" ]; then |
| 298 | CLI_CMD=$( echo "$CLI_CMD" | sed s/+SRV_PORT/$PXY_PORT/g ) |
| 299 | else |
| 300 | CLI_CMD=$( echo "$CLI_CMD" | sed s/+SRV_PORT/$SRV_PORT/g ) |
| 301 | fi |
| 302 | |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 303 | # update DTLS variable |
| 304 | detect_dtls "$SRV_CMD" |
| 305 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 306 | # prepend valgrind to our commands if active |
| 307 | if [ "$MEMCHECK" -gt 0 ]; then |
| 308 | if is_polar "$SRV_CMD"; then |
| 309 | SRV_CMD="valgrind --leak-check=full $SRV_CMD" |
| 310 | fi |
| 311 | if is_polar "$CLI_CMD"; then |
| 312 | CLI_CMD="valgrind --leak-check=full $CLI_CMD" |
| 313 | fi |
| 314 | fi |
| 315 | |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 316 | # run the commands |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 317 | if [ -n "$PXY_CMD" ]; then |
| 318 | echo "$PXY_CMD" > $PXY_OUT |
Manuel Pégourié-Gonnard | a6189f0 | 2014-09-20 13:15:43 +0200 | [diff] [blame] | 319 | $PXY_CMD >> $PXY_OUT 2>&1 & |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 320 | PXY_PID=$! |
| 321 | # assume proxy starts faster than server |
| 322 | fi |
| 323 | |
Manuel Pégourié-Gonnard | fa60f12 | 2014-09-26 16:07:29 +0200 | [diff] [blame^] | 324 | check_osrv_dtls |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 325 | echo "$SRV_CMD" > $SRV_OUT |
Manuel Pégourié-Gonnard | fa60f12 | 2014-09-26 16:07:29 +0200 | [diff] [blame^] | 326 | provide_input | $SRV_CMD >> $SRV_OUT 2>&1 & |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 327 | SRV_PID=$! |
Manuel Pégourié-Gonnard | 0c1ec47 | 2014-06-20 18:41:11 +0200 | [diff] [blame] | 328 | wait_server_start |
Manuel Pégourié-Gonnard | c0f6a69 | 2014-08-30 22:41:47 +0200 | [diff] [blame] | 329 | |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 330 | echo "$CLI_CMD" > $CLI_OUT |
Manuel Pégourié-Gonnard | c0f6a69 | 2014-08-30 22:41:47 +0200 | [diff] [blame] | 331 | eval "$CLI_CMD" >> $CLI_OUT 2>&1 & |
| 332 | wait_client_done |
Manuel Pégourié-Gonnard | e01af4c | 2014-03-25 14:16:44 +0100 | [diff] [blame] | 333 | |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 334 | # terminate the server (and the proxy) |
Manuel Pégourié-Gonnard | 74b1170 | 2014-08-14 15:47:33 +0200 | [diff] [blame] | 335 | kill $SRV_PID |
| 336 | wait $SRV_PID |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 337 | if [ -n "$PXY_CMD" ]; then |
Manuel Pégourié-Gonnard | a071972 | 2014-09-20 12:46:27 +0200 | [diff] [blame] | 338 | kill $PXY_PID >/dev/null 2>&1 |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 339 | wait $PXY_PID |
| 340 | fi |
Manuel Pégourié-Gonnard | 677884d | 2014-02-25 16:42:31 +0100 | [diff] [blame] | 341 | |
| 342 | # 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] | 343 | # (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] | 344 | # expected client exit to incorrectly succeed in case of catastrophic |
| 345 | # failure) |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 346 | if is_polar "$SRV_CMD"; then |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 347 | 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] | 348 | else |
| 349 | fail "server failed to start" |
| 350 | return |
| 351 | fi |
| 352 | fi |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 353 | if is_polar "$CLI_CMD"; then |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 354 | 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] | 355 | else |
| 356 | fail "client failed to start" |
| 357 | return |
| 358 | fi |
| 359 | fi |
| 360 | |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 361 | # check server exit code |
| 362 | if [ $? != 0 ]; then |
| 363 | fail "server fail" |
| 364 | return |
| 365 | fi |
| 366 | |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 367 | # check client exit code |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 368 | if [ \( "$CLI_EXPECT" = 0 -a "$CLI_EXIT" != 0 \) -o \ |
| 369 | \( "$CLI_EXPECT" != 0 -a "$CLI_EXIT" = 0 \) ] |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 370 | then |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 371 | 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] | 372 | return |
| 373 | fi |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 374 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 375 | # check other assertions |
Manuel Pégourié-Gonnard | 480905d | 2014-08-21 19:38:32 +0200 | [diff] [blame] | 376 | # lines beginning with == are added by valgrind, ignore them |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 377 | while [ $# -gt 0 ] |
| 378 | do |
| 379 | case $1 in |
| 380 | "-s") |
Manuel Pégourié-Gonnard | 480905d | 2014-08-21 19:38:32 +0200 | [diff] [blame] | 381 | if grep -v '^==' $SRV_OUT | grep "$2" >/dev/null; then :; else |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 382 | fail "-s $2" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 383 | return |
| 384 | fi |
| 385 | ;; |
| 386 | |
| 387 | "-c") |
Manuel Pégourié-Gonnard | 480905d | 2014-08-21 19:38:32 +0200 | [diff] [blame] | 388 | if grep -v '^==' $CLI_OUT | grep "$2" >/dev/null; then :; else |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 389 | fail "-c $2" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 390 | return |
| 391 | fi |
| 392 | ;; |
| 393 | |
| 394 | "-S") |
Manuel Pégourié-Gonnard | 480905d | 2014-08-21 19:38:32 +0200 | [diff] [blame] | 395 | if grep -v '^==' $SRV_OUT | grep "$2" >/dev/null; then |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 396 | fail "-S $2" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 397 | return |
| 398 | fi |
| 399 | ;; |
| 400 | |
| 401 | "-C") |
Manuel Pégourié-Gonnard | 480905d | 2014-08-21 19:38:32 +0200 | [diff] [blame] | 402 | if grep -v '^==' $CLI_OUT | grep "$2" >/dev/null; then |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 403 | fail "-C $2" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 404 | return |
| 405 | fi |
| 406 | ;; |
| 407 | |
| 408 | *) |
Paul Bakker | 1ebc0c5 | 2014-05-22 15:47:58 +0200 | [diff] [blame] | 409 | echo "Unknown test: $1" >&2 |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 410 | exit 1 |
| 411 | esac |
| 412 | shift 2 |
| 413 | done |
| 414 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 415 | # check valgrind's results |
| 416 | if [ "$MEMCHECK" -gt 0 ]; then |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 417 | 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] | 418 | fail "Server has memory errors" |
| 419 | return |
| 420 | fi |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 421 | 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] | 422 | fail "Client has memory errors" |
| 423 | return |
| 424 | fi |
| 425 | fi |
| 426 | |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 427 | # if we're here, everything is ok |
| 428 | echo "PASS" |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 429 | rm -f $SRV_OUT $CLI_OUT $PXY_OUT |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 430 | } |
| 431 | |
Manuel Pégourié-Gonnard | a9062e9 | 2014-02-25 16:21:22 +0100 | [diff] [blame] | 432 | cleanup() { |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 433 | rm -f $CLI_OUT $SRV_OUT $PXY_OUT $SESSION |
Manuel Pégourié-Gonnard | a6189f0 | 2014-09-20 13:15:43 +0200 | [diff] [blame] | 434 | test -n "${SRV_PID:-}" && kill $SRV_PID >/dev/null 2>&1 |
| 435 | test -n "${PXY_PID:-}" && kill $PXY_PID >/dev/null 2>&1 |
| 436 | test -n "${CLI_PID:-}" && kill $CLI_PID >/dev/null 2>&1 |
| 437 | 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] | 438 | exit 1 |
| 439 | } |
| 440 | |
Manuel Pégourié-Gonnard | 9dea8bd | 2014-02-26 18:21:02 +0100 | [diff] [blame] | 441 | # |
| 442 | # MAIN |
| 443 | # |
| 444 | |
Manuel Pégourié-Gonnard | 913030c | 2014-03-28 10:12:38 +0100 | [diff] [blame] | 445 | get_options "$@" |
| 446 | |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 447 | # sanity checks, avoid an avalanche of errors |
| 448 | if [ ! -x "$P_SRV" ]; then |
| 449 | echo "Command '$P_SRV' is not an executable file" |
| 450 | exit 1 |
| 451 | fi |
| 452 | if [ ! -x "$P_CLI" ]; then |
| 453 | echo "Command '$P_CLI' is not an executable file" |
| 454 | exit 1 |
| 455 | fi |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 456 | if [ ! -x "$P_PXY" ]; then |
| 457 | echo "Command '$P_PXY' is not an executable file" |
| 458 | exit 1 |
| 459 | fi |
Manuel Pégourié-Gonnard | 74faf3c | 2014-03-13 18:47:44 +0100 | [diff] [blame] | 460 | if which $OPENSSL_CMD >/dev/null 2>&1; then :; else |
| 461 | echo "Command '$OPENSSL_CMD' not found" |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 462 | exit 1 |
| 463 | fi |
| 464 | |
Manuel Pégourié-Gonnard | 32f8f4d | 2014-05-29 11:31:20 +0200 | [diff] [blame] | 465 | # used by watchdog |
| 466 | MAIN_PID="$$" |
| 467 | |
Manuel Pégourié-Gonnard | 0c1ec47 | 2014-06-20 18:41:11 +0200 | [diff] [blame] | 468 | # be more patient with valgrind |
| 469 | if [ "$MEMCHECK" -gt 0 ]; then |
| 470 | START_DELAY=3 |
| 471 | DOG_DELAY=30 |
| 472 | else |
| 473 | START_DELAY=1 |
| 474 | DOG_DELAY=10 |
| 475 | fi |
Manuel Pégourié-Gonnard | a071972 | 2014-09-20 12:46:27 +0200 | [diff] [blame] | 476 | CLI_DELAY_FACTOR=1 |
Manuel Pégourié-Gonnard | 0c1ec47 | 2014-06-20 18:41:11 +0200 | [diff] [blame] | 477 | |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 478 | # Pick a "unique" server port in the range 10000-19999, and a proxy port |
| 479 | PORT_BASE="0000$$" |
| 480 | PORT_BASE="$( echo -n $PORT_BASE | tail -c 4 )" |
| 481 | SRV_PORT="1$PORT_BASE" |
| 482 | PXY_PORT="2$PORT_BASE" |
| 483 | unset PORT_BASE |
Manuel Pégourié-Gonnard | 8066b81 | 2014-05-28 22:59:30 +0200 | [diff] [blame] | 484 | |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 485 | # fix commands to use this port, force IPv4 while at it |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 486 | P_SRV="$P_SRV server_addr=127.0.0.1 server_port=$SRV_PORT" |
| 487 | P_CLI="$P_CLI server_addr=127.0.0.1 server_port=+SRV_PORT" |
| 488 | P_PXY="$P_PXY server_addr=127.0.0.1 server_port=$SRV_PORT listen_addr=127.0.0.1 listen_port=$PXY_PORT" |
| 489 | O_SRV="$O_SRV -accept $SRV_PORT" |
| 490 | O_CLI="$O_CLI -connect localhost:+SRV_PORT" |
| 491 | G_SRV="$G_SRV -p $SRV_PORT" |
| 492 | G_CLI="$G_CLI -p +SRV_PORT" |
Manuel Pégourié-Gonnard | 8066b81 | 2014-05-28 22:59:30 +0200 | [diff] [blame] | 493 | |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 494 | # Also pick a unique name for intermediate files |
| 495 | SRV_OUT="srv_out.$$" |
| 496 | CLI_OUT="cli_out.$$" |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 497 | PXY_OUT="pxy_out.$$" |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 498 | SESSION="session.$$" |
| 499 | |
Manuel Pégourié-Gonnard | 6f4fbbb | 2014-08-14 14:31:29 +0200 | [diff] [blame] | 500 | SKIP_NEXT="NO" |
| 501 | |
Manuel Pégourié-Gonnard | a9062e9 | 2014-02-25 16:21:22 +0100 | [diff] [blame] | 502 | trap cleanup INT TERM HUP |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 503 | |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 504 | # Basic test |
| 505 | |
Manuel Pégourié-Gonnard | 480905d | 2014-08-21 19:38:32 +0200 | [diff] [blame] | 506 | # Checks that: |
| 507 | # - things work with all ciphersuites active (used with config-full in all.sh) |
| 508 | # - the expected (highest security) parameters are selected |
| 509 | # ("signature_algorithm ext: 6" means SHA-512 (highest common hash)) |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 510 | run_test "Default" \ |
Manuel Pégourié-Gonnard | 480905d | 2014-08-21 19:38:32 +0200 | [diff] [blame] | 511 | "$P_SRV debug_level=3" \ |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 512 | "$P_CLI" \ |
| 513 | 0 \ |
Manuel Pégourié-Gonnard | 480905d | 2014-08-21 19:38:32 +0200 | [diff] [blame] | 514 | -s "Protocol is TLSv1.2" \ |
| 515 | -s "Ciphersuite is TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384" \ |
| 516 | -s "client hello v3, signature_algorithm ext: 6" \ |
| 517 | -s "ECDHE curve: secp521r1" \ |
| 518 | -S "error" \ |
| 519 | -C "error" |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 520 | |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 521 | # Test for SSLv2 ClientHello |
| 522 | |
Manuel Pégourié-Gonnard | 6f4fbbb | 2014-08-14 14:31:29 +0200 | [diff] [blame] | 523 | requires_openssl_with_sslv2 |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 524 | run_test "SSLv2 ClientHello: reference" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 525 | "$P_SRV debug_level=3" \ |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 526 | "$O_CLI -no_ssl2" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 527 | 0 \ |
| 528 | -S "parse client hello v2" \ |
| 529 | -S "ssl_handshake returned" |
| 530 | |
| 531 | # Adding a SSL2-only suite makes OpenSSL client send SSLv2 ClientHello |
Manuel Pégourié-Gonnard | 6f4fbbb | 2014-08-14 14:31:29 +0200 | [diff] [blame] | 532 | requires_openssl_with_sslv2 |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 533 | run_test "SSLv2 ClientHello: actual test" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 534 | "$P_SRV debug_level=2" \ |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 535 | "$O_CLI -cipher 'DES-CBC-MD5:ALL'" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 536 | 0 \ |
| 537 | -s "parse client hello v2" \ |
| 538 | -S "ssl_handshake returned" |
| 539 | |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 540 | # Tests for Truncated HMAC extension |
| 541 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 542 | run_test "Truncated HMAC: reference" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 543 | "$P_SRV debug_level=4" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 544 | "$P_CLI trunc_hmac=0 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 545 | 0 \ |
| 546 | -s "dumping 'computed mac' (20 bytes)" |
| 547 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 548 | run_test "Truncated HMAC: actual test" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 549 | "$P_SRV debug_level=4" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 550 | "$P_CLI trunc_hmac=1 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 551 | 0 \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 552 | -s "dumping 'computed mac' (10 bytes)" |
| 553 | |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 554 | # Tests for Session Tickets |
| 555 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 556 | run_test "Session resume using tickets: basic" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 557 | "$P_SRV debug_level=3 tickets=1" \ |
| 558 | "$P_CLI debug_level=3 tickets=1 reconnect=1" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 559 | 0 \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 560 | -c "client hello, adding session ticket extension" \ |
| 561 | -s "found session ticket extension" \ |
| 562 | -s "server hello, adding session ticket extension" \ |
| 563 | -c "found session_ticket extension" \ |
| 564 | -c "parse new session ticket" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 565 | -S "session successfully restored from cache" \ |
| 566 | -s "session successfully restored from ticket" \ |
| 567 | -s "a session has been resumed" \ |
| 568 | -c "a session has been resumed" |
| 569 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 570 | run_test "Session resume using tickets: cache disabled" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 571 | "$P_SRV debug_level=3 tickets=1 cache_max=0" \ |
| 572 | "$P_CLI debug_level=3 tickets=1 reconnect=1" \ |
Manuel Pégourié-Gonnard | dbe1ee1 | 2014-02-21 09:18:13 +0100 | [diff] [blame] | 573 | 0 \ |
| 574 | -c "client hello, adding session ticket extension" \ |
| 575 | -s "found session ticket extension" \ |
| 576 | -s "server hello, adding session ticket extension" \ |
| 577 | -c "found session_ticket extension" \ |
| 578 | -c "parse new session ticket" \ |
| 579 | -S "session successfully restored from cache" \ |
| 580 | -s "session successfully restored from ticket" \ |
| 581 | -s "a session has been resumed" \ |
| 582 | -c "a session has been resumed" |
| 583 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 584 | run_test "Session resume using tickets: timeout" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 585 | "$P_SRV debug_level=3 tickets=1 cache_max=0 ticket_timeout=1" \ |
| 586 | "$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] | 587 | 0 \ |
| 588 | -c "client hello, adding session ticket extension" \ |
| 589 | -s "found session ticket extension" \ |
| 590 | -s "server hello, adding session ticket extension" \ |
| 591 | -c "found session_ticket extension" \ |
| 592 | -c "parse new session ticket" \ |
| 593 | -S "session successfully restored from cache" \ |
| 594 | -S "session successfully restored from ticket" \ |
| 595 | -S "a session has been resumed" \ |
| 596 | -C "a session has been resumed" |
| 597 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 598 | run_test "Session resume using tickets: openssl server" \ |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 599 | "$O_SRV" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 600 | "$P_CLI debug_level=3 tickets=1 reconnect=1" \ |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 601 | 0 \ |
| 602 | -c "client hello, adding session ticket extension" \ |
| 603 | -c "found session_ticket extension" \ |
| 604 | -c "parse new session ticket" \ |
| 605 | -c "a session has been resumed" |
| 606 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 607 | run_test "Session resume using tickets: openssl client" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 608 | "$P_SRV debug_level=3 tickets=1" \ |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 609 | "( $O_CLI -sess_out $SESSION; \ |
| 610 | $O_CLI -sess_in $SESSION; \ |
| 611 | rm -f $SESSION )" \ |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 612 | 0 \ |
| 613 | -s "found session ticket extension" \ |
| 614 | -s "server hello, adding session ticket extension" \ |
| 615 | -S "session successfully restored from cache" \ |
| 616 | -s "session successfully restored from ticket" \ |
| 617 | -s "a session has been resumed" |
| 618 | |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 619 | # Tests for Session Resume based on session-ID and cache |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 620 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 621 | run_test "Session resume using cache: tickets enabled on client" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 622 | "$P_SRV debug_level=3 tickets=0" \ |
| 623 | "$P_CLI debug_level=3 tickets=1 reconnect=1" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 624 | 0 \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 625 | -c "client hello, adding session ticket extension" \ |
| 626 | -s "found session ticket extension" \ |
| 627 | -S "server hello, adding session ticket extension" \ |
| 628 | -C "found session_ticket extension" \ |
| 629 | -C "parse new session ticket" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 630 | -s "session successfully restored from cache" \ |
| 631 | -S "session successfully restored from ticket" \ |
| 632 | -s "a session has been resumed" \ |
| 633 | -c "a session has been resumed" |
| 634 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 635 | run_test "Session resume using cache: tickets enabled on server" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 636 | "$P_SRV debug_level=3 tickets=1" \ |
| 637 | "$P_CLI debug_level=3 tickets=0 reconnect=1" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 638 | 0 \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 639 | -C "client hello, adding session ticket extension" \ |
| 640 | -S "found session ticket extension" \ |
| 641 | -S "server hello, adding session ticket extension" \ |
| 642 | -C "found session_ticket extension" \ |
| 643 | -C "parse new session ticket" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 644 | -s "session successfully restored from cache" \ |
| 645 | -S "session successfully restored from ticket" \ |
| 646 | -s "a session has been resumed" \ |
| 647 | -c "a session has been resumed" |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 648 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 649 | run_test "Session resume using cache: cache_max=0" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 650 | "$P_SRV debug_level=3 tickets=0 cache_max=0" \ |
| 651 | "$P_CLI debug_level=3 tickets=0 reconnect=1" \ |
Manuel Pégourié-Gonnard | 4c88345 | 2014-02-20 21:32:41 +0100 | [diff] [blame] | 652 | 0 \ |
| 653 | -S "session successfully restored from cache" \ |
| 654 | -S "session successfully restored from ticket" \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 655 | -S "a session has been resumed" \ |
| 656 | -C "a session has been resumed" |
Manuel Pégourié-Gonnard | 4c88345 | 2014-02-20 21:32:41 +0100 | [diff] [blame] | 657 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 658 | run_test "Session resume using cache: cache_max=1" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 659 | "$P_SRV debug_level=3 tickets=0 cache_max=1" \ |
| 660 | "$P_CLI debug_level=3 tickets=0 reconnect=1" \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 661 | 0 \ |
| 662 | -s "session successfully restored from cache" \ |
| 663 | -S "session successfully restored from ticket" \ |
| 664 | -s "a session has been resumed" \ |
| 665 | -c "a session has been resumed" |
| 666 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 667 | run_test "Session resume using cache: timemout > delay" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 668 | "$P_SRV debug_level=3 tickets=0" \ |
| 669 | "$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] | 670 | 0 \ |
| 671 | -s "session successfully restored from cache" \ |
| 672 | -S "session successfully restored from ticket" \ |
| 673 | -s "a session has been resumed" \ |
| 674 | -c "a session has been resumed" |
| 675 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 676 | run_test "Session resume using cache: timeout < delay" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 677 | "$P_SRV debug_level=3 tickets=0 cache_timeout=1" \ |
| 678 | "$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] | 679 | 0 \ |
| 680 | -S "session successfully restored from cache" \ |
| 681 | -S "session successfully restored from ticket" \ |
| 682 | -S "a session has been resumed" \ |
| 683 | -C "a session has been resumed" |
| 684 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 685 | run_test "Session resume using cache: no timeout" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 686 | "$P_SRV debug_level=3 tickets=0 cache_timeout=0" \ |
| 687 | "$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] | 688 | 0 \ |
| 689 | -s "session successfully restored from cache" \ |
| 690 | -S "session successfully restored from ticket" \ |
| 691 | -s "a session has been resumed" \ |
| 692 | -c "a session has been resumed" |
| 693 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 694 | run_test "Session resume using cache: openssl client" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 695 | "$P_SRV debug_level=3 tickets=0" \ |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 696 | "( $O_CLI -sess_out $SESSION; \ |
| 697 | $O_CLI -sess_in $SESSION; \ |
| 698 | rm -f $SESSION )" \ |
Manuel Pégourié-Gonnard | db735f6 | 2014-02-25 17:57:59 +0100 | [diff] [blame] | 699 | 0 \ |
| 700 | -s "found session ticket extension" \ |
| 701 | -S "server hello, adding session ticket extension" \ |
| 702 | -s "session successfully restored from cache" \ |
| 703 | -S "session successfully restored from ticket" \ |
| 704 | -s "a session has been resumed" |
| 705 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 706 | run_test "Session resume using cache: openssl server" \ |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 707 | "$O_SRV" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 708 | "$P_CLI debug_level=3 tickets=0 reconnect=1" \ |
Manuel Pégourié-Gonnard | db735f6 | 2014-02-25 17:57:59 +0100 | [diff] [blame] | 709 | 0 \ |
| 710 | -C "found session_ticket extension" \ |
| 711 | -C "parse new session ticket" \ |
| 712 | -c "a session has been resumed" |
| 713 | |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 714 | # Tests for Max Fragment Length extension |
| 715 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 716 | run_test "Max fragment length: not used, reference" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 717 | "$P_SRV debug_level=3" \ |
| 718 | "$P_CLI debug_level=3" \ |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 719 | 0 \ |
| 720 | -C "client hello, adding max_fragment_length extension" \ |
| 721 | -S "found max fragment length extension" \ |
| 722 | -S "server hello, max_fragment_length extension" \ |
| 723 | -C "found max_fragment_length extension" |
| 724 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 725 | run_test "Max fragment length: used by client" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 726 | "$P_SRV debug_level=3" \ |
| 727 | "$P_CLI debug_level=3 max_frag_len=4096" \ |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 728 | 0 \ |
| 729 | -c "client hello, adding max_fragment_length extension" \ |
| 730 | -s "found max fragment length extension" \ |
| 731 | -s "server hello, max_fragment_length extension" \ |
| 732 | -c "found max_fragment_length extension" |
| 733 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 734 | run_test "Max fragment length: used by server" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 735 | "$P_SRV debug_level=3 max_frag_len=4096" \ |
| 736 | "$P_CLI debug_level=3" \ |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 737 | 0 \ |
| 738 | -C "client hello, adding max_fragment_length extension" \ |
| 739 | -S "found max fragment length extension" \ |
| 740 | -S "server hello, max_fragment_length extension" \ |
| 741 | -C "found max_fragment_length extension" |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 742 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 743 | requires_gnutls |
| 744 | run_test "Max fragment length: gnutls server" \ |
Manuel Pégourié-Gonnard | baa7f07 | 2014-08-20 20:15:53 +0200 | [diff] [blame] | 745 | "$G_SRV" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 746 | "$P_CLI debug_level=3 max_frag_len=4096" \ |
Manuel Pégourié-Gonnard | baa7f07 | 2014-08-20 20:15:53 +0200 | [diff] [blame] | 747 | 0 \ |
| 748 | -c "client hello, adding max_fragment_length extension" \ |
| 749 | -c "found max_fragment_length extension" |
| 750 | |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 751 | # Tests for renegotiation |
| 752 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 753 | run_test "Renegotiation: none, for reference" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 754 | "$P_SRV debug_level=3 exchanges=2" \ |
| 755 | "$P_CLI debug_level=3 exchanges=2" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 756 | 0 \ |
| 757 | -C "client hello, adding renegotiation extension" \ |
| 758 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 759 | -S "found renegotiation extension" \ |
| 760 | -s "server hello, secure renegotiation extension" \ |
| 761 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 762 | -C "=> renegotiate" \ |
| 763 | -S "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 764 | -S "write hello request" |
| 765 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 766 | run_test "Renegotiation: client-initiated" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 767 | "$P_SRV debug_level=3 exchanges=2 renegotiation=1" \ |
| 768 | "$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] | 769 | 0 \ |
| 770 | -c "client hello, adding renegotiation extension" \ |
| 771 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 772 | -s "found renegotiation extension" \ |
| 773 | -s "server hello, secure renegotiation extension" \ |
| 774 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 775 | -c "=> renegotiate" \ |
| 776 | -s "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 777 | -S "write hello request" |
| 778 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 779 | run_test "Renegotiation: server-initiated" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 780 | "$P_SRV debug_level=3 exchanges=2 renegotiation=1 renegotiate=1" \ |
| 781 | "$P_CLI debug_level=3 exchanges=2 renegotiation=1" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 782 | 0 \ |
| 783 | -c "client hello, adding renegotiation extension" \ |
| 784 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 785 | -s "found renegotiation extension" \ |
| 786 | -s "server hello, secure renegotiation extension" \ |
| 787 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 788 | -c "=> renegotiate" \ |
| 789 | -s "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 790 | -s "write hello request" |
| 791 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 792 | run_test "Renegotiation: double" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 793 | "$P_SRV debug_level=3 exchanges=2 renegotiation=1 renegotiate=1" \ |
| 794 | "$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] | 795 | 0 \ |
| 796 | -c "client hello, adding renegotiation extension" \ |
| 797 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 798 | -s "found renegotiation extension" \ |
| 799 | -s "server hello, secure renegotiation extension" \ |
| 800 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 801 | -c "=> renegotiate" \ |
| 802 | -s "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 803 | -s "write hello request" |
| 804 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 805 | run_test "Renegotiation: client-initiated, server-rejected" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 806 | "$P_SRV debug_level=3 exchanges=2 renegotiation=0" \ |
| 807 | "$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] | 808 | 1 \ |
| 809 | -c "client hello, adding renegotiation extension" \ |
| 810 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 811 | -S "found renegotiation extension" \ |
| 812 | -s "server hello, secure renegotiation extension" \ |
| 813 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 814 | -c "=> renegotiate" \ |
| 815 | -S "=> renegotiate" \ |
Manuel Pégourié-Gonnard | fae355e | 2014-07-04 14:32:27 +0200 | [diff] [blame] | 816 | -S "write hello request" \ |
Manuel Pégourié-Gonnard | 6591962 | 2014-08-19 12:50:30 +0200 | [diff] [blame] | 817 | -c "SSL - Unexpected message at ServerHello in renegotiation" \ |
Manuel Pégourié-Gonnard | fae355e | 2014-07-04 14:32:27 +0200 | [diff] [blame] | 818 | -c "failed" |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 819 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 820 | run_test "Renegotiation: server-initiated, client-rejected, default" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 821 | "$P_SRV debug_level=3 exchanges=2 renegotiation=1 renegotiate=1" \ |
| 822 | "$P_CLI debug_level=3 exchanges=2 renegotiation=0" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 823 | 0 \ |
| 824 | -C "client hello, adding renegotiation extension" \ |
| 825 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 826 | -S "found renegotiation extension" \ |
| 827 | -s "server hello, secure renegotiation extension" \ |
| 828 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 829 | -C "=> renegotiate" \ |
| 830 | -S "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 831 | -s "write hello request" \ |
Manuel Pégourié-Gonnard | a9964db | 2014-07-03 19:29:16 +0200 | [diff] [blame] | 832 | -S "SSL - An unexpected message was received from our peer" \ |
| 833 | -S "failed" |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 834 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 835 | run_test "Renegotiation: server-initiated, client-rejected, not enforced" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 836 | "$P_SRV debug_level=3 exchanges=2 renegotiation=1 renegotiate=1 \ |
Manuel Pégourié-Gonnard | fae355e | 2014-07-04 14:32:27 +0200 | [diff] [blame] | 837 | renego_delay=-1" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 838 | "$P_CLI debug_level=3 exchanges=2 renegotiation=0" \ |
Manuel Pégourié-Gonnard | fae355e | 2014-07-04 14:32:27 +0200 | [diff] [blame] | 839 | 0 \ |
| 840 | -C "client hello, adding renegotiation extension" \ |
| 841 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 842 | -S "found renegotiation extension" \ |
| 843 | -s "server hello, secure renegotiation extension" \ |
| 844 | -c "found renegotiation extension" \ |
| 845 | -C "=> renegotiate" \ |
| 846 | -S "=> renegotiate" \ |
| 847 | -s "write hello request" \ |
| 848 | -S "SSL - An unexpected message was received from our peer" \ |
| 849 | -S "failed" |
| 850 | |
Manuel Pégourié-Gonnard | a8c0a0d | 2014-08-15 12:07:38 +0200 | [diff] [blame] | 851 | # delay 2 for 1 alert record + 1 application data record |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 852 | run_test "Renegotiation: server-initiated, client-rejected, delay 2" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 853 | "$P_SRV debug_level=3 exchanges=2 renegotiation=1 renegotiate=1 \ |
Manuel Pégourié-Gonnard | a8c0a0d | 2014-08-15 12:07:38 +0200 | [diff] [blame] | 854 | renego_delay=2" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 855 | "$P_CLI debug_level=3 exchanges=2 renegotiation=0" \ |
Manuel Pégourié-Gonnard | fae355e | 2014-07-04 14:32:27 +0200 | [diff] [blame] | 856 | 0 \ |
| 857 | -C "client hello, adding renegotiation extension" \ |
| 858 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 859 | -S "found renegotiation extension" \ |
| 860 | -s "server hello, secure renegotiation extension" \ |
| 861 | -c "found renegotiation extension" \ |
| 862 | -C "=> renegotiate" \ |
| 863 | -S "=> renegotiate" \ |
| 864 | -s "write hello request" \ |
| 865 | -S "SSL - An unexpected message was received from our peer" \ |
| 866 | -S "failed" |
| 867 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 868 | run_test "Renegotiation: server-initiated, client-rejected, delay 0" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 869 | "$P_SRV debug_level=3 exchanges=2 renegotiation=1 renegotiate=1 \ |
Manuel Pégourié-Gonnard | fae355e | 2014-07-04 14:32:27 +0200 | [diff] [blame] | 870 | renego_delay=0" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 871 | "$P_CLI debug_level=3 exchanges=2 renegotiation=0" \ |
Manuel Pégourié-Gonnard | fae355e | 2014-07-04 14:32:27 +0200 | [diff] [blame] | 872 | 0 \ |
| 873 | -C "client hello, adding renegotiation extension" \ |
| 874 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 875 | -S "found renegotiation extension" \ |
| 876 | -s "server hello, secure renegotiation extension" \ |
| 877 | -c "found renegotiation extension" \ |
| 878 | -C "=> renegotiate" \ |
| 879 | -S "=> renegotiate" \ |
| 880 | -s "write hello request" \ |
Manuel Pégourié-Gonnard | a8c0a0d | 2014-08-15 12:07:38 +0200 | [diff] [blame] | 881 | -s "SSL - An unexpected message was received from our peer" |
Manuel Pégourié-Gonnard | fae355e | 2014-07-04 14:32:27 +0200 | [diff] [blame] | 882 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 883 | run_test "Renegotiation: server-initiated, client-accepted, delay 0" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 884 | "$P_SRV debug_level=3 exchanges=2 renegotiation=1 renegotiate=1 \ |
Manuel Pégourié-Gonnard | fae355e | 2014-07-04 14:32:27 +0200 | [diff] [blame] | 885 | renego_delay=0" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 886 | "$P_CLI debug_level=3 exchanges=2 renegotiation=1" \ |
Manuel Pégourié-Gonnard | fae355e | 2014-07-04 14:32:27 +0200 | [diff] [blame] | 887 | 0 \ |
| 888 | -c "client hello, adding renegotiation extension" \ |
| 889 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 890 | -s "found renegotiation extension" \ |
| 891 | -s "server hello, secure renegotiation extension" \ |
| 892 | -c "found renegotiation extension" \ |
| 893 | -c "=> renegotiate" \ |
| 894 | -s "=> renegotiate" \ |
| 895 | -s "write hello request" \ |
| 896 | -S "SSL - An unexpected message was received from our peer" \ |
| 897 | -S "failed" |
| 898 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 899 | run_test "Renegotiation: nbio, client-initiated" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 900 | "$P_SRV debug_level=3 nbio=2 exchanges=2 renegotiation=1" \ |
| 901 | "$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] | 902 | 0 \ |
| 903 | -c "client hello, adding renegotiation extension" \ |
| 904 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 905 | -s "found renegotiation extension" \ |
| 906 | -s "server hello, secure renegotiation extension" \ |
| 907 | -c "found renegotiation extension" \ |
| 908 | -c "=> renegotiate" \ |
| 909 | -s "=> renegotiate" \ |
| 910 | -S "write hello request" |
| 911 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 912 | run_test "Renegotiation: nbio, server-initiated" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 913 | "$P_SRV debug_level=3 nbio=2 exchanges=2 renegotiation=1 renegotiate=1" \ |
| 914 | "$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] | 915 | 0 \ |
| 916 | -c "client hello, adding renegotiation extension" \ |
| 917 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 918 | -s "found renegotiation extension" \ |
| 919 | -s "server hello, secure renegotiation extension" \ |
| 920 | -c "found renegotiation extension" \ |
| 921 | -c "=> renegotiate" \ |
| 922 | -s "=> renegotiate" \ |
| 923 | -s "write hello request" |
| 924 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 925 | run_test "Renegotiation: openssl server, client-initiated" \ |
Manuel Pégourié-Gonnard | a775617 | 2014-08-31 18:37:01 +0200 | [diff] [blame] | 926 | "$O_SRV -www" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 927 | "$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] | 928 | 0 \ |
| 929 | -c "client hello, adding renegotiation extension" \ |
| 930 | -c "found renegotiation extension" \ |
| 931 | -c "=> renegotiate" \ |
| 932 | -C "ssl_handshake returned" \ |
| 933 | -C "error" \ |
| 934 | -c "HTTP/1.0 200 [Oo][Kk]" |
| 935 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 936 | run_test "Renegotiation: gnutls server, client-initiated" \ |
Manuel Pégourié-Gonnard | 5136296 | 2014-08-30 21:22:47 +0200 | [diff] [blame] | 937 | "$G_SRV" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 938 | "$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] | 939 | 0 \ |
| 940 | -c "client hello, adding renegotiation extension" \ |
| 941 | -c "found renegotiation extension" \ |
| 942 | -c "=> renegotiate" \ |
| 943 | -C "ssl_handshake returned" \ |
| 944 | -C "error" \ |
| 945 | -c "HTTP/1.0 200 [Oo][Kk]" |
| 946 | |
Manuel Pégourié-Gonnard | 30d16eb | 2014-08-19 17:43:50 +0200 | [diff] [blame] | 947 | run_test "Renegotiation: DTLS, client-initiated" \ |
| 948 | "$P_SRV debug_level=3 dtls=1 exchanges=2 renegotiation=1" \ |
| 949 | "$P_CLI debug_level=3 dtls=1 exchanges=2 renegotiation=1 renegotiate=1" \ |
| 950 | 0 \ |
| 951 | -c "client hello, adding renegotiation extension" \ |
| 952 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 953 | -s "found renegotiation extension" \ |
| 954 | -s "server hello, secure renegotiation extension" \ |
| 955 | -c "found renegotiation extension" \ |
| 956 | -c "=> renegotiate" \ |
| 957 | -s "=> renegotiate" \ |
| 958 | -S "write hello request" |
| 959 | |
Manuel Pégourié-Gonnard | c392b24 | 2014-08-19 17:53:11 +0200 | [diff] [blame] | 960 | run_test "Renegotiation: DTLS, server-initiated" \ |
| 961 | "$P_SRV debug_level=3 dtls=1 exchanges=2 renegotiation=1 renegotiate=1" \ |
| 962 | "$P_CLI debug_level=3 dtls=1 exchanges=2 renegotiation=1" \ |
| 963 | 0 \ |
| 964 | -c "client hello, adding renegotiation extension" \ |
| 965 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 966 | -s "found renegotiation extension" \ |
| 967 | -s "server hello, secure renegotiation extension" \ |
| 968 | -c "found renegotiation extension" \ |
| 969 | -c "=> renegotiate" \ |
| 970 | -s "=> renegotiate" \ |
| 971 | -s "write hello request" |
| 972 | |
Manuel Pégourié-Gonnard | f1499f6 | 2014-08-31 17:13:13 +0200 | [diff] [blame] | 973 | run_test "Renegotiation: DTLS, gnutls server, client-initiated" \ |
| 974 | "$G_SRV -u --mtu 4096" \ |
| 975 | "$P_CLI debug_level=3 dtls=1 exchanges=1 renegotiation=1 renegotiate=1" \ |
| 976 | 0 \ |
| 977 | -c "client hello, adding renegotiation extension" \ |
| 978 | -c "found renegotiation extension" \ |
| 979 | -c "=> renegotiate" \ |
| 980 | -C "ssl_handshake returned" \ |
| 981 | -C "error" \ |
| 982 | -s "Extra-header:" |
| 983 | |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 984 | # Tests for auth_mode |
| 985 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 986 | run_test "Authentication: server badcert, client required" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 987 | "$P_SRV crt_file=data_files/server5-badsign.crt \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 988 | key_file=data_files/server5.key" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 989 | "$P_CLI debug_level=1 auth_mode=required" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 990 | 1 \ |
| 991 | -c "x509_verify_cert() returned" \ |
| 992 | -c "! self-signed or not signed by a trusted CA" \ |
| 993 | -c "! ssl_handshake returned" \ |
| 994 | -c "X509 - Certificate verification failed" |
| 995 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 996 | run_test "Authentication: server badcert, client optional" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 997 | "$P_SRV crt_file=data_files/server5-badsign.crt \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 998 | key_file=data_files/server5.key" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 999 | "$P_CLI debug_level=1 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 1000 | 0 \ |
| 1001 | -c "x509_verify_cert() returned" \ |
| 1002 | -c "! self-signed or not signed by a trusted CA" \ |
| 1003 | -C "! ssl_handshake returned" \ |
| 1004 | -C "X509 - Certificate verification failed" |
| 1005 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1006 | run_test "Authentication: server badcert, client none" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 1007 | "$P_SRV crt_file=data_files/server5-badsign.crt \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 1008 | key_file=data_files/server5.key" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1009 | "$P_CLI debug_level=1 auth_mode=none" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 1010 | 0 \ |
| 1011 | -C "x509_verify_cert() returned" \ |
| 1012 | -C "! self-signed or not signed by a trusted CA" \ |
| 1013 | -C "! ssl_handshake returned" \ |
| 1014 | -C "X509 - Certificate verification failed" |
| 1015 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1016 | run_test "Authentication: client badcert, server required" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1017 | "$P_SRV debug_level=3 auth_mode=required" \ |
| 1018 | "$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] | 1019 | key_file=data_files/server5.key" \ |
| 1020 | 1 \ |
| 1021 | -S "skip write certificate request" \ |
| 1022 | -C "skip parse certificate request" \ |
| 1023 | -c "got a certificate request" \ |
| 1024 | -C "skip write certificate" \ |
| 1025 | -C "skip write certificate verify" \ |
| 1026 | -S "skip parse certificate verify" \ |
| 1027 | -s "x509_verify_cert() returned" \ |
| 1028 | -S "! self-signed or not signed by a trusted CA" \ |
| 1029 | -s "! ssl_handshake returned" \ |
| 1030 | -c "! ssl_handshake returned" \ |
| 1031 | -s "X509 - Certificate verification failed" |
| 1032 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1033 | run_test "Authentication: client badcert, server optional" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1034 | "$P_SRV debug_level=3 auth_mode=optional" \ |
| 1035 | "$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] | 1036 | key_file=data_files/server5.key" \ |
| 1037 | 0 \ |
| 1038 | -S "skip write certificate request" \ |
| 1039 | -C "skip parse certificate request" \ |
| 1040 | -c "got a certificate request" \ |
| 1041 | -C "skip write certificate" \ |
| 1042 | -C "skip write certificate verify" \ |
| 1043 | -S "skip parse certificate verify" \ |
| 1044 | -s "x509_verify_cert() returned" \ |
| 1045 | -s "! self-signed or not signed by a trusted CA" \ |
| 1046 | -S "! ssl_handshake returned" \ |
| 1047 | -C "! ssl_handshake returned" \ |
| 1048 | -S "X509 - Certificate verification failed" |
| 1049 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1050 | run_test "Authentication: client badcert, server none" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1051 | "$P_SRV debug_level=3 auth_mode=none" \ |
| 1052 | "$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] | 1053 | key_file=data_files/server5.key" \ |
| 1054 | 0 \ |
| 1055 | -s "skip write certificate request" \ |
| 1056 | -C "skip parse certificate request" \ |
| 1057 | -c "got no certificate request" \ |
| 1058 | -c "skip write certificate" \ |
| 1059 | -c "skip write certificate verify" \ |
| 1060 | -s "skip parse certificate verify" \ |
| 1061 | -S "x509_verify_cert() returned" \ |
| 1062 | -S "! self-signed or not signed by a trusted CA" \ |
| 1063 | -S "! ssl_handshake returned" \ |
| 1064 | -C "! ssl_handshake returned" \ |
| 1065 | -S "X509 - Certificate verification failed" |
| 1066 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1067 | run_test "Authentication: client no cert, server optional" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1068 | "$P_SRV debug_level=3 auth_mode=optional" \ |
| 1069 | "$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] | 1070 | 0 \ |
| 1071 | -S "skip write certificate request" \ |
| 1072 | -C "skip parse certificate request" \ |
| 1073 | -c "got a certificate request" \ |
| 1074 | -C "skip write certificate$" \ |
| 1075 | -C "got no certificate to send" \ |
| 1076 | -S "SSLv3 client has no certificate" \ |
| 1077 | -c "skip write certificate verify" \ |
| 1078 | -s "skip parse certificate verify" \ |
| 1079 | -s "! no client certificate sent" \ |
| 1080 | -S "! ssl_handshake returned" \ |
| 1081 | -C "! ssl_handshake returned" \ |
| 1082 | -S "X509 - Certificate verification failed" |
| 1083 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1084 | run_test "Authentication: openssl client no cert, server optional" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1085 | "$P_SRV debug_level=3 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | de515cc | 2014-02-27 14:58:26 +0100 | [diff] [blame] | 1086 | "$O_CLI" \ |
| 1087 | 0 \ |
| 1088 | -S "skip write certificate request" \ |
| 1089 | -s "skip parse certificate verify" \ |
| 1090 | -s "! no client certificate sent" \ |
| 1091 | -S "! ssl_handshake returned" \ |
| 1092 | -S "X509 - Certificate verification failed" |
| 1093 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1094 | run_test "Authentication: client no cert, openssl server optional" \ |
Manuel Pégourié-Gonnard | de515cc | 2014-02-27 14:58:26 +0100 | [diff] [blame] | 1095 | "$O_SRV -verify 10" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1096 | "$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] | 1097 | 0 \ |
| 1098 | -C "skip parse certificate request" \ |
| 1099 | -c "got a certificate request" \ |
| 1100 | -C "skip write certificate$" \ |
| 1101 | -c "skip write certificate verify" \ |
| 1102 | -C "! ssl_handshake returned" |
| 1103 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1104 | run_test "Authentication: client no cert, ssl3" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1105 | "$P_SRV debug_level=3 auth_mode=optional force_version=ssl3" \ |
| 1106 | "$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] | 1107 | 0 \ |
| 1108 | -S "skip write certificate request" \ |
| 1109 | -C "skip parse certificate request" \ |
| 1110 | -c "got a certificate request" \ |
| 1111 | -C "skip write certificate$" \ |
| 1112 | -c "skip write certificate verify" \ |
| 1113 | -c "got no certificate to send" \ |
| 1114 | -s "SSLv3 client has no certificate" \ |
| 1115 | -s "skip parse certificate verify" \ |
| 1116 | -s "! no client certificate sent" \ |
| 1117 | -S "! ssl_handshake returned" \ |
| 1118 | -C "! ssl_handshake returned" \ |
| 1119 | -S "X509 - Certificate verification failed" |
| 1120 | |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 1121 | # tests for SNI |
| 1122 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1123 | run_test "SNI: no SNI callback" \ |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 1124 | "$P_SRV debug_level=3 \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 1125 | 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] | 1126 | "$P_CLI server_name=localhost" \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 1127 | 0 \ |
| 1128 | -S "parse ServerName extension" \ |
| 1129 | -c "issuer name *: C=NL, O=PolarSSL, CN=Polarssl Test EC CA" \ |
| 1130 | -c "subject name *: C=NL, O=PolarSSL, CN=localhost" |
| 1131 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1132 | run_test "SNI: matching cert 1" \ |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 1133 | "$P_SRV debug_level=3 \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 1134 | crt_file=data_files/server5.crt key_file=data_files/server5.key \ |
Manuel Pégourié-Gonnard | 76b8ab7 | 2014-03-26 09:31:35 +0100 | [diff] [blame] | 1135 | 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] | 1136 | "$P_CLI server_name=localhost" \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 1137 | 0 \ |
| 1138 | -s "parse ServerName extension" \ |
| 1139 | -c "issuer name *: C=NL, O=PolarSSL, CN=PolarSSL Test CA" \ |
| 1140 | -c "subject name *: C=NL, O=PolarSSL, CN=localhost" |
| 1141 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1142 | run_test "SNI: matching cert 2" \ |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 1143 | "$P_SRV debug_level=3 \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 1144 | crt_file=data_files/server5.crt key_file=data_files/server5.key \ |
Manuel Pégourié-Gonnard | 76b8ab7 | 2014-03-26 09:31:35 +0100 | [diff] [blame] | 1145 | 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] | 1146 | "$P_CLI server_name=polarssl.example" \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 1147 | 0 \ |
| 1148 | -s "parse ServerName extension" \ |
| 1149 | -c "issuer name *: C=NL, O=PolarSSL, CN=PolarSSL Test CA" \ |
Manuel Pégourié-Gonnard | 76b8ab7 | 2014-03-26 09:31:35 +0100 | [diff] [blame] | 1150 | -c "subject name *: C=NL, O=PolarSSL, CN=polarssl.example" |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 1151 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1152 | run_test "SNI: no matching cert" \ |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 1153 | "$P_SRV debug_level=3 \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 1154 | crt_file=data_files/server5.crt key_file=data_files/server5.key \ |
Manuel Pégourié-Gonnard | 76b8ab7 | 2014-03-26 09:31:35 +0100 | [diff] [blame] | 1155 | 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] | 1156 | "$P_CLI server_name=nonesuch.example" \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 1157 | 1 \ |
| 1158 | -s "parse ServerName extension" \ |
| 1159 | -s "ssl_sni_wrapper() returned" \ |
| 1160 | -s "ssl_handshake returned" \ |
| 1161 | -c "ssl_handshake returned" \ |
| 1162 | -c "SSL - A fatal alert message was received from our peer" |
| 1163 | |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 1164 | # Tests for non-blocking I/O: exercise a variety of handshake flows |
| 1165 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1166 | run_test "Non-blocking I/O: basic handshake" \ |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 1167 | "$P_SRV nbio=2 tickets=0 auth_mode=none" \ |
| 1168 | "$P_CLI nbio=2 tickets=0" \ |
| 1169 | 0 \ |
| 1170 | -S "ssl_handshake returned" \ |
| 1171 | -C "ssl_handshake returned" \ |
| 1172 | -c "Read from server: .* bytes read" |
| 1173 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1174 | run_test "Non-blocking I/O: client auth" \ |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 1175 | "$P_SRV nbio=2 tickets=0 auth_mode=required" \ |
| 1176 | "$P_CLI nbio=2 tickets=0" \ |
| 1177 | 0 \ |
| 1178 | -S "ssl_handshake returned" \ |
| 1179 | -C "ssl_handshake returned" \ |
| 1180 | -c "Read from server: .* bytes read" |
| 1181 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1182 | run_test "Non-blocking I/O: ticket" \ |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 1183 | "$P_SRV nbio=2 tickets=1 auth_mode=none" \ |
| 1184 | "$P_CLI nbio=2 tickets=1" \ |
| 1185 | 0 \ |
| 1186 | -S "ssl_handshake returned" \ |
| 1187 | -C "ssl_handshake returned" \ |
| 1188 | -c "Read from server: .* bytes read" |
| 1189 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1190 | run_test "Non-blocking I/O: ticket + client auth" \ |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 1191 | "$P_SRV nbio=2 tickets=1 auth_mode=required" \ |
| 1192 | "$P_CLI nbio=2 tickets=1" \ |
| 1193 | 0 \ |
| 1194 | -S "ssl_handshake returned" \ |
| 1195 | -C "ssl_handshake returned" \ |
| 1196 | -c "Read from server: .* bytes read" |
| 1197 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1198 | run_test "Non-blocking I/O: ticket + client auth + resume" \ |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 1199 | "$P_SRV nbio=2 tickets=1 auth_mode=required" \ |
| 1200 | "$P_CLI nbio=2 tickets=1 reconnect=1" \ |
| 1201 | 0 \ |
| 1202 | -S "ssl_handshake returned" \ |
| 1203 | -C "ssl_handshake returned" \ |
| 1204 | -c "Read from server: .* bytes read" |
| 1205 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1206 | run_test "Non-blocking I/O: ticket + resume" \ |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 1207 | "$P_SRV nbio=2 tickets=1 auth_mode=none" \ |
| 1208 | "$P_CLI nbio=2 tickets=1 reconnect=1" \ |
| 1209 | 0 \ |
| 1210 | -S "ssl_handshake returned" \ |
| 1211 | -C "ssl_handshake returned" \ |
| 1212 | -c "Read from server: .* bytes read" |
| 1213 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1214 | run_test "Non-blocking I/O: session-id resume" \ |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 1215 | "$P_SRV nbio=2 tickets=0 auth_mode=none" \ |
| 1216 | "$P_CLI nbio=2 tickets=0 reconnect=1" \ |
| 1217 | 0 \ |
| 1218 | -S "ssl_handshake returned" \ |
| 1219 | -C "ssl_handshake returned" \ |
| 1220 | -c "Read from server: .* bytes read" |
| 1221 | |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 1222 | # Tests for version negotiation |
| 1223 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1224 | run_test "Version check: all -> 1.2" \ |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 1225 | "$P_SRV" \ |
| 1226 | "$P_CLI" \ |
| 1227 | 0 \ |
| 1228 | -S "ssl_handshake returned" \ |
| 1229 | -C "ssl_handshake returned" \ |
| 1230 | -s "Protocol is TLSv1.2" \ |
| 1231 | -c "Protocol is TLSv1.2" |
| 1232 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1233 | run_test "Version check: cli max 1.1 -> 1.1" \ |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 1234 | "$P_SRV" \ |
| 1235 | "$P_CLI max_version=tls1_1" \ |
| 1236 | 0 \ |
| 1237 | -S "ssl_handshake returned" \ |
| 1238 | -C "ssl_handshake returned" \ |
| 1239 | -s "Protocol is TLSv1.1" \ |
| 1240 | -c "Protocol is TLSv1.1" |
| 1241 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1242 | run_test "Version check: srv max 1.1 -> 1.1" \ |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 1243 | "$P_SRV max_version=tls1_1" \ |
| 1244 | "$P_CLI" \ |
| 1245 | 0 \ |
| 1246 | -S "ssl_handshake returned" \ |
| 1247 | -C "ssl_handshake returned" \ |
| 1248 | -s "Protocol is TLSv1.1" \ |
| 1249 | -c "Protocol is TLSv1.1" |
| 1250 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1251 | 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] | 1252 | "$P_SRV max_version=tls1_1" \ |
| 1253 | "$P_CLI max_version=tls1_1" \ |
| 1254 | 0 \ |
| 1255 | -S "ssl_handshake returned" \ |
| 1256 | -C "ssl_handshake returned" \ |
| 1257 | -s "Protocol is TLSv1.1" \ |
| 1258 | -c "Protocol is TLSv1.1" |
| 1259 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1260 | 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] | 1261 | "$P_SRV min_version=tls1_1" \ |
| 1262 | "$P_CLI max_version=tls1_1" \ |
| 1263 | 0 \ |
| 1264 | -S "ssl_handshake returned" \ |
| 1265 | -C "ssl_handshake returned" \ |
| 1266 | -s "Protocol is TLSv1.1" \ |
| 1267 | -c "Protocol is TLSv1.1" |
| 1268 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1269 | 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] | 1270 | "$P_SRV max_version=tls1_1" \ |
| 1271 | "$P_CLI min_version=tls1_1" \ |
| 1272 | 0 \ |
| 1273 | -S "ssl_handshake returned" \ |
| 1274 | -C "ssl_handshake returned" \ |
| 1275 | -s "Protocol is TLSv1.1" \ |
| 1276 | -c "Protocol is TLSv1.1" |
| 1277 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1278 | 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] | 1279 | "$P_SRV max_version=tls1_1" \ |
| 1280 | "$P_CLI min_version=tls1_2" \ |
| 1281 | 1 \ |
| 1282 | -s "ssl_handshake returned" \ |
| 1283 | -c "ssl_handshake returned" \ |
| 1284 | -c "SSL - Handshake protocol not within min/max boundaries" |
| 1285 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1286 | 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] | 1287 | "$P_SRV min_version=tls1_2" \ |
| 1288 | "$P_CLI max_version=tls1_1" \ |
| 1289 | 1 \ |
| 1290 | -s "ssl_handshake returned" \ |
| 1291 | -c "ssl_handshake returned" \ |
| 1292 | -s "SSL - Handshake protocol not within min/max boundaries" |
| 1293 | |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 1294 | # Tests for ALPN extension |
| 1295 | |
Manuel Pégourié-Gonnard | 83d8c73 | 2014-04-07 13:24:21 +0200 | [diff] [blame] | 1296 | if grep '^#define POLARSSL_SSL_ALPN' $CONFIG_H >/dev/null; then |
| 1297 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1298 | run_test "ALPN: none" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1299 | "$P_SRV debug_level=3" \ |
| 1300 | "$P_CLI debug_level=3" \ |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 1301 | 0 \ |
| 1302 | -C "client hello, adding alpn extension" \ |
| 1303 | -S "found alpn extension" \ |
| 1304 | -C "got an alert message, type: \\[2:120]" \ |
| 1305 | -S "server hello, adding alpn extension" \ |
| 1306 | -C "found alpn extension " \ |
| 1307 | -C "Application Layer Protocol is" \ |
| 1308 | -S "Application Layer Protocol is" |
| 1309 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1310 | run_test "ALPN: client only" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1311 | "$P_SRV debug_level=3" \ |
| 1312 | "$P_CLI debug_level=3 alpn=abc,1234" \ |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 1313 | 0 \ |
| 1314 | -c "client hello, adding alpn extension" \ |
| 1315 | -s "found alpn extension" \ |
| 1316 | -C "got an alert message, type: \\[2:120]" \ |
| 1317 | -S "server hello, adding alpn extension" \ |
| 1318 | -C "found alpn extension " \ |
| 1319 | -c "Application Layer Protocol is (none)" \ |
| 1320 | -S "Application Layer Protocol is" |
| 1321 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1322 | run_test "ALPN: server only" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1323 | "$P_SRV debug_level=3 alpn=abc,1234" \ |
| 1324 | "$P_CLI debug_level=3" \ |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 1325 | 0 \ |
| 1326 | -C "client hello, adding alpn extension" \ |
| 1327 | -S "found alpn extension" \ |
| 1328 | -C "got an alert message, type: \\[2:120]" \ |
| 1329 | -S "server hello, adding alpn extension" \ |
| 1330 | -C "found alpn extension " \ |
| 1331 | -C "Application Layer Protocol is" \ |
| 1332 | -s "Application Layer Protocol is (none)" |
| 1333 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1334 | run_test "ALPN: both, common cli1-srv1" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1335 | "$P_SRV debug_level=3 alpn=abc,1234" \ |
| 1336 | "$P_CLI debug_level=3 alpn=abc,1234" \ |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 1337 | 0 \ |
| 1338 | -c "client hello, adding alpn extension" \ |
| 1339 | -s "found alpn extension" \ |
| 1340 | -C "got an alert message, type: \\[2:120]" \ |
| 1341 | -s "server hello, adding alpn extension" \ |
| 1342 | -c "found alpn extension" \ |
| 1343 | -c "Application Layer Protocol is abc" \ |
| 1344 | -s "Application Layer Protocol is abc" |
| 1345 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1346 | run_test "ALPN: both, common cli2-srv1" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1347 | "$P_SRV debug_level=3 alpn=abc,1234" \ |
| 1348 | "$P_CLI debug_level=3 alpn=1234,abc" \ |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 1349 | 0 \ |
| 1350 | -c "client hello, adding alpn extension" \ |
| 1351 | -s "found alpn extension" \ |
| 1352 | -C "got an alert message, type: \\[2:120]" \ |
| 1353 | -s "server hello, adding alpn extension" \ |
| 1354 | -c "found alpn extension" \ |
| 1355 | -c "Application Layer Protocol is abc" \ |
| 1356 | -s "Application Layer Protocol is abc" |
| 1357 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1358 | run_test "ALPN: both, common cli1-srv2" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1359 | "$P_SRV debug_level=3 alpn=abc,1234" \ |
| 1360 | "$P_CLI debug_level=3 alpn=1234,abcde" \ |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 1361 | 0 \ |
| 1362 | -c "client hello, adding alpn extension" \ |
| 1363 | -s "found alpn extension" \ |
| 1364 | -C "got an alert message, type: \\[2:120]" \ |
| 1365 | -s "server hello, adding alpn extension" \ |
| 1366 | -c "found alpn extension" \ |
| 1367 | -c "Application Layer Protocol is 1234" \ |
| 1368 | -s "Application Layer Protocol is 1234" |
| 1369 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1370 | run_test "ALPN: both, no common" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1371 | "$P_SRV debug_level=3 alpn=abc,123" \ |
| 1372 | "$P_CLI debug_level=3 alpn=1234,abcde" \ |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 1373 | 1 \ |
| 1374 | -c "client hello, adding alpn extension" \ |
| 1375 | -s "found alpn extension" \ |
| 1376 | -c "got an alert message, type: \\[2:120]" \ |
| 1377 | -S "server hello, adding alpn extension" \ |
| 1378 | -C "found alpn extension" \ |
| 1379 | -C "Application Layer Protocol is 1234" \ |
| 1380 | -S "Application Layer Protocol is 1234" |
| 1381 | |
Manuel Pégourié-Gonnard | 83d8c73 | 2014-04-07 13:24:21 +0200 | [diff] [blame] | 1382 | fi |
| 1383 | |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1384 | # Tests for keyUsage in leaf certificates, part 1: |
| 1385 | # server-side certificate/suite selection |
| 1386 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1387 | run_test "keyUsage srv: RSA, digitalSignature -> (EC)DHE-RSA" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1388 | "$P_SRV key_file=data_files/server2.key \ |
| 1389 | crt_file=data_files/server2.ku-ds.crt" \ |
| 1390 | "$P_CLI" \ |
| 1391 | 0 \ |
Manuel Pégourié-Gonnard | 17cde5f | 2014-05-22 14:42:39 +0200 | [diff] [blame] | 1392 | -c "Ciphersuite is TLS-[EC]*DHE-RSA-WITH-" |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1393 | |
| 1394 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1395 | run_test "keyUsage srv: RSA, keyEncipherment -> RSA" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1396 | "$P_SRV key_file=data_files/server2.key \ |
| 1397 | crt_file=data_files/server2.ku-ke.crt" \ |
| 1398 | "$P_CLI" \ |
| 1399 | 0 \ |
| 1400 | -c "Ciphersuite is TLS-RSA-WITH-" |
| 1401 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1402 | run_test "keyUsage srv: RSA, keyAgreement -> fail" \ |
Manuel Pégourié-Gonnard | f2629b9 | 2014-08-30 14:20:14 +0200 | [diff] [blame] | 1403 | "$P_SRV key_file=data_files/server2.key \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1404 | crt_file=data_files/server2.ku-ka.crt" \ |
Manuel Pégourié-Gonnard | f2629b9 | 2014-08-30 14:20:14 +0200 | [diff] [blame] | 1405 | "$P_CLI" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1406 | 1 \ |
| 1407 | -C "Ciphersuite is " |
| 1408 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1409 | run_test "keyUsage srv: ECDSA, digitalSignature -> ECDHE-ECDSA" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1410 | "$P_SRV key_file=data_files/server5.key \ |
| 1411 | crt_file=data_files/server5.ku-ds.crt" \ |
| 1412 | "$P_CLI" \ |
| 1413 | 0 \ |
| 1414 | -c "Ciphersuite is TLS-ECDHE-ECDSA-WITH-" |
| 1415 | |
| 1416 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1417 | run_test "keyUsage srv: ECDSA, keyAgreement -> ECDH-" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1418 | "$P_SRV key_file=data_files/server5.key \ |
| 1419 | crt_file=data_files/server5.ku-ka.crt" \ |
| 1420 | "$P_CLI" \ |
| 1421 | 0 \ |
| 1422 | -c "Ciphersuite is TLS-ECDH-" |
| 1423 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1424 | run_test "keyUsage srv: ECDSA, keyEncipherment -> fail" \ |
Manuel Pégourié-Gonnard | f2629b9 | 2014-08-30 14:20:14 +0200 | [diff] [blame] | 1425 | "$P_SRV key_file=data_files/server5.key \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1426 | crt_file=data_files/server5.ku-ke.crt" \ |
Manuel Pégourié-Gonnard | f2629b9 | 2014-08-30 14:20:14 +0200 | [diff] [blame] | 1427 | "$P_CLI" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1428 | 1 \ |
| 1429 | -C "Ciphersuite is " |
| 1430 | |
| 1431 | # Tests for keyUsage in leaf certificates, part 2: |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1432 | # client-side checking of server cert |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1433 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1434 | run_test "keyUsage cli: DigitalSignature+KeyEncipherment, RSA: OK" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1435 | "$O_SRV -key data_files/server2.key \ |
| 1436 | -cert data_files/server2.ku-ds_ke.crt" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1437 | "$P_CLI debug_level=1 \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1438 | force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| 1439 | 0 \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1440 | -C "bad certificate (usage extensions)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1441 | -C "Processing of the Certificate handshake message failed" \ |
| 1442 | -c "Ciphersuite is TLS-" |
| 1443 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1444 | run_test "keyUsage cli: DigitalSignature+KeyEncipherment, DHE-RSA: OK" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1445 | "$O_SRV -key data_files/server2.key \ |
| 1446 | -cert data_files/server2.ku-ds_ke.crt" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1447 | "$P_CLI debug_level=1 \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1448 | force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA" \ |
| 1449 | 0 \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1450 | -C "bad certificate (usage extensions)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1451 | -C "Processing of the Certificate handshake message failed" \ |
| 1452 | -c "Ciphersuite is TLS-" |
| 1453 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1454 | run_test "keyUsage cli: KeyEncipherment, RSA: OK" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1455 | "$O_SRV -key data_files/server2.key \ |
| 1456 | -cert data_files/server2.ku-ke.crt" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1457 | "$P_CLI debug_level=1 \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1458 | force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| 1459 | 0 \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1460 | -C "bad certificate (usage extensions)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1461 | -C "Processing of the Certificate handshake message failed" \ |
| 1462 | -c "Ciphersuite is TLS-" |
| 1463 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1464 | run_test "keyUsage cli: KeyEncipherment, DHE-RSA: fail" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1465 | "$O_SRV -key data_files/server2.key \ |
| 1466 | -cert data_files/server2.ku-ke.crt" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1467 | "$P_CLI debug_level=1 \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1468 | force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA" \ |
| 1469 | 1 \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1470 | -c "bad certificate (usage extensions)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1471 | -c "Processing of the Certificate handshake message failed" \ |
| 1472 | -C "Ciphersuite is TLS-" |
| 1473 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1474 | run_test "keyUsage cli: DigitalSignature, DHE-RSA: OK" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1475 | "$O_SRV -key data_files/server2.key \ |
| 1476 | -cert data_files/server2.ku-ds.crt" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1477 | "$P_CLI debug_level=1 \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1478 | force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA" \ |
| 1479 | 0 \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1480 | -C "bad certificate (usage extensions)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1481 | -C "Processing of the Certificate handshake message failed" \ |
| 1482 | -c "Ciphersuite is TLS-" |
| 1483 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1484 | run_test "keyUsage cli: DigitalSignature, RSA: fail" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1485 | "$O_SRV -key data_files/server2.key \ |
| 1486 | -cert data_files/server2.ku-ds.crt" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1487 | "$P_CLI debug_level=1 \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1488 | force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| 1489 | 1 \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1490 | -c "bad certificate (usage extensions)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1491 | -c "Processing of the Certificate handshake message failed" \ |
| 1492 | -C "Ciphersuite is TLS-" |
| 1493 | |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1494 | # Tests for keyUsage in leaf certificates, part 3: |
| 1495 | # server-side checking of client cert |
| 1496 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1497 | run_test "keyUsage cli-auth: RSA, DigitalSignature: OK" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1498 | "$P_SRV debug_level=1 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1499 | "$O_CLI -key data_files/server2.key \ |
| 1500 | -cert data_files/server2.ku-ds.crt" \ |
| 1501 | 0 \ |
| 1502 | -S "bad certificate (usage extensions)" \ |
| 1503 | -S "Processing of the Certificate handshake message failed" |
| 1504 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1505 | run_test "keyUsage cli-auth: RSA, KeyEncipherment: fail (soft)" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1506 | "$P_SRV debug_level=1 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1507 | "$O_CLI -key data_files/server2.key \ |
| 1508 | -cert data_files/server2.ku-ke.crt" \ |
| 1509 | 0 \ |
| 1510 | -s "bad certificate (usage extensions)" \ |
| 1511 | -S "Processing of the Certificate handshake message failed" |
| 1512 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1513 | run_test "keyUsage cli-auth: RSA, KeyEncipherment: fail (hard)" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1514 | "$P_SRV debug_level=1 auth_mode=required" \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1515 | "$O_CLI -key data_files/server2.key \ |
| 1516 | -cert data_files/server2.ku-ke.crt" \ |
| 1517 | 1 \ |
| 1518 | -s "bad certificate (usage extensions)" \ |
| 1519 | -s "Processing of the Certificate handshake message failed" |
| 1520 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1521 | run_test "keyUsage cli-auth: ECDSA, DigitalSignature: OK" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1522 | "$P_SRV debug_level=1 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1523 | "$O_CLI -key data_files/server5.key \ |
| 1524 | -cert data_files/server5.ku-ds.crt" \ |
| 1525 | 0 \ |
| 1526 | -S "bad certificate (usage extensions)" \ |
| 1527 | -S "Processing of the Certificate handshake message failed" |
| 1528 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1529 | run_test "keyUsage cli-auth: ECDSA, KeyAgreement: fail (soft)" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1530 | "$P_SRV debug_level=1 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1531 | "$O_CLI -key data_files/server5.key \ |
| 1532 | -cert data_files/server5.ku-ka.crt" \ |
| 1533 | 0 \ |
| 1534 | -s "bad certificate (usage extensions)" \ |
| 1535 | -S "Processing of the Certificate handshake message failed" |
| 1536 | |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 1537 | # Tests for extendedKeyUsage, part 1: server-side certificate/suite selection |
| 1538 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1539 | run_test "extKeyUsage srv: serverAuth -> OK" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 1540 | "$P_SRV key_file=data_files/server5.key \ |
| 1541 | crt_file=data_files/server5.eku-srv.crt" \ |
| 1542 | "$P_CLI" \ |
| 1543 | 0 |
| 1544 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1545 | run_test "extKeyUsage srv: serverAuth,clientAuth -> OK" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 1546 | "$P_SRV key_file=data_files/server5.key \ |
| 1547 | crt_file=data_files/server5.eku-srv.crt" \ |
| 1548 | "$P_CLI" \ |
| 1549 | 0 |
| 1550 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1551 | run_test "extKeyUsage srv: codeSign,anyEKU -> OK" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 1552 | "$P_SRV key_file=data_files/server5.key \ |
| 1553 | crt_file=data_files/server5.eku-cs_any.crt" \ |
| 1554 | "$P_CLI" \ |
| 1555 | 0 |
| 1556 | |
| 1557 | # add psk to leave an option for client to send SERVERQUIT |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1558 | run_test "extKeyUsage srv: codeSign -> fail" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 1559 | "$P_SRV psk=abc123 key_file=data_files/server5.key \ |
| 1560 | crt_file=data_files/server5.eku-cli.crt" \ |
| 1561 | "$P_CLI psk=badbad" \ |
| 1562 | 1 |
| 1563 | |
| 1564 | # Tests for extendedKeyUsage, part 2: client-side checking of server cert |
| 1565 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1566 | run_test "extKeyUsage cli: serverAuth -> OK" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 1567 | "$O_SRV -key data_files/server5.key \ |
| 1568 | -cert data_files/server5.eku-srv.crt" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1569 | "$P_CLI debug_level=1" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 1570 | 0 \ |
| 1571 | -C "bad certificate (usage extensions)" \ |
| 1572 | -C "Processing of the Certificate handshake message failed" \ |
| 1573 | -c "Ciphersuite is TLS-" |
| 1574 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1575 | run_test "extKeyUsage cli: serverAuth,clientAuth -> OK" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 1576 | "$O_SRV -key data_files/server5.key \ |
| 1577 | -cert data_files/server5.eku-srv_cli.crt" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1578 | "$P_CLI debug_level=1" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 1579 | 0 \ |
| 1580 | -C "bad certificate (usage extensions)" \ |
| 1581 | -C "Processing of the Certificate handshake message failed" \ |
| 1582 | -c "Ciphersuite is TLS-" |
| 1583 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1584 | run_test "extKeyUsage cli: codeSign,anyEKU -> OK" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 1585 | "$O_SRV -key data_files/server5.key \ |
| 1586 | -cert data_files/server5.eku-cs_any.crt" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1587 | "$P_CLI debug_level=1" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 1588 | 0 \ |
| 1589 | -C "bad certificate (usage extensions)" \ |
| 1590 | -C "Processing of the Certificate handshake message failed" \ |
| 1591 | -c "Ciphersuite is TLS-" |
| 1592 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1593 | run_test "extKeyUsage cli: codeSign -> fail" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 1594 | "$O_SRV -key data_files/server5.key \ |
| 1595 | -cert data_files/server5.eku-cs.crt" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1596 | "$P_CLI debug_level=1" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 1597 | 1 \ |
| 1598 | -c "bad certificate (usage extensions)" \ |
| 1599 | -c "Processing of the Certificate handshake message failed" \ |
| 1600 | -C "Ciphersuite is TLS-" |
| 1601 | |
| 1602 | # Tests for extendedKeyUsage, part 3: server-side checking of client cert |
| 1603 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1604 | run_test "extKeyUsage cli-auth: clientAuth -> OK" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1605 | "$P_SRV debug_level=1 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 1606 | "$O_CLI -key data_files/server5.key \ |
| 1607 | -cert data_files/server5.eku-cli.crt" \ |
| 1608 | 0 \ |
| 1609 | -S "bad certificate (usage extensions)" \ |
| 1610 | -S "Processing of the Certificate handshake message failed" |
| 1611 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1612 | run_test "extKeyUsage cli-auth: serverAuth,clientAuth -> OK" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1613 | "$P_SRV debug_level=1 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 1614 | "$O_CLI -key data_files/server5.key \ |
| 1615 | -cert data_files/server5.eku-srv_cli.crt" \ |
| 1616 | 0 \ |
| 1617 | -S "bad certificate (usage extensions)" \ |
| 1618 | -S "Processing of the Certificate handshake message failed" |
| 1619 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1620 | run_test "extKeyUsage cli-auth: codeSign,anyEKU -> OK" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1621 | "$P_SRV debug_level=1 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 1622 | "$O_CLI -key data_files/server5.key \ |
| 1623 | -cert data_files/server5.eku-cs_any.crt" \ |
| 1624 | 0 \ |
| 1625 | -S "bad certificate (usage extensions)" \ |
| 1626 | -S "Processing of the Certificate handshake message failed" |
| 1627 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1628 | run_test "extKeyUsage cli-auth: codeSign -> fail (soft)" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1629 | "$P_SRV debug_level=1 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 1630 | "$O_CLI -key data_files/server5.key \ |
| 1631 | -cert data_files/server5.eku-cs.crt" \ |
| 1632 | 0 \ |
| 1633 | -s "bad certificate (usage extensions)" \ |
| 1634 | -S "Processing of the Certificate handshake message failed" |
| 1635 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1636 | run_test "extKeyUsage cli-auth: codeSign -> fail (hard)" \ |
Manuel Pégourié-Gonnard | 644e8f3 | 2014-08-30 21:59:31 +0200 | [diff] [blame] | 1637 | "$P_SRV debug_level=1 auth_mode=required" \ |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 1638 | "$O_CLI -key data_files/server5.key \ |
| 1639 | -cert data_files/server5.eku-cs.crt" \ |
| 1640 | 1 \ |
| 1641 | -s "bad certificate (usage extensions)" \ |
| 1642 | -s "Processing of the Certificate handshake message failed" |
| 1643 | |
Manuel Pégourié-Gonnard | 0cc7e31 | 2014-06-09 11:36:47 +0200 | [diff] [blame] | 1644 | # Tests for DHM parameters loading |
| 1645 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1646 | run_test "DHM parameters: reference" \ |
Manuel Pégourié-Gonnard | 0cc7e31 | 2014-06-09 11:36:47 +0200 | [diff] [blame] | 1647 | "$P_SRV" \ |
| 1648 | "$P_CLI force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA \ |
| 1649 | debug_level=3" \ |
| 1650 | 0 \ |
| 1651 | -c "value of 'DHM: P ' (2048 bits)" \ |
| 1652 | -c "value of 'DHM: G ' (2048 bits)" |
| 1653 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1654 | run_test "DHM parameters: other parameters" \ |
Manuel Pégourié-Gonnard | 0cc7e31 | 2014-06-09 11:36:47 +0200 | [diff] [blame] | 1655 | "$P_SRV dhm_file=data_files/dhparams.pem" \ |
| 1656 | "$P_CLI force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA \ |
| 1657 | debug_level=3" \ |
| 1658 | 0 \ |
| 1659 | -c "value of 'DHM: P ' (1024 bits)" \ |
| 1660 | -c "value of 'DHM: G ' (2 bits)" |
| 1661 | |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 1662 | # Tests for PSK callback |
| 1663 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1664 | run_test "PSK callback: psk, no callback" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 1665 | "$P_SRV psk=abc123 psk_identity=foo" \ |
| 1666 | "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \ |
| 1667 | psk_identity=foo psk=abc123" \ |
| 1668 | 0 \ |
Manuel Pégourié-Gonnard | 10c3c9f | 2014-06-10 15:28:52 +0200 | [diff] [blame] | 1669 | -S "SSL - The server has no ciphersuites in common" \ |
| 1670 | -S "SSL - Unknown identity received" \ |
| 1671 | -S "SSL - Verification of the message MAC failed" |
| 1672 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1673 | run_test "PSK callback: no psk, no callback" \ |
Manuel Pégourié-Gonnard | 10c3c9f | 2014-06-10 15:28:52 +0200 | [diff] [blame] | 1674 | "$P_SRV" \ |
| 1675 | "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \ |
| 1676 | psk_identity=foo psk=abc123" \ |
| 1677 | 1 \ |
| 1678 | -s "SSL - The server has no ciphersuites in common" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 1679 | -S "SSL - Unknown identity received" \ |
| 1680 | -S "SSL - Verification of the message MAC failed" |
| 1681 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1682 | run_test "PSK callback: callback overrides other settings" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 1683 | "$P_SRV psk=abc123 psk_identity=foo psk_list=abc,dead,def,beef" \ |
| 1684 | "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \ |
| 1685 | psk_identity=foo psk=abc123" \ |
| 1686 | 1 \ |
Manuel Pégourié-Gonnard | 10c3c9f | 2014-06-10 15:28:52 +0200 | [diff] [blame] | 1687 | -S "SSL - The server has no ciphersuites in common" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 1688 | -s "SSL - Unknown identity received" \ |
| 1689 | -S "SSL - Verification of the message MAC failed" |
| 1690 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1691 | run_test "PSK callback: first id matches" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 1692 | "$P_SRV psk_list=abc,dead,def,beef" \ |
| 1693 | "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \ |
| 1694 | psk_identity=abc psk=dead" \ |
| 1695 | 0 \ |
Manuel Pégourié-Gonnard | 10c3c9f | 2014-06-10 15:28:52 +0200 | [diff] [blame] | 1696 | -S "SSL - The server has no ciphersuites in common" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 1697 | -S "SSL - Unknown identity received" \ |
| 1698 | -S "SSL - Verification of the message MAC failed" |
| 1699 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1700 | run_test "PSK callback: second id matches" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 1701 | "$P_SRV psk_list=abc,dead,def,beef" \ |
| 1702 | "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \ |
| 1703 | psk_identity=def psk=beef" \ |
| 1704 | 0 \ |
Manuel Pégourié-Gonnard | 10c3c9f | 2014-06-10 15:28:52 +0200 | [diff] [blame] | 1705 | -S "SSL - The server has no ciphersuites in common" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 1706 | -S "SSL - Unknown identity received" \ |
| 1707 | -S "SSL - Verification of the message MAC failed" |
| 1708 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1709 | run_test "PSK callback: no match" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 1710 | "$P_SRV psk_list=abc,dead,def,beef" \ |
| 1711 | "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \ |
| 1712 | psk_identity=ghi psk=beef" \ |
| 1713 | 1 \ |
Manuel Pégourié-Gonnard | 10c3c9f | 2014-06-10 15:28:52 +0200 | [diff] [blame] | 1714 | -S "SSL - The server has no ciphersuites in common" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 1715 | -s "SSL - Unknown identity received" \ |
| 1716 | -S "SSL - Verification of the message MAC failed" |
| 1717 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1718 | run_test "PSK callback: wrong key" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 1719 | "$P_SRV psk_list=abc,dead,def,beef" \ |
| 1720 | "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \ |
| 1721 | psk_identity=abc psk=beef" \ |
| 1722 | 1 \ |
Manuel Pégourié-Gonnard | 10c3c9f | 2014-06-10 15:28:52 +0200 | [diff] [blame] | 1723 | -S "SSL - The server has no ciphersuites in common" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 1724 | -S "SSL - Unknown identity received" \ |
| 1725 | -s "SSL - Verification of the message MAC failed" |
Manuel Pégourié-Gonnard | 0cc7e31 | 2014-06-09 11:36:47 +0200 | [diff] [blame] | 1726 | |
Manuel Pégourié-Gonnard | 90805a8 | 2014-06-11 14:06:01 +0200 | [diff] [blame] | 1727 | # Tests for ciphersuites per version |
| 1728 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1729 | run_test "Per-version suites: SSL3" \ |
Manuel Pégourié-Gonnard | 90805a8 | 2014-06-11 14:06:01 +0200 | [diff] [blame] | 1730 | "$P_SRV version_suites=TLS-RSA-WITH-3DES-EDE-CBC-SHA,TLS-RSA-WITH-RC4-128-SHA,TLS-RSA-WITH-AES-128-CBC-SHA,TLS-RSA-WITH-AES-128-GCM-SHA256" \ |
| 1731 | "$P_CLI force_version=ssl3" \ |
| 1732 | 0 \ |
| 1733 | -c "Ciphersuite is TLS-RSA-WITH-3DES-EDE-CBC-SHA" |
| 1734 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1735 | run_test "Per-version suites: TLS 1.0" \ |
Manuel Pégourié-Gonnard | 90805a8 | 2014-06-11 14:06:01 +0200 | [diff] [blame] | 1736 | "$P_SRV version_suites=TLS-RSA-WITH-3DES-EDE-CBC-SHA,TLS-RSA-WITH-RC4-128-SHA,TLS-RSA-WITH-AES-128-CBC-SHA,TLS-RSA-WITH-AES-128-GCM-SHA256" \ |
| 1737 | "$P_CLI force_version=tls1" \ |
| 1738 | 0 \ |
| 1739 | -c "Ciphersuite is TLS-RSA-WITH-RC4-128-SHA" |
| 1740 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1741 | run_test "Per-version suites: TLS 1.1" \ |
Manuel Pégourié-Gonnard | 90805a8 | 2014-06-11 14:06:01 +0200 | [diff] [blame] | 1742 | "$P_SRV version_suites=TLS-RSA-WITH-3DES-EDE-CBC-SHA,TLS-RSA-WITH-RC4-128-SHA,TLS-RSA-WITH-AES-128-CBC-SHA,TLS-RSA-WITH-AES-128-GCM-SHA256" \ |
| 1743 | "$P_CLI force_version=tls1_1" \ |
| 1744 | 0 \ |
| 1745 | -c "Ciphersuite is TLS-RSA-WITH-AES-128-CBC-SHA" |
| 1746 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1747 | run_test "Per-version suites: TLS 1.2" \ |
Manuel Pégourié-Gonnard | 90805a8 | 2014-06-11 14:06:01 +0200 | [diff] [blame] | 1748 | "$P_SRV version_suites=TLS-RSA-WITH-3DES-EDE-CBC-SHA,TLS-RSA-WITH-RC4-128-SHA,TLS-RSA-WITH-AES-128-CBC-SHA,TLS-RSA-WITH-AES-128-GCM-SHA256" \ |
| 1749 | "$P_CLI force_version=tls1_2" \ |
| 1750 | 0 \ |
| 1751 | -c "Ciphersuite is TLS-RSA-WITH-AES-128-GCM-SHA256" |
| 1752 | |
Manuel Pégourié-Gonnard | 95c0a63 | 2014-06-11 18:32:36 +0200 | [diff] [blame] | 1753 | # Tests for ssl_get_bytes_avail() |
| 1754 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1755 | run_test "ssl_get_bytes_avail: no extra data" \ |
Manuel Pégourié-Gonnard | 95c0a63 | 2014-06-11 18:32:36 +0200 | [diff] [blame] | 1756 | "$P_SRV" \ |
| 1757 | "$P_CLI request_size=100" \ |
| 1758 | 0 \ |
| 1759 | -s "Read from client: 100 bytes read$" |
| 1760 | |
Manuel Pégourié-Gonnard | 8e03c71 | 2014-08-30 21:42:40 +0200 | [diff] [blame] | 1761 | run_test "ssl_get_bytes_avail: extra data" \ |
Manuel Pégourié-Gonnard | 95c0a63 | 2014-06-11 18:32:36 +0200 | [diff] [blame] | 1762 | "$P_SRV" \ |
| 1763 | "$P_CLI request_size=500" \ |
| 1764 | 0 \ |
| 1765 | -s "Read from client: 500 bytes read (.*+.*)" |
Manuel Pégourié-Gonnard | 90805a8 | 2014-06-11 14:06:01 +0200 | [diff] [blame] | 1766 | |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 1767 | # Tests for small packets |
| 1768 | |
| 1769 | run_test "Small packet SSLv3 BlockCipher" \ |
| 1770 | "$P_SRV" \ |
| 1771 | "$P_CLI request_size=1 force_version=ssl3 \ |
| 1772 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 1773 | 0 \ |
| 1774 | -s "Read from client: 1 bytes read" |
| 1775 | |
| 1776 | run_test "Small packet SSLv3 StreamCipher" \ |
| 1777 | "$P_SRV" \ |
| 1778 | "$P_CLI request_size=1 force_version=ssl3 \ |
| 1779 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 1780 | 0 \ |
| 1781 | -s "Read from client: 1 bytes read" |
| 1782 | |
| 1783 | run_test "Small packet TLS 1.0 BlockCipher" \ |
| 1784 | "$P_SRV" \ |
| 1785 | "$P_CLI request_size=1 force_version=tls1 \ |
| 1786 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 1787 | 0 \ |
| 1788 | -s "Read from client: 1 bytes read" |
| 1789 | |
| 1790 | run_test "Small packet TLS 1.0 BlockCipher truncated MAC" \ |
| 1791 | "$P_SRV" \ |
| 1792 | "$P_CLI request_size=1 force_version=tls1 \ |
| 1793 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA \ |
| 1794 | trunc_hmac=1" \ |
| 1795 | 0 \ |
| 1796 | -s "Read from client: 1 bytes read" |
| 1797 | |
| 1798 | run_test "Small packet TLS 1.0 StreamCipher truncated MAC" \ |
| 1799 | "$P_SRV" \ |
| 1800 | "$P_CLI request_size=1 force_version=tls1 \ |
| 1801 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \ |
| 1802 | trunc_hmac=1" \ |
| 1803 | 0 \ |
| 1804 | -s "Read from client: 1 bytes read" |
| 1805 | |
| 1806 | run_test "Small packet TLS 1.1 BlockCipher" \ |
| 1807 | "$P_SRV" \ |
| 1808 | "$P_CLI request_size=1 force_version=tls1_1 \ |
| 1809 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 1810 | 0 \ |
| 1811 | -s "Read from client: 1 bytes read" |
| 1812 | |
| 1813 | run_test "Small packet TLS 1.1 StreamCipher" \ |
| 1814 | "$P_SRV" \ |
| 1815 | "$P_CLI request_size=1 force_version=tls1_1 \ |
| 1816 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 1817 | 0 \ |
| 1818 | -s "Read from client: 1 bytes read" |
| 1819 | |
| 1820 | run_test "Small packet TLS 1.1 BlockCipher truncated MAC" \ |
| 1821 | "$P_SRV" \ |
| 1822 | "$P_CLI request_size=1 force_version=tls1_1 \ |
| 1823 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA \ |
| 1824 | trunc_hmac=1" \ |
| 1825 | 0 \ |
| 1826 | -s "Read from client: 1 bytes read" |
| 1827 | |
| 1828 | run_test "Small packet TLS 1.1 StreamCipher truncated MAC" \ |
| 1829 | "$P_SRV" \ |
| 1830 | "$P_CLI request_size=1 force_version=tls1_1 \ |
| 1831 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \ |
| 1832 | trunc_hmac=1" \ |
| 1833 | 0 \ |
| 1834 | -s "Read from client: 1 bytes read" |
| 1835 | |
| 1836 | run_test "Small packet TLS 1.2 BlockCipher" \ |
| 1837 | "$P_SRV" \ |
| 1838 | "$P_CLI request_size=1 force_version=tls1_2 \ |
| 1839 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 1840 | 0 \ |
| 1841 | -s "Read from client: 1 bytes read" |
| 1842 | |
| 1843 | run_test "Small packet TLS 1.2 BlockCipher larger MAC" \ |
| 1844 | "$P_SRV" \ |
| 1845 | "$P_CLI request_size=1 force_version=tls1_2 force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384" \ |
| 1846 | 0 \ |
| 1847 | -s "Read from client: 1 bytes read" |
| 1848 | |
| 1849 | run_test "Small packet TLS 1.2 BlockCipher truncated MAC" \ |
| 1850 | "$P_SRV" \ |
| 1851 | "$P_CLI request_size=1 force_version=tls1_2 \ |
| 1852 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA \ |
| 1853 | trunc_hmac=1" \ |
| 1854 | 0 \ |
| 1855 | -s "Read from client: 1 bytes read" |
| 1856 | |
| 1857 | run_test "Small packet TLS 1.2 StreamCipher" \ |
| 1858 | "$P_SRV" \ |
| 1859 | "$P_CLI request_size=1 force_version=tls1_2 \ |
| 1860 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 1861 | 0 \ |
| 1862 | -s "Read from client: 1 bytes read" |
| 1863 | |
| 1864 | run_test "Small packet TLS 1.2 StreamCipher truncated MAC" \ |
| 1865 | "$P_SRV" \ |
| 1866 | "$P_CLI request_size=1 force_version=tls1_2 \ |
| 1867 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \ |
| 1868 | trunc_hmac=1" \ |
| 1869 | 0 \ |
| 1870 | -s "Read from client: 1 bytes read" |
| 1871 | |
| 1872 | run_test "Small packet TLS 1.2 AEAD" \ |
| 1873 | "$P_SRV" \ |
| 1874 | "$P_CLI request_size=1 force_version=tls1_2 \ |
| 1875 | force_ciphersuite=TLS-RSA-WITH-AES-256-CCM" \ |
| 1876 | 0 \ |
| 1877 | -s "Read from client: 1 bytes read" |
| 1878 | |
| 1879 | run_test "Small packet TLS 1.2 AEAD shorter tag" \ |
| 1880 | "$P_SRV" \ |
| 1881 | "$P_CLI request_size=1 force_version=tls1_2 \ |
| 1882 | force_ciphersuite=TLS-RSA-WITH-AES-256-CCM-8" \ |
| 1883 | 0 \ |
| 1884 | -s "Read from client: 1 bytes read" |
| 1885 | |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 1886 | # Test for large packets |
| 1887 | |
| 1888 | run_test "Large packet SSLv3 BlockCipher" \ |
| 1889 | "$P_SRV" \ |
| 1890 | "$P_CLI request_size=16384 force_version=ssl3 \ |
| 1891 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 1892 | 0 \ |
| 1893 | -s "Read from client: 16384 bytes read" |
| 1894 | |
| 1895 | run_test "Large packet SSLv3 StreamCipher" \ |
| 1896 | "$P_SRV" \ |
| 1897 | "$P_CLI request_size=16384 force_version=ssl3 \ |
| 1898 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 1899 | 0 \ |
| 1900 | -s "Read from client: 16384 bytes read" |
| 1901 | |
| 1902 | run_test "Large packet TLS 1.0 BlockCipher" \ |
| 1903 | "$P_SRV" \ |
| 1904 | "$P_CLI request_size=16384 force_version=tls1 \ |
| 1905 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 1906 | 0 \ |
| 1907 | -s "Read from client: 16384 bytes read" |
| 1908 | |
| 1909 | run_test "Large packet TLS 1.0 BlockCipher truncated MAC" \ |
| 1910 | "$P_SRV" \ |
| 1911 | "$P_CLI request_size=16384 force_version=tls1 \ |
| 1912 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA \ |
| 1913 | trunc_hmac=1" \ |
| 1914 | 0 \ |
| 1915 | -s "Read from client: 16384 bytes read" |
| 1916 | |
| 1917 | run_test "Large packet TLS 1.0 StreamCipher truncated MAC" \ |
| 1918 | "$P_SRV" \ |
| 1919 | "$P_CLI request_size=16384 force_version=tls1 \ |
| 1920 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \ |
| 1921 | trunc_hmac=1" \ |
| 1922 | 0 \ |
| 1923 | -s "Read from client: 16384 bytes read" |
| 1924 | |
| 1925 | run_test "Large packet TLS 1.1 BlockCipher" \ |
| 1926 | "$P_SRV" \ |
| 1927 | "$P_CLI request_size=16384 force_version=tls1_1 \ |
| 1928 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 1929 | 0 \ |
| 1930 | -s "Read from client: 16384 bytes read" |
| 1931 | |
| 1932 | run_test "Large packet TLS 1.1 StreamCipher" \ |
| 1933 | "$P_SRV" \ |
| 1934 | "$P_CLI request_size=16384 force_version=tls1_1 \ |
| 1935 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 1936 | 0 \ |
| 1937 | -s "Read from client: 16384 bytes read" |
| 1938 | |
| 1939 | run_test "Large packet TLS 1.1 BlockCipher truncated MAC" \ |
| 1940 | "$P_SRV" \ |
| 1941 | "$P_CLI request_size=16384 force_version=tls1_1 \ |
| 1942 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA \ |
| 1943 | trunc_hmac=1" \ |
| 1944 | 0 \ |
| 1945 | -s "Read from client: 16384 bytes read" |
| 1946 | |
| 1947 | run_test "Large packet TLS 1.1 StreamCipher truncated MAC" \ |
| 1948 | "$P_SRV" \ |
| 1949 | "$P_CLI request_size=16384 force_version=tls1_1 \ |
| 1950 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \ |
| 1951 | trunc_hmac=1" \ |
| 1952 | 0 \ |
| 1953 | -s "Read from client: 16384 bytes read" |
| 1954 | |
| 1955 | run_test "Large packet TLS 1.2 BlockCipher" \ |
| 1956 | "$P_SRV" \ |
| 1957 | "$P_CLI request_size=16384 force_version=tls1_2 \ |
| 1958 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 1959 | 0 \ |
| 1960 | -s "Read from client: 16384 bytes read" |
| 1961 | |
| 1962 | run_test "Large packet TLS 1.2 BlockCipher larger MAC" \ |
| 1963 | "$P_SRV" \ |
| 1964 | "$P_CLI request_size=16384 force_version=tls1_2 force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384" \ |
| 1965 | 0 \ |
| 1966 | -s "Read from client: 16384 bytes read" |
| 1967 | |
| 1968 | run_test "Large packet TLS 1.2 BlockCipher truncated MAC" \ |
| 1969 | "$P_SRV" \ |
| 1970 | "$P_CLI request_size=16384 force_version=tls1_2 \ |
| 1971 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA \ |
| 1972 | trunc_hmac=1" \ |
| 1973 | 0 \ |
| 1974 | -s "Read from client: 16384 bytes read" |
| 1975 | |
| 1976 | run_test "Large packet TLS 1.2 StreamCipher" \ |
| 1977 | "$P_SRV" \ |
| 1978 | "$P_CLI request_size=16384 force_version=tls1_2 \ |
| 1979 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 1980 | 0 \ |
| 1981 | -s "Read from client: 16384 bytes read" |
| 1982 | |
| 1983 | run_test "Large packet TLS 1.2 StreamCipher truncated MAC" \ |
| 1984 | "$P_SRV" \ |
| 1985 | "$P_CLI request_size=16384 force_version=tls1_2 \ |
| 1986 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \ |
| 1987 | trunc_hmac=1" \ |
| 1988 | 0 \ |
| 1989 | -s "Read from client: 16384 bytes read" |
| 1990 | |
| 1991 | run_test "Large packet TLS 1.2 AEAD" \ |
| 1992 | "$P_SRV" \ |
| 1993 | "$P_CLI request_size=16384 force_version=tls1_2 \ |
| 1994 | force_ciphersuite=TLS-RSA-WITH-AES-256-CCM" \ |
| 1995 | 0 \ |
| 1996 | -s "Read from client: 16384 bytes read" |
| 1997 | |
| 1998 | run_test "Large packet TLS 1.2 AEAD shorter tag" \ |
| 1999 | "$P_SRV" \ |
| 2000 | "$P_CLI request_size=16384 force_version=tls1_2 \ |
| 2001 | force_ciphersuite=TLS-RSA-WITH-AES-256-CCM-8" \ |
| 2002 | 0 \ |
| 2003 | -s "Read from client: 16384 bytes read" |
| 2004 | |
Manuel Pégourié-Gonnard | 0eb6cab | 2014-07-23 20:17:47 +0200 | [diff] [blame] | 2005 | # Tests for DTLS HelloVerifyRequest |
| 2006 | |
| 2007 | run_test "DTLS cookie: enabled" \ |
| 2008 | "$P_SRV dtls=1 debug_level=2" \ |
| 2009 | "$P_CLI dtls=1 debug_level=2" \ |
| 2010 | 0 \ |
| 2011 | -s "cookie verification failed" \ |
| 2012 | -s "cookie verification passed" \ |
| 2013 | -S "cookie verification skipped" \ |
| 2014 | -c "received hello verify request" \ |
| 2015 | -S "SSL - The requested feature is not available" |
| 2016 | |
| 2017 | run_test "DTLS cookie: disabled" \ |
| 2018 | "$P_SRV dtls=1 debug_level=2 cookies=0" \ |
| 2019 | "$P_CLI dtls=1 debug_level=2" \ |
| 2020 | 0 \ |
| 2021 | -S "cookie verification failed" \ |
| 2022 | -S "cookie verification passed" \ |
| 2023 | -s "cookie verification skipped" \ |
| 2024 | -C "received hello verify request" \ |
| 2025 | -S "SSL - The requested feature is not available" |
| 2026 | |
| 2027 | # wait for client having a timeout, or server sending an alert |
| 2028 | #run_test "DTLS cookie: default (failing)" \ |
| 2029 | # "$P_SRV dtls=1 debug_level=2 cookies=-1" \ |
| 2030 | # "$P_CLI dtls=1 debug_level=2" \ |
| 2031 | # 0 \ |
| 2032 | # -S "cookie verification failed" \ |
| 2033 | # -S "cookie verification passed" \ |
| 2034 | # -S "cookie verification skipped" \ |
| 2035 | # -C "received hello verify request" \ |
| 2036 | # -s "SSL - The requested feature is not available" |
| 2037 | |
| 2038 | requires_ipv6 |
| 2039 | run_test "DTLS cookie: enabled, IPv6" \ |
| 2040 | "$P_SRV dtls=1 debug_level=2 server_addr=::1" \ |
| 2041 | "$P_CLI dtls=1 debug_level=2 server_addr=::1" \ |
| 2042 | 0 \ |
| 2043 | -s "cookie verification failed" \ |
| 2044 | -s "cookie verification passed" \ |
| 2045 | -S "cookie verification skipped" \ |
| 2046 | -c "received hello verify request" \ |
| 2047 | -S "SSL - The requested feature is not available" |
| 2048 | |
Manuel Pégourié-Gonnard | 08a1d4b | 2014-09-26 10:35:50 +0200 | [diff] [blame] | 2049 | # Tests for various cases of client authentication with DTLS |
| 2050 | # (focused on handshake flows and message parsing) |
| 2051 | |
| 2052 | run_test "DTLS client auth: required" \ |
| 2053 | "$P_SRV dtls=1 auth_mode=required" \ |
| 2054 | "$P_CLI dtls=1" \ |
| 2055 | 0 \ |
| 2056 | -s "Verifying peer X.509 certificate... ok" |
| 2057 | |
| 2058 | run_test "DTLS client auth: optional, client has no cert" \ |
| 2059 | "$P_SRV dtls=1 auth_mode=optional" \ |
| 2060 | "$P_CLI dtls=1 crt_file=none key_file=none" \ |
| 2061 | 0 \ |
| 2062 | -s "! no client certificate sent" |
| 2063 | |
| 2064 | run_test "DTLS client auth: optional, client has no cert" \ |
| 2065 | "$P_SRV dtls=1 auth_mode=none" \ |
| 2066 | "$P_CLI dtls=1 crt_file=none key_file=none debug_level=2" \ |
| 2067 | 0 \ |
| 2068 | -c "skip write certificate$" \ |
| 2069 | -s "! no client certificate sent" |
| 2070 | |
Manuel Pégourié-Gonnard | 502bf30 | 2014-08-20 13:12:58 +0200 | [diff] [blame] | 2071 | # Tests for receiving fragmented handshake messages with DTLS |
| 2072 | |
| 2073 | requires_gnutls |
| 2074 | run_test "DTLS reassembly: no fragmentation (gnutls server)" \ |
| 2075 | "$G_SRV -u --mtu 2048 -a" \ |
| 2076 | "$P_CLI dtls=1 debug_level=2" \ |
| 2077 | 0 \ |
| 2078 | -C "found fragmented DTLS handshake message" \ |
| 2079 | -C "error" |
| 2080 | |
| 2081 | requires_gnutls |
| 2082 | run_test "DTLS reassembly: some fragmentation (gnutls server)" \ |
| 2083 | "$G_SRV -u --mtu 512" \ |
| 2084 | "$P_CLI dtls=1 debug_level=2" \ |
| 2085 | 0 \ |
| 2086 | -c "found fragmented DTLS handshake message" \ |
| 2087 | -C "error" |
| 2088 | |
| 2089 | requires_gnutls |
| 2090 | run_test "DTLS reassembly: more fragmentation (gnutls server)" \ |
| 2091 | "$G_SRV -u --mtu 128" \ |
| 2092 | "$P_CLI dtls=1 debug_level=2" \ |
| 2093 | 0 \ |
| 2094 | -c "found fragmented DTLS handshake message" \ |
| 2095 | -C "error" |
| 2096 | |
| 2097 | requires_gnutls |
| 2098 | run_test "DTLS reassembly: more fragmentation, nbio (gnutls server)" \ |
| 2099 | "$G_SRV -u --mtu 128" \ |
| 2100 | "$P_CLI dtls=1 nbio=2 debug_level=2" \ |
| 2101 | 0 \ |
| 2102 | -c "found fragmented DTLS handshake message" \ |
| 2103 | -C "error" |
| 2104 | |
Manuel Pégourié-Gonnard | 0c4cbc7 | 2014-09-02 14:47:31 +0200 | [diff] [blame] | 2105 | requires_gnutls |
Manuel Pégourié-Gonnard | 0c4cbc7 | 2014-09-02 14:47:31 +0200 | [diff] [blame] | 2106 | run_test "DTLS reassembly: fragmentation, renego (gnutls server)" \ |
| 2107 | "$G_SRV -u --mtu 256" \ |
| 2108 | "$P_CLI debug_level=3 dtls=1 renegotiation=1 renegotiate=1" \ |
| 2109 | 0 \ |
| 2110 | -c "found fragmented DTLS handshake message" \ |
| 2111 | -c "client hello, adding renegotiation extension" \ |
| 2112 | -c "found renegotiation extension" \ |
| 2113 | -c "=> renegotiate" \ |
| 2114 | -C "ssl_handshake returned" \ |
| 2115 | -C "error" \ |
| 2116 | -s "Extra-header:" |
| 2117 | |
| 2118 | requires_gnutls |
Manuel Pégourié-Gonnard | 0c4cbc7 | 2014-09-02 14:47:31 +0200 | [diff] [blame] | 2119 | run_test "DTLS reassembly: fragmentation, nbio, renego (gnutls server)" \ |
| 2120 | "$G_SRV -u --mtu 256" \ |
| 2121 | "$P_CLI debug_level=3 nbio=2 dtls=1 renegotiation=1 renegotiate=1" \ |
| 2122 | 0 \ |
| 2123 | -c "found fragmented DTLS handshake message" \ |
| 2124 | -c "client hello, adding renegotiation extension" \ |
| 2125 | -c "found renegotiation extension" \ |
| 2126 | -c "=> renegotiate" \ |
| 2127 | -C "ssl_handshake returned" \ |
| 2128 | -C "error" \ |
| 2129 | -s "Extra-header:" |
| 2130 | |
Manuel Pégourié-Gonnard | a775617 | 2014-08-31 18:37:01 +0200 | [diff] [blame] | 2131 | run_test "DTLS reassembly: no fragmentation (openssl server)" \ |
| 2132 | "$O_SRV -dtls1 -mtu 2048" \ |
| 2133 | "$P_CLI dtls=1 debug_level=2" \ |
| 2134 | 0 \ |
| 2135 | -C "found fragmented DTLS handshake message" \ |
| 2136 | -C "error" |
| 2137 | |
Manuel Pégourié-Gonnard | 825a49e | 2014-09-23 11:00:37 +0200 | [diff] [blame] | 2138 | run_test "DTLS reassembly: some fragmentation (openssl server)" \ |
| 2139 | "$O_SRV -dtls1 -mtu 768" \ |
Manuel Pégourié-Gonnard | 64dffc5 | 2014-09-02 13:39:16 +0200 | [diff] [blame] | 2140 | "$P_CLI dtls=1 debug_level=2" \ |
| 2141 | 0 \ |
| 2142 | -c "found fragmented DTLS handshake message" \ |
| 2143 | -C "error" |
| 2144 | |
Manuel Pégourié-Gonnard | 825a49e | 2014-09-23 11:00:37 +0200 | [diff] [blame] | 2145 | run_test "DTLS reassembly: more fragmentation (openssl server)" \ |
Manuel Pégourié-Gonnard | 64dffc5 | 2014-09-02 13:39:16 +0200 | [diff] [blame] | 2146 | "$O_SRV -dtls1 -mtu 256" \ |
| 2147 | "$P_CLI dtls=1 debug_level=2" \ |
| 2148 | 0 \ |
| 2149 | -c "found fragmented DTLS handshake message" \ |
| 2150 | -C "error" |
| 2151 | |
| 2152 | run_test "DTLS reassembly: fragmentation, nbio (openssl server)" \ |
| 2153 | "$O_SRV -dtls1 -mtu 256" \ |
| 2154 | "$P_CLI dtls=1 nbio=2 debug_level=2" \ |
| 2155 | 0 \ |
| 2156 | -c "found fragmented DTLS handshake message" \ |
| 2157 | -C "error" |
Manuel Pégourié-Gonnard | a775617 | 2014-08-31 18:37:01 +0200 | [diff] [blame] | 2158 | |
Manuel Pégourié-Gonnard | 990f9e4 | 2014-09-06 12:27:02 +0200 | [diff] [blame] | 2159 | # Tests with UDP proxy emulating unreliable transport |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 2160 | |
Manuel Pégourié-Gonnard | 76fe9e4 | 2014-09-24 15:17:31 +0200 | [diff] [blame] | 2161 | not_with_valgrind # spurious resend due to timeout |
Manuel Pégourié-Gonnard | 990f9e4 | 2014-09-06 12:27:02 +0200 | [diff] [blame] | 2162 | run_test "DTLS proxy: reference" \ |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 2163 | -p "$P_PXY" \ |
Manuel Pégourié-Gonnard | 76fe9e4 | 2014-09-24 15:17:31 +0200 | [diff] [blame] | 2164 | "$P_SRV dtls=1 debug_level=2" \ |
| 2165 | "$P_CLI dtls=1 debug_level=2" \ |
Manuel Pégourié-Gonnard | 990f9e4 | 2014-09-06 12:27:02 +0200 | [diff] [blame] | 2166 | 0 \ |
Manuel Pégourié-Gonnard | 246c13a | 2014-09-24 13:56:09 +0200 | [diff] [blame] | 2167 | -C "replayed record" \ |
| 2168 | -S "replayed record" \ |
| 2169 | -C "record from another epoch" \ |
| 2170 | -S "record from another epoch" \ |
| 2171 | -C "discarding invalid record" \ |
| 2172 | -S "discarding invalid record" \ |
Manuel Pégourié-Gonnard | 76fe9e4 | 2014-09-24 15:17:31 +0200 | [diff] [blame] | 2173 | -C "resend" \ |
| 2174 | -S "resend" \ |
Manuel Pégourié-Gonnard | 63eca93 | 2014-09-08 16:39:08 +0200 | [diff] [blame] | 2175 | -s "Extra-header:" \ |
Manuel Pégourié-Gonnard | 990f9e4 | 2014-09-06 12:27:02 +0200 | [diff] [blame] | 2176 | -c "HTTP/1.0 200 OK" |
| 2177 | |
Manuel Pégourié-Gonnard | 76fe9e4 | 2014-09-24 15:17:31 +0200 | [diff] [blame] | 2178 | not_with_valgrind # spurious resend due to timeout |
Manuel Pégourié-Gonnard | b47368a | 2014-09-24 13:29:58 +0200 | [diff] [blame] | 2179 | run_test "DTLS proxy: duplicate every packet" \ |
Manuel Pégourié-Gonnard | 990f9e4 | 2014-09-06 12:27:02 +0200 | [diff] [blame] | 2180 | -p "$P_PXY duplicate=1" \ |
Manuel Pégourié-Gonnard | 76fe9e4 | 2014-09-24 15:17:31 +0200 | [diff] [blame] | 2181 | "$P_SRV dtls=1 debug_level=2" \ |
| 2182 | "$P_CLI dtls=1 debug_level=2" \ |
Manuel Pégourié-Gonnard | 990f9e4 | 2014-09-06 12:27:02 +0200 | [diff] [blame] | 2183 | 0 \ |
Manuel Pégourié-Gonnard | b47368a | 2014-09-24 13:29:58 +0200 | [diff] [blame] | 2184 | -c "replayed record" \ |
| 2185 | -s "replayed record" \ |
Manuel Pégourié-Gonnard | 246c13a | 2014-09-24 13:56:09 +0200 | [diff] [blame] | 2186 | -c "discarding invalid record" \ |
| 2187 | -s "discarding invalid record" \ |
Manuel Pégourié-Gonnard | 76fe9e4 | 2014-09-24 15:17:31 +0200 | [diff] [blame] | 2188 | -C "resend" \ |
| 2189 | -S "resend" \ |
Manuel Pégourié-Gonnard | 63eca93 | 2014-09-08 16:39:08 +0200 | [diff] [blame] | 2190 | -s "Extra-header:" \ |
| 2191 | -c "HTTP/1.0 200 OK" |
| 2192 | |
Manuel Pégourié-Gonnard | 2739313 | 2014-09-24 14:41:11 +0200 | [diff] [blame] | 2193 | run_test "DTLS proxy: duplicate every packet, server anti-replay off" \ |
| 2194 | -p "$P_PXY duplicate=1" \ |
Manuel Pégourié-Gonnard | 76fe9e4 | 2014-09-24 15:17:31 +0200 | [diff] [blame] | 2195 | "$P_SRV dtls=1 debug_level=2 anti_replay=0" \ |
| 2196 | "$P_CLI dtls=1 debug_level=2" \ |
Manuel Pégourié-Gonnard | 2739313 | 2014-09-24 14:41:11 +0200 | [diff] [blame] | 2197 | 0 \ |
| 2198 | -c "replayed record" \ |
| 2199 | -S "replayed record" \ |
| 2200 | -c "discarding invalid record" \ |
| 2201 | -s "discarding invalid record" \ |
Manuel Pégourié-Gonnard | 76fe9e4 | 2014-09-24 15:17:31 +0200 | [diff] [blame] | 2202 | -c "resend" \ |
| 2203 | -s "resend" \ |
Manuel Pégourié-Gonnard | 2739313 | 2014-09-24 14:41:11 +0200 | [diff] [blame] | 2204 | -s "Extra-header:" \ |
| 2205 | -c "HTTP/1.0 200 OK" |
| 2206 | |
Manuel Pégourié-Gonnard | 63eca93 | 2014-09-08 16:39:08 +0200 | [diff] [blame] | 2207 | run_test "DTLS proxy: inject invalid AD record" \ |
| 2208 | -p "$P_PXY bad_ad=1" \ |
Manuel Pégourié-Gonnard | 246c13a | 2014-09-24 13:56:09 +0200 | [diff] [blame] | 2209 | "$P_SRV dtls=1 debug_level=1" \ |
| 2210 | "$P_CLI dtls=1 debug_level=1" \ |
Manuel Pégourié-Gonnard | 825a49e | 2014-09-23 11:00:37 +0200 | [diff] [blame] | 2211 | 0 \ |
| 2212 | -c "discarding invalid record" \ |
Manuel Pégourié-Gonnard | 246c13a | 2014-09-24 13:56:09 +0200 | [diff] [blame] | 2213 | -s "discarding invalid record" \ |
Manuel Pégourié-Gonnard | 825a49e | 2014-09-23 11:00:37 +0200 | [diff] [blame] | 2214 | -s "Extra-header:" \ |
| 2215 | -c "HTTP/1.0 200 OK" |
| 2216 | |
| 2217 | run_test "DTLS proxy: delay ChangeCipherSpec" \ |
Manuel Pégourié-Gonnard | 246c13a | 2014-09-24 13:56:09 +0200 | [diff] [blame] | 2218 | -p "$P_PXY delay_ccs=1" \ |
| 2219 | "$P_SRV dtls=1 debug_level=1" \ |
| 2220 | "$P_CLI dtls=1 debug_level=1" \ |
Manuel Pégourié-Gonnard | 825a49e | 2014-09-23 11:00:37 +0200 | [diff] [blame] | 2221 | 0 \ |
Manuel Pégourié-Gonnard | 246c13a | 2014-09-24 13:56:09 +0200 | [diff] [blame] | 2222 | -c "record from another epoch" \ |
| 2223 | -s "record from another epoch" \ |
Manuel Pégourié-Gonnard | 825a49e | 2014-09-23 11:00:37 +0200 | [diff] [blame] | 2224 | -c "discarding invalid record" \ |
Manuel Pégourié-Gonnard | 246c13a | 2014-09-24 13:56:09 +0200 | [diff] [blame] | 2225 | -s "discarding invalid record" \ |
Manuel Pégourié-Gonnard | 825a49e | 2014-09-23 11:00:37 +0200 | [diff] [blame] | 2226 | -s "Extra-header:" \ |
| 2227 | -c "HTTP/1.0 200 OK" |
| 2228 | |
Manuel Pégourié-Gonnard | b47368a | 2014-09-24 13:29:58 +0200 | [diff] [blame] | 2229 | needs_more_time 2 |
Manuel Pégourié-Gonnard | 18e519a | 2014-09-24 19:09:17 +0200 | [diff] [blame] | 2230 | run_test "DTLS proxy: delay packets heavily" \ |
Manuel Pégourié-Gonnard | 825a49e | 2014-09-23 11:00:37 +0200 | [diff] [blame] | 2231 | -p "$P_PXY delay=3" \ |
Manuel Pégourié-Gonnard | 246c13a | 2014-09-24 13:56:09 +0200 | [diff] [blame] | 2232 | "$P_SRV dtls=1 debug_level=1" \ |
| 2233 | "$P_CLI dtls=1 debug_level=1" \ |
Manuel Pégourié-Gonnard | 63eca93 | 2014-09-08 16:39:08 +0200 | [diff] [blame] | 2234 | 0 \ |
Manuel Pégourié-Gonnard | 246c13a | 2014-09-24 13:56:09 +0200 | [diff] [blame] | 2235 | -C "replayed record" \ |
| 2236 | -S "replayed record" \ |
Manuel Pégourié-Gonnard | 63eca93 | 2014-09-08 16:39:08 +0200 | [diff] [blame] | 2237 | -s "Extra-header:" \ |
Manuel Pégourié-Gonnard | 990f9e4 | 2014-09-06 12:27:02 +0200 | [diff] [blame] | 2238 | -c "HTTP/1.0 200 OK" |
Manuel Pégourié-Gonnard | be9eb87 | 2014-09-05 17:45:19 +0200 | [diff] [blame] | 2239 | |
Manuel Pégourié-Gonnard | a071972 | 2014-09-20 12:46:27 +0200 | [diff] [blame] | 2240 | needs_more_time 3 |
Manuel Pégourié-Gonnard | 18e519a | 2014-09-24 19:09:17 +0200 | [diff] [blame] | 2241 | run_test "DTLS proxy: drop packets heavily" \ |
Manuel Pégourié-Gonnard | a071972 | 2014-09-20 12:46:27 +0200 | [diff] [blame] | 2242 | -p "$P_PXY drop=3" \ |
| 2243 | "$P_SRV dtls=1" \ |
| 2244 | "$P_CLI dtls=1" \ |
| 2245 | 0 \ |
| 2246 | -s "Extra-header:" \ |
| 2247 | -c "HTTP/1.0 200 OK" |
| 2248 | |
Manuel Pégourié-Gonnard | 18e519a | 2014-09-24 19:09:17 +0200 | [diff] [blame] | 2249 | # now try a variety of handshake flows with "unreliable connection" |
| 2250 | |
Manuel Pégourié-Gonnard | 825a49e | 2014-09-23 11:00:37 +0200 | [diff] [blame] | 2251 | needs_more_time 2 |
Manuel Pégourié-Gonnard | 18e519a | 2014-09-24 19:09:17 +0200 | [diff] [blame] | 2252 | 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] | 2253 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
Manuel Pégourié-Gonnard | 18e519a | 2014-09-24 19:09:17 +0200 | [diff] [blame] | 2254 | "$P_SRV dtls=1 tickets=0 auth_mode=none psk=abc123" \ |
| 2255 | "$P_CLI dtls=1 tickets=0 psk=abc123 \ |
| 2256 | force_ciphersuite=TLS-PSK-WITH-AES-128-CCM-8" \ |
| 2257 | 0 \ |
| 2258 | -s "Extra-header:" \ |
| 2259 | -c "HTTP/1.0 200 OK" |
| 2260 | |
| 2261 | needs_more_time 2 |
| 2262 | run_test "DTLS proxy: 3d, \"short\" RSA handshake" \ |
| 2263 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
| 2264 | "$P_SRV dtls=1 tickets=0 auth_mode=none" \ |
| 2265 | "$P_CLI dtls=1 tickets=0 \ |
| 2266 | force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| 2267 | 0 \ |
| 2268 | -s "Extra-header:" \ |
| 2269 | -c "HTTP/1.0 200 OK" |
| 2270 | |
| 2271 | needs_more_time 2 |
| 2272 | run_test "DTLS proxy: 3d, \"short\" (no ticket, no cli_auth) FS handshake" \ |
| 2273 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
| 2274 | "$P_SRV dtls=1 tickets=0 auth_mode=none" \ |
| 2275 | "$P_CLI dtls=1 tickets=0" \ |
| 2276 | 0 \ |
| 2277 | -s "Extra-header:" \ |
| 2278 | -c "HTTP/1.0 200 OK" |
| 2279 | |
| 2280 | needs_more_time 2 |
| 2281 | run_test "DTLS proxy: 3d, FS, client auth" \ |
| 2282 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
| 2283 | "$P_SRV dtls=1 tickets=0 auth_mode=required" \ |
| 2284 | "$P_CLI dtls=1 tickets=0" \ |
| 2285 | 0 \ |
| 2286 | -s "Extra-header:" \ |
| 2287 | -c "HTTP/1.0 200 OK" |
| 2288 | |
| 2289 | needs_more_time 2 |
| 2290 | run_test "DTLS proxy: 3d, FS, ticket" \ |
| 2291 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
| 2292 | "$P_SRV dtls=1 tickets=1 auth_mode=none" \ |
| 2293 | "$P_CLI dtls=1 tickets=1" \ |
| 2294 | 0 \ |
| 2295 | -s "Extra-header:" \ |
| 2296 | -c "HTTP/1.0 200 OK" |
| 2297 | |
| 2298 | needs_more_time 2 |
| 2299 | run_test "DTLS proxy: 3d, max handshake (FS, ticket + client auth)" \ |
| 2300 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
| 2301 | "$P_SRV dtls=1 tickets=1 auth_mode=required" \ |
| 2302 | "$P_CLI dtls=1 tickets=1" \ |
Manuel Pégourié-Gonnard | 825a49e | 2014-09-23 11:00:37 +0200 | [diff] [blame] | 2303 | 0 \ |
| 2304 | -s "Extra-header:" \ |
| 2305 | -c "HTTP/1.0 200 OK" |
| 2306 | |
Manuel Pégourié-Gonnard | 1b753f1 | 2014-09-25 16:09:36 +0200 | [diff] [blame] | 2307 | needs_more_time 4 |
| 2308 | run_test "DTLS proxy: 3d, min handshake, client-initiated renegotiation" \ |
| 2309 | -p "$P_PXY drop=5 delay=5 duplicate=5" \ |
| 2310 | "$P_SRV dtls=1 tickets=0 auth_mode=none psk=abc123 |
| 2311 | renegotiation=1 debug_level=2" \ |
| 2312 | "$P_CLI dtls=1 tickets=0 psk=abc123 renegotiate=1 debug_level=2 |
| 2313 | force_ciphersuite=TLS-PSK-WITH-AES-128-CCM-8" \ |
| 2314 | 0 \ |
| 2315 | -c "=> renegotiate" \ |
| 2316 | -s "=> renegotiate" \ |
| 2317 | -s "Extra-header:" \ |
| 2318 | -c "HTTP/1.0 200 OK" |
| 2319 | |
Manuel Pégourié-Gonnard | d0fd1da | 2014-09-25 17:00:27 +0200 | [diff] [blame] | 2320 | needs_more_time 2 |
| 2321 | run_test "DTLS proxy: 3d, max handshake, openssl server" \ |
| 2322 | -p "$P_PXY drop=5 delay=5 duplicate=5 protect_hvr=1" \ |
| 2323 | "$O_SRV -dtls1 -mtu 2048" \ |
| 2324 | "$P_CLI dtls=1" \ |
| 2325 | 0 \ |
| 2326 | -s "Extra-header:" \ |
| 2327 | -c "HTTP/1.0 200 OK" |
| 2328 | |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 2329 | # Final report |
| 2330 | |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 2331 | echo "------------------------------------------------------------------------" |
| 2332 | |
| 2333 | if [ $FAILS = 0 ]; then |
| 2334 | echo -n "PASSED" |
| 2335 | else |
| 2336 | echo -n "FAILED" |
| 2337 | fi |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 2338 | PASSES=$(( $TESTS - $FAILS )) |
Manuel Pégourié-Gonnard | 6f4fbbb | 2014-08-14 14:31:29 +0200 | [diff] [blame] | 2339 | echo " ($PASSES / $TESTS tests ($SKIPS skipped))" |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 2340 | |
| 2341 | exit $FAILS |