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