| #!/bin/sh |
| |
| # ssl-opt.sh |
| # |
| # Copyright The Mbed TLS Contributors |
| # SPDX-License-Identifier: Apache-2.0 |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| # not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| # |
| # Purpose |
| # |
| # Executes tests to prove various TLS/SSL options and extensions. |
| # |
| # The goal is not to cover every ciphersuite/version, but instead to cover |
| # specific options (max fragment length, truncated hmac, etc) or procedures |
| # (session resumption from cache or ticket, renego, etc). |
| # |
| # The tests assume a build with default options, with exceptions expressed |
| # with a dependency. The tests focus on functionality and do not consider |
| # performance. |
| # |
| |
| set -u |
| |
| # Limit the size of each log to 10 GiB, in case of failures with this script |
| # where it may output seemingly unlimited length error logs. |
| ulimit -f 20971520 |
| |
| ORIGINAL_PWD=$PWD |
| if ! cd "$(dirname "$0")"; then |
| exit 125 |
| fi |
| |
| # default values, can be overridden by the environment |
| : ${P_SRV:=../programs/ssl/ssl_server2} |
| : ${P_CLI:=../programs/ssl/ssl_client2} |
| : ${P_PXY:=../programs/test/udp_proxy} |
| : ${OPENSSL_CMD:=openssl} # OPENSSL would conflict with the build system |
| : ${GNUTLS_CLI:=gnutls-cli} |
| : ${GNUTLS_SERV:=gnutls-serv} |
| : ${PERL:=perl} |
| |
| guess_config_name() { |
| if git diff --quiet ../include/mbedtls/config.h 2>/dev/null; then |
| echo "default" |
| else |
| echo "unknown" |
| fi |
| } |
| : ${MBEDTLS_TEST_OUTCOME_FILE=} |
| : ${MBEDTLS_TEST_CONFIGURATION:="$(guess_config_name)"} |
| : ${MBEDTLS_TEST_PLATFORM:="$(uname -s | tr -c \\n0-9A-Za-z _)-$(uname -m | tr -c \\n0-9A-Za-z _)"} |
| |
| O_SRV="$OPENSSL_CMD s_server -www -cert data_files/server5.crt -key data_files/server5.key" |
| O_CLI="echo 'GET / HTTP/1.0' | $OPENSSL_CMD s_client" |
| G_SRV="$GNUTLS_SERV --x509certfile data_files/server5.crt --x509keyfile data_files/server5.key" |
| G_CLI="echo 'GET / HTTP/1.0' | $GNUTLS_CLI --x509cafile data_files/test-ca_cat12.crt" |
| TCP_CLIENT="$PERL scripts/tcp_client.pl" |
| |
| # alternative versions of OpenSSL and GnuTLS (no default path) |
| |
| if [ -n "${OPENSSL_LEGACY:-}" ]; then |
| O_LEGACY_SRV="$OPENSSL_LEGACY s_server -www -cert data_files/server5.crt -key data_files/server5.key" |
| O_LEGACY_CLI="echo 'GET / HTTP/1.0' | $OPENSSL_LEGACY s_client" |
| else |
| O_LEGACY_SRV=false |
| O_LEGACY_CLI=false |
| fi |
| |
| if [ -n "${GNUTLS_NEXT_SERV:-}" ]; then |
| G_NEXT_SRV="$GNUTLS_NEXT_SERV --x509certfile data_files/server5.crt --x509keyfile data_files/server5.key" |
| else |
| G_NEXT_SRV=false |
| fi |
| |
| if [ -n "${GNUTLS_NEXT_CLI:-}" ]; then |
| G_NEXT_CLI="echo 'GET / HTTP/1.0' | $GNUTLS_NEXT_CLI --x509cafile data_files/test-ca_cat12.crt" |
| else |
| G_NEXT_CLI=false |
| fi |
| |
| TESTS=0 |
| FAILS=0 |
| SKIPS=0 |
| |
| CONFIG_H='../include/mbedtls/config.h' |
| |
| MEMCHECK=0 |
| FILTER='.*' |
| EXCLUDE='^$' |
| |
| SHOW_TEST_NUMBER=0 |
| RUN_TEST_NUMBER='' |
| |
| PRESERVE_LOGS=0 |
| |
| # Pick a "unique" server port in the range 10000-19999, and a proxy |
| # port which is this plus 10000. Each port number may be independently |
| # overridden by a command line option. |
| SRV_PORT=$(($$ % 10000 + 10000)) |
| PXY_PORT=$((SRV_PORT + 10000)) |
| |
| print_usage() { |
| echo "Usage: $0 [options]" |
| printf " -h|--help\tPrint this help.\n" |
| printf " -m|--memcheck\tCheck memory leaks and errors.\n" |
| printf " -f|--filter\tOnly matching tests are executed (substring or BRE)\n" |
| printf " -e|--exclude\tMatching tests are excluded (substring or BRE)\n" |
| printf " -n|--number\tExecute only numbered test (comma-separated, e.g. '245,256')\n" |
| printf " -s|--show-numbers\tShow test numbers in front of test names\n" |
| printf " -p|--preserve-logs\tPreserve logs of successful tests as well\n" |
| printf " --outcome-file\tFile where test outcomes are written\n" |
| printf " \t(default: \$MBEDTLS_TEST_OUTCOME_FILE, none if empty)\n" |
| printf " --port \tTCP/UDP port (default: randomish 1xxxx)\n" |
| printf " --proxy-port\tTCP/UDP proxy port (default: randomish 2xxxx)\n" |
| printf " --seed \tInteger seed value to use for this test run\n" |
| } |
| |
| get_options() { |
| while [ $# -gt 0 ]; do |
| case "$1" in |
| -f|--filter) |
| shift; FILTER=$1 |
| ;; |
| -e|--exclude) |
| shift; EXCLUDE=$1 |
| ;; |
| -m|--memcheck) |
| MEMCHECK=1 |
| ;; |
| -n|--number) |
| shift; RUN_TEST_NUMBER=$1 |
| ;; |
| -s|--show-numbers) |
| SHOW_TEST_NUMBER=1 |
| ;; |
| -p|--preserve-logs) |
| PRESERVE_LOGS=1 |
| ;; |
| --port) |
| shift; SRV_PORT=$1 |
| ;; |
| --proxy-port) |
| shift; PXY_PORT=$1 |
| ;; |
| --seed) |
| shift; SEED="$1" |
| ;; |
| -h|--help) |
| print_usage |
| exit 0 |
| ;; |
| *) |
| echo "Unknown argument: '$1'" |
| print_usage |
| exit 1 |
| ;; |
| esac |
| shift |
| done |
| } |
| |
| # Make the outcome file path relative to the original directory, not |
| # to .../tests |
| case "$MBEDTLS_TEST_OUTCOME_FILE" in |
| [!/]*) |
| MBEDTLS_TEST_OUTCOME_FILE="$ORIGINAL_PWD/$MBEDTLS_TEST_OUTCOME_FILE" |
| ;; |
| esac |
| |
| # Read boolean configuration options from config.h for easy and quick |
| # testing. Skip non-boolean options (with something other than spaces |
| # and a comment after "#define SYMBOL"). The variable contains a |
| # space-separated list of symbols. |
| CONFIGS_ENABLED=" $(<"$CONFIG_H" \ |
| sed -n 's!^ *#define *\([A-Za-z][0-9A-Z_a-z]*\) *\(/*\)*!\1!p' | |
| tr '\n' ' ')" |
| |
| # Skip next test; use this macro to skip tests which are legitimate |
| # in theory and expected to be re-introduced at some point, but |
| # aren't expected to succeed at the moment due to problems outside |
| # our control (such as bugs in other TLS implementations). |
| skip_next_test() { |
| SKIP_NEXT="YES" |
| } |
| |
| # skip next test if the flag is not enabled in config.h |
| requires_config_enabled() { |
| case $CONFIGS_ENABLED in |
| *" $1 "*) :;; |
| *) SKIP_NEXT="YES";; |
| esac |
| } |
| |
| # skip next test if the flag is enabled in config.h |
| requires_config_disabled() { |
| case $CONFIGS_ENABLED in |
| *" $1 "*) SKIP_NEXT="YES";; |
| esac |
| } |
| |
| get_config_value_or_default() { |
| # This function uses the query_config command line option to query the |
| # required Mbed TLS compile time configuration from the ssl_server2 |
| # program. The command will always return a success value if the |
| # configuration is defined and the value will be printed to stdout. |
| # |
| # Note that if the configuration is not defined or is defined to nothing, |
| # the output of this function will be an empty string. |
| ${P_SRV} "query_config=${1}" |
| } |
| |
| requires_config_value_at_least() { |
| VAL="$( get_config_value_or_default "$1" )" |
| if [ -z "$VAL" ]; then |
| # Should never happen |
| echo "Mbed TLS configuration $1 is not defined" |
| exit 1 |
| elif [ "$VAL" -lt "$2" ]; then |
| SKIP_NEXT="YES" |
| fi |
| } |
| |
| requires_config_value_at_most() { |
| VAL=$( get_config_value_or_default "$1" ) |
| if [ -z "$VAL" ]; then |
| # Should never happen |
| echo "Mbed TLS configuration $1 is not defined" |
| exit 1 |
| elif [ "$VAL" -gt "$2" ]; then |
| SKIP_NEXT="YES" |
| fi |
| } |
| |
| # Space-separated list of ciphersuites supported by this build of |
| # Mbed TLS. |
| P_CIPHERSUITES=" $($P_CLI --help 2>/dev/null | |
| grep TLS- | |
| tr -s ' \n' ' ')" |
| requires_ciphersuite_enabled() { |
| case $P_CIPHERSUITES in |
| *" $1 "*) :;; |
| *) SKIP_NEXT="YES";; |
| esac |
| } |
| |
| # maybe_requires_ciphersuite_enabled CMD [RUN_TEST_OPTION...] |
| # If CMD (call to a TLS client or server program) requires a specific |
| # ciphersuite, arrange to only run the test case if this ciphersuite is |
| # enabled. As an exception, do run the test case if it expects a ciphersuite |
| # mismatch. |
| maybe_requires_ciphersuite_enabled() { |
| case "$1" in |
| *\ force_ciphersuite=*) :;; |
| *) return;; # No specific required ciphersuite |
| esac |
| ciphersuite="${1##*\ force_ciphersuite=}" |
| ciphersuite="${ciphersuite%%[!-0-9A-Z_a-z]*}" |
| shift |
| |
| case "$*" in |
| *"-s SSL - The server has no ciphersuites in common"*) |
| # This test case expects a ciphersuite mismatch, so it doesn't |
| # require the ciphersuite to be enabled. |
| ;; |
| *) |
| requires_ciphersuite_enabled "$ciphersuite" |
| ;; |
| esac |
| |
| unset ciphersuite |
| } |
| |
| # skip next test if OpenSSL doesn't support FALLBACK_SCSV |
| requires_openssl_with_fallback_scsv() { |
| if [ -z "${OPENSSL_HAS_FBSCSV:-}" ]; then |
| if $OPENSSL_CMD s_client -help 2>&1 | grep fallback_scsv >/dev/null |
| then |
| OPENSSL_HAS_FBSCSV="YES" |
| else |
| OPENSSL_HAS_FBSCSV="NO" |
| fi |
| fi |
| if [ "$OPENSSL_HAS_FBSCSV" = "NO" ]; then |
| SKIP_NEXT="YES" |
| fi |
| } |
| |
| # skip next test if GnuTLS isn't available |
| requires_gnutls() { |
| if [ -z "${GNUTLS_AVAILABLE:-}" ]; then |
| if ( which "$GNUTLS_CLI" && which "$GNUTLS_SERV" ) >/dev/null 2>&1; then |
| GNUTLS_AVAILABLE="YES" |
| else |
| GNUTLS_AVAILABLE="NO" |
| fi |
| fi |
| if [ "$GNUTLS_AVAILABLE" = "NO" ]; then |
| SKIP_NEXT="YES" |
| fi |
| } |
| |
| # skip next test if GnuTLS-next isn't available |
| requires_gnutls_next() { |
| if [ -z "${GNUTLS_NEXT_AVAILABLE:-}" ]; then |
| if ( which "${GNUTLS_NEXT_CLI:-}" && which "${GNUTLS_NEXT_SERV:-}" ) >/dev/null 2>&1; then |
| GNUTLS_NEXT_AVAILABLE="YES" |
| else |
| GNUTLS_NEXT_AVAILABLE="NO" |
| fi |
| fi |
| if [ "$GNUTLS_NEXT_AVAILABLE" = "NO" ]; then |
| SKIP_NEXT="YES" |
| fi |
| } |
| |
| # skip next test if OpenSSL-legacy isn't available |
| requires_openssl_legacy() { |
| if [ -z "${OPENSSL_LEGACY_AVAILABLE:-}" ]; then |
| if which "${OPENSSL_LEGACY:-}" >/dev/null 2>&1; then |
| OPENSSL_LEGACY_AVAILABLE="YES" |
| else |
| OPENSSL_LEGACY_AVAILABLE="NO" |
| fi |
| fi |
| if [ "$OPENSSL_LEGACY_AVAILABLE" = "NO" ]; then |
| SKIP_NEXT="YES" |
| fi |
| } |
| |
| # skip next test if IPv6 isn't available on this host |
| requires_ipv6() { |
| if [ -z "${HAS_IPV6:-}" ]; then |
| $P_SRV server_addr='::1' > $SRV_OUT 2>&1 & |
| SRV_PID=$! |
| sleep 1 |
| kill $SRV_PID >/dev/null 2>&1 |
| if grep "NET - Binding of the socket failed" $SRV_OUT >/dev/null; then |
| HAS_IPV6="NO" |
| else |
| HAS_IPV6="YES" |
| fi |
| rm -r $SRV_OUT |
| fi |
| |
| if [ "$HAS_IPV6" = "NO" ]; then |
| SKIP_NEXT="YES" |
| fi |
| } |
| |
| # skip next test if it's i686 or uname is not available |
| requires_not_i686() { |
| if [ -z "${IS_I686:-}" ]; then |
| IS_I686="YES" |
| if which "uname" >/dev/null 2>&1; then |
| if [ -z "$(uname -a | grep i686)" ]; then |
| IS_I686="NO" |
| fi |
| fi |
| fi |
| if [ "$IS_I686" = "YES" ]; then |
| SKIP_NEXT="YES" |
| fi |
| } |
| |
| # Calculate the input & output maximum content lengths set in the config |
| MAX_CONTENT_LEN=16384 |
| MAX_IN_LEN=$( ../scripts/config.py get MBEDTLS_SSL_IN_CONTENT_LEN || echo "$MAX_CONTENT_LEN") |
| MAX_OUT_LEN=$( ../scripts/config.py get MBEDTLS_SSL_OUT_CONTENT_LEN || echo "$MAX_CONTENT_LEN") |
| |
| if [ "$MAX_IN_LEN" -lt "$MAX_CONTENT_LEN" ]; then |
| MAX_CONTENT_LEN="$MAX_IN_LEN" |
| fi |
| if [ "$MAX_OUT_LEN" -lt "$MAX_CONTENT_LEN" ]; then |
| MAX_CONTENT_LEN="$MAX_OUT_LEN" |
| fi |
| |
| # skip the next test if the SSL output buffer is less than 16KB |
| requires_full_size_output_buffer() { |
| if [ "$MAX_OUT_LEN" -ne 16384 ]; then |
| SKIP_NEXT="YES" |
| fi |
| } |
| |
| # skip the next test if valgrind is in use |
| not_with_valgrind() { |
| if [ "$MEMCHECK" -gt 0 ]; then |
| SKIP_NEXT="YES" |
| fi |
| } |
| |
| # skip the next test if valgrind is NOT in use |
| only_with_valgrind() { |
| if [ "$MEMCHECK" -eq 0 ]; then |
| SKIP_NEXT="YES" |
| fi |
| } |
| |
| # multiply the client timeout delay by the given factor for the next test |
| client_needs_more_time() { |
| CLI_DELAY_FACTOR=$1 |
| } |
| |
| # wait for the given seconds after the client finished in the next test |
| server_needs_more_time() { |
| SRV_DELAY_SECONDS=$1 |
| } |
| |
| # print_name <name> |
| print_name() { |
| TESTS=$(( $TESTS + 1 )) |
| LINE="" |
| |
| if [ "$SHOW_TEST_NUMBER" -gt 0 ]; then |
| LINE="$TESTS " |
| fi |
| |
| LINE="$LINE$1" |
| printf "%s " "$LINE" |
| LEN=$(( 72 - `echo "$LINE" | wc -c` )) |
| for i in `seq 1 $LEN`; do printf '.'; done |
| printf ' ' |
| |
| } |
| |
| # record_outcome <outcome> [<failure-reason>] |
| # The test name must be in $NAME. |
| record_outcome() { |
| echo "$1" |
| if [ -n "$MBEDTLS_TEST_OUTCOME_FILE" ]; then |
| printf '%s;%s;%s;%s;%s;%s\n' \ |
| "$MBEDTLS_TEST_PLATFORM" "$MBEDTLS_TEST_CONFIGURATION" \ |
| "ssl-opt" "$NAME" \ |
| "$1" "${2-}" \ |
| >>"$MBEDTLS_TEST_OUTCOME_FILE" |
| fi |
| } |
| |
| # fail <message> |
| fail() { |
| record_outcome "FAIL" "$1" |
| echo " ! $1" |
| |
| mv $SRV_OUT o-srv-${TESTS}.log |
| mv $CLI_OUT o-cli-${TESTS}.log |
| if [ -n "$PXY_CMD" ]; then |
| mv $PXY_OUT o-pxy-${TESTS}.log |
| fi |
| echo " ! outputs saved to o-XXX-${TESTS}.log" |
| |
| if [ "${LOG_FAILURE_ON_STDOUT:-0}" != 0 ]; then |
| echo " ! server output:" |
| cat o-srv-${TESTS}.log |
| echo " ! ========================================================" |
| echo " ! client output:" |
| cat o-cli-${TESTS}.log |
| if [ -n "$PXY_CMD" ]; then |
| echo " ! ========================================================" |
| echo " ! proxy output:" |
| cat o-pxy-${TESTS}.log |
| fi |
| echo "" |
| fi |
| |
| FAILS=$(( $FAILS + 1 )) |
| } |
| |
| # is_polar <cmd_line> |
| is_polar() { |
| case "$1" in |
| *ssl_client2*) true;; |
| *ssl_server2*) true;; |
| *) false;; |
| esac |
| } |
| |
| # openssl s_server doesn't have -www with DTLS |
| check_osrv_dtls() { |
| case "$SRV_CMD" in |
| *s_server*-dtls*) |
| NEEDS_INPUT=1 |
| SRV_CMD="$( echo $SRV_CMD | sed s/-www// )";; |
| *) NEEDS_INPUT=0;; |
| esac |
| } |
| |
| # provide input to commands that need it |
| provide_input() { |
| if [ $NEEDS_INPUT -eq 0 ]; then |
| return |
| fi |
| |
| while true; do |
| echo "HTTP/1.0 200 OK" |
| sleep 1 |
| done |
| } |
| |
| # has_mem_err <log_file_name> |
| has_mem_err() { |
| if ( grep -F 'All heap blocks were freed -- no leaks are possible' "$1" && |
| grep -F 'ERROR SUMMARY: 0 errors from 0 contexts' "$1" ) > /dev/null |
| then |
| return 1 # false: does not have errors |
| else |
| return 0 # true: has errors |
| fi |
| } |
| |
| # Wait for process $2 named $3 to be listening on port $1. Print error to $4. |
| if type lsof >/dev/null 2>/dev/null; then |
| wait_app_start() { |
| START_TIME=$(date +%s) |
| if [ "$DTLS" -eq 1 ]; then |
| proto=UDP |
| else |
| proto=TCP |
| fi |
| # Make a tight loop, server normally takes less than 1s to start. |
| while ! lsof -a -n -b -i "$proto:$1" -p "$2" >/dev/null 2>/dev/null; do |
| if [ $(( $(date +%s) - $START_TIME )) -gt $DOG_DELAY ]; then |
| echo "$3 START TIMEOUT" |
| echo "$3 START TIMEOUT" >> $4 |
| break |
| fi |
| # Linux and *BSD support decimal arguments to sleep. On other |
| # OSes this may be a tight loop. |
| sleep 0.1 2>/dev/null || true |
| done |
| } |
| else |
| echo "Warning: lsof not available, wait_app_start = sleep" |
| wait_app_start() { |
| sleep "$START_DELAY" |
| } |
| fi |
| |
| # Wait for server process $2 to be listening on port $1. |
| wait_server_start() { |
| wait_app_start $1 $2 "SERVER" $SRV_OUT |
| } |
| |
| # Wait for proxy process $2 to be listening on port $1. |
| wait_proxy_start() { |
| wait_app_start $1 $2 "PROXY" $PXY_OUT |
| } |
| |
| # Given the client or server debug output, parse the unix timestamp that is |
| # included in the first 4 bytes of the random bytes and check that it's within |
| # acceptable bounds |
| check_server_hello_time() { |
| # Extract the time from the debug (lvl 3) output of the client |
| SERVER_HELLO_TIME="$(sed -n 's/.*server hello, current time: //p' < "$1")" |
| # Get the Unix timestamp for now |
| CUR_TIME=$(date +'%s') |
| THRESHOLD_IN_SECS=300 |
| |
| # Check if the ServerHello time was printed |
| if [ -z "$SERVER_HELLO_TIME" ]; then |
| return 1 |
| fi |
| |
| # Check the time in ServerHello is within acceptable bounds |
| if [ $SERVER_HELLO_TIME -lt $(( $CUR_TIME - $THRESHOLD_IN_SECS )) ]; then |
| # The time in ServerHello is at least 5 minutes before now |
| return 1 |
| elif [ $SERVER_HELLO_TIME -gt $(( $CUR_TIME + $THRESHOLD_IN_SECS )) ]; then |
| # The time in ServerHello is at least 5 minutes later than now |
| return 1 |
| else |
| return 0 |
| fi |
| } |
| |
| # Get handshake memory usage from server or client output and put it into the variable specified by the first argument |
| handshake_memory_get() { |
| OUTPUT_VARIABLE="$1" |
| OUTPUT_FILE="$2" |
| |
| # Get memory usage from a pattern like "Heap memory usage after handshake: 23112 bytes. Peak memory usage was 33112" |
| MEM_USAGE=$(sed -n 's/.*Heap memory usage after handshake: //p' < "$OUTPUT_FILE" | grep -o "[0-9]*" | head -1) |
| |
| # Check if memory usage was read |
| if [ -z "$MEM_USAGE" ]; then |
| echo "Error: Can not read the value of handshake memory usage" |
| return 1 |
| else |
| eval "$OUTPUT_VARIABLE=$MEM_USAGE" |
| return 0 |
| fi |
| } |
| |
| # Get handshake memory usage from server or client output and check if this value |
| # is not higher than the maximum given by the first argument |
| handshake_memory_check() { |
| MAX_MEMORY="$1" |
| OUTPUT_FILE="$2" |
| |
| # Get memory usage |
| if ! handshake_memory_get "MEMORY_USAGE" "$OUTPUT_FILE"; then |
| return 1 |
| fi |
| |
| # Check if memory usage is below max value |
| if [ "$MEMORY_USAGE" -gt "$MAX_MEMORY" ]; then |
| echo "\nFailed: Handshake memory usage was $MEMORY_USAGE bytes," \ |
| "but should be below $MAX_MEMORY bytes" |
| return 1 |
| else |
| return 0 |
| fi |
| } |
| |
| # wait for client to terminate and set CLI_EXIT |
| # must be called right after starting the client |
| wait_client_done() { |
| CLI_PID=$! |
| |
| CLI_DELAY=$(( $DOG_DELAY * $CLI_DELAY_FACTOR )) |
| CLI_DELAY_FACTOR=1 |
| |
| ( sleep $CLI_DELAY; echo "===CLIENT_TIMEOUT===" >> $CLI_OUT; kill $CLI_PID ) & |
| DOG_PID=$! |
| |
| wait $CLI_PID |
| CLI_EXIT=$? |
| |
| kill $DOG_PID >/dev/null 2>&1 |
| wait $DOG_PID |
| |
| echo "EXIT: $CLI_EXIT" >> $CLI_OUT |
| |
| sleep $SRV_DELAY_SECONDS |
| SRV_DELAY_SECONDS=0 |
| } |
| |
| # check if the given command uses dtls and sets global variable DTLS |
| detect_dtls() { |
| case "$1" in |
| *dtls=1*|-dtls|-u) DTLS=1;; |
| *) DTLS=0;; |
| esac |
| } |
| |
| # check if the given command uses gnutls and sets global variable CMD_IS_GNUTLS |
| is_gnutls() { |
| case "$1" in |
| *gnutls-cli*) |
| CMD_IS_GNUTLS=1 |
| ;; |
| *gnutls-serv*) |
| CMD_IS_GNUTLS=1 |
| ;; |
| *) |
| CMD_IS_GNUTLS=0 |
| ;; |
| esac |
| } |
| |
| # Compare file content |
| # Usage: find_in_both pattern file1 file2 |
| # extract from file1 the first line matching the pattern |
| # check in file2 that the same line can be found |
| find_in_both() { |
| srv_pattern=$(grep -m 1 "$1" "$2"); |
| if [ -z "$srv_pattern" ]; then |
| return 1; |
| fi |
| |
| if grep "$srv_pattern" $3 >/dev/null; then : |
| return 0; |
| else |
| return 1; |
| fi |
| } |
| |
| # Usage: run_test name [-p proxy_cmd] srv_cmd cli_cmd cli_exit [option [...]] |
| # Options: -s pattern pattern that must be present in server output |
| # -c pattern pattern that must be present in client output |
| # -u pattern lines after pattern must be unique in client output |
| # -f call shell function on client output |
| # -S pattern pattern that must be absent in server output |
| # -C pattern pattern that must be absent in client output |
| # -U pattern lines after pattern must be unique in server output |
| # -F call shell function on server output |
| # -g call shell function on server and client output |
| run_test() { |
| NAME="$1" |
| shift 1 |
| |
| if is_excluded "$NAME"; then |
| SKIP_NEXT="NO" |
| # There was no request to run the test, so don't record its outcome. |
| return |
| fi |
| |
| print_name "$NAME" |
| |
| # Do we only run numbered tests? |
| if [ -n "$RUN_TEST_NUMBER" ]; then |
| case ",$RUN_TEST_NUMBER," in |
| *",$TESTS,"*) :;; |
| *) SKIP_NEXT="YES";; |
| esac |
| fi |
| |
| # does this test use a proxy? |
| if [ "X$1" = "X-p" ]; then |
| PXY_CMD="$2" |
| shift 2 |
| else |
| PXY_CMD="" |
| fi |
| |
| # get commands and client output |
| SRV_CMD="$1" |
| CLI_CMD="$2" |
| CLI_EXPECT="$3" |
| shift 3 |
| |
| # Check if test uses files |
| case "$SRV_CMD $CLI_CMD" in |
| *data_files/*) |
| requires_config_enabled MBEDTLS_FS_IO;; |
| esac |
| |
| # If the client or serve requires a ciphersuite, check that it's enabled. |
| maybe_requires_ciphersuite_enabled "$SRV_CMD" "$@" |
| maybe_requires_ciphersuite_enabled "$CLI_CMD" "$@" |
| |
| # should we skip? |
| if [ "X$SKIP_NEXT" = "XYES" ]; then |
| SKIP_NEXT="NO" |
| record_outcome "SKIP" |
| SKIPS=$(( $SKIPS + 1 )) |
| return |
| fi |
| |
| # update DTLS variable |
| detect_dtls "$SRV_CMD" |
| |
| # if the test uses DTLS but no custom proxy, add a simple proxy |
| # as it provides timing info that's useful to debug failures |
| if [ -z "$PXY_CMD" ] && [ "$DTLS" -eq 1 ]; then |
| PXY_CMD="$P_PXY" |
| case " $SRV_CMD " in |
| *' server_addr=::1 '*) |
| PXY_CMD="$PXY_CMD server_addr=::1 listen_addr=::1";; |
| esac |
| fi |
| |
| # update CMD_IS_GNUTLS variable |
| is_gnutls "$SRV_CMD" |
| |
| # if the server uses gnutls but doesn't set priority, explicitly |
| # set the default priority |
| if [ "$CMD_IS_GNUTLS" -eq 1 ]; then |
| case "$SRV_CMD" in |
| *--priority*) :;; |
| *) SRV_CMD="$SRV_CMD --priority=NORMAL";; |
| esac |
| fi |
| |
| # update CMD_IS_GNUTLS variable |
| is_gnutls "$CLI_CMD" |
| |
| # if the client uses gnutls but doesn't set priority, explicitly |
| # set the default priority |
| if [ "$CMD_IS_GNUTLS" -eq 1 ]; then |
| case "$CLI_CMD" in |
| *--priority*) :;; |
| *) CLI_CMD="$CLI_CMD --priority=NORMAL";; |
| esac |
| fi |
| |
| # fix client port |
| if [ -n "$PXY_CMD" ]; then |
| CLI_CMD=$( echo "$CLI_CMD" | sed s/+SRV_PORT/$PXY_PORT/g ) |
| else |
| CLI_CMD=$( echo "$CLI_CMD" | sed s/+SRV_PORT/$SRV_PORT/g ) |
| fi |
| |
| # prepend valgrind to our commands if active |
| if [ "$MEMCHECK" -gt 0 ]; then |
| if is_polar "$SRV_CMD"; then |
| SRV_CMD="valgrind --leak-check=full $SRV_CMD" |
| fi |
| if is_polar "$CLI_CMD"; then |
| CLI_CMD="valgrind --leak-check=full $CLI_CMD" |
| fi |
| fi |
| |
| TIMES_LEFT=2 |
| while [ $TIMES_LEFT -gt 0 ]; do |
| TIMES_LEFT=$(( $TIMES_LEFT - 1 )) |
| |
| # run the commands |
| if [ -n "$PXY_CMD" ]; then |
| printf "# %s\n%s\n" "$NAME" "$PXY_CMD" > $PXY_OUT |
| $PXY_CMD >> $PXY_OUT 2>&1 & |
| PXY_PID=$! |
| wait_proxy_start "$PXY_PORT" "$PXY_PID" |
| fi |
| |
| check_osrv_dtls |
| printf '# %s\n%s\n' "$NAME" "$SRV_CMD" > $SRV_OUT |
| provide_input | $SRV_CMD >> $SRV_OUT 2>&1 & |
| SRV_PID=$! |
| wait_server_start "$SRV_PORT" "$SRV_PID" |
| |
| printf '# %s\n%s\n' "$NAME" "$CLI_CMD" > $CLI_OUT |
| eval "$CLI_CMD" >> $CLI_OUT 2>&1 & |
| wait_client_done |
| |
| sleep 0.05 |
| |
| # terminate the server (and the proxy) |
| kill $SRV_PID |
| wait $SRV_PID |
| SRV_RET=$? |
| |
| if [ -n "$PXY_CMD" ]; then |
| kill $PXY_PID >/dev/null 2>&1 |
| wait $PXY_PID |
| fi |
| |
| # retry only on timeouts |
| if grep '===CLIENT_TIMEOUT===' $CLI_OUT >/dev/null; then |
| printf "RETRY " |
| else |
| TIMES_LEFT=0 |
| fi |
| done |
| |
| # check if the client and server went at least to the handshake stage |
| # (useful to avoid tests with only negative assertions and non-zero |
| # expected client exit to incorrectly succeed in case of catastrophic |
| # failure) |
| if is_polar "$SRV_CMD"; then |
| if grep "Performing the SSL/TLS handshake" $SRV_OUT >/dev/null; then :; |
| else |
| fail "server or client failed to reach handshake stage" |
| return |
| fi |
| fi |
| if is_polar "$CLI_CMD"; then |
| if grep "Performing the SSL/TLS handshake" $CLI_OUT >/dev/null; then :; |
| else |
| fail "server or client failed to reach handshake stage" |
| return |
| fi |
| fi |
| |
| # Check server exit code (only for Mbed TLS: GnuTLS and OpenSSL don't |
| # exit with status 0 when interrupted by a signal, and we don't really |
| # care anyway), in case e.g. the server reports a memory leak. |
| if [ $SRV_RET != 0 ] && is_polar "$SRV_CMD"; then |
| fail "Server exited with status $SRV_RET" |
| return |
| fi |
| |
| # check client exit code |
| if [ \( "$CLI_EXPECT" = 0 -a "$CLI_EXIT" != 0 \) -o \ |
| \( "$CLI_EXPECT" != 0 -a "$CLI_EXIT" = 0 \) ] |
| then |
| fail "bad client exit code (expected $CLI_EXPECT, got $CLI_EXIT)" |
| return |
| fi |
| |
| # check other assertions |
| # lines beginning with == are added by valgrind, ignore them |
| # lines with 'Serious error when reading debug info', are valgrind issues as well |
| while [ $# -gt 0 ] |
| do |
| case $1 in |
| "-s") |
| if grep -v '^==' $SRV_OUT | grep -v 'Serious error when reading debug info' | grep "$2" >/dev/null; then :; else |
| fail "pattern '$2' MUST be present in the Server output" |
| return |
| fi |
| ;; |
| |
| "-c") |
| if grep -v '^==' $CLI_OUT | grep -v 'Serious error when reading debug info' | grep "$2" >/dev/null; then :; else |
| fail "pattern '$2' MUST be present in the Client output" |
| return |
| fi |
| ;; |
| |
| "-S") |
| if grep -v '^==' $SRV_OUT | grep -v 'Serious error when reading debug info' | grep "$2" >/dev/null; then |
| fail "pattern '$2' MUST NOT be present in the Server output" |
| return |
| fi |
| ;; |
| |
| "-C") |
| if grep -v '^==' $CLI_OUT | grep -v 'Serious error when reading debug info' | grep "$2" >/dev/null; then |
| fail "pattern '$2' MUST NOT be present in the Client output" |
| return |
| fi |
| ;; |
| |
| # The filtering in the following two options (-u and -U) do the following |
| # - ignore valgrind output |
| # - filter out everything but lines right after the pattern occurrences |
| # - keep one of each non-unique line |
| # - count how many lines remain |
| # A line with '--' will remain in the result from previous outputs, so the number of lines in the result will be 1 |
| # if there were no duplicates. |
| "-U") |
| if [ $(grep -v '^==' $SRV_OUT | grep -v 'Serious error when reading debug info' | grep -A1 "$2" | grep -v "$2" | sort | uniq -d | wc -l) -gt 1 ]; then |
| fail "lines following pattern '$2' must be unique in Server output" |
| return |
| fi |
| ;; |
| |
| "-u") |
| if [ $(grep -v '^==' $CLI_OUT | grep -v 'Serious error when reading debug info' | grep -A1 "$2" | grep -v "$2" | sort | uniq -d | wc -l) -gt 1 ]; then |
| fail "lines following pattern '$2' must be unique in Client output" |
| return |
| fi |
| ;; |
| "-F") |
| if ! $2 "$SRV_OUT"; then |
| fail "function call to '$2' failed on Server output" |
| return |
| fi |
| ;; |
| "-f") |
| if ! $2 "$CLI_OUT"; then |
| fail "function call to '$2' failed on Client output" |
| return |
| fi |
| ;; |
| "-g") |
| if ! eval "$2 '$SRV_OUT' '$CLI_OUT'"; then |
| fail "function call to '$2' failed on Server and Client output" |
| return |
| fi |
| ;; |
| |
| *) |
| echo "Unknown test: $1" >&2 |
| exit 1 |
| esac |
| shift 2 |
| done |
| |
| # check valgrind's results |
| if [ "$MEMCHECK" -gt 0 ]; then |
| if is_polar "$SRV_CMD" && has_mem_err $SRV_OUT; then |
| fail "Server has memory errors" |
| return |
| fi |
| if is_polar "$CLI_CMD" && has_mem_err $CLI_OUT; then |
| fail "Client has memory errors" |
| return |
| fi |
| fi |
| |
| # if we're here, everything is ok |
| record_outcome "PASS" |
| if [ "$PRESERVE_LOGS" -gt 0 ]; then |
| mv $SRV_OUT o-srv-${TESTS}.log |
| mv $CLI_OUT o-cli-${TESTS}.log |
| if [ -n "$PXY_CMD" ]; then |
| mv $PXY_OUT o-pxy-${TESTS}.log |
| fi |
| fi |
| |
| rm -f $SRV_OUT $CLI_OUT $PXY_OUT |
| } |
| |
| run_test_psa() { |
| requires_config_enabled MBEDTLS_USE_PSA_CRYPTO |
| run_test "PSA-supported ciphersuite: $1" \ |
| "$P_SRV debug_level=3 force_version=tls1_2" \ |
| "$P_CLI debug_level=3 force_version=tls1_2 force_ciphersuite=$1" \ |
| 0 \ |
| -c "Successfully setup PSA-based decryption cipher context" \ |
| -c "Successfully setup PSA-based encryption cipher context" \ |
| -c "PSA calc verify" \ |
| -c "calc PSA finished" \ |
| -s "Successfully setup PSA-based decryption cipher context" \ |
| -s "Successfully setup PSA-based encryption cipher context" \ |
| -s "PSA calc verify" \ |
| -s "calc PSA finished" \ |
| -C "Failed to setup PSA-based cipher context"\ |
| -S "Failed to setup PSA-based cipher context"\ |
| -s "Protocol is TLSv1.2" \ |
| -c "Perform PSA-based ECDH computation."\ |
| -c "Perform PSA-based computation of digest of ServerKeyExchange" \ |
| -S "error" \ |
| -C "error" |
| } |
| |
| run_test_psa_force_curve() { |
| requires_config_enabled MBEDTLS_USE_PSA_CRYPTO |
| run_test "PSA - ECDH with $1" \ |
| "$P_SRV debug_level=4 force_version=tls1_2" \ |
| "$P_CLI debug_level=4 force_version=tls1_2 force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256 curves=$1" \ |
| 0 \ |
| -c "Successfully setup PSA-based decryption cipher context" \ |
| -c "Successfully setup PSA-based encryption cipher context" \ |
| -c "PSA calc verify" \ |
| -c "calc PSA finished" \ |
| -s "Successfully setup PSA-based decryption cipher context" \ |
| -s "Successfully setup PSA-based encryption cipher context" \ |
| -s "PSA calc verify" \ |
| -s "calc PSA finished" \ |
| -C "Failed to setup PSA-based cipher context"\ |
| -S "Failed to setup PSA-based cipher context"\ |
| -s "Protocol is TLSv1.2" \ |
| -c "Perform PSA-based ECDH computation."\ |
| -c "Perform PSA-based computation of digest of ServerKeyExchange" \ |
| -S "error" \ |
| -C "error" |
| } |
| |
| # Test that the server's memory usage after a handshake is reduced when a client specifies |
| # a maximum fragment length. |
| # first argument ($1) is MFL for SSL client |
| # second argument ($2) is memory usage for SSL client with default MFL (16k) |
| run_test_memory_after_hanshake_with_mfl() |
| { |
| # The test passes if the difference is around 2*(16k-MFL) |
| MEMORY_USAGE_LIMIT="$(( $2 - ( 2 * ( 16384 - $1 )) ))" |
| |
| # Leave some margin for robustness |
| MEMORY_USAGE_LIMIT="$(( ( MEMORY_USAGE_LIMIT * 110 ) / 100 ))" |
| |
| run_test "Handshake memory usage (MFL $1)" \ |
| "$P_SRV debug_level=3 auth_mode=required force_version=tls1_2" \ |
| "$P_CLI debug_level=3 force_version=tls1_2 \ |
| crt_file=data_files/server5.crt key_file=data_files/server5.key \ |
| force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CCM max_frag_len=$1" \ |
| 0 \ |
| -F "handshake_memory_check $MEMORY_USAGE_LIMIT" |
| } |
| |
| |
| # Test that the server's memory usage after a handshake is reduced when a client specifies |
| # different values of Maximum Fragment Length: default (16k), 4k, 2k, 1k and 512 bytes |
| run_tests_memory_after_hanshake() |
| { |
| # all tests in this sequence requires the same configuration (see requires_config_enabled()) |
| SKIP_THIS_TESTS="$SKIP_NEXT" |
| |
| # first test with default MFU is to get reference memory usage |
| MEMORY_USAGE_MFL_16K=0 |
| run_test "Handshake memory usage initial (MFL 16384 - default)" \ |
| "$P_SRV debug_level=3 auth_mode=required force_version=tls1_2" \ |
| "$P_CLI debug_level=3 force_version=tls1_2 \ |
| crt_file=data_files/server5.crt key_file=data_files/server5.key \ |
| force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CCM" \ |
| 0 \ |
| -F "handshake_memory_get MEMORY_USAGE_MFL_16K" |
| |
| SKIP_NEXT="$SKIP_THIS_TESTS" |
| run_test_memory_after_hanshake_with_mfl 4096 "$MEMORY_USAGE_MFL_16K" |
| |
| SKIP_NEXT="$SKIP_THIS_TESTS" |
| run_test_memory_after_hanshake_with_mfl 2048 "$MEMORY_USAGE_MFL_16K" |
| |
| SKIP_NEXT="$SKIP_THIS_TESTS" |
| run_test_memory_after_hanshake_with_mfl 1024 "$MEMORY_USAGE_MFL_16K" |
| |
| SKIP_NEXT="$SKIP_THIS_TESTS" |
| run_test_memory_after_hanshake_with_mfl 512 "$MEMORY_USAGE_MFL_16K" |
| } |
| |
| cleanup() { |
| rm -f $CLI_OUT $SRV_OUT $PXY_OUT $SESSION |
| rm -f context_srv.txt |
| rm -f context_cli.txt |
| test -n "${SRV_PID:-}" && kill $SRV_PID >/dev/null 2>&1 |
| test -n "${PXY_PID:-}" && kill $PXY_PID >/dev/null 2>&1 |
| test -n "${CLI_PID:-}" && kill $CLI_PID >/dev/null 2>&1 |
| test -n "${DOG_PID:-}" && kill $DOG_PID >/dev/null 2>&1 |
| exit 1 |
| } |
| |
| # |
| # MAIN |
| # |
| |
| get_options "$@" |
| |
| # Optimize filters: if $FILTER and $EXCLUDE can be expressed as shell |
| # patterns rather than regular expressions, use a case statement instead |
| # of calling grep. To keep the optimizer simple, it is incomplete and only |
| # detects simple cases: plain substring, everything, nothing. |
| # |
| # As an exception, the character '.' is treated as an ordinary character |
| # if it is the only special character in the string. This is because it's |
| # rare to need "any one character", but needing a literal '.' is common |
| # (e.g. '-f "DTLS 1.2"'). |
| need_grep= |
| case "$FILTER" in |
| '^$') simple_filter=;; |
| '.*') simple_filter='*';; |
| *[][$+*?\\^{\|}]*) # Regexp special characters (other than .), we need grep |
| need_grep=1;; |
| *) # No regexp or shell-pattern special character |
| simple_filter="*$FILTER*";; |
| esac |
| case "$EXCLUDE" in |
| '^$') simple_exclude=;; |
| '.*') simple_exclude='*';; |
| *[][$+*?\\^{\|}]*) # Regexp special characters (other than .), we need grep |
| need_grep=1;; |
| *) # No regexp or shell-pattern special character |
| simple_exclude="*$EXCLUDE*";; |
| esac |
| if [ -n "$need_grep" ]; then |
| is_excluded () { |
| ! echo "$1" | grep "$FILTER" | grep -q -v "$EXCLUDE" |
| } |
| else |
| is_excluded () { |
| case "$1" in |
| $simple_exclude) true;; |
| $simple_filter) false;; |
| *) true;; |
| esac |
| } |
| fi |
| |
| # sanity checks, avoid an avalanche of errors |
| P_SRV_BIN="${P_SRV%%[ ]*}" |
| P_CLI_BIN="${P_CLI%%[ ]*}" |
| P_PXY_BIN="${P_PXY%%[ ]*}" |
| if [ ! -x "$P_SRV_BIN" ]; then |
| echo "Command '$P_SRV_BIN' is not an executable file" |
| exit 1 |
| fi |
| if [ ! -x "$P_CLI_BIN" ]; then |
| echo "Command '$P_CLI_BIN' is not an executable file" |
| exit 1 |
| fi |
| if [ ! -x "$P_PXY_BIN" ]; then |
| echo "Command '$P_PXY_BIN' is not an executable file" |
| exit 1 |
| fi |
| if [ "$MEMCHECK" -gt 0 ]; then |
| if which valgrind >/dev/null 2>&1; then :; else |
| echo "Memcheck not possible. Valgrind not found" |
| exit 1 |
| fi |
| fi |
| if which $OPENSSL_CMD >/dev/null 2>&1; then :; else |
| echo "Command '$OPENSSL_CMD' not found" |
| exit 1 |
| fi |
| |
| # used by watchdog |
| MAIN_PID="$$" |
| |
| # We use somewhat arbitrary delays for tests: |
| # - how long do we wait for the server to start (when lsof not available)? |
| # - how long do we allow for the client to finish? |
| # (not to check performance, just to avoid waiting indefinitely) |
| # Things are slower with valgrind, so give extra time here. |
| # |
| # Note: without lsof, there is a trade-off between the running time of this |
| # script and the risk of spurious errors because we didn't wait long enough. |
| # The watchdog delay on the other hand doesn't affect normal running time of |
| # the script, only the case where a client or server gets stuck. |
| if [ "$MEMCHECK" -gt 0 ]; then |
| START_DELAY=6 |
| DOG_DELAY=60 |
| else |
| START_DELAY=2 |
| DOG_DELAY=20 |
| fi |
| |
| # some particular tests need more time: |
| # - for the client, we multiply the usual watchdog limit by a factor |
| # - for the server, we sleep for a number of seconds after the client exits |
| # see client_need_more_time() and server_needs_more_time() |
| CLI_DELAY_FACTOR=1 |
| SRV_DELAY_SECONDS=0 |
| |
| # fix commands to use this port, force IPv4 while at it |
| # +SRV_PORT will be replaced by either $SRV_PORT or $PXY_PORT later |
| P_SRV="$P_SRV server_addr=127.0.0.1 server_port=$SRV_PORT" |
| P_CLI="$P_CLI server_addr=127.0.0.1 server_port=+SRV_PORT" |
| P_PXY="$P_PXY server_addr=127.0.0.1 server_port=$SRV_PORT listen_addr=127.0.0.1 listen_port=$PXY_PORT ${SEED:+"seed=$SEED"}" |
| O_SRV="$O_SRV -accept $SRV_PORT" |
| O_CLI="$O_CLI -connect localhost:+SRV_PORT" |
| G_SRV="$G_SRV -p $SRV_PORT" |
| G_CLI="$G_CLI -p +SRV_PORT" |
| |
| if [ -n "${OPENSSL_LEGACY:-}" ]; then |
| O_LEGACY_SRV="$O_LEGACY_SRV -accept $SRV_PORT -dhparam data_files/dhparams.pem" |
| O_LEGACY_CLI="$O_LEGACY_CLI -connect localhost:+SRV_PORT" |
| fi |
| |
| if [ -n "${GNUTLS_NEXT_SERV:-}" ]; then |
| G_NEXT_SRV="$G_NEXT_SRV -p $SRV_PORT" |
| fi |
| |
| if [ -n "${GNUTLS_NEXT_CLI:-}" ]; then |
| G_NEXT_CLI="$G_NEXT_CLI -p +SRV_PORT" |
| fi |
| |
| # Allow SHA-1, because many of our test certificates use it |
| P_SRV="$P_SRV allow_sha1=1" |
| P_CLI="$P_CLI allow_sha1=1" |
| |
| # Also pick a unique name for intermediate files |
| SRV_OUT="srv_out.$$" |
| CLI_OUT="cli_out.$$" |
| PXY_OUT="pxy_out.$$" |
| SESSION="session.$$" |
| |
| SKIP_NEXT="NO" |
| |
| trap cleanup INT TERM HUP |
| |
| # Basic test |
| |
| # Checks that: |
| # - things work with all ciphersuites active (used with config-full in all.sh) |
| # - the expected (highest security) parameters are selected |
| # ("signature_algorithm ext: 6" means SHA-512 (highest common hash)) |
| run_test "Default" \ |
| "$P_SRV debug_level=3" \ |
| "$P_CLI" \ |
| 0 \ |
| -s "Protocol is TLSv1.2" \ |
| -s "Ciphersuite is TLS-ECDHE-RSA-WITH-CHACHA20-POLY1305-SHA256" \ |
| -s "client hello v3, signature_algorithm ext: 6" \ |
| -s "ECDHE curve: secp521r1" \ |
| -S "error" \ |
| -C "error" |
| |
| run_test "Default, DTLS" \ |
| "$P_SRV dtls=1" \ |
| "$P_CLI dtls=1" \ |
| 0 \ |
| -s "Protocol is DTLSv1.2" \ |
| -s "Ciphersuite is TLS-ECDHE-RSA-WITH-CHACHA20-POLY1305-SHA256" |
| |
| run_test "TLS client auth: required" \ |
| "$P_SRV auth_mode=required" \ |
| "$P_CLI" \ |
| 0 \ |
| -s "Verifying peer X.509 certificate... ok" |
| |
| requires_config_enabled MBEDTLS_X509_CRT_PARSE_C |
| requires_config_enabled MBEDTLS_ECDSA_C |
| requires_config_enabled MBEDTLS_SHA256_C |
| run_test "TLS: password protected client key" \ |
| "$P_SRV auth_mode=required" \ |
| "$P_CLI crt_file=data_files/server5.crt key_file=data_files/server5.key.enc key_pwd=PolarSSLTest" \ |
| 0 |
| |
| requires_config_enabled MBEDTLS_X509_CRT_PARSE_C |
| requires_config_enabled MBEDTLS_ECDSA_C |
| requires_config_enabled MBEDTLS_SHA256_C |
| run_test "TLS: password protected server key" \ |
| "$P_SRV crt_file=data_files/server5.crt key_file=data_files/server5.key.enc key_pwd=PolarSSLTest" \ |
| "$P_CLI" \ |
| 0 |
| |
| requires_config_enabled MBEDTLS_X509_CRT_PARSE_C |
| requires_config_enabled MBEDTLS_ECDSA_C |
| requires_config_enabled MBEDTLS_RSA_C |
| requires_config_enabled MBEDTLS_SHA256_C |
| run_test "TLS: password protected server key, two certificates" \ |
| "$P_SRV \ |
| key_file=data_files/server5.key.enc key_pwd=PolarSSLTest crt_file=data_files/server5.crt \ |
| key_file2=data_files/server2.key.enc key_pwd2=PolarSSLTest crt_file2=data_files/server2.crt" \ |
| "$P_CLI" \ |
| 0 |
| |
| requires_config_enabled MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK |
| run_test "CA callback on client" \ |
| "$P_SRV debug_level=3" \ |
| "$P_CLI ca_callback=1 debug_level=3 " \ |
| 0 \ |
| -c "use CA callback for X.509 CRT verification" \ |
| -S "error" \ |
| -C "error" |
| |
| requires_config_enabled MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK |
| requires_config_enabled MBEDTLS_X509_CRT_PARSE_C |
| requires_config_enabled MBEDTLS_ECDSA_C |
| requires_config_enabled MBEDTLS_SHA256_C |
| run_test "CA callback on server" \ |
| "$P_SRV auth_mode=required" \ |
| "$P_CLI ca_callback=1 debug_level=3 crt_file=data_files/server5.crt \ |
| key_file=data_files/server5.key" \ |
| 0 \ |
| -c "use CA callback for X.509 CRT verification" \ |
| -s "Verifying peer X.509 certificate... ok" \ |
| -S "error" \ |
| -C "error" |
| |
| # Test using an opaque private key for client authentication |
| requires_config_enabled MBEDTLS_USE_PSA_CRYPTO |
| requires_config_enabled MBEDTLS_X509_CRT_PARSE_C |
| requires_config_enabled MBEDTLS_ECDSA_C |
| requires_config_enabled MBEDTLS_SHA256_C |
| run_test "Opaque key for client authentication" \ |
| "$P_SRV auth_mode=required" \ |
| "$P_CLI key_opaque=1 crt_file=data_files/server5.crt \ |
| key_file=data_files/server5.key" \ |
| 0 \ |
| -c "key type: Opaque" \ |
| -s "Verifying peer X.509 certificate... ok" \ |
| -S "error" \ |
| -C "error" |
| |
| # Test ciphersuites which we expect to be fully supported by PSA Crypto |
| # and check that we don't fall back to Mbed TLS' internal crypto primitives. |
| run_test_psa TLS-ECDHE-ECDSA-WITH-AES-128-CCM |
| run_test_psa TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8 |
| run_test_psa TLS-ECDHE-ECDSA-WITH-AES-256-CCM |
| run_test_psa TLS-ECDHE-ECDSA-WITH-AES-256-CCM-8 |
| run_test_psa TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256 |
| run_test_psa TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384 |
| run_test_psa TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA |
| run_test_psa TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256 |
| run_test_psa TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA384 |
| |
| requires_config_enabled MBEDTLS_ECP_DP_SECP521R1_ENABLED |
| run_test_psa_force_curve "secp521r1" |
| requires_config_enabled MBEDTLS_ECP_DP_BP512R1_ENABLED |
| run_test_psa_force_curve "brainpoolP512r1" |
| requires_config_enabled MBEDTLS_ECP_DP_SECP384R1_ENABLED |
| run_test_psa_force_curve "secp384r1" |
| requires_config_enabled MBEDTLS_ECP_DP_BP384R1_ENABLED |
| run_test_psa_force_curve "brainpoolP384r1" |
| requires_config_enabled MBEDTLS_ECP_DP_SECP256R1_ENABLED |
| run_test_psa_force_curve "secp256r1" |
| requires_config_enabled MBEDTLS_ECP_DP_SECP256K1_ENABLED |
| run_test_psa_force_curve "secp256k1" |
| requires_config_enabled MBEDTLS_ECP_DP_BP256R1_ENABLED |
| run_test_psa_force_curve "brainpoolP256r1" |
| requires_config_enabled MBEDTLS_ECP_DP_SECP224R1_ENABLED |
| run_test_psa_force_curve "secp224r1" |
| ## SECP224K1 is buggy via the PSA API |
| ## (https://github.com/ARMmbed/mbedtls/issues/3541), |
| ## so it is disabled in PSA even when it's enabled in Mbed TLS. |
| ## The proper dependency would be on PSA_WANT_ECC_SECP_K1_224 but |
| ## dependencies on PSA symbols in ssl-opt.sh are not implemented yet. |
| #requires_config_enabled MBEDTLS_ECP_DP_SECP224K1_ENABLED |
| #run_test_psa_force_curve "secp224k1" |
| requires_config_enabled MBEDTLS_ECP_DP_SECP192R1_ENABLED |
| run_test_psa_force_curve "secp192r1" |
| requires_config_enabled MBEDTLS_ECP_DP_SECP192K1_ENABLED |
| run_test_psa_force_curve "secp192k1" |
| |
| # Test current time in ServerHello |
| requires_config_enabled MBEDTLS_HAVE_TIME |
| run_test "ServerHello contains gmt_unix_time" \ |
| "$P_SRV debug_level=3" \ |
| "$P_CLI debug_level=3" \ |
| 0 \ |
| -f "check_server_hello_time" \ |
| -F "check_server_hello_time" |
| |
| # Test for uniqueness of IVs in AEAD ciphersuites |
| run_test "Unique IV in GCM" \ |
| "$P_SRV exchanges=20 debug_level=4" \ |
| "$P_CLI exchanges=20 debug_level=4 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384" \ |
| 0 \ |
| -u "IV used" \ |
| -U "IV used" |
| |
| # Tests for certificate verification callback |
| run_test "Configuration-specific CRT verification callback" \ |
| "$P_SRV debug_level=3" \ |
| "$P_CLI context_crt_cb=0 debug_level=3" \ |
| 0 \ |
| -S "error" \ |
| -c "Verify requested for " \ |
| -c "Use configuration-specific verification callback" \ |
| -C "Use context-specific verification callback" \ |
| -C "error" |
| |
| run_test "Context-specific CRT verification callback" \ |
| "$P_SRV debug_level=3" \ |
| "$P_CLI context_crt_cb=1 debug_level=3" \ |
| 0 \ |
| -S "error" \ |
| -c "Verify requested for " \ |
| -c "Use context-specific verification callback" \ |
| -C "Use configuration-specific verification callback" \ |
| -C "error" |
| |
| # Tests for SHA-1 support |
| run_test "SHA-1 forbidden by default in server certificate" \ |
| "$P_SRV key_file=data_files/server2.key crt_file=data_files/server2.crt" \ |
| "$P_CLI debug_level=2 allow_sha1=0" \ |
| 1 \ |
| -c "The certificate is signed with an unacceptable hash" |
| |
| run_test "SHA-1 explicitly allowed in server certificate" \ |
| "$P_SRV key_file=data_files/server2.key crt_file=data_files/server2.crt" \ |
| "$P_CLI allow_sha1=1" \ |
| 0 |
| |
| run_test "SHA-256 allowed by default in server certificate" \ |
| "$P_SRV key_file=data_files/server2.key crt_file=data_files/server2-sha256.crt" \ |
| "$P_CLI allow_sha1=0" \ |
| 0 |
| |
| run_test "SHA-1 forbidden by default in client certificate" \ |
| "$P_SRV auth_mode=required allow_sha1=0" \ |
| "$P_CLI key_file=data_files/cli-rsa.key crt_file=data_files/cli-rsa-sha1.crt" \ |
| 1 \ |
| -s "The certificate is signed with an unacceptable hash" |
| |
| run_test "SHA-1 explicitly allowed in client certificate" \ |
| "$P_SRV auth_mode=required allow_sha1=1" \ |
| "$P_CLI key_file=data_files/cli-rsa.key crt_file=data_files/cli-rsa-sha1.crt" \ |
| 0 |
| |
| run_test "SHA-256 allowed by default in client certificate" \ |
| "$P_SRV auth_mode=required allow_sha1=0" \ |
| "$P_CLI key_file=data_files/cli-rsa.key crt_file=data_files/cli-rsa-sha256.crt" \ |
| 0 |
| |
| # Tests for datagram packing |
| run_test "DTLS: multiple records in same datagram, client and server" \ |
| "$P_SRV dtls=1 dgram_packing=1 debug_level=2" \ |
| "$P_CLI dtls=1 dgram_packing=1 debug_level=2" \ |
| 0 \ |
| -c "next record in same datagram" \ |
| -s "next record in same datagram" |
| |
| run_test "DTLS: multiple records in same datagram, client only" \ |
| "$P_SRV dtls=1 dgram_packing=0 debug_level=2" \ |
| "$P_CLI dtls=1 dgram_packing=1 debug_level=2" \ |
| 0 \ |
| -s "next record in same datagram" \ |
| -C "next record in same datagram" |
| |
| run_test "DTLS: multiple records in same datagram, server only" \ |
| "$P_SRV dtls=1 dgram_packing=1 debug_level=2" \ |
| "$P_CLI dtls=1 dgram_packing=0 debug_level=2" \ |
| 0 \ |
| -S "next record in same datagram" \ |
| -c "next record in same datagram" |
| |
| run_test "DTLS: multiple records in same datagram, neither client nor server" \ |
| "$P_SRV dtls=1 dgram_packing=0 debug_level=2" \ |
| "$P_CLI dtls=1 dgram_packing=0 debug_level=2" \ |
| 0 \ |
| -S "next record in same datagram" \ |
| -C "next record in same datagram" |
| |
| # Tests for Truncated HMAC extension |
| |
| run_test "Truncated HMAC: client default, server default" \ |
| "$P_SRV debug_level=4" \ |
| "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| 0 \ |
| -s "dumping 'expected mac' (20 bytes)" \ |
| -S "dumping 'expected mac' (10 bytes)" |
| |
| requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
| run_test "Truncated HMAC: client disabled, server default" \ |
| "$P_SRV debug_level=4" \ |
| "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA trunc_hmac=0" \ |
| 0 \ |
| -s "dumping 'expected mac' (20 bytes)" \ |
| -S "dumping 'expected mac' (10 bytes)" |
| |
| requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
| run_test "Truncated HMAC: client enabled, server default" \ |
| "$P_SRV debug_level=4" \ |
| "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA trunc_hmac=1" \ |
| 0 \ |
| -s "dumping 'expected mac' (20 bytes)" \ |
| -S "dumping 'expected mac' (10 bytes)" |
| |
| requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
| run_test "Truncated HMAC: client enabled, server disabled" \ |
| "$P_SRV debug_level=4 trunc_hmac=0" \ |
| "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA trunc_hmac=1" \ |
| 0 \ |
| -s "dumping 'expected mac' (20 bytes)" \ |
| -S "dumping 'expected mac' (10 bytes)" |
| |
| requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
| run_test "Truncated HMAC: client disabled, server enabled" \ |
| "$P_SRV debug_level=4 trunc_hmac=1" \ |
| "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA trunc_hmac=0" \ |
| 0 \ |
| -s "dumping 'expected mac' (20 bytes)" \ |
| -S "dumping 'expected mac' (10 bytes)" |
| |
| requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
| run_test "Truncated HMAC: client enabled, server enabled" \ |
| "$P_SRV debug_level=4 trunc_hmac=1" \ |
| "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA trunc_hmac=1" \ |
| 0 \ |
| -S "dumping 'expected mac' (20 bytes)" \ |
| -s "dumping 'expected mac' (10 bytes)" |
| |
| run_test "Truncated HMAC, DTLS: client default, server default" \ |
| "$P_SRV dtls=1 debug_level=4" \ |
| "$P_CLI dtls=1 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| 0 \ |
| -s "dumping 'expected mac' (20 bytes)" \ |
| -S "dumping 'expected mac' (10 bytes)" |
| |
| requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
| run_test "Truncated HMAC, DTLS: client disabled, server default" \ |
| "$P_SRV dtls=1 debug_level=4" \ |
| "$P_CLI dtls=1 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA trunc_hmac=0" \ |
| 0 \ |
| -s "dumping 'expected mac' (20 bytes)" \ |
| -S "dumping 'expected mac' (10 bytes)" |
| |
| requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
| run_test "Truncated HMAC, DTLS: client enabled, server default" \ |
| "$P_SRV dtls=1 debug_level=4" \ |
| "$P_CLI dtls=1 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA trunc_hmac=1" \ |
| 0 \ |
| -s "dumping 'expected mac' (20 bytes)" \ |
| -S "dumping 'expected mac' (10 bytes)" |
| |
| requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
| run_test "Truncated HMAC, DTLS: client enabled, server disabled" \ |
| "$P_SRV dtls=1 debug_level=4 trunc_hmac=0" \ |
| "$P_CLI dtls=1 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA trunc_hmac=1" \ |
| 0 \ |
| -s "dumping 'expected mac' (20 bytes)" \ |
| -S "dumping 'expected mac' (10 bytes)" |
| |
| requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
| run_test "Truncated HMAC, DTLS: client disabled, server enabled" \ |
| "$P_SRV dtls=1 debug_level=4 trunc_hmac=1" \ |
| "$P_CLI dtls=1 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA trunc_hmac=0" \ |
| 0 \ |
| -s "dumping 'expected mac' (20 bytes)" \ |
| -S "dumping 'expected mac' (10 bytes)" |
| |
| requires_config_enabled MBEDTLS_SSL_TRUNCATED_HMAC |
| run_test "Truncated HMAC, DTLS: client enabled, server enabled" \ |
| "$P_SRV dtls=1 debug_level=4 trunc_hmac=1" \ |
| "$P_CLI dtls=1 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA trunc_hmac=1" \ |
| 0 \ |
| -S "dumping 'expected mac' (20 bytes)" \ |
| -s "dumping 'expected mac' (10 bytes)" |
| |
| # Tests for Context serialization |
| |
| requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION |
| run_test "Context serialization, client serializes, CCM" \ |
| "$P_SRV dtls=1 serialize=0 exchanges=2" \ |
| "$P_CLI dtls=1 serialize=1 exchanges=2 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8" \ |
| 0 \ |
| -c "Deserializing connection..." \ |
| -S "Deserializing connection..." |
| |
| requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION |
| run_test "Context serialization, client serializes, ChaChaPoly" \ |
| "$P_SRV dtls=1 serialize=0 exchanges=2" \ |
| "$P_CLI dtls=1 serialize=1 exchanges=2 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256" \ |
| 0 \ |
| -c "Deserializing connection..." \ |
| -S "Deserializing connection..." |
| |
| requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION |
| run_test "Context serialization, client serializes, GCM" \ |
| "$P_SRV dtls=1 serialize=0 exchanges=2" \ |
| "$P_CLI dtls=1 serialize=1 exchanges=2 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256" \ |
| 0 \ |
| -c "Deserializing connection..." \ |
| -S "Deserializing connection..." |
| |
| requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| run_test "Context serialization, client serializes, with CID" \ |
| "$P_SRV dtls=1 serialize=0 exchanges=2 cid=1 cid_val=dead" \ |
| "$P_CLI dtls=1 serialize=1 exchanges=2 cid=1 cid_val=beef" \ |
| 0 \ |
| -c "Deserializing connection..." \ |
| -S "Deserializing connection..." |
| |
| requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION |
| run_test "Context serialization, server serializes, CCM" \ |
| "$P_SRV dtls=1 serialize=1 exchanges=2" \ |
| "$P_CLI dtls=1 serialize=0 exchanges=2 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8" \ |
| 0 \ |
| -C "Deserializing connection..." \ |
| -s "Deserializing connection..." |
| |
| requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION |
| run_test "Context serialization, server serializes, ChaChaPoly" \ |
| "$P_SRV dtls=1 serialize=1 exchanges=2" \ |
| "$P_CLI dtls=1 serialize=0 exchanges=2 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256" \ |
| 0 \ |
| -C "Deserializing connection..." \ |
| -s "Deserializing connection..." |
| |
| requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION |
| run_test "Context serialization, server serializes, GCM" \ |
| "$P_SRV dtls=1 serialize=1 exchanges=2" \ |
| "$P_CLI dtls=1 serialize=0 exchanges=2 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256" \ |
| 0 \ |
| -C "Deserializing connection..." \ |
| -s "Deserializing connection..." |
| |
| requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| run_test "Context serialization, server serializes, with CID" \ |
| "$P_SRV dtls=1 serialize=1 exchanges=2 cid=1 cid_val=dead" \ |
| "$P_CLI dtls=1 serialize=0 exchanges=2 cid=1 cid_val=beef" \ |
| 0 \ |
| -C "Deserializing connection..." \ |
| -s "Deserializing connection..." |
| |
| requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION |
| run_test "Context serialization, both serialize, CCM" \ |
| "$P_SRV dtls=1 serialize=1 exchanges=2" \ |
| "$P_CLI dtls=1 serialize=1 exchanges=2 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8" \ |
| 0 \ |
| -c "Deserializing connection..." \ |
| -s "Deserializing connection..." |
| |
| requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION |
| run_test "Context serialization, both serialize, ChaChaPoly" \ |
| "$P_SRV dtls=1 serialize=1 exchanges=2" \ |
| "$P_CLI dtls=1 serialize=1 exchanges=2 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256" \ |
| 0 \ |
| -c "Deserializing connection..." \ |
| -s "Deserializing connection..." |
| |
| requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION |
| run_test "Context serialization, both serialize, GCM" \ |
| "$P_SRV dtls=1 serialize=1 exchanges=2" \ |
| "$P_CLI dtls=1 serialize=1 exchanges=2 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256" \ |
| 0 \ |
| -c "Deserializing connection..." \ |
| -s "Deserializing connection..." |
| |
| requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| run_test "Context serialization, both serialize, with CID" \ |
| "$P_SRV dtls=1 serialize=1 exchanges=2 cid=1 cid_val=dead" \ |
| "$P_CLI dtls=1 serialize=1 exchanges=2 cid=1 cid_val=beef" \ |
| 0 \ |
| -c "Deserializing connection..." \ |
| -s "Deserializing connection..." |
| |
| requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION |
| run_test "Context serialization, re-init, client serializes, CCM" \ |
| "$P_SRV dtls=1 serialize=0 exchanges=2" \ |
| "$P_CLI dtls=1 serialize=2 exchanges=2 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8" \ |
| 0 \ |
| -c "Deserializing connection..." \ |
| -S "Deserializing connection..." |
| |
| requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION |
| run_test "Context serialization, re-init, client serializes, ChaChaPoly" \ |
| "$P_SRV dtls=1 serialize=0 exchanges=2" \ |
| "$P_CLI dtls=1 serialize=2 exchanges=2 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256" \ |
| 0 \ |
| -c "Deserializing connection..." \ |
| -S "Deserializing connection..." |
| |
| requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION |
| run_test "Context serialization, re-init, client serializes, GCM" \ |
| "$P_SRV dtls=1 serialize=0 exchanges=2" \ |
| "$P_CLI dtls=1 serialize=2 exchanges=2 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256" \ |
| 0 \ |
| -c "Deserializing connection..." \ |
| -S "Deserializing connection..." |
| |
| requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| run_test "Context serialization, re-init, client serializes, with CID" \ |
| "$P_SRV dtls=1 serialize=0 exchanges=2 cid=1 cid_val=dead" \ |
| "$P_CLI dtls=1 serialize=2 exchanges=2 cid=1 cid_val=beef" \ |
| 0 \ |
| -c "Deserializing connection..." \ |
| -S "Deserializing connection..." |
| |
| requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION |
| run_test "Context serialization, re-init, server serializes, CCM" \ |
| "$P_SRV dtls=1 serialize=2 exchanges=2" \ |
| "$P_CLI dtls=1 serialize=0 exchanges=2 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8" \ |
| 0 \ |
| -C "Deserializing connection..." \ |
| -s "Deserializing connection..." |
| |
| requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION |
| run_test "Context serialization, re-init, server serializes, ChaChaPoly" \ |
| "$P_SRV dtls=1 serialize=2 exchanges=2" \ |
| "$P_CLI dtls=1 serialize=0 exchanges=2 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256" \ |
| 0 \ |
| -C "Deserializing connection..." \ |
| -s "Deserializing connection..." |
| |
| requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION |
| run_test "Context serialization, re-init, server serializes, GCM" \ |
| "$P_SRV dtls=1 serialize=2 exchanges=2" \ |
| "$P_CLI dtls=1 serialize=0 exchanges=2 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256" \ |
| 0 \ |
| -C "Deserializing connection..." \ |
| -s "Deserializing connection..." |
| |
| requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| run_test "Context serialization, re-init, server serializes, with CID" \ |
| "$P_SRV dtls=1 serialize=2 exchanges=2 cid=1 cid_val=dead" \ |
| "$P_CLI dtls=1 serialize=0 exchanges=2 cid=1 cid_val=beef" \ |
| 0 \ |
| -C "Deserializing connection..." \ |
| -s "Deserializing connection..." |
| |
| requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION |
| run_test "Context serialization, re-init, both serialize, CCM" \ |
| "$P_SRV dtls=1 serialize=2 exchanges=2" \ |
| "$P_CLI dtls=1 serialize=2 exchanges=2 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8" \ |
| 0 \ |
| -c "Deserializing connection..." \ |
| -s "Deserializing connection..." |
| |
| requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION |
| run_test "Context serialization, re-init, both serialize, ChaChaPoly" \ |
| "$P_SRV dtls=1 serialize=2 exchanges=2" \ |
| "$P_CLI dtls=1 serialize=2 exchanges=2 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256" \ |
| 0 \ |
| -c "Deserializing connection..." \ |
| -s "Deserializing connection..." |
| |
| requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION |
| run_test "Context serialization, re-init, both serialize, GCM" \ |
| "$P_SRV dtls=1 serialize=2 exchanges=2" \ |
| "$P_CLI dtls=1 serialize=2 exchanges=2 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256" \ |
| 0 \ |
| -c "Deserializing connection..." \ |
| -s "Deserializing connection..." |
| |
| requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| run_test "Context serialization, re-init, both serialize, with CID" \ |
| "$P_SRV dtls=1 serialize=2 exchanges=2 cid=1 cid_val=dead" \ |
| "$P_CLI dtls=1 serialize=2 exchanges=2 cid=1 cid_val=beef" \ |
| 0 \ |
| -c "Deserializing connection..." \ |
| -s "Deserializing connection..." |
| |
| requires_config_enabled MBEDTLS_SSL_CONTEXT_SERIALIZATION |
| run_test "Saving the serialized context to a file" \ |
| "$P_SRV dtls=1 serialize=1 context_file=context_srv.txt" \ |
| "$P_CLI dtls=1 serialize=1 context_file=context_cli.txt" \ |
| 0 \ |
| -s "Save serialized context to a file... ok" \ |
| -c "Save serialized context to a file... ok" |
| rm -f context_srv.txt |
| rm -f context_cli.txt |
| |
| # Tests for DTLS Connection ID extension |
| |
| # So far, the CID API isn't implemented, so we can't |
| # grep for output witnessing its use. This needs to be |
| # changed once the CID extension is implemented. |
| |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| run_test "Connection ID: Cli enabled, Srv disabled" \ |
| "$P_SRV debug_level=3 dtls=1 cid=0" \ |
| "$P_CLI debug_level=3 dtls=1 cid=1 cid_val=deadbeef" \ |
| 0 \ |
| -s "Disable use of CID extension." \ |
| -s "found CID extension" \ |
| -s "Client sent CID extension, but CID disabled" \ |
| -c "Enable use of CID extension." \ |
| -c "client hello, adding CID extension" \ |
| -S "server hello, adding CID extension" \ |
| -C "found CID extension" \ |
| -S "Copy CIDs into SSL transform" \ |
| -C "Copy CIDs into SSL transform" \ |
| -c "Use of Connection ID was rejected by the server" |
| |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| run_test "Connection ID: Cli disabled, Srv enabled" \ |
| "$P_SRV debug_level=3 dtls=1 cid=1 cid_val=deadbeef" \ |
| "$P_CLI debug_level=3 dtls=1 cid=0" \ |
| 0 \ |
| -c "Disable use of CID extension." \ |
| -C "client hello, adding CID extension" \ |
| -S "found CID extension" \ |
| -s "Enable use of CID extension." \ |
| -S "server hello, adding CID extension" \ |
| -C "found CID extension" \ |
| -S "Copy CIDs into SSL transform" \ |
| -C "Copy CIDs into SSL transform" \ |
| -s "Use of Connection ID was not offered by client" |
| |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| run_test "Connection ID: Cli+Srv enabled, Cli+Srv CID nonempty" \ |
| "$P_SRV debug_level=3 dtls=1 cid=1 cid_val=dead" \ |
| "$P_CLI debug_level=3 dtls=1 cid=1 cid_val=beef" \ |
| 0 \ |
| -c "Enable use of CID extension." \ |
| -s "Enable use of CID extension." \ |
| -c "client hello, adding CID extension" \ |
| -s "found CID extension" \ |
| -s "Use of CID extension negotiated" \ |
| -s "server hello, adding CID extension" \ |
| -c "found CID extension" \ |
| -c "Use of CID extension negotiated" \ |
| -s "Copy CIDs into SSL transform" \ |
| -c "Copy CIDs into SSL transform" \ |
| -c "Peer CID (length 2 Bytes): de ad" \ |
| -s "Peer CID (length 2 Bytes): be ef" \ |
| -s "Use of Connection ID has been negotiated" \ |
| -c "Use of Connection ID has been negotiated" |
| |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| run_test "Connection ID, 3D: Cli+Srv enabled, Cli+Srv CID nonempty" \ |
| -p "$P_PXY drop=5 delay=5 duplicate=5 bad_cid=1" \ |
| "$P_SRV debug_level=3 dtls=1 cid=1 dgram_packing=0 cid_val=dead" \ |
| "$P_CLI debug_level=3 dtls=1 cid=1 dgram_packing=0 cid_val=beef" \ |
| 0 \ |
| -c "Enable use of CID extension." \ |
| -s "Enable use of CID extension." \ |
| -c "client hello, adding CID extension" \ |
| -s "found CID extension" \ |
| -s "Use of CID extension negotiated" \ |
| -s "server hello, adding CID extension" \ |
| -c "found CID extension" \ |
| -c "Use of CID extension negotiated" \ |
| -s "Copy CIDs into SSL transform" \ |
| -c "Copy CIDs into SSL transform" \ |
| -c "Peer CID (length 2 Bytes): de ad" \ |
| -s "Peer CID (length 2 Bytes): be ef" \ |
| -s "Use of Connection ID has been negotiated" \ |
| -c "Use of Connection ID has been negotiated" \ |
| -c "ignoring unexpected CID" \ |
| -s "ignoring unexpected CID" |
| |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| run_test "Connection ID, MTU: Cli+Srv enabled, Cli+Srv CID nonempty" \ |
| -p "$P_PXY mtu=800" \ |
| "$P_SRV debug_level=3 mtu=800 dtls=1 cid=1 cid_val=dead" \ |
| "$P_CLI debug_level=3 mtu=800 dtls=1 cid=1 cid_val=beef" \ |
| 0 \ |
| -c "Enable use of CID extension." \ |
| -s "Enable use of CID extension." \ |
| -c "client hello, adding CID extension" \ |
| -s "found CID extension" \ |
| -s "Use of CID extension negotiated" \ |
| -s "server hello, adding CID extension" \ |
| -c "found CID extension" \ |
| -c "Use of CID extension negotiated" \ |
| -s "Copy CIDs into SSL transform" \ |
| -c "Copy CIDs into SSL transform" \ |
| -c "Peer CID (length 2 Bytes): de ad" \ |
| -s "Peer CID (length 2 Bytes): be ef" \ |
| -s "Use of Connection ID has been negotiated" \ |
| -c "Use of Connection ID has been negotiated" |
| |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| run_test "Connection ID, 3D+MTU: Cli+Srv enabled, Cli+Srv CID nonempty" \ |
| -p "$P_PXY mtu=800 drop=5 delay=5 duplicate=5 bad_cid=1" \ |
| "$P_SRV debug_level=3 mtu=800 dtls=1 cid=1 cid_val=dead" \ |
| "$P_CLI debug_level=3 mtu=800 dtls=1 cid=1 cid_val=beef" \ |
| 0 \ |
| -c "Enable use of CID extension." \ |
| -s "Enable use of CID extension." \ |
| -c "client hello, adding CID extension" \ |
| -s "found CID extension" \ |
| -s "Use of CID extension negotiated" \ |
| -s "server hello, adding CID extension" \ |
| -c "found CID extension" \ |
| -c "Use of CID extension negotiated" \ |
| -s "Copy CIDs into SSL transform" \ |
| -c "Copy CIDs into SSL transform" \ |
| -c "Peer CID (length 2 Bytes): de ad" \ |
| -s "Peer CID (length 2 Bytes): be ef" \ |
| -s "Use of Connection ID has been negotiated" \ |
| -c "Use of Connection ID has been negotiated" \ |
| -c "ignoring unexpected CID" \ |
| -s "ignoring unexpected CID" |
| |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| run_test "Connection ID: Cli+Srv enabled, Cli CID empty" \ |
| "$P_SRV debug_level=3 dtls=1 cid=1 cid_val=deadbeef" \ |
| "$P_CLI debug_level=3 dtls=1 cid=1" \ |
| 0 \ |
| -c "Enable use of CID extension." \ |
| -s "Enable use of CID extension." \ |
| -c "client hello, adding CID extension" \ |
| -s "found CID extension" \ |
| -s "Use of CID extension negotiated" \ |
| -s "server hello, adding CID extension" \ |
| -c "found CID extension" \ |
| -c "Use of CID extension negotiated" \ |
| -s "Copy CIDs into SSL transform" \ |
| -c "Copy CIDs into SSL transform" \ |
| -c "Peer CID (length 4 Bytes): de ad be ef" \ |
| -s "Peer CID (length 0 Bytes):" \ |
| -s "Use of Connection ID has been negotiated" \ |
| -c "Use of Connection ID has been negotiated" |
| |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| run_test "Connection ID: Cli+Srv enabled, Srv CID empty" \ |
| "$P_SRV debug_level=3 dtls=1 cid=1" \ |
| "$P_CLI debug_level=3 dtls=1 cid=1 cid_val=deadbeef" \ |
| 0 \ |
| -c "Enable use of CID extension." \ |
| -s "Enable use of CID extension." \ |
| -c "client hello, adding CID extension" \ |
| -s "found CID extension" \ |
| -s "Use of CID extension negotiated" \ |
| -s "server hello, adding CID extension" \ |
| -c "found CID extension" \ |
| -c "Use of CID extension negotiated" \ |
| -s "Copy CIDs into SSL transform" \ |
| -c "Copy CIDs into SSL transform" \ |
| -s "Peer CID (length 4 Bytes): de ad be ef" \ |
| -c "Peer CID (length 0 Bytes):" \ |
| -s "Use of Connection ID has been negotiated" \ |
| -c "Use of Connection ID has been negotiated" |
| |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| run_test "Connection ID: Cli+Srv enabled, Cli+Srv CID empty" \ |
| "$P_SRV debug_level=3 dtls=1 cid=1" \ |
| "$P_CLI debug_level=3 dtls=1 cid=1" \ |
| 0 \ |
| -c "Enable use of CID extension." \ |
| -s "Enable use of CID extension." \ |
| -c "client hello, adding CID extension" \ |
| -s "found CID extension" \ |
| -s "Use of CID extension negotiated" \ |
| -s "server hello, adding CID extension" \ |
| -c "found CID extension" \ |
| -c "Use of CID extension negotiated" \ |
| -s "Copy CIDs into SSL transform" \ |
| -c "Copy CIDs into SSL transform" \ |
| -S "Use of Connection ID has been negotiated" \ |
| -C "Use of Connection ID has been negotiated" |
| |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| run_test "Connection ID: Cli+Srv enabled, Cli+Srv CID nonempty, AES-128-CCM-8" \ |
| "$P_SRV debug_level=3 dtls=1 cid=1 cid_val=dead" \ |
| "$P_CLI debug_level=3 dtls=1 cid=1 cid_val=beef force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8" \ |
| 0 \ |
| -c "Enable use of CID extension." \ |
| -s "Enable use of CID extension." \ |
| -c "client hello, adding CID extension" \ |
| -s "found CID extension" \ |
| -s "Use of CID extension negotiated" \ |
| -s "server hello, adding CID extension" \ |
| -c "found CID extension" \ |
| -c "Use of CID extension negotiated" \ |
| -s "Copy CIDs into SSL transform" \ |
| -c "Copy CIDs into SSL transform" \ |
| -c "Peer CID (length 2 Bytes): de ad" \ |
| -s "Peer CID (length 2 Bytes): be ef" \ |
| -s "Use of Connection ID has been negotiated" \ |
| -c "Use of Connection ID has been negotiated" |
| |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| run_test "Connection ID: Cli+Srv enabled, Cli CID empty, AES-128-CCM-8" \ |
| "$P_SRV debug_level=3 dtls=1 cid=1 cid_val=deadbeef" \ |
| "$P_CLI debug_level=3 dtls=1 cid=1 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8" \ |
| 0 \ |
| -c "Enable use of CID extension." \ |
| -s "Enable use of CID extension." \ |
| -c "client hello, adding CID extension" \ |
| -s "found CID extension" \ |
| -s "Use of CID extension negotiated" \ |
| -s "server hello, adding CID extension" \ |
| -c "found CID extension" \ |
| -c "Use of CID extension negotiated" \ |
| -s "Copy CIDs into SSL transform" \ |
| -c "Copy CIDs into SSL transform" \ |
| -c "Peer CID (length 4 Bytes): de ad be ef" \ |
| -s "Peer CID (length 0 Bytes):" \ |
| -s "Use of Connection ID has been negotiated" \ |
| -c "Use of Connection ID has been negotiated" |
| |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| run_test "Connection ID: Cli+Srv enabled, Srv CID empty, AES-128-CCM-8" \ |
| "$P_SRV debug_level=3 dtls=1 cid=1" \ |
| "$P_CLI debug_level=3 dtls=1 cid=1 cid_val=deadbeef force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8" \ |
| 0 \ |
| -c "Enable use of CID extension." \ |
| -s "Enable use of CID extension." \ |
| -c "client hello, adding CID extension" \ |
| -s "found CID extension" \ |
| -s "Use of CID extension negotiated" \ |
| -s "server hello, adding CID extension" \ |
| -c "found CID extension" \ |
| -c "Use of CID extension negotiated" \ |
| -s "Copy CIDs into SSL transform" \ |
| -c "Copy CIDs into SSL transform" \ |
| -s "Peer CID (length 4 Bytes): de ad be ef" \ |
| -c "Peer CID (length 0 Bytes):" \ |
| -s "Use of Connection ID has been negotiated" \ |
| -c "Use of Connection ID has been negotiated" |
| |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| run_test "Connection ID: Cli+Srv enabled, Cli+Srv CID empty, AES-128-CCM-8" \ |
| "$P_SRV debug_level=3 dtls=1 cid=1" \ |
| "$P_CLI debug_level=3 dtls=1 cid=1 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8" \ |
| 0 \ |
| -c "Enable use of CID extension." \ |
| -s "Enable use of CID extension." \ |
| -c "client hello, adding CID extension" \ |
| -s "found CID extension" \ |
| -s "Use of CID extension negotiated" \ |
| -s "server hello, adding CID extension" \ |
| -c "found CID extension" \ |
| -c "Use of CID extension negotiated" \ |
| -s "Copy CIDs into SSL transform" \ |
| -c "Copy CIDs into SSL transform" \ |
| -S "Use of Connection ID has been negotiated" \ |
| -C "Use of Connection ID has been negotiated" |
| |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| run_test "Connection ID: Cli+Srv enabled, Cli+Srv CID nonempty, AES-128-CBC" \ |
| "$P_SRV debug_level=3 dtls=1 cid=1 cid_val=dead" \ |
| "$P_CLI debug_level=3 dtls=1 cid=1 cid_val=beef force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256" \ |
| 0 \ |
| -c "Enable use of CID extension." \ |
| -s "Enable use of CID extension." \ |
| -c "client hello, adding CID extension" \ |
| -s "found CID extension" \ |
| -s "Use of CID extension negotiated" \ |
| -s "server hello, adding CID extension" \ |
| -c "found CID extension" \ |
| -c "Use of CID extension negotiated" \ |
| -s "Copy CIDs into SSL transform" \ |
| -c "Copy CIDs into SSL transform" \ |
| -c "Peer CID (length 2 Bytes): de ad" \ |
| -s "Peer CID (length 2 Bytes): be ef" \ |
| -s "Use of Connection ID has been negotiated" \ |
| -c "Use of Connection ID has been negotiated" |
| |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| run_test "Connection ID: Cli+Srv enabled, Cli CID empty, AES-128-CBC" \ |
| "$P_SRV debug_level=3 dtls=1 cid=1 cid_val=deadbeef" \ |
| "$P_CLI debug_level=3 dtls=1 cid=1 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256" \ |
| 0 \ |
| -c "Enable use of CID extension." \ |
| -s "Enable use of CID extension." \ |
| -c "client hello, adding CID extension" \ |
| -s "found CID extension" \ |
| -s "Use of CID extension negotiated" \ |
| -s "server hello, adding CID extension" \ |
| -c "found CID extension" \ |
| -c "Use of CID extension negotiated" \ |
| -s "Copy CIDs into SSL transform" \ |
| -c "Copy CIDs into SSL transform" \ |
| -c "Peer CID (length 4 Bytes): de ad be ef" \ |
| -s "Peer CID (length 0 Bytes):" \ |
| -s "Use of Connection ID has been negotiated" \ |
| -c "Use of Connection ID has been negotiated" |
| |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| run_test "Connection ID: Cli+Srv enabled, Srv CID empty, AES-128-CBC" \ |
| "$P_SRV debug_level=3 dtls=1 cid=1" \ |
| "$P_CLI debug_level=3 dtls=1 cid=1 cid_val=deadbeef force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256" \ |
| 0 \ |
| -c "Enable use of CID extension." \ |
| -s "Enable use of CID extension." \ |
| -c "client hello, adding CID extension" \ |
| -s "found CID extension" \ |
| -s "Use of CID extension negotiated" \ |
| -s "server hello, adding CID extension" \ |
| -c "found CID extension" \ |
| -c "Use of CID extension negotiated" \ |
| -s "Copy CIDs into SSL transform" \ |
| -c "Copy CIDs into SSL transform" \ |
| -s "Peer CID (length 4 Bytes): de ad be ef" \ |
| -c "Peer CID (length 0 Bytes):" \ |
| -s "Use of Connection ID has been negotiated" \ |
| -c "Use of Connection ID has been negotiated" |
| |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| run_test "Connection ID: Cli+Srv enabled, Cli+Srv CID empty, AES-128-CBC" \ |
| "$P_SRV debug_level=3 dtls=1 cid=1" \ |
| "$P_CLI debug_level=3 dtls=1 cid=1 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256" \ |
| 0 \ |
| -c "Enable use of CID extension." \ |
| -s "Enable use of CID extension." \ |
| -c "client hello, adding CID extension" \ |
| -s "found CID extension" \ |
| -s "Use of CID extension negotiated" \ |
| -s "server hello, adding CID extension" \ |
| -c "found CID extension" \ |
| -c "Use of CID extension negotiated" \ |
| -s "Copy CIDs into SSL transform" \ |
| -c "Copy CIDs into SSL transform" \ |
| -S "Use of Connection ID has been negotiated" \ |
| -C "Use of Connection ID has been negotiated" |
| |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Connection ID: Cli+Srv enabled, renegotiate without change of CID" \ |
| "$P_SRV debug_level=3 dtls=1 cid=1 cid_val=dead renegotiation=1" \ |
| "$P_CLI debug_level=3 dtls=1 cid=1 cid_val=beef renegotiation=1 renegotiate=1" \ |
| 0 \ |
| -c "(initial handshake) Peer CID (length 2 Bytes): de ad" \ |
| -s "(initial handshake) Peer CID (length 2 Bytes): be ef" \ |
| -s "(initial handshake) Use of Connection ID has been negotiated" \ |
| -c "(initial handshake) Use of Connection ID has been negotiated" \ |
| -c "(after renegotiation) Peer CID (length 2 Bytes): de ad" \ |
| -s "(after renegotiation) Peer CID (length 2 Bytes): be ef" \ |
| -s "(after renegotiation) Use of Connection ID has been negotiated" \ |
| -c "(after renegotiation) Use of Connection ID has been negotiated" |
| |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Connection ID: Cli+Srv enabled, renegotiate with different CID" \ |
| "$P_SRV debug_level=3 dtls=1 cid=1 cid_val=dead cid_val_renego=beef renegotiation=1" \ |
| "$P_CLI debug_level=3 dtls=1 cid=1 cid_val=beef cid_val_renego=dead renegotiation=1 renegotiate=1" \ |
| 0 \ |
| -c "(initial handshake) Peer CID (length 2 Bytes): de ad" \ |
| -s "(initial handshake) Peer CID (length 2 Bytes): be ef" \ |
| -s "(initial handshake) Use of Connection ID has been negotiated" \ |
| -c "(initial handshake) Use of Connection ID has been negotiated" \ |
| -c "(after renegotiation) Peer CID (length 2 Bytes): be ef" \ |
| -s "(after renegotiation) Peer CID (length 2 Bytes): de ad" \ |
| -s "(after renegotiation) Use of Connection ID has been negotiated" \ |
| -c "(after renegotiation) Use of Connection ID has been negotiated" |
| |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Connection ID, no packing: Cli+Srv enabled, renegotiate with different CID" \ |
| "$P_SRV debug_level=3 dtls=1 cid=1 dgram_packing=0 cid_val=dead cid_val_renego=beef renegotiation=1" \ |
| "$P_CLI debug_level=3 dtls=1 cid=1 dgram_packing=0 cid_val=beef cid_val_renego=dead renegotiation=1 renegotiate=1" \ |
| 0 \ |
| -c "(initial handshake) Peer CID (length 2 Bytes): de ad" \ |
| -s "(initial handshake) Peer CID (length 2 Bytes): be ef" \ |
| -s "(initial handshake) Use of Connection ID has been negotiated" \ |
| -c "(initial handshake) Use of Connection ID has been negotiated" \ |
| -c "(after renegotiation) Peer CID (length 2 Bytes): be ef" \ |
| -s "(after renegotiation) Peer CID (length 2 Bytes): de ad" \ |
| -s "(after renegotiation) Use of Connection ID has been negotiated" \ |
| -c "(after renegotiation) Use of Connection ID has been negotiated" |
| |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Connection ID, 3D+MTU: Cli+Srv enabled, renegotiate with different CID" \ |
| -p "$P_PXY mtu=800 drop=5 delay=5 duplicate=5 bad_cid=1" \ |
| "$P_SRV debug_level=3 mtu=800 dtls=1 cid=1 cid_val=dead cid_val_renego=beef renegotiation=1" \ |
| "$P_CLI debug_level=3 mtu=800 dtls=1 cid=1 cid_val=beef cid_val_renego=dead renegotiation=1 renegotiate=1" \ |
| 0 \ |
| -c "(initial handshake) Peer CID (length 2 Bytes): de ad" \ |
| -s "(initial handshake) Peer CID (length 2 Bytes): be ef" \ |
| -s "(initial handshake) Use of Connection ID has been negotiated" \ |
| -c "(initial handshake) Use of Connection ID has been negotiated" \ |
| -c "(after renegotiation) Peer CID (length 2 Bytes): be ef" \ |
| -s "(after renegotiation) Peer CID (length 2 Bytes): de ad" \ |
| -s "(after renegotiation) Use of Connection ID has been negotiated" \ |
| -c "(after renegotiation) Use of Connection ID has been negotiated" \ |
| -c "ignoring unexpected CID" \ |
| -s "ignoring unexpected CID" |
| |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Connection ID: Cli+Srv enabled, renegotiate without CID" \ |
| "$P_SRV debug_level=3 dtls=1 cid=1 cid_val=dead cid_renego=0 renegotiation=1" \ |
| "$P_CLI debug_level=3 dtls=1 cid=1 cid_val=beef cid_renego=0 renegotiation=1 renegotiate=1" \ |
| 0 \ |
| -c "(initial handshake) Peer CID (length 2 Bytes): de ad" \ |
| -s "(initial handshake) Peer CID (length 2 Bytes): be ef" \ |
| -s "(initial handshake) Use of Connection ID has been negotiated" \ |
| -c "(initial handshake) Use of Connection ID has been negotiated" \ |
| -C "(after renegotiation) Peer CID (length 2 Bytes): de ad" \ |
| -S "(after renegotiation) Peer CID (length 2 Bytes): be ef" \ |
| -C "(after renegotiation) Use of Connection ID has been negotiated" \ |
| -S "(after renegotiation) Use of Connection ID has been negotiated" |
| |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Connection ID, no packing: Cli+Srv enabled, renegotiate without CID" \ |
| "$P_SRV debug_level=3 dtls=1 dgram_packing=0 cid=1 cid_val=dead cid_renego=0 renegotiation=1" \ |
| "$P_CLI debug_level=3 dtls=1 dgram_packing=0 cid=1 cid_val=beef cid_renego=0 renegotiation=1 renegotiate=1" \ |
| 0 \ |
| -c "(initial handshake) Peer CID (length 2 Bytes): de ad" \ |
| -s "(initial handshake) Peer CID (length 2 Bytes): be ef" \ |
| -s "(initial handshake) Use of Connection ID has been negotiated" \ |
| -c "(initial handshake) Use of Connection ID has been negotiated" \ |
| -C "(after renegotiation) Peer CID (length 2 Bytes): de ad" \ |
| -S "(after renegotiation) Peer CID (length 2 Bytes): be ef" \ |
| -C "(after renegotiation) Use of Connection ID has been negotiated" \ |
| -S "(after renegotiation) Use of Connection ID has been negotiated" |
| |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Connection ID, 3D+MTU: Cli+Srv enabled, renegotiate without CID" \ |
| -p "$P_PXY drop=5 delay=5 duplicate=5 bad_cid=1" \ |
| "$P_SRV debug_level=3 mtu=800 dtls=1 cid=1 cid_val=dead cid_renego=0 renegotiation=1" \ |
| "$P_CLI debug_level=3 mtu=800 dtls=1 cid=1 cid_val=beef cid_renego=0 renegotiation=1 renegotiate=1" \ |
| 0 \ |
| -c "(initial handshake) Peer CID (length 2 Bytes): de ad" \ |
| -s "(initial handshake) Peer CID (length 2 Bytes): be ef" \ |
| -s "(initial handshake) Use of Connection ID has been negotiated" \ |
| -c "(initial handshake) Use of Connection ID has been negotiated" \ |
| -C "(after renegotiation) Peer CID (length 2 Bytes): de ad" \ |
| -S "(after renegotiation) Peer CID (length 2 Bytes): be ef" \ |
| -C "(after renegotiation) Use of Connection ID has been negotiated" \ |
| -S "(after renegotiation) Use of Connection ID has been negotiated" \ |
| -c "ignoring unexpected CID" \ |
| -s "ignoring unexpected CID" |
| |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Connection ID: Cli+Srv enabled, CID on renegotiation" \ |
| "$P_SRV debug_level=3 dtls=1 cid=0 cid_renego=1 cid_val_renego=dead renegotiation=1" \ |
| "$P_CLI debug_level=3 dtls=1 cid=0 cid_renego=1 cid_val_renego=beef renegotiation=1 renegotiate=1" \ |
| 0 \ |
| -S "(initial handshake) Use of Connection ID has been negotiated" \ |
| -C "(initial handshake) Use of Connection ID has been negotiated" \ |
| -c "(after renegotiation) Peer CID (length 2 Bytes): de ad" \ |
| -s "(after renegotiation) Peer CID (length 2 Bytes): be ef" \ |
| -c "(after renegotiation) Use of Connection ID has been negotiated" \ |
| -s "(after renegotiation) Use of Connection ID has been negotiated" |
| |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Connection ID, no packing: Cli+Srv enabled, CID on renegotiation" \ |
| "$P_SRV debug_level=3 dtls=1 dgram_packing=0 cid=0 cid_renego=1 cid_val_renego=dead renegotiation=1" \ |
| "$P_CLI debug_level=3 dtls=1 dgram_packing=0 cid=0 cid_renego=1 cid_val_renego=beef renegotiation=1 renegotiate=1" \ |
| 0 \ |
| -S "(initial handshake) Use of Connection ID has been negotiated" \ |
| -C "(initial handshake) Use of Connection ID has been negotiated" \ |
| -c "(after renegotiation) Peer CID (length 2 Bytes): de ad" \ |
| -s "(after renegotiation) Peer CID (length 2 Bytes): be ef" \ |
| -c "(after renegotiation) Use of Connection ID has been negotiated" \ |
| -s "(after renegotiation) Use of Connection ID has been negotiated" |
| |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Connection ID, 3D+MTU: Cli+Srv enabled, CID on renegotiation" \ |
| -p "$P_PXY mtu=800 drop=5 delay=5 duplicate=5 bad_cid=1" \ |
| "$P_SRV debug_level=3 mtu=800 dtls=1 dgram_packing=1 cid=0 cid_renego=1 cid_val_renego=dead renegotiation=1" \ |
| "$P_CLI debug_level=3 mtu=800 dtls=1 dgram_packing=1 cid=0 cid_renego=1 cid_val_renego=beef renegotiation=1 renegotiate=1" \ |
| 0 \ |
| -S "(initial handshake) Use of Connection ID has been negotiated" \ |
| -C "(initial handshake) Use of Connection ID has been negotiated" \ |
| -c "(after renegotiation) Peer CID (length 2 Bytes): de ad" \ |
| -s "(after renegotiation) Peer CID (length 2 Bytes): be ef" \ |
| -c "(after renegotiation) Use of Connection ID has been negotiated" \ |
| -s "(after renegotiation) Use of Connection ID has been negotiated" \ |
| -c "ignoring unexpected CID" \ |
| -s "ignoring unexpected CID" |
| |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Connection ID: Cli+Srv enabled, Cli disables on renegotiation" \ |
| "$P_SRV debug_level=3 dtls=1 cid=1 cid_val=dead renegotiation=1" \ |
| "$P_CLI debug_level=3 dtls=1 cid=1 cid_val=beef cid_renego=0 renegotiation=1 renegotiate=1" \ |
| 0 \ |
| -c "(initial handshake) Peer CID (length 2 Bytes): de ad" \ |
| -s "(initial handshake) Peer CID (length 2 Bytes): be ef" \ |
| -s "(initial handshake) Use of Connection ID has been negotiated" \ |
| -c "(initial handshake) Use of Connection ID has been negotiated" \ |
| -C "(after renegotiation) Peer CID (length 2 Bytes): de ad" \ |
| -S "(after renegotiation) Peer CID (length 2 Bytes): be ef" \ |
| -C "(after renegotiation) Use of Connection ID has been negotiated" \ |
| -S "(after renegotiation) Use of Connection ID has been negotiated" \ |
| -s "(after renegotiation) Use of Connection ID was not offered by client" |
| |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Connection ID, 3D: Cli+Srv enabled, Cli disables on renegotiation" \ |
| -p "$P_PXY drop=5 delay=5 duplicate=5 bad_cid=1" \ |
| "$P_SRV debug_level=3 dtls=1 cid=1 cid_val=dead renegotiation=1" \ |
| "$P_CLI debug_level=3 dtls=1 cid=1 cid_val=beef cid_renego=0 renegotiation=1 renegotiate=1" \ |
| 0 \ |
| -c "(initial handshake) Peer CID (length 2 Bytes): de ad" \ |
| -s "(initial handshake) Peer CID (length 2 Bytes): be ef" \ |
| -s "(initial handshake) Use of Connection ID has been negotiated" \ |
| -c "(initial handshake) Use of Connection ID has been negotiated" \ |
| -C "(after renegotiation) Peer CID (length 2 Bytes): de ad" \ |
| -S "(after renegotiation) Peer CID (length 2 Bytes): be ef" \ |
| -C "(after renegotiation) Use of Connection ID has been negotiated" \ |
| -S "(after renegotiation) Use of Connection ID has been negotiated" \ |
| -s "(after renegotiation) Use of Connection ID was not offered by client" \ |
| -c "ignoring unexpected CID" \ |
| -s "ignoring unexpected CID" |
| |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Connection ID: Cli+Srv enabled, Srv disables on renegotiation" \ |
| "$P_SRV debug_level=3 dtls=1 cid=1 cid_val=dead cid_renego=0 renegotiation=1" \ |
| "$P_CLI debug_level=3 dtls=1 cid=1 cid_val=beef renegotiation=1 renegotiate=1" \ |
| 0 \ |
| -c "(initial handshake) Peer CID (length 2 Bytes): de ad" \ |
| -s "(initial handshake) Peer CID (length 2 Bytes): be ef" \ |
| -s "(initial handshake) Use of Connection ID has been negotiated" \ |
| -c "(initial handshake) Use of Connection ID has been negotiated" \ |
| -C "(after renegotiation) Peer CID (length 2 Bytes): de ad" \ |
| -S "(after renegotiation) Peer CID (length 2 Bytes): be ef" \ |
| -C "(after renegotiation) Use of Connection ID has been negotiated" \ |
| -S "(after renegotiation) Use of Connection ID has been negotiated" \ |
| -c "(after renegotiation) Use of Connection ID was rejected by the server" |
| |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Connection ID, 3D: Cli+Srv enabled, Srv disables on renegotiation" \ |
| -p "$P_PXY drop=5 delay=5 duplicate=5 bad_cid=1" \ |
| "$P_SRV debug_level=3 dtls=1 cid=1 cid_val=dead cid_renego=0 renegotiation=1" \ |
| "$P_CLI debug_level=3 dtls=1 cid=1 cid_val=beef renegotiation=1 renegotiate=1" \ |
| 0 \ |
| -c "(initial handshake) Peer CID (length 2 Bytes): de ad" \ |
| -s "(initial handshake) Peer CID (length 2 Bytes): be ef" \ |
| -s "(initial handshake) Use of Connection ID has been negotiated" \ |
| -c "(initial handshake) Use of Connection ID has been negotiated" \ |
| -C "(after renegotiation) Peer CID (length 2 Bytes): de ad" \ |
| -S "(after renegotiation) Peer CID (length 2 Bytes): be ef" \ |
| -C "(after renegotiation) Use of Connection ID has been negotiated" \ |
| -S "(after renegotiation) Use of Connection ID has been negotiated" \ |
| -c "(after renegotiation) Use of Connection ID was rejected by the server" \ |
| -c "ignoring unexpected CID" \ |
| -s "ignoring unexpected CID" |
| |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| requires_config_enabled MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH |
| run_test "Connection ID: Cli+Srv enabled, variable buffer lengths, MFL=512" \ |
| "$P_SRV dtls=1 cid=1 cid_val=dead debug_level=2" \ |
| "$P_CLI force_ciphersuite="TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8" max_frag_len=512 dtls=1 cid=1 cid_val=beef" \ |
| 0 \ |
| -c "(initial handshake) Peer CID (length 2 Bytes): de ad" \ |
| -s "(initial handshake) Peer CID (length 2 Bytes): be ef" \ |
| -s "(initial handshake) Use of Connection ID has been negotiated" \ |
| -c "(initial handshake) Use of Connection ID has been negotiated" \ |
| -s "Reallocating in_buf" \ |
| -s "Reallocating out_buf" |
| |
| requires_config_enabled MBEDTLS_SSL_DTLS_CONNECTION_ID |
| requires_config_enabled MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH |
| run_test "Connection ID: Cli+Srv enabled, variable buffer lengths, MFL=1024" \ |
| "$P_SRV dtls=1 cid=1 cid_val=dead debug_level=2" \ |
| "$P_CLI force_ciphersuite="TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8" max_frag_len=1024 dtls=1 cid=1 cid_val=beef" \ |
| 0 \ |
| -c "(initial handshake) Peer CID (length 2 Bytes): de ad" \ |
| -s "(initial handshake) Peer CID (length 2 Bytes): be ef" \ |
| -s "(initial handshake) Use of Connection ID has been negotiated" \ |
| -c "(initial handshake) Use of Connection ID has been negotiated" \ |
| -s "Reallocating in_buf" \ |
| -s "Reallocating out_buf" |
| |
| # Tests for Encrypt-then-MAC extension |
| |
| run_test "Encrypt then MAC: default" \ |
| "$P_SRV debug_level=3 \ |
| force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| "$P_CLI debug_level=3" \ |
| 0 \ |
| -c "client hello, adding encrypt_then_mac extension" \ |
| -s "found encrypt then mac extension" \ |
| -s "server hello, adding encrypt then mac extension" \ |
| -c "found encrypt_then_mac extension" \ |
| -c "using encrypt then mac" \ |
| -s "using encrypt then mac" |
| |
| run_test "Encrypt then MAC: client enabled, server disabled" \ |
| "$P_SRV debug_level=3 etm=0 \ |
| force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| "$P_CLI debug_level=3 etm=1" \ |
| 0 \ |
| -c "client hello, adding encrypt_then_mac extension" \ |
| -s "found encrypt then mac extension" \ |
| -S "server hello, adding encrypt then mac extension" \ |
| -C "found encrypt_then_mac extension" \ |
| -C "using encrypt then mac" \ |
| -S "using encrypt then mac" |
| |
| run_test "Encrypt then MAC: client enabled, aead cipher" \ |
| "$P_SRV debug_level=3 etm=1 \ |
| force_ciphersuite=TLS-RSA-WITH-AES-128-GCM-SHA256" \ |
| "$P_CLI debug_level=3 etm=1" \ |
| 0 \ |
| -c "client hello, adding encrypt_then_mac extension" \ |
| -s "found encrypt then mac extension" \ |
| -S "server hello, adding encrypt then mac extension" \ |
| -C "found encrypt_then_mac extension" \ |
| -C "using encrypt then mac" \ |
| -S "using encrypt then mac" |
| |
| run_test "Encrypt then MAC: client disabled, server enabled" \ |
| "$P_SRV debug_level=3 etm=1 \ |
| force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
| "$P_CLI debug_level=3 etm=0" \ |
| 0 \ |
| -C "client hello, adding encrypt_then_mac extension" \ |
| -S "found encrypt then mac extension" \ |
| -S "server hello, adding encrypt then mac extension" \ |
| -C "found encrypt_then_mac extension" \ |
| -C "using encrypt then mac" \ |
| -S "using encrypt then mac" |
| |
| # Tests for Extended Master Secret extension |
| |
| run_test "Extended Master Secret: default" \ |
| "$P_SRV debug_level=3" \ |
| "$P_CLI debug_level=3" \ |
| 0 \ |
| -c "client hello, adding extended_master_secret extension" \ |
| -s "found extended master secret extension" \ |
| -s "server hello, adding extended master secret extension" \ |
| -c "found extended_master_secret extension" \ |
| -c "session hash for extended master secret" \ |
| -s "session hash for extended master secret" |
| |
| run_test "Extended Master Secret: client enabled, server disabled" \ |
| "$P_SRV debug_level=3 extended_ms=0" \ |
| "$P_CLI debug_level=3 extended_ms=1" \ |
| 0 \ |
| -c "client hello, adding extended_master_secret extension" \ |
| -s "found extended master secret extension" \ |
| -S "server hello, adding extended master secret extension" \ |
| -C "found extended_master_secret extension" \ |
| -C "session hash for extended master secret" \ |
| -S "session hash for extended master secret" |
| |
| run_test "Extended Master Secret: client disabled, server enabled" \ |
| "$P_SRV debug_level=3 extended_ms=1" \ |
| "$P_CLI debug_level=3 extended_ms=0" \ |
| 0 \ |
| -C "client hello, adding extended_master_secret extension" \ |
| -S "found extended master secret extension" \ |
| -S "server hello, adding extended master secret extension" \ |
| -C "found extended_master_secret extension" \ |
| -C "session hash for extended master secret" \ |
| -S "session hash for extended master secret" |
| |
| # Tests for FALLBACK_SCSV |
| |
| run_test "Fallback SCSV: enabled, max version" \ |
| "$P_SRV debug_level=2" \ |
| "$P_CLI debug_level=3 fallback=1" \ |
| 0 \ |
| -c "adding FALLBACK_SCSV" \ |
| -s "received FALLBACK_SCSV" \ |
| -S "inapropriate fallback" \ |
| -C "is a fatal alert message (msg 86)" |
| |
| requires_openssl_with_fallback_scsv |
| run_test "Fallback SCSV: enabled, max version, openssl client" \ |
| "$P_SRV debug_level=2" \ |
| "$O_CLI -fallback_scsv" \ |
| 0 \ |
| -s "received FALLBACK_SCSV" \ |
| -S "inapropriate fallback" |
| |
| # Test sending and receiving empty application data records |
| |
| run_test "Encrypt then MAC: empty application data record" \ |
| "$P_SRV auth_mode=none debug_level=4 etm=1" \ |
| "$P_CLI auth_mode=none etm=1 request_size=0 force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA" \ |
| 0 \ |
| -S "0000: 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f" \ |
| -s "dumping 'input payload after decrypt' (0 bytes)" \ |
| -c "0 bytes written in 1 fragments" |
| |
| run_test "Encrypt then MAC: disabled, empty application data record" \ |
| "$P_SRV auth_mode=none debug_level=4 etm=0" \ |
| "$P_CLI auth_mode=none etm=0 request_size=0" \ |
| 0 \ |
| -s "dumping 'input payload after decrypt' (0 bytes)" \ |
| -c "0 bytes written in 1 fragments" |
| |
| run_test "Encrypt then MAC, DTLS: empty application data record" \ |
| "$P_SRV auth_mode=none debug_level=4 etm=1 dtls=1" \ |
| "$P_CLI auth_mode=none etm=1 request_size=0 force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA dtls=1" \ |
| 0 \ |
| -S "0000: 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f" \ |
| -s "dumping 'input payload after decrypt' (0 bytes)" \ |
| -c "0 bytes written in 1 fragments" |
| |
| run_test "Encrypt then MAC, DTLS: disabled, empty application data record" \ |
| "$P_SRV auth_mode=none debug_level=4 etm=0 dtls=1" \ |
| "$P_CLI auth_mode=none etm=0 request_size=0 dtls=1" \ |
| 0 \ |
| -s "dumping 'input payload after decrypt' (0 bytes)" \ |
| -c "0 bytes written in 1 fragments" |
| |
| # Tests for CBC 1/n-1 record splitting |
| |
| run_test "CBC Record splitting: TLS 1.2, no splitting" \ |
| "$P_SRV" \ |
| "$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA \ |
| request_size=123 force_version=tls1_2" \ |
| 0 \ |
| -s "Read from client: 123 bytes read" \ |
| -S "Read from client: 1 bytes read" \ |
| -S "122 bytes read" |
| |
| # Tests for Session Tickets |
| |
| run_test "Session resume using tickets: basic" \ |
| "$P_SRV debug_level=3 tickets=1" \ |
| "$P_CLI debug_level=3 tickets=1 reconnect=1" \ |
| 0 \ |
| -c "client hello, adding session ticket extension" \ |
| -s "found session ticket extension" \ |
| -s "server hello, adding session ticket extension" \ |
| -c "found session_ticket extension" \ |
| -c "parse new session ticket" \ |
| -S "session successfully restored from cache" \ |
| -s "session successfully restored from ticket" \ |
| -s "a session has been resumed" \ |
| -c "a session has been resumed" |
| |
| run_test "Session resume using tickets: cache disabled" \ |
| "$P_SRV debug_level=3 tickets=1 cache_max=0" \ |
| "$P_CLI debug_level=3 tickets=1 reconnect=1" \ |
| 0 \ |
| -c "client hello, adding session ticket extension" \ |
| -s "found session ticket extension" \ |
| -s "server hello, adding session ticket extension" \ |
| -c "found session_ticket extension" \ |
| -c "parse new session ticket" \ |
| -S "session successfully restored from cache" \ |
| -s "session successfully restored from ticket" \ |
| -s "a session has been resumed" \ |
| -c "a session has been resumed" |
| |
| run_test "Session resume using tickets: timeout" \ |
| "$P_SRV debug_level=3 tickets=1 cache_max=0 ticket_timeout=1" \ |
| "$P_CLI debug_level=3 tickets=1 reconnect=1 reco_delay=2" \ |
| 0 \ |
| -c "client hello, adding session ticket extension" \ |
| -s "found session ticket extension" \ |
| -s "server hello, adding session ticket extension" \ |
| -c "found session_ticket extension" \ |
| -c "parse new session ticket" \ |
| -S "session successfully restored from cache" \ |
| -S "session successfully restored from ticket" \ |
| -S "a session has been resumed" \ |
| -C "a session has been resumed" |
| |
| run_test "Session resume using tickets: session copy" \ |
| "$P_SRV debug_level=3 tickets=1 cache_max=0" \ |
| "$P_CLI debug_level=3 tickets=1 reconnect=1 reco_mode=0" \ |
| 0 \ |
| -c "client hello, adding session ticket extension" \ |
| -s "found session ticket extension" \ |
| -s "server hello, adding session ticket extension" \ |
| -c "found session_ticket extension" \ |
| -c "parse new session ticket" \ |
| -S "session successfully restored from cache" \ |
| -s "session successfully restored from ticket" \ |
| -s "a session has been resumed" \ |
| -c "a session has been resumed" |
| |
| run_test "Session resume using tickets: openssl server" \ |
| "$O_SRV" \ |
| "$P_CLI debug_level=3 tickets=1 reconnect=1" \ |
| 0 \ |
| -c "client hello, adding session ticket extension" \ |
| -c "found session_ticket extension" \ |
| -c "parse new session ticket" \ |
| -c "a session has been resumed" |
| |
| run_test "Session resume using tickets: openssl client" \ |
| "$P_SRV debug_level=3 tickets=1" \ |
| "( $O_CLI -sess_out $SESSION; \ |
| $O_CLI -sess_in $SESSION; \ |
| rm -f $SESSION )" \ |
| 0 \ |
| -s "found session ticket extension" \ |
| -s "server hello, adding session ticket extension" \ |
| -S "session successfully restored from cache" \ |
| -s "session successfully restored from ticket" \ |
| -s "a session has been resumed" |
| |
| # Tests for Session Tickets with DTLS |
| |
| run_test "Session resume using tickets, DTLS: basic" \ |
| "$P_SRV debug_level=3 dtls=1 tickets=1" \ |
| "$P_CLI debug_level=3 dtls=1 tickets=1 reconnect=1 skip_close_notify=1" \ |
| 0 \ |
| -c "client hello, adding session ticket extension" \ |
| -s "found session ticket extension" \ |
| -s "server hello, adding session ticket extension" \ |
| -c "found session_ticket extension" \ |
| -c "parse new session ticket" \ |
| -S "session successfully restored from cache" \ |
| -s "session successfully restored from ticket" \ |
| -s "a session has been resumed" \ |
| -c "a session has been resumed" |
| |
| run_test "Session resume using tickets, DTLS: cache disabled" \ |
| "$P_SRV debug_level=3 dtls=1 tickets=1 cache_max=0" \ |
| "$P_CLI debug_level=3 dtls=1 tickets=1 reconnect=1 skip_close_notify=1" \ |
| 0 \ |
| -c "client hello, adding session ticket extension" \ |
| -s "found session ticket extension" \ |
| -s "server hello, adding session ticket extension" \ |
| -c "found session_ticket extension" \ |
| -c "parse new session ticket" \ |
| -S "session successfully restored from cache" \ |
| -s "session successfully restored from ticket" \ |
| -s "a session has been resumed" \ |
| -c "a session has been resumed" |
| |
| run_test "Session resume using tickets, DTLS: timeout" \ |
| "$P_SRV debug_level=3 dtls=1 tickets=1 cache_max=0 ticket_timeout=1" \ |
| "$P_CLI debug_level=3 dtls=1 tickets=1 reconnect=1 skip_close_notify=1 reco_delay=2" \ |
| 0 \ |
| -c "client hello, adding session ticket extension" \ |
| -s "found session ticket extension" \ |
| -s "server hello, adding session ticket extension" \ |
| -c "found session_ticket extension" \ |
| -c "parse new session ticket" \ |
| -S "session successfully restored from cache" \ |
| -S "session successfully restored from ticket" \ |
| -S "a session has been resumed" \ |
| -C "a session has been resumed" |
| |
| run_test "Session resume using tickets, DTLS: session copy" \ |
| "$P_SRV debug_level=3 dtls=1 tickets=1 cache_max=0" \ |
| "$P_CLI debug_level=3 dtls=1 tickets=1 reconnect=1 skip_close_notify=1 reco_mode=0" \ |
| 0 \ |
| -c "client hello, adding session ticket extension" \ |
| -s "found session ticket extension" \ |
| -s "server hello, adding session ticket extension" \ |
| -c "found session_ticket extension" \ |
| -c "parse new session ticket" \ |
| -S "session successfully restored from cache" \ |
| -s "session successfully restored from ticket" \ |
| -s "a session has been resumed" \ |
| -c "a session has been resumed" |
| |
| run_test "Session resume using tickets, DTLS: openssl server" \ |
| "$O_SRV -dtls1" \ |
| "$P_CLI dtls=1 debug_level=3 tickets=1 reconnect=1" \ |
| 0 \ |
| -c "client hello, adding session ticket extension" \ |
| -c "found session_ticket extension" \ |
| -c "parse new session ticket" \ |
| -c "a session has been resumed" |
| |
| run_test "Session resume using tickets, DTLS: openssl client" \ |
| "$P_SRV dtls=1 debug_level=3 tickets=1" \ |
| "( $O_CLI -dtls1 -sess_out $SESSION; \ |
| $O_CLI -dtls1 -sess_in $SESSION; \ |
| rm -f $SESSION )" \ |
| 0 \ |
| -s "found session ticket extension" \ |
| -s "server hello, adding session ticket extension" \ |
| -S "session successfully restored from cache" \ |
| -s "session successfully restored from ticket" \ |
| -s "a session has been resumed" |
| |
| # Tests for Session Resume based on session-ID and cache |
| |
| run_test "Session resume using cache: tickets enabled on client" \ |
| "$P_SRV debug_level=3 tickets=0" \ |
| "$P_CLI debug_level=3 tickets=1 reconnect=1" \ |
| 0 \ |
| -c "client hello, adding session ticket extension" \ |
| -s "found session ticket extension" \ |
| -S "server hello, adding session ticket extension" \ |
| -C "found session_ticket extension" \ |
| -C "parse new session ticket" \ |
| -s "session successfully restored from cache" \ |
| -S "session successfully restored from ticket" \ |
| -s "a session has been resumed" \ |
| -c "a session has been resumed" |
| |
| run_test "Session resume using cache: tickets enabled on server" \ |
| "$P_SRV debug_level=3 tickets=1" \ |
| "$P_CLI debug_level=3 tickets=0 reconnect=1" \ |
| 0 \ |
| -C "client hello, adding session ticket extension" \ |
| -S "found session ticket extension" \ |
| -S "server hello, adding session ticket extension" \ |
| -C "found session_ticket extension" \ |
| -C "parse new session ticket" \ |
| -s "session successfully restored from cache" \ |
| -S "session successfully restored from ticket" \ |
| -s "a session has been resumed" \ |
| -c "a session has been resumed" |
| |
| run_test "Session resume using cache: cache_max=0" \ |
| "$P_SRV debug_level=3 tickets=0 cache_max=0" \ |
| "$P_CLI debug_level=3 tickets=0 reconnect=1" \ |
| 0 \ |
| -S "session successfully restored from cache" \ |
| -S "session successfully restored from ticket" \ |
| -S "a session has been resumed" \ |
| -C "a session has been resumed" |
| |
| run_test "Session resume using cache: cache_max=1" \ |
| "$P_SRV debug_level=3 tickets=0 cache_max=1" \ |
| "$P_CLI debug_level=3 tickets=0 reconnect=1" \ |
| 0 \ |
| -s "session successfully restored from cache" \ |
| -S "session successfully restored from ticket" \ |
| -s "a session has been resumed" \ |
| -c "a session has been resumed" |
| |
| run_test "Session resume using cache: timeout > delay" \ |
| "$P_SRV debug_level=3 tickets=0" \ |
| "$P_CLI debug_level=3 tickets=0 reconnect=1 reco_delay=0" \ |
| 0 \ |
| -s "session successfully restored from cache" \ |
| -S "session successfully restored from ticket" \ |
| -s "a session has been resumed" \ |
| -c "a session has been resumed" |
| |
| run_test "Session resume using cache: timeout < delay" \ |
| "$P_SRV debug_level=3 tickets=0 cache_timeout=1" \ |
| "$P_CLI debug_level=3 tickets=0 reconnect=1 reco_delay=2" \ |
| 0 \ |
| -S "session successfully restored from cache" \ |
| -S "session successfully restored from ticket" \ |
| -S "a session has been resumed" \ |
| -C "a session has been resumed" |
| |
| run_test "Session resume using cache: no timeout" \ |
| "$P_SRV debug_level=3 tickets=0 cache_timeout=0" \ |
| "$P_CLI debug_level=3 tickets=0 reconnect=1 reco_delay=2" \ |
| 0 \ |
| -s "session successfully restored from cache" \ |
| -S "session successfully restored from ticket" \ |
| -s "a session has been resumed" \ |
| -c "a session has been resumed" |
| |
| run_test "Session resume using cache: session copy" \ |
| "$P_SRV debug_level=3 tickets=0" \ |
| "$P_CLI debug_level=3 tickets=0 reconnect=1 reco_mode=0" \ |
| 0 \ |
| -s "session successfully restored from cache" \ |
| -S "session successfully restored from ticket" \ |
| -s "a session has been resumed" \ |
| -c "a session has been resumed" |
| |
| run_test "Session resume using cache: openssl client" \ |
| "$P_SRV debug_level=3 tickets=0" \ |
| "( $O_CLI -sess_out $SESSION; \ |
| $O_CLI -sess_in $SESSION; \ |
| rm -f $SESSION )" \ |
| 0 \ |
| -s "found session ticket extension" \ |
| -S "server hello, adding session ticket extension" \ |
| -s "session successfully restored from cache" \ |
| -S "session successfully restored from ticket" \ |
| -s "a session has been resumed" |
| |
| run_test "Session resume using cache: openssl server" \ |
| "$O_SRV" \ |
| "$P_CLI debug_level=3 tickets=0 reconnect=1" \ |
| 0 \ |
| -C "found session_ticket extension" \ |
| -C "parse new session ticket" \ |
| -c "a session has been resumed" |
| |
| # Tests for Session Resume based on session-ID and cache, DTLS |
| |
| run_test "Session resume using cache, DTLS: tickets enabled on client" \ |
| "$P_SRV dtls=1 debug_level=3 tickets=0" \ |
| "$P_CLI dtls=1 debug_level=3 tickets=1 reconnect=1 skip_close_notify=1" \ |
| 0 \ |
| -c "client hello, adding session ticket extension" \ |
| -s "found session ticket extension" \ |
| -S "server hello, adding session ticket extension" \ |
| -C "found session_ticket extension" \ |
| -C "parse new session ticket" \ |
| -s "session successfully restored from cache" \ |
| -S "session successfully restored from ticket" \ |
| -s "a session has been resumed" \ |
| -c "a session has been resumed" |
| |
| run_test "Session resume using cache, DTLS: tickets enabled on server" \ |
| "$P_SRV dtls=1 debug_level=3 tickets=1" \ |
| "$P_CLI dtls=1 debug_level=3 tickets=0 reconnect=1 skip_close_notify=1" \ |
| 0 \ |
| -C "client hello, adding session ticket extension" \ |
| -S "found session ticket extension" \ |
| -S "server hello, adding session ticket extension" \ |
| -C "found session_ticket extension" \ |
| -C "parse new session ticket" \ |
| -s "session successfully restored from cache" \ |
| -S "session successfully restored from ticket" \ |
| -s "a session has been resumed" \ |
| -c "a session has been resumed" |
| |
| run_test "Session resume using cache, DTLS: cache_max=0" \ |
| "$P_SRV dtls=1 debug_level=3 tickets=0 cache_max=0" \ |
| "$P_CLI dtls=1 debug_level=3 tickets=0 reconnect=1 skip_close_notify=1" \ |
| 0 \ |
| -S "session successfully restored from cache" \ |
| -S "session successfully restored from ticket" \ |
| -S "a session has been resumed" \ |
| -C "a session has been resumed" |
| |
| run_test "Session resume using cache, DTLS: cache_max=1" \ |
| "$P_SRV dtls=1 debug_level=3 tickets=0 cache_max=1" \ |
| "$P_CLI dtls=1 debug_level=3 tickets=0 reconnect=1 skip_close_notify=1" \ |
| 0 \ |
| -s "session successfully restored from cache" \ |
| -S "session successfully restored from ticket" \ |
| -s "a session has been resumed" \ |
| -c "a session has been resumed" |
| |
| run_test "Session resume using cache, DTLS: timeout > delay" \ |
| "$P_SRV dtls=1 debug_level=3 tickets=0" \ |
| "$P_CLI dtls=1 debug_level=3 tickets=0 reconnect=1 skip_close_notify=1 reco_delay=0" \ |
| 0 \ |
| -s "session successfully restored from cache" \ |
| -S "session successfully restored from ticket" \ |
| -s "a session has been resumed" \ |
| -c "a session has been resumed" |
| |
| run_test "Session resume using cache, DTLS: timeout < delay" \ |
| "$P_SRV dtls=1 debug_level=3 tickets=0 cache_timeout=1" \ |
| "$P_CLI dtls=1 debug_level=3 tickets=0 reconnect=1 skip_close_notify=1 reco_delay=2" \ |
| 0 \ |
| -S "session successfully restored from cache" \ |
| -S "session successfully restored from ticket" \ |
| -S "a session has been resumed" \ |
| -C "a session has been resumed" |
| |
| run_test "Session resume using cache, DTLS: no timeout" \ |
| "$P_SRV dtls=1 debug_level=3 tickets=0 cache_timeout=0" \ |
| "$P_CLI dtls=1 debug_level=3 tickets=0 reconnect=1 skip_close_notify=1 reco_delay=2" \ |
| 0 \ |
| -s "session successfully restored from cache" \ |
| -S "session successfully restored from ticket" \ |
| -s "a session has been resumed" \ |
| -c "a session has been resumed" |
| |
| run_test "Session resume using cache, DTLS: session copy" \ |
| "$P_SRV dtls=1 debug_level=3 tickets=0" \ |
| "$P_CLI dtls=1 debug_level=3 tickets=0 reconnect=1 skip_close_notify=1 reco_mode=0" \ |
| 0 \ |
| -s "session successfully restored from cache" \ |
| -S "session successfully restored from ticket" \ |
| -s "a session has been resumed" \ |
| -c "a session has been resumed" |
| |
| run_test "Session resume using cache, DTLS: openssl client" \ |
| "$P_SRV dtls=1 debug_level=3 tickets=0" \ |
| "( $O_CLI -dtls1 -sess_out $SESSION; \ |
| $O_CLI -dtls1 -sess_in $SESSION; \ |
| rm -f $SESSION )" \ |
| 0 \ |
| -s "found session ticket extension" \ |
| -S "server hello, adding session ticket extension" \ |
| -s "session successfully restored from cache" \ |
| -S "session successfully restored from ticket" \ |
| -s "a session has been resumed" |
| |
| run_test "Session resume using cache, DTLS: openssl server" \ |
| "$O_SRV -dtls1" \ |
| "$P_CLI dtls=1 debug_level=3 tickets=0 reconnect=1" \ |
| 0 \ |
| -C "found session_ticket extension" \ |
| -C "parse new session ticket" \ |
| -c "a session has been resumed" |
| |
| # Tests for Max Fragment Length extension |
| |
| if [ "$MAX_IN_LEN" -lt "4096" ]; then |
| printf '%s defines MBEDTLS_SSL_IN_CONTENT_LEN to be less than 4096. Fragment length tests will fail.\n' "${CONFIG_H}" |
| exit 1 |
| fi |
| |
| if [ "$MAX_OUT_LEN" -lt "4096" ]; then |
| printf '%s defines MBEDTLS_SSL_OUT_CONTENT_LEN to be less than 4096. Fragment length tests will fail.\n' "${CONFIG_H}" |
| exit 1 |
| fi |
| |
| if [ $MAX_CONTENT_LEN -ne 16384 ]; then |
| echo "Using non-default maximum content length $MAX_CONTENT_LEN" |
| fi |
| |
| requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| run_test "Max fragment length: enabled, default" \ |
| "$P_SRV debug_level=3" \ |
| "$P_CLI debug_level=3" \ |
| 0 \ |
| -c "Maximum input fragment length is $MAX_CONTENT_LEN" \ |
| -c "Maximum output fragment length is $MAX_CONTENT_LEN" \ |
| -s "Maximum input fragment length is $MAX_CONTENT_LEN" \ |
| -s "Maximum output fragment length is $MAX_CONTENT_LEN" \ |
| -C "client hello, adding max_fragment_length extension" \ |
| -S "found max fragment length extension" \ |
| -S "server hello, max_fragment_length extension" \ |
| -C "found max_fragment_length extension" |
| |
| requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| run_test "Max fragment length: enabled, default, larger message" \ |
| "$P_SRV debug_level=3" \ |
| "$P_CLI debug_level=3 request_size=$(( $MAX_CONTENT_LEN + 1))" \ |
| 0 \ |
| -c "Maximum input fragment length is $MAX_CONTENT_LEN" \ |
| -c "Maximum output fragment length is $MAX_CONTENT_LEN" \ |
| -s "Maximum input fragment length is $MAX_CONTENT_LEN" \ |
| -s "Maximum output fragment length is $MAX_CONTENT_LEN" \ |
| -C "client hello, adding max_fragment_length extension" \ |
| -S "found max fragment length extension" \ |
| -S "server hello, max_fragment_length extension" \ |
| -C "found max_fragment_length extension" \ |
| -c "$(( $MAX_CONTENT_LEN + 1)) bytes written in 2 fragments" \ |
| -s "$MAX_CONTENT_LEN bytes read" \ |
| -s "1 bytes read" |
| |
| requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| run_test "Max fragment length, DTLS: enabled, default, larger message" \ |
| "$P_SRV debug_level=3 dtls=1" \ |
| "$P_CLI debug_level=3 dtls=1 request_size=$(( $MAX_CONTENT_LEN + 1))" \ |
| 1 \ |
| -c "Maximum input fragment length is $MAX_CONTENT_LEN" \ |
| -c "Maximum output fragment length is $MAX_CONTENT_LEN" \ |
| -s "Maximum input fragment length is $MAX_CONTENT_LEN" \ |
| -s "Maximum output fragment length is $MAX_CONTENT_LEN" \ |
| -C "client hello, adding max_fragment_length extension" \ |
| -S "found max fragment length extension" \ |
| -S "server hello, max_fragment_length extension" \ |
| -C "found max_fragment_length extension" \ |
| -c "fragment larger than.*maximum " |
| |
| # Run some tests with MBEDTLS_SSL_MAX_FRAGMENT_LENGTH disabled |
| # (session fragment length will be 16384 regardless of mbedtls |
| # content length configuration.) |
| |
| requires_config_disabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| run_test "Max fragment length: disabled, larger message" \ |
| "$P_SRV debug_level=3" \ |
| "$P_CLI debug_level=3 request_size=$(( $MAX_CONTENT_LEN + 1))" \ |
| 0 \ |
| -C "Maximum input fragment length is 16384" \ |
| -C "Maximum output fragment length is 16384" \ |
| -S "Maximum input fragment length is 16384" \ |
| -S "Maximum output fragment length is 16384" \ |
| -c "$(( $MAX_CONTENT_LEN + 1)) bytes written in 2 fragments" \ |
| -s "$MAX_CONTENT_LEN bytes read" \ |
| -s "1 bytes read" |
| |
| requires_config_disabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| run_test "Max fragment length DTLS: disabled, larger message" \ |
| "$P_SRV debug_level=3 dtls=1" \ |
| "$P_CLI debug_level=3 dtls=1 request_size=$(( $MAX_CONTENT_LEN + 1))" \ |
| 1 \ |
| -C "Maximum input fragment length is 16384" \ |
| -C "Maximum output fragment length is 16384" \ |
| -S "Maximum input fragment length is 16384" \ |
| -S "Maximum output fragment length is 16384" \ |
| -c "fragment larger than.*maximum " |
| |
| requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| run_test "Max fragment length: used by client" \ |
| "$P_SRV debug_level=3" \ |
| "$P_CLI debug_level=3 max_frag_len=4096" \ |
| 0 \ |
| -c "Maximum input fragment length is 4096" \ |
| -c "Maximum output fragment length is 4096" \ |
| -s "Maximum input fragment length is 4096" \ |
| -s "Maximum output fragment length is 4096" \ |
| -c "client hello, adding max_fragment_length extension" \ |
| -s "found max fragment length extension" \ |
| -s "server hello, max_fragment_length extension" \ |
| -c "found max_fragment_length extension" |
| |
| requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| run_test "Max fragment length: client 512, server 1024" \ |
| "$P_SRV debug_level=3 max_frag_len=1024" \ |
| "$P_CLI debug_level=3 max_frag_len=512" \ |
| 0 \ |
| -c "Maximum input fragment length is 512" \ |
| -c "Maximum output fragment length is 512" \ |
| -s "Maximum input fragment length is 512" \ |
| -s "Maximum output fragment length is 512" \ |
| -c "client hello, adding max_fragment_length extension" \ |
| -s "found max fragment length extension" \ |
| -s "server hello, max_fragment_length extension" \ |
| -c "found max_fragment_length extension" |
| |
| requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| run_test "Max fragment length: client 512, server 2048" \ |
| "$P_SRV debug_level=3 max_frag_len=2048" \ |
| "$P_CLI debug_level=3 max_frag_len=512" \ |
| 0 \ |
| -c "Maximum input fragment length is 512" \ |
| -c "Maximum output fragment length is 512" \ |
| -s "Maximum input fragment length is 512" \ |
| -s "Maximum output fragment length is 512" \ |
| -c "client hello, adding max_fragment_length extension" \ |
| -s "found max fragment length extension" \ |
| -s "server hello, max_fragment_length extension" \ |
| -c "found max_fragment_length extension" |
| |
| requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| run_test "Max fragment length: client 512, server 4096" \ |
| "$P_SRV debug_level=3 max_frag_len=4096" \ |
| "$P_CLI debug_level=3 max_frag_len=512" \ |
| 0 \ |
| -c "Maximum input fragment length is 512" \ |
| -c "Maximum output fragment length is 512" \ |
| -s "Maximum input fragment length is 512" \ |
| -s "Maximum output fragment length is 512" \ |
| -c "client hello, adding max_fragment_length extension" \ |
| -s "found max fragment length extension" \ |
| -s "server hello, max_fragment_length extension" \ |
| -c "found max_fragment_length extension" |
| |
| requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| run_test "Max fragment length: client 1024, server 512" \ |
| "$P_SRV debug_level=3 max_frag_len=512" \ |
| "$P_CLI debug_level=3 max_frag_len=1024" \ |
| 0 \ |
| -c "Maximum input fragment length is 1024" \ |
| -c "Maximum output fragment length is 1024" \ |
| -s "Maximum input fragment length is 1024" \ |
| -s "Maximum output fragment length is 512" \ |
| -c "client hello, adding max_fragment_length extension" \ |
| -s "found max fragment length extension" \ |
| -s "server hello, max_fragment_length extension" \ |
| -c "found max_fragment_length extension" |
| |
| requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| run_test "Max fragment length: client 1024, server 2048" \ |
| "$P_SRV debug_level=3 max_frag_len=2048" \ |
| "$P_CLI debug_level=3 max_frag_len=1024" \ |
| 0 \ |
| -c "Maximum input fragment length is 1024" \ |
| -c "Maximum output fragment length is 1024" \ |
| -s "Maximum input fragment length is 1024" \ |
| -s "Maximum output fragment length is 1024" \ |
| -c "client hello, adding max_fragment_length extension" \ |
| -s "found max fragment length extension" \ |
| -s "server hello, max_fragment_length extension" \ |
| -c "found max_fragment_length extension" |
| |
| requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| run_test "Max fragment length: client 1024, server 4096" \ |
| "$P_SRV debug_level=3 max_frag_len=4096" \ |
| "$P_CLI debug_level=3 max_frag_len=1024" \ |
| 0 \ |
| -c "Maximum input fragment length is 1024" \ |
| -c "Maximum output fragment length is 1024" \ |
| -s "Maximum input fragment length is 1024" \ |
| -s "Maximum output fragment length is 1024" \ |
| -c "client hello, adding max_fragment_length extension" \ |
| -s "found max fragment length extension" \ |
| -s "server hello, max_fragment_length extension" \ |
| -c "found max_fragment_length extension" |
| |
| requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| run_test "Max fragment length: client 2048, server 512" \ |
| "$P_SRV debug_level=3 max_frag_len=512" \ |
| "$P_CLI debug_level=3 max_frag_len=2048" \ |
| 0 \ |
| -c "Maximum input fragment length is 2048" \ |
| -c "Maximum output fragment length is 2048" \ |
| -s "Maximum input fragment length is 2048" \ |
| -s "Maximum output fragment length is 512" \ |
| -c "client hello, adding max_fragment_length extension" \ |
| -s "found max fragment length extension" \ |
| -s "server hello, max_fragment_length extension" \ |
| -c "found max_fragment_length extension" |
| |
| requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| run_test "Max fragment length: client 2048, server 1024" \ |
| "$P_SRV debug_level=3 max_frag_len=1024" \ |
| "$P_CLI debug_level=3 max_frag_len=2048" \ |
| 0 \ |
| -c "Maximum input fragment length is 2048" \ |
| -c "Maximum output fragment length is 2048" \ |
| -s "Maximum input fragment length is 2048" \ |
| -s "Maximum output fragment length is 1024" \ |
| -c "client hello, adding max_fragment_length extension" \ |
| -s "found max fragment length extension" \ |
| -s "server hello, max_fragment_length extension" \ |
| -c "found max_fragment_length extension" |
| |
| requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| run_test "Max fragment length: client 2048, server 4096" \ |
| "$P_SRV debug_level=3 max_frag_len=4096" \ |
| "$P_CLI debug_level=3 max_frag_len=2048" \ |
| 0 \ |
| -c "Maximum input fragment length is 2048" \ |
| -c "Maximum output fragment length is 2048" \ |
| -s "Maximum input fragment length is 2048" \ |
| -s "Maximum output fragment length is 2048" \ |
| -c "client hello, adding max_fragment_length extension" \ |
| -s "found max fragment length extension" \ |
| -s "server hello, max_fragment_length extension" \ |
| -c "found max_fragment_length extension" |
| |
| requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| run_test "Max fragment length: client 4096, server 512" \ |
| "$P_SRV debug_level=3 max_frag_len=512" \ |
| "$P_CLI debug_level=3 max_frag_len=4096" \ |
| 0 \ |
| -c "Maximum input fragment length is 4096" \ |
| -c "Maximum output fragment length is 4096" \ |
| -s "Maximum input fragment length is 4096" \ |
| -s "Maximum output fragment length is 512" \ |
| -c "client hello, adding max_fragment_length extension" \ |
| -s "found max fragment length extension" \ |
| -s "server hello, max_fragment_length extension" \ |
| -c "found max_fragment_length extension" |
| |
| requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| run_test "Max fragment length: client 4096, server 1024" \ |
| "$P_SRV debug_level=3 max_frag_len=1024" \ |
| "$P_CLI debug_level=3 max_frag_len=4096" \ |
| 0 \ |
| -c "Maximum input fragment length is 4096" \ |
| -c "Maximum output fragment length is 4096" \ |
| -s "Maximum input fragment length is 4096" \ |
| -s "Maximum output fragment length is 1024" \ |
| -c "client hello, adding max_fragment_length extension" \ |
| -s "found max fragment length extension" \ |
| -s "server hello, max_fragment_length extension" \ |
| -c "found max_fragment_length extension" |
| |
| requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| run_test "Max fragment length: client 4096, server 2048" \ |
| "$P_SRV debug_level=3 max_frag_len=2048" \ |
| "$P_CLI debug_level=3 max_frag_len=4096" \ |
| 0 \ |
| -c "Maximum input fragment length is 4096" \ |
| -c "Maximum output fragment length is 4096" \ |
| -s "Maximum input fragment length is 4096" \ |
| -s "Maximum output fragment length is 2048" \ |
| -c "client hello, adding max_fragment_length extension" \ |
| -s "found max fragment length extension" \ |
| -s "server hello, max_fragment_length extension" \ |
| -c "found max_fragment_length extension" |
| |
| requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| run_test "Max fragment length: used by server" \ |
| "$P_SRV debug_level=3 max_frag_len=4096" \ |
| "$P_CLI debug_level=3" \ |
| 0 \ |
| -c "Maximum input fragment length is $MAX_CONTENT_LEN" \ |
| -c "Maximum output fragment length is $MAX_CONTENT_LEN" \ |
| -s "Maximum input fragment length is $MAX_CONTENT_LEN" \ |
| -s "Maximum output fragment length is 4096" \ |
| -C "client hello, adding max_fragment_length extension" \ |
| -S "found max fragment length extension" \ |
| -S "server hello, max_fragment_length extension" \ |
| -C "found max_fragment_length extension" |
| |
| requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| requires_gnutls |
| run_test "Max fragment length: gnutls server" \ |
| "$G_SRV" \ |
| "$P_CLI debug_level=3 max_frag_len=4096" \ |
| 0 \ |
| -c "Maximum input fragment length is 4096" \ |
| -c "Maximum output fragment length is 4096" \ |
| -c "client hello, adding max_fragment_length extension" \ |
| -c "found max_fragment_length extension" |
| |
| requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| run_test "Max fragment length: client, message just fits" \ |
| "$P_SRV debug_level=3" \ |
| "$P_CLI debug_level=3 max_frag_len=2048 request_size=2048" \ |
| 0 \ |
| -c "Maximum input fragment length is 2048" \ |
| -c "Maximum output fragment length is 2048" \ |
| -s "Maximum input fragment length is 2048" \ |
| -s "Maximum output fragment length is 2048" \ |
| -c "client hello, adding max_fragment_length extension" \ |
| -s "found max fragment length extension" \ |
| -s "server hello, max_fragment_length extension" \ |
| -c "found max_fragment_length extension" \ |
| -c "2048 bytes written in 1 fragments" \ |
| -s "2048 bytes read" |
| |
| requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| run_test "Max fragment length: client, larger message" \ |
| "$P_SRV debug_level=3" \ |
| "$P_CLI debug_level=3 max_frag_len=2048 request_size=2345" \ |
| 0 \ |
| -c "Maximum input fragment length is 2048" \ |
| -c "Maximum output fragment length is 2048" \ |
| -s "Maximum input fragment length is 2048" \ |
| -s "Maximum output fragment length is 2048" \ |
| -c "client hello, adding max_fragment_length extension" \ |
| -s "found max fragment length extension" \ |
| -s "server hello, max_fragment_length extension" \ |
| -c "found max_fragment_length extension" \ |
| -c "2345 bytes written in 2 fragments" \ |
| -s "2048 bytes read" \ |
| -s "297 bytes read" |
| |
| requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| run_test "Max fragment length: DTLS client, larger message" \ |
| "$P_SRV debug_level=3 dtls=1" \ |
| "$P_CLI debug_level=3 dtls=1 max_frag_len=2048 request_size=2345" \ |
| 1 \ |
| -c "Maximum input fragment length is 2048" \ |
| -c "Maximum output fragment length is 2048" \ |
| -s "Maximum input fragment length is 2048" \ |
| -s "Maximum output fragment length is 2048" \ |
| -c "client hello, adding max_fragment_length extension" \ |
| -s "found max fragment length extension" \ |
| -s "server hello, max_fragment_length extension" \ |
| -c "found max_fragment_length extension" \ |
| -c "fragment larger than.*maximum" |
| |
| # Tests for renegotiation |
| |
| # Renegotiation SCSV always added, regardless of SSL_RENEGOTIATION |
| run_test "Renegotiation: none, for reference" \ |
| "$P_SRV debug_level=3 exchanges=2 auth_mode=optional" \ |
| "$P_CLI debug_level=3 exchanges=2" \ |
| 0 \ |
| -C "client hello, adding renegotiation extension" \ |
| -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| -S "found renegotiation extension" \ |
| -s "server hello, secure renegotiation extension" \ |
| -c "found renegotiation extension" \ |
| -C "=> renegotiate" \ |
| -S "=> renegotiate" \ |
| -S "write hello request" |
| |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Renegotiation: client-initiated" \ |
| "$P_SRV debug_level=3 exchanges=2 renegotiation=1 auth_mode=optional" \ |
| "$P_CLI debug_level=3 exchanges=2 renegotiation=1 renegotiate=1" \ |
| 0 \ |
| -c "client hello, adding renegotiation extension" \ |
| -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| -s "found renegotiation extension" \ |
| -s "server hello, secure renegotiation extension" \ |
| -c "found renegotiation extension" \ |
| -c "=> renegotiate" \ |
| -s "=> renegotiate" \ |
| -S "write hello request" |
| |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Renegotiation: server-initiated" \ |
| "$P_SRV debug_level=3 exchanges=2 renegotiation=1 auth_mode=optional renegotiate=1" \ |
| "$P_CLI debug_level=3 exchanges=2 renegotiation=1" \ |
| 0 \ |
| -c "client hello, adding renegotiation extension" \ |
| -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| -s "found renegotiation extension" \ |
| -s "server hello, secure renegotiation extension" \ |
| -c "found renegotiation extension" \ |
| -c "=> renegotiate" \ |
| -s "=> renegotiate" \ |
| -s "write hello request" |
| |
| # Checks that no Signature Algorithm with SHA-1 gets negotiated. Negotiating SHA-1 would mean that |
| # the server did not parse the Signature Algorithm extension. This test is valid only if an MD |
| # algorithm stronger than SHA-1 is enabled in config.h |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Renegotiation: Signature Algorithms parsing, client-initiated" \ |
| "$P_SRV debug_level=3 exchanges=2 renegotiation=1 auth_mode=optional" \ |
| "$P_CLI debug_level=3 exchanges=2 renegotiation=1 renegotiate=1" \ |
| 0 \ |
| -c "client hello, adding renegotiation extension" \ |
| -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| -s "found renegotiation extension" \ |
| -s "server hello, secure renegotiation extension" \ |
| -c "found renegotiation extension" \ |
| -c "=> renegotiate" \ |
| -s "=> renegotiate" \ |
| -S "write hello request" \ |
| -S "client hello v3, signature_algorithm ext: 2" # Is SHA-1 negotiated? |
| |
| # Checks that no Signature Algorithm with SHA-1 gets negotiated. Negotiating SHA-1 would mean that |
| # the server did not parse the Signature Algorithm extension. This test is valid only if an MD |
| # algorithm stronger than SHA-1 is enabled in config.h |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Renegotiation: Signature Algorithms parsing, server-initiated" \ |
| "$P_SRV debug_level=3 exchanges=2 renegotiation=1 auth_mode=optional renegotiate=1" \ |
| "$P_CLI debug_level=3 exchanges=2 renegotiation=1" \ |
| 0 \ |
| -c "client hello, adding renegotiation extension" \ |
| -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| -s "found renegotiation extension" \ |
| -s "server hello, secure renegotiation extension" \ |
| -c "found renegotiation extension" \ |
| -c "=> renegotiate" \ |
| -s "=> renegotiate" \ |
| -s "write hello request" \ |
| -S "client hello v3, signature_algorithm ext: 2" # Is SHA-1 negotiated? |
| |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Renegotiation: double" \ |
| "$P_SRV debug_level=3 exchanges=2 renegotiation=1 auth_mode=optional renegotiate=1" \ |
| "$P_CLI debug_level=3 exchanges=2 renegotiation=1 renegotiate=1" \ |
| 0 \ |
| -c "client hello, adding renegotiation extension" \ |
| -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| -s "found renegotiation extension" \ |
| -s "server hello, secure renegotiation extension" \ |
| -c "found renegotiation extension" \ |
| -c "=> renegotiate" \ |
| -s "=> renegotiate" \ |
| -s "write hello request" |
| |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| run_test "Renegotiation with max fragment length: client 2048, server 512" \ |
| "$P_SRV debug_level=3 exchanges=2 renegotiation=1 auth_mode=optional renegotiate=1 max_frag_len=512" \ |
| "$P_CLI debug_level=3 exchanges=2 renegotiation=1 renegotiate=1 max_frag_len=2048 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8" \ |
| 0 \ |
| -c "Maximum input fragment length is 2048" \ |
| -c "Maximum output fragment length is 2048" \ |
| -s "Maximum input fragment length is 2048" \ |
| -s "Maximum output fragment length is 512" \ |
| -c "client hello, adding max_fragment_length extension" \ |
| -s "found max fragment length extension" \ |
| -s "server hello, max_fragment_length extension" \ |
| -c "found max_fragment_length extension" \ |
| -c "client hello, adding renegotiation extension" \ |
| -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| -s "found renegotiation extension" \ |
| -s "server hello, secure renegotiation extension" \ |
| -c "found renegotiation extension" \ |
| -c "=> renegotiate" \ |
| -s "=> renegotiate" \ |
| -s "write hello request" |
| |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Renegotiation: client-initiated, server-rejected" \ |
| "$P_SRV debug_level=3 exchanges=2 renegotiation=0 auth_mode=optional" \ |
| "$P_CLI debug_level=3 exchanges=2 renegotiation=1 renegotiate=1" \ |
| 1 \ |
| -c "client hello, adding renegotiation extension" \ |
| -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| -S "found renegotiation extension" \ |
| -s "server hello, secure renegotiation extension" \ |
| -c "found renegotiation extension" \ |
| -c "=> renegotiate" \ |
| -S "=> renegotiate" \ |
| -S "write hello request" \ |
| -c "SSL - Unexpected message at ServerHello in renegotiation" \ |
| -c "failed" |
| |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Renegotiation: server-initiated, client-rejected, default" \ |
| "$P_SRV debug_level=3 exchanges=2 renegotiation=1 renegotiate=1 auth_mode=optional" \ |
| "$P_CLI debug_level=3 exchanges=2 renegotiation=0" \ |
| 0 \ |
| -C "client hello, adding renegotiation extension" \ |
| -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| -S "found renegotiation extension" \ |
| -s "server hello, secure renegotiation extension" \ |
| -c "found renegotiation extension" \ |
| -C "=> renegotiate" \ |
| -S "=> renegotiate" \ |
| -s "write hello request" \ |
| -S "SSL - An unexpected message was received from our peer" \ |
| -S "failed" |
| |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Renegotiation: server-initiated, client-rejected, not enforced" \ |
| "$P_SRV debug_level=3 exchanges=2 renegotiation=1 renegotiate=1 \ |
| renego_delay=-1 auth_mode=optional" \ |
| "$P_CLI debug_level=3 exchanges=2 renegotiation=0" \ |
| 0 \ |
| -C "client hello, adding renegotiation extension" \ |
| -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| -S "found renegotiation extension" \ |
| -s "server hello, secure renegotiation extension" \ |
| -c "found renegotiation extension" \ |
| -C "=> renegotiate" \ |
| -S "=> renegotiate" \ |
| -s "write hello request" \ |
| -S "SSL - An unexpected message was received from our peer" \ |
| -S "failed" |
| |
| # delay 2 for 1 alert record + 1 application data record |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Renegotiation: server-initiated, client-rejected, delay 2" \ |
| "$P_SRV debug_level=3 exchanges=2 renegotiation=1 renegotiate=1 \ |
| renego_delay=2 auth_mode=optional" \ |
| "$P_CLI debug_level=3 exchanges=2 renegotiation=0" \ |
| 0 \ |
| -C "client hello, adding renegotiation extension" \ |
| -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| -S "found renegotiation extension" \ |
| -s "server hello, secure renegotiation extension" \ |
| -c "found renegotiation extension" \ |
| -C "=> renegotiate" \ |
| -S "=> renegotiate" \ |
| -s "write hello request" \ |
| -S "SSL - An unexpected message was received from our peer" \ |
| -S "failed" |
| |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Renegotiation: server-initiated, client-rejected, delay 0" \ |
| "$P_SRV debug_level=3 exchanges=2 renegotiation=1 renegotiate=1 \ |
| renego_delay=0 auth_mode=optional" \ |
| "$P_CLI debug_level=3 exchanges=2 renegotiation=0" \ |
| 0 \ |
| -C "client hello, adding renegotiation extension" \ |
| -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| -S "found renegotiation extension" \ |
| -s "server hello, secure renegotiation extension" \ |
| -c "found renegotiation extension" \ |
| -C "=> renegotiate" \ |
| -S "=> renegotiate" \ |
| -s "write hello request" \ |
| -s "SSL - An unexpected message was received from our peer" |
| |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Renegotiation: server-initiated, client-accepted, delay 0" \ |
| "$P_SRV debug_level=3 exchanges=2 renegotiation=1 renegotiate=1 \ |
| renego_delay=0 auth_mode=optional" \ |
| "$P_CLI debug_level=3 exchanges=2 renegotiation=1" \ |
| 0 \ |
| -c "client hello, adding renegotiation extension" \ |
| -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| -s "found renegotiation extension" \ |
| -s "server hello, secure renegotiation extension" \ |
| -c "found renegotiation extension" \ |
| -c "=> renegotiate" \ |
| -s "=> renegotiate" \ |
| -s "write hello request" \ |
| -S "SSL - An unexpected message was received from our peer" \ |
| -S "failed" |
| |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Renegotiation: periodic, just below period" \ |
| "$P_SRV debug_level=3 exchanges=9 renegotiation=1 renego_period=3 auth_mode=optional" \ |
| "$P_CLI debug_level=3 exchanges=2 renegotiation=1" \ |
| 0 \ |
| -C "client hello, adding renegotiation extension" \ |
| -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| -S "found renegotiation extension" \ |
| -s "server hello, secure renegotiation extension" \ |
| -c "found renegotiation extension" \ |
| -S "record counter limit reached: renegotiate" \ |
| -C "=> renegotiate" \ |
| -S "=> renegotiate" \ |
| -S "write hello request" \ |
| -S "SSL - An unexpected message was received from our peer" \ |
| -S "failed" |
| |
| # one extra exchange to be able to complete renego |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Renegotiation: periodic, just above period" \ |
| "$P_SRV debug_level=3 exchanges=9 renegotiation=1 renego_period=3 auth_mode=optional" \ |
| "$P_CLI debug_level=3 exchanges=4 renegotiation=1" \ |
| 0 \ |
| -c "client hello, adding renegotiation extension" \ |
| -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| -s "found renegotiation extension" \ |
| -s "server hello, secure renegotiation extension" \ |
| -c "found renegotiation extension" \ |
| -s "record counter limit reached: renegotiate" \ |
| -c "=> renegotiate" \ |
| -s "=> renegotiate" \ |
| -s "write hello request" \ |
| -S "SSL - An unexpected message was received from our peer" \ |
| -S "failed" |
| |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Renegotiation: periodic, two times period" \ |
| "$P_SRV debug_level=3 exchanges=9 renegotiation=1 renego_period=3 auth_mode=optional" \ |
| "$P_CLI debug_level=3 exchanges=7 renegotiation=1" \ |
| 0 \ |
| -c "client hello, adding renegotiation extension" \ |
| -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| -s "found renegotiation extension" \ |
| -s "server hello, secure renegotiation extension" \ |
| -c "found renegotiation extension" \ |
| -s "record counter limit reached: renegotiate" \ |
| -c "=> renegotiate" \ |
| -s "=> renegotiate" \ |
| -s "write hello request" \ |
| -S "SSL - An unexpected message was received from our peer" \ |
| -S "failed" |
| |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Renegotiation: periodic, above period, disabled" \ |
| "$P_SRV debug_level=3 exchanges=9 renegotiation=0 renego_period=3 auth_mode=optional" \ |
| "$P_CLI debug_level=3 exchanges=4 renegotiation=1" \ |
| 0 \ |
| -C "client hello, adding renegotiation extension" \ |
| -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| -S "found renegotiation extension" \ |
| -s "server hello, secure renegotiation extension" \ |
| -c "found renegotiation extension" \ |
| -S "record counter limit reached: renegotiate" \ |
| -C "=> renegotiate" \ |
| -S "=> renegotiate" \ |
| -S "write hello request" \ |
| -S "SSL - An unexpected message was received from our peer" \ |
| -S "failed" |
| |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Renegotiation: nbio, client-initiated" \ |
| "$P_SRV debug_level=3 nbio=2 exchanges=2 renegotiation=1 auth_mode=optional" \ |
| "$P_CLI debug_level=3 nbio=2 exchanges=2 renegotiation=1 renegotiate=1" \ |
| 0 \ |
| -c "client hello, adding renegotiation extension" \ |
| -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| -s "found renegotiation extension" \ |
| -s "server hello, secure renegotiation extension" \ |
| -c "found renegotiation extension" \ |
| -c "=> renegotiate" \ |
| -s "=> renegotiate" \ |
| -S "write hello request" |
| |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Renegotiation: nbio, server-initiated" \ |
| "$P_SRV debug_level=3 nbio=2 exchanges=2 renegotiation=1 renegotiate=1 auth_mode=optional" \ |
| "$P_CLI debug_level=3 nbio=2 exchanges=2 renegotiation=1" \ |
| 0 \ |
| -c "client hello, adding renegotiation extension" \ |
| -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| -s "found renegotiation extension" \ |
| -s "server hello, secure renegotiation extension" \ |
| -c "found renegotiation extension" \ |
| -c "=> renegotiate" \ |
| -s "=> renegotiate" \ |
| -s "write hello request" |
| |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Renegotiation: openssl server, client-initiated" \ |
| "$O_SRV -www" \ |
| "$P_CLI debug_level=3 exchanges=1 renegotiation=1 renegotiate=1" \ |
| 0 \ |
| -c "client hello, adding renegotiation extension" \ |
| -c "found renegotiation extension" \ |
| -c "=> renegotiate" \ |
| -C "ssl_hanshake() returned" \ |
| -C "error" \ |
| -c "HTTP/1.0 200 [Oo][Kk]" |
| |
| requires_gnutls |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Renegotiation: gnutls server strict, client-initiated" \ |
| "$G_SRV --priority=NORMAL:%SAFE_RENEGOTIATION" \ |
| "$P_CLI debug_level=3 exchanges=1 renegotiation=1 renegotiate=1" \ |
| 0 \ |
| -c "client hello, adding renegotiation extension" \ |
| -c "found renegotiation extension" \ |
| -c "=> renegotiate" \ |
| -C "ssl_hanshake() returned" \ |
| -C "error" \ |
| -c "HTTP/1.0 200 [Oo][Kk]" |
| |
| requires_gnutls |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Renegotiation: gnutls server unsafe, client-initiated default" \ |
| "$G_SRV --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION" \ |
| "$P_CLI debug_level=3 exchanges=1 renegotiation=1 renegotiate=1" \ |
| 1 \ |
| -c "client hello, adding renegotiation extension" \ |
| -C "found renegotiation extension" \ |
| -c "=> renegotiate" \ |
| -c "mbedtls_ssl_handshake() returned" \ |
| -c "error" \ |
| -C "HTTP/1.0 200 [Oo][Kk]" |
| |
| requires_gnutls |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Renegotiation: gnutls server unsafe, client-inititated no legacy" \ |
| "$G_SRV --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION" \ |
| "$P_CLI debug_level=3 exchanges=1 renegotiation=1 renegotiate=1 \ |
| allow_legacy=0" \ |
| 1 \ |
| -c "client hello, adding renegotiation extension" \ |
| -C "found renegotiation extension" \ |
| -c "=> renegotiate" \ |
| -c "mbedtls_ssl_handshake() returned" \ |
| -c "error" \ |
| -C "HTTP/1.0 200 [Oo][Kk]" |
| |
| requires_gnutls |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Renegotiation: gnutls server unsafe, client-inititated legacy" \ |
| "$G_SRV --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION" \ |
| "$P_CLI debug_level=3 exchanges=1 renegotiation=1 renegotiate=1 \ |
| allow_legacy=1" \ |
| 0 \ |
| -c "client hello, adding renegotiation extension" \ |
| -C "found renegotiation extension" \ |
| -c "=> renegotiate" \ |
| -C "ssl_hanshake() returned" \ |
| -C "error" \ |
| -c "HTTP/1.0 200 [Oo][Kk]" |
| |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Renegotiation: DTLS, client-initiated" \ |
| "$P_SRV debug_level=3 dtls=1 exchanges=2 renegotiation=1" \ |
| "$P_CLI debug_level=3 dtls=1 exchanges=2 renegotiation=1 renegotiate=1" \ |
| 0 \ |
| -c "client hello, adding renegotiation extension" \ |
| -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| -s "found renegotiation extension" \ |
| -s "server hello, secure renegotiation extension" \ |
| -c "found renegotiation extension" \ |
| -c "=> renegotiate" \ |
| -s "=> renegotiate" \ |
| -S "write hello request" |
| |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Renegotiation: DTLS, server-initiated" \ |
| "$P_SRV debug_level=3 dtls=1 exchanges=2 renegotiation=1 renegotiate=1" \ |
| "$P_CLI debug_level=3 dtls=1 exchanges=2 renegotiation=1 \ |
| read_timeout=1000 max_resend=2" \ |
| 0 \ |
| -c "client hello, adding renegotiation extension" \ |
| -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| -s "found renegotiation extension" \ |
| -s "server hello, secure renegotiation extension" \ |
| -c "found renegotiation extension" \ |
| -c "=> renegotiate" \ |
| -s "=> renegotiate" \ |
| -s "write hello request" |
| |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Renegotiation: DTLS, renego_period overflow" \ |
| "$P_SRV debug_level=3 dtls=1 exchanges=4 renegotiation=1 renego_period=18446462598732840962 auth_mode=optional" \ |
| "$P_CLI debug_level=3 dtls=1 exchanges=4 renegotiation=1" \ |
| 0 \ |
| -c "client hello, adding renegotiation extension" \ |
| -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| -s "found renegotiation extension" \ |
| -s "server hello, secure renegotiation extension" \ |
| -s "record counter limit reached: renegotiate" \ |
| -c "=> renegotiate" \ |
| -s "=> renegotiate" \ |
| -s "write hello request" |
| |
| requires_gnutls |
| requires_config_enabled MBEDTLS_SSL_RENEGOTIATION |
| run_test "Renegotiation: DTLS, gnutls server, client-initiated" \ |
| "$G_SRV -u --mtu 4096" \ |
| "$P_CLI debug_level=3 dtls=1 exchanges=1 renegotiation=1 renegotiate=1" \ |
| 0 \ |
| -c "client hello, adding renegotiation extension" \ |
| -c "found renegotiation extension" \ |
| -c "=> renegotiate" \ |
| -C "mbedtls_ssl_handshake returned" \ |
| -C "error" \ |
| -s "Extra-header:" |
| |
| # Test for the "secure renegotation" extension only (no actual renegotiation) |
| |
| requires_gnutls |
| run_test "Renego ext: gnutls server strict, client default" \ |
| "$G_SRV --priority=NORMAL:%SAFE_RENEGOTIATION" \ |
| "$P_CLI debug_level=3" \ |
| 0 \ |
| -c "found renegotiation extension" \ |
| -C "error" \ |
| -c "HTTP/1.0 200 [Oo][Kk]" |
| |
| requires_gnutls |
| run_test "Renego ext: gnutls server unsafe, client default" \ |
| "$G_SRV --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION" \ |
| "$P_CLI debug_level=3" \ |
| 0 \ |
| -C "found renegotiation extension" \ |
| -C "error" \ |
| -c "HTTP/1.0 200 [Oo][Kk]" |
| |
| requires_gnutls |
| run_test "Renego ext: gnutls server unsafe, client break legacy" \ |
| "$G_SRV --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION" \ |
| "$P_CLI debug_level=3 allow_legacy=-1" \ |
| 1 \ |
| -C "found renegotiation extension" \ |
| -c "error" \ |
| -C "HTTP/1.0 200 [Oo][Kk]" |
| |
| requires_gnutls |
| run_test "Renego ext: gnutls client strict, server default" \ |
| "$P_SRV debug_level=3" \ |
| "$G_CLI --priority=NORMAL:%SAFE_RENEGOTIATION localhost" \ |
| 0 \ |
| -s "received TLS_EMPTY_RENEGOTIATION_INFO\|found renegotiation extension" \ |
| -s "server hello, secure renegotiation extension" |
| |
| requires_gnutls |
| run_test "Renego ext: gnutls client unsafe, server default" \ |
| "$P_SRV debug_level=3" \ |
| "$G_CLI --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION localhost" \ |
| 0 \ |
| -S "received TLS_EMPTY_RENEGOTIATION_INFO\|found renegotiation extension" \ |
| -S "server hello, secure renegotiation extension" |
| |
| requires_gnutls |
| run_test "Renego ext: gnutls client unsafe, server break legacy" \ |
| "$P_SRV debug_level=3 allow_legacy=-1" \ |
| "$G_CLI --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION localhost" \ |
| 1 \ |
| -S "received TLS_EMPTY_RENEGOTIATION_INFO\|found renegotiation extension" \ |
| -S "server hello, secure renegotiation extension" |
| |
| # Tests for silently dropping trailing extra bytes in .der certificates |
| |
| requires_gnutls |
| run_test "DER format: no trailing bytes" \ |
| "$P_SRV crt_file=data_files/server5-der0.crt \ |
| key_file=data_files/server5.key" \ |
| "$G_CLI localhost" \ |
| 0 \ |
| -c "Handshake was completed" \ |
| |
| requires_gnutls |
| run_test "DER format: with a trailing zero byte" \ |
| "$P_SRV crt_file=data_files/server5-der1a.crt \ |
| key_file=data_files/server5.key" \ |
| "$G_CLI localhost" \ |
| 0 \ |
| -c "Handshake was completed" \ |
| |
| requires_gnutls |
| run_test "DER format: with a trailing random byte" \ |
| "$P_SRV crt_file=data_files/server5-der1b.crt \ |
| key_file=data_files/server5.key" \ |
| "$G_CLI localhost" \ |
| 0 \ |
| -c "Handshake was completed" \ |
| |
| requires_gnutls |
| run_test "DER format: with 2 trailing random bytes" \ |
| "$P_SRV crt_file=data_files/server5-der2.crt \ |
| key_file=data_files/server5.key" \ |
| "$G_CLI localhost" \ |
| 0 \ |
| -c "Handshake was completed" \ |
| |
| requires_gnutls |
| run_test "DER format: with 4 trailing random bytes" \ |
| "$P_SRV crt_file=data_files/server5-der4.crt \ |
| key_file=data_files/server5.key" \ |
| "$G_CLI localhost" \ |
| 0 \ |
| -c "Handshake was completed" \ |
| |
| requires_gnutls |
| run_test "DER format: with 8 trailing random bytes" \ |
| "$P_SRV crt_file=data_files/server5-der8.crt \ |
| key_file=data_files/server5.key" \ |
| "$G_CLI localhost" \ |
| 0 \ |
| -c "Handshake was completed" \ |
| |
| requires_gnutls |
| run_test "DER format: with 9 trailing random bytes" \ |
| "$P_SRV crt_file=data_files/server5-der9.crt \ |
| key_file=data_files/server5.key" \ |
| "$G_CLI localhost" \ |
| 0 \ |
| -c "Handshake was completed" \ |
| |
| # Tests for auth_mode, there are duplicated tests using ca callback for authentication |
| # When updating these tests, modify the matching authentication tests accordingly |
| |
| run_test "Authentication: server badcert, client required" \ |
| "$P_SRV crt_file=data_files/server5-badsign.crt \ |
| key_file=data_files/server5.key" \ |
| "$P_CLI debug_level=1 auth_mode=required" \ |
| 1 \ |
| -c "x509_verify_cert() returned" \ |
| -c "! The certificate is not correctly signed by the trusted CA" \ |
| -c "! mbedtls_ssl_handshake returned" \ |
| -c "X509 - Certificate verification failed" |
| |
| run_test "Authentication: server badcert, client optional" \ |
| "$P_SRV crt_file=data_files/server5-badsign.crt \ |
| key_file=data_files/server5.key" \ |
| "$P_CLI debug_level=1 auth_mode=optional" \ |
| 0 \ |
| -c "x509_verify_cert() returned" \ |
| -c "! The certificate is not correctly signed by the trusted CA" \ |
| -C "! mbedtls_ssl_handshake returned" \ |
| -C "X509 - Certificate verification failed" |
| |
| run_test "Authentication: server goodcert, client optional, no trusted CA" \ |
| "$P_SRV" \ |
| "$P_CLI debug_level=3 auth_mode=optional ca_file=none ca_path=none" \ |
| 0 \ |
| -c "x509_verify_cert() returned" \ |
| -c "! The certificate is not correctly signed by the trusted CA" \ |
| -c "! Certificate verification flags"\ |
| -C "! mbedtls_ssl_handshake returned" \ |
| -C "X509 - Certificate verification failed" \ |
| -C "SSL - No CA Chain is set, but required to operate" |
| |
| run_test "Authentication: server goodcert, client required, no trusted CA" \ |
| "$P_SRV" \ |
| "$P_CLI debug_level=3 auth_mode=required ca_file=none ca_path=none" \ |
| 1 \ |
| -c "x509_verify_cert() returned" \ |
| -c "! The certificate is not correctly signed by the trusted CA" \ |
| -c "! Certificate verification flags"\ |
| -c "! mbedtls_ssl_handshake returned" \ |
| -c "SSL - No CA Chain is set, but required to operate" |
| |
| # The purpose of the next two tests is to test the client's behaviour when receiving a server |
| # certificate with an unsupported elliptic curve. This should usually not happen because |
| # the client informs the server about the supported curves - it does, though, in the |
| # corner case of a static ECDH suite, because the server doesn't check the curve on that |
| # occasion (to be fixed). If that bug's fixed, the test needs to be altered to use a |
| # different means to have the server ignoring the client's supported curve list. |
| |
| requires_config_enabled MBEDTLS_ECP_C |
| run_test "Authentication: server ECDH p256v1, client required, p256v1 unsupported" \ |
| "$P_SRV debug_level=1 key_file=data_files/server5.key \ |
| crt_file=data_files/server5.ku-ka.crt" \ |
| "$P_CLI debug_level=3 auth_mode=required curves=secp521r1" \ |
| 1 \ |
| -c "bad certificate (EC key curve)"\ |
| -c "! Certificate verification flags"\ |
| -C "bad server certificate (ECDH curve)" # Expect failure at earlier verification stage |
| |
| requires_config_enabled MBEDTLS_ECP_C |
| run_test "Authentication: server ECDH p256v1, client optional, p256v1 unsupported" \ |
| "$P_SRV debug_level=1 key_file=data_files/server5.key \ |
| crt_file=data_files/server5.ku-ka.crt" \ |
| "$P_CLI debug_level=3 auth_mode=optional curves=secp521r1" \ |
| 1 \ |
| -c "bad certificate (EC key curve)"\ |
| -c "! Certificate verification flags"\ |
| -c "bad server certificate (ECDH curve)" # Expect failure only at ECDH params check |
| |
| run_test "Authentication: server badcert, client none" \ |
| "$P_SRV crt_file=data_files/server5-badsign.crt \ |
| key_file=data_files/server5.key" \ |
| "$P_CLI debug_level=1 auth_mode=none" \ |
| 0 \ |
| -C "x509_verify_cert() returned" \ |
| -C "! The certificate is not correctly signed by the trusted CA" \ |
| -C "! mbedtls_ssl_handshake returned" \ |
| -C "X509 - Certificate verification failed" |
| |
| run_test "Authentication: client SHA256, server required" \ |
| "$P_SRV auth_mode=required" \ |
| "$P_CLI debug_level=3 crt_file=data_files/server6.crt \ |
| key_file=data_files/server6.key \ |
| force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384" \ |
| 0 \ |
| -c "Supported Signature Algorithm found: 4," \ |
| -c "Supported Signature Algorithm found: 5," |
| |
| run_test "Authentication: client SHA384, server required" \ |
| "$P_SRV auth_mode=required" \ |
| "$P_CLI debug_level=3 crt_file=data_files/server6.crt \ |
| key_file=data_files/server6.key \ |
| force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256" \ |
| 0 \ |
| -c "Supported Signature Algorithm found: 4," \ |
| -c "Supported Signature Algorithm found: 5," |
| |
| run_test "Authentication: client has no cert, server required (TLS)" \ |
| "$P_SRV debug_level=3 auth_mode=required" \ |
| "$P_CLI debug_level=3 crt_file=none \ |
| key_file=data_files/server5.key" \ |
| 1 \ |
| -S "skip write certificate request" \ |
| -C "skip parse certificate request" \ |
| -c "got a certificate request" \ |
| -c "= write certificate$" \ |
| -C "skip write certificate$" \ |
| -S "x509_verify_cert() returned" \ |
| -s "client has no certificate" \ |
| -s "! mbedtls_ssl_handshake returned" \ |
| -c "! mbedtls_ssl_handshake returned" \ |
| -s "No client certification received from the client, but required by the authentication mode" |
| |
| run_test "Authentication: client badcert, server required" \ |
| "$P_SRV debug_level=3 auth_mode=required" \ |
| "$P_CLI debug_level=3 crt_file=data_files/server5-badsign.crt \ |
| key_file=data_files/server5.key" \ |
| 1 \ |
| -S "skip write certificate request" \ |
| -C "skip parse certificate request" \ |
| -c "got a certificate request" \ |
| -C "skip write certificate" \ |
| -C "skip write certificate verify" \ |
| -S "skip parse certificate verify" \ |
| -s "x509_verify_cert() returned" \ |
| -s "! The certificate is not correctly signed by the trusted CA" \ |
| -s "! mbedtls_ssl_handshake returned" \ |
| -s "send alert level=2 message=48" \ |
| -c "! mbedtls_ssl_handshake returned" \ |
| -s "X509 - Certificate verification failed" |
| # We don't check that the client receives the alert because it might |
| # detect that its write end of the connection is closed and abort |
| # before reading the alert message. |
| |
| run_test "Authentication: client cert not trusted, server required" \ |
| "$P_SRV debug_level=3 auth_mode=required" \ |
| "$P_CLI debug_level=3 crt_file=data_files/server5-selfsigned.crt \ |
| key_file=data_files/server5.key" \ |
| 1 \ |
| -S "skip write certificate request" \ |
| -C "skip parse certificate request" \ |
| -c "got a certificate request" \ |
| -C "skip write certificate" \ |
| -C "skip write certificate verify" \ |
| -S "skip parse certificate verify" \ |
| -s "x509_verify_cert() returned" \ |
| -s "! The certificate is not correctly signed by the trusted CA" \ |
| -s "! mbedtls_ssl_handshake returned" \ |
| -c "! mbedtls_ssl_handshake returned" \ |
| -s "X509 - Certificate verification failed" |
| |
| run_test "Authentication: client badcert, server optional" \ |
| "$P_SRV debug_level=3 auth_mode=optional" \ |
| "$P_CLI debug_level=3 crt_file=data_files/server5-badsign.crt \ |
| key_file=data_files/server5.key" \ |
| 0 \ |
| -S "skip write certificate request" \ |
| -C "skip parse certificate request" \ |
| -c "got a certificate request" \ |
| -C "skip write certificate" \ |
| -C "skip write certificate verify" \ |
| -S "skip parse certificate verify" \ |
| -s "x509_verify_cert() returned" \ |
| -s "! The certificate is not correctly signed by the trusted CA" \ |
| -S "! mbedtls_ssl_handshake returned" \ |
| -C "! mbedtls_ssl_handshake returned" \ |
| -S "X509 - Certificate verification failed" |
| |
| run_test "Authentication: client badcert, server none" \ |
| "$P_SRV debug_level=3 auth_mode=none" \ |
| "$P_CLI debug_level=3 crt_file=data_files/server5-badsign.crt \ |
| key_file=data_files/server5.key" \ |
| 0 \ |
| -s "skip write certificate request" \ |
| -C "skip parse certificate request" \ |
| -c "got no certificate request" \ |
| -c "skip write certificate" \ |
| -c "skip write certificate verify" \ |
| -s "skip parse certificate verify" \ |
| -S "x509_verify_cert() returned" \ |
| -S "! The certificate is not correctly signed by the trusted CA" \ |
| -S "! mbedtls_ssl_handshake returned" \ |
| -C "! mbedtls_ssl_handshake returned" \ |
| -S "X509 - Certificate verification failed" |
| |
| run_test "Authentication: client no cert, server optional" \ |
| "$P_SRV debug_level=3 auth_mode=optional" \ |
| "$P_CLI debug_level=3 crt_file=none key_file=none" \ |
| 0 \ |
| -S "skip write certificate request" \ |
| -C "skip parse certificate request" \ |
| -c "got a certificate request" \ |
| -C "skip write certificate$" \ |
| -C "got no certificate to send" \ |
| -c "skip write certificate verify" \ |
| -s "skip parse certificate verify" \ |
| -s "! Certificate was missing" \ |
| -S "! mbedtls_ssl_handshake returned" \ |
| -C "! mbedtls_ssl_handshake returned" \ |
| -S "X509 - Certificate verification failed" |
| |
| run_test "Authentication: openssl client no cert, server optional" \ |
| "$P_SRV debug_level=3 auth_mode=optional" \ |
| "$O_CLI" \ |
| 0 \ |
| -S "skip write certificate request" \ |
| -s "skip parse certificate verify" \ |
| -s "! Certificate was missing" \ |
| -S "! mbedtls_ssl_handshake returned" \ |
| -S "X509 - Certificate verification failed" |
| |
| run_test "Authentication: client no cert, openssl server optional" \ |
| "$O_SRV -verify 10" \ |
| "$P_CLI debug_level=3 crt_file=none key_file=none" \ |
| 0 \ |
| -C "skip parse certificate request" \ |
| -c "got a certificate request" \ |
| -C "skip write certificate$" \ |
| -c "skip write certificate verify" \ |
| -C "! mbedtls_ssl_handshake returned" |
| |
| run_test "Authentication: client no cert, openssl server required" \ |
| "$O_SRV -Verify 10" \ |
| "$P_CLI debug_level=3 crt_file=none key_file=none" \ |
| 1 \ |
| -C "skip parse certificate request" \ |
| -c "got a certificate request" \ |
| -C "skip write certificate$" \ |
| -c "skip write certificate verify" \ |
| -c "! mbedtls_ssl_handshake returned" |
| |
| # The "max_int chain" tests assume that MAX_INTERMEDIATE_CA is set to its |
| # default value (8) |
| |
| MAX_IM_CA='8' |
| MAX_IM_CA_CONFIG=$( ../scripts/config.py get MBEDTLS_X509_MAX_INTERMEDIATE_CA) |
| |
| if [ -n "$MAX_IM_CA_CONFIG" ] && [ "$MAX_IM_CA_CONFIG" -ne "$MAX_IM_CA" ]; then |
| cat <<EOF |
| ${CONFIG_H} contains a value for the configuration of |
| MBEDTLS_X509_MAX_INTERMEDIATE_CA that is different from the script's |
| test value of ${MAX_IM_CA}. |
| |
| The tests assume this value and if it changes, the tests in this |
| script should also be adjusted. |
| EOF |
| exit 1 |
| fi |
| |
| requires_full_size_output_buffer |
| run_test "Authentication: server max_int chain, client default" \ |
| "$P_SRV crt_file=data_files/dir-maxpath/c09.pem \ |
| key_file=data_files/dir-maxpath/09.key" \ |
| "$P_CLI server_name=CA09 ca_file=data_files/dir-maxpath/00.crt" \ |
| 0 \ |
| -C "X509 - A fatal error occurred" |
| |
| requires_full_size_output_buffer |
|