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