Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 1 | #!/bin/sh |
Paul Bakker | accd4eb | 2013-07-19 13:41:51 +0200 | [diff] [blame] | 2 | |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 3 | # compat.sh |
| 4 | # |
Bence Szépkúti | 1e14827 | 2020-08-07 13:07:28 +0200 | [diff] [blame] | 5 | # Copyright The Mbed TLS Contributors |
Bence Szépkúti | c7da1fe | 2020-05-26 01:54:15 +0200 | [diff] [blame] | 6 | # SPDX-License-Identifier: Apache-2.0 |
| 7 | # |
| 8 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 9 | # not use this file except in compliance with the License. |
| 10 | # You may obtain a copy of the License at |
| 11 | # |
| 12 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 13 | # |
| 14 | # Unless required by applicable law or agreed to in writing, software |
| 15 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 16 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 17 | # See the License for the specific language governing permissions and |
| 18 | # limitations under the License. |
| 19 | # |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 20 | # Purpose |
| 21 | # |
| 22 | # Test interoperbility with OpenSSL, GnuTLS as well as itself. |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 23 | # |
| 24 | # Check each common ciphersuite, with each version, both ways (client/server), |
| 25 | # with and without client authentication. |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 26 | |
Manuel Pégourié-Gonnard | 913030c | 2014-03-28 10:12:38 +0100 | [diff] [blame] | 27 | set -u |
| 28 | |
Jaeden Amero | 6e70eb2 | 2019-07-03 13:51:04 +0100 | [diff] [blame] | 29 | # Limit the size of each log to 10 GiB, in case of failures with this script |
| 30 | # where it may output seemingly unlimited length error logs. |
| 31 | ulimit -f 20971520 |
| 32 | |
Manuel Pégourié-Gonnard | a1a9f9a | 2014-03-25 18:04:59 +0100 | [diff] [blame] | 33 | # initialise counters |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 34 | TESTS=0 |
| 35 | FAILED=0 |
| 36 | SKIPPED=0 |
| 37 | SRVMEM=0 |
Manuel Pégourié-Gonnard | 70064fd | 2013-08-27 22:00:47 +0200 | [diff] [blame] | 38 | |
Antonin Décimo | 36e89b5 | 2019-01-23 15:24:37 +0100 | [diff] [blame] | 39 | # default commands, can be overridden by the environment |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 40 | : ${M_SRV:=../programs/ssl/ssl_server2} |
| 41 | : ${M_CLI:=../programs/ssl/ssl_client2} |
Manuel Pégourié-Gonnard | 74faf3c | 2014-03-13 18:47:44 +0100 | [diff] [blame] | 42 | : ${OPENSSL_CMD:=openssl} # OPENSSL would conflict with the build system |
| 43 | : ${GNUTLS_CLI:=gnutls-cli} |
| 44 | : ${GNUTLS_SERV:=gnutls-serv} |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 45 | |
Manuel Pégourié-Gonnard | 1287f11 | 2014-08-31 16:20:58 +0200 | [diff] [blame] | 46 | # do we have a recent enough GnuTLS? |
Manuel Pégourié-Gonnard | 03db6b0 | 2015-06-26 15:45:30 +0200 | [diff] [blame] | 47 | if ( which $GNUTLS_CLI && which $GNUTLS_SERV ) >/dev/null 2>&1; then |
Manuel Pégourié-Gonnard | dd45927 | 2014-10-24 12:57:37 +0200 | [diff] [blame] | 48 | G_VER="$( $GNUTLS_CLI --version | head -n1 )" |
| 49 | if echo "$G_VER" | grep '@VERSION@' > /dev/null; then # git version |
Manuel Pégourié-Gonnard | 1287f11 | 2014-08-31 16:20:58 +0200 | [diff] [blame] | 50 | PEER_GNUTLS=" GnuTLS" |
Manuel Pégourié-Gonnard | dd45927 | 2014-10-24 12:57:37 +0200 | [diff] [blame] | 51 | else |
| 52 | eval $( echo $G_VER | sed 's/.* \([0-9]*\)\.\([0-9]\)*\.\([0-9]*\)$/MAJOR="\1" MINOR="\2" PATCH="\3"/' ) |
| 53 | if [ $MAJOR -lt 3 -o \ |
| 54 | \( $MAJOR -eq 3 -a $MINOR -lt 2 \) -o \ |
| 55 | \( $MAJOR -eq 3 -a $MINOR -eq 2 -a $PATCH -lt 15 \) ] |
| 56 | then |
| 57 | PEER_GNUTLS="" |
| 58 | else |
| 59 | PEER_GNUTLS=" GnuTLS" |
Manuel Pégourié-Gonnard | c36b432 | 2018-06-14 13:14:29 +0200 | [diff] [blame] | 60 | if [ $MINOR -lt 4 ]; then |
| 61 | GNUTLS_MINOR_LT_FOUR='x' |
| 62 | fi |
Manuel Pégourié-Gonnard | dd45927 | 2014-10-24 12:57:37 +0200 | [diff] [blame] | 63 | fi |
Manuel Pégourié-Gonnard | 1287f11 | 2014-08-31 16:20:58 +0200 | [diff] [blame] | 64 | fi |
| 65 | else |
| 66 | PEER_GNUTLS="" |
| 67 | fi |
| 68 | |
Manuel Pégourié-Gonnard | a1a9f9a | 2014-03-25 18:04:59 +0100 | [diff] [blame] | 69 | # default values for options |
TRodziewicz | 0f82ec6 | 2021-05-12 17:49:18 +0200 | [diff] [blame] | 70 | MODES="tls1_2 dtls1_2" |
Paul Bakker | 1eeceae | 2012-11-23 14:25:34 +0100 | [diff] [blame] | 71 | VERIFIES="NO YES" |
Manuel Pégourié-Gonnard | 7ebaf37 | 2013-08-27 21:03:33 +0200 | [diff] [blame] | 72 | TYPES="ECDSA RSA PSK" |
Paul Bakker | accd4eb | 2013-07-19 13:41:51 +0200 | [diff] [blame] | 73 | FILTER="" |
Manuel Pégourié-Gonnard | 7299dfd | 2018-02-15 11:43:55 +0100 | [diff] [blame] | 74 | # exclude: |
| 75 | # - NULL: excluded from our default config |
Manuel Pégourié-Gonnard | 7299dfd | 2018-02-15 11:43:55 +0100 | [diff] [blame] | 76 | # avoid plain DES but keep 3DES-EDE-CBC (mbedTLS), DES-CBC3 (OpenSSL) |
Bence Szépkúti | bb0cfeb | 2021-05-28 09:42:25 +0200 | [diff] [blame] | 77 | # - ARIA: not in default mbedtls_config.h + requires OpenSSL >= 1.1.1 |
Manuel Pégourié-Gonnard | 9fece7e | 2018-06-18 11:38:22 +0200 | [diff] [blame] | 78 | # - ChachaPoly: requires OpenSSL >= 1.1.0 |
Andres Amaya Garcia | bdfba79 | 2019-02-11 21:47:30 +0000 | [diff] [blame] | 79 | # - 3DES: not in default config |
Mateusz Starzyk | 5224e29 | 2021-02-22 14:36:29 +0100 | [diff] [blame] | 80 | EXCLUDE='NULL\|DES\|ARIA\|CHACHA20-POLY1305' |
Paul Bakker | accd4eb | 2013-07-19 13:41:51 +0200 | [diff] [blame] | 81 | VERBOSE="" |
Manuel Pégourié-Gonnard | 3eec604 | 2014-02-27 15:37:24 +0100 | [diff] [blame] | 82 | MEMCHECK=0 |
Manuel Pégourié-Gonnard | e4f6edc | 2015-01-22 16:43:54 +0000 | [diff] [blame] | 83 | PEERS="OpenSSL$PEER_GNUTLS mbedTLS" |
Paul Bakker | accd4eb | 2013-07-19 13:41:51 +0200 | [diff] [blame] | 84 | |
Manuel Pégourié-Gonnard | 39e2ca9 | 2015-08-04 16:43:37 +0200 | [diff] [blame] | 85 | # hidden option: skip DTLS with OpenSSL |
| 86 | # (travis CI has a version that doesn't work for us) |
| 87 | : ${OSSL_NO_DTLS:=0} |
| 88 | |
Manuel Pégourié-Gonnard | 9dea8bd | 2014-02-26 18:21:02 +0100 | [diff] [blame] | 89 | print_usage() { |
| 90 | echo "Usage: $0" |
Manuel Pégourié-Gonnard | f46f128 | 2014-12-11 11:51:28 +0100 | [diff] [blame] | 91 | printf " -h|--help\tPrint this help.\n" |
Gilles Peskine | 231befa | 2020-08-26 20:05:11 +0200 | [diff] [blame] | 92 | printf " -f|--filter\tOnly matching ciphersuites are tested (Default: '%s')\n" "$FILTER" |
| 93 | printf " -e|--exclude\tMatching ciphersuites are excluded (Default: '%s')\n" "$EXCLUDE" |
| 94 | printf " -m|--modes\tWhich modes to perform (Default: '%s')\n" "$MODES" |
| 95 | printf " -t|--types\tWhich key exchange type to perform (Default: '%s')\n" "$TYPES" |
| 96 | printf " -V|--verify\tWhich verification modes to perform (Default: '%s')\n" "$VERIFIES" |
| 97 | printf " -p|--peers\tWhich peers to use (Default: '%s')\n" "$PEERS" |
Manuel Pégourié-Gonnard | f46f128 | 2014-12-11 11:51:28 +0100 | [diff] [blame] | 98 | printf " \tAlso available: GnuTLS (needs v3.2.15 or higher)\n" |
| 99 | printf " -M|--memcheck\tCheck memory leaks and errors.\n" |
| 100 | printf " -v|--verbose\tSet verbose output.\n" |
Manuel Pégourié-Gonnard | 9dea8bd | 2014-02-26 18:21:02 +0100 | [diff] [blame] | 101 | } |
| 102 | |
| 103 | get_options() { |
| 104 | while [ $# -gt 0 ]; do |
| 105 | case "$1" in |
| 106 | -f|--filter) |
| 107 | shift; FILTER=$1 |
| 108 | ;; |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 109 | -e|--exclude) |
| 110 | shift; EXCLUDE=$1 |
| 111 | ;; |
Manuel Pégourié-Gonnard | 9dea8bd | 2014-02-26 18:21:02 +0100 | [diff] [blame] | 112 | -m|--modes) |
| 113 | shift; MODES=$1 |
| 114 | ;; |
| 115 | -t|--types) |
| 116 | shift; TYPES=$1 |
| 117 | ;; |
| 118 | -V|--verify) |
| 119 | shift; VERIFIES=$1 |
| 120 | ;; |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 121 | -p|--peers) |
| 122 | shift; PEERS=$1 |
| 123 | ;; |
Manuel Pégourié-Gonnard | 9dea8bd | 2014-02-26 18:21:02 +0100 | [diff] [blame] | 124 | -v|--verbose) |
| 125 | VERBOSE=1 |
| 126 | ;; |
Manuel Pégourié-Gonnard | 3eec604 | 2014-02-27 15:37:24 +0100 | [diff] [blame] | 127 | -M|--memcheck) |
| 128 | MEMCHECK=1 |
| 129 | ;; |
Manuel Pégourié-Gonnard | 9dea8bd | 2014-02-26 18:21:02 +0100 | [diff] [blame] | 130 | -h|--help) |
| 131 | print_usage |
| 132 | exit 0 |
| 133 | ;; |
| 134 | *) |
| 135 | echo "Unknown argument: '$1'" |
| 136 | print_usage |
| 137 | exit 1 |
| 138 | ;; |
| 139 | esac |
| 140 | shift |
| 141 | done |
Manuel Pégourié-Gonnard | 85a4178 | 2014-10-24 12:47:26 +0200 | [diff] [blame] | 142 | |
| 143 | # sanitize some options (modes checked later) |
| 144 | VERIFIES="$( echo $VERIFIES | tr [a-z] [A-Z] )" |
| 145 | TYPES="$( echo $TYPES | tr [a-z] [A-Z] )" |
Manuel Pégourié-Gonnard | 9dea8bd | 2014-02-26 18:21:02 +0100 | [diff] [blame] | 146 | } |
Paul Bakker | accd4eb | 2013-07-19 13:41:51 +0200 | [diff] [blame] | 147 | |
Manuel Pégourié-Gonnard | 9595771 | 2014-02-19 15:29:38 +0100 | [diff] [blame] | 148 | log() { |
Paul Bakker | accd4eb | 2013-07-19 13:41:51 +0200 | [diff] [blame] | 149 | if [ "X" != "X$VERBOSE" ]; then |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 150 | echo "" |
Paul Bakker | accd4eb | 2013-07-19 13:41:51 +0200 | [diff] [blame] | 151 | echo "$@" |
| 152 | fi |
| 153 | } |
Paul Bakker | 10cd225 | 2012-04-12 21:26:34 +0000 | [diff] [blame] | 154 | |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 155 | # is_dtls <mode> |
| 156 | is_dtls() |
| 157 | { |
TRodziewicz | 6370dbe | 2021-05-13 22:56:31 +0200 | [diff] [blame] | 158 | test "$1" = "dtls1_2" |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 159 | } |
| 160 | |
| 161 | # minor_ver <mode> |
| 162 | minor_ver() |
| 163 | { |
| 164 | case "$1" in |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 165 | tls1_2|dtls1_2) |
| 166 | echo 3 |
| 167 | ;; |
| 168 | *) |
| 169 | echo "error: invalid mode: $MODE" >&2 |
| 170 | # exiting is no good here, typically called in a subshell |
| 171 | echo -1 |
| 172 | esac |
| 173 | } |
| 174 | |
Manuel Pégourié-Gonnard | dfc8d5a | 2013-08-27 20:48:40 +0200 | [diff] [blame] | 175 | filter() |
| 176 | { |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 177 | LIST="$1" |
Manuel Pégourié-Gonnard | dfc8d5a | 2013-08-27 20:48:40 +0200 | [diff] [blame] | 178 | NEW_LIST="" |
| 179 | |
Mateusz Starzyk | 5224e29 | 2021-02-22 14:36:29 +0100 | [diff] [blame] | 180 | EXCLMODE="$EXCLUDE" |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 181 | |
Manuel Pégourié-Gonnard | dfc8d5a | 2013-08-27 20:48:40 +0200 | [diff] [blame] | 182 | for i in $LIST; |
| 183 | do |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 184 | NEW_LIST="$NEW_LIST $( echo "$i" | grep "$FILTER" | grep -v "$EXCLMODE" )" |
Manuel Pégourié-Gonnard | dfc8d5a | 2013-08-27 20:48:40 +0200 | [diff] [blame] | 185 | done |
| 186 | |
Manuel Pégourié-Gonnard | 911622d | 2014-02-27 11:50:40 +0100 | [diff] [blame] | 187 | # normalize whitespace |
Manuel Pégourié-Gonnard | f46f128 | 2014-12-11 11:51:28 +0100 | [diff] [blame] | 188 | echo "$NEW_LIST" | sed -e 's/[[:space:]][[:space:]]*/ /g' -e 's/^ //' -e 's/ $//' |
Manuel Pégourié-Gonnard | dfc8d5a | 2013-08-27 20:48:40 +0200 | [diff] [blame] | 189 | } |
| 190 | |
Manuel Pégourié-Gonnard | 53aef81 | 2014-07-11 17:41:24 +0200 | [diff] [blame] | 191 | # OpenSSL 1.0.1h with -Verify wants a ClientCertificate message even for |
| 192 | # PSK ciphersuites with DTLS, which is incorrect, so disable them for now |
| 193 | check_openssl_server_bug() |
| 194 | { |
| 195 | if test "X$VERIFY" = "XYES" && is_dtls "$MODE" && \ |
| 196 | echo "$1" | grep "^TLS-PSK" >/dev/null; |
| 197 | then |
| 198 | SKIP_NEXT="YES" |
| 199 | fi |
| 200 | } |
| 201 | |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 202 | filter_ciphersuites() |
| 203 | { |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 204 | if [ "X" != "X$FILTER" -o "X" != "X$EXCLUDE" ]; |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 205 | then |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 206 | # Ciphersuite for mbed TLS |
| 207 | M_CIPHERS=$( filter "$M_CIPHERS" ) |
| 208 | |
| 209 | # Ciphersuite for OpenSSL |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 210 | O_CIPHERS=$( filter "$O_CIPHERS" ) |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 211 | |
| 212 | # Ciphersuite for GnuTLS |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 213 | G_CIPHERS=$( filter "$G_CIPHERS" ) |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 214 | fi |
Manuel Pégourié-Gonnard | 29980b1 | 2014-07-10 20:12:56 +0200 | [diff] [blame] | 215 | |
Gilles Peskine | 6eece5b | 2019-08-10 17:38:34 +0200 | [diff] [blame] | 216 | # OpenSSL <1.0.2 doesn't support DTLS 1.2. Check what OpenSSL |
| 217 | # supports from the s_server help. (The s_client help isn't |
| 218 | # accurate as of 1.0.2g: it supports DTLS 1.2 but doesn't list it. |
| 219 | # But the s_server help seems to be accurate.) |
| 220 | if ! $OPENSSL_CMD s_server -help 2>&1 | grep -q "^ *-$MODE "; then |
| 221 | M_CIPHERS="" |
Manuel Pégourié-Gonnard | 29980b1 | 2014-07-10 20:12:56 +0200 | [diff] [blame] | 222 | O_CIPHERS="" |
| 223 | fi |
| 224 | |
Manuel Pégourié-Gonnard | dba564b | 2015-01-23 11:33:38 +0000 | [diff] [blame] | 225 | # For GnuTLS client -> mbed TLS server, |
Manuel Pégourié-Gonnard | d1af102 | 2014-07-11 17:01:06 +0200 | [diff] [blame] | 226 | # we need to force IPv4 by connecting to 127.0.0.1 but then auth fails |
Manuel Pégourié-Gonnard | 29980b1 | 2014-07-10 20:12:56 +0200 | [diff] [blame] | 227 | if [ "X$VERIFY" = "XYES" ] && is_dtls "$MODE"; then |
| 228 | G_CIPHERS="" |
| 229 | fi |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 230 | } |
| 231 | |
| 232 | reset_ciphersuites() |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 233 | { |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 234 | M_CIPHERS="" |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 235 | O_CIPHERS="" |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 236 | G_CIPHERS="" |
| 237 | } |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 238 | |
Manuel Pégourié-Gonnard | 7299dfd | 2018-02-15 11:43:55 +0100 | [diff] [blame] | 239 | # Ciphersuites that can be used with all peers. |
| 240 | # Since we currently have three possible peers, each ciphersuite should appear |
| 241 | # three times: in each peer's list (with the name that this peer uses). |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 242 | add_common_ciphersuites() |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 243 | { |
Joe Subbiani | 34d6262 | 2021-07-27 14:55:56 +0100 | [diff] [blame] | 244 | CIPHERS="" |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 245 | case $TYPE in |
| 246 | |
| 247 | "ECDSA") |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 248 | if [ `minor_ver "$MODE"` -gt 0 ] |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 249 | then |
Joe Subbiani | 34d6262 | 2021-07-27 14:55:56 +0100 | [diff] [blame] | 250 | CIPHERS="$CIPHERS \ |
| 251 | TLS-ECDHE-ECDSA-WITH-NULL-SHA \ |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 252 | TLS-ECDHE-ECDSA-WITH-3DES-EDE-CBC-SHA \ |
| 253 | TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA \ |
| 254 | TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA \ |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 255 | " |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 256 | fi |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 257 | if [ `minor_ver "$MODE"` -ge 3 ] |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 258 | then |
Joe Subbiani | 34d6262 | 2021-07-27 14:55:56 +0100 | [diff] [blame] | 259 | CIPHERS="$CIPHERS \ |
| 260 | TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256 \ |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 261 | TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA384 \ |
| 262 | TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256 \ |
| 263 | TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384 \ |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 264 | " |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 265 | fi |
| 266 | ;; |
| 267 | |
| 268 | "RSA") |
Joe Subbiani | 34d6262 | 2021-07-27 14:55:56 +0100 | [diff] [blame] | 269 | CIPHERS="$CIPHERS \ |
| 270 | TLS-DHE-RSA-WITH-AES-128-CBC-SHA \ |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 271 | TLS-DHE-RSA-WITH-AES-256-CBC-SHA \ |
| 272 | TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA \ |
| 273 | TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA \ |
| 274 | TLS-DHE-RSA-WITH-3DES-EDE-CBC-SHA \ |
| 275 | TLS-RSA-WITH-AES-256-CBC-SHA \ |
| 276 | TLS-RSA-WITH-CAMELLIA-256-CBC-SHA \ |
| 277 | TLS-RSA-WITH-AES-128-CBC-SHA \ |
| 278 | TLS-RSA-WITH-CAMELLIA-128-CBC-SHA \ |
| 279 | TLS-RSA-WITH-3DES-EDE-CBC-SHA \ |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 280 | TLS-RSA-WITH-NULL-MD5 \ |
| 281 | TLS-RSA-WITH-NULL-SHA \ |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 282 | " |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 283 | if [ `minor_ver "$MODE"` -gt 0 ] |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 284 | then |
Joe Subbiani | 34d6262 | 2021-07-27 14:55:56 +0100 | [diff] [blame] | 285 | CIPHERS="$CIPHERS \ |
| 286 | TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA \ |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 287 | TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA \ |
| 288 | TLS-ECDHE-RSA-WITH-3DES-EDE-CBC-SHA \ |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 289 | TLS-ECDHE-RSA-WITH-NULL-SHA \ |
| 290 | " |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 291 | fi |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 292 | if [ `minor_ver "$MODE"` -ge 3 ] |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 293 | then |
Joe Subbiani | 34d6262 | 2021-07-27 14:55:56 +0100 | [diff] [blame] | 294 | CIPHERS="$CIPHERS \ |
| 295 | TLS-RSA-WITH-AES-128-CBC-SHA256 \ |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 296 | TLS-DHE-RSA-WITH-AES-128-CBC-SHA256 \ |
| 297 | TLS-RSA-WITH-AES-256-CBC-SHA256 \ |
| 298 | TLS-DHE-RSA-WITH-AES-256-CBC-SHA256 \ |
| 299 | TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA256 \ |
| 300 | TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384 \ |
| 301 | TLS-RSA-WITH-AES-128-GCM-SHA256 \ |
| 302 | TLS-RSA-WITH-AES-256-GCM-SHA384 \ |
| 303 | TLS-DHE-RSA-WITH-AES-128-GCM-SHA256 \ |
| 304 | TLS-DHE-RSA-WITH-AES-256-GCM-SHA384 \ |
| 305 | TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256 \ |
| 306 | TLS-ECDHE-RSA-WITH-AES-256-GCM-SHA384 \ |
| 307 | " |
Joe Subbiani | 34d6262 | 2021-07-27 14:55:56 +0100 | [diff] [blame] | 308 | O_CIPHERS="$O_CIPHERS NULL-SHA256" |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 309 | fi |
| 310 | ;; |
| 311 | |
| 312 | "PSK") |
Joe Subbiani | 34d6262 | 2021-07-27 14:55:56 +0100 | [diff] [blame] | 313 | CIPHERS="$CIPHERS \ |
| 314 | TLS-PSK-WITH-3DES-EDE-CBC-SHA \ |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 315 | TLS-PSK-WITH-AES-128-CBC-SHA \ |
| 316 | TLS-PSK-WITH-AES-256-CBC-SHA \ |
| 317 | " |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 318 | ;; |
| 319 | esac |
Joe Subbiani | 34d6262 | 2021-07-27 14:55:56 +0100 | [diff] [blame] | 320 | |
| 321 | M_CIPHERS="$M_CIPHERS $CIPHERS" |
| 322 | |
Joe Subbiani | f3fcc29 | 2021-07-28 15:51:02 +0100 | [diff] [blame] | 323 | G=`python3 scripts/translate_ciphers.py g "$CIPHERS"` |
Joe Subbiani | 34d6262 | 2021-07-27 14:55:56 +0100 | [diff] [blame] | 324 | G_CIPHERS="$G_CIPHERS $G" |
| 325 | |
Joe Subbiani | f3fcc29 | 2021-07-28 15:51:02 +0100 | [diff] [blame] | 326 | O=`python3 scripts/translate_ciphers.py o "$CIPHERS"` |
Joe Subbiani | 34d6262 | 2021-07-27 14:55:56 +0100 | [diff] [blame] | 327 | O_CIPHERS="$O_CIPHERS $O" |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 328 | } |
| 329 | |
Manuel Pégourié-Gonnard | 7299dfd | 2018-02-15 11:43:55 +0100 | [diff] [blame] | 330 | # Ciphersuites usable only with Mbed TLS and OpenSSL |
Joe Subbiani | a032963 | 2021-07-27 15:40:12 +0100 | [diff] [blame] | 331 | # Each ciphersuite is compiled case by case in the MBedTLS standard, and |
| 332 | # is appended to the list of MBedTLS ciphersuites $M_CIPHERS. The same list |
Joe Subbiani | 43592bd | 2021-07-27 16:32:21 +0100 | [diff] [blame] | 333 | # is translated to the OpenSSL naming standard and appended to the list of |
Joe Subbiani | a032963 | 2021-07-27 15:40:12 +0100 | [diff] [blame] | 334 | # OpenSSL ciphersuites $O_CIPHERS |
Manuel Pégourié-Gonnard | 7299dfd | 2018-02-15 11:43:55 +0100 | [diff] [blame] | 335 | # |
| 336 | # NOTE: for some reason RSA-PSK doesn't work with OpenSSL, |
Manuel Pégourié-Gonnard | ce5673c | 2018-03-06 09:54:10 +0100 | [diff] [blame] | 337 | # so RSA-PSK ciphersuites need to go in other sections, see |
| 338 | # https://github.com/ARMmbed/mbedtls/issues/1419 |
Manuel Pégourié-Gonnard | 9fece7e | 2018-06-18 11:38:22 +0200 | [diff] [blame] | 339 | # |
| 340 | # ChachaPoly suites are here rather than in "common", as they were added in |
| 341 | # GnuTLS in 3.5.0 and the CI only has 3.4.x so far. |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 342 | add_openssl_ciphersuites() |
| 343 | { |
Joe Subbiani | 34d6262 | 2021-07-27 14:55:56 +0100 | [diff] [blame] | 344 | CIPHERS="" |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 345 | case $TYPE in |
| 346 | |
| 347 | "ECDSA") |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 348 | if [ `minor_ver "$MODE"` -gt 0 ] |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 349 | then |
Joe Subbiani | 34d6262 | 2021-07-27 14:55:56 +0100 | [diff] [blame] | 350 | CIPHERS="$CIPHERS \ |
| 351 | TLS-ECDH-ECDSA-WITH-NULL-SHA \ |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 352 | TLS-ECDH-ECDSA-WITH-3DES-EDE-CBC-SHA \ |
| 353 | TLS-ECDH-ECDSA-WITH-AES-128-CBC-SHA \ |
| 354 | TLS-ECDH-ECDSA-WITH-AES-256-CBC-SHA \ |
| 355 | " |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 356 | fi |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 357 | if [ `minor_ver "$MODE"` -ge 3 ] |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 358 | then |
Joe Subbiani | 34d6262 | 2021-07-27 14:55:56 +0100 | [diff] [blame] | 359 | CIPHERS="$CIPHERS \ |
| 360 | TLS-ECDH-ECDSA-WITH-AES-128-CBC-SHA256 \ |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 361 | TLS-ECDH-ECDSA-WITH-AES-256-CBC-SHA384 \ |
| 362 | TLS-ECDH-ECDSA-WITH-AES-128-GCM-SHA256 \ |
| 363 | TLS-ECDH-ECDSA-WITH-AES-256-GCM-SHA384 \ |
Manuel Pégourié-Gonnard | 7299dfd | 2018-02-15 11:43:55 +0100 | [diff] [blame] | 364 | TLS-ECDHE-ECDSA-WITH-ARIA-256-GCM-SHA384 \ |
| 365 | TLS-ECDHE-ECDSA-WITH-ARIA-128-GCM-SHA256 \ |
Manuel Pégourié-Gonnard | 9fece7e | 2018-06-18 11:38:22 +0200 | [diff] [blame] | 366 | TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256 \ |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 367 | " |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 368 | fi |
| 369 | ;; |
| 370 | |
| 371 | "RSA") |
Joe Subbiani | 34d6262 | 2021-07-27 14:55:56 +0100 | [diff] [blame] | 372 | CIPHERS="$CIPHERS \ |
| 373 | TLS-RSA-WITH-DES-CBC-SHA \ |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 374 | TLS-DHE-RSA-WITH-DES-CBC-SHA \ |
| 375 | " |
Manuel Pégourié-Gonnard | 7299dfd | 2018-02-15 11:43:55 +0100 | [diff] [blame] | 376 | if [ `minor_ver "$MODE"` -ge 3 ] |
| 377 | then |
Joe Subbiani | 34d6262 | 2021-07-27 14:55:56 +0100 | [diff] [blame] | 378 | CIPHERS="$CIPHERS \ |
| 379 | TLS-ECDHE-RSA-WITH-ARIA-256-GCM-SHA384 \ |
Manuel Pégourié-Gonnard | 7299dfd | 2018-02-15 11:43:55 +0100 | [diff] [blame] | 380 | TLS-DHE-RSA-WITH-ARIA-256-GCM-SHA384 \ |
Manuel Pégourié-Gonnard | bba6406 | 2018-02-20 11:58:44 +0100 | [diff] [blame] | 381 | TLS-RSA-WITH-ARIA-256-GCM-SHA384 \ |
Manuel Pégourié-Gonnard | 7299dfd | 2018-02-15 11:43:55 +0100 | [diff] [blame] | 382 | TLS-ECDHE-RSA-WITH-ARIA-128-GCM-SHA256 \ |
| 383 | TLS-DHE-RSA-WITH-ARIA-128-GCM-SHA256 \ |
Manuel Pégourié-Gonnard | bba6406 | 2018-02-20 11:58:44 +0100 | [diff] [blame] | 384 | TLS-RSA-WITH-ARIA-128-GCM-SHA256 \ |
Manuel Pégourié-Gonnard | 9fece7e | 2018-06-18 11:38:22 +0200 | [diff] [blame] | 385 | TLS-DHE-RSA-WITH-CHACHA20-POLY1305-SHA256 \ |
| 386 | TLS-ECDHE-RSA-WITH-CHACHA20-POLY1305-SHA256 \ |
Manuel Pégourié-Gonnard | 7299dfd | 2018-02-15 11:43:55 +0100 | [diff] [blame] | 387 | " |
Manuel Pégourié-Gonnard | 7299dfd | 2018-02-15 11:43:55 +0100 | [diff] [blame] | 388 | fi |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 389 | ;; |
| 390 | |
| 391 | "PSK") |
Manuel Pégourié-Gonnard | 7299dfd | 2018-02-15 11:43:55 +0100 | [diff] [blame] | 392 | if [ `minor_ver "$MODE"` -ge 3 ] |
| 393 | then |
Joe Subbiani | 34d6262 | 2021-07-27 14:55:56 +0100 | [diff] [blame] | 394 | CIPHERS="$CIPHERS \ |
| 395 | TLS-DHE-PSK-WITH-ARIA-256-GCM-SHA384 \ |
Manuel Pégourié-Gonnard | bba6406 | 2018-02-20 11:58:44 +0100 | [diff] [blame] | 396 | TLS-DHE-PSK-WITH-ARIA-128-GCM-SHA256 \ |
Manuel Pégourié-Gonnard | 7299dfd | 2018-02-15 11:43:55 +0100 | [diff] [blame] | 397 | TLS-PSK-WITH-ARIA-256-GCM-SHA384 \ |
| 398 | TLS-PSK-WITH-ARIA-128-GCM-SHA256 \ |
Manuel Pégourié-Gonnard | 9fece7e | 2018-06-18 11:38:22 +0200 | [diff] [blame] | 399 | TLS-PSK-WITH-CHACHA20-POLY1305-SHA256 \ |
| 400 | TLS-ECDHE-PSK-WITH-CHACHA20-POLY1305-SHA256 \ |
| 401 | TLS-DHE-PSK-WITH-CHACHA20-POLY1305-SHA256 \ |
Manuel Pégourié-Gonnard | 7299dfd | 2018-02-15 11:43:55 +0100 | [diff] [blame] | 402 | " |
Manuel Pégourié-Gonnard | 7299dfd | 2018-02-15 11:43:55 +0100 | [diff] [blame] | 403 | fi |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 404 | ;; |
| 405 | esac |
Joe Subbiani | 34d6262 | 2021-07-27 14:55:56 +0100 | [diff] [blame] | 406 | |
| 407 | M_CIPHERS="$M_CIPHERS $CIPHERS" |
| 408 | |
Joe Subbiani | f3fcc29 | 2021-07-28 15:51:02 +0100 | [diff] [blame] | 409 | O=`python3 scripts/translate_ciphers.py o "$CIPHERS"` |
Joe Subbiani | 34d6262 | 2021-07-27 14:55:56 +0100 | [diff] [blame] | 410 | O_CIPHERS="$O_CIPHERS $O" |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 411 | } |
| 412 | |
Manuel Pégourié-Gonnard | 7299dfd | 2018-02-15 11:43:55 +0100 | [diff] [blame] | 413 | # Ciphersuites usable only with Mbed TLS and GnuTLS |
Joe Subbiani | a032963 | 2021-07-27 15:40:12 +0100 | [diff] [blame] | 414 | # Each ciphersuite is compiled case by case in the MBedTLS standard, and |
| 415 | # is appended to the list of MBedTLS ciphersuites $M_CIPHERS. The same list |
Joe Subbiani | 43592bd | 2021-07-27 16:32:21 +0100 | [diff] [blame] | 416 | # is translated to the GnuTLS naming standard and appended to the list of |
Joe Subbiani | a032963 | 2021-07-27 15:40:12 +0100 | [diff] [blame] | 417 | # GnuTLS ciphersuites $G_CIPHERS |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 418 | add_gnutls_ciphersuites() |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 419 | { |
Joe Subbiani | 34d6262 | 2021-07-27 14:55:56 +0100 | [diff] [blame] | 420 | CIPHERS="" |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 421 | case $TYPE in |
| 422 | |
| 423 | "ECDSA") |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 424 | if [ `minor_ver "$MODE"` -ge 3 ] |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 425 | then |
Joe Subbiani | 34d6262 | 2021-07-27 14:55:56 +0100 | [diff] [blame] | 426 | CIPHERS="$CIPHERS \ |
| 427 | TLS-ECDHE-ECDSA-WITH-CAMELLIA-128-CBC-SHA256 \ |
Joe Subbiani | 15d7124 | 2021-07-26 12:20:00 +0100 | [diff] [blame] | 428 | TLS-ECDHE-ECDSA-WITH-CAMELLIA-256-CBC-SHA384 \ |
| 429 | TLS-ECDHE-ECDSA-WITH-CAMELLIA-128-GCM-SHA256 \ |
| 430 | TLS-ECDHE-ECDSA-WITH-CAMELLIA-256-GCM-SHA384 \ |
| 431 | TLS-ECDHE-ECDSA-WITH-AES-128-CCM \ |
| 432 | TLS-ECDHE-ECDSA-WITH-AES-256-CCM \ |
| 433 | TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8 \ |
| 434 | TLS-ECDHE-ECDSA-WITH-AES-256-CCM-8 \ |
Manuel Pégourié-Gonnard | a437144 | 2014-03-13 16:21:59 +0100 | [diff] [blame] | 435 | " |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 436 | fi |
| 437 | ;; |
| 438 | |
| 439 | "RSA") |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 440 | if [ `minor_ver "$MODE"` -gt 0 ] |
Manuel Pégourié-Gonnard | 7457cb3 | 2014-07-13 13:57:24 +0200 | [diff] [blame] | 441 | then |
Joe Subbiani | 34d6262 | 2021-07-27 14:55:56 +0100 | [diff] [blame] | 442 | CIPHERS="$CIPHERS TLS-RSA-WITH-NULL-SHA256" |
Manuel Pégourié-Gonnard | 7457cb3 | 2014-07-13 13:57:24 +0200 | [diff] [blame] | 443 | fi |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 444 | if [ `minor_ver "$MODE"` -ge 3 ] |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 445 | then |
Joe Subbiani | 34d6262 | 2021-07-27 14:55:56 +0100 | [diff] [blame] | 446 | CIPHERS="$CIPHERS \ |
| 447 | TLS-ECDHE-RSA-WITH-CAMELLIA-128-CBC-SHA256 \ |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 448 | TLS-ECDHE-RSA-WITH-CAMELLIA-256-CBC-SHA384 \ |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 449 | TLS-RSA-WITH-CAMELLIA-128-CBC-SHA256 \ |
| 450 | TLS-RSA-WITH-CAMELLIA-256-CBC-SHA256 \ |
| 451 | TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA256 \ |
| 452 | TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA256 \ |
| 453 | TLS-ECDHE-RSA-WITH-CAMELLIA-128-GCM-SHA256 \ |
| 454 | TLS-ECDHE-RSA-WITH-CAMELLIA-256-GCM-SHA384 \ |
| 455 | TLS-DHE-RSA-WITH-CAMELLIA-128-GCM-SHA256 \ |
| 456 | TLS-DHE-RSA-WITH-CAMELLIA-256-GCM-SHA384 \ |
| 457 | TLS-RSA-WITH-CAMELLIA-128-GCM-SHA256 \ |
| 458 | TLS-RSA-WITH-CAMELLIA-256-GCM-SHA384 \ |
Manuel Pégourié-Gonnard | c36b432 | 2018-06-14 13:14:29 +0200 | [diff] [blame] | 459 | TLS-RSA-WITH-AES-128-CCM \ |
| 460 | TLS-RSA-WITH-AES-256-CCM \ |
| 461 | TLS-DHE-RSA-WITH-AES-128-CCM \ |
| 462 | TLS-DHE-RSA-WITH-AES-256-CCM \ |
| 463 | TLS-RSA-WITH-AES-128-CCM-8 \ |
| 464 | TLS-RSA-WITH-AES-256-CCM-8 \ |
| 465 | TLS-DHE-RSA-WITH-AES-128-CCM-8 \ |
| 466 | TLS-DHE-RSA-WITH-AES-256-CCM-8 \ |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 467 | " |
| 468 | fi |
| 469 | ;; |
| 470 | |
| 471 | "PSK") |
Joe Subbiani | 34d6262 | 2021-07-27 14:55:56 +0100 | [diff] [blame] | 472 | CIPHERS="$CIPHERS \ |
| 473 | TLS-DHE-PSK-WITH-3DES-EDE-CBC-SHA \ |
| 474 | TLS-DHE-PSK-WITH-AES-128-CBC-SHA \ |
| 475 | TLS-DHE-PSK-WITH-AES-256-CBC-SHA \ |
Manuel Pégourié-Gonnard | e46aa5e | 2014-07-13 15:44:19 +0200 | [diff] [blame] | 476 | " |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 477 | if [ `minor_ver "$MODE"` -gt 0 ] |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 478 | then |
Joe Subbiani | 34d6262 | 2021-07-27 14:55:56 +0100 | [diff] [blame] | 479 | CIPHERS="$CIPHERS \ |
| 480 | TLS-ECDHE-PSK-WITH-AES-256-CBC-SHA \ |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 481 | TLS-ECDHE-PSK-WITH-AES-128-CBC-SHA \ |
| 482 | TLS-ECDHE-PSK-WITH-3DES-EDE-CBC-SHA \ |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 483 | TLS-RSA-PSK-WITH-3DES-EDE-CBC-SHA \ |
| 484 | TLS-RSA-PSK-WITH-AES-256-CBC-SHA \ |
| 485 | TLS-RSA-PSK-WITH-AES-128-CBC-SHA \ |
Manuel Pégourié-Gonnard | a437144 | 2014-03-13 16:21:59 +0100 | [diff] [blame] | 486 | " |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 487 | fi |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 488 | if [ `minor_ver "$MODE"` -ge 3 ] |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 489 | then |
Joe Subbiani | 34d6262 | 2021-07-27 14:55:56 +0100 | [diff] [blame] | 490 | CIPHERS="$CIPHERS \ |
| 491 | TLS-ECDHE-PSK-WITH-AES-256-CBC-SHA384 \ |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 492 | TLS-ECDHE-PSK-WITH-CAMELLIA-256-CBC-SHA384 \ |
| 493 | TLS-ECDHE-PSK-WITH-AES-128-CBC-SHA256 \ |
| 494 | TLS-ECDHE-PSK-WITH-CAMELLIA-128-CBC-SHA256 \ |
| 495 | TLS-ECDHE-PSK-WITH-NULL-SHA384 \ |
| 496 | TLS-ECDHE-PSK-WITH-NULL-SHA256 \ |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 497 | TLS-PSK-WITH-AES-128-CBC-SHA256 \ |
| 498 | TLS-PSK-WITH-AES-256-CBC-SHA384 \ |
| 499 | TLS-DHE-PSK-WITH-AES-128-CBC-SHA256 \ |
| 500 | TLS-DHE-PSK-WITH-AES-256-CBC-SHA384 \ |
| 501 | TLS-PSK-WITH-NULL-SHA256 \ |
| 502 | TLS-PSK-WITH-NULL-SHA384 \ |
| 503 | TLS-DHE-PSK-WITH-NULL-SHA256 \ |
| 504 | TLS-DHE-PSK-WITH-NULL-SHA384 \ |
| 505 | TLS-RSA-PSK-WITH-AES-256-CBC-SHA384 \ |
| 506 | TLS-RSA-PSK-WITH-AES-128-CBC-SHA256 \ |
| 507 | TLS-RSA-PSK-WITH-NULL-SHA256 \ |
| 508 | TLS-RSA-PSK-WITH-NULL-SHA384 \ |
| 509 | TLS-DHE-PSK-WITH-CAMELLIA-128-CBC-SHA256 \ |
| 510 | TLS-DHE-PSK-WITH-CAMELLIA-256-CBC-SHA384 \ |
| 511 | TLS-PSK-WITH-CAMELLIA-128-CBC-SHA256 \ |
| 512 | TLS-PSK-WITH-CAMELLIA-256-CBC-SHA384 \ |
| 513 | TLS-RSA-PSK-WITH-CAMELLIA-256-CBC-SHA384 \ |
| 514 | TLS-RSA-PSK-WITH-CAMELLIA-128-CBC-SHA256 \ |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 515 | TLS-PSK-WITH-AES-128-GCM-SHA256 \ |
| 516 | TLS-PSK-WITH-AES-256-GCM-SHA384 \ |
| 517 | TLS-DHE-PSK-WITH-AES-128-GCM-SHA256 \ |
| 518 | TLS-DHE-PSK-WITH-AES-256-GCM-SHA384 \ |
Manuel Pégourié-Gonnard | c36b432 | 2018-06-14 13:14:29 +0200 | [diff] [blame] | 519 | TLS-PSK-WITH-AES-128-CCM \ |
| 520 | TLS-PSK-WITH-AES-256-CCM \ |
| 521 | TLS-DHE-PSK-WITH-AES-128-CCM \ |
| 522 | TLS-DHE-PSK-WITH-AES-256-CCM \ |
| 523 | TLS-PSK-WITH-AES-128-CCM-8 \ |
| 524 | TLS-PSK-WITH-AES-256-CCM-8 \ |
| 525 | TLS-DHE-PSK-WITH-AES-128-CCM-8 \ |
| 526 | TLS-DHE-PSK-WITH-AES-256-CCM-8 \ |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 527 | TLS-RSA-PSK-WITH-CAMELLIA-128-GCM-SHA256 \ |
| 528 | TLS-RSA-PSK-WITH-CAMELLIA-256-GCM-SHA384 \ |
| 529 | TLS-PSK-WITH-CAMELLIA-128-GCM-SHA256 \ |
| 530 | TLS-PSK-WITH-CAMELLIA-256-GCM-SHA384 \ |
| 531 | TLS-DHE-PSK-WITH-CAMELLIA-128-GCM-SHA256 \ |
| 532 | TLS-DHE-PSK-WITH-CAMELLIA-256-GCM-SHA384 \ |
| 533 | TLS-RSA-PSK-WITH-AES-256-GCM-SHA384 \ |
| 534 | TLS-RSA-PSK-WITH-AES-128-GCM-SHA256 \ |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 535 | " |
| 536 | fi |
| 537 | ;; |
| 538 | esac |
Joe Subbiani | 43592bd | 2021-07-27 16:32:21 +0100 | [diff] [blame] | 539 | |
Joe Subbiani | 34d6262 | 2021-07-27 14:55:56 +0100 | [diff] [blame] | 540 | M_CIPHERS="$M_CIPHERS $CIPHERS" |
| 541 | |
Joe Subbiani | f3fcc29 | 2021-07-28 15:51:02 +0100 | [diff] [blame] | 542 | G=`python3 scripts/translate_ciphers.py g "$CIPHERS"` |
Joe Subbiani | 34d6262 | 2021-07-27 14:55:56 +0100 | [diff] [blame] | 543 | G_CIPHERS="$G_CIPHERS $G" |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 544 | } |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 545 | |
Manuel Pégourié-Gonnard | 7299dfd | 2018-02-15 11:43:55 +0100 | [diff] [blame] | 546 | # Ciphersuites usable only with Mbed TLS (not currently supported by another |
| 547 | # peer usable in this script). This provide only very rudimentaty testing, as |
| 548 | # this is not interop testing, but it's better than nothing. |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 549 | add_mbedtls_ciphersuites() |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 550 | { |
| 551 | case $TYPE in |
| 552 | |
| 553 | "ECDSA") |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 554 | if [ `minor_ver "$MODE"` -gt 0 ] |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 555 | then |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 556 | M_CIPHERS="$M_CIPHERS \ |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 557 | TLS-ECDH-ECDSA-WITH-CAMELLIA-128-CBC-SHA256 \ |
| 558 | TLS-ECDH-ECDSA-WITH-CAMELLIA-256-CBC-SHA384 \ |
| 559 | " |
| 560 | fi |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 561 | if [ `minor_ver "$MODE"` -ge 3 ] |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 562 | then |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 563 | M_CIPHERS="$M_CIPHERS \ |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 564 | TLS-ECDH-ECDSA-WITH-CAMELLIA-128-GCM-SHA256 \ |
| 565 | TLS-ECDH-ECDSA-WITH-CAMELLIA-256-GCM-SHA384 \ |
Manuel Pégourié-Gonnard | a0e4708 | 2018-02-15 11:07:58 +0100 | [diff] [blame] | 566 | TLS-ECDHE-ECDSA-WITH-ARIA-256-CBC-SHA384 \ |
Manuel Pégourié-Gonnard | a0e4708 | 2018-02-15 11:07:58 +0100 | [diff] [blame] | 567 | TLS-ECDHE-ECDSA-WITH-ARIA-128-CBC-SHA256 \ |
Manuel Pégourié-Gonnard | bba6406 | 2018-02-20 11:58:44 +0100 | [diff] [blame] | 568 | TLS-ECDH-ECDSA-WITH-ARIA-256-GCM-SHA384 \ |
| 569 | TLS-ECDH-ECDSA-WITH-ARIA-128-GCM-SHA256 \ |
| 570 | TLS-ECDH-ECDSA-WITH-ARIA-256-CBC-SHA384 \ |
| 571 | TLS-ECDH-ECDSA-WITH-ARIA-128-CBC-SHA256 \ |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 572 | " |
| 573 | fi |
| 574 | ;; |
| 575 | |
| 576 | "RSA") |
Manuel Pégourié-Gonnard | 392c2d2 | 2018-02-15 11:06:14 +0100 | [diff] [blame] | 577 | if [ `minor_ver "$MODE"` -ge 3 ] |
Manuel Pégourié-Gonnard | 2594859 | 2014-05-22 14:36:02 +0200 | [diff] [blame] | 578 | then |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 579 | M_CIPHERS="$M_CIPHERS \ |
Manuel Pégourié-Gonnard | a0e4708 | 2018-02-15 11:07:58 +0100 | [diff] [blame] | 580 | TLS-ECDHE-RSA-WITH-ARIA-256-CBC-SHA384 \ |
| 581 | TLS-DHE-RSA-WITH-ARIA-256-CBC-SHA384 \ |
Manuel Pégourié-Gonnard | a0e4708 | 2018-02-15 11:07:58 +0100 | [diff] [blame] | 582 | TLS-ECDHE-RSA-WITH-ARIA-128-CBC-SHA256 \ |
| 583 | TLS-DHE-RSA-WITH-ARIA-128-CBC-SHA256 \ |
Manuel Pégourié-Gonnard | bba6406 | 2018-02-20 11:58:44 +0100 | [diff] [blame] | 584 | TLS-RSA-WITH-ARIA-256-CBC-SHA384 \ |
| 585 | TLS-RSA-WITH-ARIA-128-CBC-SHA256 \ |
Manuel Pégourié-Gonnard | 2594859 | 2014-05-22 14:36:02 +0200 | [diff] [blame] | 586 | " |
| 587 | fi |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 588 | ;; |
| 589 | |
| 590 | "PSK") |
Manuel Pégourié-Gonnard | 7eb58cb | 2015-07-07 11:54:14 +0200 | [diff] [blame] | 591 | # *PSK-NULL-SHA suites supported by GnuTLS 3.3.5 but not 3.2.15 |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 592 | M_CIPHERS="$M_CIPHERS \ |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 593 | TLS-PSK-WITH-NULL-SHA \ |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 594 | TLS-DHE-PSK-WITH-NULL-SHA \ |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 595 | " |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 596 | if [ `minor_ver "$MODE"` -gt 0 ] |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 597 | then |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 598 | M_CIPHERS="$M_CIPHERS \ |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 599 | TLS-ECDHE-PSK-WITH-NULL-SHA \ |
Manuel Pégourié-Gonnard | e46aa5e | 2014-07-13 15:44:19 +0200 | [diff] [blame] | 600 | TLS-RSA-PSK-WITH-NULL-SHA \ |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 601 | " |
| 602 | fi |
Manuel Pégourié-Gonnard | 392c2d2 | 2018-02-15 11:06:14 +0100 | [diff] [blame] | 603 | if [ `minor_ver "$MODE"` -ge 3 ] |
Manuel Pégourié-Gonnard | 2594859 | 2014-05-22 14:36:02 +0200 | [diff] [blame] | 604 | then |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 605 | M_CIPHERS="$M_CIPHERS \ |
Manuel Pégourié-Gonnard | a0e4708 | 2018-02-15 11:07:58 +0100 | [diff] [blame] | 606 | TLS-RSA-PSK-WITH-ARIA-256-CBC-SHA384 \ |
Manuel Pégourié-Gonnard | a0e4708 | 2018-02-15 11:07:58 +0100 | [diff] [blame] | 607 | TLS-RSA-PSK-WITH-ARIA-128-CBC-SHA256 \ |
Manuel Pégourié-Gonnard | a0e4708 | 2018-02-15 11:07:58 +0100 | [diff] [blame] | 608 | TLS-PSK-WITH-ARIA-256-CBC-SHA384 \ |
Manuel Pégourié-Gonnard | a0e4708 | 2018-02-15 11:07:58 +0100 | [diff] [blame] | 609 | TLS-PSK-WITH-ARIA-128-CBC-SHA256 \ |
Manuel Pégourié-Gonnard | 7299dfd | 2018-02-15 11:43:55 +0100 | [diff] [blame] | 610 | TLS-RSA-PSK-WITH-ARIA-256-GCM-SHA384 \ |
| 611 | TLS-RSA-PSK-WITH-ARIA-128-GCM-SHA256 \ |
Manuel Pégourié-Gonnard | bba6406 | 2018-02-20 11:58:44 +0100 | [diff] [blame] | 612 | TLS-ECDHE-PSK-WITH-ARIA-256-CBC-SHA384 \ |
| 613 | TLS-ECDHE-PSK-WITH-ARIA-128-CBC-SHA256 \ |
| 614 | TLS-DHE-PSK-WITH-ARIA-256-CBC-SHA384 \ |
| 615 | TLS-DHE-PSK-WITH-ARIA-128-CBC-SHA256 \ |
Manuel Pégourié-Gonnard | 9fece7e | 2018-06-18 11:38:22 +0200 | [diff] [blame] | 616 | TLS-RSA-PSK-WITH-CHACHA20-POLY1305-SHA256 \ |
Manuel Pégourié-Gonnard | 2594859 | 2014-05-22 14:36:02 +0200 | [diff] [blame] | 617 | " |
| 618 | fi |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 619 | ;; |
| 620 | esac |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 621 | } |
| 622 | |
Manuel Pégourié-Gonnard | d941a79 | 2014-02-19 13:35:52 +0100 | [diff] [blame] | 623 | setup_arguments() |
| 624 | { |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 625 | G_MODE="" |
| 626 | case "$MODE" in |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 627 | "tls1_2") |
| 628 | G_PRIO_MODE="+VERS-TLS1.2" |
Manuel Pégourié-Gonnard | 9ada01a | 2014-02-19 14:24:24 +0100 | [diff] [blame] | 629 | ;; |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 630 | "dtls1_2") |
| 631 | G_PRIO_MODE="+VERS-DTLS1.2" |
Manuel Pégourié-Gonnard | 3679519 | 2014-09-26 16:33:45 +0200 | [diff] [blame] | 632 | G_MODE="-u" |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 633 | ;; |
Manuel Pégourié-Gonnard | 9ada01a | 2014-02-19 14:24:24 +0100 | [diff] [blame] | 634 | *) |
| 635 | echo "error: invalid mode: $MODE" >&2 |
| 636 | exit 1; |
| 637 | esac |
| 638 | |
Manuel Pégourié-Gonnard | c36b432 | 2018-06-14 13:14:29 +0200 | [diff] [blame] | 639 | # GnuTLS < 3.4 will choke if we try to allow CCM-8 |
| 640 | if [ -z "${GNUTLS_MINOR_LT_FOUR-}" ]; then |
| 641 | G_PRIO_CCM="+AES-256-CCM-8:+AES-128-CCM-8:" |
| 642 | else |
| 643 | G_PRIO_CCM="" |
| 644 | fi |
| 645 | |
Mateusz Starzyk | 5224e29 | 2021-02-22 14:36:29 +0100 | [diff] [blame] | 646 | M_SERVER_ARGS="server_port=$PORT server_addr=0.0.0.0 force_version=$MODE" |
Gilles Peskine | 96f5bae | 2021-04-01 14:00:11 +0200 | [diff] [blame] | 647 | O_SERVER_ARGS="-accept $PORT -cipher NULL,ALL -$MODE" |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 648 | G_SERVER_ARGS="-p $PORT --http $G_MODE" |
Mateusz Starzyk | 5224e29 | 2021-02-22 14:36:29 +0100 | [diff] [blame] | 649 | G_SERVER_PRIO="NORMAL:${G_PRIO_CCM}+NULL:+MD5:+PSK:+DHE-PSK:+ECDHE-PSK:+SHA256:+SHA384:+RSA-PSK:-VERS-TLS-ALL:$G_PRIO_MODE" |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 650 | |
Gilles Peskine | 96f5bae | 2021-04-01 14:00:11 +0200 | [diff] [blame] | 651 | # The default prime for `openssl s_server` depends on the version: |
| 652 | # * OpenSSL <= 1.0.2a: 512-bit |
| 653 | # * OpenSSL 1.0.2b to 1.1.1b: 1024-bit |
| 654 | # * OpenSSL >= 1.1.1c: 2048-bit |
| 655 | # Mbed TLS wants >=1024, so force that for older versions. Don't force |
| 656 | # it for newer versions, which reject a 1024-bit prime. Indifferently |
| 657 | # force it or not for intermediate versions. |
| 658 | case $($OPENSSL_CMD version) in |
| 659 | "OpenSSL 1.0"*) |
| 660 | O_SERVER_ARGS="$O_SERVER_ARGS -dhparam data_files/dhparams.pem" |
| 661 | ;; |
| 662 | esac |
| 663 | |
Manuel Pégourié-Gonnard | d1af102 | 2014-07-11 17:01:06 +0200 | [diff] [blame] | 664 | # with OpenSSL 1.0.1h, -www, -WWW and -HTTP break DTLS handshakes |
| 665 | if is_dtls "$MODE"; then |
Manuel Pégourié-Gonnard | 3679519 | 2014-09-26 16:33:45 +0200 | [diff] [blame] | 666 | O_SERVER_ARGS="$O_SERVER_ARGS" |
Manuel Pégourié-Gonnard | d1af102 | 2014-07-11 17:01:06 +0200 | [diff] [blame] | 667 | else |
| 668 | O_SERVER_ARGS="$O_SERVER_ARGS -www" |
| 669 | fi |
| 670 | |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 671 | M_CLIENT_ARGS="server_port=$PORT server_addr=127.0.0.1 force_version=$MODE" |
Manuel Pégourié-Gonnard | 8066b81 | 2014-05-28 22:59:30 +0200 | [diff] [blame] | 672 | O_CLIENT_ARGS="-connect localhost:$PORT -$MODE" |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 673 | G_CLIENT_ARGS="-p $PORT --debug 3 $G_MODE" |
Manuel Pégourié-Gonnard | a437144 | 2014-03-13 16:21:59 +0100 | [diff] [blame] | 674 | G_CLIENT_PRIO="NONE:$G_PRIO_MODE:+COMP-NULL:+CURVE-ALL:+SIGN-ALL" |
Manuel Pégourié-Gonnard | 9ada01a | 2014-02-19 14:24:24 +0100 | [diff] [blame] | 675 | |
Manuel Pégourié-Gonnard | d941a79 | 2014-02-19 13:35:52 +0100 | [diff] [blame] | 676 | if [ "X$VERIFY" = "XYES" ]; |
| 677 | then |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 678 | M_SERVER_ARGS="$M_SERVER_ARGS ca_file=data_files/test-ca_cat12.crt auth_mode=required" |
Manuel Pégourié-Gonnard | 9ada01a | 2014-02-19 14:24:24 +0100 | [diff] [blame] | 679 | O_SERVER_ARGS="$O_SERVER_ARGS -CAfile data_files/test-ca_cat12.crt -Verify 10" |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 680 | G_SERVER_ARGS="$G_SERVER_ARGS --x509cafile data_files/test-ca_cat12.crt --require-client-cert" |
| 681 | |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 682 | M_CLIENT_ARGS="$M_CLIENT_ARGS ca_file=data_files/test-ca_cat12.crt auth_mode=required" |
Manuel Pégourié-Gonnard | da782c9 | 2014-02-21 10:10:20 +0100 | [diff] [blame] | 683 | O_CLIENT_ARGS="$O_CLIENT_ARGS -CAfile data_files/test-ca_cat12.crt -verify 10" |
Manuel Pégourié-Gonnard | a437144 | 2014-03-13 16:21:59 +0100 | [diff] [blame] | 684 | G_CLIENT_ARGS="$G_CLIENT_ARGS --x509cafile data_files/test-ca_cat12.crt" |
Manuel Pégourié-Gonnard | da782c9 | 2014-02-21 10:10:20 +0100 | [diff] [blame] | 685 | else |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 686 | # don't request a client cert at all |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 687 | M_SERVER_ARGS="$M_SERVER_ARGS ca_file=none auth_mode=none" |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 688 | G_SERVER_ARGS="$G_SERVER_ARGS --disable-client-cert" |
| 689 | |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 690 | M_CLIENT_ARGS="$M_CLIENT_ARGS ca_file=none auth_mode=none" |
Manuel Pégourié-Gonnard | 5de31ec | 2014-03-19 17:34:52 +0100 | [diff] [blame] | 691 | O_CLIENT_ARGS="$O_CLIENT_ARGS" |
| 692 | G_CLIENT_ARGS="$G_CLIENT_ARGS --insecure" |
Manuel Pégourié-Gonnard | d941a79 | 2014-02-19 13:35:52 +0100 | [diff] [blame] | 693 | fi |
| 694 | |
| 695 | case $TYPE in |
| 696 | "ECDSA") |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 697 | M_SERVER_ARGS="$M_SERVER_ARGS crt_file=data_files/server5.crt key_file=data_files/server5.key" |
Manuel Pégourié-Gonnard | 9ada01a | 2014-02-19 14:24:24 +0100 | [diff] [blame] | 698 | O_SERVER_ARGS="$O_SERVER_ARGS -cert data_files/server5.crt -key data_files/server5.key" |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 699 | G_SERVER_ARGS="$G_SERVER_ARGS --x509certfile data_files/server5.crt --x509keyfile data_files/server5.key" |
| 700 | |
Manuel Pégourié-Gonnard | 1b149ef | 2014-02-27 14:38:29 +0100 | [diff] [blame] | 701 | if [ "X$VERIFY" = "XYES" ]; then |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 702 | M_CLIENT_ARGS="$M_CLIENT_ARGS crt_file=data_files/server6.crt key_file=data_files/server6.key" |
Manuel Pégourié-Gonnard | 1b149ef | 2014-02-27 14:38:29 +0100 | [diff] [blame] | 703 | O_CLIENT_ARGS="$O_CLIENT_ARGS -cert data_files/server6.crt -key data_files/server6.key" |
Manuel Pégourié-Gonnard | a437144 | 2014-03-13 16:21:59 +0100 | [diff] [blame] | 704 | G_CLIENT_ARGS="$G_CLIENT_ARGS --x509certfile data_files/server6.crt --x509keyfile data_files/server6.key" |
Manuel Pégourié-Gonnard | 1b149ef | 2014-02-27 14:38:29 +0100 | [diff] [blame] | 705 | else |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 706 | M_CLIENT_ARGS="$M_CLIENT_ARGS crt_file=none key_file=none" |
Manuel Pégourié-Gonnard | 1b149ef | 2014-02-27 14:38:29 +0100 | [diff] [blame] | 707 | fi |
Manuel Pégourié-Gonnard | d941a79 | 2014-02-19 13:35:52 +0100 | [diff] [blame] | 708 | ;; |
| 709 | |
| 710 | "RSA") |
Manuel Pégourié-Gonnard | 499bf4c | 2020-08-21 12:24:32 +0200 | [diff] [blame] | 711 | M_SERVER_ARGS="$M_SERVER_ARGS crt_file=data_files/server2-sha256.crt key_file=data_files/server2.key" |
| 712 | O_SERVER_ARGS="$O_SERVER_ARGS -cert data_files/server2-sha256.crt -key data_files/server2.key" |
| 713 | G_SERVER_ARGS="$G_SERVER_ARGS --x509certfile data_files/server2-sha256.crt --x509keyfile data_files/server2.key" |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 714 | |
Manuel Pégourié-Gonnard | 1b149ef | 2014-02-27 14:38:29 +0100 | [diff] [blame] | 715 | if [ "X$VERIFY" = "XYES" ]; then |
Manuel Pégourié-Gonnard | 499bf4c | 2020-08-21 12:24:32 +0200 | [diff] [blame] | 716 | M_CLIENT_ARGS="$M_CLIENT_ARGS crt_file=data_files/cert_sha256.crt key_file=data_files/server1.key" |
| 717 | O_CLIENT_ARGS="$O_CLIENT_ARGS -cert data_files/cert_sha256.crt -key data_files/server1.key" |
| 718 | G_CLIENT_ARGS="$G_CLIENT_ARGS --x509certfile data_files/cert_sha256.crt --x509keyfile data_files/server1.key" |
Manuel Pégourié-Gonnard | 1b149ef | 2014-02-27 14:38:29 +0100 | [diff] [blame] | 719 | else |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 720 | M_CLIENT_ARGS="$M_CLIENT_ARGS crt_file=none key_file=none" |
Manuel Pégourié-Gonnard | 1b149ef | 2014-02-27 14:38:29 +0100 | [diff] [blame] | 721 | fi |
Manuel Pégourié-Gonnard | d941a79 | 2014-02-19 13:35:52 +0100 | [diff] [blame] | 722 | ;; |
| 723 | |
| 724 | "PSK") |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 725 | # give RSA-PSK-capable server a RSA cert |
Manuel Pégourié-Gonnard | 1b149ef | 2014-02-27 14:38:29 +0100 | [diff] [blame] | 726 | # (should be a separate type, but harder to close with openssl) |
Manuel Pégourié-Gonnard | 499bf4c | 2020-08-21 12:24:32 +0200 | [diff] [blame] | 727 | M_SERVER_ARGS="$M_SERVER_ARGS psk=6162636465666768696a6b6c6d6e6f70 ca_file=none crt_file=data_files/server2-sha256.crt key_file=data_files/server2.key" |
Manuel Pégourié-Gonnard | 1b149ef | 2014-02-27 14:38:29 +0100 | [diff] [blame] | 728 | O_SERVER_ARGS="$O_SERVER_ARGS -psk 6162636465666768696a6b6c6d6e6f70 -nocert" |
Manuel Pégourié-Gonnard | 499bf4c | 2020-08-21 12:24:32 +0200 | [diff] [blame] | 729 | G_SERVER_ARGS="$G_SERVER_ARGS --x509certfile data_files/server2-sha256.crt --x509keyfile data_files/server2.key --pskpasswd data_files/passwd.psk" |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 730 | |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 731 | M_CLIENT_ARGS="$M_CLIENT_ARGS psk=6162636465666768696a6b6c6d6e6f70 crt_file=none key_file=none" |
Manuel Pégourié-Gonnard | 9ada01a | 2014-02-19 14:24:24 +0100 | [diff] [blame] | 732 | O_CLIENT_ARGS="$O_CLIENT_ARGS -psk 6162636465666768696a6b6c6d6e6f70" |
Manuel Pégourié-Gonnard | a437144 | 2014-03-13 16:21:59 +0100 | [diff] [blame] | 733 | G_CLIENT_ARGS="$G_CLIENT_ARGS --pskusername Client_identity --pskkey=6162636465666768696a6b6c6d6e6f70" |
Manuel Pégourié-Gonnard | d941a79 | 2014-02-19 13:35:52 +0100 | [diff] [blame] | 734 | ;; |
| 735 | esac |
| 736 | } |
| 737 | |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 738 | # is_mbedtls <cmd_line> |
| 739 | is_mbedtls() { |
Manuel Pégourié-Gonnard | 3eec604 | 2014-02-27 15:37:24 +0100 | [diff] [blame] | 740 | echo "$1" | grep 'ssl_server2\|ssl_client2' > /dev/null |
| 741 | } |
| 742 | |
| 743 | # has_mem_err <log_file_name> |
| 744 | has_mem_err() { |
| 745 | if ( grep -F 'All heap blocks were freed -- no leaks are possible' "$1" && |
| 746 | grep -F 'ERROR SUMMARY: 0 errors from 0 contexts' "$1" ) > /dev/null |
| 747 | then |
| 748 | return 1 # false: does not have errors |
| 749 | else |
| 750 | return 0 # true: has errors |
| 751 | fi |
| 752 | } |
| 753 | |
Gilles Peskine | 12c49c7 | 2017-12-14 19:02:00 +0100 | [diff] [blame] | 754 | # Wait for process $2 to be listening on port $1 |
| 755 | if type lsof >/dev/null 2>/dev/null; then |
| 756 | wait_server_start() { |
| 757 | START_TIME=$(date +%s) |
| 758 | if is_dtls "$MODE"; then |
| 759 | proto=UDP |
| 760 | else |
| 761 | proto=TCP |
| 762 | fi |
| 763 | while ! lsof -a -n -b -i "$proto:$1" -p "$2" >/dev/null 2>/dev/null; do |
| 764 | if [ $(( $(date +%s) - $START_TIME )) -gt $DOG_DELAY ]; then |
| 765 | echo "SERVERSTART TIMEOUT" |
| 766 | echo "SERVERSTART TIMEOUT" >> $SRV_OUT |
| 767 | break |
| 768 | fi |
| 769 | # Linux and *BSD support decimal arguments to sleep. On other |
| 770 | # OSes this may be a tight loop. |
| 771 | sleep 0.1 2>/dev/null || true |
| 772 | done |
| 773 | } |
| 774 | else |
Gilles Peskine | 3c9e2b5 | 2018-01-08 12:38:15 +0100 | [diff] [blame] | 775 | echo "Warning: lsof not available, wait_server_start = sleep" |
Gilles Peskine | 12c49c7 | 2017-12-14 19:02:00 +0100 | [diff] [blame] | 776 | wait_server_start() { |
Manuel Pégourié-Gonnard | 0d225da | 2018-01-22 10:22:09 +0100 | [diff] [blame] | 777 | sleep 2 |
Gilles Peskine | 12c49c7 | 2017-12-14 19:02:00 +0100 | [diff] [blame] | 778 | } |
| 779 | fi |
| 780 | |
| 781 | |
Manuel Pégourié-Gonnard | 304beef | 2014-02-19 14:45:00 +0100 | [diff] [blame] | 782 | # start_server <name> |
| 783 | # also saves name and command |
| 784 | start_server() { |
Manuel Pégourié-Gonnard | 304beef | 2014-02-19 14:45:00 +0100 | [diff] [blame] | 785 | case $1 in |
| 786 | [Oo]pen*) |
Manuel Pégourié-Gonnard | 74faf3c | 2014-03-13 18:47:44 +0100 | [diff] [blame] | 787 | SERVER_CMD="$OPENSSL_CMD s_server $O_SERVER_ARGS" |
Manuel Pégourié-Gonnard | 304beef | 2014-02-19 14:45:00 +0100 | [diff] [blame] | 788 | ;; |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 789 | [Gg]nu*) |
Manuel Pégourié-Gonnard | 74faf3c | 2014-03-13 18:47:44 +0100 | [diff] [blame] | 790 | SERVER_CMD="$GNUTLS_SERV $G_SERVER_ARGS --priority $G_SERVER_PRIO" |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 791 | ;; |
Manuel Pégourié-Gonnard | a8f3b75 | 2015-01-22 17:05:05 +0000 | [diff] [blame] | 792 | mbed*) |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 793 | SERVER_CMD="$M_SRV $M_SERVER_ARGS" |
Manuel Pégourié-Gonnard | 3eec604 | 2014-02-27 15:37:24 +0100 | [diff] [blame] | 794 | if [ "$MEMCHECK" -gt 0 ]; then |
| 795 | SERVER_CMD="valgrind --leak-check=full $SERVER_CMD" |
| 796 | fi |
Manuel Pégourié-Gonnard | 304beef | 2014-02-19 14:45:00 +0100 | [diff] [blame] | 797 | ;; |
| 798 | *) |
| 799 | echo "error: invalid server name: $1" >&2 |
| 800 | exit 1 |
| 801 | ;; |
| 802 | esac |
| 803 | SERVER_NAME=$1 |
| 804 | |
| 805 | log "$SERVER_CMD" |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 806 | echo "$SERVER_CMD" > $SRV_OUT |
Manuel Pégourié-Gonnard | d1af102 | 2014-07-11 17:01:06 +0200 | [diff] [blame] | 807 | # for servers without -www or equivalent |
Manuel Pégourié-Gonnard | 82cf0a1 | 2015-02-09 13:05:54 +0000 | [diff] [blame] | 808 | while :; do echo bla; sleep 1; done | $SERVER_CMD >> $SRV_OUT 2>&1 & |
Manuel Pégourié-Gonnard | 304beef | 2014-02-19 14:45:00 +0100 | [diff] [blame] | 809 | PROCESS_ID=$! |
| 810 | |
Gilles Peskine | 12c49c7 | 2017-12-14 19:02:00 +0100 | [diff] [blame] | 811 | wait_server_start "$PORT" "$PROCESS_ID" |
Manuel Pégourié-Gonnard | 304beef | 2014-02-19 14:45:00 +0100 | [diff] [blame] | 812 | } |
| 813 | |
Manuel Pégourié-Gonnard | 1649449 | 2014-08-31 10:37:14 +0200 | [diff] [blame] | 814 | # terminate the running server |
Manuel Pégourié-Gonnard | 9595771 | 2014-02-19 15:29:38 +0100 | [diff] [blame] | 815 | stop_server() { |
Manuel Pégourié-Gonnard | 74b1170 | 2014-08-14 15:47:33 +0200 | [diff] [blame] | 816 | kill $PROCESS_ID 2>/dev/null |
| 817 | wait $PROCESS_ID 2>/dev/null |
Manuel Pégourié-Gonnard | 3eec604 | 2014-02-27 15:37:24 +0100 | [diff] [blame] | 818 | |
| 819 | if [ "$MEMCHECK" -gt 0 ]; then |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 820 | if is_mbedtls "$SERVER_CMD" && has_mem_err $SRV_OUT; then |
Manuel Pégourié-Gonnard | 3eec604 | 2014-02-27 15:37:24 +0100 | [diff] [blame] | 821 | echo " ! Server had memory errors" |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 822 | SRVMEM=$(( $SRVMEM + 1 )) |
Manuel Pégourié-Gonnard | 3eec604 | 2014-02-27 15:37:24 +0100 | [diff] [blame] | 823 | return |
| 824 | fi |
| 825 | fi |
| 826 | |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 827 | rm -f $SRV_OUT |
Manuel Pégourié-Gonnard | 9595771 | 2014-02-19 15:29:38 +0100 | [diff] [blame] | 828 | } |
| 829 | |
Manuel Pégourié-Gonnard | a9062e9 | 2014-02-25 16:21:22 +0100 | [diff] [blame] | 830 | # kill the running server (used when killed by signal) |
| 831 | cleanup() { |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 832 | rm -f $SRV_OUT $CLI_OUT |
Manuel Pégourié-Gonnard | 1649449 | 2014-08-31 10:37:14 +0200 | [diff] [blame] | 833 | kill $PROCESS_ID >/dev/null 2>&1 |
| 834 | kill $WATCHDOG_PID >/dev/null 2>&1 |
Manuel Pégourié-Gonnard | a9062e9 | 2014-02-25 16:21:22 +0100 | [diff] [blame] | 835 | exit 1 |
| 836 | } |
| 837 | |
Manuel Pégourié-Gonnard | c0f6a69 | 2014-08-30 22:41:47 +0200 | [diff] [blame] | 838 | # wait for client to terminate and set EXIT |
| 839 | # must be called right after starting the client |
| 840 | wait_client_done() { |
| 841 | CLI_PID=$! |
| 842 | |
| 843 | ( sleep "$DOG_DELAY"; echo "TIMEOUT" >> $CLI_OUT; kill $CLI_PID ) & |
| 844 | WATCHDOG_PID=$! |
| 845 | |
| 846 | wait $CLI_PID |
| 847 | EXIT=$? |
| 848 | |
| 849 | kill $WATCHDOG_PID |
| 850 | wait $WATCHDOG_PID |
| 851 | |
| 852 | echo "EXIT: $EXIT" >> $CLI_OUT |
| 853 | } |
| 854 | |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 855 | # run_client <name> <cipher> |
| 856 | run_client() { |
Manuel Pégourié-Gonnard | 87ae303 | 2014-02-27 11:12:30 +0100 | [diff] [blame] | 857 | # announce what we're going to do |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 858 | TESTS=$(( $TESTS + 1 )) |
Manuel Pégourié-Gonnard | 87ae303 | 2014-02-27 11:12:30 +0100 | [diff] [blame] | 859 | VERIF=$(echo $VERIFY | tr '[:upper:]' '[:lower:]') |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 860 | TITLE="`echo $1 | head -c1`->`echo $SERVER_NAME | head -c1`" |
| 861 | TITLE="$TITLE $MODE,$VERIF $2" |
Gilles Peskine | 231befa | 2020-08-26 20:05:11 +0200 | [diff] [blame] | 862 | printf "%s " "$TITLE" |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 863 | LEN=$(( 72 - `echo "$TITLE" | wc -c` )) |
Manuel Pégourié-Gonnard | f46f128 | 2014-12-11 11:51:28 +0100 | [diff] [blame] | 864 | for i in `seq 1 $LEN`; do printf '.'; done; printf ' ' |
Manuel Pégourié-Gonnard | 87ae303 | 2014-02-27 11:12:30 +0100 | [diff] [blame] | 865 | |
Manuel Pégourié-Gonnard | 53aef81 | 2014-07-11 17:41:24 +0200 | [diff] [blame] | 866 | # should we skip? |
| 867 | if [ "X$SKIP_NEXT" = "XYES" ]; then |
| 868 | SKIP_NEXT="NO" |
| 869 | echo "SKIP" |
| 870 | SKIPPED=$(( $SKIPPED + 1 )) |
| 871 | return |
| 872 | fi |
| 873 | |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 874 | # run the command and interpret result |
| 875 | case $1 in |
| 876 | [Oo]pen*) |
Manuel Pégourié-Gonnard | 74faf3c | 2014-03-13 18:47:44 +0100 | [diff] [blame] | 877 | CLIENT_CMD="$OPENSSL_CMD s_client $O_CLIENT_ARGS -cipher $2" |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 878 | log "$CLIENT_CMD" |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 879 | echo "$CLIENT_CMD" > $CLI_OUT |
Manuel Pégourié-Gonnard | 9afdc83 | 2015-08-04 17:15:13 +0200 | [diff] [blame] | 880 | printf 'GET HTTP/1.0\r\n\r\n' | $CLIENT_CMD >> $CLI_OUT 2>&1 & |
Manuel Pégourié-Gonnard | c0f6a69 | 2014-08-30 22:41:47 +0200 | [diff] [blame] | 881 | wait_client_done |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 882 | |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 883 | if [ $EXIT -eq 0 ]; then |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 884 | RESULT=0 |
| 885 | else |
Darryl Green | 11999bb | 2018-03-13 15:22:58 +0000 | [diff] [blame] | 886 | # If the cipher isn't supported... |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 887 | if grep 'Cipher is (NONE)' $CLI_OUT >/dev/null; then |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 888 | RESULT=1 |
| 889 | else |
| 890 | RESULT=2 |
| 891 | fi |
| 892 | fi |
| 893 | ;; |
| 894 | |
Manuel Pégourié-Gonnard | a437144 | 2014-03-13 16:21:59 +0100 | [diff] [blame] | 895 | [Gg]nu*) |
Manuel Pégourié-Gonnard | 29980b1 | 2014-07-10 20:12:56 +0200 | [diff] [blame] | 896 | # need to force IPv4 with UDP, but keep localhost for auth |
| 897 | if is_dtls "$MODE"; then |
| 898 | G_HOST="127.0.0.1" |
| 899 | else |
| 900 | G_HOST="localhost" |
| 901 | fi |
| 902 | CLIENT_CMD="$GNUTLS_CLI $G_CLIENT_ARGS --priority $G_PRIO_MODE:$2 $G_HOST" |
Manuel Pégourié-Gonnard | a437144 | 2014-03-13 16:21:59 +0100 | [diff] [blame] | 903 | log "$CLIENT_CMD" |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 904 | echo "$CLIENT_CMD" > $CLI_OUT |
Manuel Pégourié-Gonnard | 9afdc83 | 2015-08-04 17:15:13 +0200 | [diff] [blame] | 905 | printf 'GET HTTP/1.0\r\n\r\n' | $CLIENT_CMD >> $CLI_OUT 2>&1 & |
Manuel Pégourié-Gonnard | c0f6a69 | 2014-08-30 22:41:47 +0200 | [diff] [blame] | 906 | wait_client_done |
Manuel Pégourié-Gonnard | a437144 | 2014-03-13 16:21:59 +0100 | [diff] [blame] | 907 | |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 908 | if [ $EXIT -eq 0 ]; then |
Manuel Pégourié-Gonnard | a437144 | 2014-03-13 16:21:59 +0100 | [diff] [blame] | 909 | RESULT=0 |
| 910 | else |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 911 | RESULT=2 |
| 912 | # interpret early failure, with a handshake_failure alert |
| 913 | # before the server hello, as "no ciphersuite in common" |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 914 | if grep -F 'Received alert [40]: Handshake failed' $CLI_OUT; then |
| 915 | if grep -i 'SERVER HELLO .* was received' $CLI_OUT; then : |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 916 | else |
| 917 | RESULT=1 |
| 918 | fi |
| 919 | fi >/dev/null |
Manuel Pégourié-Gonnard | a437144 | 2014-03-13 16:21:59 +0100 | [diff] [blame] | 920 | fi |
| 921 | ;; |
| 922 | |
Manuel Pégourié-Gonnard | a8f3b75 | 2015-01-22 17:05:05 +0000 | [diff] [blame] | 923 | mbed*) |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 924 | CLIENT_CMD="$M_CLI $M_CLIENT_ARGS force_ciphersuite=$2" |
Manuel Pégourié-Gonnard | 3eec604 | 2014-02-27 15:37:24 +0100 | [diff] [blame] | 925 | if [ "$MEMCHECK" -gt 0 ]; then |
| 926 | CLIENT_CMD="valgrind --leak-check=full $CLIENT_CMD" |
| 927 | fi |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 928 | log "$CLIENT_CMD" |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 929 | echo "$CLIENT_CMD" > $CLI_OUT |
Manuel Pégourié-Gonnard | c0f6a69 | 2014-08-30 22:41:47 +0200 | [diff] [blame] | 930 | $CLIENT_CMD >> $CLI_OUT 2>&1 & |
| 931 | wait_client_done |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 932 | |
| 933 | case $EXIT in |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 934 | # Success |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 935 | "0") RESULT=0 ;; |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 936 | |
| 937 | # Ciphersuite not supported |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 938 | "2") RESULT=1 ;; |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 939 | |
| 940 | # Error |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 941 | *) RESULT=2 ;; |
| 942 | esac |
Manuel Pégourié-Gonnard | 3eec604 | 2014-02-27 15:37:24 +0100 | [diff] [blame] | 943 | |
| 944 | if [ "$MEMCHECK" -gt 0 ]; then |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 945 | if is_mbedtls "$CLIENT_CMD" && has_mem_err $CLI_OUT; then |
Manuel Pégourié-Gonnard | 3eec604 | 2014-02-27 15:37:24 +0100 | [diff] [blame] | 946 | RESULT=2 |
| 947 | fi |
| 948 | fi |
| 949 | |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 950 | ;; |
| 951 | |
| 952 | *) |
| 953 | echo "error: invalid client name: $1" >&2 |
| 954 | exit 1 |
| 955 | ;; |
| 956 | esac |
| 957 | |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 958 | echo "EXIT: $EXIT" >> $CLI_OUT |
Manuel Pégourié-Gonnard | e01af4c | 2014-03-25 14:16:44 +0100 | [diff] [blame] | 959 | |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 960 | # report and count result |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 961 | case $RESULT in |
| 962 | "0") |
Manuel Pégourié-Gonnard | 4145b89 | 2014-02-24 13:20:14 +0100 | [diff] [blame] | 963 | echo PASS |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 964 | ;; |
| 965 | "1") |
Manuel Pégourié-Gonnard | 4145b89 | 2014-02-24 13:20:14 +0100 | [diff] [blame] | 966 | echo SKIP |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 967 | SKIPPED=$(( $SKIPPED + 1 )) |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 968 | ;; |
| 969 | "2") |
Manuel Pégourié-Gonnard | 4145b89 | 2014-02-24 13:20:14 +0100 | [diff] [blame] | 970 | echo FAIL |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 971 | cp $SRV_OUT c-srv-${TESTS}.log |
| 972 | cp $CLI_OUT c-cli-${TESTS}.log |
| 973 | echo " ! outputs saved to c-srv-${TESTS}.log, c-cli-${TESTS}.log" |
Manuel Pégourié-Gonnard | 7fa6772 | 2014-08-31 17:42:53 +0200 | [diff] [blame] | 974 | |
Manuel Pégourié-Gonnard | 882148e | 2020-07-27 09:46:53 +0200 | [diff] [blame] | 975 | if [ "${LOG_FAILURE_ON_STDOUT:-0}" != 0 ]; then |
Manuel Pégourié-Gonnard | 7fa6772 | 2014-08-31 17:42:53 +0200 | [diff] [blame] | 976 | echo " ! server output:" |
| 977 | cat c-srv-${TESTS}.log |
| 978 | echo " ! ===================================================" |
| 979 | echo " ! client output:" |
| 980 | cat c-cli-${TESTS}.log |
| 981 | fi |
| 982 | |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 983 | FAILED=$(( $FAILED + 1 )) |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 984 | ;; |
| 985 | esac |
Manuel Pégourié-Gonnard | 87ae303 | 2014-02-27 11:12:30 +0100 | [diff] [blame] | 986 | |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 987 | rm -f $CLI_OUT |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 988 | } |
| 989 | |
Manuel Pégourié-Gonnard | 9dea8bd | 2014-02-26 18:21:02 +0100 | [diff] [blame] | 990 | # |
| 991 | # MAIN |
| 992 | # |
| 993 | |
Manuel Pégourié-Gonnard | 19db8ea | 2015-03-10 13:41:04 +0000 | [diff] [blame] | 994 | if cd $( dirname $0 ); then :; else |
| 995 | echo "cd $( dirname $0 ) failed" >&2 |
| 996 | exit 1 |
| 997 | fi |
| 998 | |
Manuel Pégourié-Gonnard | 3947d04 | 2014-03-14 18:13:53 +0100 | [diff] [blame] | 999 | get_options "$@" |
| 1000 | |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 1001 | # sanity checks, avoid an avalanche of errors |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 1002 | if [ ! -x "$M_SRV" ]; then |
| 1003 | echo "Command '$M_SRV' is not an executable file" >&2 |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 1004 | exit 1 |
| 1005 | fi |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 1006 | if [ ! -x "$M_CLI" ]; then |
| 1007 | echo "Command '$M_CLI' is not an executable file" >&2 |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 1008 | exit 1 |
| 1009 | fi |
Manuel Pégourié-Gonnard | 3947d04 | 2014-03-14 18:13:53 +0100 | [diff] [blame] | 1010 | |
| 1011 | if echo "$PEERS" | grep -i openssl > /dev/null; then |
| 1012 | if which "$OPENSSL_CMD" >/dev/null 2>&1; then :; else |
| 1013 | echo "Command '$OPENSSL_CMD' not found" >&2 |
Manuel Pégourié-Gonnard | 74faf3c | 2014-03-13 18:47:44 +0100 | [diff] [blame] | 1014 | exit 1 |
| 1015 | fi |
Manuel Pégourié-Gonnard | 3947d04 | 2014-03-14 18:13:53 +0100 | [diff] [blame] | 1016 | fi |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 1017 | |
Manuel Pégourié-Gonnard | 3947d04 | 2014-03-14 18:13:53 +0100 | [diff] [blame] | 1018 | if echo "$PEERS" | grep -i gnutls > /dev/null; then |
| 1019 | for CMD in "$GNUTLS_CLI" "$GNUTLS_SERV"; do |
| 1020 | if which "$CMD" >/dev/null 2>&1; then :; else |
| 1021 | echo "Command '$CMD' not found" >&2 |
| 1022 | exit 1 |
| 1023 | fi |
| 1024 | done |
| 1025 | fi |
| 1026 | |
| 1027 | for PEER in $PEERS; do |
| 1028 | case "$PEER" in |
Manuel Pégourié-Gonnard | a8f3b75 | 2015-01-22 17:05:05 +0000 | [diff] [blame] | 1029 | mbed*|[Oo]pen*|[Gg]nu*) |
Manuel Pégourié-Gonnard | 3947d04 | 2014-03-14 18:13:53 +0100 | [diff] [blame] | 1030 | ;; |
| 1031 | *) |
| 1032 | echo "Unknown peers: $PEER" >&2 |
| 1033 | exit 1 |
| 1034 | esac |
| 1035 | done |
Manuel Pégourié-Gonnard | 9dea8bd | 2014-02-26 18:21:02 +0100 | [diff] [blame] | 1036 | |
Manuel Pégourié-Gonnard | 8066b81 | 2014-05-28 22:59:30 +0200 | [diff] [blame] | 1037 | # Pick a "unique" port in the range 10000-19999. |
| 1038 | PORT="0000$$" |
Manuel Pégourié-Gonnard | fab2a3c | 2014-06-16 16:54:36 +0200 | [diff] [blame] | 1039 | PORT="1$(echo $PORT | tail -c 5)" |
Manuel Pégourié-Gonnard | 8066b81 | 2014-05-28 22:59:30 +0200 | [diff] [blame] | 1040 | |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 1041 | # Also pick a unique name for intermediate files |
| 1042 | SRV_OUT="srv_out.$$" |
| 1043 | CLI_OUT="cli_out.$$" |
| 1044 | |
Manuel Pégourié-Gonnard | c0f6a69 | 2014-08-30 22:41:47 +0200 | [diff] [blame] | 1045 | # client timeout delay: be more patient with valgrind |
| 1046 | if [ "$MEMCHECK" -gt 0 ]; then |
| 1047 | DOG_DELAY=30 |
| 1048 | else |
| 1049 | DOG_DELAY=10 |
| 1050 | fi |
| 1051 | |
Manuel Pégourié-Gonnard | 53aef81 | 2014-07-11 17:41:24 +0200 | [diff] [blame] | 1052 | SKIP_NEXT="NO" |
| 1053 | |
Manuel Pégourié-Gonnard | a9062e9 | 2014-02-25 16:21:22 +0100 | [diff] [blame] | 1054 | trap cleanup INT TERM HUP |
| 1055 | |
Manuel Pégourié-Gonnard | 9595771 | 2014-02-19 15:29:38 +0100 | [diff] [blame] | 1056 | for VERIFY in $VERIFIES; do |
| 1057 | for MODE in $MODES; do |
Manuel Pégourié-Gonnard | 9595771 | 2014-02-19 15:29:38 +0100 | [diff] [blame] | 1058 | for TYPE in $TYPES; do |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1059 | for PEER in $PEERS; do |
Paul Bakker | 7e5e7ca | 2013-04-17 19:27:58 +0200 | [diff] [blame] | 1060 | |
Manuel Pégourié-Gonnard | 9595771 | 2014-02-19 15:29:38 +0100 | [diff] [blame] | 1061 | setup_arguments |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 1062 | |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1063 | case "$PEER" in |
Manuel Pégourié-Gonnard | d331319 | 2013-09-13 19:20:37 +0200 | [diff] [blame] | 1064 | |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1065 | [Oo]pen*) |
Paul Bakker | 398cb51 | 2012-04-10 08:22:31 +0000 | [diff] [blame] | 1066 | |
Manuel Pégourié-Gonnard | 39e2ca9 | 2015-08-04 16:43:37 +0200 | [diff] [blame] | 1067 | if test "$OSSL_NO_DTLS" -gt 0 && is_dtls "$MODE"; then |
| 1068 | continue; |
| 1069 | fi |
| 1070 | |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1071 | reset_ciphersuites |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 1072 | add_common_ciphersuites |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1073 | add_openssl_ciphersuites |
| 1074 | filter_ciphersuites |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 1075 | |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 1076 | if [ "X" != "X$M_CIPHERS" ]; then |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1077 | start_server "OpenSSL" |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 1078 | for i in $M_CIPHERS; do |
Manuel Pégourié-Gonnard | 53aef81 | 2014-07-11 17:41:24 +0200 | [diff] [blame] | 1079 | check_openssl_server_bug $i |
Manuel Pégourié-Gonnard | e4f6edc | 2015-01-22 16:43:54 +0000 | [diff] [blame] | 1080 | run_client mbedTLS $i |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1081 | done |
| 1082 | stop_server |
| 1083 | fi |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 1084 | |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1085 | if [ "X" != "X$O_CIPHERS" ]; then |
Manuel Pégourié-Gonnard | e4f6edc | 2015-01-22 16:43:54 +0000 | [diff] [blame] | 1086 | start_server "mbedTLS" |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1087 | for i in $O_CIPHERS; do |
| 1088 | run_client OpenSSL $i |
| 1089 | done |
| 1090 | stop_server |
| 1091 | fi |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 1092 | |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1093 | ;; |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 1094 | |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1095 | [Gg]nu*) |
Paul Bakker | fab5c82 | 2012-02-06 16:45:10 +0000 | [diff] [blame] | 1096 | |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1097 | reset_ciphersuites |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 1098 | add_common_ciphersuites |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1099 | add_gnutls_ciphersuites |
| 1100 | filter_ciphersuites |
Paul Bakker | fab5c82 | 2012-02-06 16:45:10 +0000 | [diff] [blame] | 1101 | |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 1102 | if [ "X" != "X$M_CIPHERS" ]; then |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1103 | start_server "GnuTLS" |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 1104 | for i in $M_CIPHERS; do |
Manuel Pégourié-Gonnard | e4f6edc | 2015-01-22 16:43:54 +0000 | [diff] [blame] | 1105 | run_client mbedTLS $i |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1106 | done |
| 1107 | stop_server |
| 1108 | fi |
| 1109 | |
| 1110 | if [ "X" != "X$G_CIPHERS" ]; then |
Manuel Pégourié-Gonnard | e4f6edc | 2015-01-22 16:43:54 +0000 | [diff] [blame] | 1111 | start_server "mbedTLS" |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1112 | for i in $G_CIPHERS; do |
| 1113 | run_client GnuTLS $i |
| 1114 | done |
| 1115 | stop_server |
| 1116 | fi |
| 1117 | |
| 1118 | ;; |
| 1119 | |
Manuel Pégourié-Gonnard | a8f3b75 | 2015-01-22 17:05:05 +0000 | [diff] [blame] | 1120 | mbed*) |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1121 | |
| 1122 | reset_ciphersuites |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 1123 | add_common_ciphersuites |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1124 | add_openssl_ciphersuites |
| 1125 | add_gnutls_ciphersuites |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 1126 | add_mbedtls_ciphersuites |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1127 | filter_ciphersuites |
| 1128 | |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 1129 | if [ "X" != "X$M_CIPHERS" ]; then |
Manuel Pégourié-Gonnard | e4f6edc | 2015-01-22 16:43:54 +0000 | [diff] [blame] | 1130 | start_server "mbedTLS" |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 1131 | for i in $M_CIPHERS; do |
Manuel Pégourié-Gonnard | e4f6edc | 2015-01-22 16:43:54 +0000 | [diff] [blame] | 1132 | run_client mbedTLS $i |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1133 | done |
| 1134 | stop_server |
| 1135 | fi |
| 1136 | |
| 1137 | ;; |
| 1138 | |
Manuel Pégourié-Gonnard | a1a9f9a | 2014-03-25 18:04:59 +0100 | [diff] [blame] | 1139 | *) |
Paul Bakker | 1ebc0c5 | 2014-05-22 15:47:58 +0200 | [diff] [blame] | 1140 | echo "Unknown peer: $PEER" >&2 |
Manuel Pégourié-Gonnard | a1a9f9a | 2014-03-25 18:04:59 +0100 | [diff] [blame] | 1141 | exit 1 |
| 1142 | ;; |
| 1143 | |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1144 | esac |
| 1145 | |
| 1146 | done |
Manuel Pégourié-Gonnard | 9595771 | 2014-02-19 15:29:38 +0100 | [diff] [blame] | 1147 | done |
| 1148 | done |
Manuel Pégourié-Gonnard | 9791a40 | 2013-08-27 19:57:15 +0200 | [diff] [blame] | 1149 | done |
Manuel Pégourié-Gonnard | 70064fd | 2013-08-27 22:00:47 +0200 | [diff] [blame] | 1150 | |
Manuel Pégourié-Gonnard | 4145b89 | 2014-02-24 13:20:14 +0100 | [diff] [blame] | 1151 | echo "------------------------------------------------------------------------" |
Manuel Pégourié-Gonnard | 70064fd | 2013-08-27 22:00:47 +0200 | [diff] [blame] | 1152 | |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 1153 | if [ $FAILED -ne 0 -o $SRVMEM -ne 0 ]; |
Manuel Pégourié-Gonnard | 70064fd | 2013-08-27 22:00:47 +0200 | [diff] [blame] | 1154 | then |
Manuel Pégourié-Gonnard | f46f128 | 2014-12-11 11:51:28 +0100 | [diff] [blame] | 1155 | printf "FAILED" |
Manuel Pégourié-Gonnard | 70064fd | 2013-08-27 22:00:47 +0200 | [diff] [blame] | 1156 | else |
Manuel Pégourié-Gonnard | f46f128 | 2014-12-11 11:51:28 +0100 | [diff] [blame] | 1157 | printf "PASSED" |
Manuel Pégourié-Gonnard | 70064fd | 2013-08-27 22:00:47 +0200 | [diff] [blame] | 1158 | fi |
| 1159 | |
Manuel Pégourié-Gonnard | ba0b844 | 2014-03-13 17:57:45 +0100 | [diff] [blame] | 1160 | if [ "$MEMCHECK" -gt 0 ]; then |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 1161 | MEMREPORT=", $SRVMEM server memory errors" |
Manuel Pégourié-Gonnard | ba0b844 | 2014-03-13 17:57:45 +0100 | [diff] [blame] | 1162 | else |
| 1163 | MEMREPORT="" |
| 1164 | fi |
| 1165 | |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 1166 | PASSED=$(( $TESTS - $FAILED )) |
| 1167 | echo " ($PASSED / $TESTS tests ($SKIPPED skipped$MEMREPORT))" |
Manuel Pégourié-Gonnard | 70064fd | 2013-08-27 22:00:47 +0200 | [diff] [blame] | 1168 | |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 1169 | FAILED=$(( $FAILED + $SRVMEM )) |
| 1170 | exit $FAILED |