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