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 | 7f2a07d | 2014-04-09 09:50:57 +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 | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 279 | killall -q openssl ssl_server ssl_server2 |
Manuel Pégourié-Gonnard | a9062e9 | 2014-02-25 16:21:22 +0100 | [diff] [blame] | 280 | trap cleanup INT TERM HUP |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 281 | |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 282 | # Test for SSLv2 ClientHello |
| 283 | |
| 284 | run_test "SSLv2 ClientHello #0 (reference)" \ |
| 285 | "$P_SRV debug_level=3" \ |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 286 | "$O_CLI -no_ssl2" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 287 | 0 \ |
| 288 | -S "parse client hello v2" \ |
| 289 | -S "ssl_handshake returned" |
| 290 | |
| 291 | # Adding a SSL2-only suite makes OpenSSL client send SSLv2 ClientHello |
| 292 | run_test "SSLv2 ClientHello #1 (actual test)" \ |
| 293 | "$P_SRV debug_level=3" \ |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 294 | "$O_CLI -cipher 'DES-CBC-MD5:ALL'" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 295 | 0 \ |
| 296 | -s "parse client hello v2" \ |
| 297 | -S "ssl_handshake returned" |
| 298 | |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 299 | # Tests for Truncated HMAC extension |
| 300 | |
| 301 | run_test "Truncated HMAC #0" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 302 | "$P_SRV debug_level=5" \ |
| 303 | "$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] | 304 | 0 \ |
| 305 | -s "dumping 'computed mac' (20 bytes)" |
| 306 | |
| 307 | run_test "Truncated HMAC #1" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 308 | "$P_SRV debug_level=5" \ |
| 309 | "$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] | 310 | 0 \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 311 | -s "dumping 'computed mac' (10 bytes)" |
| 312 | |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 313 | # Tests for Session Tickets |
| 314 | |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 315 | run_test "Session resume using tickets #1 (basic)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 316 | "$P_SRV debug_level=4 tickets=1" \ |
| 317 | "$P_CLI debug_level=4 tickets=1 reconnect=1" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 318 | 0 \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 319 | -c "client hello, adding session ticket extension" \ |
| 320 | -s "found session ticket extension" \ |
| 321 | -s "server hello, adding session ticket extension" \ |
| 322 | -c "found session_ticket extension" \ |
| 323 | -c "parse new session ticket" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 324 | -S "session successfully restored from cache" \ |
| 325 | -s "session successfully restored from ticket" \ |
| 326 | -s "a session has been resumed" \ |
| 327 | -c "a session has been resumed" |
| 328 | |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 329 | run_test "Session resume using tickets #2 (cache disabled)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 330 | "$P_SRV debug_level=4 tickets=1 cache_max=0" \ |
| 331 | "$P_CLI debug_level=4 tickets=1 reconnect=1" \ |
Manuel Pégourié-Gonnard | dbe1ee1 | 2014-02-21 09:18:13 +0100 | [diff] [blame] | 332 | 0 \ |
| 333 | -c "client hello, adding session ticket extension" \ |
| 334 | -s "found session ticket extension" \ |
| 335 | -s "server hello, adding session ticket extension" \ |
| 336 | -c "found session_ticket extension" \ |
| 337 | -c "parse new session ticket" \ |
| 338 | -S "session successfully restored from cache" \ |
| 339 | -s "session successfully restored from ticket" \ |
| 340 | -s "a session has been resumed" \ |
| 341 | -c "a session has been resumed" |
| 342 | |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 343 | run_test "Session resume using tickets #3 (timeout)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 344 | "$P_SRV debug_level=4 tickets=1 cache_max=0 ticket_timeout=1" \ |
| 345 | "$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] | 346 | 0 \ |
| 347 | -c "client hello, adding session ticket extension" \ |
| 348 | -s "found session ticket extension" \ |
| 349 | -s "server hello, adding session ticket extension" \ |
| 350 | -c "found session_ticket extension" \ |
| 351 | -c "parse new session ticket" \ |
| 352 | -S "session successfully restored from cache" \ |
| 353 | -S "session successfully restored from ticket" \ |
| 354 | -S "a session has been resumed" \ |
| 355 | -C "a session has been resumed" |
| 356 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 357 | run_test "Session resume using tickets #4 (openssl server)" \ |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 358 | "$O_SRV" \ |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 359 | "$P_CLI debug_level=4 tickets=1 reconnect=1" \ |
| 360 | 0 \ |
| 361 | -c "client hello, adding session ticket extension" \ |
| 362 | -c "found session_ticket extension" \ |
| 363 | -c "parse new session ticket" \ |
| 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 #5 (openssl client)" \ |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 367 | "$P_SRV debug_level=4 tickets=1" \ |
| 368 | "($O_CLI -sess_out sess; $O_CLI -sess_in sess; rm -f sess)" \ |
| 369 | 0 \ |
| 370 | -s "found session ticket extension" \ |
| 371 | -s "server hello, adding session ticket extension" \ |
| 372 | -S "session successfully restored from cache" \ |
| 373 | -s "session successfully restored from ticket" \ |
| 374 | -s "a session has been resumed" |
| 375 | |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 376 | # Tests for Session Resume based on session-ID and cache |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 377 | |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 378 | 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] | 379 | "$P_SRV debug_level=4 tickets=0" \ |
| 380 | "$P_CLI debug_level=4 tickets=1 reconnect=1" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 381 | 0 \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 382 | -c "client hello, adding session ticket extension" \ |
| 383 | -s "found session ticket extension" \ |
| 384 | -S "server hello, adding session ticket extension" \ |
| 385 | -C "found session_ticket extension" \ |
| 386 | -C "parse new session ticket" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 387 | -s "session successfully restored from cache" \ |
| 388 | -S "session successfully restored from ticket" \ |
| 389 | -s "a session has been resumed" \ |
| 390 | -c "a session has been resumed" |
| 391 | |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 392 | 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] | 393 | "$P_SRV debug_level=4 tickets=1" \ |
| 394 | "$P_CLI debug_level=4 tickets=0 reconnect=1" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 395 | 0 \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 396 | -C "client hello, adding session ticket extension" \ |
| 397 | -S "found session ticket extension" \ |
| 398 | -S "server hello, adding session ticket extension" \ |
| 399 | -C "found session_ticket extension" \ |
| 400 | -C "parse new session ticket" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 401 | -s "session successfully restored from cache" \ |
| 402 | -S "session successfully restored from ticket" \ |
| 403 | -s "a session has been resumed" \ |
| 404 | -c "a session has been resumed" |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 405 | |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 406 | run_test "Session resume using cache #3 (cache_max=0)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 407 | "$P_SRV debug_level=4 tickets=0 cache_max=0" \ |
| 408 | "$P_CLI debug_level=4 tickets=0 reconnect=1" \ |
Manuel Pégourié-Gonnard | 4c88345 | 2014-02-20 21:32:41 +0100 | [diff] [blame] | 409 | 0 \ |
| 410 | -S "session successfully restored from cache" \ |
| 411 | -S "session successfully restored from ticket" \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 412 | -S "a session has been resumed" \ |
| 413 | -C "a session has been resumed" |
Manuel Pégourié-Gonnard | 4c88345 | 2014-02-20 21:32:41 +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 #4 (cache_max=1)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 416 | "$P_SRV debug_level=4 tickets=0 cache_max=1" \ |
| 417 | "$P_CLI debug_level=4 tickets=0 reconnect=1" \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 418 | 0 \ |
| 419 | -s "session successfully restored from cache" \ |
| 420 | -S "session successfully restored from ticket" \ |
| 421 | -s "a session has been resumed" \ |
| 422 | -c "a session has been resumed" |
| 423 | |
| 424 | run_test "Session resume using cache #5 (timemout > delay)" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 425 | "$P_SRV debug_level=4 tickets=0" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 426 | "$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] | 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 #6 (timeout < delay)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 434 | "$P_SRV debug_level=4 tickets=0 cache_timeout=1" \ |
| 435 | "$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] | 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 #7 (no timeout)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 443 | "$P_SRV debug_level=4 tickets=0 cache_timeout=0" \ |
| 444 | "$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] | 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 | |
Manuel Pégourié-Gonnard | db735f6 | 2014-02-25 17:57:59 +0100 | [diff] [blame] | 451 | run_test "Session resume using cache #8 (openssl client)" \ |
| 452 | "$P_SRV debug_level=4 tickets=0" \ |
| 453 | "($O_CLI -sess_out sess; $O_CLI -sess_in sess; rm -f sess)" \ |
| 454 | 0 \ |
| 455 | -s "found session ticket extension" \ |
| 456 | -S "server hello, adding session ticket extension" \ |
| 457 | -s "session successfully restored from cache" \ |
| 458 | -S "session successfully restored from ticket" \ |
| 459 | -s "a session has been resumed" |
| 460 | |
| 461 | run_test "Session resume using cache #9 (openssl server)" \ |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 462 | "$O_SRV" \ |
Manuel Pégourié-Gonnard | db735f6 | 2014-02-25 17:57:59 +0100 | [diff] [blame] | 463 | "$P_CLI debug_level=4 tickets=0 reconnect=1" \ |
| 464 | 0 \ |
| 465 | -C "found session_ticket extension" \ |
| 466 | -C "parse new session ticket" \ |
| 467 | -c "a session has been resumed" |
| 468 | |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 469 | # Tests for Max Fragment Length extension |
| 470 | |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 471 | run_test "Max fragment length #1" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 472 | "$P_SRV debug_level=4" \ |
| 473 | "$P_CLI debug_level=4" \ |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 474 | 0 \ |
| 475 | -C "client hello, adding max_fragment_length extension" \ |
| 476 | -S "found max fragment length extension" \ |
| 477 | -S "server hello, max_fragment_length extension" \ |
| 478 | -C "found max_fragment_length extension" |
| 479 | |
| 480 | run_test "Max fragment length #2" \ |
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 max_frag_len=4096" \ |
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 #3" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 490 | "$P_SRV debug_level=4 max_frag_len=4096" \ |
| 491 | "$P_CLI debug_level=4" \ |
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" |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 497 | |
| 498 | # Tests for renegotiation |
| 499 | |
| 500 | run_test "Renegotiation #0 (none)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 501 | "$P_SRV debug_level=4" \ |
| 502 | "$P_CLI debug_level=4" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 503 | 0 \ |
| 504 | -C "client hello, adding renegotiation extension" \ |
| 505 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 506 | -S "found renegotiation extension" \ |
| 507 | -s "server hello, secure renegotiation extension" \ |
| 508 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 509 | -C "=> renegotiate" \ |
| 510 | -S "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 511 | -S "write hello request" |
| 512 | |
| 513 | run_test "Renegotiation #1 (enabled, client-initiated)" \ |
Manuel Pégourié-Gonnard | 00d538f | 2014-03-31 10:44:40 +0200 | [diff] [blame] | 514 | "$P_SRV debug_level=4 renegotiation=1" \ |
| 515 | "$P_CLI debug_level=4 renegotiation=1 renegotiate=1" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 516 | 0 \ |
| 517 | -c "client hello, adding renegotiation extension" \ |
| 518 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 519 | -s "found renegotiation extension" \ |
| 520 | -s "server hello, secure renegotiation extension" \ |
| 521 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 522 | -c "=> renegotiate" \ |
| 523 | -s "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 524 | -S "write hello request" |
| 525 | |
| 526 | run_test "Renegotiation #2 (enabled, server-initiated)" \ |
Manuel Pégourié-Gonnard | 00d538f | 2014-03-31 10:44:40 +0200 | [diff] [blame] | 527 | "$P_SRV debug_level=4 renegotiation=1 renegotiate=1" \ |
| 528 | "$P_CLI debug_level=4 renegotiation=1" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 529 | 0 \ |
| 530 | -c "client hello, adding renegotiation extension" \ |
| 531 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 532 | -s "found renegotiation extension" \ |
| 533 | -s "server hello, secure renegotiation extension" \ |
| 534 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 535 | -c "=> renegotiate" \ |
| 536 | -s "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 537 | -s "write hello request" |
| 538 | |
| 539 | run_test "Renegotiation #3 (enabled, double)" \ |
Manuel Pégourié-Gonnard | 00d538f | 2014-03-31 10:44:40 +0200 | [diff] [blame] | 540 | "$P_SRV debug_level=4 renegotiation=1 renegotiate=1" \ |
| 541 | "$P_CLI debug_level=4 renegotiation=1 renegotiate=1" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 542 | 0 \ |
| 543 | -c "client hello, adding renegotiation extension" \ |
| 544 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 545 | -s "found renegotiation extension" \ |
| 546 | -s "server hello, secure renegotiation extension" \ |
| 547 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 548 | -c "=> renegotiate" \ |
| 549 | -s "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 550 | -s "write hello request" |
| 551 | |
| 552 | run_test "Renegotiation #4 (client-initiated, server-rejected)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 553 | "$P_SRV debug_level=4 renegotiation=0" \ |
Manuel Pégourié-Gonnard | 00d538f | 2014-03-31 10:44:40 +0200 | [diff] [blame] | 554 | "$P_CLI debug_level=4 renegotiation=1 renegotiate=1" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 555 | 1 \ |
| 556 | -c "client hello, adding renegotiation extension" \ |
| 557 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 558 | -S "found renegotiation extension" \ |
| 559 | -s "server hello, secure renegotiation extension" \ |
| 560 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 561 | -c "=> renegotiate" \ |
| 562 | -S "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 563 | -S "write hello request" |
| 564 | |
| 565 | run_test "Renegotiation #5 (server-initiated, client-rejected)" \ |
Manuel Pégourié-Gonnard | 00d538f | 2014-03-31 10:44:40 +0200 | [diff] [blame] | 566 | "$P_SRV debug_level=4 renegotiation=1 renegotiate=1" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 567 | "$P_CLI debug_level=4 renegotiation=0" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 568 | 0 \ |
| 569 | -C "client hello, adding renegotiation extension" \ |
| 570 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 571 | -S "found renegotiation extension" \ |
| 572 | -s "server hello, secure renegotiation extension" \ |
| 573 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 574 | -C "=> renegotiate" \ |
| 575 | -S "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 576 | -s "write hello request" \ |
| 577 | -s "SSL - An unexpected message was received from our peer" \ |
| 578 | -s "failed" |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 579 | |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 580 | # Tests for auth_mode |
| 581 | |
| 582 | run_test "Authentication #1 (server badcert, client required)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 583 | "$P_SRV crt_file=data_files/server5-badsign.crt \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 584 | key_file=data_files/server5.key" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 585 | "$P_CLI debug_level=2 auth_mode=required" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 586 | 1 \ |
| 587 | -c "x509_verify_cert() returned" \ |
| 588 | -c "! self-signed or not signed by a trusted CA" \ |
| 589 | -c "! ssl_handshake returned" \ |
| 590 | -c "X509 - Certificate verification failed" |
| 591 | |
| 592 | run_test "Authentication #2 (server badcert, client optional)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 593 | "$P_SRV crt_file=data_files/server5-badsign.crt \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 594 | key_file=data_files/server5.key" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 595 | "$P_CLI debug_level=2 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 596 | 0 \ |
| 597 | -c "x509_verify_cert() returned" \ |
| 598 | -c "! self-signed or not signed by a trusted CA" \ |
| 599 | -C "! ssl_handshake returned" \ |
| 600 | -C "X509 - Certificate verification failed" |
| 601 | |
| 602 | run_test "Authentication #3 (server badcert, client none)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 603 | "$P_SRV crt_file=data_files/server5-badsign.crt \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 604 | key_file=data_files/server5.key" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 605 | "$P_CLI debug_level=2 auth_mode=none" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 606 | 0 \ |
| 607 | -C "x509_verify_cert() returned" \ |
| 608 | -C "! self-signed or not signed by a trusted CA" \ |
| 609 | -C "! ssl_handshake returned" \ |
| 610 | -C "X509 - Certificate verification failed" |
| 611 | |
| 612 | run_test "Authentication #4 (client badcert, server required)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 613 | "$P_SRV debug_level=4 auth_mode=required" \ |
| 614 | "$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] | 615 | key_file=data_files/server5.key" \ |
| 616 | 1 \ |
| 617 | -S "skip write certificate request" \ |
| 618 | -C "skip parse certificate request" \ |
| 619 | -c "got a certificate request" \ |
| 620 | -C "skip write certificate" \ |
| 621 | -C "skip write certificate verify" \ |
| 622 | -S "skip parse certificate verify" \ |
| 623 | -s "x509_verify_cert() returned" \ |
| 624 | -S "! self-signed or not signed by a trusted CA" \ |
| 625 | -s "! ssl_handshake returned" \ |
| 626 | -c "! ssl_handshake returned" \ |
| 627 | -s "X509 - Certificate verification failed" |
| 628 | |
| 629 | run_test "Authentication #5 (client badcert, server optional)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 630 | "$P_SRV debug_level=4 auth_mode=optional" \ |
| 631 | "$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] | 632 | key_file=data_files/server5.key" \ |
| 633 | 0 \ |
| 634 | -S "skip write certificate request" \ |
| 635 | -C "skip parse certificate request" \ |
| 636 | -c "got a certificate request" \ |
| 637 | -C "skip write certificate" \ |
| 638 | -C "skip write certificate verify" \ |
| 639 | -S "skip parse certificate verify" \ |
| 640 | -s "x509_verify_cert() returned" \ |
| 641 | -s "! self-signed or not signed by a trusted CA" \ |
| 642 | -S "! ssl_handshake returned" \ |
| 643 | -C "! ssl_handshake returned" \ |
| 644 | -S "X509 - Certificate verification failed" |
| 645 | |
| 646 | run_test "Authentication #6 (client badcert, server none)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 647 | "$P_SRV debug_level=4 auth_mode=none" \ |
| 648 | "$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] | 649 | key_file=data_files/server5.key" \ |
| 650 | 0 \ |
| 651 | -s "skip write certificate request" \ |
| 652 | -C "skip parse certificate request" \ |
| 653 | -c "got no certificate request" \ |
| 654 | -c "skip write certificate" \ |
| 655 | -c "skip write certificate verify" \ |
| 656 | -s "skip parse certificate verify" \ |
| 657 | -S "x509_verify_cert() returned" \ |
| 658 | -S "! self-signed or not signed by a trusted CA" \ |
| 659 | -S "! ssl_handshake returned" \ |
| 660 | -C "! ssl_handshake returned" \ |
| 661 | -S "X509 - Certificate verification failed" |
| 662 | |
Manuel Pégourié-Gonnard | de515cc | 2014-02-27 14:58:26 +0100 | [diff] [blame] | 663 | run_test "Authentication #7 (client no cert, server optional)" \ |
| 664 | "$P_SRV debug_level=4 auth_mode=optional" \ |
| 665 | "$P_CLI debug_level=4 crt_file=none key_file=none" \ |
| 666 | 0 \ |
| 667 | -S "skip write certificate request" \ |
| 668 | -C "skip parse certificate request" \ |
| 669 | -c "got a certificate request" \ |
| 670 | -C "skip write certificate$" \ |
| 671 | -C "got no certificate to send" \ |
| 672 | -S "SSLv3 client has no certificate" \ |
| 673 | -c "skip write certificate verify" \ |
| 674 | -s "skip parse certificate verify" \ |
| 675 | -s "! no client certificate sent" \ |
| 676 | -S "! ssl_handshake returned" \ |
| 677 | -C "! ssl_handshake returned" \ |
| 678 | -S "X509 - Certificate verification failed" |
| 679 | |
| 680 | run_test "Authentication #8 (openssl client no cert, server optional)" \ |
| 681 | "$P_SRV debug_level=4 auth_mode=optional" \ |
| 682 | "$O_CLI" \ |
| 683 | 0 \ |
| 684 | -S "skip write certificate request" \ |
| 685 | -s "skip parse certificate verify" \ |
| 686 | -s "! no client certificate sent" \ |
| 687 | -S "! ssl_handshake returned" \ |
| 688 | -S "X509 - Certificate verification failed" |
| 689 | |
| 690 | run_test "Authentication #9 (client no cert, openssl server optional)" \ |
| 691 | "$O_SRV -verify 10" \ |
| 692 | "$P_CLI debug_level=4 crt_file=none key_file=none" \ |
| 693 | 0 \ |
| 694 | -C "skip parse certificate request" \ |
| 695 | -c "got a certificate request" \ |
| 696 | -C "skip write certificate$" \ |
| 697 | -c "skip write certificate verify" \ |
| 698 | -C "! ssl_handshake returned" |
| 699 | |
| 700 | run_test "Authentication #10 (client no cert, ssl3)" \ |
| 701 | "$P_SRV debug_level=4 auth_mode=optional force_version=ssl3" \ |
| 702 | "$P_CLI debug_level=4 crt_file=none key_file=none" \ |
| 703 | 0 \ |
| 704 | -S "skip write certificate request" \ |
| 705 | -C "skip parse certificate request" \ |
| 706 | -c "got a certificate request" \ |
| 707 | -C "skip write certificate$" \ |
| 708 | -c "skip write certificate verify" \ |
| 709 | -c "got no certificate to send" \ |
| 710 | -s "SSLv3 client has no certificate" \ |
| 711 | -s "skip parse certificate verify" \ |
| 712 | -s "! no client certificate sent" \ |
| 713 | -S "! ssl_handshake returned" \ |
| 714 | -C "! ssl_handshake returned" \ |
| 715 | -S "X509 - Certificate verification failed" |
| 716 | |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 717 | # tests for SNI |
| 718 | |
| 719 | run_test "SNI #0 (no SNI callback)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 720 | "$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] | 721 | 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] | 722 | "$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] | 723 | server_name=localhost" \ |
| 724 | 0 \ |
| 725 | -S "parse ServerName extension" \ |
| 726 | -c "issuer name *: C=NL, O=PolarSSL, CN=Polarssl Test EC CA" \ |
| 727 | -c "subject name *: C=NL, O=PolarSSL, CN=localhost" |
| 728 | |
| 729 | run_test "SNI #1 (matching cert 1)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 730 | "$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] | 731 | 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] | 732 | 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] | 733 | "$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] | 734 | server_name=localhost" \ |
| 735 | 0 \ |
| 736 | -s "parse ServerName extension" \ |
| 737 | -c "issuer name *: C=NL, O=PolarSSL, CN=PolarSSL Test CA" \ |
| 738 | -c "subject name *: C=NL, O=PolarSSL, CN=localhost" |
| 739 | |
| 740 | run_test "SNI #2 (matching cert 2)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 741 | "$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] | 742 | 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] | 743 | 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] | 744 | "$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] | 745 | server_name=polarssl.example" \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 746 | 0 \ |
| 747 | -s "parse ServerName extension" \ |
| 748 | -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] | 749 | -c "subject name *: C=NL, O=PolarSSL, CN=polarssl.example" |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 750 | |
| 751 | run_test "SNI #3 (no matching cert)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 752 | "$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] | 753 | 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] | 754 | 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] | 755 | "$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] | 756 | server_name=nonesuch.example" \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 757 | 1 \ |
| 758 | -s "parse ServerName extension" \ |
| 759 | -s "ssl_sni_wrapper() returned" \ |
| 760 | -s "ssl_handshake returned" \ |
| 761 | -c "ssl_handshake returned" \ |
| 762 | -c "SSL - A fatal alert message was received from our peer" |
| 763 | |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 764 | # Tests for non-blocking I/O: exercise a variety of handshake flows |
| 765 | |
| 766 | run_test "Non-blocking I/O #1 (basic handshake)" \ |
| 767 | "$P_SRV nbio=2 tickets=0 auth_mode=none" \ |
| 768 | "$P_CLI nbio=2 tickets=0" \ |
| 769 | 0 \ |
| 770 | -S "ssl_handshake returned" \ |
| 771 | -C "ssl_handshake returned" \ |
| 772 | -c "Read from server: .* bytes read" |
| 773 | |
| 774 | run_test "Non-blocking I/O #2 (client auth)" \ |
| 775 | "$P_SRV nbio=2 tickets=0 auth_mode=required" \ |
| 776 | "$P_CLI nbio=2 tickets=0" \ |
| 777 | 0 \ |
| 778 | -S "ssl_handshake returned" \ |
| 779 | -C "ssl_handshake returned" \ |
| 780 | -c "Read from server: .* bytes read" |
| 781 | |
| 782 | run_test "Non-blocking I/O #3 (ticket)" \ |
| 783 | "$P_SRV nbio=2 tickets=1 auth_mode=none" \ |
| 784 | "$P_CLI nbio=2 tickets=1" \ |
| 785 | 0 \ |
| 786 | -S "ssl_handshake returned" \ |
| 787 | -C "ssl_handshake returned" \ |
| 788 | -c "Read from server: .* bytes read" |
| 789 | |
| 790 | run_test "Non-blocking I/O #4 (ticket + client auth)" \ |
| 791 | "$P_SRV nbio=2 tickets=1 auth_mode=required" \ |
| 792 | "$P_CLI nbio=2 tickets=1" \ |
| 793 | 0 \ |
| 794 | -S "ssl_handshake returned" \ |
| 795 | -C "ssl_handshake returned" \ |
| 796 | -c "Read from server: .* bytes read" |
| 797 | |
| 798 | run_test "Non-blocking I/O #5 (ticket + client auth + resume)" \ |
| 799 | "$P_SRV nbio=2 tickets=1 auth_mode=required" \ |
| 800 | "$P_CLI nbio=2 tickets=1 reconnect=1" \ |
| 801 | 0 \ |
| 802 | -S "ssl_handshake returned" \ |
| 803 | -C "ssl_handshake returned" \ |
| 804 | -c "Read from server: .* bytes read" |
| 805 | |
| 806 | run_test "Non-blocking I/O #6 (ticket + resume)" \ |
| 807 | "$P_SRV nbio=2 tickets=1 auth_mode=none" \ |
| 808 | "$P_CLI nbio=2 tickets=1 reconnect=1" \ |
| 809 | 0 \ |
| 810 | -S "ssl_handshake returned" \ |
| 811 | -C "ssl_handshake returned" \ |
| 812 | -c "Read from server: .* bytes read" |
| 813 | |
| 814 | run_test "Non-blocking I/O #7 (session-id resume)" \ |
| 815 | "$P_SRV nbio=2 tickets=0 auth_mode=none" \ |
| 816 | "$P_CLI nbio=2 tickets=0 reconnect=1" \ |
| 817 | 0 \ |
| 818 | -S "ssl_handshake returned" \ |
| 819 | -C "ssl_handshake returned" \ |
| 820 | -c "Read from server: .* bytes read" |
| 821 | |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 822 | # Tests for version negotiation |
| 823 | |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 824 | run_test "Version check #1 (all -> 1.2)" \ |
| 825 | "$P_SRV" \ |
| 826 | "$P_CLI" \ |
| 827 | 0 \ |
| 828 | -S "ssl_handshake returned" \ |
| 829 | -C "ssl_handshake returned" \ |
| 830 | -s "Protocol is TLSv1.2" \ |
| 831 | -c "Protocol is TLSv1.2" |
| 832 | |
| 833 | run_test "Version check #2 (cli max 1.1 -> 1.1)" \ |
| 834 | "$P_SRV" \ |
| 835 | "$P_CLI max_version=tls1_1" \ |
| 836 | 0 \ |
| 837 | -S "ssl_handshake returned" \ |
| 838 | -C "ssl_handshake returned" \ |
| 839 | -s "Protocol is TLSv1.1" \ |
| 840 | -c "Protocol is TLSv1.1" |
| 841 | |
| 842 | run_test "Version check #3 (srv max 1.1 -> 1.1)" \ |
| 843 | "$P_SRV max_version=tls1_1" \ |
| 844 | "$P_CLI" \ |
| 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 #4 (cli+srv max 1.1 -> 1.1)" \ |
| 852 | "$P_SRV max_version=tls1_1" \ |
| 853 | "$P_CLI max_version=tls1_1" \ |
| 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 #5 (cli max 1.1, srv min 1.1 -> 1.1)" \ |
| 861 | "$P_SRV min_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 #6 (cli min 1.1, srv max 1.1 -> 1.1)" \ |
| 870 | "$P_SRV max_version=tls1_1" \ |
| 871 | "$P_CLI min_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 #7 (cli min 1.2, srv max 1.1 -> fail)" \ |
| 879 | "$P_SRV max_version=tls1_1" \ |
| 880 | "$P_CLI min_version=tls1_2" \ |
| 881 | 1 \ |
| 882 | -s "ssl_handshake returned" \ |
| 883 | -c "ssl_handshake returned" \ |
| 884 | -c "SSL - Handshake protocol not within min/max boundaries" |
| 885 | |
| 886 | run_test "Version check #8 (srv min 1.2, cli max 1.1 -> fail)" \ |
| 887 | "$P_SRV min_version=tls1_2" \ |
| 888 | "$P_CLI max_version=tls1_1" \ |
| 889 | 1 \ |
| 890 | -s "ssl_handshake returned" \ |
| 891 | -c "ssl_handshake returned" \ |
| 892 | -s "SSL - Handshake protocol not within min/max boundaries" |
| 893 | |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 894 | # Tests for ALPN extension |
| 895 | |
Manuel Pégourié-Gonnard | 83d8c73 | 2014-04-07 13:24:21 +0200 | [diff] [blame] | 896 | if grep '^#define POLARSSL_SSL_ALPN' $CONFIG_H >/dev/null; then |
| 897 | |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 898 | run_test "ALPN #0 (none)" \ |
| 899 | "$P_SRV debug_level=4" \ |
| 900 | "$P_CLI debug_level=4" \ |
| 901 | 0 \ |
| 902 | -C "client hello, adding alpn extension" \ |
| 903 | -S "found alpn extension" \ |
| 904 | -C "got an alert message, type: \\[2:120]" \ |
| 905 | -S "server hello, adding alpn extension" \ |
| 906 | -C "found alpn extension " \ |
| 907 | -C "Application Layer Protocol is" \ |
| 908 | -S "Application Layer Protocol is" |
| 909 | |
| 910 | run_test "ALPN #1 (client only)" \ |
| 911 | "$P_SRV debug_level=4" \ |
| 912 | "$P_CLI debug_level=4 alpn=abc,1234" \ |
| 913 | 0 \ |
| 914 | -c "client hello, adding alpn extension" \ |
| 915 | -s "found alpn extension" \ |
| 916 | -C "got an alert message, type: \\[2:120]" \ |
| 917 | -S "server hello, adding alpn extension" \ |
| 918 | -C "found alpn extension " \ |
| 919 | -c "Application Layer Protocol is (none)" \ |
| 920 | -S "Application Layer Protocol is" |
| 921 | |
| 922 | run_test "ALPN #2 (server only)" \ |
| 923 | "$P_SRV debug_level=4 alpn=abc,1234" \ |
| 924 | "$P_CLI debug_level=4" \ |
| 925 | 0 \ |
| 926 | -C "client hello, adding alpn extension" \ |
| 927 | -S "found alpn extension" \ |
| 928 | -C "got an alert message, type: \\[2:120]" \ |
| 929 | -S "server hello, adding alpn extension" \ |
| 930 | -C "found alpn extension " \ |
| 931 | -C "Application Layer Protocol is" \ |
| 932 | -s "Application Layer Protocol is (none)" |
| 933 | |
| 934 | run_test "ALPN #3 (both, common cli1-srv1)" \ |
| 935 | "$P_SRV debug_level=4 alpn=abc,1234" \ |
| 936 | "$P_CLI debug_level=4 alpn=abc,1234" \ |
| 937 | 0 \ |
| 938 | -c "client hello, adding alpn extension" \ |
| 939 | -s "found alpn extension" \ |
| 940 | -C "got an alert message, type: \\[2:120]" \ |
| 941 | -s "server hello, adding alpn extension" \ |
| 942 | -c "found alpn extension" \ |
| 943 | -c "Application Layer Protocol is abc" \ |
| 944 | -s "Application Layer Protocol is abc" |
| 945 | |
| 946 | run_test "ALPN #4 (both, common cli2-srv1)" \ |
| 947 | "$P_SRV debug_level=4 alpn=abc,1234" \ |
| 948 | "$P_CLI debug_level=4 alpn=1234,abc" \ |
| 949 | 0 \ |
| 950 | -c "client hello, adding alpn extension" \ |
| 951 | -s "found alpn extension" \ |
| 952 | -C "got an alert message, type: \\[2:120]" \ |
| 953 | -s "server hello, adding alpn extension" \ |
| 954 | -c "found alpn extension" \ |
| 955 | -c "Application Layer Protocol is abc" \ |
| 956 | -s "Application Layer Protocol is abc" |
| 957 | |
| 958 | run_test "ALPN #5 (both, common cli1-srv2)" \ |
| 959 | "$P_SRV debug_level=4 alpn=abc,1234" \ |
| 960 | "$P_CLI debug_level=4 alpn=1234,abcde" \ |
| 961 | 0 \ |
| 962 | -c "client hello, adding alpn extension" \ |
| 963 | -s "found alpn extension" \ |
| 964 | -C "got an alert message, type: \\[2:120]" \ |
| 965 | -s "server hello, adding alpn extension" \ |
| 966 | -c "found alpn extension" \ |
| 967 | -c "Application Layer Protocol is 1234" \ |
| 968 | -s "Application Layer Protocol is 1234" |
| 969 | |
| 970 | run_test "ALPN #6 (both, no common)" \ |
| 971 | "$P_SRV debug_level=4 alpn=abc,123" \ |
| 972 | "$P_CLI debug_level=4 alpn=1234,abcde" \ |
| 973 | 1 \ |
| 974 | -c "client hello, adding alpn extension" \ |
| 975 | -s "found alpn extension" \ |
| 976 | -c "got an alert message, type: \\[2:120]" \ |
| 977 | -S "server hello, adding alpn extension" \ |
| 978 | -C "found alpn extension" \ |
| 979 | -C "Application Layer Protocol is 1234" \ |
| 980 | -S "Application Layer Protocol is 1234" |
| 981 | |
Manuel Pégourié-Gonnard | 83d8c73 | 2014-04-07 13:24:21 +0200 | [diff] [blame] | 982 | fi |
| 983 | |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 984 | # Tests for keyUsage in leaf certificates, part 1: |
| 985 | # server-side certificate/suite selection |
| 986 | |
Manuel Pégourié-Gonnard | 17cde5f | 2014-05-22 14:42:39 +0200 | [diff] [blame] | 987 | run_test "keyUsage srv #1 (RSA, digitalSignature -> (EC)DHE-RSA)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 988 | "$P_SRV key_file=data_files/server2.key \ |
| 989 | crt_file=data_files/server2.ku-ds.crt" \ |
| 990 | "$P_CLI" \ |
| 991 | 0 \ |
Manuel Pégourié-Gonnard | 17cde5f | 2014-05-22 14:42:39 +0200 | [diff] [blame] | 992 | -c "Ciphersuite is TLS-[EC]*DHE-RSA-WITH-" |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 993 | |
| 994 | |
| 995 | run_test "keyUsage srv #2 (RSA, keyEncipherment -> RSA)" \ |
| 996 | "$P_SRV key_file=data_files/server2.key \ |
| 997 | crt_file=data_files/server2.ku-ke.crt" \ |
| 998 | "$P_CLI" \ |
| 999 | 0 \ |
| 1000 | -c "Ciphersuite is TLS-RSA-WITH-" |
| 1001 | |
| 1002 | # add psk to leave an option for client to send SERVERQUIT |
| 1003 | run_test "keyUsage srv #3 (RSA, keyAgreement -> fail)" \ |
| 1004 | "$P_SRV psk=abc123 key_file=data_files/server2.key \ |
| 1005 | crt_file=data_files/server2.ku-ka.crt" \ |
| 1006 | "$P_CLI psk=badbad" \ |
| 1007 | 1 \ |
| 1008 | -C "Ciphersuite is " |
| 1009 | |
| 1010 | run_test "keyUsage srv #4 (ECDSA, digitalSignature -> ECDHE-ECDSA)" \ |
| 1011 | "$P_SRV key_file=data_files/server5.key \ |
| 1012 | crt_file=data_files/server5.ku-ds.crt" \ |
| 1013 | "$P_CLI" \ |
| 1014 | 0 \ |
| 1015 | -c "Ciphersuite is TLS-ECDHE-ECDSA-WITH-" |
| 1016 | |
| 1017 | |
| 1018 | run_test "keyUsage srv #5 (ECDSA, keyAgreement -> ECDH-)" \ |
| 1019 | "$P_SRV key_file=data_files/server5.key \ |
| 1020 | crt_file=data_files/server5.ku-ka.crt" \ |
| 1021 | "$P_CLI" \ |
| 1022 | 0 \ |
| 1023 | -c "Ciphersuite is TLS-ECDH-" |
| 1024 | |
| 1025 | # add psk to leave an option for client to send SERVERQUIT |
| 1026 | run_test "keyUsage srv #6 (ECDSA, keyEncipherment -> fail)" \ |
| 1027 | "$P_SRV psk=abc123 key_file=data_files/server5.key \ |
| 1028 | crt_file=data_files/server5.ku-ke.crt" \ |
| 1029 | "$P_CLI psk=badbad" \ |
| 1030 | 1 \ |
| 1031 | -C "Ciphersuite is " |
| 1032 | |
| 1033 | # Tests for keyUsage in leaf certificates, part 2: |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1034 | # client-side checking of server cert |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1035 | |
| 1036 | run_test "keyUsage cli #1 (DigitalSignature+KeyEncipherment, RSA: OK)" \ |
| 1037 | "$O_SRV -key data_files/server2.key \ |
| 1038 | -cert data_files/server2.ku-ds_ke.crt" \ |
| 1039 | "$P_CLI debug_level=2 \ |
| 1040 | force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| 1041 | 0 \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1042 | -C "bad certificate (usage extensions)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1043 | -C "Processing of the Certificate handshake message failed" \ |
| 1044 | -c "Ciphersuite is TLS-" |
| 1045 | |
| 1046 | run_test "keyUsage cli #2 (DigitalSignature+KeyEncipherment, DHE-RSA: OK)" \ |
| 1047 | "$O_SRV -key data_files/server2.key \ |
| 1048 | -cert data_files/server2.ku-ds_ke.crt" \ |
| 1049 | "$P_CLI debug_level=2 \ |
| 1050 | force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA" \ |
| 1051 | 0 \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1052 | -C "bad certificate (usage extensions)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1053 | -C "Processing of the Certificate handshake message failed" \ |
| 1054 | -c "Ciphersuite is TLS-" |
| 1055 | |
| 1056 | run_test "keyUsage cli #3 (KeyEncipherment, RSA: OK)" \ |
| 1057 | "$O_SRV -key data_files/server2.key \ |
| 1058 | -cert data_files/server2.ku-ke.crt" \ |
| 1059 | "$P_CLI debug_level=2 \ |
| 1060 | force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| 1061 | 0 \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1062 | -C "bad certificate (usage extensions)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1063 | -C "Processing of the Certificate handshake message failed" \ |
| 1064 | -c "Ciphersuite is TLS-" |
| 1065 | |
| 1066 | run_test "keyUsage cli #4 (KeyEncipherment, DHE-RSA: fail)" \ |
| 1067 | "$O_SRV -key data_files/server2.key \ |
| 1068 | -cert data_files/server2.ku-ke.crt" \ |
| 1069 | "$P_CLI debug_level=2 \ |
| 1070 | force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA" \ |
| 1071 | 1 \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1072 | -c "bad certificate (usage extensions)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1073 | -c "Processing of the Certificate handshake message failed" \ |
| 1074 | -C "Ciphersuite is TLS-" |
| 1075 | |
| 1076 | run_test "keyUsage cli #5 (DigitalSignature, DHE-RSA: OK)" \ |
| 1077 | "$O_SRV -key data_files/server2.key \ |
| 1078 | -cert data_files/server2.ku-ds.crt" \ |
| 1079 | "$P_CLI debug_level=2 \ |
| 1080 | force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA" \ |
| 1081 | 0 \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1082 | -C "bad certificate (usage extensions)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1083 | -C "Processing of the Certificate handshake message failed" \ |
| 1084 | -c "Ciphersuite is TLS-" |
| 1085 | |
| 1086 | run_test "keyUsage cli #5 (DigitalSignature, RSA: fail)" \ |
| 1087 | "$O_SRV -key data_files/server2.key \ |
| 1088 | -cert data_files/server2.ku-ds.crt" \ |
| 1089 | "$P_CLI debug_level=2 \ |
| 1090 | force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| 1091 | 1 \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1092 | -c "bad certificate (usage extensions)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1093 | -c "Processing of the Certificate handshake message failed" \ |
| 1094 | -C "Ciphersuite is TLS-" |
| 1095 | |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1096 | # Tests for keyUsage in leaf certificates, part 3: |
| 1097 | # server-side checking of client cert |
| 1098 | |
| 1099 | run_test "keyUsage cli-auth #1 (RSA, DigitalSignature: OK)" \ |
| 1100 | "$P_SRV debug_level=2 auth_mode=optional" \ |
| 1101 | "$O_CLI -key data_files/server2.key \ |
| 1102 | -cert data_files/server2.ku-ds.crt" \ |
| 1103 | 0 \ |
| 1104 | -S "bad certificate (usage extensions)" \ |
| 1105 | -S "Processing of the Certificate handshake message failed" |
| 1106 | |
| 1107 | run_test "keyUsage cli-auth #2 (RSA, KeyEncipherment: fail (soft))" \ |
| 1108 | "$P_SRV debug_level=2 auth_mode=optional" \ |
| 1109 | "$O_CLI -key data_files/server2.key \ |
| 1110 | -cert data_files/server2.ku-ke.crt" \ |
| 1111 | 0 \ |
| 1112 | -s "bad certificate (usage extensions)" \ |
| 1113 | -S "Processing of the Certificate handshake message failed" |
| 1114 | |
| 1115 | run_test "keyUsage cli-auth #3 (RSA, KeyEncipherment: fail (hard))" \ |
| 1116 | "$P_SRV debug_level=2 auth_mode=required" \ |
| 1117 | "$O_CLI -key data_files/server2.key \ |
| 1118 | -cert data_files/server2.ku-ke.crt" \ |
| 1119 | 1 \ |
| 1120 | -s "bad certificate (usage extensions)" \ |
| 1121 | -s "Processing of the Certificate handshake message failed" |
| 1122 | |
| 1123 | run_test "keyUsage cli-auth #4 (ECDSA, DigitalSignature: OK)" \ |
| 1124 | "$P_SRV debug_level=2 auth_mode=optional" \ |
| 1125 | "$O_CLI -key data_files/server5.key \ |
| 1126 | -cert data_files/server5.ku-ds.crt" \ |
| 1127 | 0 \ |
| 1128 | -S "bad certificate (usage extensions)" \ |
| 1129 | -S "Processing of the Certificate handshake message failed" |
| 1130 | |
| 1131 | run_test "keyUsage cli-auth #5 (ECDSA, KeyAgreement: fail (soft))" \ |
| 1132 | "$P_SRV debug_level=2 auth_mode=optional" \ |
| 1133 | "$O_CLI -key data_files/server5.key \ |
| 1134 | -cert data_files/server5.ku-ka.crt" \ |
| 1135 | 0 \ |
| 1136 | -s "bad certificate (usage extensions)" \ |
| 1137 | -S "Processing of the Certificate handshake message failed" |
| 1138 | |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 1139 | # Tests for extendedKeyUsage, part 1: server-side certificate/suite selection |
| 1140 | |
| 1141 | run_test "extKeyUsage srv #1 (serverAuth -> OK)" \ |
| 1142 | "$P_SRV key_file=data_files/server5.key \ |
| 1143 | crt_file=data_files/server5.eku-srv.crt" \ |
| 1144 | "$P_CLI" \ |
| 1145 | 0 |
| 1146 | |
| 1147 | run_test "extKeyUsage srv #2 (serverAuth,clientAuth -> OK)" \ |
| 1148 | "$P_SRV key_file=data_files/server5.key \ |
| 1149 | crt_file=data_files/server5.eku-srv.crt" \ |
| 1150 | "$P_CLI" \ |
| 1151 | 0 |
| 1152 | |
| 1153 | run_test "extKeyUsage srv #3 (codeSign,anyEKU -> OK)" \ |
| 1154 | "$P_SRV key_file=data_files/server5.key \ |
| 1155 | crt_file=data_files/server5.eku-cs_any.crt" \ |
| 1156 | "$P_CLI" \ |
| 1157 | 0 |
| 1158 | |
| 1159 | # add psk to leave an option for client to send SERVERQUIT |
| 1160 | run_test "extKeyUsage srv #4 (codeSign -> fail)" \ |
| 1161 | "$P_SRV psk=abc123 key_file=data_files/server5.key \ |
| 1162 | crt_file=data_files/server5.eku-cli.crt" \ |
| 1163 | "$P_CLI psk=badbad" \ |
| 1164 | 1 |
| 1165 | |
| 1166 | # Tests for extendedKeyUsage, part 2: client-side checking of server cert |
| 1167 | |
| 1168 | run_test "extKeyUsage cli #1 (serverAuth -> OK)" \ |
| 1169 | "$O_SRV -key data_files/server5.key \ |
| 1170 | -cert data_files/server5.eku-srv.crt" \ |
| 1171 | "$P_CLI debug_level=2" \ |
| 1172 | 0 \ |
| 1173 | -C "bad certificate (usage extensions)" \ |
| 1174 | -C "Processing of the Certificate handshake message failed" \ |
| 1175 | -c "Ciphersuite is TLS-" |
| 1176 | |
| 1177 | run_test "extKeyUsage cli #2 (serverAuth,clientAuth -> OK)" \ |
| 1178 | "$O_SRV -key data_files/server5.key \ |
| 1179 | -cert data_files/server5.eku-srv_cli.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 #3 (codeSign,anyEKU -> OK)" \ |
| 1187 | "$O_SRV -key data_files/server5.key \ |
| 1188 | -cert data_files/server5.eku-cs_any.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 #4 (codeSign -> fail)" \ |
| 1196 | "$O_SRV -key data_files/server5.key \ |
| 1197 | -cert data_files/server5.eku-cs.crt" \ |
| 1198 | "$P_CLI debug_level=2" \ |
| 1199 | 1 \ |
| 1200 | -c "bad certificate (usage extensions)" \ |
| 1201 | -c "Processing of the Certificate handshake message failed" \ |
| 1202 | -C "Ciphersuite is TLS-" |
| 1203 | |
| 1204 | # Tests for extendedKeyUsage, part 3: server-side checking of client cert |
| 1205 | |
| 1206 | run_test "extKeyUsage cli-auth #1 (clientAuth -> OK)" \ |
| 1207 | "$P_SRV debug_level=2 auth_mode=optional" \ |
| 1208 | "$O_CLI -key data_files/server5.key \ |
| 1209 | -cert data_files/server5.eku-cli.crt" \ |
| 1210 | 0 \ |
| 1211 | -S "bad certificate (usage extensions)" \ |
| 1212 | -S "Processing of the Certificate handshake message failed" |
| 1213 | |
| 1214 | run_test "extKeyUsage cli-auth #2 (serverAuth,clientAuth -> OK)" \ |
| 1215 | "$P_SRV debug_level=2 auth_mode=optional" \ |
| 1216 | "$O_CLI -key data_files/server5.key \ |
| 1217 | -cert data_files/server5.eku-srv_cli.crt" \ |
| 1218 | 0 \ |
| 1219 | -S "bad certificate (usage extensions)" \ |
| 1220 | -S "Processing of the Certificate handshake message failed" |
| 1221 | |
| 1222 | run_test "extKeyUsage cli-auth #3 (codeSign,anyEKU -> OK)" \ |
| 1223 | "$P_SRV debug_level=2 auth_mode=optional" \ |
| 1224 | "$O_CLI -key data_files/server5.key \ |
| 1225 | -cert data_files/server5.eku-cs_any.crt" \ |
| 1226 | 0 \ |
| 1227 | -S "bad certificate (usage extensions)" \ |
| 1228 | -S "Processing of the Certificate handshake message failed" |
| 1229 | |
| 1230 | run_test "extKeyUsage cli-auth #4 (codeSign -> fail (soft))" \ |
| 1231 | "$P_SRV debug_level=2 auth_mode=optional" \ |
| 1232 | "$O_CLI -key data_files/server5.key \ |
| 1233 | -cert data_files/server5.eku-cs.crt" \ |
| 1234 | 0 \ |
| 1235 | -s "bad certificate (usage extensions)" \ |
| 1236 | -S "Processing of the Certificate handshake message failed" |
| 1237 | |
| 1238 | run_test "extKeyUsage cli-auth #4b (codeSign -> fail (hard))" \ |
| 1239 | "$P_SRV debug_level=2 auth_mode=required" \ |
| 1240 | "$O_CLI -key data_files/server5.key \ |
| 1241 | -cert data_files/server5.eku-cs.crt" \ |
| 1242 | 1 \ |
| 1243 | -s "bad certificate (usage extensions)" \ |
| 1244 | -s "Processing of the Certificate handshake message failed" |
| 1245 | |
Manuel Pégourié-Gonnard | 0cc7e31 | 2014-06-09 11:36:47 +0200 | [diff] [blame] | 1246 | # Tests for DHM parameters loading |
| 1247 | |
| 1248 | run_test "DHM parameters #0 (reference)" \ |
| 1249 | "$P_SRV" \ |
| 1250 | "$P_CLI force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA \ |
| 1251 | debug_level=3" \ |
| 1252 | 0 \ |
| 1253 | -c "value of 'DHM: P ' (2048 bits)" \ |
| 1254 | -c "value of 'DHM: G ' (2048 bits)" |
| 1255 | |
| 1256 | run_test "DHM parameters #1 (other parameters)" \ |
| 1257 | "$P_SRV dhm_file=data_files/dhparams.pem" \ |
| 1258 | "$P_CLI force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA \ |
| 1259 | debug_level=3" \ |
| 1260 | 0 \ |
| 1261 | -c "value of 'DHM: P ' (1024 bits)" \ |
| 1262 | -c "value of 'DHM: G ' (2 bits)" |
| 1263 | |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame^] | 1264 | # Tests for PSK callback |
| 1265 | |
| 1266 | run_test "PSK callback #0 (reference)" \ |
| 1267 | "$P_SRV psk=abc123 psk_identity=foo" \ |
| 1268 | "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \ |
| 1269 | psk_identity=foo psk=abc123" \ |
| 1270 | 0 \ |
| 1271 | -S "SSL - Unknown identity received" \ |
| 1272 | -S "SSL - Verification of the message MAC failed" |
| 1273 | |
| 1274 | run_test "PSK callback #1 (callback overrides other settings)" \ |
| 1275 | "$P_SRV psk=abc123 psk_identity=foo psk_list=abc,dead,def,beef" \ |
| 1276 | "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \ |
| 1277 | psk_identity=foo psk=abc123" \ |
| 1278 | 1 \ |
| 1279 | -s "SSL - Unknown identity received" \ |
| 1280 | -S "SSL - Verification of the message MAC failed" |
| 1281 | |
| 1282 | run_test "PSK callback #2 (first id matches)" \ |
| 1283 | "$P_SRV psk_list=abc,dead,def,beef" \ |
| 1284 | "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \ |
| 1285 | psk_identity=abc psk=dead" \ |
| 1286 | 0 \ |
| 1287 | -S "SSL - Unknown identity received" \ |
| 1288 | -S "SSL - Verification of the message MAC failed" |
| 1289 | |
| 1290 | run_test "PSK callback #3 (second id matches)" \ |
| 1291 | "$P_SRV psk_list=abc,dead,def,beef" \ |
| 1292 | "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \ |
| 1293 | psk_identity=def psk=beef" \ |
| 1294 | 0 \ |
| 1295 | -S "SSL - Unknown identity received" \ |
| 1296 | -S "SSL - Verification of the message MAC failed" |
| 1297 | |
| 1298 | run_test "PSK callback #4 (no match)" \ |
| 1299 | "$P_SRV psk_list=abc,dead,def,beef" \ |
| 1300 | "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \ |
| 1301 | psk_identity=ghi psk=beef" \ |
| 1302 | 1 \ |
| 1303 | -s "SSL - Unknown identity received" \ |
| 1304 | -S "SSL - Verification of the message MAC failed" |
| 1305 | |
| 1306 | run_test "PSK callback #5 (wrong key)" \ |
| 1307 | "$P_SRV psk_list=abc,dead,def,beef" \ |
| 1308 | "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \ |
| 1309 | psk_identity=abc psk=beef" \ |
| 1310 | 1 \ |
| 1311 | -S "SSL - Unknown identity received" \ |
| 1312 | -s "SSL - Verification of the message MAC failed" |
Manuel Pégourié-Gonnard | 0cc7e31 | 2014-06-09 11:36:47 +0200 | [diff] [blame] | 1313 | |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 1314 | # Final report |
| 1315 | |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 1316 | echo "------------------------------------------------------------------------" |
| 1317 | |
| 1318 | if [ $FAILS = 0 ]; then |
| 1319 | echo -n "PASSED" |
| 1320 | else |
| 1321 | echo -n "FAILED" |
| 1322 | fi |
| 1323 | PASSES=`echo $TESTS - $FAILS | bc` |
Manuel Pégourié-Gonnard | 4145b89 | 2014-02-24 13:20:14 +0100 | [diff] [blame] | 1324 | echo " ($PASSES / $TESTS tests)" |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 1325 | |
| 1326 | exit $FAILS |