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