Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 1 | /** |
| 2 | * \file ssl_ciphersuites.h |
| 3 | * |
Gilles Peskine | e820c0a | 2023-08-03 17:45:20 +0200 | [diff] [blame] | 4 | * \brief SSL Ciphersuites for Mbed TLS |
Darryl Green | a40a101 | 2018-01-05 15:33:17 +0000 | [diff] [blame] | 5 | */ |
| 6 | /* |
Bence Szépkúti | 1e14827 | 2020-08-07 13:07:28 +0200 | [diff] [blame] | 7 | * Copyright The Mbed TLS Contributors |
Dave Rodgman | 16799db | 2023-11-02 19:47:20 +0000 | [diff] [blame] | 8 | * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 9 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 10 | #ifndef MBEDTLS_SSL_CIPHERSUITES_H |
| 11 | #define MBEDTLS_SSL_CIPHERSUITES_H |
Mateusz Starzyk | 846f021 | 2021-05-19 19:44:07 +0200 | [diff] [blame] | 12 | #include "mbedtls/private_access.h" |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 13 | |
Bence Szépkúti | c662b36 | 2021-05-27 11:25:03 +0200 | [diff] [blame] | 14 | #include "mbedtls/build_info.h" |
Ron Eldor | 8b0cf2e | 2018-02-14 16:02:41 +0200 | [diff] [blame] | 15 | |
Jaeden Amero | 6609aef | 2019-07-04 20:01:14 +0100 | [diff] [blame] | 16 | #include "mbedtls/pk.h" |
| 17 | #include "mbedtls/cipher.h" |
| 18 | #include "mbedtls/md.h" |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 19 | |
| 20 | #ifdef __cplusplus |
| 21 | extern "C" { |
| 22 | #endif |
| 23 | |
Paul Bakker | 41c83d3 | 2013-03-20 14:39:14 +0100 | [diff] [blame] | 24 | /* |
| 25 | * Supported ciphersuites (Official IANA names) |
| 26 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 27 | #define MBEDTLS_TLS_RSA_WITH_NULL_MD5 0x01 /**< Weak! */ |
| 28 | #define MBEDTLS_TLS_RSA_WITH_NULL_SHA 0x02 /**< Weak! */ |
Paul Bakker | 41c83d3 | 2013-03-20 14:39:14 +0100 | [diff] [blame] | 29 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 30 | #define MBEDTLS_TLS_PSK_WITH_NULL_SHA 0x2C /**< Weak! */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 31 | #define MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA 0x2F |
Paul Bakker | 0c5fac2 | 2013-04-19 21:10:51 +0200 | [diff] [blame] | 32 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 33 | #define MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CBC_SHA 0x33 |
| 34 | #define MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA 0x35 |
| 35 | #define MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CBC_SHA 0x39 |
Paul Bakker | d4a56ec | 2013-04-16 18:05:29 +0200 | [diff] [blame] | 36 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 37 | #define MBEDTLS_TLS_RSA_WITH_NULL_SHA256 0x3B /**< Weak! */ |
| 38 | #define MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA256 0x3C /**< TLS 1.2 */ |
| 39 | #define MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA256 0x3D /**< TLS 1.2 */ |
Paul Bakker | 41c83d3 | 2013-03-20 14:39:14 +0100 | [diff] [blame] | 40 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 41 | #define MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA 0x41 |
| 42 | #define MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA 0x45 |
Paul Bakker | 0c5fac2 | 2013-04-19 21:10:51 +0200 | [diff] [blame] | 43 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 44 | #define MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 0x67 /**< TLS 1.2 */ |
| 45 | #define MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 0x6B /**< TLS 1.2 */ |
Paul Bakker | 0c5fac2 | 2013-04-19 21:10:51 +0200 | [diff] [blame] | 46 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 47 | #define MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA 0x84 |
| 48 | #define MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA 0x88 |
Paul Bakker | d4a56ec | 2013-04-16 18:05:29 +0200 | [diff] [blame] | 49 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 50 | #define MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA 0x8C |
| 51 | #define MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA 0x8D |
Paul Bakker | d4a56ec | 2013-04-16 18:05:29 +0200 | [diff] [blame] | 52 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 53 | #define MBEDTLS_TLS_RSA_WITH_AES_128_GCM_SHA256 0x9C /**< TLS 1.2 */ |
| 54 | #define MBEDTLS_TLS_RSA_WITH_AES_256_GCM_SHA384 0x9D /**< TLS 1.2 */ |
| 55 | #define MBEDTLS_TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 0x9E /**< TLS 1.2 */ |
| 56 | #define MBEDTLS_TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 0x9F /**< TLS 1.2 */ |
Paul Bakker | 41c83d3 | 2013-03-20 14:39:14 +0100 | [diff] [blame] | 57 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 58 | #define MBEDTLS_TLS_PSK_WITH_AES_128_GCM_SHA256 0xA8 /**< TLS 1.2 */ |
| 59 | #define MBEDTLS_TLS_PSK_WITH_AES_256_GCM_SHA384 0xA9 /**< TLS 1.2 */ |
Paul Bakker | 40afb4b | 2013-04-19 22:03:30 +0200 | [diff] [blame] | 60 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 61 | #define MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA256 0xAE |
| 62 | #define MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA384 0xAF |
| 63 | #define MBEDTLS_TLS_PSK_WITH_NULL_SHA256 0xB0 /**< Weak! */ |
| 64 | #define MBEDTLS_TLS_PSK_WITH_NULL_SHA384 0xB1 /**< Weak! */ |
Paul Bakker | 40afb4b | 2013-04-19 22:03:30 +0200 | [diff] [blame] | 65 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 66 | #define MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256 0xBA /**< TLS 1.2 */ |
| 67 | #define MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 0xBE /**< TLS 1.2 */ |
Paul Bakker | 0c5fac2 | 2013-04-19 21:10:51 +0200 | [diff] [blame] | 68 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 69 | #define MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256 0xC0 /**< TLS 1.2 */ |
| 70 | #define MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 0xC4 /**< TLS 1.2 */ |
Paul Bakker | 0c5fac2 | 2013-04-19 21:10:51 +0200 | [diff] [blame] | 71 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 72 | #define MBEDTLS_TLS_ECDH_ECDSA_WITH_NULL_SHA 0xC001 /**< Weak! */ |
Mateusz Starzyk | 06b07fb | 2021-02-18 13:55:21 +0100 | [diff] [blame] | 73 | #define MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA 0xC004 |
| 74 | #define MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA 0xC005 |
Manuel Pégourié-Gonnard | 25781b2 | 2013-12-11 16:17:10 +0100 | [diff] [blame] | 75 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 76 | #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_NULL_SHA 0xC006 /**< Weak! */ |
Mateusz Starzyk | 06b07fb | 2021-02-18 13:55:21 +0100 | [diff] [blame] | 77 | #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA 0xC009 |
| 78 | #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA 0xC00A |
Manuel Pégourié-Gonnard | 32ea60a | 2013-08-17 17:39:04 +0200 | [diff] [blame] | 79 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 80 | #define MBEDTLS_TLS_ECDH_RSA_WITH_NULL_SHA 0xC00B /**< Weak! */ |
Mateusz Starzyk | 06b07fb | 2021-02-18 13:55:21 +0100 | [diff] [blame] | 81 | #define MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA 0xC00E |
| 82 | #define MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA 0xC00F |
Manuel Pégourié-Gonnard | 25781b2 | 2013-12-11 16:17:10 +0100 | [diff] [blame] | 83 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 84 | #define MBEDTLS_TLS_ECDHE_RSA_WITH_NULL_SHA 0xC010 /**< Weak! */ |
Mateusz Starzyk | 06b07fb | 2021-02-18 13:55:21 +0100 | [diff] [blame] | 85 | #define MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA 0xC013 |
| 86 | #define MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA 0xC014 |
Paul Bakker | 41c83d3 | 2013-03-20 14:39:14 +0100 | [diff] [blame] | 87 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 88 | #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 0xC023 /**< TLS 1.2 */ |
| 89 | #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 0xC024 /**< TLS 1.2 */ |
| 90 | #define MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256 0xC025 /**< TLS 1.2 */ |
| 91 | #define MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 0xC026 /**< TLS 1.2 */ |
| 92 | #define MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 0xC027 /**< TLS 1.2 */ |
| 93 | #define MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 0xC028 /**< TLS 1.2 */ |
| 94 | #define MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256 0xC029 /**< TLS 1.2 */ |
| 95 | #define MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 0xC02A /**< TLS 1.2 */ |
Paul Bakker | 0c5fac2 | 2013-04-19 21:10:51 +0200 | [diff] [blame] | 96 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 97 | #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 0xC02B /**< TLS 1.2 */ |
| 98 | #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 0xC02C /**< TLS 1.2 */ |
| 99 | #define MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 0xC02D /**< TLS 1.2 */ |
| 100 | #define MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 0xC02E /**< TLS 1.2 */ |
| 101 | #define MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 0xC02F /**< TLS 1.2 */ |
| 102 | #define MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 0xC030 /**< TLS 1.2 */ |
| 103 | #define MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256 0xC031 /**< TLS 1.2 */ |
| 104 | #define MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384 0xC032 /**< TLS 1.2 */ |
Paul Bakker | a54e493 | 2013-03-20 15:31:54 +0100 | [diff] [blame] | 105 | |
Mateusz Starzyk | 06b07fb | 2021-02-18 13:55:21 +0100 | [diff] [blame] | 106 | #define MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA 0xC035 |
| 107 | #define MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA 0xC036 |
| 108 | #define MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256 0xC037 |
| 109 | #define MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384 0xC038 |
| 110 | #define MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA 0xC039 |
| 111 | #define MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA256 0xC03A |
| 112 | #define MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA384 0xC03B |
Manuel Pégourié-Gonnard | 225d6aa | 2013-10-11 19:07:56 +0200 | [diff] [blame] | 113 | |
Manuel Pégourié-Gonnard | 4231e7f | 2018-02-28 10:54:31 +0100 | [diff] [blame] | 114 | #define MBEDTLS_TLS_RSA_WITH_ARIA_128_CBC_SHA256 0xC03C /**< TLS 1.2 */ |
| 115 | #define MBEDTLS_TLS_RSA_WITH_ARIA_256_CBC_SHA384 0xC03D /**< TLS 1.2 */ |
| 116 | #define MBEDTLS_TLS_DHE_RSA_WITH_ARIA_128_CBC_SHA256 0xC044 /**< TLS 1.2 */ |
| 117 | #define MBEDTLS_TLS_DHE_RSA_WITH_ARIA_256_CBC_SHA384 0xC045 /**< TLS 1.2 */ |
| 118 | #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_ARIA_128_CBC_SHA256 0xC048 /**< TLS 1.2 */ |
| 119 | #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_ARIA_256_CBC_SHA384 0xC049 /**< TLS 1.2 */ |
| 120 | #define MBEDTLS_TLS_ECDH_ECDSA_WITH_ARIA_128_CBC_SHA256 0xC04A /**< TLS 1.2 */ |
| 121 | #define MBEDTLS_TLS_ECDH_ECDSA_WITH_ARIA_256_CBC_SHA384 0xC04B /**< TLS 1.2 */ |
| 122 | #define MBEDTLS_TLS_ECDHE_RSA_WITH_ARIA_128_CBC_SHA256 0xC04C /**< TLS 1.2 */ |
| 123 | #define MBEDTLS_TLS_ECDHE_RSA_WITH_ARIA_256_CBC_SHA384 0xC04D /**< TLS 1.2 */ |
| 124 | #define MBEDTLS_TLS_ECDH_RSA_WITH_ARIA_128_CBC_SHA256 0xC04E /**< TLS 1.2 */ |
| 125 | #define MBEDTLS_TLS_ECDH_RSA_WITH_ARIA_256_CBC_SHA384 0xC04F /**< TLS 1.2 */ |
| 126 | #define MBEDTLS_TLS_RSA_WITH_ARIA_128_GCM_SHA256 0xC050 /**< TLS 1.2 */ |
| 127 | #define MBEDTLS_TLS_RSA_WITH_ARIA_256_GCM_SHA384 0xC051 /**< TLS 1.2 */ |
| 128 | #define MBEDTLS_TLS_DHE_RSA_WITH_ARIA_128_GCM_SHA256 0xC052 /**< TLS 1.2 */ |
| 129 | #define MBEDTLS_TLS_DHE_RSA_WITH_ARIA_256_GCM_SHA384 0xC053 /**< TLS 1.2 */ |
| 130 | #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256 0xC05C /**< TLS 1.2 */ |
| 131 | #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384 0xC05D /**< TLS 1.2 */ |
| 132 | #define MBEDTLS_TLS_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256 0xC05E /**< TLS 1.2 */ |
| 133 | #define MBEDTLS_TLS_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384 0xC05F /**< TLS 1.2 */ |
| 134 | #define MBEDTLS_TLS_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256 0xC060 /**< TLS 1.2 */ |
| 135 | #define MBEDTLS_TLS_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384 0xC061 /**< TLS 1.2 */ |
| 136 | #define MBEDTLS_TLS_ECDH_RSA_WITH_ARIA_128_GCM_SHA256 0xC062 /**< TLS 1.2 */ |
| 137 | #define MBEDTLS_TLS_ECDH_RSA_WITH_ARIA_256_GCM_SHA384 0xC063 /**< TLS 1.2 */ |
| 138 | #define MBEDTLS_TLS_PSK_WITH_ARIA_128_CBC_SHA256 0xC064 /**< TLS 1.2 */ |
| 139 | #define MBEDTLS_TLS_PSK_WITH_ARIA_256_CBC_SHA384 0xC065 /**< TLS 1.2 */ |
Manuel Pégourié-Gonnard | 4231e7f | 2018-02-28 10:54:31 +0100 | [diff] [blame] | 140 | #define MBEDTLS_TLS_PSK_WITH_ARIA_128_GCM_SHA256 0xC06A /**< TLS 1.2 */ |
| 141 | #define MBEDTLS_TLS_PSK_WITH_ARIA_256_GCM_SHA384 0xC06B /**< TLS 1.2 */ |
Manuel Pégourié-Gonnard | 4231e7f | 2018-02-28 10:54:31 +0100 | [diff] [blame] | 142 | #define MBEDTLS_TLS_ECDHE_PSK_WITH_ARIA_128_CBC_SHA256 0xC070 /**< TLS 1.2 */ |
| 143 | #define MBEDTLS_TLS_ECDHE_PSK_WITH_ARIA_256_CBC_SHA384 0xC071 /**< TLS 1.2 */ |
Markku-Juhani O. Saarinen | c06e101 | 2017-12-07 11:51:13 +0000 | [diff] [blame] | 144 | |
Mateusz Starzyk | 06b07fb | 2021-02-18 13:55:21 +0100 | [diff] [blame] | 145 | #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 0xC072 |
| 146 | #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 0xC073 |
| 147 | #define MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 0xC074 |
| 148 | #define MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 0xC075 |
| 149 | #define MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 0xC076 |
| 150 | #define MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 0xC077 |
| 151 | #define MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 0xC078 |
| 152 | #define MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 0xC079 |
Paul Bakker | 27714b1 | 2013-04-07 23:07:12 +0200 | [diff] [blame] | 153 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 154 | #define MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256 0xC07A /**< TLS 1.2 */ |
| 155 | #define MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384 0xC07B /**< TLS 1.2 */ |
| 156 | #define MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_GCM_SHA256 0xC07C /**< TLS 1.2 */ |
| 157 | #define MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_GCM_SHA384 0xC07D /**< TLS 1.2 */ |
| 158 | #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 0xC086 /**< TLS 1.2 */ |
| 159 | #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 0xC087 /**< TLS 1.2 */ |
| 160 | #define MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 0xC088 /**< TLS 1.2 */ |
| 161 | #define MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 0xC089 /**< TLS 1.2 */ |
| 162 | #define MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_GCM_SHA256 0xC08A /**< TLS 1.2 */ |
| 163 | #define MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_GCM_SHA384 0xC08B /**< TLS 1.2 */ |
| 164 | #define MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256 0xC08C /**< TLS 1.2 */ |
| 165 | #define MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384 0xC08D /**< TLS 1.2 */ |
Manuel Pégourié-Gonnard | 8d01eea | 2013-10-24 19:49:07 +0200 | [diff] [blame] | 166 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 167 | #define MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256 0xC08E /**< TLS 1.2 */ |
| 168 | #define MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384 0xC08F /**< TLS 1.2 */ |
Manuel Pégourié-Gonnard | 8d01eea | 2013-10-24 19:49:07 +0200 | [diff] [blame] | 169 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 170 | #define MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256 0xC094 |
| 171 | #define MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384 0xC095 |
Mateusz Starzyk | 06b07fb | 2021-02-18 13:55:21 +0100 | [diff] [blame] | 172 | #define MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 0xC09A |
| 173 | #define MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 0xC09B |
Paul Bakker | 0f2f0bf | 2013-07-26 15:03:31 +0200 | [diff] [blame] | 174 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 175 | #define MBEDTLS_TLS_RSA_WITH_AES_128_CCM 0xC09C /**< TLS 1.2 */ |
| 176 | #define MBEDTLS_TLS_RSA_WITH_AES_256_CCM 0xC09D /**< TLS 1.2 */ |
| 177 | #define MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CCM 0xC09E /**< TLS 1.2 */ |
| 178 | #define MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CCM 0xC09F /**< TLS 1.2 */ |
| 179 | #define MBEDTLS_TLS_RSA_WITH_AES_128_CCM_8 0xC0A0 /**< TLS 1.2 */ |
| 180 | #define MBEDTLS_TLS_RSA_WITH_AES_256_CCM_8 0xC0A1 /**< TLS 1.2 */ |
| 181 | #define MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CCM_8 0xC0A2 /**< TLS 1.2 */ |
| 182 | #define MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CCM_8 0xC0A3 /**< TLS 1.2 */ |
| 183 | #define MBEDTLS_TLS_PSK_WITH_AES_128_CCM 0xC0A4 /**< TLS 1.2 */ |
| 184 | #define MBEDTLS_TLS_PSK_WITH_AES_256_CCM 0xC0A5 /**< TLS 1.2 */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 185 | #define MBEDTLS_TLS_PSK_WITH_AES_128_CCM_8 0xC0A8 /**< TLS 1.2 */ |
| 186 | #define MBEDTLS_TLS_PSK_WITH_AES_256_CCM_8 0xC0A9 /**< TLS 1.2 */ |
Manuel Pégourié-Gonnard | 6768da9 | 2014-05-14 12:26:51 +0200 | [diff] [blame] | 187 | /* The last two are named with PSK_DHE in the RFC, which looks like a typo */ |
| 188 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 189 | #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CCM 0xC0AC /**< TLS 1.2 */ |
| 190 | #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CCM 0xC0AD /**< TLS 1.2 */ |
| 191 | #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 0xC0AE /**< TLS 1.2 */ |
| 192 | #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CCM_8 0xC0AF /**< TLS 1.2 */ |
Manuel Pégourié-Gonnard | 6768da9 | 2014-05-14 12:26:51 +0200 | [diff] [blame] | 193 | |
Manuel Pégourié-Gonnard | 538cb7b | 2015-09-15 18:03:28 +0200 | [diff] [blame] | 194 | #define MBEDTLS_TLS_ECJPAKE_WITH_AES_128_CCM_8 0xC0FF /**< experimental */ |
| 195 | |
Manuel Pégourié-Gonnard | ce66d5e | 2018-06-14 11:11:15 +0200 | [diff] [blame] | 196 | /* RFC 7905 */ |
| 197 | #define MBEDTLS_TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 0xCCA8 /**< TLS 1.2 */ |
| 198 | #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 0xCCA9 /**< TLS 1.2 */ |
| 199 | #define MBEDTLS_TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256 0xCCAA /**< TLS 1.2 */ |
| 200 | #define MBEDTLS_TLS_PSK_WITH_CHACHA20_POLY1305_SHA256 0xCCAB /**< TLS 1.2 */ |
| 201 | #define MBEDTLS_TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256 0xCCAC /**< TLS 1.2 */ |
Manuel Pégourié-Gonnard | ce66d5e | 2018-06-14 11:11:15 +0200 | [diff] [blame] | 202 | |
Hanno Becker | 8ca2692 | 2021-07-23 19:24:23 +0100 | [diff] [blame] | 203 | /* RFC 8446, Appendix B.4 */ |
| 204 | #define MBEDTLS_TLS1_3_AES_128_GCM_SHA256 0x1301 /**< TLS 1.3 */ |
| 205 | #define MBEDTLS_TLS1_3_AES_256_GCM_SHA384 0x1302 /**< TLS 1.3 */ |
| 206 | #define MBEDTLS_TLS1_3_CHACHA20_POLY1305_SHA256 0x1303 /**< TLS 1.3 */ |
| 207 | #define MBEDTLS_TLS1_3_AES_128_CCM_SHA256 0x1304 /**< TLS 1.3 */ |
| 208 | #define MBEDTLS_TLS1_3_AES_128_CCM_8_SHA256 0x1305 /**< TLS 1.3 */ |
| 209 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 210 | /* Reminder: update mbedtls_ssl_premaster_secret when adding a new key exchange. |
Manuel Pégourié-Gonnard | adeb7d8 | 2015-10-09 14:44:47 +0100 | [diff] [blame] | 211 | * Reminder: update MBEDTLS_KEY_EXCHANGE__xxx below |
Manuel Pégourié-Gonnard | d942323 | 2014-12-02 11:57:29 +0100 | [diff] [blame] | 212 | */ |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 213 | typedef enum { |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 214 | MBEDTLS_KEY_EXCHANGE_NONE = 0, |
| 215 | MBEDTLS_KEY_EXCHANGE_RSA, |
| 216 | MBEDTLS_KEY_EXCHANGE_DHE_RSA, |
| 217 | MBEDTLS_KEY_EXCHANGE_ECDHE_RSA, |
| 218 | MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA, |
| 219 | MBEDTLS_KEY_EXCHANGE_PSK, |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 220 | MBEDTLS_KEY_EXCHANGE_ECDHE_PSK, |
| 221 | MBEDTLS_KEY_EXCHANGE_ECDH_RSA, |
| 222 | MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA, |
Manuel Pégourié-Gonnard | 557535d | 2015-09-15 17:53:32 +0200 | [diff] [blame] | 223 | MBEDTLS_KEY_EXCHANGE_ECJPAKE, |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 224 | } mbedtls_key_exchange_type_t; |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 225 | |
Manuel Pégourié-Gonnard | e5f3072 | 2015-10-22 17:01:15 +0200 | [diff] [blame] | 226 | /* Key exchanges using a certificate */ |
Manuel Pégourié-Gonnard | adeb7d8 | 2015-10-09 14:44:47 +0100 | [diff] [blame] | 227 | #if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) || \ |
| 228 | defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) || \ |
| 229 | defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \ |
| 230 | defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \ |
Manuel Pégourié-Gonnard | adeb7d8 | 2015-10-09 14:44:47 +0100 | [diff] [blame] | 231 | defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 232 | defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) |
Gilles Peskine | eccd888 | 2020-03-10 12:19:08 +0100 | [diff] [blame] | 233 | #define MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED |
Manuel Pégourié-Gonnard | d942323 | 2014-12-02 11:57:29 +0100 | [diff] [blame] | 234 | #endif |
| 235 | |
Valerio Setti | c8ccc8f | 2023-08-02 20:00:13 +0200 | [diff] [blame] | 236 | /* Key exchanges in either TLS 1.2 or 1.3 which are using an ECDSA |
| 237 | * signature */ |
Valerio Setti | 2430a70 | 2023-07-13 17:22:51 +0200 | [diff] [blame] | 238 | #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \ |
| 239 | defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED) |
| 240 | #define MBEDTLS_KEY_EXCHANGE_WITH_ECDSA_ANY_ENABLED |
| 241 | #endif |
| 242 | |
Ronald Cron | e68ab4f | 2022-10-05 12:46:29 +0200 | [diff] [blame] | 243 | #if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED) || \ |
| 244 | defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED) |
| 245 | #define MBEDTLS_SSL_HANDSHAKE_WITH_CERT_ENABLED |
| 246 | #endif |
| 247 | |
Manuel Pégourié-Gonnard | 97bb726 | 2023-09-18 11:28:32 +0200 | [diff] [blame] | 248 | /* Key exchanges allowing client certificate requests. |
| 249 | * |
Gilles Peskine | 0068fce | 2024-09-20 18:39:29 +0200 | [diff] [blame] | 250 | * This is now the same as MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED, |
| 251 | * and the two macros could be unified. |
| 252 | * Until Mbed TLS 3.x, the two sets were different because |
| 253 | * MBEDTLS_KEY_EXCHANGE_CERT_REQ_ALLOWED_ENABLED covers |
| 254 | * MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED plus RSA-PSK. |
| 255 | * But RSA-PSK was removed in Mbed TLS 4.0. |
Manuel Pégourié-Gonnard | 97bb726 | 2023-09-18 11:28:32 +0200 | [diff] [blame] | 256 | */ |
Gilles Peskine | 0068fce | 2024-09-20 18:39:29 +0200 | [diff] [blame] | 257 | #if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED) |
Gilles Peskine | eccd888 | 2020-03-10 12:19:08 +0100 | [diff] [blame] | 258 | #define MBEDTLS_KEY_EXCHANGE_CERT_REQ_ALLOWED_ENABLED |
Hanno Becker | 1aa267c | 2017-04-28 17:08:27 +0100 | [diff] [blame] | 259 | #endif |
| 260 | |
Valerio Setti | 568799f | 2023-08-18 16:27:00 +0200 | [diff] [blame] | 261 | /* Helper to state that certificate-based client authentication through ECDSA |
Valerio Setti | 2430a70 | 2023-07-13 17:22:51 +0200 | [diff] [blame] | 262 | * is supported in TLS 1.2 */ |
| 263 | #if defined(MBEDTLS_KEY_EXCHANGE_CERT_REQ_ALLOWED_ENABLED) && \ |
Elena Uziunaite | bed21b5 | 2024-08-27 11:56:25 +0100 | [diff] [blame] | 264 | defined(PSA_HAVE_ALG_ECDSA_SIGN) && defined(PSA_HAVE_ALG_ECDSA_VERIFY) |
Valerio Setti | 2430a70 | 2023-07-13 17:22:51 +0200 | [diff] [blame] | 265 | #define MBEDTLS_KEY_EXCHANGE_ECDSA_CERT_REQ_ALLOWED_ENABLED |
| 266 | #endif |
| 267 | |
Valerio Setti | c8ccc8f | 2023-08-02 20:00:13 +0200 | [diff] [blame] | 268 | /* ECDSA required for certificates in either TLS 1.2 or 1.3 */ |
| 269 | #if defined(MBEDTLS_KEY_EXCHANGE_ECDSA_CERT_REQ_ALLOWED_ENABLED) || \ |
| 270 | defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED) |
| 271 | #define MBEDTLS_KEY_EXCHANGE_ECDSA_CERT_REQ_ANY_ALLOWED_ENABLED |
| 272 | #endif |
| 273 | |
Hanno Becker | 1aa267c | 2017-04-28 17:08:27 +0100 | [diff] [blame] | 274 | /* Key exchanges involving server signature in ServerKeyExchange */ |
| 275 | #if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) || \ |
| 276 | defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \ |
| 277 | defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) |
Gilles Peskine | eccd888 | 2020-03-10 12:19:08 +0100 | [diff] [blame] | 278 | #define MBEDTLS_KEY_EXCHANGE_WITH_SERVER_SIGNATURE_ENABLED |
Hanno Becker | 1aa267c | 2017-04-28 17:08:27 +0100 | [diff] [blame] | 279 | #endif |
| 280 | |
| 281 | /* Key exchanges using ECDH */ |
| 282 | #if defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \ |
| 283 | defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) |
Gilles Peskine | eccd888 | 2020-03-10 12:19:08 +0100 | [diff] [blame] | 284 | #define MBEDTLS_KEY_EXCHANGE_SOME_ECDH_ENABLED |
Hanno Becker | 1aa267c | 2017-04-28 17:08:27 +0100 | [diff] [blame] | 285 | #endif |
| 286 | |
| 287 | /* Key exchanges that don't involve ephemeral keys */ |
| 288 | #if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) || \ |
| 289 | defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED) || \ |
Gilles Peskine | eccd888 | 2020-03-10 12:19:08 +0100 | [diff] [blame] | 290 | defined(MBEDTLS_KEY_EXCHANGE_SOME_ECDH_ENABLED) |
| 291 | #define MBEDTLS_KEY_EXCHANGE_SOME_NON_PFS_ENABLED |
Hanno Becker | 1aa267c | 2017-04-28 17:08:27 +0100 | [diff] [blame] | 292 | #endif |
| 293 | |
| 294 | /* Key exchanges that involve ephemeral keys */ |
| 295 | #if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) || \ |
Hanno Becker | 1aa267c | 2017-04-28 17:08:27 +0100 | [diff] [blame] | 296 | defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \ |
| 297 | defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) || \ |
| 298 | defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \ |
| 299 | defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) |
Gilles Peskine | eccd888 | 2020-03-10 12:19:08 +0100 | [diff] [blame] | 300 | #define MBEDTLS_KEY_EXCHANGE_SOME_PFS_ENABLED |
Hanno Becker | 1aa267c | 2017-04-28 17:08:27 +0100 | [diff] [blame] | 301 | #endif |
| 302 | |
Manuel Pégourié-Gonnard | e5f3072 | 2015-10-22 17:01:15 +0200 | [diff] [blame] | 303 | /* Key exchanges using a PSK */ |
Manuel Pégourié-Gonnard | adeb7d8 | 2015-10-09 14:44:47 +0100 | [diff] [blame] | 304 | #if defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED) || \ |
Manuel Pégourié-Gonnard | adeb7d8 | 2015-10-09 14:44:47 +0100 | [diff] [blame] | 305 | defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) |
Gilles Peskine | eccd888 | 2020-03-10 12:19:08 +0100 | [diff] [blame] | 306 | #define MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED |
Manuel Pégourié-Gonnard | adeb7d8 | 2015-10-09 14:44:47 +0100 | [diff] [blame] | 307 | #endif |
| 308 | |
Hanno Becker | 1aa267c | 2017-04-28 17:08:27 +0100 | [diff] [blame] | 309 | /* Key exchanges using DHE */ |
Valerio Setti | 6348b46 | 2025-01-15 14:32:46 +0100 | [diff] [blame] | 310 | #if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) |
Gilles Peskine | eccd888 | 2020-03-10 12:19:08 +0100 | [diff] [blame] | 311 | #define MBEDTLS_KEY_EXCHANGE_SOME_DHE_ENABLED |
Hanno Becker | 1aa267c | 2017-04-28 17:08:27 +0100 | [diff] [blame] | 312 | #endif |
| 313 | |
| 314 | /* Key exchanges using ECDHE */ |
Manuel Pégourié-Gonnard | adeb7d8 | 2015-10-09 14:44:47 +0100 | [diff] [blame] | 315 | #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \ |
| 316 | defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \ |
| 317 | defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) |
Gilles Peskine | eccd888 | 2020-03-10 12:19:08 +0100 | [diff] [blame] | 318 | #define MBEDTLS_KEY_EXCHANGE_SOME_ECDHE_ENABLED |
Manuel Pégourié-Gonnard | adeb7d8 | 2015-10-09 14:44:47 +0100 | [diff] [blame] | 319 | #endif |
| 320 | |
Valerio Setti | ed365e6 | 2023-07-07 15:02:27 +0200 | [diff] [blame] | 321 | /* TLS 1.2 key exchanges using ECDH or ECDHE*/ |
Valerio Setti | 00dc406 | 2023-07-05 18:48:43 +0200 | [diff] [blame] | 322 | #if defined(MBEDTLS_KEY_EXCHANGE_SOME_ECDH_ENABLED) || \ |
| 323 | defined(MBEDTLS_KEY_EXCHANGE_SOME_ECDHE_ENABLED) |
| 324 | #define MBEDTLS_KEY_EXCHANGE_SOME_ECDH_OR_ECDHE_1_2_ENABLED |
| 325 | #endif |
| 326 | |
Valerio Setti | 0a0d0d5 | 2023-07-07 15:12:45 +0200 | [diff] [blame] | 327 | /* TLS 1.3 PSK key exchanges */ |
| 328 | #if defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED) || \ |
| 329 | defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED) |
| 330 | #define MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_SOME_PSK_ENABLED |
| 331 | #endif |
| 332 | |
| 333 | /* TLS 1.2 or 1.3 key exchanges with PSK */ |
| 334 | #if defined(MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED) || \ |
| 335 | defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_SOME_PSK_ENABLED) |
| 336 | #define MBEDTLS_SSL_HANDSHAKE_WITH_PSK_ENABLED |
| 337 | #endif |
| 338 | |
| 339 | /* TLS 1.3 ephemeral key exchanges */ |
| 340 | #if defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED) || \ |
| 341 | defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED) |
| 342 | #define MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_SOME_EPHEMERAL_ENABLED |
| 343 | #endif |
| 344 | |
Valerio Setti | ea59c43 | 2023-07-25 11:14:03 +0200 | [diff] [blame] | 345 | /* TLS 1.3 key exchanges using ECDHE */ |
Valerio Setti | ed365e6 | 2023-07-07 15:02:27 +0200 | [diff] [blame] | 346 | #if defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_SOME_EPHEMERAL_ENABLED) && \ |
| 347 | defined(PSA_WANT_ALG_ECDH) |
| 348 | #define MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_SOME_ECDHE_ENABLED |
| 349 | #endif |
| 350 | |
| 351 | /* TLS 1.2 or 1.3 key exchanges using ECDH or ECDHE */ |
Valerio Setti | 00dc406 | 2023-07-05 18:48:43 +0200 | [diff] [blame] | 352 | #if defined(MBEDTLS_KEY_EXCHANGE_SOME_ECDH_OR_ECDHE_1_2_ENABLED) || \ |
Valerio Setti | ed365e6 | 2023-07-07 15:02:27 +0200 | [diff] [blame] | 353 | defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_SOME_ECDHE_ENABLED) |
Valerio Setti | e87915b | 2023-07-06 12:47:43 +0200 | [diff] [blame] | 354 | #define MBEDTLS_KEY_EXCHANGE_SOME_ECDH_OR_ECDHE_ANY_ENABLED |
| 355 | #endif |
| 356 | |
Valerio Setti | ed365e6 | 2023-07-07 15:02:27 +0200 | [diff] [blame] | 357 | /* TLS 1.2 XXDH key exchanges: ECDH or ECDHE or FFDH */ |
| 358 | #if (defined(MBEDTLS_KEY_EXCHANGE_SOME_ECDH_OR_ECDHE_1_2_ENABLED) || \ |
| 359 | defined(MBEDTLS_KEY_EXCHANGE_SOME_DHE_ENABLED)) |
| 360 | #define MBEDTLS_KEY_EXCHANGE_SOME_XXDH_1_2_ENABLED |
Valerio Setti | 00dc406 | 2023-07-05 18:48:43 +0200 | [diff] [blame] | 361 | #endif |
| 362 | |
Valerio Setti | 9cd8011 | 2023-07-25 12:04:21 +0200 | [diff] [blame] | 363 | /* The handshake params structure has a set of fields called xxdh_psa which are used: |
Janos Follath | 130ece0 | 2024-11-19 16:16:36 +0000 | [diff] [blame] | 364 | * - by TLS 1.2 to do ECDH or ECDHE; |
Valerio Setti | 9cd8011 | 2023-07-25 12:04:21 +0200 | [diff] [blame] | 365 | * - by TLS 1.3 to do ECDHE or FFDHE. |
| 366 | * The following macros can be used to guard their declaration and use. |
| 367 | */ |
| 368 | #if defined(MBEDTLS_KEY_EXCHANGE_SOME_ECDH_OR_ECDHE_1_2_ENABLED) && \ |
| 369 | defined(MBEDTLS_USE_PSA_CRYPTO) |
| 370 | #define MBEDTLS_KEY_EXCHANGE_SOME_XXDH_PSA_1_2_ENABLED |
| 371 | #endif |
| 372 | #if defined(MBEDTLS_KEY_EXCHANGE_SOME_XXDH_PSA_1_2_ENABLED) || \ |
Valerio Setti | 3d237b5 | 2023-07-07 16:00:20 +0200 | [diff] [blame] | 373 | defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_SOME_EPHEMERAL_ENABLED) |
Valerio Setti | ea59c43 | 2023-07-25 11:14:03 +0200 | [diff] [blame] | 374 | #define MBEDTLS_KEY_EXCHANGE_SOME_XXDH_PSA_ANY_ENABLED |
Valerio Setti | 3d237b5 | 2023-07-07 16:00:20 +0200 | [diff] [blame] | 375 | #endif |
| 376 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 377 | typedef struct mbedtls_ssl_ciphersuite_t mbedtls_ssl_ciphersuite_t; |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 378 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 379 | #define MBEDTLS_CIPHERSUITE_WEAK 0x01 /**< Weak ciphersuite flag */ |
| 380 | #define MBEDTLS_CIPHERSUITE_SHORT_TAG 0x02 /**< Short authentication tag, |
Manuel Pégourié-Gonnard | 6768da9 | 2014-05-14 12:26:51 +0200 | [diff] [blame] | 381 | eg for CCM_8 */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 382 | #define MBEDTLS_CIPHERSUITE_NODTLS 0x04 /**< Can't be used with DTLS */ |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 383 | |
| 384 | /** |
| 385 | * \brief This structure is used for storing ciphersuite information |
Glenn Strauss | 60bfe60 | 2022-03-14 19:04:24 -0400 | [diff] [blame] | 386 | * |
| 387 | * \note members are defined using integral types instead of enums |
| 388 | * in order to pack structure and reduce memory usage by internal |
| 389 | * \c ciphersuite_definitions[] |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 390 | */ |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 391 | struct mbedtls_ssl_ciphersuite_t { |
Mateusz Starzyk | 363eb29 | 2021-05-19 17:32:44 +0200 | [diff] [blame] | 392 | int MBEDTLS_PRIVATE(id); |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 393 | const char *MBEDTLS_PRIVATE(name); |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 394 | |
Glenn Strauss | 60bfe60 | 2022-03-14 19:04:24 -0400 | [diff] [blame] | 395 | uint8_t MBEDTLS_PRIVATE(cipher); /* mbedtls_cipher_type_t */ |
| 396 | uint8_t MBEDTLS_PRIVATE(mac); /* mbedtls_md_type_t */ |
| 397 | uint8_t MBEDTLS_PRIVATE(key_exchange); /* mbedtls_key_exchange_type_t */ |
| 398 | uint8_t MBEDTLS_PRIVATE(flags); |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 399 | |
Glenn Strauss | 60bfe60 | 2022-03-14 19:04:24 -0400 | [diff] [blame] | 400 | uint16_t MBEDTLS_PRIVATE(min_tls_version); /* mbedtls_ssl_protocol_version */ |
| 401 | uint16_t MBEDTLS_PRIVATE(max_tls_version); /* mbedtls_ssl_protocol_version */ |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 402 | }; |
| 403 | |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 404 | const int *mbedtls_ssl_list_ciphersuites(void); |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 405 | |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 406 | const mbedtls_ssl_ciphersuite_t *mbedtls_ssl_ciphersuite_from_string(const char *ciphersuite_name); |
| 407 | const mbedtls_ssl_ciphersuite_t *mbedtls_ssl_ciphersuite_from_id(int ciphersuite_id); |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 408 | |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 409 | static inline const char *mbedtls_ssl_ciphersuite_get_name(const mbedtls_ssl_ciphersuite_t *info) |
Glenn Strauss | 8f52690 | 2022-01-13 00:04:49 -0500 | [diff] [blame] | 410 | { |
| 411 | return info->MBEDTLS_PRIVATE(name); |
| 412 | } |
| 413 | |
Minos Galanakis | 40d4708 | 2024-03-04 15:24:51 +0000 | [diff] [blame] | 414 | static inline int mbedtls_ssl_ciphersuite_get_id(const mbedtls_ssl_ciphersuite_t *info) |
Minos Galanakis | 358b448 | 2024-03-04 02:19:31 +0000 | [diff] [blame] | 415 | { |
| 416 | return info->MBEDTLS_PRIVATE(id); |
| 417 | } |
| 418 | |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 419 | size_t mbedtls_ssl_ciphersuite_get_cipher_key_bitlen(const mbedtls_ssl_ciphersuite_t *info); |
Glenn Strauss | 8f52690 | 2022-01-13 00:04:49 -0500 | [diff] [blame] | 420 | |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 421 | #ifdef __cplusplus |
| 422 | } |
| 423 | #endif |
| 424 | |
| 425 | #endif /* ssl_ciphersuites.h */ |