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