Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # Test various options that are not covered by compat.sh |
| 4 | # |
| 5 | # Here the goal is not to cover every ciphersuite/version, but |
| 6 | # rather specific options (max fragment length, truncated hmac, etc) |
| 7 | # or procedures (session resumption from cache or ticket, renego, etc). |
| 8 | # |
| 9 | # Assumes all options are compiled in. |
| 10 | |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 11 | set -u |
| 12 | |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 13 | # default values, can be overriden by the environment |
| 14 | : ${P_SRV:=../programs/ssl/ssl_server2} |
| 15 | : ${P_CLI:=../programs/ssl/ssl_client2} |
Manuel Pégourié-Gonnard | 74faf3c | 2014-03-13 18:47:44 +0100 | [diff] [blame] | 16 | : ${OPENSSL_CMD:=openssl} # OPENSSL would conflict with the build system |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 17 | |
Manuel Pégourié-Gonnard | 74faf3c | 2014-03-13 18:47:44 +0100 | [diff] [blame] | 18 | O_SRV="$OPENSSL_CMD s_server -www -cert data_files/server5.crt -key data_files/server5.key" |
| 19 | O_CLI="echo 'GET / HTTP/1.0' | $OPENSSL_CMD s_client" |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 20 | |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 21 | TESTS=0 |
| 22 | FAILS=0 |
Manuel Pégourié-Gonnard | 6f4fbbb | 2014-08-14 14:31:29 +0200 | [diff] [blame] | 23 | SKIPS=0 |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 24 | |
Manuel Pégourié-Gonnard | 83d8c73 | 2014-04-07 13:24:21 +0200 | [diff] [blame] | 25 | CONFIG_H='../include/polarssl/config.h' |
| 26 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 27 | MEMCHECK=0 |
Manuel Pégourié-Gonnard | 417d46c | 2014-03-13 19:17:53 +0100 | [diff] [blame] | 28 | FILTER='.*' |
Manuel Pégourié-Gonnard | 6f4fbbb | 2014-08-14 14:31:29 +0200 | [diff] [blame] | 29 | EXCLUDE='^$' |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 30 | |
| 31 | print_usage() { |
| 32 | echo "Usage: $0 [options]" |
Manuel Pégourié-Gonnard | 417d46c | 2014-03-13 19:17:53 +0100 | [diff] [blame] | 33 | echo -e " -h|--help\tPrint this help." |
| 34 | echo -e " -m|--memcheck\tCheck memory leaks and errors." |
| 35 | echo -e " -f|--filter\tOnly matching tests are executed (default: '$FILTER')" |
| 36 | echo -e " -e|--exclude\tMatching tests are excluded (default: '$EXCLUDE')" |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 37 | } |
| 38 | |
| 39 | get_options() { |
| 40 | while [ $# -gt 0 ]; do |
| 41 | case "$1" in |
Manuel Pégourié-Gonnard | 417d46c | 2014-03-13 19:17:53 +0100 | [diff] [blame] | 42 | -f|--filter) |
| 43 | shift; FILTER=$1 |
| 44 | ;; |
| 45 | -e|--exclude) |
| 46 | shift; EXCLUDE=$1 |
| 47 | ;; |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 48 | -m|--memcheck) |
| 49 | MEMCHECK=1 |
| 50 | ;; |
| 51 | -h|--help) |
| 52 | print_usage |
| 53 | exit 0 |
| 54 | ;; |
| 55 | *) |
Paul Bakker | 1ebc0c5 | 2014-05-22 15:47:58 +0200 | [diff] [blame] | 56 | echo "Unknown argument: '$1'" |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 57 | print_usage |
| 58 | exit 1 |
| 59 | ;; |
| 60 | esac |
| 61 | shift |
| 62 | done |
| 63 | } |
| 64 | |
Manuel Pégourié-Gonnard | 6f4fbbb | 2014-08-14 14:31:29 +0200 | [diff] [blame] | 65 | # skip next test if OpenSSL can't send SSLv2 ClientHello |
| 66 | requires_openssl_with_sslv2() { |
| 67 | if [ -z "${OPENSSL_HAS_SSL2:-}" ]; then |
| 68 | if openssl ciphers -ssl2 >/dev/null 2>&1; then |
| 69 | OPENSSL_HAS_SSL2="YES" |
| 70 | else |
| 71 | OPENSSL_HAS_SSL2="NO" |
| 72 | fi |
| 73 | fi |
| 74 | if [ "$OPENSSL_HAS_SSL2" = "NO" ]; then |
| 75 | SKIP_NEXT="YES" |
| 76 | fi |
| 77 | } |
| 78 | |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 79 | # print_name <name> |
| 80 | print_name() { |
| 81 | echo -n "$1 " |
| 82 | LEN=`echo "$1" | wc -c` |
| 83 | LEN=`echo 72 - $LEN | bc` |
| 84 | for i in `seq 1 $LEN`; do echo -n '.'; done |
| 85 | echo -n ' ' |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 86 | |
| 87 | TESTS=`echo $TESTS + 1 | bc` |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 88 | } |
| 89 | |
| 90 | # fail <message> |
| 91 | fail() { |
| 92 | echo "FAIL" |
Manuel Pégourié-Gonnard | 3eec604 | 2014-02-27 15:37:24 +0100 | [diff] [blame] | 93 | echo " ! $1" |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 94 | |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 95 | cp $SRV_OUT o-srv-${TESTS}.log |
| 96 | cp $CLI_OUT o-cli-${TESTS}.log |
Manuel Pégourié-Gonnard | 3eec604 | 2014-02-27 15:37:24 +0100 | [diff] [blame] | 97 | 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] | 98 | |
| 99 | FAILS=`echo $FAILS + 1 | bc` |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 100 | } |
| 101 | |
Manuel Pégourié-Gonnard | 677884d | 2014-02-25 16:42:31 +0100 | [diff] [blame] | 102 | # is_polar <cmd_line> |
| 103 | is_polar() { |
| 104 | echo "$1" | grep 'ssl_server2\|ssl_client2' > /dev/null |
| 105 | } |
| 106 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 107 | # has_mem_err <log_file_name> |
| 108 | has_mem_err() { |
| 109 | if ( grep -F 'All heap blocks were freed -- no leaks are possible' "$1" && |
| 110 | grep -F 'ERROR SUMMARY: 0 errors from 0 contexts' "$1" ) > /dev/null |
| 111 | then |
| 112 | return 1 # false: does not have errors |
| 113 | else |
| 114 | return 0 # true: has errors |
| 115 | fi |
| 116 | } |
| 117 | |
Manuel Pégourié-Gonnard | 0c1ec47 | 2014-06-20 18:41:11 +0200 | [diff] [blame] | 118 | # wait for server to start: two versions depending on lsof availability |
| 119 | wait_server_start() { |
| 120 | if which lsof >/dev/null; then |
| 121 | # make sure we don't loop forever |
| 122 | ( sleep "$DOG_DELAY"; echo "SERVERSTART TIMEOUT"; kill $MAIN_PID ) & |
| 123 | WATCHDOG_PID=$! |
| 124 | |
| 125 | # make a tight loop, server usually takes less than 1 sec to start |
| 126 | until lsof -nbi TCP:"$PORT" | grep LISTEN >/dev/null; do :; done |
| 127 | |
| 128 | kill $WATCHDOG_PID |
| 129 | wait $WATCHDOG_PID |
| 130 | else |
| 131 | sleep "$START_DELAY" |
| 132 | fi |
| 133 | } |
| 134 | |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 135 | # 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] | 136 | # Options: -s pattern pattern that must be present in server output |
| 137 | # -c pattern pattern that must be present in client output |
| 138 | # -S pattern pattern that must be absent in server output |
| 139 | # -C pattern pattern that must be absent in client output |
| 140 | run_test() { |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 141 | NAME="$1" |
| 142 | SRV_CMD="$2" |
| 143 | CLI_CMD="$3" |
| 144 | CLI_EXPECT="$4" |
| 145 | shift 4 |
| 146 | |
Manuel Pégourié-Gonnard | 417d46c | 2014-03-13 19:17:53 +0100 | [diff] [blame] | 147 | if echo "$NAME" | grep "$FILTER" | grep -v "$EXCLUDE" >/dev/null; then : |
| 148 | else |
| 149 | return |
| 150 | fi |
| 151 | |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 152 | print_name "$NAME" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 153 | |
Manuel Pégourié-Gonnard | 6f4fbbb | 2014-08-14 14:31:29 +0200 | [diff] [blame] | 154 | # should we skip? |
| 155 | if [ "X$SKIP_NEXT" = "XYES" ]; then |
| 156 | SKIP_NEXT="NO" |
| 157 | echo "SKIP" |
| 158 | SKIPS=`echo $SKIPS + 1 | bc` |
| 159 | return |
| 160 | fi |
| 161 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 162 | # prepend valgrind to our commands if active |
| 163 | if [ "$MEMCHECK" -gt 0 ]; then |
| 164 | if is_polar "$SRV_CMD"; then |
| 165 | SRV_CMD="valgrind --leak-check=full $SRV_CMD" |
| 166 | fi |
| 167 | if is_polar "$CLI_CMD"; then |
| 168 | CLI_CMD="valgrind --leak-check=full $CLI_CMD" |
| 169 | fi |
| 170 | fi |
| 171 | |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 172 | # run the commands |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 173 | echo "$SRV_CMD" > $SRV_OUT |
| 174 | $SRV_CMD >> $SRV_OUT 2>&1 & |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 175 | SRV_PID=$! |
Manuel Pégourié-Gonnard | 0c1ec47 | 2014-06-20 18:41:11 +0200 | [diff] [blame] | 176 | wait_server_start |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 177 | echo "$CLI_CMD" > $CLI_OUT |
| 178 | eval "$CLI_CMD" >> $CLI_OUT 2>&1 |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 179 | CLI_EXIT=$? |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 180 | echo "EXIT: $CLI_EXIT" >> $CLI_OUT |
Manuel Pégourié-Gonnard | e01af4c | 2014-03-25 14:16:44 +0100 | [diff] [blame] | 181 | |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 182 | if is_polar "$SRV_CMD"; then |
Manuel Pégourié-Gonnard | 32f8f4d | 2014-05-29 11:31:20 +0200 | [diff] [blame] | 183 | # start watchdog in case SERVERQUIT fails |
Manuel Pégourié-Gonnard | 0c1ec47 | 2014-06-20 18:41:11 +0200 | [diff] [blame] | 184 | ( sleep "$DOG_DELAY"; echo "SERVERQUIT TIMEOUT"; kill $MAIN_PID ) & |
Manuel Pégourié-Gonnard | 32f8f4d | 2014-05-29 11:31:20 +0200 | [diff] [blame] | 185 | WATCHDOG_PID=$! |
| 186 | |
| 187 | # psk is useful when server only has bad certs |
Manuel Pégourié-Gonnard | 8066b81 | 2014-05-28 22:59:30 +0200 | [diff] [blame] | 188 | $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] | 189 | crt_file=data_files/cli2.crt key_file=data_files/cli2.key \ |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 190 | >/dev/null 2>&1 |
Manuel Pégourié-Gonnard | 32f8f4d | 2014-05-29 11:31:20 +0200 | [diff] [blame] | 191 | |
| 192 | wait $SRV_PID |
| 193 | kill $WATCHDOG_PID |
| 194 | wait $WATCHDOG_PID |
Manuel Pégourié-Gonnard | 677884d | 2014-02-25 16:42:31 +0100 | [diff] [blame] | 195 | else |
| 196 | kill $SRV_PID |
Manuel Pégourié-Gonnard | 32f8f4d | 2014-05-29 11:31:20 +0200 | [diff] [blame] | 197 | wait $SRV_PID |
Manuel Pégourié-Gonnard | 677884d | 2014-02-25 16:42:31 +0100 | [diff] [blame] | 198 | fi |
Manuel Pégourié-Gonnard | 677884d | 2014-02-25 16:42:31 +0100 | [diff] [blame] | 199 | |
| 200 | # 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] | 201 | # (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] | 202 | # expected client exit to incorrectly succeed in case of catastrophic |
| 203 | # failure) |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 204 | if is_polar "$SRV_CMD"; then |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 205 | if grep "Performing the SSL/TLS handshake" $SRV_OUT >/dev/null; then :; |
Manuel Pégourié-Gonnard | 677884d | 2014-02-25 16:42:31 +0100 | [diff] [blame] | 206 | else |
| 207 | fail "server failed to start" |
| 208 | return |
| 209 | fi |
| 210 | fi |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 211 | if is_polar "$CLI_CMD"; then |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 212 | if grep "Performing the SSL/TLS handshake" $CLI_OUT >/dev/null; then :; |
Manuel Pégourié-Gonnard | 677884d | 2014-02-25 16:42:31 +0100 | [diff] [blame] | 213 | else |
| 214 | fail "client failed to start" |
| 215 | return |
| 216 | fi |
| 217 | fi |
| 218 | |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 219 | # check server exit code |
| 220 | if [ $? != 0 ]; then |
| 221 | fail "server fail" |
| 222 | return |
| 223 | fi |
| 224 | |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 225 | # check client exit code |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 226 | if [ \( "$CLI_EXPECT" = 0 -a "$CLI_EXIT" != 0 \) -o \ |
| 227 | \( "$CLI_EXPECT" != 0 -a "$CLI_EXIT" = 0 \) ] |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 228 | then |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 229 | fail "bad client exit code" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 230 | return |
| 231 | fi |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 232 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 233 | # check other assertions |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 234 | while [ $# -gt 0 ] |
| 235 | do |
| 236 | case $1 in |
| 237 | "-s") |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 238 | if grep "$2" $SRV_OUT >/dev/null; then :; else |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 239 | fail "-s $2" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 240 | return |
| 241 | fi |
| 242 | ;; |
| 243 | |
| 244 | "-c") |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 245 | if grep "$2" $CLI_OUT >/dev/null; then :; else |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 246 | fail "-c $2" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 247 | return |
| 248 | fi |
| 249 | ;; |
| 250 | |
| 251 | "-S") |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 252 | if grep "$2" $SRV_OUT >/dev/null; then |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 253 | fail "-S $2" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 254 | return |
| 255 | fi |
| 256 | ;; |
| 257 | |
| 258 | "-C") |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 259 | if grep "$2" $CLI_OUT >/dev/null; then |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 260 | fail "-C $2" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 261 | return |
| 262 | fi |
| 263 | ;; |
| 264 | |
| 265 | *) |
Paul Bakker | 1ebc0c5 | 2014-05-22 15:47:58 +0200 | [diff] [blame] | 266 | echo "Unknown test: $1" >&2 |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 267 | exit 1 |
| 268 | esac |
| 269 | shift 2 |
| 270 | done |
| 271 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 272 | # check valgrind's results |
| 273 | if [ "$MEMCHECK" -gt 0 ]; then |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 274 | if is_polar "$SRV_CMD" && has_mem_err $SRV_OUT; then |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 275 | fail "Server has memory errors" |
| 276 | return |
| 277 | fi |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 278 | if is_polar "$CLI_CMD" && has_mem_err $CLI_OUT; then |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 279 | fail "Client has memory errors" |
| 280 | return |
| 281 | fi |
| 282 | fi |
| 283 | |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 284 | # if we're here, everything is ok |
| 285 | echo "PASS" |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 286 | rm -f $SRV_OUT $CLI_OUT |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 287 | } |
| 288 | |
Manuel Pégourié-Gonnard | a9062e9 | 2014-02-25 16:21:22 +0100 | [diff] [blame] | 289 | cleanup() { |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 290 | rm -f $CLI_OUT $SRV_OUT $SESSION |
Manuel Pégourié-Gonnard | 0c1ec47 | 2014-06-20 18:41:11 +0200 | [diff] [blame] | 291 | kill $SRV_PID >/dev/null 2>&1 |
| 292 | kill $WATCHDOG_PID >/dev/null 2>&1 |
Manuel Pégourié-Gonnard | a9062e9 | 2014-02-25 16:21:22 +0100 | [diff] [blame] | 293 | exit 1 |
| 294 | } |
| 295 | |
Manuel Pégourié-Gonnard | 9dea8bd | 2014-02-26 18:21:02 +0100 | [diff] [blame] | 296 | # |
| 297 | # MAIN |
| 298 | # |
| 299 | |
Manuel Pégourié-Gonnard | 913030c | 2014-03-28 10:12:38 +0100 | [diff] [blame] | 300 | get_options "$@" |
| 301 | |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 302 | # sanity checks, avoid an avalanche of errors |
| 303 | if [ ! -x "$P_SRV" ]; then |
| 304 | echo "Command '$P_SRV' is not an executable file" |
| 305 | exit 1 |
| 306 | fi |
| 307 | if [ ! -x "$P_CLI" ]; then |
| 308 | echo "Command '$P_CLI' is not an executable file" |
| 309 | exit 1 |
| 310 | fi |
Manuel Pégourié-Gonnard | 74faf3c | 2014-03-13 18:47:44 +0100 | [diff] [blame] | 311 | if which $OPENSSL_CMD >/dev/null 2>&1; then :; else |
| 312 | echo "Command '$OPENSSL_CMD' not found" |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 313 | exit 1 |
| 314 | fi |
| 315 | |
Manuel Pégourié-Gonnard | 32f8f4d | 2014-05-29 11:31:20 +0200 | [diff] [blame] | 316 | # used by watchdog |
| 317 | MAIN_PID="$$" |
| 318 | |
Manuel Pégourié-Gonnard | 0c1ec47 | 2014-06-20 18:41:11 +0200 | [diff] [blame] | 319 | # be more patient with valgrind |
| 320 | if [ "$MEMCHECK" -gt 0 ]; then |
| 321 | START_DELAY=3 |
| 322 | DOG_DELAY=30 |
| 323 | else |
| 324 | START_DELAY=1 |
| 325 | DOG_DELAY=10 |
| 326 | fi |
| 327 | |
Manuel Pégourié-Gonnard | 8066b81 | 2014-05-28 22:59:30 +0200 | [diff] [blame] | 328 | # Pick a "unique" port in the range 10000-19999. |
| 329 | PORT="0000$$" |
Manuel Pégourié-Gonnard | fab2a3c | 2014-06-16 16:54:36 +0200 | [diff] [blame] | 330 | PORT="1$(echo $PORT | tail -c 5)" |
Manuel Pégourié-Gonnard | 8066b81 | 2014-05-28 22:59:30 +0200 | [diff] [blame] | 331 | |
| 332 | # fix commands to use this port |
| 333 | P_SRV="$P_SRV server_port=$PORT" |
| 334 | P_CLI="$P_CLI server_port=$PORT" |
| 335 | O_SRV="$O_SRV -accept $PORT" |
| 336 | O_CLI="$O_CLI -connect localhost:$PORT" |
| 337 | |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 338 | # Also pick a unique name for intermediate files |
| 339 | SRV_OUT="srv_out.$$" |
| 340 | CLI_OUT="cli_out.$$" |
| 341 | SESSION="session.$$" |
| 342 | |
Manuel Pégourié-Gonnard | 6f4fbbb | 2014-08-14 14:31:29 +0200 | [diff] [blame] | 343 | SKIP_NEXT="NO" |
| 344 | |
Manuel Pégourié-Gonnard | a9062e9 | 2014-02-25 16:21:22 +0100 | [diff] [blame] | 345 | trap cleanup INT TERM HUP |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 346 | |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 347 | # Basic test |
| 348 | |
| 349 | run_test "Default" \ |
| 350 | "$P_SRV" \ |
| 351 | "$P_CLI" \ |
| 352 | 0 \ |
| 353 | -S "Last error was" \ |
| 354 | -C "Last error was" |
| 355 | |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 356 | # Test for SSLv2 ClientHello |
| 357 | |
Manuel Pégourié-Gonnard | 6f4fbbb | 2014-08-14 14:31:29 +0200 | [diff] [blame] | 358 | requires_openssl_with_sslv2 |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 359 | run_test "SSLv2 ClientHello #0 (reference)" \ |
| 360 | "$P_SRV debug_level=3" \ |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 361 | "$O_CLI -no_ssl2" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 362 | 0 \ |
| 363 | -S "parse client hello v2" \ |
| 364 | -S "ssl_handshake returned" |
| 365 | |
| 366 | # Adding a SSL2-only suite makes OpenSSL client send SSLv2 ClientHello |
Manuel Pégourié-Gonnard | 6f4fbbb | 2014-08-14 14:31:29 +0200 | [diff] [blame] | 367 | requires_openssl_with_sslv2 |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 368 | run_test "SSLv2 ClientHello #1 (actual test)" \ |
| 369 | "$P_SRV debug_level=3" \ |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 370 | "$O_CLI -cipher 'DES-CBC-MD5:ALL'" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 371 | 0 \ |
| 372 | -s "parse client hello v2" \ |
| 373 | -S "ssl_handshake returned" |
| 374 | |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 375 | # Tests for Truncated HMAC extension |
| 376 | |
| 377 | run_test "Truncated HMAC #0" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 378 | "$P_SRV debug_level=5" \ |
| 379 | "$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] | 380 | 0 \ |
| 381 | -s "dumping 'computed mac' (20 bytes)" |
| 382 | |
| 383 | run_test "Truncated HMAC #1" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 384 | "$P_SRV debug_level=5" \ |
| 385 | "$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] | 386 | 0 \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 387 | -s "dumping 'computed mac' (10 bytes)" |
| 388 | |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 389 | # Tests for Session Tickets |
| 390 | |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 391 | run_test "Session resume using tickets #1 (basic)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 392 | "$P_SRV debug_level=4 tickets=1" \ |
| 393 | "$P_CLI debug_level=4 tickets=1 reconnect=1" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 394 | 0 \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 395 | -c "client hello, adding session ticket extension" \ |
| 396 | -s "found session ticket extension" \ |
| 397 | -s "server hello, adding session ticket extension" \ |
| 398 | -c "found session_ticket extension" \ |
| 399 | -c "parse new session ticket" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 400 | -S "session successfully restored from cache" \ |
| 401 | -s "session successfully restored from ticket" \ |
| 402 | -s "a session has been resumed" \ |
| 403 | -c "a session has been resumed" |
| 404 | |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 405 | run_test "Session resume using tickets #2 (cache disabled)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 406 | "$P_SRV debug_level=4 tickets=1 cache_max=0" \ |
| 407 | "$P_CLI debug_level=4 tickets=1 reconnect=1" \ |
Manuel Pégourié-Gonnard | dbe1ee1 | 2014-02-21 09:18:13 +0100 | [diff] [blame] | 408 | 0 \ |
| 409 | -c "client hello, adding session ticket extension" \ |
| 410 | -s "found session ticket extension" \ |
| 411 | -s "server hello, adding session ticket extension" \ |
| 412 | -c "found session_ticket extension" \ |
| 413 | -c "parse new session ticket" \ |
| 414 | -S "session successfully restored from cache" \ |
| 415 | -s "session successfully restored from ticket" \ |
| 416 | -s "a session has been resumed" \ |
| 417 | -c "a session has been resumed" |
| 418 | |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 419 | run_test "Session resume using tickets #3 (timeout)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 420 | "$P_SRV debug_level=4 tickets=1 cache_max=0 ticket_timeout=1" \ |
| 421 | "$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] | 422 | 0 \ |
| 423 | -c "client hello, adding session ticket extension" \ |
| 424 | -s "found session ticket extension" \ |
| 425 | -s "server hello, adding session ticket extension" \ |
| 426 | -c "found session_ticket extension" \ |
| 427 | -c "parse new session ticket" \ |
| 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 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 433 | run_test "Session resume using tickets #4 (openssl server)" \ |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 434 | "$O_SRV" \ |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 435 | "$P_CLI debug_level=4 tickets=1 reconnect=1" \ |
| 436 | 0 \ |
| 437 | -c "client hello, adding session ticket extension" \ |
| 438 | -c "found session_ticket extension" \ |
| 439 | -c "parse new session ticket" \ |
| 440 | -c "a session has been resumed" |
| 441 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 442 | run_test "Session resume using tickets #5 (openssl client)" \ |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 443 | "$P_SRV debug_level=4 tickets=1" \ |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 444 | "( $O_CLI -sess_out $SESSION; \ |
| 445 | $O_CLI -sess_in $SESSION; \ |
| 446 | rm -f $SESSION )" \ |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 447 | 0 \ |
| 448 | -s "found session ticket extension" \ |
| 449 | -s "server hello, adding session ticket extension" \ |
| 450 | -S "session successfully restored from cache" \ |
| 451 | -s "session successfully restored from ticket" \ |
| 452 | -s "a session has been resumed" |
| 453 | |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 454 | # Tests for Session Resume based on session-ID and cache |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 455 | |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 456 | 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] | 457 | "$P_SRV debug_level=4 tickets=0" \ |
| 458 | "$P_CLI debug_level=4 tickets=1 reconnect=1" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 459 | 0 \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 460 | -c "client hello, adding session ticket extension" \ |
| 461 | -s "found session ticket extension" \ |
| 462 | -S "server hello, adding session ticket extension" \ |
| 463 | -C "found session_ticket extension" \ |
| 464 | -C "parse new session ticket" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 465 | -s "session successfully restored from cache" \ |
| 466 | -S "session successfully restored from ticket" \ |
| 467 | -s "a session has been resumed" \ |
| 468 | -c "a session has been resumed" |
| 469 | |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 470 | 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] | 471 | "$P_SRV debug_level=4 tickets=1" \ |
| 472 | "$P_CLI debug_level=4 tickets=0 reconnect=1" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 473 | 0 \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 474 | -C "client hello, adding session ticket extension" \ |
| 475 | -S "found session ticket extension" \ |
| 476 | -S "server hello, adding session ticket extension" \ |
| 477 | -C "found session_ticket extension" \ |
| 478 | -C "parse new session ticket" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 479 | -s "session successfully restored from cache" \ |
| 480 | -S "session successfully restored from ticket" \ |
| 481 | -s "a session has been resumed" \ |
| 482 | -c "a session has been resumed" |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 483 | |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 484 | run_test "Session resume using cache #3 (cache_max=0)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 485 | "$P_SRV debug_level=4 tickets=0 cache_max=0" \ |
| 486 | "$P_CLI debug_level=4 tickets=0 reconnect=1" \ |
Manuel Pégourié-Gonnard | 4c88345 | 2014-02-20 21:32:41 +0100 | [diff] [blame] | 487 | 0 \ |
| 488 | -S "session successfully restored from cache" \ |
| 489 | -S "session successfully restored from ticket" \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 490 | -S "a session has been resumed" \ |
| 491 | -C "a session has been resumed" |
Manuel Pégourié-Gonnard | 4c88345 | 2014-02-20 21:32:41 +0100 | [diff] [blame] | 492 | |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 493 | run_test "Session resume using cache #4 (cache_max=1)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 494 | "$P_SRV debug_level=4 tickets=0 cache_max=1" \ |
| 495 | "$P_CLI debug_level=4 tickets=0 reconnect=1" \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 496 | 0 \ |
| 497 | -s "session successfully restored from cache" \ |
| 498 | -S "session successfully restored from ticket" \ |
| 499 | -s "a session has been resumed" \ |
| 500 | -c "a session has been resumed" |
| 501 | |
| 502 | run_test "Session resume using cache #5 (timemout > delay)" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 503 | "$P_SRV debug_level=4 tickets=0" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 504 | "$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] | 505 | 0 \ |
| 506 | -s "session successfully restored from cache" \ |
| 507 | -S "session successfully restored from ticket" \ |
| 508 | -s "a session has been resumed" \ |
| 509 | -c "a session has been resumed" |
| 510 | |
| 511 | run_test "Session resume using cache #6 (timeout < delay)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 512 | "$P_SRV debug_level=4 tickets=0 cache_timeout=1" \ |
| 513 | "$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] | 514 | 0 \ |
| 515 | -S "session successfully restored from cache" \ |
| 516 | -S "session successfully restored from ticket" \ |
| 517 | -S "a session has been resumed" \ |
| 518 | -C "a session has been resumed" |
| 519 | |
| 520 | run_test "Session resume using cache #7 (no timeout)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 521 | "$P_SRV debug_level=4 tickets=0 cache_timeout=0" \ |
| 522 | "$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] | 523 | 0 \ |
| 524 | -s "session successfully restored from cache" \ |
| 525 | -S "session successfully restored from ticket" \ |
| 526 | -s "a session has been resumed" \ |
| 527 | -c "a session has been resumed" |
| 528 | |
Manuel Pégourié-Gonnard | db735f6 | 2014-02-25 17:57:59 +0100 | [diff] [blame] | 529 | run_test "Session resume using cache #8 (openssl client)" \ |
| 530 | "$P_SRV debug_level=4 tickets=0" \ |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 531 | "( $O_CLI -sess_out $SESSION; \ |
| 532 | $O_CLI -sess_in $SESSION; \ |
| 533 | rm -f $SESSION )" \ |
Manuel Pégourié-Gonnard | db735f6 | 2014-02-25 17:57:59 +0100 | [diff] [blame] | 534 | 0 \ |
| 535 | -s "found session ticket extension" \ |
| 536 | -S "server hello, adding session ticket extension" \ |
| 537 | -s "session successfully restored from cache" \ |
| 538 | -S "session successfully restored from ticket" \ |
| 539 | -s "a session has been resumed" |
| 540 | |
| 541 | run_test "Session resume using cache #9 (openssl server)" \ |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 542 | "$O_SRV" \ |
Manuel Pégourié-Gonnard | db735f6 | 2014-02-25 17:57:59 +0100 | [diff] [blame] | 543 | "$P_CLI debug_level=4 tickets=0 reconnect=1" \ |
| 544 | 0 \ |
| 545 | -C "found session_ticket extension" \ |
| 546 | -C "parse new session ticket" \ |
| 547 | -c "a session has been resumed" |
| 548 | |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 549 | # Tests for Max Fragment Length extension |
| 550 | |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 551 | run_test "Max fragment length #1" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 552 | "$P_SRV debug_level=4" \ |
| 553 | "$P_CLI debug_level=4" \ |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 554 | 0 \ |
| 555 | -C "client hello, adding max_fragment_length extension" \ |
| 556 | -S "found max fragment length extension" \ |
| 557 | -S "server hello, max_fragment_length extension" \ |
| 558 | -C "found max_fragment_length extension" |
| 559 | |
| 560 | run_test "Max fragment length #2" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 561 | "$P_SRV debug_level=4" \ |
| 562 | "$P_CLI debug_level=4 max_frag_len=4096" \ |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 563 | 0 \ |
| 564 | -c "client hello, adding max_fragment_length extension" \ |
| 565 | -s "found max fragment length extension" \ |
| 566 | -s "server hello, max_fragment_length extension" \ |
| 567 | -c "found max_fragment_length extension" |
| 568 | |
| 569 | run_test "Max fragment length #3" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 570 | "$P_SRV debug_level=4 max_frag_len=4096" \ |
| 571 | "$P_CLI debug_level=4" \ |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 572 | 0 \ |
| 573 | -C "client hello, adding max_fragment_length extension" \ |
| 574 | -S "found max fragment length extension" \ |
| 575 | -S "server hello, max_fragment_length extension" \ |
| 576 | -C "found max_fragment_length extension" |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 577 | |
| 578 | # Tests for renegotiation |
| 579 | |
| 580 | run_test "Renegotiation #0 (none)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 581 | "$P_SRV debug_level=4" \ |
| 582 | "$P_CLI debug_level=4" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 583 | 0 \ |
| 584 | -C "client hello, adding renegotiation extension" \ |
| 585 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 586 | -S "found renegotiation extension" \ |
| 587 | -s "server hello, secure renegotiation extension" \ |
| 588 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 589 | -C "=> renegotiate" \ |
| 590 | -S "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 591 | -S "write hello request" |
| 592 | |
| 593 | run_test "Renegotiation #1 (enabled, client-initiated)" \ |
Manuel Pégourié-Gonnard | 00d538f | 2014-03-31 10:44:40 +0200 | [diff] [blame] | 594 | "$P_SRV debug_level=4 renegotiation=1" \ |
| 595 | "$P_CLI debug_level=4 renegotiation=1 renegotiate=1" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 596 | 0 \ |
| 597 | -c "client hello, adding renegotiation extension" \ |
| 598 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 599 | -s "found renegotiation extension" \ |
| 600 | -s "server hello, secure renegotiation extension" \ |
| 601 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 602 | -c "=> renegotiate" \ |
| 603 | -s "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 604 | -S "write hello request" |
| 605 | |
| 606 | run_test "Renegotiation #2 (enabled, server-initiated)" \ |
Manuel Pégourié-Gonnard | 00d538f | 2014-03-31 10:44:40 +0200 | [diff] [blame] | 607 | "$P_SRV debug_level=4 renegotiation=1 renegotiate=1" \ |
| 608 | "$P_CLI debug_level=4 renegotiation=1" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 609 | 0 \ |
| 610 | -c "client hello, adding renegotiation extension" \ |
| 611 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 612 | -s "found renegotiation extension" \ |
| 613 | -s "server hello, secure renegotiation extension" \ |
| 614 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 615 | -c "=> renegotiate" \ |
| 616 | -s "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 617 | -s "write hello request" |
| 618 | |
| 619 | run_test "Renegotiation #3 (enabled, double)" \ |
Manuel Pégourié-Gonnard | 00d538f | 2014-03-31 10:44:40 +0200 | [diff] [blame] | 620 | "$P_SRV debug_level=4 renegotiation=1 renegotiate=1" \ |
| 621 | "$P_CLI debug_level=4 renegotiation=1 renegotiate=1" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 622 | 0 \ |
| 623 | -c "client hello, adding renegotiation extension" \ |
| 624 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 625 | -s "found renegotiation extension" \ |
| 626 | -s "server hello, secure renegotiation extension" \ |
| 627 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 628 | -c "=> renegotiate" \ |
| 629 | -s "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 630 | -s "write hello request" |
| 631 | |
| 632 | run_test "Renegotiation #4 (client-initiated, server-rejected)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 633 | "$P_SRV debug_level=4 renegotiation=0" \ |
Manuel Pégourié-Gonnard | 00d538f | 2014-03-31 10:44:40 +0200 | [diff] [blame] | 634 | "$P_CLI debug_level=4 renegotiation=1 renegotiate=1" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 635 | 1 \ |
| 636 | -c "client hello, adding renegotiation extension" \ |
| 637 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 638 | -S "found renegotiation extension" \ |
| 639 | -s "server hello, secure renegotiation extension" \ |
| 640 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 641 | -c "=> renegotiate" \ |
| 642 | -S "=> renegotiate" \ |
Manuel Pégourié-Gonnard | fae355e | 2014-07-04 14:32:27 +0200 | [diff] [blame] | 643 | -S "write hello request" \ |
| 644 | -c "SSL - An unexpected message was received from our peer" \ |
| 645 | -c "failed" |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 646 | |
Manuel Pégourié-Gonnard | fae355e | 2014-07-04 14:32:27 +0200 | [diff] [blame] | 647 | run_test "Renegotiation #5 (server-initiated, client-rejected, default)" \ |
Manuel Pégourié-Gonnard | 00d538f | 2014-03-31 10:44:40 +0200 | [diff] [blame] | 648 | "$P_SRV debug_level=4 renegotiation=1 renegotiate=1" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 649 | "$P_CLI debug_level=4 renegotiation=0" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 650 | 0 \ |
| 651 | -C "client hello, adding renegotiation extension" \ |
| 652 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 653 | -S "found renegotiation extension" \ |
| 654 | -s "server hello, secure renegotiation extension" \ |
| 655 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 656 | -C "=> renegotiate" \ |
| 657 | -S "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 658 | -s "write hello request" \ |
Manuel Pégourié-Gonnard | a9964db | 2014-07-03 19:29:16 +0200 | [diff] [blame] | 659 | -S "SSL - An unexpected message was received from our peer" \ |
| 660 | -S "failed" |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 661 | |
Manuel Pégourié-Gonnard | fae355e | 2014-07-04 14:32:27 +0200 | [diff] [blame] | 662 | run_test "Renegotiation #6 (server-initiated, client-rejected, not enforced)" \ |
| 663 | "$P_SRV debug_level=4 renegotiation=1 renegotiate=1 \ |
| 664 | renego_delay=-1" \ |
| 665 | "$P_CLI debug_level=4 renegotiation=0" \ |
| 666 | 0 \ |
| 667 | -C "client hello, adding renegotiation extension" \ |
| 668 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 669 | -S "found renegotiation extension" \ |
| 670 | -s "server hello, secure renegotiation extension" \ |
| 671 | -c "found renegotiation extension" \ |
| 672 | -C "=> renegotiate" \ |
| 673 | -S "=> renegotiate" \ |
| 674 | -s "write hello request" \ |
| 675 | -S "SSL - An unexpected message was received from our peer" \ |
| 676 | -S "failed" |
| 677 | |
| 678 | run_test "Renegotiation #7 (server-initiated, client-rejected, delay 1)" \ |
| 679 | "$P_SRV debug_level=4 renegotiation=1 renegotiate=1 \ |
| 680 | renego_delay=1" \ |
| 681 | "$P_CLI debug_level=4 renegotiation=0" \ |
| 682 | 0 \ |
| 683 | -C "client hello, adding renegotiation extension" \ |
| 684 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 685 | -S "found renegotiation extension" \ |
| 686 | -s "server hello, secure renegotiation extension" \ |
| 687 | -c "found renegotiation extension" \ |
| 688 | -C "=> renegotiate" \ |
| 689 | -S "=> renegotiate" \ |
| 690 | -s "write hello request" \ |
| 691 | -S "SSL - An unexpected message was received from our peer" \ |
| 692 | -S "failed" |
| 693 | |
| 694 | run_test "Renegotiation #8 (server-initiated, client-rejected, delay 0)" \ |
| 695 | "$P_SRV debug_level=4 renegotiation=1 renegotiate=1 \ |
| 696 | renego_delay=0" \ |
| 697 | "$P_CLI debug_level=4 renegotiation=0" \ |
| 698 | 0 \ |
| 699 | -C "client hello, adding renegotiation extension" \ |
| 700 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 701 | -S "found renegotiation extension" \ |
| 702 | -s "server hello, secure renegotiation extension" \ |
| 703 | -c "found renegotiation extension" \ |
| 704 | -C "=> renegotiate" \ |
| 705 | -S "=> renegotiate" \ |
| 706 | -s "write hello request" \ |
| 707 | -s "SSL - An unexpected message was received from our peer" \ |
| 708 | -s "failed" |
| 709 | |
| 710 | run_test "Renegotiation #9 (server-initiated, client-accepted, delay 0)" \ |
| 711 | "$P_SRV debug_level=4 renegotiation=1 renegotiate=1 \ |
| 712 | renego_delay=0" \ |
| 713 | "$P_CLI debug_level=4 renegotiation=1" \ |
| 714 | 0 \ |
| 715 | -c "client hello, adding renegotiation extension" \ |
| 716 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 717 | -s "found renegotiation extension" \ |
| 718 | -s "server hello, secure renegotiation extension" \ |
| 719 | -c "found renegotiation extension" \ |
| 720 | -c "=> renegotiate" \ |
| 721 | -s "=> renegotiate" \ |
| 722 | -s "write hello request" \ |
| 723 | -S "SSL - An unexpected message was received from our peer" \ |
| 724 | -S "failed" |
| 725 | |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 726 | # Tests for auth_mode |
| 727 | |
| 728 | run_test "Authentication #1 (server badcert, client required)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 729 | "$P_SRV crt_file=data_files/server5-badsign.crt \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 730 | 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=2 auth_mode=required" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 732 | 1 \ |
| 733 | -c "x509_verify_cert() returned" \ |
| 734 | -c "! self-signed or not signed by a trusted CA" \ |
| 735 | -c "! ssl_handshake returned" \ |
| 736 | -c "X509 - Certificate verification failed" |
| 737 | |
| 738 | run_test "Authentication #2 (server badcert, client optional)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 739 | "$P_SRV crt_file=data_files/server5-badsign.crt \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 740 | key_file=data_files/server5.key" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 741 | "$P_CLI debug_level=2 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 742 | 0 \ |
| 743 | -c "x509_verify_cert() returned" \ |
| 744 | -c "! self-signed or not signed by a trusted CA" \ |
| 745 | -C "! ssl_handshake returned" \ |
| 746 | -C "X509 - Certificate verification failed" |
| 747 | |
| 748 | run_test "Authentication #3 (server badcert, client none)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 749 | "$P_SRV crt_file=data_files/server5-badsign.crt \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 750 | key_file=data_files/server5.key" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 751 | "$P_CLI debug_level=2 auth_mode=none" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 752 | 0 \ |
| 753 | -C "x509_verify_cert() returned" \ |
| 754 | -C "! self-signed or not signed by a trusted CA" \ |
| 755 | -C "! ssl_handshake returned" \ |
| 756 | -C "X509 - Certificate verification failed" |
| 757 | |
| 758 | run_test "Authentication #4 (client badcert, server required)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 759 | "$P_SRV debug_level=4 auth_mode=required" \ |
| 760 | "$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] | 761 | key_file=data_files/server5.key" \ |
| 762 | 1 \ |
| 763 | -S "skip write certificate request" \ |
| 764 | -C "skip parse certificate request" \ |
| 765 | -c "got a certificate request" \ |
| 766 | -C "skip write certificate" \ |
| 767 | -C "skip write certificate verify" \ |
| 768 | -S "skip parse certificate verify" \ |
| 769 | -s "x509_verify_cert() returned" \ |
| 770 | -S "! self-signed or not signed by a trusted CA" \ |
| 771 | -s "! ssl_handshake returned" \ |
| 772 | -c "! ssl_handshake returned" \ |
| 773 | -s "X509 - Certificate verification failed" |
| 774 | |
| 775 | run_test "Authentication #5 (client badcert, server optional)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 776 | "$P_SRV debug_level=4 auth_mode=optional" \ |
| 777 | "$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] | 778 | key_file=data_files/server5.key" \ |
| 779 | 0 \ |
| 780 | -S "skip write certificate request" \ |
| 781 | -C "skip parse certificate request" \ |
| 782 | -c "got a certificate request" \ |
| 783 | -C "skip write certificate" \ |
| 784 | -C "skip write certificate verify" \ |
| 785 | -S "skip parse certificate verify" \ |
| 786 | -s "x509_verify_cert() returned" \ |
| 787 | -s "! self-signed or not signed by a trusted CA" \ |
| 788 | -S "! ssl_handshake returned" \ |
| 789 | -C "! ssl_handshake returned" \ |
| 790 | -S "X509 - Certificate verification failed" |
| 791 | |
| 792 | run_test "Authentication #6 (client badcert, server none)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 793 | "$P_SRV debug_level=4 auth_mode=none" \ |
| 794 | "$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] | 795 | key_file=data_files/server5.key" \ |
| 796 | 0 \ |
| 797 | -s "skip write certificate request" \ |
| 798 | -C "skip parse certificate request" \ |
| 799 | -c "got no certificate request" \ |
| 800 | -c "skip write certificate" \ |
| 801 | -c "skip write certificate verify" \ |
| 802 | -s "skip parse certificate verify" \ |
| 803 | -S "x509_verify_cert() returned" \ |
| 804 | -S "! self-signed or not signed by a trusted CA" \ |
| 805 | -S "! ssl_handshake returned" \ |
| 806 | -C "! ssl_handshake returned" \ |
| 807 | -S "X509 - Certificate verification failed" |
| 808 | |
Manuel Pégourié-Gonnard | de515cc | 2014-02-27 14:58:26 +0100 | [diff] [blame] | 809 | run_test "Authentication #7 (client no cert, server optional)" \ |
| 810 | "$P_SRV debug_level=4 auth_mode=optional" \ |
| 811 | "$P_CLI debug_level=4 crt_file=none key_file=none" \ |
| 812 | 0 \ |
| 813 | -S "skip write certificate request" \ |
| 814 | -C "skip parse certificate request" \ |
| 815 | -c "got a certificate request" \ |
| 816 | -C "skip write certificate$" \ |
| 817 | -C "got no certificate to send" \ |
| 818 | -S "SSLv3 client has no certificate" \ |
| 819 | -c "skip write certificate verify" \ |
| 820 | -s "skip parse certificate verify" \ |
| 821 | -s "! no client certificate sent" \ |
| 822 | -S "! ssl_handshake returned" \ |
| 823 | -C "! ssl_handshake returned" \ |
| 824 | -S "X509 - Certificate verification failed" |
| 825 | |
| 826 | run_test "Authentication #8 (openssl client no cert, server optional)" \ |
| 827 | "$P_SRV debug_level=4 auth_mode=optional" \ |
| 828 | "$O_CLI" \ |
| 829 | 0 \ |
| 830 | -S "skip write certificate request" \ |
| 831 | -s "skip parse certificate verify" \ |
| 832 | -s "! no client certificate sent" \ |
| 833 | -S "! ssl_handshake returned" \ |
| 834 | -S "X509 - Certificate verification failed" |
| 835 | |
| 836 | run_test "Authentication #9 (client no cert, openssl server optional)" \ |
| 837 | "$O_SRV -verify 10" \ |
| 838 | "$P_CLI debug_level=4 crt_file=none key_file=none" \ |
| 839 | 0 \ |
| 840 | -C "skip parse certificate request" \ |
| 841 | -c "got a certificate request" \ |
| 842 | -C "skip write certificate$" \ |
| 843 | -c "skip write certificate verify" \ |
| 844 | -C "! ssl_handshake returned" |
| 845 | |
| 846 | run_test "Authentication #10 (client no cert, ssl3)" \ |
| 847 | "$P_SRV debug_level=4 auth_mode=optional force_version=ssl3" \ |
| 848 | "$P_CLI debug_level=4 crt_file=none key_file=none" \ |
| 849 | 0 \ |
| 850 | -S "skip write certificate request" \ |
| 851 | -C "skip parse certificate request" \ |
| 852 | -c "got a certificate request" \ |
| 853 | -C "skip write certificate$" \ |
| 854 | -c "skip write certificate verify" \ |
| 855 | -c "got no certificate to send" \ |
| 856 | -s "SSLv3 client has no certificate" \ |
| 857 | -s "skip parse certificate verify" \ |
| 858 | -s "! no client certificate sent" \ |
| 859 | -S "! ssl_handshake returned" \ |
| 860 | -C "! ssl_handshake returned" \ |
| 861 | -S "X509 - Certificate verification failed" |
| 862 | |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 863 | # tests for SNI |
| 864 | |
| 865 | run_test "SNI #0 (no SNI callback)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 866 | "$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] | 867 | 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] | 868 | "$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] | 869 | server_name=localhost" \ |
| 870 | 0 \ |
| 871 | -S "parse ServerName extension" \ |
| 872 | -c "issuer name *: C=NL, O=PolarSSL, CN=Polarssl Test EC CA" \ |
| 873 | -c "subject name *: C=NL, O=PolarSSL, CN=localhost" |
| 874 | |
| 875 | run_test "SNI #1 (matching cert 1)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 876 | "$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] | 877 | 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] | 878 | 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] | 879 | "$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] | 880 | server_name=localhost" \ |
| 881 | 0 \ |
| 882 | -s "parse ServerName extension" \ |
| 883 | -c "issuer name *: C=NL, O=PolarSSL, CN=PolarSSL Test CA" \ |
| 884 | -c "subject name *: C=NL, O=PolarSSL, CN=localhost" |
| 885 | |
| 886 | run_test "SNI #2 (matching cert 2)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 887 | "$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] | 888 | 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] | 889 | 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] | 890 | "$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] | 891 | server_name=polarssl.example" \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 892 | 0 \ |
| 893 | -s "parse ServerName extension" \ |
| 894 | -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] | 895 | -c "subject name *: C=NL, O=PolarSSL, CN=polarssl.example" |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 896 | |
| 897 | run_test "SNI #3 (no matching cert)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 898 | "$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] | 899 | 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] | 900 | 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] | 901 | "$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] | 902 | server_name=nonesuch.example" \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 903 | 1 \ |
| 904 | -s "parse ServerName extension" \ |
| 905 | -s "ssl_sni_wrapper() returned" \ |
| 906 | -s "ssl_handshake returned" \ |
| 907 | -c "ssl_handshake returned" \ |
| 908 | -c "SSL - A fatal alert message was received from our peer" |
| 909 | |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 910 | # Tests for non-blocking I/O: exercise a variety of handshake flows |
| 911 | |
| 912 | run_test "Non-blocking I/O #1 (basic handshake)" \ |
| 913 | "$P_SRV nbio=2 tickets=0 auth_mode=none" \ |
| 914 | "$P_CLI nbio=2 tickets=0" \ |
| 915 | 0 \ |
| 916 | -S "ssl_handshake returned" \ |
| 917 | -C "ssl_handshake returned" \ |
| 918 | -c "Read from server: .* bytes read" |
| 919 | |
| 920 | run_test "Non-blocking I/O #2 (client auth)" \ |
| 921 | "$P_SRV nbio=2 tickets=0 auth_mode=required" \ |
| 922 | "$P_CLI nbio=2 tickets=0" \ |
| 923 | 0 \ |
| 924 | -S "ssl_handshake returned" \ |
| 925 | -C "ssl_handshake returned" \ |
| 926 | -c "Read from server: .* bytes read" |
| 927 | |
| 928 | run_test "Non-blocking I/O #3 (ticket)" \ |
| 929 | "$P_SRV nbio=2 tickets=1 auth_mode=none" \ |
| 930 | "$P_CLI nbio=2 tickets=1" \ |
| 931 | 0 \ |
| 932 | -S "ssl_handshake returned" \ |
| 933 | -C "ssl_handshake returned" \ |
| 934 | -c "Read from server: .* bytes read" |
| 935 | |
| 936 | run_test "Non-blocking I/O #4 (ticket + client auth)" \ |
| 937 | "$P_SRV nbio=2 tickets=1 auth_mode=required" \ |
| 938 | "$P_CLI nbio=2 tickets=1" \ |
| 939 | 0 \ |
| 940 | -S "ssl_handshake returned" \ |
| 941 | -C "ssl_handshake returned" \ |
| 942 | -c "Read from server: .* bytes read" |
| 943 | |
| 944 | run_test "Non-blocking I/O #5 (ticket + client auth + resume)" \ |
| 945 | "$P_SRV nbio=2 tickets=1 auth_mode=required" \ |
| 946 | "$P_CLI nbio=2 tickets=1 reconnect=1" \ |
| 947 | 0 \ |
| 948 | -S "ssl_handshake returned" \ |
| 949 | -C "ssl_handshake returned" \ |
| 950 | -c "Read from server: .* bytes read" |
| 951 | |
| 952 | run_test "Non-blocking I/O #6 (ticket + resume)" \ |
| 953 | "$P_SRV nbio=2 tickets=1 auth_mode=none" \ |
| 954 | "$P_CLI nbio=2 tickets=1 reconnect=1" \ |
| 955 | 0 \ |
| 956 | -S "ssl_handshake returned" \ |
| 957 | -C "ssl_handshake returned" \ |
| 958 | -c "Read from server: .* bytes read" |
| 959 | |
| 960 | run_test "Non-blocking I/O #7 (session-id resume)" \ |
| 961 | "$P_SRV nbio=2 tickets=0 auth_mode=none" \ |
| 962 | "$P_CLI nbio=2 tickets=0 reconnect=1" \ |
| 963 | 0 \ |
| 964 | -S "ssl_handshake returned" \ |
| 965 | -C "ssl_handshake returned" \ |
| 966 | -c "Read from server: .* bytes read" |
| 967 | |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 968 | # Tests for version negotiation |
| 969 | |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 970 | run_test "Version check #1 (all -> 1.2)" \ |
| 971 | "$P_SRV" \ |
| 972 | "$P_CLI" \ |
| 973 | 0 \ |
| 974 | -S "ssl_handshake returned" \ |
| 975 | -C "ssl_handshake returned" \ |
| 976 | -s "Protocol is TLSv1.2" \ |
| 977 | -c "Protocol is TLSv1.2" |
| 978 | |
| 979 | run_test "Version check #2 (cli max 1.1 -> 1.1)" \ |
| 980 | "$P_SRV" \ |
| 981 | "$P_CLI max_version=tls1_1" \ |
| 982 | 0 \ |
| 983 | -S "ssl_handshake returned" \ |
| 984 | -C "ssl_handshake returned" \ |
| 985 | -s "Protocol is TLSv1.1" \ |
| 986 | -c "Protocol is TLSv1.1" |
| 987 | |
| 988 | run_test "Version check #3 (srv max 1.1 -> 1.1)" \ |
| 989 | "$P_SRV max_version=tls1_1" \ |
| 990 | "$P_CLI" \ |
| 991 | 0 \ |
| 992 | -S "ssl_handshake returned" \ |
| 993 | -C "ssl_handshake returned" \ |
| 994 | -s "Protocol is TLSv1.1" \ |
| 995 | -c "Protocol is TLSv1.1" |
| 996 | |
| 997 | run_test "Version check #4 (cli+srv max 1.1 -> 1.1)" \ |
| 998 | "$P_SRV max_version=tls1_1" \ |
| 999 | "$P_CLI max_version=tls1_1" \ |
| 1000 | 0 \ |
| 1001 | -S "ssl_handshake returned" \ |
| 1002 | -C "ssl_handshake returned" \ |
| 1003 | -s "Protocol is TLSv1.1" \ |
| 1004 | -c "Protocol is TLSv1.1" |
| 1005 | |
| 1006 | run_test "Version check #5 (cli max 1.1, srv min 1.1 -> 1.1)" \ |
| 1007 | "$P_SRV min_version=tls1_1" \ |
| 1008 | "$P_CLI max_version=tls1_1" \ |
| 1009 | 0 \ |
| 1010 | -S "ssl_handshake returned" \ |
| 1011 | -C "ssl_handshake returned" \ |
| 1012 | -s "Protocol is TLSv1.1" \ |
| 1013 | -c "Protocol is TLSv1.1" |
| 1014 | |
| 1015 | run_test "Version check #6 (cli min 1.1, srv max 1.1 -> 1.1)" \ |
| 1016 | "$P_SRV max_version=tls1_1" \ |
| 1017 | "$P_CLI min_version=tls1_1" \ |
| 1018 | 0 \ |
| 1019 | -S "ssl_handshake returned" \ |
| 1020 | -C "ssl_handshake returned" \ |
| 1021 | -s "Protocol is TLSv1.1" \ |
| 1022 | -c "Protocol is TLSv1.1" |
| 1023 | |
| 1024 | run_test "Version check #7 (cli min 1.2, srv max 1.1 -> fail)" \ |
| 1025 | "$P_SRV max_version=tls1_1" \ |
| 1026 | "$P_CLI min_version=tls1_2" \ |
| 1027 | 1 \ |
| 1028 | -s "ssl_handshake returned" \ |
| 1029 | -c "ssl_handshake returned" \ |
| 1030 | -c "SSL - Handshake protocol not within min/max boundaries" |
| 1031 | |
| 1032 | run_test "Version check #8 (srv min 1.2, cli max 1.1 -> fail)" \ |
| 1033 | "$P_SRV min_version=tls1_2" \ |
| 1034 | "$P_CLI max_version=tls1_1" \ |
| 1035 | 1 \ |
| 1036 | -s "ssl_handshake returned" \ |
| 1037 | -c "ssl_handshake returned" \ |
| 1038 | -s "SSL - Handshake protocol not within min/max boundaries" |
| 1039 | |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 1040 | # Tests for ALPN extension |
| 1041 | |
Manuel Pégourié-Gonnard | 83d8c73 | 2014-04-07 13:24:21 +0200 | [diff] [blame] | 1042 | if grep '^#define POLARSSL_SSL_ALPN' $CONFIG_H >/dev/null; then |
| 1043 | |
Manuel Pégourié-Gonnard | f6521de | 2014-04-07 12:42:04 +0200 | [diff] [blame] | 1044 | run_test "ALPN #0 (none)" \ |
| 1045 | "$P_SRV debug_level=4" \ |
| 1046 | "$P_CLI debug_level=4" \ |
| 1047 | 0 \ |
| 1048 | -C "client hello, adding alpn extension" \ |
| 1049 | -S "found alpn extension" \ |
| 1050 | -C "got an alert message, type: \\[2:120]" \ |
| 1051 | -S "server hello, adding alpn extension" \ |
| 1052 | -C "found alpn extension " \ |
| 1053 | -C "Application Layer Protocol is" \ |
| 1054 | -S "Application Layer Protocol is" |
| 1055 | |
| 1056 | run_test "ALPN #1 (client only)" \ |
| 1057 | "$P_SRV debug_level=4" \ |
| 1058 | "$P_CLI debug_level=4 alpn=abc,1234" \ |
| 1059 | 0 \ |
| 1060 | -c "client hello, adding alpn extension" \ |
| 1061 | -s "found alpn extension" \ |
| 1062 | -C "got an alert message, type: \\[2:120]" \ |
| 1063 | -S "server hello, adding alpn extension" \ |
| 1064 | -C "found alpn extension " \ |
| 1065 | -c "Application Layer Protocol is (none)" \ |
| 1066 | -S "Application Layer Protocol is" |
| 1067 | |
| 1068 | run_test "ALPN #2 (server only)" \ |
| 1069 | "$P_SRV debug_level=4 alpn=abc,1234" \ |
| 1070 | "$P_CLI debug_level=4" \ |
| 1071 | 0 \ |
| 1072 | -C "client hello, adding alpn extension" \ |
| 1073 | -S "found alpn extension" \ |
| 1074 | -C "got an alert message, type: \\[2:120]" \ |
| 1075 | -S "server hello, adding alpn extension" \ |
| 1076 | -C "found alpn extension " \ |
| 1077 | -C "Application Layer Protocol is" \ |
| 1078 | -s "Application Layer Protocol is (none)" |
| 1079 | |
| 1080 | run_test "ALPN #3 (both, common cli1-srv1)" \ |
| 1081 | "$P_SRV debug_level=4 alpn=abc,1234" \ |
| 1082 | "$P_CLI debug_level=4 alpn=abc,1234" \ |
| 1083 | 0 \ |
| 1084 | -c "client hello, adding alpn extension" \ |
| 1085 | -s "found alpn extension" \ |
| 1086 | -C "got an alert message, type: \\[2:120]" \ |
| 1087 | -s "server hello, adding alpn extension" \ |
| 1088 | -c "found alpn extension" \ |
| 1089 | -c "Application Layer Protocol is abc" \ |
| 1090 | -s "Application Layer Protocol is abc" |
| 1091 | |
| 1092 | run_test "ALPN #4 (both, common cli2-srv1)" \ |
| 1093 | "$P_SRV debug_level=4 alpn=abc,1234" \ |
| 1094 | "$P_CLI debug_level=4 alpn=1234,abc" \ |
| 1095 | 0 \ |
| 1096 | -c "client hello, adding alpn extension" \ |
| 1097 | -s "found alpn extension" \ |
| 1098 | -C "got an alert message, type: \\[2:120]" \ |
| 1099 | -s "server hello, adding alpn extension" \ |
| 1100 | -c "found alpn extension" \ |
| 1101 | -c "Application Layer Protocol is abc" \ |
| 1102 | -s "Application Layer Protocol is abc" |
| 1103 | |
| 1104 | run_test "ALPN #5 (both, common cli1-srv2)" \ |
| 1105 | "$P_SRV debug_level=4 alpn=abc,1234" \ |
| 1106 | "$P_CLI debug_level=4 alpn=1234,abcde" \ |
| 1107 | 0 \ |
| 1108 | -c "client hello, adding alpn extension" \ |
| 1109 | -s "found alpn extension" \ |
| 1110 | -C "got an alert message, type: \\[2:120]" \ |
| 1111 | -s "server hello, adding alpn extension" \ |
| 1112 | -c "found alpn extension" \ |
| 1113 | -c "Application Layer Protocol is 1234" \ |
| 1114 | -s "Application Layer Protocol is 1234" |
| 1115 | |
| 1116 | run_test "ALPN #6 (both, no common)" \ |
| 1117 | "$P_SRV debug_level=4 alpn=abc,123" \ |
| 1118 | "$P_CLI debug_level=4 alpn=1234,abcde" \ |
| 1119 | 1 \ |
| 1120 | -c "client hello, adding alpn extension" \ |
| 1121 | -s "found alpn extension" \ |
| 1122 | -c "got an alert message, type: \\[2:120]" \ |
| 1123 | -S "server hello, adding alpn extension" \ |
| 1124 | -C "found alpn extension" \ |
| 1125 | -C "Application Layer Protocol is 1234" \ |
| 1126 | -S "Application Layer Protocol is 1234" |
| 1127 | |
Manuel Pégourié-Gonnard | 83d8c73 | 2014-04-07 13:24:21 +0200 | [diff] [blame] | 1128 | fi |
| 1129 | |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1130 | # Tests for keyUsage in leaf certificates, part 1: |
| 1131 | # server-side certificate/suite selection |
| 1132 | |
Manuel Pégourié-Gonnard | 17cde5f | 2014-05-22 14:42:39 +0200 | [diff] [blame] | 1133 | run_test "keyUsage srv #1 (RSA, digitalSignature -> (EC)DHE-RSA)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1134 | "$P_SRV key_file=data_files/server2.key \ |
| 1135 | crt_file=data_files/server2.ku-ds.crt" \ |
| 1136 | "$P_CLI" \ |
| 1137 | 0 \ |
Manuel Pégourié-Gonnard | 17cde5f | 2014-05-22 14:42:39 +0200 | [diff] [blame] | 1138 | -c "Ciphersuite is TLS-[EC]*DHE-RSA-WITH-" |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1139 | |
| 1140 | |
| 1141 | run_test "keyUsage srv #2 (RSA, keyEncipherment -> RSA)" \ |
| 1142 | "$P_SRV key_file=data_files/server2.key \ |
| 1143 | crt_file=data_files/server2.ku-ke.crt" \ |
| 1144 | "$P_CLI" \ |
| 1145 | 0 \ |
| 1146 | -c "Ciphersuite is TLS-RSA-WITH-" |
| 1147 | |
| 1148 | # add psk to leave an option for client to send SERVERQUIT |
| 1149 | run_test "keyUsage srv #3 (RSA, keyAgreement -> fail)" \ |
| 1150 | "$P_SRV psk=abc123 key_file=data_files/server2.key \ |
| 1151 | crt_file=data_files/server2.ku-ka.crt" \ |
| 1152 | "$P_CLI psk=badbad" \ |
| 1153 | 1 \ |
| 1154 | -C "Ciphersuite is " |
| 1155 | |
| 1156 | run_test "keyUsage srv #4 (ECDSA, digitalSignature -> ECDHE-ECDSA)" \ |
| 1157 | "$P_SRV key_file=data_files/server5.key \ |
| 1158 | crt_file=data_files/server5.ku-ds.crt" \ |
| 1159 | "$P_CLI" \ |
| 1160 | 0 \ |
| 1161 | -c "Ciphersuite is TLS-ECDHE-ECDSA-WITH-" |
| 1162 | |
| 1163 | |
| 1164 | run_test "keyUsage srv #5 (ECDSA, keyAgreement -> ECDH-)" \ |
| 1165 | "$P_SRV key_file=data_files/server5.key \ |
| 1166 | crt_file=data_files/server5.ku-ka.crt" \ |
| 1167 | "$P_CLI" \ |
| 1168 | 0 \ |
| 1169 | -c "Ciphersuite is TLS-ECDH-" |
| 1170 | |
| 1171 | # add psk to leave an option for client to send SERVERQUIT |
| 1172 | run_test "keyUsage srv #6 (ECDSA, keyEncipherment -> fail)" \ |
| 1173 | "$P_SRV psk=abc123 key_file=data_files/server5.key \ |
| 1174 | crt_file=data_files/server5.ku-ke.crt" \ |
| 1175 | "$P_CLI psk=badbad" \ |
| 1176 | 1 \ |
| 1177 | -C "Ciphersuite is " |
| 1178 | |
| 1179 | # Tests for keyUsage in leaf certificates, part 2: |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1180 | # client-side checking of server cert |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1181 | |
| 1182 | run_test "keyUsage cli #1 (DigitalSignature+KeyEncipherment, RSA: OK)" \ |
| 1183 | "$O_SRV -key data_files/server2.key \ |
| 1184 | -cert data_files/server2.ku-ds_ke.crt" \ |
| 1185 | "$P_CLI debug_level=2 \ |
| 1186 | force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| 1187 | 0 \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1188 | -C "bad certificate (usage extensions)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1189 | -C "Processing of the Certificate handshake message failed" \ |
| 1190 | -c "Ciphersuite is TLS-" |
| 1191 | |
| 1192 | run_test "keyUsage cli #2 (DigitalSignature+KeyEncipherment, DHE-RSA: OK)" \ |
| 1193 | "$O_SRV -key data_files/server2.key \ |
| 1194 | -cert data_files/server2.ku-ds_ke.crt" \ |
| 1195 | "$P_CLI debug_level=2 \ |
| 1196 | force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA" \ |
| 1197 | 0 \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1198 | -C "bad certificate (usage extensions)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1199 | -C "Processing of the Certificate handshake message failed" \ |
| 1200 | -c "Ciphersuite is TLS-" |
| 1201 | |
| 1202 | run_test "keyUsage cli #3 (KeyEncipherment, RSA: OK)" \ |
| 1203 | "$O_SRV -key data_files/server2.key \ |
| 1204 | -cert data_files/server2.ku-ke.crt" \ |
| 1205 | "$P_CLI debug_level=2 \ |
| 1206 | force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| 1207 | 0 \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1208 | -C "bad certificate (usage extensions)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1209 | -C "Processing of the Certificate handshake message failed" \ |
| 1210 | -c "Ciphersuite is TLS-" |
| 1211 | |
| 1212 | run_test "keyUsage cli #4 (KeyEncipherment, DHE-RSA: fail)" \ |
| 1213 | "$O_SRV -key data_files/server2.key \ |
| 1214 | -cert data_files/server2.ku-ke.crt" \ |
| 1215 | "$P_CLI debug_level=2 \ |
| 1216 | force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA" \ |
| 1217 | 1 \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1218 | -c "bad certificate (usage extensions)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1219 | -c "Processing of the Certificate handshake message failed" \ |
| 1220 | -C "Ciphersuite is TLS-" |
| 1221 | |
| 1222 | run_test "keyUsage cli #5 (DigitalSignature, DHE-RSA: OK)" \ |
| 1223 | "$O_SRV -key data_files/server2.key \ |
| 1224 | -cert data_files/server2.ku-ds.crt" \ |
| 1225 | "$P_CLI debug_level=2 \ |
| 1226 | force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA" \ |
| 1227 | 0 \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1228 | -C "bad certificate (usage extensions)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1229 | -C "Processing of the Certificate handshake message failed" \ |
| 1230 | -c "Ciphersuite is TLS-" |
| 1231 | |
| 1232 | run_test "keyUsage cli #5 (DigitalSignature, RSA: fail)" \ |
| 1233 | "$O_SRV -key data_files/server2.key \ |
| 1234 | -cert data_files/server2.ku-ds.crt" \ |
| 1235 | "$P_CLI debug_level=2 \ |
| 1236 | force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| 1237 | 1 \ |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1238 | -c "bad certificate (usage extensions)" \ |
Manuel Pégourié-Gonnard | 7f2a07d | 2014-04-09 09:50:57 +0200 | [diff] [blame] | 1239 | -c "Processing of the Certificate handshake message failed" \ |
| 1240 | -C "Ciphersuite is TLS-" |
| 1241 | |
Manuel Pégourié-Gonnard | a9db85d | 2014-04-09 14:53:05 +0200 | [diff] [blame] | 1242 | # Tests for keyUsage in leaf certificates, part 3: |
| 1243 | # server-side checking of client cert |
| 1244 | |
| 1245 | run_test "keyUsage cli-auth #1 (RSA, DigitalSignature: OK)" \ |
| 1246 | "$P_SRV debug_level=2 auth_mode=optional" \ |
| 1247 | "$O_CLI -key data_files/server2.key \ |
| 1248 | -cert data_files/server2.ku-ds.crt" \ |
| 1249 | 0 \ |
| 1250 | -S "bad certificate (usage extensions)" \ |
| 1251 | -S "Processing of the Certificate handshake message failed" |
| 1252 | |
| 1253 | run_test "keyUsage cli-auth #2 (RSA, KeyEncipherment: fail (soft))" \ |
| 1254 | "$P_SRV debug_level=2 auth_mode=optional" \ |
| 1255 | "$O_CLI -key data_files/server2.key \ |
| 1256 | -cert data_files/server2.ku-ke.crt" \ |
| 1257 | 0 \ |
| 1258 | -s "bad certificate (usage extensions)" \ |
| 1259 | -S "Processing of the Certificate handshake message failed" |
| 1260 | |
| 1261 | run_test "keyUsage cli-auth #3 (RSA, KeyEncipherment: fail (hard))" \ |
| 1262 | "$P_SRV debug_level=2 auth_mode=required" \ |
| 1263 | "$O_CLI -key data_files/server2.key \ |
| 1264 | -cert data_files/server2.ku-ke.crt" \ |
| 1265 | 1 \ |
| 1266 | -s "bad certificate (usage extensions)" \ |
| 1267 | -s "Processing of the Certificate handshake message failed" |
| 1268 | |
| 1269 | run_test "keyUsage cli-auth #4 (ECDSA, DigitalSignature: OK)" \ |
| 1270 | "$P_SRV debug_level=2 auth_mode=optional" \ |
| 1271 | "$O_CLI -key data_files/server5.key \ |
| 1272 | -cert data_files/server5.ku-ds.crt" \ |
| 1273 | 0 \ |
| 1274 | -S "bad certificate (usage extensions)" \ |
| 1275 | -S "Processing of the Certificate handshake message failed" |
| 1276 | |
| 1277 | run_test "keyUsage cli-auth #5 (ECDSA, KeyAgreement: fail (soft))" \ |
| 1278 | "$P_SRV debug_level=2 auth_mode=optional" \ |
| 1279 | "$O_CLI -key data_files/server5.key \ |
| 1280 | -cert data_files/server5.ku-ka.crt" \ |
| 1281 | 0 \ |
| 1282 | -s "bad certificate (usage extensions)" \ |
| 1283 | -S "Processing of the Certificate handshake message failed" |
| 1284 | |
Manuel Pégourié-Gonnard | 0408fd1 | 2014-04-11 11:06:22 +0200 | [diff] [blame] | 1285 | # Tests for extendedKeyUsage, part 1: server-side certificate/suite selection |
| 1286 | |
| 1287 | run_test "extKeyUsage srv #1 (serverAuth -> OK)" \ |
| 1288 | "$P_SRV key_file=data_files/server5.key \ |
| 1289 | crt_file=data_files/server5.eku-srv.crt" \ |
| 1290 | "$P_CLI" \ |
| 1291 | 0 |
| 1292 | |
| 1293 | run_test "extKeyUsage srv #2 (serverAuth,clientAuth -> OK)" \ |
| 1294 | "$P_SRV key_file=data_files/server5.key \ |
| 1295 | crt_file=data_files/server5.eku-srv.crt" \ |
| 1296 | "$P_CLI" \ |
| 1297 | 0 |
| 1298 | |
| 1299 | run_test "extKeyUsage srv #3 (codeSign,anyEKU -> OK)" \ |
| 1300 | "$P_SRV key_file=data_files/server5.key \ |
| 1301 | crt_file=data_files/server5.eku-cs_any.crt" \ |
| 1302 | "$P_CLI" \ |
| 1303 | 0 |
| 1304 | |
| 1305 | # add psk to leave an option for client to send SERVERQUIT |
| 1306 | run_test "extKeyUsage srv #4 (codeSign -> fail)" \ |
| 1307 | "$P_SRV psk=abc123 key_file=data_files/server5.key \ |
| 1308 | crt_file=data_files/server5.eku-cli.crt" \ |
| 1309 | "$P_CLI psk=badbad" \ |
| 1310 | 1 |
| 1311 | |
| 1312 | # Tests for extendedKeyUsage, part 2: client-side checking of server cert |
| 1313 | |
| 1314 | run_test "extKeyUsage cli #1 (serverAuth -> OK)" \ |
| 1315 | "$O_SRV -key data_files/server5.key \ |
| 1316 | -cert data_files/server5.eku-srv.crt" \ |
| 1317 | "$P_CLI debug_level=2" \ |
| 1318 | 0 \ |
| 1319 | -C "bad certificate (usage extensions)" \ |
| 1320 | -C "Processing of the Certificate handshake message failed" \ |
| 1321 | -c "Ciphersuite is TLS-" |
| 1322 | |
| 1323 | run_test "extKeyUsage cli #2 (serverAuth,clientAuth -> OK)" \ |
| 1324 | "$O_SRV -key data_files/server5.key \ |
| 1325 | -cert data_files/server5.eku-srv_cli.crt" \ |
| 1326 | "$P_CLI debug_level=2" \ |
| 1327 | 0 \ |
| 1328 | -C "bad certificate (usage extensions)" \ |
| 1329 | -C "Processing of the Certificate handshake message failed" \ |
| 1330 | -c "Ciphersuite is TLS-" |
| 1331 | |
| 1332 | run_test "extKeyUsage cli #3 (codeSign,anyEKU -> OK)" \ |
| 1333 | "$O_SRV -key data_files/server5.key \ |
| 1334 | -cert data_files/server5.eku-cs_any.crt" \ |
| 1335 | "$P_CLI debug_level=2" \ |
| 1336 | 0 \ |
| 1337 | -C "bad certificate (usage extensions)" \ |
| 1338 | -C "Processing of the Certificate handshake message failed" \ |
| 1339 | -c "Ciphersuite is TLS-" |
| 1340 | |
| 1341 | run_test "extKeyUsage cli #4 (codeSign -> fail)" \ |
| 1342 | "$O_SRV -key data_files/server5.key \ |
| 1343 | -cert data_files/server5.eku-cs.crt" \ |
| 1344 | "$P_CLI debug_level=2" \ |
| 1345 | 1 \ |
| 1346 | -c "bad certificate (usage extensions)" \ |
| 1347 | -c "Processing of the Certificate handshake message failed" \ |
| 1348 | -C "Ciphersuite is TLS-" |
| 1349 | |
| 1350 | # Tests for extendedKeyUsage, part 3: server-side checking of client cert |
| 1351 | |
| 1352 | run_test "extKeyUsage cli-auth #1 (clientAuth -> OK)" \ |
| 1353 | "$P_SRV debug_level=2 auth_mode=optional" \ |
| 1354 | "$O_CLI -key data_files/server5.key \ |
| 1355 | -cert data_files/server5.eku-cli.crt" \ |
| 1356 | 0 \ |
| 1357 | -S "bad certificate (usage extensions)" \ |
| 1358 | -S "Processing of the Certificate handshake message failed" |
| 1359 | |
| 1360 | run_test "extKeyUsage cli-auth #2 (serverAuth,clientAuth -> OK)" \ |
| 1361 | "$P_SRV debug_level=2 auth_mode=optional" \ |
| 1362 | "$O_CLI -key data_files/server5.key \ |
| 1363 | -cert data_files/server5.eku-srv_cli.crt" \ |
| 1364 | 0 \ |
| 1365 | -S "bad certificate (usage extensions)" \ |
| 1366 | -S "Processing of the Certificate handshake message failed" |
| 1367 | |
| 1368 | run_test "extKeyUsage cli-auth #3 (codeSign,anyEKU -> OK)" \ |
| 1369 | "$P_SRV debug_level=2 auth_mode=optional" \ |
| 1370 | "$O_CLI -key data_files/server5.key \ |
| 1371 | -cert data_files/server5.eku-cs_any.crt" \ |
| 1372 | 0 \ |
| 1373 | -S "bad certificate (usage extensions)" \ |
| 1374 | -S "Processing of the Certificate handshake message failed" |
| 1375 | |
| 1376 | run_test "extKeyUsage cli-auth #4 (codeSign -> fail (soft))" \ |
| 1377 | "$P_SRV debug_level=2 auth_mode=optional" \ |
| 1378 | "$O_CLI -key data_files/server5.key \ |
| 1379 | -cert data_files/server5.eku-cs.crt" \ |
| 1380 | 0 \ |
| 1381 | -s "bad certificate (usage extensions)" \ |
| 1382 | -S "Processing of the Certificate handshake message failed" |
| 1383 | |
| 1384 | run_test "extKeyUsage cli-auth #4b (codeSign -> fail (hard))" \ |
| 1385 | "$P_SRV debug_level=2 auth_mode=required" \ |
| 1386 | "$O_CLI -key data_files/server5.key \ |
| 1387 | -cert data_files/server5.eku-cs.crt" \ |
| 1388 | 1 \ |
| 1389 | -s "bad certificate (usage extensions)" \ |
| 1390 | -s "Processing of the Certificate handshake message failed" |
| 1391 | |
Manuel Pégourié-Gonnard | 0cc7e31 | 2014-06-09 11:36:47 +0200 | [diff] [blame] | 1392 | # Tests for DHM parameters loading |
| 1393 | |
| 1394 | run_test "DHM parameters #0 (reference)" \ |
| 1395 | "$P_SRV" \ |
| 1396 | "$P_CLI force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA \ |
| 1397 | debug_level=3" \ |
| 1398 | 0 \ |
| 1399 | -c "value of 'DHM: P ' (2048 bits)" \ |
| 1400 | -c "value of 'DHM: G ' (2048 bits)" |
| 1401 | |
| 1402 | run_test "DHM parameters #1 (other parameters)" \ |
| 1403 | "$P_SRV dhm_file=data_files/dhparams.pem" \ |
| 1404 | "$P_CLI force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA \ |
| 1405 | debug_level=3" \ |
| 1406 | 0 \ |
| 1407 | -c "value of 'DHM: P ' (1024 bits)" \ |
| 1408 | -c "value of 'DHM: G ' (2 bits)" |
| 1409 | |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 1410 | # Tests for PSK callback |
| 1411 | |
Manuel Pégourié-Gonnard | 10c3c9f | 2014-06-10 15:28:52 +0200 | [diff] [blame] | 1412 | run_test "PSK callback #0a (psk, no callback)" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 1413 | "$P_SRV psk=abc123 psk_identity=foo" \ |
| 1414 | "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \ |
| 1415 | psk_identity=foo psk=abc123" \ |
| 1416 | 0 \ |
Manuel Pégourié-Gonnard | 10c3c9f | 2014-06-10 15:28:52 +0200 | [diff] [blame] | 1417 | -S "SSL - The server has no ciphersuites in common" \ |
| 1418 | -S "SSL - Unknown identity received" \ |
| 1419 | -S "SSL - Verification of the message MAC failed" |
| 1420 | |
| 1421 | run_test "PSK callback #0b (no psk, no callback)" \ |
| 1422 | "$P_SRV" \ |
| 1423 | "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \ |
| 1424 | psk_identity=foo psk=abc123" \ |
| 1425 | 1 \ |
| 1426 | -s "SSL - The server has no ciphersuites in common" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 1427 | -S "SSL - Unknown identity received" \ |
| 1428 | -S "SSL - Verification of the message MAC failed" |
| 1429 | |
| 1430 | run_test "PSK callback #1 (callback overrides other settings)" \ |
| 1431 | "$P_SRV psk=abc123 psk_identity=foo psk_list=abc,dead,def,beef" \ |
| 1432 | "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \ |
| 1433 | psk_identity=foo psk=abc123" \ |
| 1434 | 1 \ |
Manuel Pégourié-Gonnard | 10c3c9f | 2014-06-10 15:28:52 +0200 | [diff] [blame] | 1435 | -S "SSL - The server has no ciphersuites in common" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 1436 | -s "SSL - Unknown identity received" \ |
| 1437 | -S "SSL - Verification of the message MAC failed" |
| 1438 | |
| 1439 | run_test "PSK callback #2 (first id matches)" \ |
| 1440 | "$P_SRV psk_list=abc,dead,def,beef" \ |
| 1441 | "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \ |
| 1442 | psk_identity=abc psk=dead" \ |
| 1443 | 0 \ |
Manuel Pégourié-Gonnard | 10c3c9f | 2014-06-10 15:28:52 +0200 | [diff] [blame] | 1444 | -S "SSL - The server has no ciphersuites in common" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 1445 | -S "SSL - Unknown identity received" \ |
| 1446 | -S "SSL - Verification of the message MAC failed" |
| 1447 | |
| 1448 | run_test "PSK callback #3 (second id matches)" \ |
| 1449 | "$P_SRV psk_list=abc,dead,def,beef" \ |
| 1450 | "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \ |
| 1451 | psk_identity=def psk=beef" \ |
| 1452 | 0 \ |
Manuel Pégourié-Gonnard | 10c3c9f | 2014-06-10 15:28:52 +0200 | [diff] [blame] | 1453 | -S "SSL - The server has no ciphersuites in common" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 1454 | -S "SSL - Unknown identity received" \ |
| 1455 | -S "SSL - Verification of the message MAC failed" |
| 1456 | |
| 1457 | run_test "PSK callback #4 (no match)" \ |
| 1458 | "$P_SRV psk_list=abc,dead,def,beef" \ |
| 1459 | "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \ |
| 1460 | psk_identity=ghi psk=beef" \ |
| 1461 | 1 \ |
Manuel Pégourié-Gonnard | 10c3c9f | 2014-06-10 15:28:52 +0200 | [diff] [blame] | 1462 | -S "SSL - The server has no ciphersuites in common" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 1463 | -s "SSL - Unknown identity received" \ |
| 1464 | -S "SSL - Verification of the message MAC failed" |
| 1465 | |
| 1466 | run_test "PSK callback #5 (wrong key)" \ |
| 1467 | "$P_SRV psk_list=abc,dead,def,beef" \ |
| 1468 | "$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \ |
| 1469 | psk_identity=abc psk=beef" \ |
| 1470 | 1 \ |
Manuel Pégourié-Gonnard | 10c3c9f | 2014-06-10 15:28:52 +0200 | [diff] [blame] | 1471 | -S "SSL - The server has no ciphersuites in common" \ |
Manuel Pégourié-Gonnard | a6781c9 | 2014-06-10 15:00:46 +0200 | [diff] [blame] | 1472 | -S "SSL - Unknown identity received" \ |
| 1473 | -s "SSL - Verification of the message MAC failed" |
Manuel Pégourié-Gonnard | 0cc7e31 | 2014-06-09 11:36:47 +0200 | [diff] [blame] | 1474 | |
Manuel Pégourié-Gonnard | 90805a8 | 2014-06-11 14:06:01 +0200 | [diff] [blame] | 1475 | # Tests for ciphersuites per version |
| 1476 | |
| 1477 | run_test "Per-version suites #1" \ |
| 1478 | "$P_SRV version_suites=TLS-RSA-WITH-3DES-EDE-CBC-SHA,TLS-RSA-WITH-RC4-128-SHA,TLS-RSA-WITH-AES-128-CBC-SHA,TLS-RSA-WITH-AES-128-GCM-SHA256" \ |
| 1479 | "$P_CLI force_version=ssl3" \ |
| 1480 | 0 \ |
| 1481 | -c "Ciphersuite is TLS-RSA-WITH-3DES-EDE-CBC-SHA" |
| 1482 | |
| 1483 | run_test "Per-version suites #2" \ |
| 1484 | "$P_SRV version_suites=TLS-RSA-WITH-3DES-EDE-CBC-SHA,TLS-RSA-WITH-RC4-128-SHA,TLS-RSA-WITH-AES-128-CBC-SHA,TLS-RSA-WITH-AES-128-GCM-SHA256" \ |
| 1485 | "$P_CLI force_version=tls1" \ |
| 1486 | 0 \ |
| 1487 | -c "Ciphersuite is TLS-RSA-WITH-RC4-128-SHA" |
| 1488 | |
| 1489 | run_test "Per-version suites #3" \ |
| 1490 | "$P_SRV version_suites=TLS-RSA-WITH-3DES-EDE-CBC-SHA,TLS-RSA-WITH-RC4-128-SHA,TLS-RSA-WITH-AES-128-CBC-SHA,TLS-RSA-WITH-AES-128-GCM-SHA256" \ |
| 1491 | "$P_CLI force_version=tls1_1" \ |
| 1492 | 0 \ |
| 1493 | -c "Ciphersuite is TLS-RSA-WITH-AES-128-CBC-SHA" |
| 1494 | |
| 1495 | run_test "Per-version suites #4" \ |
| 1496 | "$P_SRV version_suites=TLS-RSA-WITH-3DES-EDE-CBC-SHA,TLS-RSA-WITH-RC4-128-SHA,TLS-RSA-WITH-AES-128-CBC-SHA,TLS-RSA-WITH-AES-128-GCM-SHA256" \ |
| 1497 | "$P_CLI force_version=tls1_2" \ |
| 1498 | 0 \ |
| 1499 | -c "Ciphersuite is TLS-RSA-WITH-AES-128-GCM-SHA256" |
| 1500 | |
Manuel Pégourié-Gonnard | 95c0a63 | 2014-06-11 18:32:36 +0200 | [diff] [blame] | 1501 | # Tests for ssl_get_bytes_avail() |
| 1502 | |
| 1503 | run_test "ssl_get_bytes_avail #1 (no extra data)" \ |
| 1504 | "$P_SRV" \ |
| 1505 | "$P_CLI request_size=100" \ |
| 1506 | 0 \ |
| 1507 | -s "Read from client: 100 bytes read$" |
| 1508 | |
| 1509 | run_test "ssl_get_bytes_avail #2 (extra data)" \ |
| 1510 | "$P_SRV" \ |
| 1511 | "$P_CLI request_size=500" \ |
| 1512 | 0 \ |
| 1513 | -s "Read from client: 500 bytes read (.*+.*)" |
Manuel Pégourié-Gonnard | 90805a8 | 2014-06-11 14:06:01 +0200 | [diff] [blame] | 1514 | |
Manuel Pégourié-Gonnard | ee41503 | 2014-06-18 15:08:56 +0200 | [diff] [blame] | 1515 | # Tests for small packets |
| 1516 | |
| 1517 | run_test "Small packet SSLv3 BlockCipher" \ |
| 1518 | "$P_SRV" \ |
| 1519 | "$P_CLI request_size=1 force_version=ssl3 \ |
| 1520 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 1521 | 0 \ |
| 1522 | -s "Read from client: 1 bytes read" |
| 1523 | |
| 1524 | run_test "Small packet SSLv3 StreamCipher" \ |
| 1525 | "$P_SRV" \ |
| 1526 | "$P_CLI request_size=1 force_version=ssl3 \ |
| 1527 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 1528 | 0 \ |
| 1529 | -s "Read from client: 1 bytes read" |
| 1530 | |
| 1531 | run_test "Small packet TLS 1.0 BlockCipher" \ |
| 1532 | "$P_SRV" \ |
| 1533 | "$P_CLI request_size=1 force_version=tls1 \ |
| 1534 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 1535 | 0 \ |
| 1536 | -s "Read from client: 1 bytes read" |
| 1537 | |
| 1538 | run_test "Small packet TLS 1.0 BlockCipher truncated MAC" \ |
| 1539 | "$P_SRV" \ |
| 1540 | "$P_CLI request_size=1 force_version=tls1 \ |
| 1541 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA \ |
| 1542 | trunc_hmac=1" \ |
| 1543 | 0 \ |
| 1544 | -s "Read from client: 1 bytes read" |
| 1545 | |
| 1546 | run_test "Small packet TLS 1.0 StreamCipher truncated MAC" \ |
| 1547 | "$P_SRV" \ |
| 1548 | "$P_CLI request_size=1 force_version=tls1 \ |
| 1549 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \ |
| 1550 | trunc_hmac=1" \ |
| 1551 | 0 \ |
| 1552 | -s "Read from client: 1 bytes read" |
| 1553 | |
| 1554 | run_test "Small packet TLS 1.1 BlockCipher" \ |
| 1555 | "$P_SRV" \ |
| 1556 | "$P_CLI request_size=1 force_version=tls1_1 \ |
| 1557 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 1558 | 0 \ |
| 1559 | -s "Read from client: 1 bytes read" |
| 1560 | |
| 1561 | run_test "Small packet TLS 1.1 StreamCipher" \ |
| 1562 | "$P_SRV" \ |
| 1563 | "$P_CLI request_size=1 force_version=tls1_1 \ |
| 1564 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 1565 | 0 \ |
| 1566 | -s "Read from client: 1 bytes read" |
| 1567 | |
| 1568 | run_test "Small packet TLS 1.1 BlockCipher truncated MAC" \ |
| 1569 | "$P_SRV" \ |
| 1570 | "$P_CLI request_size=1 force_version=tls1_1 \ |
| 1571 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA \ |
| 1572 | trunc_hmac=1" \ |
| 1573 | 0 \ |
| 1574 | -s "Read from client: 1 bytes read" |
| 1575 | |
| 1576 | run_test "Small packet TLS 1.1 StreamCipher truncated MAC" \ |
| 1577 | "$P_SRV" \ |
| 1578 | "$P_CLI request_size=1 force_version=tls1_1 \ |
| 1579 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \ |
| 1580 | trunc_hmac=1" \ |
| 1581 | 0 \ |
| 1582 | -s "Read from client: 1 bytes read" |
| 1583 | |
| 1584 | run_test "Small packet TLS 1.2 BlockCipher" \ |
| 1585 | "$P_SRV" \ |
| 1586 | "$P_CLI request_size=1 force_version=tls1_2 \ |
| 1587 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 1588 | 0 \ |
| 1589 | -s "Read from client: 1 bytes read" |
| 1590 | |
| 1591 | run_test "Small packet TLS 1.2 BlockCipher larger MAC" \ |
| 1592 | "$P_SRV" \ |
| 1593 | "$P_CLI request_size=1 force_version=tls1_2 force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384" \ |
| 1594 | 0 \ |
| 1595 | -s "Read from client: 1 bytes read" |
| 1596 | |
| 1597 | run_test "Small packet TLS 1.2 BlockCipher truncated MAC" \ |
| 1598 | "$P_SRV" \ |
| 1599 | "$P_CLI request_size=1 force_version=tls1_2 \ |
| 1600 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA \ |
| 1601 | trunc_hmac=1" \ |
| 1602 | 0 \ |
| 1603 | -s "Read from client: 1 bytes read" |
| 1604 | |
| 1605 | run_test "Small packet TLS 1.2 StreamCipher" \ |
| 1606 | "$P_SRV" \ |
| 1607 | "$P_CLI request_size=1 force_version=tls1_2 \ |
| 1608 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 1609 | 0 \ |
| 1610 | -s "Read from client: 1 bytes read" |
| 1611 | |
| 1612 | run_test "Small packet TLS 1.2 StreamCipher truncated MAC" \ |
| 1613 | "$P_SRV" \ |
| 1614 | "$P_CLI request_size=1 force_version=tls1_2 \ |
| 1615 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \ |
| 1616 | trunc_hmac=1" \ |
| 1617 | 0 \ |
| 1618 | -s "Read from client: 1 bytes read" |
| 1619 | |
| 1620 | run_test "Small packet TLS 1.2 AEAD" \ |
| 1621 | "$P_SRV" \ |
| 1622 | "$P_CLI request_size=1 force_version=tls1_2 \ |
| 1623 | force_ciphersuite=TLS-RSA-WITH-AES-256-CCM" \ |
| 1624 | 0 \ |
| 1625 | -s "Read from client: 1 bytes read" |
| 1626 | |
| 1627 | run_test "Small packet TLS 1.2 AEAD shorter tag" \ |
| 1628 | "$P_SRV" \ |
| 1629 | "$P_CLI request_size=1 force_version=tls1_2 \ |
| 1630 | force_ciphersuite=TLS-RSA-WITH-AES-256-CCM-8" \ |
| 1631 | 0 \ |
| 1632 | -s "Read from client: 1 bytes read" |
| 1633 | |
Manuel Pégourié-Gonnard | 8920f69 | 2014-06-18 22:05:08 +0200 | [diff] [blame] | 1634 | # Test for large packets |
| 1635 | |
| 1636 | run_test "Large packet SSLv3 BlockCipher" \ |
| 1637 | "$P_SRV" \ |
| 1638 | "$P_CLI request_size=16384 force_version=ssl3 \ |
| 1639 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 1640 | 0 \ |
| 1641 | -s "Read from client: 16384 bytes read" |
| 1642 | |
| 1643 | run_test "Large packet SSLv3 StreamCipher" \ |
| 1644 | "$P_SRV" \ |
| 1645 | "$P_CLI request_size=16384 force_version=ssl3 \ |
| 1646 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 1647 | 0 \ |
| 1648 | -s "Read from client: 16384 bytes read" |
| 1649 | |
| 1650 | run_test "Large packet TLS 1.0 BlockCipher" \ |
| 1651 | "$P_SRV" \ |
| 1652 | "$P_CLI request_size=16384 force_version=tls1 \ |
| 1653 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 1654 | 0 \ |
| 1655 | -s "Read from client: 16384 bytes read" |
| 1656 | |
| 1657 | run_test "Large packet TLS 1.0 BlockCipher truncated MAC" \ |
| 1658 | "$P_SRV" \ |
| 1659 | "$P_CLI request_size=16384 force_version=tls1 \ |
| 1660 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA \ |
| 1661 | trunc_hmac=1" \ |
| 1662 | 0 \ |
| 1663 | -s "Read from client: 16384 bytes read" |
| 1664 | |
| 1665 | run_test "Large packet TLS 1.0 StreamCipher truncated MAC" \ |
| 1666 | "$P_SRV" \ |
| 1667 | "$P_CLI request_size=16384 force_version=tls1 \ |
| 1668 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \ |
| 1669 | trunc_hmac=1" \ |
| 1670 | 0 \ |
| 1671 | -s "Read from client: 16384 bytes read" |
| 1672 | |
| 1673 | run_test "Large packet TLS 1.1 BlockCipher" \ |
| 1674 | "$P_SRV" \ |
| 1675 | "$P_CLI request_size=16384 force_version=tls1_1 \ |
| 1676 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 1677 | 0 \ |
| 1678 | -s "Read from client: 16384 bytes read" |
| 1679 | |
| 1680 | run_test "Large packet TLS 1.1 StreamCipher" \ |
| 1681 | "$P_SRV" \ |
| 1682 | "$P_CLI request_size=16384 force_version=tls1_1 \ |
| 1683 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 1684 | 0 \ |
| 1685 | -s "Read from client: 16384 bytes read" |
| 1686 | |
| 1687 | run_test "Large packet TLS 1.1 BlockCipher truncated MAC" \ |
| 1688 | "$P_SRV" \ |
| 1689 | "$P_CLI request_size=16384 force_version=tls1_1 \ |
| 1690 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA \ |
| 1691 | trunc_hmac=1" \ |
| 1692 | 0 \ |
| 1693 | -s "Read from client: 16384 bytes read" |
| 1694 | |
| 1695 | run_test "Large packet TLS 1.1 StreamCipher truncated MAC" \ |
| 1696 | "$P_SRV" \ |
| 1697 | "$P_CLI request_size=16384 force_version=tls1_1 \ |
| 1698 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \ |
| 1699 | trunc_hmac=1" \ |
| 1700 | 0 \ |
| 1701 | -s "Read from client: 16384 bytes read" |
| 1702 | |
| 1703 | run_test "Large packet TLS 1.2 BlockCipher" \ |
| 1704 | "$P_SRV" \ |
| 1705 | "$P_CLI request_size=16384 force_version=tls1_2 \ |
| 1706 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \ |
| 1707 | 0 \ |
| 1708 | -s "Read from client: 16384 bytes read" |
| 1709 | |
| 1710 | run_test "Large packet TLS 1.2 BlockCipher larger MAC" \ |
| 1711 | "$P_SRV" \ |
| 1712 | "$P_CLI request_size=16384 force_version=tls1_2 force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384" \ |
| 1713 | 0 \ |
| 1714 | -s "Read from client: 16384 bytes read" |
| 1715 | |
| 1716 | run_test "Large packet TLS 1.2 BlockCipher truncated MAC" \ |
| 1717 | "$P_SRV" \ |
| 1718 | "$P_CLI request_size=16384 force_version=tls1_2 \ |
| 1719 | force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA \ |
| 1720 | trunc_hmac=1" \ |
| 1721 | 0 \ |
| 1722 | -s "Read from client: 16384 bytes read" |
| 1723 | |
| 1724 | run_test "Large packet TLS 1.2 StreamCipher" \ |
| 1725 | "$P_SRV" \ |
| 1726 | "$P_CLI request_size=16384 force_version=tls1_2 \ |
| 1727 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \ |
| 1728 | 0 \ |
| 1729 | -s "Read from client: 16384 bytes read" |
| 1730 | |
| 1731 | run_test "Large packet TLS 1.2 StreamCipher truncated MAC" \ |
| 1732 | "$P_SRV" \ |
| 1733 | "$P_CLI request_size=16384 force_version=tls1_2 \ |
| 1734 | force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \ |
| 1735 | trunc_hmac=1" \ |
| 1736 | 0 \ |
| 1737 | -s "Read from client: 16384 bytes read" |
| 1738 | |
| 1739 | run_test "Large packet TLS 1.2 AEAD" \ |
| 1740 | "$P_SRV" \ |
| 1741 | "$P_CLI request_size=16384 force_version=tls1_2 \ |
| 1742 | force_ciphersuite=TLS-RSA-WITH-AES-256-CCM" \ |
| 1743 | 0 \ |
| 1744 | -s "Read from client: 16384 bytes read" |
| 1745 | |
| 1746 | run_test "Large packet TLS 1.2 AEAD shorter tag" \ |
| 1747 | "$P_SRV" \ |
| 1748 | "$P_CLI request_size=16384 force_version=tls1_2 \ |
| 1749 | force_ciphersuite=TLS-RSA-WITH-AES-256-CCM-8" \ |
| 1750 | 0 \ |
| 1751 | -s "Read from client: 16384 bytes read" |
| 1752 | |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 1753 | # Final report |
| 1754 | |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 1755 | echo "------------------------------------------------------------------------" |
| 1756 | |
| 1757 | if [ $FAILS = 0 ]; then |
| 1758 | echo -n "PASSED" |
| 1759 | else |
| 1760 | echo -n "FAILED" |
| 1761 | fi |
| 1762 | PASSES=`echo $TESTS - $FAILS | bc` |
Manuel Pégourié-Gonnard | 6f4fbbb | 2014-08-14 14:31:29 +0200 | [diff] [blame] | 1763 | echo " ($PASSES / $TESTS tests ($SKIPS skipped))" |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 1764 | |
| 1765 | exit $FAILS |