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 | { |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 244 | case $TYPE in |
| 245 | |
| 246 | "ECDSA") |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 247 | if [ `minor_ver "$MODE"` -gt 0 ] |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 248 | then |
Joe Subbiani | 15d7124 | 2021-07-26 12:20:00 +0100 | [diff] [blame^] | 249 | CIPHERS="TLS-ECDHE-ECDSA-WITH-NULL-SHA \ |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 250 | TLS-ECDHE-ECDSA-WITH-3DES-EDE-CBC-SHA \ |
| 251 | TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA \ |
| 252 | TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA \ |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 253 | " |
Joe Subbiani | 15d7124 | 2021-07-26 12:20:00 +0100 | [diff] [blame^] | 254 | M_CIPHERS="$M_CIPHERS $CIPHERS" |
| 255 | |
| 256 | G=`python3 translate_ciphers.py g "$CIPHERS"` |
| 257 | G_CIPHERS="$G_CIPHERS $G" |
| 258 | |
| 259 | O=`python3 translate_ciphers.py o "$CIPHERS"` |
| 260 | O_CIPHERS="$O_CIPHERS $O" |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 261 | fi |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 262 | if [ `minor_ver "$MODE"` -ge 3 ] |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 263 | then |
Joe Subbiani | 15d7124 | 2021-07-26 12:20:00 +0100 | [diff] [blame^] | 264 | CIPHERS="TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256 \ |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 265 | TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA384 \ |
| 266 | TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256 \ |
| 267 | TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384 \ |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 268 | " |
Joe Subbiani | 15d7124 | 2021-07-26 12:20:00 +0100 | [diff] [blame^] | 269 | M_CIPHERS="$M_CIPHERS $CIPHERS" |
| 270 | |
| 271 | G=`python3 translate_ciphers.py g "$CIPHERS"` |
| 272 | G_CIPHERS="$G_CIPHERS $G" |
| 273 | |
| 274 | O=`python3 translate_ciphers.py o "$CIPHERS"` |
| 275 | O_CIPHERS="$O_CIPHERS $O" |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 276 | fi |
| 277 | ;; |
| 278 | |
| 279 | "RSA") |
Joe Subbiani | 15d7124 | 2021-07-26 12:20:00 +0100 | [diff] [blame^] | 280 | CIPHERS="TLS-DHE-RSA-WITH-AES-128-CBC-SHA \ |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 281 | TLS-DHE-RSA-WITH-AES-256-CBC-SHA \ |
| 282 | TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA \ |
| 283 | TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA \ |
| 284 | TLS-DHE-RSA-WITH-3DES-EDE-CBC-SHA \ |
| 285 | TLS-RSA-WITH-AES-256-CBC-SHA \ |
| 286 | TLS-RSA-WITH-CAMELLIA-256-CBC-SHA \ |
| 287 | TLS-RSA-WITH-AES-128-CBC-SHA \ |
| 288 | TLS-RSA-WITH-CAMELLIA-128-CBC-SHA \ |
| 289 | TLS-RSA-WITH-3DES-EDE-CBC-SHA \ |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 290 | TLS-RSA-WITH-NULL-MD5 \ |
| 291 | TLS-RSA-WITH-NULL-SHA \ |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 292 | " |
Joe Subbiani | 15d7124 | 2021-07-26 12:20:00 +0100 | [diff] [blame^] | 293 | M_CIPHERS="$M_CIPHERS $CIPHERS" |
| 294 | |
| 295 | G=`python3 translate_ciphers.py g "$CIPHERS"` |
| 296 | G_CIPHERS="$G_CIPHERS $G" |
| 297 | |
| 298 | O=`python3 translate_ciphers.py o "$CIPHERS"` |
| 299 | O_CIPHERS="$O_CIPHERS $O" |
| 300 | |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 301 | if [ `minor_ver "$MODE"` -gt 0 ] |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 302 | then |
Joe Subbiani | 15d7124 | 2021-07-26 12:20:00 +0100 | [diff] [blame^] | 303 | CIPHERS="TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA \ |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 304 | TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA \ |
| 305 | TLS-ECDHE-RSA-WITH-3DES-EDE-CBC-SHA \ |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 306 | TLS-ECDHE-RSA-WITH-NULL-SHA \ |
| 307 | " |
Joe Subbiani | 15d7124 | 2021-07-26 12:20:00 +0100 | [diff] [blame^] | 308 | M_CIPHERS="$M_CIPHERS $CIPHERS" |
| 309 | |
| 310 | G=`python3 translate_ciphers.py g "$CIPHERS"` |
| 311 | G_CIPHERS="$G_CIPHERS $G" |
| 312 | |
| 313 | O=`python3 translate_ciphers.py o "$CIPHERS"` |
| 314 | O_CIPHERS="$O_CIPHERS $O" |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 315 | fi |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 316 | if [ `minor_ver "$MODE"` -ge 3 ] |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 317 | then |
Joe Subbiani | 15d7124 | 2021-07-26 12:20:00 +0100 | [diff] [blame^] | 318 | CIPHERS="TLS-RSA-WITH-AES-128-CBC-SHA256 \ |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 319 | TLS-DHE-RSA-WITH-AES-128-CBC-SHA256 \ |
| 320 | TLS-RSA-WITH-AES-256-CBC-SHA256 \ |
| 321 | TLS-DHE-RSA-WITH-AES-256-CBC-SHA256 \ |
| 322 | TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA256 \ |
| 323 | TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384 \ |
| 324 | TLS-RSA-WITH-AES-128-GCM-SHA256 \ |
| 325 | TLS-RSA-WITH-AES-256-GCM-SHA384 \ |
| 326 | TLS-DHE-RSA-WITH-AES-128-GCM-SHA256 \ |
| 327 | TLS-DHE-RSA-WITH-AES-256-GCM-SHA384 \ |
| 328 | TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256 \ |
| 329 | TLS-ECDHE-RSA-WITH-AES-256-GCM-SHA384 \ |
| 330 | " |
Joe Subbiani | 15d7124 | 2021-07-26 12:20:00 +0100 | [diff] [blame^] | 331 | M_CIPHERS="$M_CIPHERS $CIPHERS" |
| 332 | |
| 333 | G=`python3 translate_ciphers.py g "$CIPHERS"` |
| 334 | G_CIPHERS="$G_CIPHERS $G" |
| 335 | |
| 336 | O=`python3 translate_ciphers.py o "$CIPHERS"` |
| 337 | O_CIPHERS="$O_CIPHERS NULL-SHA256 $O" |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 338 | fi |
| 339 | ;; |
| 340 | |
| 341 | "PSK") |
Joe Subbiani | 15d7124 | 2021-07-26 12:20:00 +0100 | [diff] [blame^] | 342 | CIPHERS="TLS-PSK-WITH-3DES-EDE-CBC-SH \ |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 343 | TLS-PSK-WITH-AES-128-CBC-SHA \ |
| 344 | TLS-PSK-WITH-AES-256-CBC-SHA \ |
| 345 | " |
Joe Subbiani | 15d7124 | 2021-07-26 12:20:00 +0100 | [diff] [blame^] | 346 | M_CIPHERS="$M_CIPHERS $CIPHERS" |
| 347 | |
| 348 | G=`python3 translate_ciphers.py g "$CIPHERS"` |
| 349 | G_CIPHERS="$G_CIPHERS $G" |
| 350 | |
| 351 | O=`python3 translate_ciphers.py o "$CIPHERS"` |
| 352 | O_CIPHERS="$O_CIPHERS $O" |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 353 | ;; |
| 354 | esac |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 355 | } |
| 356 | |
Manuel Pégourié-Gonnard | 7299dfd | 2018-02-15 11:43:55 +0100 | [diff] [blame] | 357 | # Ciphersuites usable only with Mbed TLS and OpenSSL |
| 358 | # Each ciphersuite should appear two times, once with its OpenSSL name, once |
| 359 | # with its Mbed TLS name. |
| 360 | # |
| 361 | # 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] | 362 | # so RSA-PSK ciphersuites need to go in other sections, see |
| 363 | # https://github.com/ARMmbed/mbedtls/issues/1419 |
Manuel Pégourié-Gonnard | 9fece7e | 2018-06-18 11:38:22 +0200 | [diff] [blame] | 364 | # |
| 365 | # ChachaPoly suites are here rather than in "common", as they were added in |
| 366 | # 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] | 367 | add_openssl_ciphersuites() |
| 368 | { |
| 369 | case $TYPE in |
| 370 | |
| 371 | "ECDSA") |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 372 | if [ `minor_ver "$MODE"` -gt 0 ] |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 373 | then |
Joe Subbiani | 15d7124 | 2021-07-26 12:20:00 +0100 | [diff] [blame^] | 374 | CIPHERS="TLS-ECDH-ECDSA-WITH-NULL-SHA \ |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 375 | TLS-ECDH-ECDSA-WITH-3DES-EDE-CBC-SHA \ |
| 376 | TLS-ECDH-ECDSA-WITH-AES-128-CBC-SHA \ |
| 377 | TLS-ECDH-ECDSA-WITH-AES-256-CBC-SHA \ |
| 378 | " |
Joe Subbiani | 15d7124 | 2021-07-26 12:20:00 +0100 | [diff] [blame^] | 379 | M_CIPHERS="$M_CIPHERS $CIPHERS" |
| 380 | |
| 381 | O=`python3 translate_ciphers.py o "$CIPHERS"` |
| 382 | O_CIPHERS="$O_CIPHERS $O" |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 383 | fi |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 384 | if [ `minor_ver "$MODE"` -ge 3 ] |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 385 | then |
Joe Subbiani | 15d7124 | 2021-07-26 12:20:00 +0100 | [diff] [blame^] | 386 | CIPHERS="TLS-ECDH-ECDSA-WITH-AES-128-CBC-SHA256 \ |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 387 | TLS-ECDH-ECDSA-WITH-AES-256-CBC-SHA384 \ |
| 388 | TLS-ECDH-ECDSA-WITH-AES-128-GCM-SHA256 \ |
| 389 | TLS-ECDH-ECDSA-WITH-AES-256-GCM-SHA384 \ |
Manuel Pégourié-Gonnard | 7299dfd | 2018-02-15 11:43:55 +0100 | [diff] [blame] | 390 | TLS-ECDHE-ECDSA-WITH-ARIA-256-GCM-SHA384 \ |
| 391 | TLS-ECDHE-ECDSA-WITH-ARIA-128-GCM-SHA256 \ |
Manuel Pégourié-Gonnard | 9fece7e | 2018-06-18 11:38:22 +0200 | [diff] [blame] | 392 | TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256 \ |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 393 | " |
Joe Subbiani | 15d7124 | 2021-07-26 12:20:00 +0100 | [diff] [blame^] | 394 | M_CIPHERS="$M_CIPHERS $CIPHERS" |
| 395 | |
| 396 | O=`python3 translate_ciphers.py o "$CIPHERS"` |
| 397 | O_CIPHERS="$O_CIPHERS $O" |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 398 | fi |
| 399 | ;; |
| 400 | |
| 401 | "RSA") |
Joe Subbiani | 15d7124 | 2021-07-26 12:20:00 +0100 | [diff] [blame^] | 402 | CIPHERS="TLS-RSA-WITH-DES-CBC-SHA \ |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 403 | TLS-DHE-RSA-WITH-DES-CBC-SHA \ |
| 404 | " |
Joe Subbiani | 15d7124 | 2021-07-26 12:20:00 +0100 | [diff] [blame^] | 405 | M_CIPHERS="$M_CIPHERS $CIPHERS" |
| 406 | |
| 407 | O=`python3 translate_ciphers.py o "$CIPHERS"` |
| 408 | O_CIPHERS="$O_CIPHERS $O" |
| 409 | |
Manuel Pégourié-Gonnard | 7299dfd | 2018-02-15 11:43:55 +0100 | [diff] [blame] | 410 | if [ `minor_ver "$MODE"` -ge 3 ] |
| 411 | then |
Joe Subbiani | 15d7124 | 2021-07-26 12:20:00 +0100 | [diff] [blame^] | 412 | CIPHERS="TLS-ECDHE-RSA-WITH-ARIA-256-GCM-SHA384 \ |
Manuel Pégourié-Gonnard | 7299dfd | 2018-02-15 11:43:55 +0100 | [diff] [blame] | 413 | TLS-DHE-RSA-WITH-ARIA-256-GCM-SHA384 \ |
Manuel Pégourié-Gonnard | bba6406 | 2018-02-20 11:58:44 +0100 | [diff] [blame] | 414 | TLS-RSA-WITH-ARIA-256-GCM-SHA384 \ |
Manuel Pégourié-Gonnard | 7299dfd | 2018-02-15 11:43:55 +0100 | [diff] [blame] | 415 | TLS-ECDHE-RSA-WITH-ARIA-128-GCM-SHA256 \ |
| 416 | TLS-DHE-RSA-WITH-ARIA-128-GCM-SHA256 \ |
Manuel Pégourié-Gonnard | bba6406 | 2018-02-20 11:58:44 +0100 | [diff] [blame] | 417 | TLS-RSA-WITH-ARIA-128-GCM-SHA256 \ |
Manuel Pégourié-Gonnard | 9fece7e | 2018-06-18 11:38:22 +0200 | [diff] [blame] | 418 | TLS-DHE-RSA-WITH-CHACHA20-POLY1305-SHA256 \ |
| 419 | TLS-ECDHE-RSA-WITH-CHACHA20-POLY1305-SHA256 \ |
Manuel Pégourié-Gonnard | 7299dfd | 2018-02-15 11:43:55 +0100 | [diff] [blame] | 420 | " |
Joe Subbiani | 15d7124 | 2021-07-26 12:20:00 +0100 | [diff] [blame^] | 421 | M_CIPHERS="$M_CIPHERS $CIPHERS" |
| 422 | |
| 423 | O=`python3 translate_ciphers.py o "$CIPHERS"` |
| 424 | O_CIPHERS="$O_CIPHERS $O" |
Manuel Pégourié-Gonnard | 7299dfd | 2018-02-15 11:43:55 +0100 | [diff] [blame] | 425 | fi |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 426 | ;; |
| 427 | |
| 428 | "PSK") |
Manuel Pégourié-Gonnard | 7299dfd | 2018-02-15 11:43:55 +0100 | [diff] [blame] | 429 | if [ `minor_ver "$MODE"` -ge 3 ] |
| 430 | then |
Joe Subbiani | 15d7124 | 2021-07-26 12:20:00 +0100 | [diff] [blame^] | 431 | CIPHERS="TLS-DHE-PSK-WITH-ARIA-256-GCM-SHA384 \ |
Manuel Pégourié-Gonnard | bba6406 | 2018-02-20 11:58:44 +0100 | [diff] [blame] | 432 | TLS-DHE-PSK-WITH-ARIA-128-GCM-SHA256 \ |
Manuel Pégourié-Gonnard | 7299dfd | 2018-02-15 11:43:55 +0100 | [diff] [blame] | 433 | TLS-PSK-WITH-ARIA-256-GCM-SHA384 \ |
| 434 | TLS-PSK-WITH-ARIA-128-GCM-SHA256 \ |
Manuel Pégourié-Gonnard | 9fece7e | 2018-06-18 11:38:22 +0200 | [diff] [blame] | 435 | TLS-PSK-WITH-CHACHA20-POLY1305-SHA256 \ |
| 436 | TLS-ECDHE-PSK-WITH-CHACHA20-POLY1305-SHA256 \ |
| 437 | TLS-DHE-PSK-WITH-CHACHA20-POLY1305-SHA256 \ |
Manuel Pégourié-Gonnard | 7299dfd | 2018-02-15 11:43:55 +0100 | [diff] [blame] | 438 | " |
Joe Subbiani | 15d7124 | 2021-07-26 12:20:00 +0100 | [diff] [blame^] | 439 | M_CIPHERS="$M_CIPHERS $CIPHERS" |
| 440 | |
| 441 | O=`python3 translate_ciphers.py o "$CIPHERS"` |
| 442 | O_CIPHERS="$O_CIPHERS $O" |
Manuel Pégourié-Gonnard | 7299dfd | 2018-02-15 11:43:55 +0100 | [diff] [blame] | 443 | fi |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 444 | ;; |
| 445 | esac |
| 446 | } |
| 447 | |
Manuel Pégourié-Gonnard | 7299dfd | 2018-02-15 11:43:55 +0100 | [diff] [blame] | 448 | # Ciphersuites usable only with Mbed TLS and GnuTLS |
| 449 | # Each ciphersuite should appear two times, once with its GnuTLS name, once |
| 450 | # with its Mbed TLS name. |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 451 | add_gnutls_ciphersuites() |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 452 | { |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 453 | case $TYPE in |
| 454 | |
| 455 | "ECDSA") |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 456 | if [ `minor_ver "$MODE"` -ge 3 ] |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 457 | then |
Joe Subbiani | 15d7124 | 2021-07-26 12:20:00 +0100 | [diff] [blame^] | 458 | CIPHERS="TLS-ECDHE-ECDSA-WITH-CAMELLIA-128-CBC-SHA256 \ |
| 459 | TLS-ECDHE-ECDSA-WITH-CAMELLIA-256-CBC-SHA384 \ |
| 460 | TLS-ECDHE-ECDSA-WITH-CAMELLIA-128-GCM-SHA256 \ |
| 461 | TLS-ECDHE-ECDSA-WITH-CAMELLIA-256-GCM-SHA384 \ |
| 462 | TLS-ECDHE-ECDSA-WITH-AES-128-CCM \ |
| 463 | TLS-ECDHE-ECDSA-WITH-AES-256-CCM \ |
| 464 | TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8 \ |
| 465 | TLS-ECDHE-ECDSA-WITH-AES-256-CCM-8 \ |
Manuel Pégourié-Gonnard | a437144 | 2014-03-13 16:21:59 +0100 | [diff] [blame] | 466 | " |
Joe Subbiani | 15d7124 | 2021-07-26 12:20:00 +0100 | [diff] [blame^] | 467 | M_CIPHERS="$M_CIPHERS $CIPHERS" |
| 468 | |
| 469 | G=`python3 translate_ciphers.py g "$CIPHERS"` |
| 470 | G_CIPHERS="$G_CIPHERS $G" |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 471 | fi |
| 472 | ;; |
| 473 | |
| 474 | "RSA") |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 475 | if [ `minor_ver "$MODE"` -gt 0 ] |
Manuel Pégourié-Gonnard | 7457cb3 | 2014-07-13 13:57:24 +0200 | [diff] [blame] | 476 | then |
Joe Subbiani | 15d7124 | 2021-07-26 12:20:00 +0100 | [diff] [blame^] | 477 | CIPHERS="TLS-RSA-WITH-NULL-SHA256" |
| 478 | M_CIPHERS="$M_CIPHERS $CIPHERS" |
| 479 | |
| 480 | G=`python3 translate_ciphers.py g "$CIPHERS"` |
| 481 | G_CIPHERS="$G_CIPHERS $G" |
Manuel Pégourié-Gonnard | 7457cb3 | 2014-07-13 13:57:24 +0200 | [diff] [blame] | 482 | fi |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 483 | if [ `minor_ver "$MODE"` -ge 3 ] |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 484 | then |
Joe Subbiani | 15d7124 | 2021-07-26 12:20:00 +0100 | [diff] [blame^] | 485 | CIPHERS="TLS-ECDHE-RSA-WITH-CAMELLIA-128-CBC-SHA256 \ |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 486 | TLS-ECDHE-RSA-WITH-CAMELLIA-256-CBC-SHA384 \ |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 487 | TLS-RSA-WITH-CAMELLIA-128-CBC-SHA256 \ |
| 488 | TLS-RSA-WITH-CAMELLIA-256-CBC-SHA256 \ |
| 489 | TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA256 \ |
| 490 | TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA256 \ |
| 491 | TLS-ECDHE-RSA-WITH-CAMELLIA-128-GCM-SHA256 \ |
| 492 | TLS-ECDHE-RSA-WITH-CAMELLIA-256-GCM-SHA384 \ |
| 493 | TLS-DHE-RSA-WITH-CAMELLIA-128-GCM-SHA256 \ |
| 494 | TLS-DHE-RSA-WITH-CAMELLIA-256-GCM-SHA384 \ |
| 495 | TLS-RSA-WITH-CAMELLIA-128-GCM-SHA256 \ |
| 496 | TLS-RSA-WITH-CAMELLIA-256-GCM-SHA384 \ |
Manuel Pégourié-Gonnard | c36b432 | 2018-06-14 13:14:29 +0200 | [diff] [blame] | 497 | TLS-RSA-WITH-AES-128-CCM \ |
| 498 | TLS-RSA-WITH-AES-256-CCM \ |
| 499 | TLS-DHE-RSA-WITH-AES-128-CCM \ |
| 500 | TLS-DHE-RSA-WITH-AES-256-CCM \ |
| 501 | TLS-RSA-WITH-AES-128-CCM-8 \ |
| 502 | TLS-RSA-WITH-AES-256-CCM-8 \ |
| 503 | TLS-DHE-RSA-WITH-AES-128-CCM-8 \ |
| 504 | TLS-DHE-RSA-WITH-AES-256-CCM-8 \ |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 505 | " |
Joe Subbiani | 15d7124 | 2021-07-26 12:20:00 +0100 | [diff] [blame^] | 506 | M_CIPHERS="$M_CIPHERS $CIPHERS" |
| 507 | |
| 508 | G=`python3 translate_ciphers.py g "$CIPHERS"` |
| 509 | G_CIPHERS="$G_CIPHERS $G" |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 510 | fi |
| 511 | ;; |
| 512 | |
| 513 | "PSK") |
Joe Subbiani | 15d7124 | 2021-07-26 12:20:00 +0100 | [diff] [blame^] | 514 | CIPHERS="TLS-DHE-PSK-WITH-3DES-EDE-CBC-SHA \ |
Manuel Pégourié-Gonnard | e46aa5e | 2014-07-13 15:44:19 +0200 | [diff] [blame] | 515 | TLS-DHE-PSK-WITH-AES-128-CBC-SHA \ |
| 516 | TLS-DHE-PSK-WITH-AES-256-CBC-SHA \ |
Manuel Pégourié-Gonnard | e46aa5e | 2014-07-13 15:44:19 +0200 | [diff] [blame] | 517 | " |
Joe Subbiani | 15d7124 | 2021-07-26 12:20:00 +0100 | [diff] [blame^] | 518 | M_CIPHERS="$M_CIPHERS $CIPHERS" |
| 519 | |
| 520 | G=`python3 translate_ciphers.py g "$CIPHERS"` |
| 521 | G_CIPHERS="$G_CIPHERS $G" |
| 522 | |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 523 | if [ `minor_ver "$MODE"` -gt 0 ] |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 524 | then |
Joe Subbiani | 15d7124 | 2021-07-26 12:20:00 +0100 | [diff] [blame^] | 525 | CIPHERS="TLS-ECDHE-PSK-WITH-AES-256-CBC-SHA \ |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 526 | TLS-ECDHE-PSK-WITH-AES-128-CBC-SHA \ |
| 527 | TLS-ECDHE-PSK-WITH-3DES-EDE-CBC-SHA \ |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 528 | TLS-RSA-PSK-WITH-3DES-EDE-CBC-SHA \ |
| 529 | TLS-RSA-PSK-WITH-AES-256-CBC-SHA \ |
| 530 | TLS-RSA-PSK-WITH-AES-128-CBC-SHA \ |
Manuel Pégourié-Gonnard | a437144 | 2014-03-13 16:21:59 +0100 | [diff] [blame] | 531 | " |
Joe Subbiani | 15d7124 | 2021-07-26 12:20:00 +0100 | [diff] [blame^] | 532 | M_CIPHERS="$M_CIPHERS $CIPHERS" |
| 533 | |
| 534 | G=`python3 translate_ciphers.py g "$CIPHERS"` |
| 535 | G_CIPHERS="$G_CIPHERS $G" |
| 536 | |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 537 | fi |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 538 | if [ `minor_ver "$MODE"` -ge 3 ] |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 539 | then |
Joe Subbiani | 15d7124 | 2021-07-26 12:20:00 +0100 | [diff] [blame^] | 540 | CIPHERS="TLS-ECDHE-PSK-WITH-AES-256-CBC-SHA384 \ |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 541 | TLS-ECDHE-PSK-WITH-CAMELLIA-256-CBC-SHA384 \ |
| 542 | TLS-ECDHE-PSK-WITH-AES-128-CBC-SHA256 \ |
| 543 | TLS-ECDHE-PSK-WITH-CAMELLIA-128-CBC-SHA256 \ |
| 544 | TLS-ECDHE-PSK-WITH-NULL-SHA384 \ |
| 545 | TLS-ECDHE-PSK-WITH-NULL-SHA256 \ |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 546 | TLS-PSK-WITH-AES-128-CBC-SHA256 \ |
| 547 | TLS-PSK-WITH-AES-256-CBC-SHA384 \ |
| 548 | TLS-DHE-PSK-WITH-AES-128-CBC-SHA256 \ |
| 549 | TLS-DHE-PSK-WITH-AES-256-CBC-SHA384 \ |
| 550 | TLS-PSK-WITH-NULL-SHA256 \ |
| 551 | TLS-PSK-WITH-NULL-SHA384 \ |
| 552 | TLS-DHE-PSK-WITH-NULL-SHA256 \ |
| 553 | TLS-DHE-PSK-WITH-NULL-SHA384 \ |
| 554 | TLS-RSA-PSK-WITH-AES-256-CBC-SHA384 \ |
| 555 | TLS-RSA-PSK-WITH-AES-128-CBC-SHA256 \ |
| 556 | TLS-RSA-PSK-WITH-NULL-SHA256 \ |
| 557 | TLS-RSA-PSK-WITH-NULL-SHA384 \ |
| 558 | TLS-DHE-PSK-WITH-CAMELLIA-128-CBC-SHA256 \ |
| 559 | TLS-DHE-PSK-WITH-CAMELLIA-256-CBC-SHA384 \ |
| 560 | TLS-PSK-WITH-CAMELLIA-128-CBC-SHA256 \ |
| 561 | TLS-PSK-WITH-CAMELLIA-256-CBC-SHA384 \ |
| 562 | TLS-RSA-PSK-WITH-CAMELLIA-256-CBC-SHA384 \ |
| 563 | TLS-RSA-PSK-WITH-CAMELLIA-128-CBC-SHA256 \ |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 564 | TLS-PSK-WITH-AES-128-GCM-SHA256 \ |
| 565 | TLS-PSK-WITH-AES-256-GCM-SHA384 \ |
| 566 | TLS-DHE-PSK-WITH-AES-128-GCM-SHA256 \ |
| 567 | TLS-DHE-PSK-WITH-AES-256-GCM-SHA384 \ |
Manuel Pégourié-Gonnard | c36b432 | 2018-06-14 13:14:29 +0200 | [diff] [blame] | 568 | TLS-PSK-WITH-AES-128-CCM \ |
| 569 | TLS-PSK-WITH-AES-256-CCM \ |
| 570 | TLS-DHE-PSK-WITH-AES-128-CCM \ |
| 571 | TLS-DHE-PSK-WITH-AES-256-CCM \ |
| 572 | TLS-PSK-WITH-AES-128-CCM-8 \ |
| 573 | TLS-PSK-WITH-AES-256-CCM-8 \ |
| 574 | TLS-DHE-PSK-WITH-AES-128-CCM-8 \ |
| 575 | TLS-DHE-PSK-WITH-AES-256-CCM-8 \ |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 576 | TLS-RSA-PSK-WITH-CAMELLIA-128-GCM-SHA256 \ |
| 577 | TLS-RSA-PSK-WITH-CAMELLIA-256-GCM-SHA384 \ |
| 578 | TLS-PSK-WITH-CAMELLIA-128-GCM-SHA256 \ |
| 579 | TLS-PSK-WITH-CAMELLIA-256-GCM-SHA384 \ |
| 580 | TLS-DHE-PSK-WITH-CAMELLIA-128-GCM-SHA256 \ |
| 581 | TLS-DHE-PSK-WITH-CAMELLIA-256-GCM-SHA384 \ |
| 582 | TLS-RSA-PSK-WITH-AES-256-GCM-SHA384 \ |
| 583 | TLS-RSA-PSK-WITH-AES-128-GCM-SHA256 \ |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 584 | " |
Joe Subbiani | 15d7124 | 2021-07-26 12:20:00 +0100 | [diff] [blame^] | 585 | M_CIPHERS="$M_CIPHERS $CIPHERS" |
| 586 | |
| 587 | G=`python3 translate_ciphers.py g "$CIPHERS"` |
| 588 | G_CIPHERS="$G_CIPHERS $G" |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 589 | fi |
| 590 | ;; |
| 591 | esac |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 592 | } |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 593 | |
Manuel Pégourié-Gonnard | 7299dfd | 2018-02-15 11:43:55 +0100 | [diff] [blame] | 594 | # Ciphersuites usable only with Mbed TLS (not currently supported by another |
| 595 | # peer usable in this script). This provide only very rudimentaty testing, as |
| 596 | # 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] | 597 | add_mbedtls_ciphersuites() |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 598 | { |
| 599 | case $TYPE in |
| 600 | |
| 601 | "ECDSA") |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 602 | if [ `minor_ver "$MODE"` -gt 0 ] |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 603 | then |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 604 | M_CIPHERS="$M_CIPHERS \ |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 605 | TLS-ECDH-ECDSA-WITH-CAMELLIA-128-CBC-SHA256 \ |
| 606 | TLS-ECDH-ECDSA-WITH-CAMELLIA-256-CBC-SHA384 \ |
| 607 | " |
| 608 | fi |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 609 | if [ `minor_ver "$MODE"` -ge 3 ] |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 610 | then |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 611 | M_CIPHERS="$M_CIPHERS \ |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 612 | TLS-ECDH-ECDSA-WITH-CAMELLIA-128-GCM-SHA256 \ |
| 613 | TLS-ECDH-ECDSA-WITH-CAMELLIA-256-GCM-SHA384 \ |
Manuel Pégourié-Gonnard | a0e4708 | 2018-02-15 11:07:58 +0100 | [diff] [blame] | 614 | TLS-ECDHE-ECDSA-WITH-ARIA-256-CBC-SHA384 \ |
Manuel Pégourié-Gonnard | a0e4708 | 2018-02-15 11:07:58 +0100 | [diff] [blame] | 615 | TLS-ECDHE-ECDSA-WITH-ARIA-128-CBC-SHA256 \ |
Manuel Pégourié-Gonnard | bba6406 | 2018-02-20 11:58:44 +0100 | [diff] [blame] | 616 | TLS-ECDH-ECDSA-WITH-ARIA-256-GCM-SHA384 \ |
| 617 | TLS-ECDH-ECDSA-WITH-ARIA-128-GCM-SHA256 \ |
| 618 | TLS-ECDH-ECDSA-WITH-ARIA-256-CBC-SHA384 \ |
| 619 | TLS-ECDH-ECDSA-WITH-ARIA-128-CBC-SHA256 \ |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 620 | " |
| 621 | fi |
| 622 | ;; |
| 623 | |
| 624 | "RSA") |
Manuel Pégourié-Gonnard | 392c2d2 | 2018-02-15 11:06:14 +0100 | [diff] [blame] | 625 | if [ `minor_ver "$MODE"` -ge 3 ] |
Manuel Pégourié-Gonnard | 2594859 | 2014-05-22 14:36:02 +0200 | [diff] [blame] | 626 | then |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 627 | M_CIPHERS="$M_CIPHERS \ |
Manuel Pégourié-Gonnard | a0e4708 | 2018-02-15 11:07:58 +0100 | [diff] [blame] | 628 | TLS-ECDHE-RSA-WITH-ARIA-256-CBC-SHA384 \ |
| 629 | TLS-DHE-RSA-WITH-ARIA-256-CBC-SHA384 \ |
Manuel Pégourié-Gonnard | a0e4708 | 2018-02-15 11:07:58 +0100 | [diff] [blame] | 630 | TLS-ECDHE-RSA-WITH-ARIA-128-CBC-SHA256 \ |
| 631 | TLS-DHE-RSA-WITH-ARIA-128-CBC-SHA256 \ |
Manuel Pégourié-Gonnard | bba6406 | 2018-02-20 11:58:44 +0100 | [diff] [blame] | 632 | TLS-RSA-WITH-ARIA-256-CBC-SHA384 \ |
| 633 | TLS-RSA-WITH-ARIA-128-CBC-SHA256 \ |
Manuel Pégourié-Gonnard | 2594859 | 2014-05-22 14:36:02 +0200 | [diff] [blame] | 634 | " |
| 635 | fi |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 636 | ;; |
| 637 | |
| 638 | "PSK") |
Manuel Pégourié-Gonnard | 7eb58cb | 2015-07-07 11:54:14 +0200 | [diff] [blame] | 639 | # *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] | 640 | M_CIPHERS="$M_CIPHERS \ |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 641 | TLS-PSK-WITH-NULL-SHA \ |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 642 | TLS-DHE-PSK-WITH-NULL-SHA \ |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 643 | " |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 644 | if [ `minor_ver "$MODE"` -gt 0 ] |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 645 | then |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 646 | M_CIPHERS="$M_CIPHERS \ |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 647 | TLS-ECDHE-PSK-WITH-NULL-SHA \ |
Manuel Pégourié-Gonnard | e46aa5e | 2014-07-13 15:44:19 +0200 | [diff] [blame] | 648 | TLS-RSA-PSK-WITH-NULL-SHA \ |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 649 | " |
| 650 | fi |
Manuel Pégourié-Gonnard | 392c2d2 | 2018-02-15 11:06:14 +0100 | [diff] [blame] | 651 | if [ `minor_ver "$MODE"` -ge 3 ] |
Manuel Pégourié-Gonnard | 2594859 | 2014-05-22 14:36:02 +0200 | [diff] [blame] | 652 | then |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 653 | M_CIPHERS="$M_CIPHERS \ |
Manuel Pégourié-Gonnard | a0e4708 | 2018-02-15 11:07:58 +0100 | [diff] [blame] | 654 | TLS-RSA-PSK-WITH-ARIA-256-CBC-SHA384 \ |
Manuel Pégourié-Gonnard | a0e4708 | 2018-02-15 11:07:58 +0100 | [diff] [blame] | 655 | TLS-RSA-PSK-WITH-ARIA-128-CBC-SHA256 \ |
Manuel Pégourié-Gonnard | a0e4708 | 2018-02-15 11:07:58 +0100 | [diff] [blame] | 656 | TLS-PSK-WITH-ARIA-256-CBC-SHA384 \ |
Manuel Pégourié-Gonnard | a0e4708 | 2018-02-15 11:07:58 +0100 | [diff] [blame] | 657 | TLS-PSK-WITH-ARIA-128-CBC-SHA256 \ |
Manuel Pégourié-Gonnard | 7299dfd | 2018-02-15 11:43:55 +0100 | [diff] [blame] | 658 | TLS-RSA-PSK-WITH-ARIA-256-GCM-SHA384 \ |
| 659 | TLS-RSA-PSK-WITH-ARIA-128-GCM-SHA256 \ |
Manuel Pégourié-Gonnard | bba6406 | 2018-02-20 11:58:44 +0100 | [diff] [blame] | 660 | TLS-ECDHE-PSK-WITH-ARIA-256-CBC-SHA384 \ |
| 661 | TLS-ECDHE-PSK-WITH-ARIA-128-CBC-SHA256 \ |
| 662 | TLS-DHE-PSK-WITH-ARIA-256-CBC-SHA384 \ |
| 663 | TLS-DHE-PSK-WITH-ARIA-128-CBC-SHA256 \ |
Manuel Pégourié-Gonnard | 9fece7e | 2018-06-18 11:38:22 +0200 | [diff] [blame] | 664 | TLS-RSA-PSK-WITH-CHACHA20-POLY1305-SHA256 \ |
Manuel Pégourié-Gonnard | 2594859 | 2014-05-22 14:36:02 +0200 | [diff] [blame] | 665 | " |
| 666 | fi |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 667 | ;; |
| 668 | esac |
Manuel Pégourié-Gonnard | 48f196c | 2014-02-19 13:51:58 +0100 | [diff] [blame] | 669 | } |
| 670 | |
Manuel Pégourié-Gonnard | d941a79 | 2014-02-19 13:35:52 +0100 | [diff] [blame] | 671 | setup_arguments() |
| 672 | { |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 673 | G_MODE="" |
| 674 | case "$MODE" in |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 675 | "tls1_2") |
| 676 | G_PRIO_MODE="+VERS-TLS1.2" |
Manuel Pégourié-Gonnard | 9ada01a | 2014-02-19 14:24:24 +0100 | [diff] [blame] | 677 | ;; |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 678 | "dtls1_2") |
| 679 | G_PRIO_MODE="+VERS-DTLS1.2" |
Manuel Pégourié-Gonnard | 3679519 | 2014-09-26 16:33:45 +0200 | [diff] [blame] | 680 | G_MODE="-u" |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 681 | ;; |
Manuel Pégourié-Gonnard | 9ada01a | 2014-02-19 14:24:24 +0100 | [diff] [blame] | 682 | *) |
| 683 | echo "error: invalid mode: $MODE" >&2 |
| 684 | exit 1; |
| 685 | esac |
| 686 | |
Manuel Pégourié-Gonnard | c36b432 | 2018-06-14 13:14:29 +0200 | [diff] [blame] | 687 | # GnuTLS < 3.4 will choke if we try to allow CCM-8 |
| 688 | if [ -z "${GNUTLS_MINOR_LT_FOUR-}" ]; then |
| 689 | G_PRIO_CCM="+AES-256-CCM-8:+AES-128-CCM-8:" |
| 690 | else |
| 691 | G_PRIO_CCM="" |
| 692 | fi |
| 693 | |
Mateusz Starzyk | 5224e29 | 2021-02-22 14:36:29 +0100 | [diff] [blame] | 694 | 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] | 695 | O_SERVER_ARGS="-accept $PORT -cipher NULL,ALL -$MODE" |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 696 | G_SERVER_ARGS="-p $PORT --http $G_MODE" |
Mateusz Starzyk | 5224e29 | 2021-02-22 14:36:29 +0100 | [diff] [blame] | 697 | 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] | 698 | |
Gilles Peskine | 96f5bae | 2021-04-01 14:00:11 +0200 | [diff] [blame] | 699 | # The default prime for `openssl s_server` depends on the version: |
| 700 | # * OpenSSL <= 1.0.2a: 512-bit |
| 701 | # * OpenSSL 1.0.2b to 1.1.1b: 1024-bit |
| 702 | # * OpenSSL >= 1.1.1c: 2048-bit |
| 703 | # Mbed TLS wants >=1024, so force that for older versions. Don't force |
| 704 | # it for newer versions, which reject a 1024-bit prime. Indifferently |
| 705 | # force it or not for intermediate versions. |
| 706 | case $($OPENSSL_CMD version) in |
| 707 | "OpenSSL 1.0"*) |
| 708 | O_SERVER_ARGS="$O_SERVER_ARGS -dhparam data_files/dhparams.pem" |
| 709 | ;; |
| 710 | esac |
| 711 | |
Manuel Pégourié-Gonnard | d1af102 | 2014-07-11 17:01:06 +0200 | [diff] [blame] | 712 | # with OpenSSL 1.0.1h, -www, -WWW and -HTTP break DTLS handshakes |
| 713 | if is_dtls "$MODE"; then |
Manuel Pégourié-Gonnard | 3679519 | 2014-09-26 16:33:45 +0200 | [diff] [blame] | 714 | O_SERVER_ARGS="$O_SERVER_ARGS" |
Manuel Pégourié-Gonnard | d1af102 | 2014-07-11 17:01:06 +0200 | [diff] [blame] | 715 | else |
| 716 | O_SERVER_ARGS="$O_SERVER_ARGS -www" |
| 717 | fi |
| 718 | |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 719 | 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] | 720 | O_CLIENT_ARGS="-connect localhost:$PORT -$MODE" |
Manuel Pégourié-Gonnard | 3025b6c | 2014-03-26 15:30:16 +0100 | [diff] [blame] | 721 | G_CLIENT_ARGS="-p $PORT --debug 3 $G_MODE" |
Manuel Pégourié-Gonnard | a437144 | 2014-03-13 16:21:59 +0100 | [diff] [blame] | 722 | 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] | 723 | |
Manuel Pégourié-Gonnard | d941a79 | 2014-02-19 13:35:52 +0100 | [diff] [blame] | 724 | if [ "X$VERIFY" = "XYES" ]; |
| 725 | then |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 726 | 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] | 727 | 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] | 728 | G_SERVER_ARGS="$G_SERVER_ARGS --x509cafile data_files/test-ca_cat12.crt --require-client-cert" |
| 729 | |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 730 | 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] | 731 | 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] | 732 | 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] | 733 | else |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 734 | # don't request a client cert at all |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 735 | 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] | 736 | G_SERVER_ARGS="$G_SERVER_ARGS --disable-client-cert" |
| 737 | |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 738 | 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] | 739 | O_CLIENT_ARGS="$O_CLIENT_ARGS" |
| 740 | G_CLIENT_ARGS="$G_CLIENT_ARGS --insecure" |
Manuel Pégourié-Gonnard | d941a79 | 2014-02-19 13:35:52 +0100 | [diff] [blame] | 741 | fi |
| 742 | |
| 743 | case $TYPE in |
| 744 | "ECDSA") |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 745 | 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] | 746 | 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] | 747 | G_SERVER_ARGS="$G_SERVER_ARGS --x509certfile data_files/server5.crt --x509keyfile data_files/server5.key" |
| 748 | |
Manuel Pégourié-Gonnard | 1b149ef | 2014-02-27 14:38:29 +0100 | [diff] [blame] | 749 | if [ "X$VERIFY" = "XYES" ]; then |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 750 | 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] | 751 | 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] | 752 | 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] | 753 | else |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 754 | 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] | 755 | fi |
Manuel Pégourié-Gonnard | d941a79 | 2014-02-19 13:35:52 +0100 | [diff] [blame] | 756 | ;; |
| 757 | |
| 758 | "RSA") |
Manuel Pégourié-Gonnard | 499bf4c | 2020-08-21 12:24:32 +0200 | [diff] [blame] | 759 | M_SERVER_ARGS="$M_SERVER_ARGS crt_file=data_files/server2-sha256.crt key_file=data_files/server2.key" |
| 760 | O_SERVER_ARGS="$O_SERVER_ARGS -cert data_files/server2-sha256.crt -key data_files/server2.key" |
| 761 | 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] | 762 | |
Manuel Pégourié-Gonnard | 1b149ef | 2014-02-27 14:38:29 +0100 | [diff] [blame] | 763 | if [ "X$VERIFY" = "XYES" ]; then |
Manuel Pégourié-Gonnard | 499bf4c | 2020-08-21 12:24:32 +0200 | [diff] [blame] | 764 | M_CLIENT_ARGS="$M_CLIENT_ARGS crt_file=data_files/cert_sha256.crt key_file=data_files/server1.key" |
| 765 | O_CLIENT_ARGS="$O_CLIENT_ARGS -cert data_files/cert_sha256.crt -key data_files/server1.key" |
| 766 | 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] | 767 | else |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 768 | 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] | 769 | fi |
Manuel Pégourié-Gonnard | d941a79 | 2014-02-19 13:35:52 +0100 | [diff] [blame] | 770 | ;; |
| 771 | |
| 772 | "PSK") |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 773 | # give RSA-PSK-capable server a RSA cert |
Manuel Pégourié-Gonnard | 1b149ef | 2014-02-27 14:38:29 +0100 | [diff] [blame] | 774 | # (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] | 775 | 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] | 776 | O_SERVER_ARGS="$O_SERVER_ARGS -psk 6162636465666768696a6b6c6d6e6f70 -nocert" |
Manuel Pégourié-Gonnard | 499bf4c | 2020-08-21 12:24:32 +0200 | [diff] [blame] | 777 | 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] | 778 | |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 779 | 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] | 780 | O_CLIENT_ARGS="$O_CLIENT_ARGS -psk 6162636465666768696a6b6c6d6e6f70" |
Manuel Pégourié-Gonnard | a437144 | 2014-03-13 16:21:59 +0100 | [diff] [blame] | 781 | 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] | 782 | ;; |
| 783 | esac |
| 784 | } |
| 785 | |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 786 | # is_mbedtls <cmd_line> |
| 787 | is_mbedtls() { |
Manuel Pégourié-Gonnard | 3eec604 | 2014-02-27 15:37:24 +0100 | [diff] [blame] | 788 | echo "$1" | grep 'ssl_server2\|ssl_client2' > /dev/null |
| 789 | } |
| 790 | |
| 791 | # has_mem_err <log_file_name> |
| 792 | has_mem_err() { |
| 793 | if ( grep -F 'All heap blocks were freed -- no leaks are possible' "$1" && |
| 794 | grep -F 'ERROR SUMMARY: 0 errors from 0 contexts' "$1" ) > /dev/null |
| 795 | then |
| 796 | return 1 # false: does not have errors |
| 797 | else |
| 798 | return 0 # true: has errors |
| 799 | fi |
| 800 | } |
| 801 | |
Gilles Peskine | 12c49c7 | 2017-12-14 19:02:00 +0100 | [diff] [blame] | 802 | # Wait for process $2 to be listening on port $1 |
| 803 | if type lsof >/dev/null 2>/dev/null; then |
| 804 | wait_server_start() { |
| 805 | START_TIME=$(date +%s) |
| 806 | if is_dtls "$MODE"; then |
| 807 | proto=UDP |
| 808 | else |
| 809 | proto=TCP |
| 810 | fi |
| 811 | while ! lsof -a -n -b -i "$proto:$1" -p "$2" >/dev/null 2>/dev/null; do |
| 812 | if [ $(( $(date +%s) - $START_TIME )) -gt $DOG_DELAY ]; then |
| 813 | echo "SERVERSTART TIMEOUT" |
| 814 | echo "SERVERSTART TIMEOUT" >> $SRV_OUT |
| 815 | break |
| 816 | fi |
| 817 | # Linux and *BSD support decimal arguments to sleep. On other |
| 818 | # OSes this may be a tight loop. |
| 819 | sleep 0.1 2>/dev/null || true |
| 820 | done |
| 821 | } |
| 822 | else |
Gilles Peskine | 3c9e2b5 | 2018-01-08 12:38:15 +0100 | [diff] [blame] | 823 | echo "Warning: lsof not available, wait_server_start = sleep" |
Gilles Peskine | 12c49c7 | 2017-12-14 19:02:00 +0100 | [diff] [blame] | 824 | wait_server_start() { |
Manuel Pégourié-Gonnard | 0d225da | 2018-01-22 10:22:09 +0100 | [diff] [blame] | 825 | sleep 2 |
Gilles Peskine | 12c49c7 | 2017-12-14 19:02:00 +0100 | [diff] [blame] | 826 | } |
| 827 | fi |
| 828 | |
| 829 | |
Manuel Pégourié-Gonnard | 304beef | 2014-02-19 14:45:00 +0100 | [diff] [blame] | 830 | # start_server <name> |
| 831 | # also saves name and command |
| 832 | start_server() { |
Manuel Pégourié-Gonnard | 304beef | 2014-02-19 14:45:00 +0100 | [diff] [blame] | 833 | case $1 in |
| 834 | [Oo]pen*) |
Manuel Pégourié-Gonnard | 74faf3c | 2014-03-13 18:47:44 +0100 | [diff] [blame] | 835 | SERVER_CMD="$OPENSSL_CMD s_server $O_SERVER_ARGS" |
Manuel Pégourié-Gonnard | 304beef | 2014-02-19 14:45:00 +0100 | [diff] [blame] | 836 | ;; |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 837 | [Gg]nu*) |
Manuel Pégourié-Gonnard | 74faf3c | 2014-03-13 18:47:44 +0100 | [diff] [blame] | 838 | 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] | 839 | ;; |
Manuel Pégourié-Gonnard | a8f3b75 | 2015-01-22 17:05:05 +0000 | [diff] [blame] | 840 | mbed*) |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 841 | SERVER_CMD="$M_SRV $M_SERVER_ARGS" |
Manuel Pégourié-Gonnard | 3eec604 | 2014-02-27 15:37:24 +0100 | [diff] [blame] | 842 | if [ "$MEMCHECK" -gt 0 ]; then |
| 843 | SERVER_CMD="valgrind --leak-check=full $SERVER_CMD" |
| 844 | fi |
Manuel Pégourié-Gonnard | 304beef | 2014-02-19 14:45:00 +0100 | [diff] [blame] | 845 | ;; |
| 846 | *) |
| 847 | echo "error: invalid server name: $1" >&2 |
| 848 | exit 1 |
| 849 | ;; |
| 850 | esac |
| 851 | SERVER_NAME=$1 |
| 852 | |
| 853 | log "$SERVER_CMD" |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 854 | echo "$SERVER_CMD" > $SRV_OUT |
Manuel Pégourié-Gonnard | d1af102 | 2014-07-11 17:01:06 +0200 | [diff] [blame] | 855 | # for servers without -www or equivalent |
Manuel Pégourié-Gonnard | 82cf0a1 | 2015-02-09 13:05:54 +0000 | [diff] [blame] | 856 | 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] | 857 | PROCESS_ID=$! |
| 858 | |
Gilles Peskine | 12c49c7 | 2017-12-14 19:02:00 +0100 | [diff] [blame] | 859 | wait_server_start "$PORT" "$PROCESS_ID" |
Manuel Pégourié-Gonnard | 304beef | 2014-02-19 14:45:00 +0100 | [diff] [blame] | 860 | } |
| 861 | |
Manuel Pégourié-Gonnard | 1649449 | 2014-08-31 10:37:14 +0200 | [diff] [blame] | 862 | # terminate the running server |
Manuel Pégourié-Gonnard | 9595771 | 2014-02-19 15:29:38 +0100 | [diff] [blame] | 863 | stop_server() { |
Manuel Pégourié-Gonnard | 74b1170 | 2014-08-14 15:47:33 +0200 | [diff] [blame] | 864 | kill $PROCESS_ID 2>/dev/null |
| 865 | wait $PROCESS_ID 2>/dev/null |
Manuel Pégourié-Gonnard | 3eec604 | 2014-02-27 15:37:24 +0100 | [diff] [blame] | 866 | |
| 867 | if [ "$MEMCHECK" -gt 0 ]; then |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 868 | 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] | 869 | echo " ! Server had memory errors" |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 870 | SRVMEM=$(( $SRVMEM + 1 )) |
Manuel Pégourié-Gonnard | 3eec604 | 2014-02-27 15:37:24 +0100 | [diff] [blame] | 871 | return |
| 872 | fi |
| 873 | fi |
| 874 | |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 875 | rm -f $SRV_OUT |
Manuel Pégourié-Gonnard | 9595771 | 2014-02-19 15:29:38 +0100 | [diff] [blame] | 876 | } |
| 877 | |
Manuel Pégourié-Gonnard | a9062e9 | 2014-02-25 16:21:22 +0100 | [diff] [blame] | 878 | # kill the running server (used when killed by signal) |
| 879 | cleanup() { |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 880 | rm -f $SRV_OUT $CLI_OUT |
Manuel Pégourié-Gonnard | 1649449 | 2014-08-31 10:37:14 +0200 | [diff] [blame] | 881 | kill $PROCESS_ID >/dev/null 2>&1 |
| 882 | kill $WATCHDOG_PID >/dev/null 2>&1 |
Manuel Pégourié-Gonnard | a9062e9 | 2014-02-25 16:21:22 +0100 | [diff] [blame] | 883 | exit 1 |
| 884 | } |
| 885 | |
Manuel Pégourié-Gonnard | c0f6a69 | 2014-08-30 22:41:47 +0200 | [diff] [blame] | 886 | # wait for client to terminate and set EXIT |
| 887 | # must be called right after starting the client |
| 888 | wait_client_done() { |
| 889 | CLI_PID=$! |
| 890 | |
| 891 | ( sleep "$DOG_DELAY"; echo "TIMEOUT" >> $CLI_OUT; kill $CLI_PID ) & |
| 892 | WATCHDOG_PID=$! |
| 893 | |
| 894 | wait $CLI_PID |
| 895 | EXIT=$? |
| 896 | |
| 897 | kill $WATCHDOG_PID |
| 898 | wait $WATCHDOG_PID |
| 899 | |
| 900 | echo "EXIT: $EXIT" >> $CLI_OUT |
| 901 | } |
| 902 | |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 903 | # run_client <name> <cipher> |
| 904 | run_client() { |
Manuel Pégourié-Gonnard | 87ae303 | 2014-02-27 11:12:30 +0100 | [diff] [blame] | 905 | # announce what we're going to do |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 906 | TESTS=$(( $TESTS + 1 )) |
Manuel Pégourié-Gonnard | 87ae303 | 2014-02-27 11:12:30 +0100 | [diff] [blame] | 907 | VERIF=$(echo $VERIFY | tr '[:upper:]' '[:lower:]') |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 908 | TITLE="`echo $1 | head -c1`->`echo $SERVER_NAME | head -c1`" |
| 909 | TITLE="$TITLE $MODE,$VERIF $2" |
Gilles Peskine | 231befa | 2020-08-26 20:05:11 +0200 | [diff] [blame] | 910 | printf "%s " "$TITLE" |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 911 | LEN=$(( 72 - `echo "$TITLE" | wc -c` )) |
Manuel Pégourié-Gonnard | f46f128 | 2014-12-11 11:51:28 +0100 | [diff] [blame] | 912 | for i in `seq 1 $LEN`; do printf '.'; done; printf ' ' |
Manuel Pégourié-Gonnard | 87ae303 | 2014-02-27 11:12:30 +0100 | [diff] [blame] | 913 | |
Manuel Pégourié-Gonnard | 53aef81 | 2014-07-11 17:41:24 +0200 | [diff] [blame] | 914 | # should we skip? |
| 915 | if [ "X$SKIP_NEXT" = "XYES" ]; then |
| 916 | SKIP_NEXT="NO" |
| 917 | echo "SKIP" |
| 918 | SKIPPED=$(( $SKIPPED + 1 )) |
| 919 | return |
| 920 | fi |
| 921 | |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 922 | # run the command and interpret result |
| 923 | case $1 in |
| 924 | [Oo]pen*) |
Manuel Pégourié-Gonnard | 74faf3c | 2014-03-13 18:47:44 +0100 | [diff] [blame] | 925 | 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] | 926 | log "$CLIENT_CMD" |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 927 | echo "$CLIENT_CMD" > $CLI_OUT |
Manuel Pégourié-Gonnard | 9afdc83 | 2015-08-04 17:15:13 +0200 | [diff] [blame] | 928 | 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] | 929 | wait_client_done |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 930 | |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 931 | if [ $EXIT -eq 0 ]; then |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 932 | RESULT=0 |
| 933 | else |
Darryl Green | 11999bb | 2018-03-13 15:22:58 +0000 | [diff] [blame] | 934 | # If the cipher isn't supported... |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 935 | if grep 'Cipher is (NONE)' $CLI_OUT >/dev/null; then |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 936 | RESULT=1 |
| 937 | else |
| 938 | RESULT=2 |
| 939 | fi |
| 940 | fi |
| 941 | ;; |
| 942 | |
Manuel Pégourié-Gonnard | a437144 | 2014-03-13 16:21:59 +0100 | [diff] [blame] | 943 | [Gg]nu*) |
Manuel Pégourié-Gonnard | 29980b1 | 2014-07-10 20:12:56 +0200 | [diff] [blame] | 944 | # need to force IPv4 with UDP, but keep localhost for auth |
| 945 | if is_dtls "$MODE"; then |
| 946 | G_HOST="127.0.0.1" |
| 947 | else |
| 948 | G_HOST="localhost" |
| 949 | fi |
| 950 | 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] | 951 | log "$CLIENT_CMD" |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 952 | echo "$CLIENT_CMD" > $CLI_OUT |
Manuel Pégourié-Gonnard | 9afdc83 | 2015-08-04 17:15:13 +0200 | [diff] [blame] | 953 | 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] | 954 | wait_client_done |
Manuel Pégourié-Gonnard | a437144 | 2014-03-13 16:21:59 +0100 | [diff] [blame] | 955 | |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 956 | if [ $EXIT -eq 0 ]; then |
Manuel Pégourié-Gonnard | a437144 | 2014-03-13 16:21:59 +0100 | [diff] [blame] | 957 | RESULT=0 |
| 958 | else |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 959 | RESULT=2 |
| 960 | # interpret early failure, with a handshake_failure alert |
| 961 | # before the server hello, as "no ciphersuite in common" |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 962 | if grep -F 'Received alert [40]: Handshake failed' $CLI_OUT; then |
| 963 | if grep -i 'SERVER HELLO .* was received' $CLI_OUT; then : |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 964 | else |
| 965 | RESULT=1 |
| 966 | fi |
| 967 | fi >/dev/null |
Manuel Pégourié-Gonnard | a437144 | 2014-03-13 16:21:59 +0100 | [diff] [blame] | 968 | fi |
| 969 | ;; |
| 970 | |
Manuel Pégourié-Gonnard | a8f3b75 | 2015-01-22 17:05:05 +0000 | [diff] [blame] | 971 | mbed*) |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 972 | CLIENT_CMD="$M_CLI $M_CLIENT_ARGS force_ciphersuite=$2" |
Manuel Pégourié-Gonnard | 3eec604 | 2014-02-27 15:37:24 +0100 | [diff] [blame] | 973 | if [ "$MEMCHECK" -gt 0 ]; then |
| 974 | CLIENT_CMD="valgrind --leak-check=full $CLIENT_CMD" |
| 975 | fi |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 976 | log "$CLIENT_CMD" |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 977 | echo "$CLIENT_CMD" > $CLI_OUT |
Manuel Pégourié-Gonnard | c0f6a69 | 2014-08-30 22:41:47 +0200 | [diff] [blame] | 978 | $CLIENT_CMD >> $CLI_OUT 2>&1 & |
| 979 | wait_client_done |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 980 | |
| 981 | case $EXIT in |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 982 | # Success |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 983 | "0") RESULT=0 ;; |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 984 | |
| 985 | # Ciphersuite not supported |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 986 | "2") RESULT=1 ;; |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 987 | |
| 988 | # Error |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 989 | *) RESULT=2 ;; |
| 990 | esac |
Manuel Pégourié-Gonnard | 3eec604 | 2014-02-27 15:37:24 +0100 | [diff] [blame] | 991 | |
| 992 | if [ "$MEMCHECK" -gt 0 ]; then |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 993 | 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] | 994 | RESULT=2 |
| 995 | fi |
| 996 | fi |
| 997 | |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 998 | ;; |
| 999 | |
| 1000 | *) |
| 1001 | echo "error: invalid client name: $1" >&2 |
| 1002 | exit 1 |
| 1003 | ;; |
| 1004 | esac |
| 1005 | |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 1006 | echo "EXIT: $EXIT" >> $CLI_OUT |
Manuel Pégourié-Gonnard | e01af4c | 2014-03-25 14:16:44 +0100 | [diff] [blame] | 1007 | |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 1008 | # report and count result |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 1009 | case $RESULT in |
| 1010 | "0") |
Manuel Pégourié-Gonnard | 4145b89 | 2014-02-24 13:20:14 +0100 | [diff] [blame] | 1011 | echo PASS |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 1012 | ;; |
| 1013 | "1") |
Manuel Pégourié-Gonnard | 4145b89 | 2014-02-24 13:20:14 +0100 | [diff] [blame] | 1014 | echo SKIP |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 1015 | SKIPPED=$(( $SKIPPED + 1 )) |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 1016 | ;; |
| 1017 | "2") |
Manuel Pégourié-Gonnard | 4145b89 | 2014-02-24 13:20:14 +0100 | [diff] [blame] | 1018 | echo FAIL |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 1019 | cp $SRV_OUT c-srv-${TESTS}.log |
| 1020 | cp $CLI_OUT c-cli-${TESTS}.log |
| 1021 | 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] | 1022 | |
Manuel Pégourié-Gonnard | 882148e | 2020-07-27 09:46:53 +0200 | [diff] [blame] | 1023 | if [ "${LOG_FAILURE_ON_STDOUT:-0}" != 0 ]; then |
Manuel Pégourié-Gonnard | 7fa6772 | 2014-08-31 17:42:53 +0200 | [diff] [blame] | 1024 | echo " ! server output:" |
| 1025 | cat c-srv-${TESTS}.log |
| 1026 | echo " ! ===================================================" |
| 1027 | echo " ! client output:" |
| 1028 | cat c-cli-${TESTS}.log |
| 1029 | fi |
| 1030 | |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 1031 | FAILED=$(( $FAILED + 1 )) |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 1032 | ;; |
| 1033 | esac |
Manuel Pégourié-Gonnard | 87ae303 | 2014-02-27 11:12:30 +0100 | [diff] [blame] | 1034 | |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 1035 | rm -f $CLI_OUT |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 1036 | } |
| 1037 | |
Manuel Pégourié-Gonnard | 9dea8bd | 2014-02-26 18:21:02 +0100 | [diff] [blame] | 1038 | # |
| 1039 | # MAIN |
| 1040 | # |
| 1041 | |
Manuel Pégourié-Gonnard | 19db8ea | 2015-03-10 13:41:04 +0000 | [diff] [blame] | 1042 | if cd $( dirname $0 ); then :; else |
| 1043 | echo "cd $( dirname $0 ) failed" >&2 |
| 1044 | exit 1 |
| 1045 | fi |
| 1046 | |
Manuel Pégourié-Gonnard | 3947d04 | 2014-03-14 18:13:53 +0100 | [diff] [blame] | 1047 | get_options "$@" |
| 1048 | |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 1049 | # sanity checks, avoid an avalanche of errors |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 1050 | if [ ! -x "$M_SRV" ]; then |
| 1051 | echo "Command '$M_SRV' is not an executable file" >&2 |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 1052 | exit 1 |
| 1053 | fi |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 1054 | if [ ! -x "$M_CLI" ]; then |
| 1055 | echo "Command '$M_CLI' is not an executable file" >&2 |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 1056 | exit 1 |
| 1057 | fi |
Manuel Pégourié-Gonnard | 3947d04 | 2014-03-14 18:13:53 +0100 | [diff] [blame] | 1058 | |
| 1059 | if echo "$PEERS" | grep -i openssl > /dev/null; then |
| 1060 | if which "$OPENSSL_CMD" >/dev/null 2>&1; then :; else |
| 1061 | echo "Command '$OPENSSL_CMD' not found" >&2 |
Manuel Pégourié-Gonnard | 74faf3c | 2014-03-13 18:47:44 +0100 | [diff] [blame] | 1062 | exit 1 |
| 1063 | fi |
Manuel Pégourié-Gonnard | 3947d04 | 2014-03-14 18:13:53 +0100 | [diff] [blame] | 1064 | fi |
Manuel Pégourié-Gonnard | f7a2690 | 2014-02-27 12:25:54 +0100 | [diff] [blame] | 1065 | |
Manuel Pégourié-Gonnard | 3947d04 | 2014-03-14 18:13:53 +0100 | [diff] [blame] | 1066 | if echo "$PEERS" | grep -i gnutls > /dev/null; then |
| 1067 | for CMD in "$GNUTLS_CLI" "$GNUTLS_SERV"; do |
| 1068 | if which "$CMD" >/dev/null 2>&1; then :; else |
| 1069 | echo "Command '$CMD' not found" >&2 |
| 1070 | exit 1 |
| 1071 | fi |
| 1072 | done |
| 1073 | fi |
| 1074 | |
| 1075 | for PEER in $PEERS; do |
| 1076 | case "$PEER" in |
Manuel Pégourié-Gonnard | a8f3b75 | 2015-01-22 17:05:05 +0000 | [diff] [blame] | 1077 | mbed*|[Oo]pen*|[Gg]nu*) |
Manuel Pégourié-Gonnard | 3947d04 | 2014-03-14 18:13:53 +0100 | [diff] [blame] | 1078 | ;; |
| 1079 | *) |
| 1080 | echo "Unknown peers: $PEER" >&2 |
| 1081 | exit 1 |
| 1082 | esac |
| 1083 | done |
Manuel Pégourié-Gonnard | 9dea8bd | 2014-02-26 18:21:02 +0100 | [diff] [blame] | 1084 | |
Manuel Pégourié-Gonnard | 8066b81 | 2014-05-28 22:59:30 +0200 | [diff] [blame] | 1085 | # Pick a "unique" port in the range 10000-19999. |
| 1086 | PORT="0000$$" |
Manuel Pégourié-Gonnard | fab2a3c | 2014-06-16 16:54:36 +0200 | [diff] [blame] | 1087 | PORT="1$(echo $PORT | tail -c 5)" |
Manuel Pégourié-Gonnard | 8066b81 | 2014-05-28 22:59:30 +0200 | [diff] [blame] | 1088 | |
Manuel Pégourié-Gonnard | bc3b16c | 2014-05-28 23:06:50 +0200 | [diff] [blame] | 1089 | # Also pick a unique name for intermediate files |
| 1090 | SRV_OUT="srv_out.$$" |
| 1091 | CLI_OUT="cli_out.$$" |
| 1092 | |
Manuel Pégourié-Gonnard | c0f6a69 | 2014-08-30 22:41:47 +0200 | [diff] [blame] | 1093 | # client timeout delay: be more patient with valgrind |
| 1094 | if [ "$MEMCHECK" -gt 0 ]; then |
| 1095 | DOG_DELAY=30 |
| 1096 | else |
| 1097 | DOG_DELAY=10 |
| 1098 | fi |
| 1099 | |
Manuel Pégourié-Gonnard | 53aef81 | 2014-07-11 17:41:24 +0200 | [diff] [blame] | 1100 | SKIP_NEXT="NO" |
| 1101 | |
Manuel Pégourié-Gonnard | a9062e9 | 2014-02-25 16:21:22 +0100 | [diff] [blame] | 1102 | trap cleanup INT TERM HUP |
| 1103 | |
Manuel Pégourié-Gonnard | 9595771 | 2014-02-19 15:29:38 +0100 | [diff] [blame] | 1104 | for VERIFY in $VERIFIES; do |
| 1105 | for MODE in $MODES; do |
Manuel Pégourié-Gonnard | 9595771 | 2014-02-19 15:29:38 +0100 | [diff] [blame] | 1106 | for TYPE in $TYPES; do |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1107 | for PEER in $PEERS; do |
Paul Bakker | 7e5e7ca | 2013-04-17 19:27:58 +0200 | [diff] [blame] | 1108 | |
Manuel Pégourié-Gonnard | 9595771 | 2014-02-19 15:29:38 +0100 | [diff] [blame] | 1109 | setup_arguments |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 1110 | |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1111 | case "$PEER" in |
Manuel Pégourié-Gonnard | d331319 | 2013-09-13 19:20:37 +0200 | [diff] [blame] | 1112 | |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1113 | [Oo]pen*) |
Paul Bakker | 398cb51 | 2012-04-10 08:22:31 +0000 | [diff] [blame] | 1114 | |
Manuel Pégourié-Gonnard | 39e2ca9 | 2015-08-04 16:43:37 +0200 | [diff] [blame] | 1115 | if test "$OSSL_NO_DTLS" -gt 0 && is_dtls "$MODE"; then |
| 1116 | continue; |
| 1117 | fi |
| 1118 | |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1119 | reset_ciphersuites |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 1120 | add_common_ciphersuites |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1121 | add_openssl_ciphersuites |
| 1122 | filter_ciphersuites |
Manuel Pégourié-Gonnard | 330e411 | 2014-02-19 15:23:21 +0100 | [diff] [blame] | 1123 | |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 1124 | if [ "X" != "X$M_CIPHERS" ]; then |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1125 | start_server "OpenSSL" |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 1126 | for i in $M_CIPHERS; do |
Manuel Pégourié-Gonnard | 53aef81 | 2014-07-11 17:41:24 +0200 | [diff] [blame] | 1127 | check_openssl_server_bug $i |
Manuel Pégourié-Gonnard | e4f6edc | 2015-01-22 16:43:54 +0000 | [diff] [blame] | 1128 | run_client mbedTLS $i |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1129 | done |
| 1130 | stop_server |
| 1131 | fi |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 1132 | |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1133 | if [ "X" != "X$O_CIPHERS" ]; then |
Manuel Pégourié-Gonnard | e4f6edc | 2015-01-22 16:43:54 +0000 | [diff] [blame] | 1134 | start_server "mbedTLS" |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1135 | for i in $O_CIPHERS; do |
| 1136 | run_client OpenSSL $i |
| 1137 | done |
| 1138 | stop_server |
| 1139 | fi |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 1140 | |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1141 | ;; |
Manuel Pégourié-Gonnard | 5b2d776 | 2014-02-28 12:42:57 +0100 | [diff] [blame] | 1142 | |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1143 | [Gg]nu*) |
Paul Bakker | fab5c82 | 2012-02-06 16:45:10 +0000 | [diff] [blame] | 1144 | |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1145 | reset_ciphersuites |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 1146 | add_common_ciphersuites |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1147 | add_gnutls_ciphersuites |
| 1148 | filter_ciphersuites |
Paul Bakker | fab5c82 | 2012-02-06 16:45:10 +0000 | [diff] [blame] | 1149 | |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 1150 | if [ "X" != "X$M_CIPHERS" ]; then |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1151 | start_server "GnuTLS" |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 1152 | for i in $M_CIPHERS; do |
Manuel Pégourié-Gonnard | e4f6edc | 2015-01-22 16:43:54 +0000 | [diff] [blame] | 1153 | run_client mbedTLS $i |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1154 | done |
| 1155 | stop_server |
| 1156 | fi |
| 1157 | |
| 1158 | if [ "X" != "X$G_CIPHERS" ]; then |
Manuel Pégourié-Gonnard | e4f6edc | 2015-01-22 16:43:54 +0000 | [diff] [blame] | 1159 | start_server "mbedTLS" |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1160 | for i in $G_CIPHERS; do |
| 1161 | run_client GnuTLS $i |
| 1162 | done |
| 1163 | stop_server |
| 1164 | fi |
| 1165 | |
| 1166 | ;; |
| 1167 | |
Manuel Pégourié-Gonnard | a8f3b75 | 2015-01-22 17:05:05 +0000 | [diff] [blame] | 1168 | mbed*) |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1169 | |
| 1170 | reset_ciphersuites |
Manuel Pégourié-Gonnard | 12b8472 | 2014-03-25 19:07:28 +0100 | [diff] [blame] | 1171 | add_common_ciphersuites |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1172 | add_openssl_ciphersuites |
| 1173 | add_gnutls_ciphersuites |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 1174 | add_mbedtls_ciphersuites |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1175 | filter_ciphersuites |
| 1176 | |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 1177 | if [ "X" != "X$M_CIPHERS" ]; then |
Manuel Pégourié-Gonnard | e4f6edc | 2015-01-22 16:43:54 +0000 | [diff] [blame] | 1178 | start_server "mbedTLS" |
Simon Butcher | ac22d11 | 2016-09-04 22:31:09 +0100 | [diff] [blame] | 1179 | for i in $M_CIPHERS; do |
Manuel Pégourié-Gonnard | e4f6edc | 2015-01-22 16:43:54 +0000 | [diff] [blame] | 1180 | run_client mbedTLS $i |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1181 | done |
| 1182 | stop_server |
| 1183 | fi |
| 1184 | |
| 1185 | ;; |
| 1186 | |
Manuel Pégourié-Gonnard | a1a9f9a | 2014-03-25 18:04:59 +0100 | [diff] [blame] | 1187 | *) |
Paul Bakker | 1ebc0c5 | 2014-05-22 15:47:58 +0200 | [diff] [blame] | 1188 | echo "Unknown peer: $PEER" >&2 |
Manuel Pégourié-Gonnard | a1a9f9a | 2014-03-25 18:04:59 +0100 | [diff] [blame] | 1189 | exit 1 |
| 1190 | ;; |
| 1191 | |
Manuel Pégourié-Gonnard | 9edba77 | 2014-03-13 17:45:35 +0100 | [diff] [blame] | 1192 | esac |
| 1193 | |
| 1194 | done |
Manuel Pégourié-Gonnard | 9595771 | 2014-02-19 15:29:38 +0100 | [diff] [blame] | 1195 | done |
| 1196 | done |
Manuel Pégourié-Gonnard | 9791a40 | 2013-08-27 19:57:15 +0200 | [diff] [blame] | 1197 | done |
Manuel Pégourié-Gonnard | 70064fd | 2013-08-27 22:00:47 +0200 | [diff] [blame] | 1198 | |
Manuel Pégourié-Gonnard | 4145b89 | 2014-02-24 13:20:14 +0100 | [diff] [blame] | 1199 | echo "------------------------------------------------------------------------" |
Manuel Pégourié-Gonnard | 70064fd | 2013-08-27 22:00:47 +0200 | [diff] [blame] | 1200 | |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 1201 | if [ $FAILED -ne 0 -o $SRVMEM -ne 0 ]; |
Manuel Pégourié-Gonnard | 70064fd | 2013-08-27 22:00:47 +0200 | [diff] [blame] | 1202 | then |
Manuel Pégourié-Gonnard | f46f128 | 2014-12-11 11:51:28 +0100 | [diff] [blame] | 1203 | printf "FAILED" |
Manuel Pégourié-Gonnard | 70064fd | 2013-08-27 22:00:47 +0200 | [diff] [blame] | 1204 | else |
Manuel Pégourié-Gonnard | f46f128 | 2014-12-11 11:51:28 +0100 | [diff] [blame] | 1205 | printf "PASSED" |
Manuel Pégourié-Gonnard | 70064fd | 2013-08-27 22:00:47 +0200 | [diff] [blame] | 1206 | fi |
| 1207 | |
Manuel Pégourié-Gonnard | ba0b844 | 2014-03-13 17:57:45 +0100 | [diff] [blame] | 1208 | if [ "$MEMCHECK" -gt 0 ]; then |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 1209 | MEMREPORT=", $SRVMEM server memory errors" |
Manuel Pégourié-Gonnard | ba0b844 | 2014-03-13 17:57:45 +0100 | [diff] [blame] | 1210 | else |
| 1211 | MEMREPORT="" |
| 1212 | fi |
| 1213 | |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 1214 | PASSED=$(( $TESTS - $FAILED )) |
| 1215 | echo " ($PASSED / $TESTS tests ($SKIPPED skipped$MEMREPORT))" |
Manuel Pégourié-Gonnard | 70064fd | 2013-08-27 22:00:47 +0200 | [diff] [blame] | 1216 | |
Manuel Pégourié-Gonnard | 72e51ee | 2014-08-31 10:22:11 +0200 | [diff] [blame] | 1217 | FAILED=$(( $FAILED + $SRVMEM )) |
| 1218 | exit $FAILED |