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