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