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 | # |
| 9 | # Assumes all options are compiled in. |
| 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 | 74faf3c | 2014-03-13 18:47:44 +0100 | [diff] [blame] | 16 | : ${OPENSSL_CMD:=openssl} # OPENSSL would conflict with the build system |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 17 | |
Manuel Pégourié-Gonnard | 74faf3c | 2014-03-13 18:47:44 +0100 | [diff] [blame] | 18 | O_SRV="$OPENSSL_CMD s_server -www -cert data_files/server5.crt -key data_files/server5.key" |
| 19 | O_CLI="echo 'GET / HTTP/1.0' | $OPENSSL_CMD s_client" |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 20 | |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 21 | TESTS=0 |
| 22 | FAILS=0 |
| 23 | |
Manuel Pégourié-Gonnard | 83d8c73 | 2014-04-07 13:24:21 +0200 | [diff] [blame^] | 24 | CONFIG_H='../include/polarssl/config.h' |
| 25 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 26 | MEMCHECK=0 |
Manuel Pégourié-Gonnard | 417d46c | 2014-03-13 19:17:53 +0100 | [diff] [blame] | 27 | FILTER='.*' |
| 28 | EXCLUDE='SSLv2' # disabled by default, needs OpenSSL compiled with SSLv2 |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 29 | |
| 30 | print_usage() { |
| 31 | echo "Usage: $0 [options]" |
Manuel Pégourié-Gonnard | 417d46c | 2014-03-13 19:17:53 +0100 | [diff] [blame] | 32 | echo -e " -h|--help\tPrint this help." |
| 33 | echo -e " -m|--memcheck\tCheck memory leaks and errors." |
| 34 | echo -e " -f|--filter\tOnly matching tests are executed (default: '$FILTER')" |
| 35 | echo -e " -e|--exclude\tMatching tests are excluded (default: '$EXCLUDE')" |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 36 | } |
| 37 | |
| 38 | get_options() { |
| 39 | while [ $# -gt 0 ]; do |
| 40 | case "$1" in |
Manuel Pégourié-Gonnard | 417d46c | 2014-03-13 19:17:53 +0100 | [diff] [blame] | 41 | -f|--filter) |
| 42 | shift; FILTER=$1 |
| 43 | ;; |
| 44 | -e|--exclude) |
| 45 | shift; EXCLUDE=$1 |
| 46 | ;; |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 47 | -m|--memcheck) |
| 48 | MEMCHECK=1 |
| 49 | ;; |
| 50 | -h|--help) |
| 51 | print_usage |
| 52 | exit 0 |
| 53 | ;; |
| 54 | *) |
| 55 | echo "Unkown argument: '$1'" |
| 56 | print_usage |
| 57 | exit 1 |
| 58 | ;; |
| 59 | esac |
| 60 | shift |
| 61 | done |
| 62 | } |
| 63 | |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 64 | # print_name <name> |
| 65 | print_name() { |
| 66 | echo -n "$1 " |
| 67 | LEN=`echo "$1" | wc -c` |
| 68 | LEN=`echo 72 - $LEN | bc` |
| 69 | for i in `seq 1 $LEN`; do echo -n '.'; done |
| 70 | echo -n ' ' |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 71 | |
| 72 | TESTS=`echo $TESTS + 1 | bc` |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 73 | } |
| 74 | |
| 75 | # fail <message> |
| 76 | fail() { |
| 77 | echo "FAIL" |
Manuel Pégourié-Gonnard | 3eec604 | 2014-02-27 15:37:24 +0100 | [diff] [blame] | 78 | echo " ! $1" |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 79 | |
Manuel Pégourié-Gonnard | 3eec604 | 2014-02-27 15:37:24 +0100 | [diff] [blame] | 80 | cp srv_out o-srv-${TESTS}.log |
| 81 | cp cli_out o-cli-${TESTS}.log |
| 82 | echo " ! outputs saved to o-srv-${TESTS}.log and o-cli-${TESTS}.log" |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 83 | |
| 84 | FAILS=`echo $FAILS + 1 | bc` |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 85 | } |
| 86 | |
Manuel Pégourié-Gonnard | 677884d | 2014-02-25 16:42:31 +0100 | [diff] [blame] | 87 | # is_polar <cmd_line> |
| 88 | is_polar() { |
| 89 | echo "$1" | grep 'ssl_server2\|ssl_client2' > /dev/null |
| 90 | } |
| 91 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 92 | # has_mem_err <log_file_name> |
| 93 | has_mem_err() { |
| 94 | if ( grep -F 'All heap blocks were freed -- no leaks are possible' "$1" && |
| 95 | grep -F 'ERROR SUMMARY: 0 errors from 0 contexts' "$1" ) > /dev/null |
| 96 | then |
| 97 | return 1 # false: does not have errors |
| 98 | else |
| 99 | return 0 # true: has errors |
| 100 | fi |
| 101 | } |
| 102 | |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 103 | # Usage: run_test name srv_cmd cli_cmd cli_exit [option [...]] |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 104 | # Options: -s pattern pattern that must be present in server output |
| 105 | # -c pattern pattern that must be present in client output |
| 106 | # -S pattern pattern that must be absent in server output |
| 107 | # -C pattern pattern that must be absent in client output |
| 108 | run_test() { |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 109 | NAME="$1" |
| 110 | SRV_CMD="$2" |
| 111 | CLI_CMD="$3" |
| 112 | CLI_EXPECT="$4" |
| 113 | shift 4 |
| 114 | |
Manuel Pégourié-Gonnard | 417d46c | 2014-03-13 19:17:53 +0100 | [diff] [blame] | 115 | if echo "$NAME" | grep "$FILTER" | grep -v "$EXCLUDE" >/dev/null; then : |
| 116 | else |
| 117 | return |
| 118 | fi |
| 119 | |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 120 | print_name "$NAME" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 121 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 122 | # prepend valgrind to our commands if active |
| 123 | if [ "$MEMCHECK" -gt 0 ]; then |
| 124 | if is_polar "$SRV_CMD"; then |
| 125 | SRV_CMD="valgrind --leak-check=full $SRV_CMD" |
| 126 | fi |
| 127 | if is_polar "$CLI_CMD"; then |
| 128 | CLI_CMD="valgrind --leak-check=full $CLI_CMD" |
| 129 | fi |
| 130 | fi |
| 131 | |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 132 | # run the commands |
Manuel Pégourié-Gonnard | ba0b844 | 2014-03-13 17:57:45 +0100 | [diff] [blame] | 133 | echo "$SRV_CMD" > srv_out |
Manuel Pégourié-Gonnard | 76b8ab7 | 2014-03-26 09:31:35 +0100 | [diff] [blame] | 134 | $SRV_CMD >> srv_out 2>&1 & |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 135 | SRV_PID=$! |
| 136 | sleep 1 |
Manuel Pégourié-Gonnard | ba0b844 | 2014-03-13 17:57:45 +0100 | [diff] [blame] | 137 | echo "$CLI_CMD" > cli_out |
Manuel Pégourié-Gonnard | 76b8ab7 | 2014-03-26 09:31:35 +0100 | [diff] [blame] | 138 | eval "$CLI_CMD" >> cli_out 2>&1 |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 139 | CLI_EXIT=$? |
Manuel Pégourié-Gonnard | e01af4c | 2014-03-25 14:16:44 +0100 | [diff] [blame] | 140 | echo "EXIT: $CLI_EXIT" >> cli_out |
| 141 | |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 142 | if is_polar "$SRV_CMD"; then |
Manuel Pégourié-Gonnard | 84fd687 | 2014-03-13 18:35:10 +0100 | [diff] [blame] | 143 | "$P_CLI" request_page=SERVERQUIT tickets=0 auth_mode=none \ |
| 144 | crt_file=data_files/cli2.crt key_file=data_files/cli2.key \ |
| 145 | >/dev/null |
Manuel Pégourié-Gonnard | 677884d | 2014-02-25 16:42:31 +0100 | [diff] [blame] | 146 | else |
| 147 | kill $SRV_PID |
| 148 | fi |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 149 | wait $SRV_PID |
Manuel Pégourié-Gonnard | 677884d | 2014-02-25 16:42:31 +0100 | [diff] [blame] | 150 | |
| 151 | # check if the client and server went at least to the handshake stage |
| 152 | # (usefull to avoid tests with only negative assertions and non-zero |
| 153 | # expected client exit to incorrectly succeed in case of catastrophic |
| 154 | # failure) |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 155 | if is_polar "$SRV_CMD"; then |
Manuel Pégourié-Gonnard | 677884d | 2014-02-25 16:42:31 +0100 | [diff] [blame] | 156 | if grep "Performing the SSL/TLS handshake" srv_out >/dev/null; then :; |
| 157 | else |
| 158 | fail "server failed to start" |
| 159 | return |
| 160 | fi |
| 161 | fi |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 162 | if is_polar "$CLI_CMD"; then |
Manuel Pégourié-Gonnard | 677884d | 2014-02-25 16:42:31 +0100 | [diff] [blame] | 163 | if grep "Performing the SSL/TLS handshake" cli_out >/dev/null; then :; |
| 164 | else |
| 165 | fail "client failed to start" |
| 166 | return |
| 167 | fi |
| 168 | fi |
| 169 | |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 170 | # check server exit code |
| 171 | if [ $? != 0 ]; then |
| 172 | fail "server fail" |
| 173 | return |
| 174 | fi |
| 175 | |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 176 | # check client exit code |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 177 | if [ \( "$CLI_EXPECT" = 0 -a "$CLI_EXIT" != 0 \) -o \ |
| 178 | \( "$CLI_EXPECT" != 0 -a "$CLI_EXIT" = 0 \) ] |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 179 | then |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 180 | fail "bad client exit code" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 181 | return |
| 182 | fi |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 183 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 184 | # check other assertions |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 185 | while [ $# -gt 0 ] |
| 186 | do |
| 187 | case $1 in |
| 188 | "-s") |
| 189 | if grep "$2" srv_out >/dev/null; then :; else |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 190 | fail "-s $2" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 191 | return |
| 192 | fi |
| 193 | ;; |
| 194 | |
| 195 | "-c") |
| 196 | if grep "$2" cli_out >/dev/null; then :; else |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 197 | fail "-c $2" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 198 | return |
| 199 | fi |
| 200 | ;; |
| 201 | |
| 202 | "-S") |
| 203 | if grep "$2" srv_out >/dev/null; then |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 204 | fail "-S $2" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 205 | return |
| 206 | fi |
| 207 | ;; |
| 208 | |
| 209 | "-C") |
| 210 | if grep "$2" cli_out >/dev/null; then |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 211 | fail "-C $2" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 212 | return |
| 213 | fi |
| 214 | ;; |
| 215 | |
| 216 | *) |
| 217 | echo "Unkown test: $1" >&2 |
| 218 | exit 1 |
| 219 | esac |
| 220 | shift 2 |
| 221 | done |
| 222 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 223 | # check valgrind's results |
| 224 | if [ "$MEMCHECK" -gt 0 ]; then |
| 225 | if is_polar "$SRV_CMD" && has_mem_err srv_out; then |
| 226 | fail "Server has memory errors" |
| 227 | return |
| 228 | fi |
| 229 | if is_polar "$CLI_CMD" && has_mem_err cli_out; then |
| 230 | fail "Client has memory errors" |
| 231 | return |
| 232 | fi |
| 233 | fi |
| 234 | |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 235 | # if we're here, everything is ok |
| 236 | echo "PASS" |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 237 | rm -f srv_out cli_out |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 238 | } |
| 239 | |
Manuel Pégourié-Gonnard | a9062e9 | 2014-02-25 16:21:22 +0100 | [diff] [blame] | 240 | cleanup() { |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 241 | rm -f cli_out srv_out sess |
Manuel Pégourié-Gonnard | a9062e9 | 2014-02-25 16:21:22 +0100 | [diff] [blame] | 242 | kill $SRV_PID |
| 243 | exit 1 |
| 244 | } |
| 245 | |
Manuel Pégourié-Gonnard | 9dea8bd | 2014-02-26 18:21:02 +0100 | [diff] [blame] | 246 | # |
| 247 | # MAIN |
| 248 | # |
| 249 | |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 250 | # sanity checks, avoid an avalanche of errors |
| 251 | if [ ! -x "$P_SRV" ]; then |
| 252 | echo "Command '$P_SRV' is not an executable file" |
| 253 | exit 1 |
| 254 | fi |
| 255 | if [ ! -x "$P_CLI" ]; then |
| 256 | echo "Command '$P_CLI' is not an executable file" |
| 257 | exit 1 |
| 258 | fi |
Manuel Pégourié-Gonnard | 74faf3c | 2014-03-13 18:47:44 +0100 | [diff] [blame] | 259 | if which $OPENSSL_CMD >/dev/null 2>&1; then :; else |
| 260 | echo "Command '$OPENSSL_CMD' not found" |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 261 | exit 1 |
| 262 | fi |
| 263 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 264 | get_options "$@" |
| 265 | |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 266 | killall -q openssl ssl_server ssl_server2 |
Manuel Pégourié-Gonnard | a9062e9 | 2014-02-25 16:21:22 +0100 | [diff] [blame] | 267 | trap cleanup INT TERM HUP |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 268 | |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 269 | # Test for SSLv2 ClientHello |
| 270 | |
| 271 | run_test "SSLv2 ClientHello #0 (reference)" \ |
| 272 | "$P_SRV debug_level=3" \ |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 273 | "$O_CLI -no_ssl2" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 274 | 0 \ |
| 275 | -S "parse client hello v2" \ |
| 276 | -S "ssl_handshake returned" |
| 277 | |
| 278 | # Adding a SSL2-only suite makes OpenSSL client send SSLv2 ClientHello |
| 279 | run_test "SSLv2 ClientHello #1 (actual test)" \ |
| 280 | "$P_SRV debug_level=3" \ |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 281 | "$O_CLI -cipher 'DES-CBC-MD5:ALL'" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 282 | 0 \ |
| 283 | -s "parse client hello v2" \ |
| 284 | -S "ssl_handshake returned" |
| 285 | |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 286 | # Tests for Truncated HMAC extension |
| 287 | |
| 288 | run_test "Truncated HMAC #0" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 289 | "$P_SRV debug_level=5" \ |
| 290 | "$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] | 291 | 0 \ |
| 292 | -s "dumping 'computed mac' (20 bytes)" |
| 293 | |
| 294 | run_test "Truncated HMAC #1" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 295 | "$P_SRV debug_level=5" \ |
| 296 | "$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] | 297 | 0 \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 298 | -s "dumping 'computed mac' (10 bytes)" |
| 299 | |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 300 | # Tests for Session Tickets |
| 301 | |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 302 | run_test "Session resume using tickets #1 (basic)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 303 | "$P_SRV debug_level=4 tickets=1" \ |
| 304 | "$P_CLI debug_level=4 tickets=1 reconnect=1" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 305 | 0 \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 306 | -c "client hello, adding session ticket extension" \ |
| 307 | -s "found session ticket extension" \ |
| 308 | -s "server hello, adding session ticket extension" \ |
| 309 | -c "found session_ticket extension" \ |
| 310 | -c "parse new session ticket" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 311 | -S "session successfully restored from cache" \ |
| 312 | -s "session successfully restored from ticket" \ |
| 313 | -s "a session has been resumed" \ |
| 314 | -c "a session has been resumed" |
| 315 | |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 316 | run_test "Session resume using tickets #2 (cache disabled)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 317 | "$P_SRV debug_level=4 tickets=1 cache_max=0" \ |
| 318 | "$P_CLI debug_level=4 tickets=1 reconnect=1" \ |
Manuel Pégourié-Gonnard | dbe1ee1 | 2014-02-21 09:18:13 +0100 | [diff] [blame] | 319 | 0 \ |
| 320 | -c "client hello, adding session ticket extension" \ |
| 321 | -s "found session ticket extension" \ |
| 322 | -s "server hello, adding session ticket extension" \ |
| 323 | -c "found session_ticket extension" \ |
| 324 | -c "parse new session ticket" \ |
| 325 | -S "session successfully restored from cache" \ |
| 326 | -s "session successfully restored from ticket" \ |
| 327 | -s "a session has been resumed" \ |
| 328 | -c "a session has been resumed" |
| 329 | |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 330 | run_test "Session resume using tickets #3 (timeout)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 331 | "$P_SRV debug_level=4 tickets=1 cache_max=0 ticket_timeout=1" \ |
| 332 | "$P_CLI debug_level=4 tickets=1 reconnect=1 reco_delay=2" \ |
Manuel Pégourié-Gonnard | dbe1ee1 | 2014-02-21 09:18:13 +0100 | [diff] [blame] | 333 | 0 \ |
| 334 | -c "client hello, adding session ticket extension" \ |
| 335 | -s "found session ticket extension" \ |
| 336 | -s "server hello, adding session ticket extension" \ |
| 337 | -c "found session_ticket extension" \ |
| 338 | -c "parse new session ticket" \ |
| 339 | -S "session successfully restored from cache" \ |
| 340 | -S "session successfully restored from ticket" \ |
| 341 | -S "a session has been resumed" \ |
| 342 | -C "a session has been resumed" |
| 343 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 344 | run_test "Session resume using tickets #4 (openssl server)" \ |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 345 | "$O_SRV" \ |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 346 | "$P_CLI debug_level=4 tickets=1 reconnect=1" \ |
| 347 | 0 \ |
| 348 | -c "client hello, adding session ticket extension" \ |
| 349 | -c "found session_ticket extension" \ |
| 350 | -c "parse new session ticket" \ |
| 351 | -c "a session has been resumed" |
| 352 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 353 | run_test "Session resume using tickets #5 (openssl client)" \ |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 354 | "$P_SRV debug_level=4 tickets=1" \ |
| 355 | "($O_CLI -sess_out sess; $O_CLI -sess_in sess; rm -f sess)" \ |
| 356 | 0 \ |
| 357 | -s "found session ticket extension" \ |
| 358 | -s "server hello, adding session ticket extension" \ |
| 359 | -S "session successfully restored from cache" \ |
| 360 | -s "session successfully restored from ticket" \ |
| 361 | -s "a session has been resumed" |
| 362 | |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 363 | # Tests for Session Resume based on session-ID and cache |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 364 | |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 365 | run_test "Session resume using cache #1 (tickets enabled on client)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 366 | "$P_SRV debug_level=4 tickets=0" \ |
| 367 | "$P_CLI debug_level=4 tickets=1 reconnect=1" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 368 | 0 \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 369 | -c "client hello, adding session ticket extension" \ |
| 370 | -s "found session ticket extension" \ |
| 371 | -S "server hello, adding session ticket extension" \ |
| 372 | -C "found session_ticket extension" \ |
| 373 | -C "parse new session ticket" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 374 | -s "session successfully restored from cache" \ |
| 375 | -S "session successfully restored from ticket" \ |
| 376 | -s "a session has been resumed" \ |
| 377 | -c "a session has been resumed" |
| 378 | |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 379 | run_test "Session resume using cache #2 (tickets enabled on server)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 380 | "$P_SRV debug_level=4 tickets=1" \ |
| 381 | "$P_CLI debug_level=4 tickets=0 reconnect=1" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 382 | 0 \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 383 | -C "client hello, adding session ticket extension" \ |
| 384 | -S "found session ticket extension" \ |
| 385 | -S "server hello, adding session ticket extension" \ |
| 386 | -C "found session_ticket extension" \ |
| 387 | -C "parse new session ticket" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 388 | -s "session successfully restored from cache" \ |
| 389 | -S "session successfully restored from ticket" \ |
| 390 | -s "a session has been resumed" \ |
| 391 | -c "a session has been resumed" |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 392 | |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 393 | run_test "Session resume using cache #3 (cache_max=0)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 394 | "$P_SRV debug_level=4 tickets=0 cache_max=0" \ |
| 395 | "$P_CLI debug_level=4 tickets=0 reconnect=1" \ |
Manuel Pégourié-Gonnard | 4c88345 | 2014-02-20 21:32:41 +0100 | [diff] [blame] | 396 | 0 \ |
| 397 | -S "session successfully restored from cache" \ |
| 398 | -S "session successfully restored from ticket" \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 399 | -S "a session has been resumed" \ |
| 400 | -C "a session has been resumed" |
Manuel Pégourié-Gonnard | 4c88345 | 2014-02-20 21:32:41 +0100 | [diff] [blame] | 401 | |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 402 | run_test "Session resume using cache #4 (cache_max=1)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 403 | "$P_SRV debug_level=4 tickets=0 cache_max=1" \ |
| 404 | "$P_CLI debug_level=4 tickets=0 reconnect=1" \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 405 | 0 \ |
| 406 | -s "session successfully restored from cache" \ |
| 407 | -S "session successfully restored from ticket" \ |
| 408 | -s "a session has been resumed" \ |
| 409 | -c "a session has been resumed" |
| 410 | |
| 411 | run_test "Session resume using cache #5 (timemout > delay)" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 412 | "$P_SRV debug_level=4 tickets=0" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 413 | "$P_CLI debug_level=4 tickets=0 reconnect=1 reco_delay=0" \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 414 | 0 \ |
| 415 | -s "session successfully restored from cache" \ |
| 416 | -S "session successfully restored from ticket" \ |
| 417 | -s "a session has been resumed" \ |
| 418 | -c "a session has been resumed" |
| 419 | |
| 420 | run_test "Session resume using cache #6 (timeout < delay)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 421 | "$P_SRV debug_level=4 tickets=0 cache_timeout=1" \ |
| 422 | "$P_CLI debug_level=4 tickets=0 reconnect=1 reco_delay=2" \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 423 | 0 \ |
| 424 | -S "session successfully restored from cache" \ |
| 425 | -S "session successfully restored from ticket" \ |
| 426 | -S "a session has been resumed" \ |
| 427 | -C "a session has been resumed" |
| 428 | |
| 429 | run_test "Session resume using cache #7 (no timeout)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 430 | "$P_SRV debug_level=4 tickets=0 cache_timeout=0" \ |
| 431 | "$P_CLI debug_level=4 tickets=0 reconnect=1 reco_delay=2" \ |
Manuel Pégourié-Gonnard | 4c88345 | 2014-02-20 21:32:41 +0100 | [diff] [blame] | 432 | 0 \ |
| 433 | -s "session successfully restored from cache" \ |
| 434 | -S "session successfully restored from ticket" \ |
| 435 | -s "a session has been resumed" \ |
| 436 | -c "a session has been resumed" |
| 437 | |
Manuel Pégourié-Gonnard | db735f6 | 2014-02-25 17:57:59 +0100 | [diff] [blame] | 438 | run_test "Session resume using cache #8 (openssl client)" \ |
| 439 | "$P_SRV debug_level=4 tickets=0" \ |
| 440 | "($O_CLI -sess_out sess; $O_CLI -sess_in sess; rm -f sess)" \ |
| 441 | 0 \ |
| 442 | -s "found session ticket extension" \ |
| 443 | -S "server hello, adding session ticket extension" \ |
| 444 | -s "session successfully restored from cache" \ |
| 445 | -S "session successfully restored from ticket" \ |
| 446 | -s "a session has been resumed" |
| 447 | |
| 448 | run_test "Session resume using cache #9 (openssl server)" \ |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 449 | "$O_SRV" \ |
Manuel Pégourié-Gonnard | db735f6 | 2014-02-25 17:57:59 +0100 | [diff] [blame] | 450 | "$P_CLI debug_level=4 tickets=0 reconnect=1" \ |
| 451 | 0 \ |
| 452 | -C "found session_ticket extension" \ |
| 453 | -C "parse new session ticket" \ |
| 454 | -c "a session has been resumed" |
| 455 | |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 456 | # Tests for Max Fragment Length extension |
| 457 | |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 458 | run_test "Max fragment length #1" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 459 | "$P_SRV debug_level=4" \ |
| 460 | "$P_CLI debug_level=4" \ |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 461 | 0 \ |
| 462 | -C "client hello, adding max_fragment_length extension" \ |
| 463 | -S "found max fragment length extension" \ |
| 464 | -S "server hello, max_fragment_length extension" \ |
| 465 | -C "found max_fragment_length extension" |
| 466 | |
| 467 | run_test "Max fragment length #2" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 468 | "$P_SRV debug_level=4" \ |
| 469 | "$P_CLI debug_level=4 max_frag_len=4096" \ |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 470 | 0 \ |
| 471 | -c "client hello, adding max_fragment_length extension" \ |
| 472 | -s "found max fragment length extension" \ |
| 473 | -s "server hello, max_fragment_length extension" \ |
| 474 | -c "found max_fragment_length extension" |
| 475 | |
| 476 | run_test "Max fragment length #3" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 477 | "$P_SRV debug_level=4 max_frag_len=4096" \ |
| 478 | "$P_CLI debug_level=4" \ |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 479 | 0 \ |
| 480 | -C "client hello, adding max_fragment_length extension" \ |
| 481 | -S "found max fragment length extension" \ |
| 482 | -S "server hello, max_fragment_length extension" \ |
| 483 | -C "found max_fragment_length extension" |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 484 | |
| 485 | # Tests for renegotiation |
| 486 | |
| 487 | run_test "Renegotiation #0 (none)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 488 | "$P_SRV debug_level=4" \ |
| 489 | "$P_CLI debug_level=4" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 490 | 0 \ |
| 491 | -C "client hello, adding renegotiation extension" \ |
| 492 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 493 | -S "found renegotiation extension" \ |
| 494 | -s "server hello, secure renegotiation extension" \ |
| 495 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 496 | -C "=> renegotiate" \ |
| 497 | -S "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 498 | -S "write hello request" |
| 499 | |
| 500 | run_test "Renegotiation #1 (enabled, client-initiated)" \ |
Manuel Pégourié-Gonnard | 00d538f | 2014-03-31 10:44:40 +0200 | [diff] [blame] | 501 | "$P_SRV debug_level=4 renegotiation=1" \ |
| 502 | "$P_CLI debug_level=4 renegotiation=1 renegotiate=1" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 503 | 0 \ |
| 504 | -c "client hello, adding renegotiation extension" \ |
| 505 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 506 | -s "found renegotiation extension" \ |
| 507 | -s "server hello, secure renegotiation extension" \ |
| 508 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 509 | -c "=> renegotiate" \ |
| 510 | -s "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 511 | -S "write hello request" |
| 512 | |
| 513 | run_test "Renegotiation #2 (enabled, server-initiated)" \ |
Manuel Pégourié-Gonnard | 00d538f | 2014-03-31 10:44:40 +0200 | [diff] [blame] | 514 | "$P_SRV debug_level=4 renegotiation=1 renegotiate=1" \ |
| 515 | "$P_CLI debug_level=4 renegotiation=1" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 516 | 0 \ |
| 517 | -c "client hello, adding renegotiation extension" \ |
| 518 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 519 | -s "found renegotiation extension" \ |
| 520 | -s "server hello, secure renegotiation extension" \ |
| 521 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 522 | -c "=> renegotiate" \ |
| 523 | -s "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 524 | -s "write hello request" |
| 525 | |
| 526 | run_test "Renegotiation #3 (enabled, double)" \ |
Manuel Pégourié-Gonnard | 00d538f | 2014-03-31 10:44:40 +0200 | [diff] [blame] | 527 | "$P_SRV debug_level=4 renegotiation=1 renegotiate=1" \ |
| 528 | "$P_CLI debug_level=4 renegotiation=1 renegotiate=1" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 529 | 0 \ |
| 530 | -c "client hello, adding renegotiation extension" \ |
| 531 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 532 | -s "found renegotiation extension" \ |
| 533 | -s "server hello, secure renegotiation extension" \ |
| 534 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 535 | -c "=> renegotiate" \ |
| 536 | -s "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 537 | -s "write hello request" |
| 538 | |
| 539 | run_test "Renegotiation #4 (client-initiated, server-rejected)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 540 | "$P_SRV debug_level=4 renegotiation=0" \ |
Manuel Pégourié-Gonnard | 00d538f | 2014-03-31 10:44:40 +0200 | [diff] [blame] | 541 | "$P_CLI debug_level=4 renegotiation=1 renegotiate=1" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 542 | 1 \ |
| 543 | -c "client hello, adding renegotiation extension" \ |
| 544 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 545 | -S "found renegotiation extension" \ |
| 546 | -s "server hello, secure renegotiation extension" \ |
| 547 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 548 | -c "=> renegotiate" \ |
| 549 | -S "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 550 | -S "write hello request" |
| 551 | |
| 552 | run_test "Renegotiation #5 (server-initiated, client-rejected)" \ |
Manuel Pégourié-Gonnard | 00d538f | 2014-03-31 10:44:40 +0200 | [diff] [blame] | 553 | "$P_SRV debug_level=4 renegotiation=1 renegotiate=1" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 554 | "$P_CLI debug_level=4 renegotiation=0" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 555 | 0 \ |
| 556 | -C "client hello, adding renegotiation extension" \ |
| 557 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 558 | -S "found renegotiation extension" \ |
| 559 | -s "server hello, secure renegotiation extension" \ |
| 560 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 561 | -C "=> renegotiate" \ |
| 562 | -S "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 563 | -s "write hello request" \ |
| 564 | -s "SSL - An unexpected message was received from our peer" \ |
| 565 | -s "failed" |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 566 | |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 567 | # Tests for auth_mode |
| 568 | |
| 569 | run_test "Authentication #1 (server badcert, client required)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 570 | "$P_SRV crt_file=data_files/server5-badsign.crt \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 571 | key_file=data_files/server5.key" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 572 | "$P_CLI debug_level=2 auth_mode=required" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 573 | 1 \ |
| 574 | -c "x509_verify_cert() returned" \ |
| 575 | -c "! self-signed or not signed by a trusted CA" \ |
| 576 | -c "! ssl_handshake returned" \ |
| 577 | -c "X509 - Certificate verification failed" |
| 578 | |
| 579 | run_test "Authentication #2 (server badcert, client optional)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 580 | "$P_SRV crt_file=data_files/server5-badsign.crt \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 581 | key_file=data_files/server5.key" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 582 | "$P_CLI debug_level=2 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 583 | 0 \ |
| 584 | -c "x509_verify_cert() returned" \ |
| 585 | -c "! self-signed or not signed by a trusted CA" \ |
| 586 | -C "! ssl_handshake returned" \ |
| 587 | -C "X509 - Certificate verification failed" |
| 588 | |
| 589 | run_test "Authentication #3 (server badcert, client none)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 590 | "$P_SRV crt_file=data_files/server5-badsign.crt \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 591 | key_file=data_files/server5.key" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 592 | "$P_CLI debug_level=2 auth_mode=none" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 593 | 0 \ |
| 594 | -C "x509_verify_cert() returned" \ |
| 595 | -C "! self-signed or not signed by a trusted CA" \ |
| 596 | -C "! ssl_handshake returned" \ |
| 597 | -C "X509 - Certificate verification failed" |
| 598 | |
| 599 | run_test "Authentication #4 (client badcert, server required)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 600 | "$P_SRV debug_level=4 auth_mode=required" \ |
| 601 | "$P_CLI debug_level=4 crt_file=data_files/server5-badsign.crt \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 602 | key_file=data_files/server5.key" \ |
| 603 | 1 \ |
| 604 | -S "skip write certificate request" \ |
| 605 | -C "skip parse certificate request" \ |
| 606 | -c "got a certificate request" \ |
| 607 | -C "skip write certificate" \ |
| 608 | -C "skip write certificate verify" \ |
| 609 | -S "skip parse certificate verify" \ |
| 610 | -s "x509_verify_cert() returned" \ |
| 611 | -S "! self-signed or not signed by a trusted CA" \ |
| 612 | -s "! ssl_handshake returned" \ |
| 613 | -c "! ssl_handshake returned" \ |
| 614 | -s "X509 - Certificate verification failed" |
| 615 | |
| 616 | run_test "Authentication #5 (client badcert, server optional)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 617 | "$P_SRV debug_level=4 auth_mode=optional" \ |
| 618 | "$P_CLI debug_level=4 crt_file=data_files/server5-badsign.crt \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 619 | key_file=data_files/server5.key" \ |
| 620 | 0 \ |
| 621 | -S "skip write certificate request" \ |
| 622 | -C "skip parse certificate request" \ |
| 623 | -c "got a certificate request" \ |
| 624 | -C "skip write certificate" \ |
| 625 | -C "skip write certificate verify" \ |
| 626 | -S "skip parse certificate verify" \ |
| 627 | -s "x509_verify_cert() returned" \ |
| 628 | -s "! self-signed or not signed by a trusted CA" \ |
| 629 | -S "! ssl_handshake returned" \ |
| 630 | -C "! ssl_handshake returned" \ |
| 631 | -S "X509 - Certificate verification failed" |
| 632 | |
| 633 | run_test "Authentication #6 (client badcert, server none)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 634 | "$P_SRV debug_level=4 auth_mode=none" \ |
| 635 | "$P_CLI debug_level=4 crt_file=data_files/server5-badsign.crt \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 636 | key_file=data_files/server5.key" \ |
| 637 | 0 \ |
| 638 | -s "skip write certificate request" \ |
| 639 | -C "skip parse certificate request" \ |
| 640 | -c "got no certificate request" \ |
| 641 | -c "skip write certificate" \ |
| 642 | -c "skip write certificate verify" \ |
| 643 | -s "skip parse certificate verify" \ |
| 644 | -S "x509_verify_cert() returned" \ |
| 645 | -S "! self-signed or not signed by a trusted CA" \ |
| 646 | -S "! ssl_handshake returned" \ |
| 647 | -C "! ssl_handshake returned" \ |
| 648 | -S "X509 - Certificate verification failed" |
| 649 | |
Manuel Pégourié-Gonnard | de515cc | 2014-02-27 14:58:26 +0100 | [diff] [blame] | 650 | run_test "Authentication #7 (client no cert, server optional)" \ |
| 651 | "$P_SRV debug_level=4 auth_mode=optional" \ |
| 652 | "$P_CLI debug_level=4 crt_file=none key_file=none" \ |
| 653 | 0 \ |
| 654 | -S "skip write certificate request" \ |
| 655 | -C "skip parse certificate request" \ |
| 656 | -c "got a certificate request" \ |
| 657 | -C "skip write certificate$" \ |
| 658 | -C "got no certificate to send" \ |
| 659 | -S "SSLv3 client has no certificate" \ |
| 660 | -c "skip write certificate verify" \ |
| 661 | -s "skip parse certificate verify" \ |
| 662 | -s "! no client certificate sent" \ |
| 663 | -S "! ssl_handshake returned" \ |
| 664 | -C "! ssl_handshake returned" \ |
| 665 | -S "X509 - Certificate verification failed" |
| 666 | |
| 667 | run_test "Authentication #8 (openssl client no cert, server optional)" \ |
| 668 | "$P_SRV debug_level=4 auth_mode=optional" \ |
| 669 | "$O_CLI" \ |
| 670 | 0 \ |
| 671 | -S "skip write certificate request" \ |
| 672 | -s "skip parse certificate verify" \ |
| 673 | -s "! no client certificate sent" \ |
| 674 | -S "! ssl_handshake returned" \ |
| 675 | -S "X509 - Certificate verification failed" |
| 676 | |
| 677 | run_test "Authentication #9 (client no cert, openssl server optional)" \ |
| 678 | "$O_SRV -verify 10" \ |
| 679 | "$P_CLI debug_level=4 crt_file=none key_file=none" \ |
| 680 | 0 \ |
| 681 | -C "skip parse certificate request" \ |
| 682 | -c "got a certificate request" \ |
| 683 | -C "skip write certificate$" \ |
| 684 | -c "skip write certificate verify" \ |
| 685 | -C "! ssl_handshake returned" |
| 686 | |
| 687 | run_test "Authentication #10 (client no cert, ssl3)" \ |
| 688 | "$P_SRV debug_level=4 auth_mode=optional force_version=ssl3" \ |
| 689 | "$P_CLI debug_level=4 crt_file=none key_file=none" \ |
| 690 | 0 \ |
| 691 | -S "skip write certificate request" \ |
| 692 | -C "skip parse certificate request" \ |
| 693 | -c "got a certificate request" \ |
| 694 | -C "skip write certificate$" \ |
| 695 | -c "skip write certificate verify" \ |
| 696 | -c "got no certificate to send" \ |
| 697 | -s "SSLv3 client has no certificate" \ |
| 698 | -s "skip parse certificate verify" \ |
| 699 | -s "! no client certificate sent" \ |
| 700 | -S "! ssl_handshake returned" \ |
| 701 | -C "! ssl_handshake returned" \ |
| 702 | -S "X509 - Certificate verification failed" |
| 703 | |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 704 | # tests for SNI |
| 705 | |
| 706 | run_test "SNI #0 (no SNI callback)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 707 | "$P_SRV debug_level=4 server_addr=127.0.0.1 \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 708 | crt_file=data_files/server5.crt key_file=data_files/server5.key" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 709 | "$P_CLI debug_level=0 server_addr=127.0.0.1 \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 710 | server_name=localhost" \ |
| 711 | 0 \ |
| 712 | -S "parse ServerName extension" \ |
| 713 | -c "issuer name *: C=NL, O=PolarSSL, CN=Polarssl Test EC CA" \ |
| 714 | -c "subject name *: C=NL, O=PolarSSL, CN=localhost" |
| 715 | |
| 716 | run_test "SNI #1 (matching cert 1)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 717 | "$P_SRV debug_level=4 server_addr=127.0.0.1 \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 718 | 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] | 719 | 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 | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 720 | "$P_CLI debug_level=0 server_addr=127.0.0.1 \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 721 | server_name=localhost" \ |
| 722 | 0 \ |
| 723 | -s "parse ServerName extension" \ |
| 724 | -c "issuer name *: C=NL, O=PolarSSL, CN=PolarSSL Test CA" \ |
| 725 | -c "subject name *: C=NL, O=PolarSSL, CN=localhost" |
| 726 | |
| 727 | run_test "SNI #2 (matching cert 2)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 728 | "$P_SRV debug_level=4 server_addr=127.0.0.1 \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 729 | 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] | 730 | 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 | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 731 | "$P_CLI debug_level=0 server_addr=127.0.0.1 \ |
Manuel Pégourié-Gonnard | 76b8ab7 | 2014-03-26 09:31:35 +0100 | [diff] [blame] | 732 | server_name=polarssl.example" \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 733 | 0 \ |
| 734 | -s "parse ServerName extension" \ |
| 735 | -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] | 736 | -c "subject name *: C=NL, O=PolarSSL, CN=polarssl.example" |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 737 | |
| 738 | run_test "SNI #3 (no matching cert)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 739 | "$P_SRV debug_level=4 server_addr=127.0.0.1 \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 740 | 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] | 741 | 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 | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 742 | "$P_CLI debug_level=0 server_addr=127.0.0.1 \ |
Manuel Pégourié-Gonnard | 76b8ab7 | 2014-03-26 09:31:35 +0100 | [diff] [blame] | 743 | server_name=nonesuch.example" \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 744 | 1 \ |
| 745 | -s "parse ServerName extension" \ |
| 746 | -s "ssl_sni_wrapper() returned" \ |
| 747 | -s "ssl_handshake returned" \ |
| 748 | -c "ssl_handshake returned" \ |
| 749 | -c "SSL - A fatal alert message was received from our peer" |
| 750 | |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 751 | # Tests for non-blocking I/O: exercise a variety of handshake flows |
| 752 | |
| 753 | run_test "Non-blocking I/O #1 (basic handshake)" \ |
| 754 | "$P_SRV nbio=2 tickets=0 auth_mode=none" \ |
| 755 | "$P_CLI nbio=2 tickets=0" \ |
| 756 | 0 \ |
| 757 | -S "ssl_handshake returned" \ |
| 758 | -C "ssl_handshake returned" \ |
| 759 | -c "Read from server: .* bytes read" |
| 760 | |
| 761 | run_test "Non-blocking I/O #2 (client auth)" \ |
| 762 | "$P_SRV nbio=2 tickets=0 auth_mode=required" \ |
| 763 | "$P_CLI nbio=2 tickets=0" \ |
| 764 | 0 \ |
| 765 | -S "ssl_handshake returned" \ |
| 766 | -C "ssl_handshake returned" \ |
| 767 | -c "Read from server: .* bytes read" |
| 768 | |
| 769 | run_test "Non-blocking I/O #3 (ticket)" \ |
| 770 | "$P_SRV nbio=2 tickets=1 auth_mode=none" \ |
| 771 | "$P_CLI nbio=2 tickets=1" \ |
| 772 | 0 \ |
| 773 | -S "ssl_handshake returned" \ |
| 774 | -C "ssl_handshake returned" \ |
| 775 | -c "Read from server: .* bytes read" |
| 776 | |
| 777 | run_test "Non-blocking I/O #4 (ticket + client auth)" \ |
| 778 | "$P_SRV nbio=2 tickets=1 auth_mode=required" \ |
| 779 | "$P_CLI nbio=2 tickets=1" \ |
| 780 | 0 \ |
| 781 | -S "ssl_handshake returned" \ |
| 782 | -C "ssl_handshake returned" \ |
| 783 | -c "Read from server: .* bytes read" |
| 784 | |
| 785 | run_test "Non-blocking I/O #5 (ticket + client auth + resume)" \ |
| 786 | "$P_SRV nbio=2 tickets=1 auth_mode=required" \ |
| 787 | "$P_CLI nbio=2 tickets=1 reconnect=1" \ |
| 788 | 0 \ |
| 789 | -S "ssl_handshake returned" \ |
| 790 | -C "ssl_handshake returned" \ |
| 791 | -c "Read from server: .* bytes read" |
| 792 | |
| 793 | run_test "Non-blocking I/O #6 (ticket + resume)" \ |
| 794 | "$P_SRV nbio=2 tickets=1 auth_mode=none" \ |
| 795 | "$P_CLI nbio=2 tickets=1 reconnect=1" \ |
| 796 | 0 \ |
| 797 | -S "ssl_handshake returned" \ |
| 798 | -C "ssl_handshake returned" \ |
| 799 | -c "Read from server: .* bytes read" |
| 800 | |
| 801 | run_test "Non-blocking I/O #7 (session-id resume)" \ |
| 802 | "$P_SRV nbio=2 tickets=0 auth_mode=none" \ |
| 803 | "$P_CLI nbio=2 tickets=0 reconnect=1" \ |
| 804 | 0 \ |
| 805 | -S "ssl_handshake returned" \ |
| 806 | -C "ssl_handshake returned" \ |
| 807 | -c "Read from server: .* bytes read" |
| 808 | |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 809 | # Tests for version negotiation |
| 810 | |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 811 | run_test "Version check #1 (all -> 1.2)" \ |
| 812 | "$P_SRV" \ |
| 813 | "$P_CLI" \ |
| 814 | 0 \ |
| 815 | -S "ssl_handshake returned" \ |
| 816 | -C "ssl_handshake returned" \ |
| 817 | -s "Protocol is TLSv1.2" \ |
| 818 | -c "Protocol is TLSv1.2" |
| 819 | |
| 820 | run_test "Version check #2 (cli max 1.1 -> 1.1)" \ |
| 821 | "$P_SRV" \ |
| 822 | "$P_CLI max_version=tls1_1" \ |
| 823 | 0 \ |
| 824 | -S "ssl_handshake returned" \ |
| 825 | -C "ssl_handshake returned" \ |
| 826 | -s "Protocol is TLSv1.1" \ |
| 827 | -c "Protocol is TLSv1.1" |
| 828 | |
| 829 | run_test "Version check #3 (srv max 1.1 -> 1.1)" \ |
| 830 | "$P_SRV max_version=tls1_1" \ |
| 831 | "$P_CLI" \ |
| 832 | 0 \ |
| 833 | -S "ssl_handshake returned" \ |
| 834 | -C "ssl_handshake returned" \ |
| 835 | -s "Protocol is TLSv1.1" \ |
| 836 | -c "Protocol is TLSv1.1" |
| 837 | |
| 838 | run_test "Version check #4 (cli+srv max 1.1 -> 1.1)" \ |
| 839 | "$P_SRV max_version=tls1_1" \ |
| 840 | "$P_CLI max_version=tls1_1" \ |
| 841 | 0 \ |
| 842 | -S "ssl_handshake returned" \ |
| 843 | -C "ssl_handshake returned" \ |
| 844 | -s "Protocol is TLSv1.1" \ |
| 845 | -c "Protocol is TLSv1.1" |
| 846 | |
| 847 | run_test "Version check #5 (cli max 1.1, srv min 1.1 -> 1.1)" \ |
| 848 | "$P_SRV min_version=tls1_1" \ |
| 849 | "$P_CLI max_version=tls1_1" \ |
| 850 | 0 \ |
| 851 | -S "ssl_handshake returned" \ |
| 852 | -C "ssl_handshake returned" \ |
| 853 | -s "Protocol is TLSv1.1" \ |
| 854 | -c "Protocol is TLSv1.1" |
| 855 | |
| 856 | run_test "Version check #6 (cli min 1.1, srv max 1.1 -> 1.1)" \ |
| 857 | "$P_SRV max_version=tls1_1" \ |
| 858 | "$P_CLI min_version=tls1_1" \ |
| 859 | 0 \ |
| 860 | -S "ssl_handshake returned" \ |
| 861 | -C "ssl_handshake returned" \ |
| 862 | -s "Protocol is TLSv1.1" \ |
| 863 | -c "Protocol is TLSv1.1" |
| 864 | |
| 865 | run_test "Version check #7 (cli min 1.2, srv max 1.1 -> fail)" \ |
| 866 | "$P_SRV max_version=tls1_1" \ |
| 867 | "$P_CLI min_version=tls1_2" \ |
| 868 | 1 \ |
| 869 | -s "ssl_handshake returned" \ |
| 870 | -c "ssl_handshake returned" \ |
| 871 | -c "SSL - Handshake protocol not within min/max boundaries" |
| 872 | |
| 873 | run_test "Version check #8 (srv min 1.2, cli max 1.1 -> fail)" \ |
| 874 | "$P_SRV min_version=tls1_2" \ |
| 875 | "$P_CLI max_version=tls1_1" \ |
| 876 | 1 \ |
| 877 | -s "ssl_handshake returned" \ |
| 878 | -c "ssl_handshake returned" \ |
| 879 | -s "SSL - Handshake protocol not within min/max boundaries" |
| 880 | |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 881 | # Tests for ALPN extension |
| 882 | |
Manuel Pégourié-Gonnard | 83d8c73 | 2014-04-07 13:24:21 +0200 | [diff] [blame^] | 883 | if grep '^#define POLARSSL_SSL_ALPN' $CONFIG_H >/dev/null; then |
| 884 | |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 885 | run_test "ALPN #0 (none)" \ |
| 886 | "$P_SRV debug_level=4" \ |
| 887 | "$P_CLI debug_level=4" \ |
| 888 | 0 \ |
| 889 | -C "client hello, adding alpn extension" \ |
| 890 | -S "found alpn extension" \ |
| 891 | -C "got an alert message, type: \\[2:120]" \ |
| 892 | -S "server hello, adding alpn extension" \ |
| 893 | -C "found alpn extension " \ |
| 894 | -C "Application Layer Protocol is" \ |
| 895 | -S "Application Layer Protocol is" |
| 896 | |
| 897 | run_test "ALPN #1 (client only)" \ |
| 898 | "$P_SRV debug_level=4" \ |
| 899 | "$P_CLI debug_level=4 alpn=abc,1234" \ |
| 900 | 0 \ |
| 901 | -c "client hello, adding alpn extension" \ |
| 902 | -s "found alpn extension" \ |
| 903 | -C "got an alert message, type: \\[2:120]" \ |
| 904 | -S "server hello, adding alpn extension" \ |
| 905 | -C "found alpn extension " \ |
| 906 | -c "Application Layer Protocol is (none)" \ |
| 907 | -S "Application Layer Protocol is" |
| 908 | |
| 909 | run_test "ALPN #2 (server only)" \ |
| 910 | "$P_SRV debug_level=4 alpn=abc,1234" \ |
| 911 | "$P_CLI debug_level=4" \ |
| 912 | 0 \ |
| 913 | -C "client hello, adding alpn extension" \ |
| 914 | -S "found alpn extension" \ |
| 915 | -C "got an alert message, type: \\[2:120]" \ |
| 916 | -S "server hello, adding alpn extension" \ |
| 917 | -C "found alpn extension " \ |
| 918 | -C "Application Layer Protocol is" \ |
| 919 | -s "Application Layer Protocol is (none)" |
| 920 | |
| 921 | run_test "ALPN #3 (both, common cli1-srv1)" \ |
| 922 | "$P_SRV debug_level=4 alpn=abc,1234" \ |
| 923 | "$P_CLI debug_level=4 alpn=abc,1234" \ |
| 924 | 0 \ |
| 925 | -c "client hello, adding alpn extension" \ |
| 926 | -s "found alpn extension" \ |
| 927 | -C "got an alert message, type: \\[2:120]" \ |
| 928 | -s "server hello, adding alpn extension" \ |
| 929 | -c "found alpn extension" \ |
| 930 | -c "Application Layer Protocol is abc" \ |
| 931 | -s "Application Layer Protocol is abc" |
| 932 | |
| 933 | run_test "ALPN #4 (both, common cli2-srv1)" \ |
| 934 | "$P_SRV debug_level=4 alpn=abc,1234" \ |
| 935 | "$P_CLI debug_level=4 alpn=1234,abc" \ |
| 936 | 0 \ |
| 937 | -c "client hello, adding alpn extension" \ |
| 938 | -s "found alpn extension" \ |
| 939 | -C "got an alert message, type: \\[2:120]" \ |
| 940 | -s "server hello, adding alpn extension" \ |
| 941 | -c "found alpn extension" \ |
| 942 | -c "Application Layer Protocol is abc" \ |
| 943 | -s "Application Layer Protocol is abc" |
| 944 | |
| 945 | run_test "ALPN #5 (both, common cli1-srv2)" \ |
| 946 | "$P_SRV debug_level=4 alpn=abc,1234" \ |
| 947 | "$P_CLI debug_level=4 alpn=1234,abcde" \ |
| 948 | 0 \ |
| 949 | -c "client hello, adding alpn extension" \ |
| 950 | -s "found alpn extension" \ |
| 951 | -C "got an alert message, type: \\[2:120]" \ |
| 952 | -s "server hello, adding alpn extension" \ |
| 953 | -c "found alpn extension" \ |
| 954 | -c "Application Layer Protocol is 1234" \ |
| 955 | -s "Application Layer Protocol is 1234" |
| 956 | |
| 957 | run_test "ALPN #6 (both, no common)" \ |
| 958 | "$P_SRV debug_level=4 alpn=abc,123" \ |
| 959 | "$P_CLI debug_level=4 alpn=1234,abcde" \ |
| 960 | 1 \ |
| 961 | -c "client hello, adding alpn extension" \ |
| 962 | -s "found alpn extension" \ |
| 963 | -c "got an alert message, type: \\[2:120]" \ |
| 964 | -S "server hello, adding alpn extension" \ |
| 965 | -C "found alpn extension" \ |
| 966 | -C "Application Layer Protocol is 1234" \ |
| 967 | -S "Application Layer Protocol is 1234" |
| 968 | |
Manuel Pégourié-Gonnard | 83d8c73 | 2014-04-07 13:24:21 +0200 | [diff] [blame^] | 969 | fi |
| 970 | |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 971 | # Final report |
| 972 | |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 973 | echo "------------------------------------------------------------------------" |
| 974 | |
| 975 | if [ $FAILS = 0 ]; then |
| 976 | echo -n "PASSED" |
| 977 | else |
| 978 | echo -n "FAILED" |
| 979 | fi |
| 980 | PASSES=`echo $TESTS - $FAILS | bc` |
Manuel Pégourié-Gonnard | 4145b89 | 2014-02-24 13:20:14 +0100 | [diff] [blame] | 981 | echo " ($PASSES / $TESTS tests)" |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 982 | |
| 983 | exit $FAILS |