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