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 | *) |
Paul Bakker | 1ebc0c5 | 2014-05-22 15:47:58 +0200 | [diff] [blame] | 67 | echo "Unknown argument: '$1'" |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 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 | |
Paul Bakker | 1ebc0c5 | 2014-05-22 15:47:58 +0200 | [diff] [blame] | 154 | # psk is useful when server only has bad certs |
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 | 8066b81 | 2014-05-28 22:59:30 +0200 | [diff] [blame^] | 156 | $P_CLI request_page=SERVERQUIT tickets=0 auth_mode=none psk=abc123 \ |
Manuel Pégourié-Gonnard | 84fd687 | 2014-03-13 18:35:10 +0100 | [diff] [blame] | 157 | crt_file=data_files/cli2.crt key_file=data_files/cli2.key \ |
| 158 | >/dev/null |
Manuel Pégourié-Gonnard | 677884d | 2014-02-25 16:42:31 +0100 | [diff] [blame] | 159 | else |
| 160 | kill $SRV_PID |
| 161 | fi |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 162 | wait $SRV_PID |
Manuel Pégourié-Gonnard | 677884d | 2014-02-25 16:42:31 +0100 | [diff] [blame] | 163 | |
| 164 | # check if the client and server went at least to the handshake stage |
Paul Bakker | 1ebc0c5 | 2014-05-22 15:47:58 +0200 | [diff] [blame] | 165 | # (useful to avoid tests with only negative assertions and non-zero |
Manuel Pégourié-Gonnard | 677884d | 2014-02-25 16:42:31 +0100 | [diff] [blame] | 166 | # expected client exit to incorrectly succeed in case of catastrophic |
| 167 | # failure) |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 168 | if is_polar "$SRV_CMD"; then |
Manuel Pégourié-Gonnard | 677884d | 2014-02-25 16:42:31 +0100 | [diff] [blame] | 169 | if grep "Performing the SSL/TLS handshake" srv_out >/dev/null; then :; |
| 170 | else |
| 171 | fail "server failed to start" |
| 172 | return |
| 173 | fi |
| 174 | fi |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 175 | if is_polar "$CLI_CMD"; then |
Manuel Pégourié-Gonnard | 677884d | 2014-02-25 16:42:31 +0100 | [diff] [blame] | 176 | if grep "Performing the SSL/TLS handshake" cli_out >/dev/null; then :; |
| 177 | else |
| 178 | fail "client failed to start" |
| 179 | return |
| 180 | fi |
| 181 | fi |
| 182 | |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 183 | # check server exit code |
| 184 | if [ $? != 0 ]; then |
| 185 | fail "server fail" |
| 186 | return |
| 187 | fi |
| 188 | |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 189 | # check client exit code |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 190 | if [ \( "$CLI_EXPECT" = 0 -a "$CLI_EXIT" != 0 \) -o \ |
| 191 | \( "$CLI_EXPECT" != 0 -a "$CLI_EXIT" = 0 \) ] |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 192 | then |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 193 | fail "bad client exit code" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 194 | return |
| 195 | fi |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 196 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 197 | # check other assertions |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 198 | while [ $# -gt 0 ] |
| 199 | do |
| 200 | case $1 in |
| 201 | "-s") |
| 202 | if grep "$2" srv_out >/dev/null; then :; else |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 203 | fail "-s $2" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 204 | return |
| 205 | fi |
| 206 | ;; |
| 207 | |
| 208 | "-c") |
| 209 | if grep "$2" cli_out >/dev/null; then :; else |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 210 | fail "-c $2" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 211 | return |
| 212 | fi |
| 213 | ;; |
| 214 | |
| 215 | "-S") |
| 216 | if grep "$2" srv_out >/dev/null; then |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 217 | fail "-S $2" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 218 | return |
| 219 | fi |
| 220 | ;; |
| 221 | |
| 222 | "-C") |
| 223 | if grep "$2" cli_out >/dev/null; then |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 224 | fail "-C $2" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 225 | return |
| 226 | fi |
| 227 | ;; |
| 228 | |
| 229 | *) |
Paul Bakker | 1ebc0c5 | 2014-05-22 15:47:58 +0200 | [diff] [blame] | 230 | echo "Unknown test: $1" >&2 |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 231 | exit 1 |
| 232 | esac |
| 233 | shift 2 |
| 234 | done |
| 235 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 236 | # check valgrind's results |
| 237 | if [ "$MEMCHECK" -gt 0 ]; then |
| 238 | if is_polar "$SRV_CMD" && has_mem_err srv_out; then |
| 239 | fail "Server has memory errors" |
| 240 | return |
| 241 | fi |
| 242 | if is_polar "$CLI_CMD" && has_mem_err cli_out; then |
| 243 | fail "Client has memory errors" |
| 244 | return |
| 245 | fi |
| 246 | fi |
| 247 | |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 248 | # if we're here, everything is ok |
| 249 | echo "PASS" |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 250 | rm -f srv_out cli_out |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 251 | } |
| 252 | |
Manuel Pégourié-Gonnard | a9062e9 | 2014-02-25 16:21:22 +0100 | [diff] [blame] | 253 | cleanup() { |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 254 | rm -f cli_out srv_out sess |
Manuel Pégourié-Gonnard | a9062e9 | 2014-02-25 16:21:22 +0100 | [diff] [blame] | 255 | kill $SRV_PID |
| 256 | exit 1 |
| 257 | } |
| 258 | |
Manuel Pégourié-Gonnard | 9dea8bd | 2014-02-26 18:21:02 +0100 | [diff] [blame] | 259 | # |
| 260 | # MAIN |
| 261 | # |
| 262 | |
Manuel Pégourié-Gonnard | 913030c | 2014-03-28 10:12:38 +0100 | [diff] [blame] | 263 | get_options "$@" |
| 264 | |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 265 | # sanity checks, avoid an avalanche of errors |
| 266 | if [ ! -x "$P_SRV" ]; then |
| 267 | echo "Command '$P_SRV' is not an executable file" |
| 268 | exit 1 |
| 269 | fi |
| 270 | if [ ! -x "$P_CLI" ]; then |
| 271 | echo "Command '$P_CLI' is not an executable file" |
| 272 | exit 1 |
| 273 | fi |
Manuel Pégourié-Gonnard | 74faf3c | 2014-03-13 18:47:44 +0100 | [diff] [blame] | 274 | if which $OPENSSL_CMD >/dev/null 2>&1; then :; else |
| 275 | echo "Command '$OPENSSL_CMD' not found" |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 276 | exit 1 |
| 277 | fi |
| 278 | |
Manuel Pégourié-Gonnard | 8066b81 | 2014-05-28 22:59:30 +0200 | [diff] [blame^] | 279 | # Pick a "unique" port in the range 10000-19999. |
| 280 | PORT="0000$$" |
| 281 | PORT="1$(echo $PORT | tail -c 4)" |
| 282 | |
| 283 | # fix commands to use this port |
| 284 | P_SRV="$P_SRV server_port=$PORT" |
| 285 | P_CLI="$P_CLI server_port=$PORT" |
| 286 | O_SRV="$O_SRV -accept $PORT" |
| 287 | O_CLI="$O_CLI -connect localhost:$PORT" |
| 288 | |
Manuel Pégourié-Gonnard | a9062e9 | 2014-02-25 16:21:22 +0100 | [diff] [blame] | 289 | trap cleanup INT TERM HUP |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 290 | |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 291 | # Test for SSLv2 ClientHello |
| 292 | |
| 293 | run_test "SSLv2 ClientHello #0 (reference)" \ |
| 294 | "$P_SRV debug_level=3" \ |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 295 | "$O_CLI -no_ssl2" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 296 | 0 \ |
| 297 | -S "parse client hello v2" \ |
| 298 | -S "ssl_handshake returned" |
| 299 | |
| 300 | # Adding a SSL2-only suite makes OpenSSL client send SSLv2 ClientHello |
| 301 | run_test "SSLv2 ClientHello #1 (actual test)" \ |
| 302 | "$P_SRV debug_level=3" \ |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 303 | "$O_CLI -cipher 'DES-CBC-MD5:ALL'" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 304 | 0 \ |
| 305 | -s "parse client hello v2" \ |
| 306 | -S "ssl_handshake returned" |
| 307 | |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 308 | # Tests for Truncated HMAC extension |
| 309 | |
| 310 | run_test "Truncated HMAC #0" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 311 | "$P_SRV debug_level=5" \ |
| 312 | "$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] | 313 | 0 \ |
| 314 | -s "dumping 'computed mac' (20 bytes)" |
| 315 | |
| 316 | run_test "Truncated HMAC #1" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 317 | "$P_SRV debug_level=5" \ |
| 318 | "$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] | 319 | 0 \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 320 | -s "dumping 'computed mac' (10 bytes)" |
| 321 | |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 322 | # Tests for Session Tickets |
| 323 | |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 324 | run_test "Session resume using tickets #1 (basic)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 325 | "$P_SRV debug_level=4 tickets=1" \ |
| 326 | "$P_CLI debug_level=4 tickets=1 reconnect=1" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 327 | 0 \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 328 | -c "client hello, adding session ticket extension" \ |
| 329 | -s "found session ticket extension" \ |
| 330 | -s "server hello, adding session ticket extension" \ |
| 331 | -c "found session_ticket extension" \ |
| 332 | -c "parse new session ticket" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 333 | -S "session successfully restored from cache" \ |
| 334 | -s "session successfully restored from ticket" \ |
| 335 | -s "a session has been resumed" \ |
| 336 | -c "a session has been resumed" |
| 337 | |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 338 | run_test "Session resume using tickets #2 (cache disabled)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 339 | "$P_SRV debug_level=4 tickets=1 cache_max=0" \ |
| 340 | "$P_CLI debug_level=4 tickets=1 reconnect=1" \ |
Manuel Pégourié-Gonnard | dbe1ee1 | 2014-02-21 09:18:13 +0100 | [diff] [blame] | 341 | 0 \ |
| 342 | -c "client hello, adding session ticket extension" \ |
| 343 | -s "found session ticket extension" \ |
| 344 | -s "server hello, adding session ticket extension" \ |
| 345 | -c "found session_ticket extension" \ |
| 346 | -c "parse new session ticket" \ |
| 347 | -S "session successfully restored from cache" \ |
| 348 | -s "session successfully restored from ticket" \ |
| 349 | -s "a session has been resumed" \ |
| 350 | -c "a session has been resumed" |
| 351 | |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 352 | run_test "Session resume using tickets #3 (timeout)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 353 | "$P_SRV debug_level=4 tickets=1 cache_max=0 ticket_timeout=1" \ |
| 354 | "$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] | 355 | 0 \ |
| 356 | -c "client hello, adding session ticket extension" \ |
| 357 | -s "found session ticket extension" \ |
| 358 | -s "server hello, adding session ticket extension" \ |
| 359 | -c "found session_ticket extension" \ |
| 360 | -c "parse new session ticket" \ |
| 361 | -S "session successfully restored from cache" \ |
| 362 | -S "session successfully restored from ticket" \ |
| 363 | -S "a session has been resumed" \ |
| 364 | -C "a session has been resumed" |
| 365 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 366 | run_test "Session resume using tickets #4 (openssl server)" \ |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 367 | "$O_SRV" \ |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 368 | "$P_CLI debug_level=4 tickets=1 reconnect=1" \ |
| 369 | 0 \ |
| 370 | -c "client hello, adding session ticket extension" \ |
| 371 | -c "found session_ticket extension" \ |
| 372 | -c "parse new session ticket" \ |
| 373 | -c "a session has been resumed" |
| 374 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 375 | run_test "Session resume using tickets #5 (openssl client)" \ |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 376 | "$P_SRV debug_level=4 tickets=1" \ |
| 377 | "($O_CLI -sess_out sess; $O_CLI -sess_in sess; rm -f sess)" \ |
| 378 | 0 \ |
| 379 | -s "found session ticket extension" \ |
| 380 | -s "server hello, adding session ticket extension" \ |
| 381 | -S "session successfully restored from cache" \ |
| 382 | -s "session successfully restored from ticket" \ |
| 383 | -s "a session has been resumed" |
| 384 | |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 385 | # Tests for Session Resume based on session-ID and cache |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 386 | |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 387 | 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] | 388 | "$P_SRV debug_level=4 tickets=0" \ |
| 389 | "$P_CLI debug_level=4 tickets=1 reconnect=1" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 390 | 0 \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 391 | -c "client hello, adding session ticket extension" \ |
| 392 | -s "found session ticket extension" \ |
| 393 | -S "server hello, adding session ticket extension" \ |
| 394 | -C "found session_ticket extension" \ |
| 395 | -C "parse new session ticket" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 396 | -s "session successfully restored from cache" \ |
| 397 | -S "session successfully restored from ticket" \ |
| 398 | -s "a session has been resumed" \ |
| 399 | -c "a session has been resumed" |
| 400 | |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 401 | 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] | 402 | "$P_SRV debug_level=4 tickets=1" \ |
| 403 | "$P_CLI debug_level=4 tickets=0 reconnect=1" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 404 | 0 \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 405 | -C "client hello, adding session ticket extension" \ |
| 406 | -S "found session ticket extension" \ |
| 407 | -S "server hello, adding session ticket extension" \ |
| 408 | -C "found session_ticket extension" \ |
| 409 | -C "parse new session ticket" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 410 | -s "session successfully restored from cache" \ |
| 411 | -S "session successfully restored from ticket" \ |
| 412 | -s "a session has been resumed" \ |
| 413 | -c "a session has been resumed" |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 414 | |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 415 | run_test "Session resume using cache #3 (cache_max=0)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 416 | "$P_SRV debug_level=4 tickets=0 cache_max=0" \ |
| 417 | "$P_CLI debug_level=4 tickets=0 reconnect=1" \ |
Manuel Pégourié-Gonnard | 4c88345 | 2014-02-20 21:32:41 +0100 | [diff] [blame] | 418 | 0 \ |
| 419 | -S "session successfully restored from cache" \ |
| 420 | -S "session successfully restored from ticket" \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 421 | -S "a session has been resumed" \ |
| 422 | -C "a session has been resumed" |
Manuel Pégourié-Gonnard | 4c88345 | 2014-02-20 21:32:41 +0100 | [diff] [blame] | 423 | |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 424 | run_test "Session resume using cache #4 (cache_max=1)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 425 | "$P_SRV debug_level=4 tickets=0 cache_max=1" \ |
| 426 | "$P_CLI debug_level=4 tickets=0 reconnect=1" \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 427 | 0 \ |
| 428 | -s "session successfully restored from cache" \ |
| 429 | -S "session successfully restored from ticket" \ |
| 430 | -s "a session has been resumed" \ |
| 431 | -c "a session has been resumed" |
| 432 | |
| 433 | run_test "Session resume using cache #5 (timemout > delay)" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 434 | "$P_SRV debug_level=4 tickets=0" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 435 | "$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] | 436 | 0 \ |
| 437 | -s "session successfully restored from cache" \ |
| 438 | -S "session successfully restored from ticket" \ |
| 439 | -s "a session has been resumed" \ |
| 440 | -c "a session has been resumed" |
| 441 | |
| 442 | run_test "Session resume using cache #6 (timeout < delay)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 443 | "$P_SRV debug_level=4 tickets=0 cache_timeout=1" \ |
| 444 | "$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] | 445 | 0 \ |
| 446 | -S "session successfully restored from cache" \ |
| 447 | -S "session successfully restored from ticket" \ |
| 448 | -S "a session has been resumed" \ |
| 449 | -C "a session has been resumed" |
| 450 | |
| 451 | run_test "Session resume using cache #7 (no timeout)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 452 | "$P_SRV debug_level=4 tickets=0 cache_timeout=0" \ |
| 453 | "$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] | 454 | 0 \ |
| 455 | -s "session successfully restored from cache" \ |
| 456 | -S "session successfully restored from ticket" \ |
| 457 | -s "a session has been resumed" \ |
| 458 | -c "a session has been resumed" |
| 459 | |
Manuel Pégourié-Gonnard | db735f6 | 2014-02-25 17:57:59 +0100 | [diff] [blame] | 460 | run_test "Session resume using cache #8 (openssl client)" \ |
| 461 | "$P_SRV debug_level=4 tickets=0" \ |
| 462 | "($O_CLI -sess_out sess; $O_CLI -sess_in sess; rm -f sess)" \ |
| 463 | 0 \ |
| 464 | -s "found session ticket extension" \ |
| 465 | -S "server hello, adding session ticket extension" \ |
| 466 | -s "session successfully restored from cache" \ |
| 467 | -S "session successfully restored from ticket" \ |
| 468 | -s "a session has been resumed" |
| 469 | |
| 470 | run_test "Session resume using cache #9 (openssl server)" \ |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 471 | "$O_SRV" \ |
Manuel Pégourié-Gonnard | db735f6 | 2014-02-25 17:57:59 +0100 | [diff] [blame] | 472 | "$P_CLI debug_level=4 tickets=0 reconnect=1" \ |
| 473 | 0 \ |
| 474 | -C "found session_ticket extension" \ |
| 475 | -C "parse new session ticket" \ |
| 476 | -c "a session has been resumed" |
| 477 | |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 478 | # Tests for Max Fragment Length extension |
| 479 | |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 480 | run_test "Max fragment length #1" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 481 | "$P_SRV debug_level=4" \ |
| 482 | "$P_CLI debug_level=4" \ |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 483 | 0 \ |
| 484 | -C "client hello, adding max_fragment_length extension" \ |
| 485 | -S "found max fragment length extension" \ |
| 486 | -S "server hello, max_fragment_length extension" \ |
| 487 | -C "found max_fragment_length extension" |
| 488 | |
| 489 | run_test "Max fragment length #2" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 490 | "$P_SRV debug_level=4" \ |
| 491 | "$P_CLI debug_level=4 max_frag_len=4096" \ |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 492 | 0 \ |
| 493 | -c "client hello, adding max_fragment_length extension" \ |
| 494 | -s "found max fragment length extension" \ |
| 495 | -s "server hello, max_fragment_length extension" \ |
| 496 | -c "found max_fragment_length extension" |
| 497 | |
| 498 | run_test "Max fragment length #3" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 499 | "$P_SRV debug_level=4 max_frag_len=4096" \ |
| 500 | "$P_CLI debug_level=4" \ |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 501 | 0 \ |
| 502 | -C "client hello, adding max_fragment_length extension" \ |
| 503 | -S "found max fragment length extension" \ |
| 504 | -S "server hello, max_fragment_length extension" \ |
| 505 | -C "found max_fragment_length extension" |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 506 | |
| 507 | # Tests for renegotiation |
| 508 | |
| 509 | run_test "Renegotiation #0 (none)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 510 | "$P_SRV debug_level=4" \ |
| 511 | "$P_CLI debug_level=4" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 512 | 0 \ |
| 513 | -C "client hello, adding renegotiation extension" \ |
| 514 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 515 | -S "found renegotiation extension" \ |
| 516 | -s "server hello, secure renegotiation extension" \ |
| 517 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 518 | -C "=> renegotiate" \ |
| 519 | -S "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 520 | -S "write hello request" |
| 521 | |
| 522 | run_test "Renegotiation #1 (enabled, client-initiated)" \ |
Manuel Pégourié-Gonnard | 00d538f | 2014-03-31 10:44:40 +0200 | [diff] [blame] | 523 | "$P_SRV debug_level=4 renegotiation=1" \ |
| 524 | "$P_CLI debug_level=4 renegotiation=1 renegotiate=1" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 525 | 0 \ |
| 526 | -c "client hello, adding renegotiation extension" \ |
| 527 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 528 | -s "found renegotiation extension" \ |
| 529 | -s "server hello, secure renegotiation extension" \ |
| 530 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 531 | -c "=> renegotiate" \ |
| 532 | -s "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 533 | -S "write hello request" |
| 534 | |
| 535 | run_test "Renegotiation #2 (enabled, server-initiated)" \ |
Manuel Pégourié-Gonnard | 00d538f | 2014-03-31 10:44:40 +0200 | [diff] [blame] | 536 | "$P_SRV debug_level=4 renegotiation=1 renegotiate=1" \ |
| 537 | "$P_CLI debug_level=4 renegotiation=1" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 538 | 0 \ |
| 539 | -c "client hello, adding renegotiation extension" \ |
| 540 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 541 | -s "found renegotiation extension" \ |
| 542 | -s "server hello, secure renegotiation extension" \ |
| 543 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 544 | -c "=> renegotiate" \ |
| 545 | -s "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 546 | -s "write hello request" |
| 547 | |
| 548 | run_test "Renegotiation #3 (enabled, double)" \ |
Manuel Pégourié-Gonnard | 00d538f | 2014-03-31 10:44:40 +0200 | [diff] [blame] | 549 | "$P_SRV debug_level=4 renegotiation=1 renegotiate=1" \ |
| 550 | "$P_CLI debug_level=4 renegotiation=1 renegotiate=1" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 551 | 0 \ |
| 552 | -c "client hello, adding renegotiation extension" \ |
| 553 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 554 | -s "found renegotiation extension" \ |
| 555 | -s "server hello, secure renegotiation extension" \ |
| 556 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 557 | -c "=> renegotiate" \ |
| 558 | -s "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 559 | -s "write hello request" |
| 560 | |
| 561 | run_test "Renegotiation #4 (client-initiated, server-rejected)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 562 | "$P_SRV debug_level=4 renegotiation=0" \ |
Manuel Pégourié-Gonnard | 00d538f | 2014-03-31 10:44:40 +0200 | [diff] [blame] | 563 | "$P_CLI debug_level=4 renegotiation=1 renegotiate=1" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 564 | 1 \ |
| 565 | -c "client hello, adding renegotiation extension" \ |
| 566 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 567 | -S "found renegotiation extension" \ |
| 568 | -s "server hello, secure renegotiation extension" \ |
| 569 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 570 | -c "=> renegotiate" \ |
| 571 | -S "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 572 | -S "write hello request" |
| 573 | |
| 574 | run_test "Renegotiation #5 (server-initiated, client-rejected)" \ |
Manuel Pégourié-Gonnard | 00d538f | 2014-03-31 10:44:40 +0200 | [diff] [blame] | 575 | "$P_SRV debug_level=4 renegotiation=1 renegotiate=1" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 576 | "$P_CLI debug_level=4 renegotiation=0" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 577 | 0 \ |
| 578 | -C "client hello, adding renegotiation extension" \ |
| 579 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 580 | -S "found renegotiation extension" \ |
| 581 | -s "server hello, secure renegotiation extension" \ |
| 582 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 583 | -C "=> renegotiate" \ |
| 584 | -S "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 585 | -s "write hello request" \ |
| 586 | -s "SSL - An unexpected message was received from our peer" \ |
| 587 | -s "failed" |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 588 | |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 589 | # Tests for auth_mode |
| 590 | |
| 591 | run_test "Authentication #1 (server badcert, client required)" \ |
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=required" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 595 | 1 \ |
| 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 #2 (server badcert, client optional)" \ |
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=optional" \ |
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 #3 (server badcert, client none)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 612 | "$P_SRV crt_file=data_files/server5-badsign.crt \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 613 | key_file=data_files/server5.key" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 614 | "$P_CLI debug_level=2 auth_mode=none" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 615 | 0 \ |
| 616 | -C "x509_verify_cert() returned" \ |
| 617 | -C "! self-signed or not signed by a trusted CA" \ |
| 618 | -C "! ssl_handshake returned" \ |
| 619 | -C "X509 - Certificate verification failed" |
| 620 | |
| 621 | run_test "Authentication #4 (client badcert, server required)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 622 | "$P_SRV debug_level=4 auth_mode=required" \ |
| 623 | "$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] | 624 | key_file=data_files/server5.key" \ |
| 625 | 1 \ |
| 626 | -S "skip write certificate request" \ |
| 627 | -C "skip parse certificate request" \ |
| 628 | -c "got a certificate request" \ |
| 629 | -C "skip write certificate" \ |
| 630 | -C "skip write certificate verify" \ |
| 631 | -S "skip parse certificate verify" \ |
| 632 | -s "x509_verify_cert() returned" \ |
| 633 | -S "! self-signed or not signed by a trusted CA" \ |
| 634 | -s "! ssl_handshake returned" \ |
| 635 | -c "! ssl_handshake returned" \ |
| 636 | -s "X509 - Certificate verification failed" |
| 637 | |
| 638 | run_test "Authentication #5 (client badcert, server optional)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 639 | "$P_SRV debug_level=4 auth_mode=optional" \ |
| 640 | "$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] | 641 | key_file=data_files/server5.key" \ |
| 642 | 0 \ |
| 643 | -S "skip write certificate request" \ |
| 644 | -C "skip parse certificate request" \ |
| 645 | -c "got a certificate request" \ |
| 646 | -C "skip write certificate" \ |
| 647 | -C "skip write certificate verify" \ |
| 648 | -S "skip parse certificate verify" \ |
| 649 | -s "x509_verify_cert() returned" \ |
| 650 | -s "! self-signed or not signed by a trusted CA" \ |
| 651 | -S "! ssl_handshake returned" \ |
| 652 | -C "! ssl_handshake returned" \ |
| 653 | -S "X509 - Certificate verification failed" |
| 654 | |
| 655 | run_test "Authentication #6 (client badcert, server none)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 656 | "$P_SRV debug_level=4 auth_mode=none" \ |
| 657 | "$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] | 658 | key_file=data_files/server5.key" \ |
| 659 | 0 \ |
| 660 | -s "skip write certificate request" \ |
| 661 | -C "skip parse certificate request" \ |
| 662 | -c "got no certificate request" \ |
| 663 | -c "skip write certificate" \ |
| 664 | -c "skip write certificate verify" \ |
| 665 | -s "skip parse certificate verify" \ |
| 666 | -S "x509_verify_cert() returned" \ |
| 667 | -S "! self-signed or not signed by a trusted CA" \ |
| 668 | -S "! ssl_handshake returned" \ |
| 669 | -C "! ssl_handshake returned" \ |
| 670 | -S "X509 - Certificate verification failed" |
| 671 | |
Manuel Pégourié-Gonnard | de515cc | 2014-02-27 14:58:26 +0100 | [diff] [blame] | 672 | run_test "Authentication #7 (client no cert, server optional)" \ |
| 673 | "$P_SRV debug_level=4 auth_mode=optional" \ |
| 674 | "$P_CLI debug_level=4 crt_file=none key_file=none" \ |
| 675 | 0 \ |
| 676 | -S "skip write certificate request" \ |
| 677 | -C "skip parse certificate request" \ |
| 678 | -c "got a certificate request" \ |
| 679 | -C "skip write certificate$" \ |
| 680 | -C "got no certificate to send" \ |
| 681 | -S "SSLv3 client has no certificate" \ |
| 682 | -c "skip write certificate verify" \ |
| 683 | -s "skip parse certificate verify" \ |
| 684 | -s "! no client certificate sent" \ |
| 685 | -S "! ssl_handshake returned" \ |
| 686 | -C "! ssl_handshake returned" \ |
| 687 | -S "X509 - Certificate verification failed" |
| 688 | |
| 689 | run_test "Authentication #8 (openssl client no cert, server optional)" \ |
| 690 | "$P_SRV debug_level=4 auth_mode=optional" \ |
| 691 | "$O_CLI" \ |
| 692 | 0 \ |
| 693 | -S "skip write certificate request" \ |
| 694 | -s "skip parse certificate verify" \ |
| 695 | -s "! no client certificate sent" \ |
| 696 | -S "! ssl_handshake returned" \ |
| 697 | -S "X509 - Certificate verification failed" |
| 698 | |
| 699 | run_test "Authentication #9 (client no cert, openssl server optional)" \ |
| 700 | "$O_SRV -verify 10" \ |
| 701 | "$P_CLI debug_level=4 crt_file=none key_file=none" \ |
| 702 | 0 \ |
| 703 | -C "skip parse certificate request" \ |
| 704 | -c "got a certificate request" \ |
| 705 | -C "skip write certificate$" \ |
| 706 | -c "skip write certificate verify" \ |
| 707 | -C "! ssl_handshake returned" |
| 708 | |
| 709 | run_test "Authentication #10 (client no cert, ssl3)" \ |
| 710 | "$P_SRV debug_level=4 auth_mode=optional force_version=ssl3" \ |
| 711 | "$P_CLI debug_level=4 crt_file=none key_file=none" \ |
| 712 | 0 \ |
| 713 | -S "skip write certificate request" \ |
| 714 | -C "skip parse certificate request" \ |
| 715 | -c "got a certificate request" \ |
| 716 | -C "skip write certificate$" \ |
| 717 | -c "skip write certificate verify" \ |
| 718 | -c "got no certificate to send" \ |
| 719 | -s "SSLv3 client has no certificate" \ |
| 720 | -s "skip parse certificate verify" \ |
| 721 | -s "! no client certificate sent" \ |
| 722 | -S "! ssl_handshake returned" \ |
| 723 | -C "! ssl_handshake returned" \ |
| 724 | -S "X509 - Certificate verification failed" |
| 725 | |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 726 | # tests for SNI |
| 727 | |
| 728 | run_test "SNI #0 (no SNI callback)" \ |
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 | 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 | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 732 | server_name=localhost" \ |
| 733 | 0 \ |
| 734 | -S "parse ServerName extension" \ |
| 735 | -c "issuer name *: C=NL, O=PolarSSL, CN=Polarssl Test EC CA" \ |
| 736 | -c "subject name *: C=NL, O=PolarSSL, CN=localhost" |
| 737 | |
| 738 | run_test "SNI #1 (matching cert 1)" \ |
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 | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 743 | server_name=localhost" \ |
| 744 | 0 \ |
| 745 | -s "parse ServerName extension" \ |
| 746 | -c "issuer name *: C=NL, O=PolarSSL, CN=PolarSSL Test CA" \ |
| 747 | -c "subject name *: C=NL, O=PolarSSL, CN=localhost" |
| 748 | |
| 749 | run_test "SNI #2 (matching cert 2)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 750 | "$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] | 751 | 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] | 752 | 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] | 753 | "$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] | 754 | server_name=polarssl.example" \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 755 | 0 \ |
| 756 | -s "parse ServerName extension" \ |
| 757 | -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] | 758 | -c "subject name *: C=NL, O=PolarSSL, CN=polarssl.example" |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 759 | |
| 760 | run_test "SNI #3 (no matching cert)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 761 | "$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] | 762 | 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] | 763 | 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] | 764 | "$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] | 765 | server_name=nonesuch.example" \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 766 | 1 \ |
| 767 | -s "parse ServerName extension" \ |
| 768 | -s "ssl_sni_wrapper() returned" \ |
| 769 | -s "ssl_handshake returned" \ |
| 770 | -c "ssl_handshake returned" \ |
| 771 | -c "SSL - A fatal alert message was received from our peer" |
| 772 | |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 773 | # Tests for non-blocking I/O: exercise a variety of handshake flows |
| 774 | |
| 775 | run_test "Non-blocking I/O #1 (basic handshake)" \ |
| 776 | "$P_SRV nbio=2 tickets=0 auth_mode=none" \ |
| 777 | "$P_CLI nbio=2 tickets=0" \ |
| 778 | 0 \ |
| 779 | -S "ssl_handshake returned" \ |
| 780 | -C "ssl_handshake returned" \ |
| 781 | -c "Read from server: .* bytes read" |
| 782 | |
| 783 | run_test "Non-blocking I/O #2 (client auth)" \ |
| 784 | "$P_SRV nbio=2 tickets=0 auth_mode=required" \ |
| 785 | "$P_CLI nbio=2 tickets=0" \ |
| 786 | 0 \ |
| 787 | -S "ssl_handshake returned" \ |
| 788 | -C "ssl_handshake returned" \ |
| 789 | -c "Read from server: .* bytes read" |
| 790 | |
| 791 | run_test "Non-blocking I/O #3 (ticket)" \ |
| 792 | "$P_SRV nbio=2 tickets=1 auth_mode=none" \ |
| 793 | "$P_CLI nbio=2 tickets=1" \ |
| 794 | 0 \ |
| 795 | -S "ssl_handshake returned" \ |
| 796 | -C "ssl_handshake returned" \ |
| 797 | -c "Read from server: .* bytes read" |
| 798 | |
| 799 | run_test "Non-blocking I/O #4 (ticket + client auth)" \ |
| 800 | "$P_SRV nbio=2 tickets=1 auth_mode=required" \ |
| 801 | "$P_CLI nbio=2 tickets=1" \ |
| 802 | 0 \ |
| 803 | -S "ssl_handshake returned" \ |
| 804 | -C "ssl_handshake returned" \ |
| 805 | -c "Read from server: .* bytes read" |
| 806 | |
| 807 | run_test "Non-blocking I/O #5 (ticket + client auth + resume)" \ |
| 808 | "$P_SRV nbio=2 tickets=1 auth_mode=required" \ |
| 809 | "$P_CLI nbio=2 tickets=1 reconnect=1" \ |
| 810 | 0 \ |
| 811 | -S "ssl_handshake returned" \ |
| 812 | -C "ssl_handshake returned" \ |
| 813 | -c "Read from server: .* bytes read" |
| 814 | |
| 815 | run_test "Non-blocking I/O #6 (ticket + resume)" \ |
| 816 | "$P_SRV nbio=2 tickets=1 auth_mode=none" \ |
| 817 | "$P_CLI nbio=2 tickets=1 reconnect=1" \ |
| 818 | 0 \ |
| 819 | -S "ssl_handshake returned" \ |
| 820 | -C "ssl_handshake returned" \ |
| 821 | -c "Read from server: .* bytes read" |
| 822 | |
| 823 | run_test "Non-blocking I/O #7 (session-id resume)" \ |
| 824 | "$P_SRV nbio=2 tickets=0 auth_mode=none" \ |
| 825 | "$P_CLI nbio=2 tickets=0 reconnect=1" \ |
| 826 | 0 \ |
| 827 | -S "ssl_handshake returned" \ |
| 828 | -C "ssl_handshake returned" \ |
| 829 | -c "Read from server: .* bytes read" |
| 830 | |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 831 | # Tests for version negotiation |
| 832 | |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 833 | run_test "Version check #1 (all -> 1.2)" \ |
| 834 | "$P_SRV" \ |
| 835 | "$P_CLI" \ |
| 836 | 0 \ |
| 837 | -S "ssl_handshake returned" \ |
| 838 | -C "ssl_handshake returned" \ |
| 839 | -s "Protocol is TLSv1.2" \ |
| 840 | -c "Protocol is TLSv1.2" |
| 841 | |
| 842 | run_test "Version check #2 (cli max 1.1 -> 1.1)" \ |
| 843 | "$P_SRV" \ |
| 844 | "$P_CLI max_version=tls1_1" \ |
| 845 | 0 \ |
| 846 | -S "ssl_handshake returned" \ |
| 847 | -C "ssl_handshake returned" \ |
| 848 | -s "Protocol is TLSv1.1" \ |
| 849 | -c "Protocol is TLSv1.1" |
| 850 | |
| 851 | run_test "Version check #3 (srv max 1.1 -> 1.1)" \ |
| 852 | "$P_SRV max_version=tls1_1" \ |
| 853 | "$P_CLI" \ |
| 854 | 0 \ |
| 855 | -S "ssl_handshake returned" \ |
| 856 | -C "ssl_handshake returned" \ |
| 857 | -s "Protocol is TLSv1.1" \ |
| 858 | -c "Protocol is TLSv1.1" |
| 859 | |
| 860 | run_test "Version check #4 (cli+srv max 1.1 -> 1.1)" \ |
| 861 | "$P_SRV max_version=tls1_1" \ |
| 862 | "$P_CLI max_version=tls1_1" \ |
| 863 | 0 \ |
| 864 | -S "ssl_handshake returned" \ |
| 865 | -C "ssl_handshake returned" \ |
| 866 | -s "Protocol is TLSv1.1" \ |
| 867 | -c "Protocol is TLSv1.1" |
| 868 | |
| 869 | run_test "Version check #5 (cli max 1.1, srv min 1.1 -> 1.1)" \ |
| 870 | "$P_SRV min_version=tls1_1" \ |
| 871 | "$P_CLI max_version=tls1_1" \ |
| 872 | 0 \ |
| 873 | -S "ssl_handshake returned" \ |
| 874 | -C "ssl_handshake returned" \ |
| 875 | -s "Protocol is TLSv1.1" \ |
| 876 | -c "Protocol is TLSv1.1" |
| 877 | |
| 878 | run_test "Version check #6 (cli min 1.1, srv max 1.1 -> 1.1)" \ |
| 879 | "$P_SRV max_version=tls1_1" \ |
| 880 | "$P_CLI min_version=tls1_1" \ |
| 881 | 0 \ |
| 882 | -S "ssl_handshake returned" \ |
| 883 | -C "ssl_handshake returned" \ |
| 884 | -s "Protocol is TLSv1.1" \ |
| 885 | -c "Protocol is TLSv1.1" |
| 886 | |
| 887 | run_test "Version check #7 (cli min 1.2, srv max 1.1 -> fail)" \ |
| 888 | "$P_SRV max_version=tls1_1" \ |
| 889 | "$P_CLI min_version=tls1_2" \ |
| 890 | 1 \ |
| 891 | -s "ssl_handshake returned" \ |
| 892 | -c "ssl_handshake returned" \ |
| 893 | -c "SSL - Handshake protocol not within min/max boundaries" |
| 894 | |
| 895 | run_test "Version check #8 (srv min 1.2, cli max 1.1 -> fail)" \ |
| 896 | "$P_SRV min_version=tls1_2" \ |
| 897 | "$P_CLI max_version=tls1_1" \ |
| 898 | 1 \ |
| 899 | -s "ssl_handshake returned" \ |
| 900 | -c "ssl_handshake returned" \ |
| 901 | -s "SSL - Handshake protocol not within min/max boundaries" |
| 902 | |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 903 | # Tests for ALPN extension |
| 904 | |
Manuel Pégourié-Gonnard | 83d8c73 | 2014-04-07 13:24:21 +0200 | [diff] [blame] | 905 | if grep '^#define POLARSSL_SSL_ALPN' $CONFIG_H >/dev/null; then |
| 906 | |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 907 | run_test "ALPN #0 (none)" \ |
| 908 | "$P_SRV debug_level=4" \ |
| 909 | "$P_CLI debug_level=4" \ |
| 910 | 0 \ |
| 911 | -C "client hello, adding alpn extension" \ |
| 912 | -S "found alpn extension" \ |
| 913 | -C "got an alert message, type: \\[2:120]" \ |
| 914 | -S "server hello, adding alpn extension" \ |
| 915 | -C "found alpn extension " \ |
| 916 | -C "Application Layer Protocol is" \ |
| 917 | -S "Application Layer Protocol is" |
| 918 | |
| 919 | run_test "ALPN #1 (client only)" \ |
| 920 | "$P_SRV debug_level=4" \ |
| 921 | "$P_CLI debug_level=4 alpn=abc,1234" \ |
| 922 | 0 \ |
| 923 | -c "client hello, adding alpn extension" \ |
| 924 | -s "found alpn extension" \ |
| 925 | -C "got an alert message, type: \\[2:120]" \ |
| 926 | -S "server hello, adding alpn extension" \ |
| 927 | -C "found alpn extension " \ |
| 928 | -c "Application Layer Protocol is (none)" \ |
| 929 | -S "Application Layer Protocol is" |
| 930 | |
| 931 | run_test "ALPN #2 (server only)" \ |
| 932 | "$P_SRV debug_level=4 alpn=abc,1234" \ |
| 933 | "$P_CLI debug_level=4" \ |
| 934 | 0 \ |
| 935 | -C "client hello, adding alpn extension" \ |
| 936 | -S "found alpn extension" \ |
| 937 | -C "got an alert message, type: \\[2:120]" \ |
| 938 | -S "server hello, adding alpn extension" \ |
| 939 | -C "found alpn extension " \ |
| 940 | -C "Application Layer Protocol is" \ |
| 941 | -s "Application Layer Protocol is (none)" |
| 942 | |
| 943 | run_test "ALPN #3 (both, common cli1-srv1)" \ |
| 944 | "$P_SRV debug_level=4 alpn=abc,1234" \ |
| 945 | "$P_CLI debug_level=4 alpn=abc,1234" \ |
| 946 | 0 \ |
| 947 | -c "client hello, adding alpn extension" \ |
| 948 | -s "found alpn extension" \ |
| 949 | -C "got an alert message, type: \\[2:120]" \ |
| 950 | -s "server hello, adding alpn extension" \ |
| 951 | -c "found alpn extension" \ |
| 952 | -c "Application Layer Protocol is abc" \ |
| 953 | -s "Application Layer Protocol is abc" |
| 954 | |
| 955 | run_test "ALPN #4 (both, common cli2-srv1)" \ |
| 956 | "$P_SRV debug_level=4 alpn=abc,1234" \ |
| 957 | "$P_CLI debug_level=4 alpn=1234,abc" \ |
| 958 | 0 \ |
| 959 | -c "client hello, adding alpn extension" \ |
| 960 | -s "found alpn extension" \ |
| 961 | -C "got an alert message, type: \\[2:120]" \ |
| 962 | -s "server hello, adding alpn extension" \ |
| 963 | -c "found alpn extension" \ |
| 964 | -c "Application Layer Protocol is abc" \ |
| 965 | -s "Application Layer Protocol is abc" |
| 966 | |
| 967 | run_test "ALPN #5 (both, common cli1-srv2)" \ |
| 968 | "$P_SRV debug_level=4 alpn=abc,1234" \ |
| 969 | "$P_CLI debug_level=4 alpn=1234,abcde" \ |
| 970 | 0 \ |
| 971 | -c "client hello, adding alpn extension" \ |
| 972 | -s "found alpn extension" \ |
| 973 | -C "got an alert message, type: \\[2:120]" \ |
| 974 | -s "server hello, adding alpn extension" \ |
| 975 | -c "found alpn extension" \ |
| 976 | -c "Application Layer Protocol is 1234" \ |
| 977 | -s "Application Layer Protocol is 1234" |
| 978 | |
| 979 | run_test "ALPN #6 (both, no common)" \ |
| 980 | "$P_SRV debug_level=4 alpn=abc,123" \ |
| 981 | "$P_CLI debug_level=4 alpn=1234,abcde" \ |
| 982 | 1 \ |
| 983 | -c "client hello, adding alpn extension" \ |
| 984 | -s "found alpn extension" \ |
| 985 | -c "got an alert message, type: \\[2:120]" \ |
| 986 | -S "server hello, adding alpn extension" \ |
| 987 | -C "found alpn extension" \ |
| 988 | -C "Application Layer Protocol is 1234" \ |
| 989 | -S "Application Layer Protocol is 1234" |
| 990 | |
Manuel Pégourié-Gonnard | 83d8c73 | 2014-04-07 13:24:21 +0200 | [diff] [blame] | 991 | fi |
| 992 | |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 993 | # Tests for keyUsage in leaf certificates, part 1: |
| 994 | # server-side certificate/suite selection |
| 995 | |
Manuel Pégourié-Gonnard | 17cde5f | 2014-05-22 14:42:39 +0200 | [diff] [blame] | 996 | run_test "keyUsage srv #1 (RSA, digitalSignature -> (EC)DHE-RSA)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 997 | "$P_SRV key_file=data_files/server2.key \ |
| 998 | crt_file=data_files/server2.ku-ds.crt" \ |
| 999 | "$P_CLI" \ |
| 1000 | 0 \ |
Manuel Pégourié-Gonnard | 17cde5f | 2014-05-22 14:42:39 +0200 | [diff] [blame] | 1001 | -c "Ciphersuite is TLS-[EC]*DHE-RSA-WITH-" |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1002 | |
| 1003 | |
| 1004 | run_test "keyUsage srv #2 (RSA, keyEncipherment -> RSA)" \ |
| 1005 | "$P_SRV key_file=data_files/server2.key \ |
| 1006 | crt_file=data_files/server2.ku-ke.crt" \ |
| 1007 | "$P_CLI" \ |
| 1008 | 0 \ |
| 1009 | -c "Ciphersuite is TLS-RSA-WITH-" |
| 1010 | |
| 1011 | # add psk to leave an option for client to send SERVERQUIT |
| 1012 | run_test "keyUsage srv #3 (RSA, keyAgreement -> fail)" \ |
| 1013 | "$P_SRV psk=abc123 key_file=data_files/server2.key \ |
| 1014 | crt_file=data_files/server2.ku-ka.crt" \ |
| 1015 | "$P_CLI psk=badbad" \ |
| 1016 | 1 \ |
| 1017 | -C "Ciphersuite is " |
| 1018 | |
| 1019 | run_test "keyUsage srv #4 (ECDSA, digitalSignature -> ECDHE-ECDSA)" \ |
| 1020 | "$P_SRV key_file=data_files/server5.key \ |
| 1021 | crt_file=data_files/server5.ku-ds.crt" \ |
| 1022 | "$P_CLI" \ |
| 1023 | 0 \ |
| 1024 | -c "Ciphersuite is TLS-ECDHE-ECDSA-WITH-" |
| 1025 | |
| 1026 | |
| 1027 | run_test "keyUsage srv #5 (ECDSA, keyAgreement -> ECDH-)" \ |
| 1028 | "$P_SRV key_file=data_files/server5.key \ |
| 1029 | crt_file=data_files/server5.ku-ka.crt" \ |
| 1030 | "$P_CLI" \ |
| 1031 | 0 \ |
| 1032 | -c "Ciphersuite is TLS-ECDH-" |
| 1033 | |
| 1034 | # add psk to leave an option for client to send SERVERQUIT |
| 1035 | run_test "keyUsage srv #6 (ECDSA, keyEncipherment -> fail)" \ |
| 1036 | "$P_SRV psk=abc123 key_file=data_files/server5.key \ |
| 1037 | crt_file=data_files/server5.ku-ke.crt" \ |
| 1038 | "$P_CLI psk=badbad" \ |
| 1039 | 1 \ |
| 1040 | -C "Ciphersuite is " |
| 1041 | |
| 1042 | # Tests for keyUsage in leaf certificates, part 2: |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1043 | # client-side checking of server cert |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1044 | |
| 1045 | run_test "keyUsage cli #1 (DigitalSignature+KeyEncipherment, RSA: OK)" \ |
| 1046 | "$O_SRV -key data_files/server2.key \ |
| 1047 | -cert data_files/server2.ku-ds_ke.crt" \ |
| 1048 | "$P_CLI debug_level=2 \ |
| 1049 | force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| 1050 | 0 \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1051 | -C "bad certificate (usage extensions)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1052 | -C "Processing of the Certificate handshake message failed" \ |
| 1053 | -c "Ciphersuite is TLS-" |
| 1054 | |
| 1055 | run_test "keyUsage cli #2 (DigitalSignature+KeyEncipherment, DHE-RSA: OK)" \ |
| 1056 | "$O_SRV -key data_files/server2.key \ |
| 1057 | -cert data_files/server2.ku-ds_ke.crt" \ |
| 1058 | "$P_CLI debug_level=2 \ |
| 1059 | force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA" \ |
| 1060 | 0 \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1061 | -C "bad certificate (usage extensions)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1062 | -C "Processing of the Certificate handshake message failed" \ |
| 1063 | -c "Ciphersuite is TLS-" |
| 1064 | |
| 1065 | run_test "keyUsage cli #3 (KeyEncipherment, RSA: OK)" \ |
| 1066 | "$O_SRV -key data_files/server2.key \ |
| 1067 | -cert data_files/server2.ku-ke.crt" \ |
| 1068 | "$P_CLI debug_level=2 \ |
| 1069 | force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| 1070 | 0 \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1071 | -C "bad certificate (usage extensions)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1072 | -C "Processing of the Certificate handshake message failed" \ |
| 1073 | -c "Ciphersuite is TLS-" |
| 1074 | |
| 1075 | run_test "keyUsage cli #4 (KeyEncipherment, DHE-RSA: fail)" \ |
| 1076 | "$O_SRV -key data_files/server2.key \ |
| 1077 | -cert data_files/server2.ku-ke.crt" \ |
| 1078 | "$P_CLI debug_level=2 \ |
| 1079 | force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA" \ |
| 1080 | 1 \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1081 | -c "bad certificate (usage extensions)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1082 | -c "Processing of the Certificate handshake message failed" \ |
| 1083 | -C "Ciphersuite is TLS-" |
| 1084 | |
| 1085 | run_test "keyUsage cli #5 (DigitalSignature, DHE-RSA: OK)" \ |
| 1086 | "$O_SRV -key data_files/server2.key \ |
| 1087 | -cert data_files/server2.ku-ds.crt" \ |
| 1088 | "$P_CLI debug_level=2 \ |
| 1089 | force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA" \ |
| 1090 | 0 \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1091 | -C "bad certificate (usage extensions)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1092 | -C "Processing of the Certificate handshake message failed" \ |
| 1093 | -c "Ciphersuite is TLS-" |
| 1094 | |
| 1095 | run_test "keyUsage cli #5 (DigitalSignature, RSA: fail)" \ |
| 1096 | "$O_SRV -key data_files/server2.key \ |
| 1097 | -cert data_files/server2.ku-ds.crt" \ |
| 1098 | "$P_CLI debug_level=2 \ |
| 1099 | force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| 1100 | 1 \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1101 | -c "bad certificate (usage extensions)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1102 | -c "Processing of the Certificate handshake message failed" \ |
| 1103 | -C "Ciphersuite is TLS-" |
| 1104 | |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1105 | # Tests for keyUsage in leaf certificates, part 3: |
| 1106 | # server-side checking of client cert |
| 1107 | |
| 1108 | run_test "keyUsage cli-auth #1 (RSA, DigitalSignature: OK)" \ |
| 1109 | "$P_SRV debug_level=2 auth_mode=optional" \ |
| 1110 | "$O_CLI -key data_files/server2.key \ |
| 1111 | -cert data_files/server2.ku-ds.crt" \ |
| 1112 | 0 \ |
| 1113 | -S "bad certificate (usage extensions)" \ |
| 1114 | -S "Processing of the Certificate handshake message failed" |
| 1115 | |
| 1116 | run_test "keyUsage cli-auth #2 (RSA, KeyEncipherment: fail (soft))" \ |
| 1117 | "$P_SRV debug_level=2 auth_mode=optional" \ |
| 1118 | "$O_CLI -key data_files/server2.key \ |
| 1119 | -cert data_files/server2.ku-ke.crt" \ |
| 1120 | 0 \ |
| 1121 | -s "bad certificate (usage extensions)" \ |
| 1122 | -S "Processing of the Certificate handshake message failed" |
| 1123 | |
| 1124 | run_test "keyUsage cli-auth #3 (RSA, KeyEncipherment: fail (hard))" \ |
| 1125 | "$P_SRV debug_level=2 auth_mode=required" \ |
| 1126 | "$O_CLI -key data_files/server2.key \ |
| 1127 | -cert data_files/server2.ku-ke.crt" \ |
| 1128 | 1 \ |
| 1129 | -s "bad certificate (usage extensions)" \ |
| 1130 | -s "Processing of the Certificate handshake message failed" |
| 1131 | |
| 1132 | run_test "keyUsage cli-auth #4 (ECDSA, DigitalSignature: OK)" \ |
| 1133 | "$P_SRV debug_level=2 auth_mode=optional" \ |
| 1134 | "$O_CLI -key data_files/server5.key \ |
| 1135 | -cert data_files/server5.ku-ds.crt" \ |
| 1136 | 0 \ |
| 1137 | -S "bad certificate (usage extensions)" \ |
| 1138 | -S "Processing of the Certificate handshake message failed" |
| 1139 | |
| 1140 | run_test "keyUsage cli-auth #5 (ECDSA, KeyAgreement: fail (soft))" \ |
| 1141 | "$P_SRV debug_level=2 auth_mode=optional" \ |
| 1142 | "$O_CLI -key data_files/server5.key \ |
| 1143 | -cert data_files/server5.ku-ka.crt" \ |
| 1144 | 0 \ |
| 1145 | -s "bad certificate (usage extensions)" \ |
| 1146 | -S "Processing of the Certificate handshake message failed" |
| 1147 | |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 1148 | # Tests for extendedKeyUsage, part 1: server-side certificate/suite selection |
| 1149 | |
| 1150 | run_test "extKeyUsage srv #1 (serverAuth -> OK)" \ |
| 1151 | "$P_SRV key_file=data_files/server5.key \ |
| 1152 | crt_file=data_files/server5.eku-srv.crt" \ |
| 1153 | "$P_CLI" \ |
| 1154 | 0 |
| 1155 | |
| 1156 | run_test "extKeyUsage srv #2 (serverAuth,clientAuth -> OK)" \ |
| 1157 | "$P_SRV key_file=data_files/server5.key \ |
| 1158 | crt_file=data_files/server5.eku-srv.crt" \ |
| 1159 | "$P_CLI" \ |
| 1160 | 0 |
| 1161 | |
| 1162 | run_test "extKeyUsage srv #3 (codeSign,anyEKU -> OK)" \ |
| 1163 | "$P_SRV key_file=data_files/server5.key \ |
| 1164 | crt_file=data_files/server5.eku-cs_any.crt" \ |
| 1165 | "$P_CLI" \ |
| 1166 | 0 |
| 1167 | |
| 1168 | # add psk to leave an option for client to send SERVERQUIT |
| 1169 | run_test "extKeyUsage srv #4 (codeSign -> fail)" \ |
| 1170 | "$P_SRV psk=abc123 key_file=data_files/server5.key \ |
| 1171 | crt_file=data_files/server5.eku-cli.crt" \ |
| 1172 | "$P_CLI psk=badbad" \ |
| 1173 | 1 |
| 1174 | |
| 1175 | # Tests for extendedKeyUsage, part 2: client-side checking of server cert |
| 1176 | |
| 1177 | run_test "extKeyUsage cli #1 (serverAuth -> OK)" \ |
| 1178 | "$O_SRV -key data_files/server5.key \ |
| 1179 | -cert data_files/server5.eku-srv.crt" \ |
| 1180 | "$P_CLI debug_level=2" \ |
| 1181 | 0 \ |
| 1182 | -C "bad certificate (usage extensions)" \ |
| 1183 | -C "Processing of the Certificate handshake message failed" \ |
| 1184 | -c "Ciphersuite is TLS-" |
| 1185 | |
| 1186 | run_test "extKeyUsage cli #2 (serverAuth,clientAuth -> OK)" \ |
| 1187 | "$O_SRV -key data_files/server5.key \ |
| 1188 | -cert data_files/server5.eku-srv_cli.crt" \ |
| 1189 | "$P_CLI debug_level=2" \ |
| 1190 | 0 \ |
| 1191 | -C "bad certificate (usage extensions)" \ |
| 1192 | -C "Processing of the Certificate handshake message failed" \ |
| 1193 | -c "Ciphersuite is TLS-" |
| 1194 | |
| 1195 | run_test "extKeyUsage cli #3 (codeSign,anyEKU -> OK)" \ |
| 1196 | "$O_SRV -key data_files/server5.key \ |
| 1197 | -cert data_files/server5.eku-cs_any.crt" \ |
| 1198 | "$P_CLI debug_level=2" \ |
| 1199 | 0 \ |
| 1200 | -C "bad certificate (usage extensions)" \ |
| 1201 | -C "Processing of the Certificate handshake message failed" \ |
| 1202 | -c "Ciphersuite is TLS-" |
| 1203 | |
| 1204 | run_test "extKeyUsage cli #4 (codeSign -> fail)" \ |
| 1205 | "$O_SRV -key data_files/server5.key \ |
| 1206 | -cert data_files/server5.eku-cs.crt" \ |
| 1207 | "$P_CLI debug_level=2" \ |
| 1208 | 1 \ |
| 1209 | -c "bad certificate (usage extensions)" \ |
| 1210 | -c "Processing of the Certificate handshake message failed" \ |
| 1211 | -C "Ciphersuite is TLS-" |
| 1212 | |
| 1213 | # Tests for extendedKeyUsage, part 3: server-side checking of client cert |
| 1214 | |
| 1215 | run_test "extKeyUsage cli-auth #1 (clientAuth -> OK)" \ |
| 1216 | "$P_SRV debug_level=2 auth_mode=optional" \ |
| 1217 | "$O_CLI -key data_files/server5.key \ |
| 1218 | -cert data_files/server5.eku-cli.crt" \ |
| 1219 | 0 \ |
| 1220 | -S "bad certificate (usage extensions)" \ |
| 1221 | -S "Processing of the Certificate handshake message failed" |
| 1222 | |
| 1223 | run_test "extKeyUsage cli-auth #2 (serverAuth,clientAuth -> OK)" \ |
| 1224 | "$P_SRV debug_level=2 auth_mode=optional" \ |
| 1225 | "$O_CLI -key data_files/server5.key \ |
| 1226 | -cert data_files/server5.eku-srv_cli.crt" \ |
| 1227 | 0 \ |
| 1228 | -S "bad certificate (usage extensions)" \ |
| 1229 | -S "Processing of the Certificate handshake message failed" |
| 1230 | |
| 1231 | run_test "extKeyUsage cli-auth #3 (codeSign,anyEKU -> OK)" \ |
| 1232 | "$P_SRV debug_level=2 auth_mode=optional" \ |
| 1233 | "$O_CLI -key data_files/server5.key \ |
| 1234 | -cert data_files/server5.eku-cs_any.crt" \ |
| 1235 | 0 \ |
| 1236 | -S "bad certificate (usage extensions)" \ |
| 1237 | -S "Processing of the Certificate handshake message failed" |
| 1238 | |
| 1239 | run_test "extKeyUsage cli-auth #4 (codeSign -> fail (soft))" \ |
| 1240 | "$P_SRV debug_level=2 auth_mode=optional" \ |
| 1241 | "$O_CLI -key data_files/server5.key \ |
| 1242 | -cert data_files/server5.eku-cs.crt" \ |
| 1243 | 0 \ |
| 1244 | -s "bad certificate (usage extensions)" \ |
| 1245 | -S "Processing of the Certificate handshake message failed" |
| 1246 | |
| 1247 | run_test "extKeyUsage cli-auth #4b (codeSign -> fail (hard))" \ |
| 1248 | "$P_SRV debug_level=2 auth_mode=required" \ |
| 1249 | "$O_CLI -key data_files/server5.key \ |
| 1250 | -cert data_files/server5.eku-cs.crt" \ |
| 1251 | 1 \ |
| 1252 | -s "bad certificate (usage extensions)" \ |
| 1253 | -s "Processing of the Certificate handshake message failed" |
| 1254 | |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 1255 | # Final report |
| 1256 | |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 1257 | echo "------------------------------------------------------------------------" |
| 1258 | |
| 1259 | if [ $FAILS = 0 ]; then |
| 1260 | echo -n "PASSED" |
| 1261 | else |
| 1262 | echo -n "FAILED" |
| 1263 | fi |
| 1264 | PASSES=`echo $TESTS - $FAILS | bc` |
Manuel Pégourié-Gonnard | 4145b89 | 2014-02-24 13:20:14 +0100 | [diff] [blame] | 1265 | echo " ($PASSES / $TESTS tests)" |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 1266 | |
| 1267 | exit $FAILS |