mbed TLS v2.16.0: ssl_ciphersuites.h Source File

mbed TLS v2.16.0

ssl_ciphersuites.h
Go to the documentation of this file.
1
6 /*
7 * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
8 * SPDX-License-Identifier: Apache-2.0
9 *
10 * Licensed under the Apache License, Version 2.0 (the "License"); you may
11 * not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
13 *
14 * http://www.apache.org/licenses/LICENSE-2.0
15 *
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
18 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
21 *
22 * This file is part of mbed TLS (https://tls.mbed.org)
23 */
24 #ifndef MBEDTLS_SSL_CIPHERSUITES_H
25 #define MBEDTLS_SSL_CIPHERSUITES_H
26
27 #include "pk.h"
28 #include "cipher.h"
29 #include "md.h"
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 /*
36 * Supported ciphersuites (Official IANA names)
37 */
38 #define MBEDTLS_TLS_RSA_WITH_NULL_MD5 0x01
39 #define MBEDTLS_TLS_RSA_WITH_NULL_SHA 0x02
41 #define MBEDTLS_TLS_RSA_WITH_RC4_128_MD5 0x04
42 #define MBEDTLS_TLS_RSA_WITH_RC4_128_SHA 0x05
43 #define MBEDTLS_TLS_RSA_WITH_DES_CBC_SHA 0x09
45 #define MBEDTLS_TLS_RSA_WITH_3DES_EDE_CBC_SHA 0x0A
46
47 #define MBEDTLS_TLS_DHE_RSA_WITH_DES_CBC_SHA 0x15
48 #define MBEDTLS_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA 0x16
49
50 #define MBEDTLS_TLS_PSK_WITH_NULL_SHA 0x2C
51 #define MBEDTLS_TLS_DHE_PSK_WITH_NULL_SHA 0x2D
52 #define MBEDTLS_TLS_RSA_PSK_WITH_NULL_SHA 0x2E
53 #define MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA 0x2F
54
55 #define MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CBC_SHA 0x33
56 #define MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA 0x35
57 #define MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CBC_SHA 0x39
58
59 #define MBEDTLS_TLS_RSA_WITH_NULL_SHA256 0x3B
60 #define MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA256 0x3C
61 #define MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA256 0x3D
63 #define MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA 0x41
64 #define MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA 0x45
65
66 #define MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 0x67
67 #define MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 0x6B
69 #define MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA 0x84
70 #define MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA 0x88
71
72 #define MBEDTLS_TLS_PSK_WITH_RC4_128_SHA 0x8A
73 #define MBEDTLS_TLS_PSK_WITH_3DES_EDE_CBC_SHA 0x8B
74 #define MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA 0x8C
75 #define MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA 0x8D
76
77 #define MBEDTLS_TLS_DHE_PSK_WITH_RC4_128_SHA 0x8E
78 #define MBEDTLS_TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA 0x8F
79 #define MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CBC_SHA 0x90
80 #define MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CBC_SHA 0x91
81
82 #define MBEDTLS_TLS_RSA_PSK_WITH_RC4_128_SHA 0x92
83 #define MBEDTLS_TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA 0x93
84 #define MBEDTLS_TLS_RSA_PSK_WITH_AES_128_CBC_SHA 0x94
85 #define MBEDTLS_TLS_RSA_PSK_WITH_AES_256_CBC_SHA 0x95
86
87 #define MBEDTLS_TLS_RSA_WITH_AES_128_GCM_SHA256 0x9C
88 #define MBEDTLS_TLS_RSA_WITH_AES_256_GCM_SHA384 0x9D
89 #define MBEDTLS_TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 0x9E
90 #define MBEDTLS_TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 0x9F
92 #define MBEDTLS_TLS_PSK_WITH_AES_128_GCM_SHA256 0xA8
93 #define MBEDTLS_TLS_PSK_WITH_AES_256_GCM_SHA384 0xA9
94 #define MBEDTLS_TLS_DHE_PSK_WITH_AES_128_GCM_SHA256 0xAA
95 #define MBEDTLS_TLS_DHE_PSK_WITH_AES_256_GCM_SHA384 0xAB
96 #define MBEDTLS_TLS_RSA_PSK_WITH_AES_128_GCM_SHA256 0xAC
97 #define MBEDTLS_TLS_RSA_PSK_WITH_AES_256_GCM_SHA384 0xAD
99 #define MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA256 0xAE
100 #define MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA384 0xAF
101 #define MBEDTLS_TLS_PSK_WITH_NULL_SHA256 0xB0
102 #define MBEDTLS_TLS_PSK_WITH_NULL_SHA384 0xB1
104 #define MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CBC_SHA256 0xB2
105 #define MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CBC_SHA384 0xB3
106 #define MBEDTLS_TLS_DHE_PSK_WITH_NULL_SHA256 0xB4
107 #define MBEDTLS_TLS_DHE_PSK_WITH_NULL_SHA384 0xB5
109 #define MBEDTLS_TLS_RSA_PSK_WITH_AES_128_CBC_SHA256 0xB6
110 #define MBEDTLS_TLS_RSA_PSK_WITH_AES_256_CBC_SHA384 0xB7
111 #define MBEDTLS_TLS_RSA_PSK_WITH_NULL_SHA256 0xB8
112 #define MBEDTLS_TLS_RSA_PSK_WITH_NULL_SHA384 0xB9
114 #define MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256 0xBA
115 #define MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 0xBE
117 #define MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256 0xC0
118 #define MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 0xC4
120 #define MBEDTLS_TLS_ECDH_ECDSA_WITH_NULL_SHA 0xC001
121 #define MBEDTLS_TLS_ECDH_ECDSA_WITH_RC4_128_SHA 0xC002
122 #define MBEDTLS_TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA 0xC003
123 #define MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA 0xC004
124 #define MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA 0xC005
126 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_NULL_SHA 0xC006
127 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_RC4_128_SHA 0xC007
128 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA 0xC008
129 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA 0xC009
130 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA 0xC00A
132 #define MBEDTLS_TLS_ECDH_RSA_WITH_NULL_SHA 0xC00B
133 #define MBEDTLS_TLS_ECDH_RSA_WITH_RC4_128_SHA 0xC00C
134 #define MBEDTLS_TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA 0xC00D
135 #define MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA 0xC00E
136 #define MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA 0xC00F
138 #define MBEDTLS_TLS_ECDHE_RSA_WITH_NULL_SHA 0xC010
139 #define MBEDTLS_TLS_ECDHE_RSA_WITH_RC4_128_SHA 0xC011
140 #define MBEDTLS_TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA 0xC012
141 #define MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA 0xC013
142 #define MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA 0xC014
144 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 0xC023
145 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 0xC024
146 #define MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256 0xC025
147 #define MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 0xC026
148 #define MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 0xC027
149 #define MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 0xC028
150 #define MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256 0xC029
151 #define MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 0xC02A
153 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 0xC02B
154 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 0xC02C
155 #define MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 0xC02D
156 #define MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 0xC02E
157 #define MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 0xC02F
158 #define MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 0xC030
159 #define MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256 0xC031
160 #define MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384 0xC032
162 #define MBEDTLS_TLS_ECDHE_PSK_WITH_RC4_128_SHA 0xC033
163 #define MBEDTLS_TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA 0xC034
164 #define MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA 0xC035
165 #define MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA 0xC036
166 #define MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256 0xC037
167 #define MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384 0xC038
168 #define MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA 0xC039
169 #define MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA256 0xC03A
170 #define MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA384 0xC03B
172 #define MBEDTLS_TLS_RSA_WITH_ARIA_128_CBC_SHA256 0xC03C
173 #define MBEDTLS_TLS_RSA_WITH_ARIA_256_CBC_SHA384 0xC03D
174 #define MBEDTLS_TLS_DHE_RSA_WITH_ARIA_128_CBC_SHA256 0xC044
175 #define MBEDTLS_TLS_DHE_RSA_WITH_ARIA_256_CBC_SHA384 0xC045
176 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_ARIA_128_CBC_SHA256 0xC048
177 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_ARIA_256_CBC_SHA384 0xC049
178 #define MBEDTLS_TLS_ECDH_ECDSA_WITH_ARIA_128_CBC_SHA256 0xC04A
179 #define MBEDTLS_TLS_ECDH_ECDSA_WITH_ARIA_256_CBC_SHA384 0xC04B
180 #define MBEDTLS_TLS_ECDHE_RSA_WITH_ARIA_128_CBC_SHA256 0xC04C
181 #define MBEDTLS_TLS_ECDHE_RSA_WITH_ARIA_256_CBC_SHA384 0xC04D
182 #define MBEDTLS_TLS_ECDH_RSA_WITH_ARIA_128_CBC_SHA256 0xC04E
183 #define MBEDTLS_TLS_ECDH_RSA_WITH_ARIA_256_CBC_SHA384 0xC04F
184 #define MBEDTLS_TLS_RSA_WITH_ARIA_128_GCM_SHA256 0xC050
185 #define MBEDTLS_TLS_RSA_WITH_ARIA_256_GCM_SHA384 0xC051
186 #define MBEDTLS_TLS_DHE_RSA_WITH_ARIA_128_GCM_SHA256 0xC052
187 #define MBEDTLS_TLS_DHE_RSA_WITH_ARIA_256_GCM_SHA384 0xC053
188 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256 0xC05C
189 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384 0xC05D
190 #define MBEDTLS_TLS_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256 0xC05E
191 #define MBEDTLS_TLS_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384 0xC05F
192 #define MBEDTLS_TLS_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256 0xC060
193 #define MBEDTLS_TLS_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384 0xC061
194 #define MBEDTLS_TLS_ECDH_RSA_WITH_ARIA_128_GCM_SHA256 0xC062
195 #define MBEDTLS_TLS_ECDH_RSA_WITH_ARIA_256_GCM_SHA384 0xC063
196 #define MBEDTLS_TLS_PSK_WITH_ARIA_128_CBC_SHA256 0xC064
197 #define MBEDTLS_TLS_PSK_WITH_ARIA_256_CBC_SHA384 0xC065
198 #define MBEDTLS_TLS_DHE_PSK_WITH_ARIA_128_CBC_SHA256 0xC066
199 #define MBEDTLS_TLS_DHE_PSK_WITH_ARIA_256_CBC_SHA384 0xC067
200 #define MBEDTLS_TLS_RSA_PSK_WITH_ARIA_128_CBC_SHA256 0xC068
201 #define MBEDTLS_TLS_RSA_PSK_WITH_ARIA_256_CBC_SHA384 0xC069
202 #define MBEDTLS_TLS_PSK_WITH_ARIA_128_GCM_SHA256 0xC06A
203 #define MBEDTLS_TLS_PSK_WITH_ARIA_256_GCM_SHA384 0xC06B
204 #define MBEDTLS_TLS_DHE_PSK_WITH_ARIA_128_GCM_SHA256 0xC06C
205 #define MBEDTLS_TLS_DHE_PSK_WITH_ARIA_256_GCM_SHA384 0xC06D
206 #define MBEDTLS_TLS_RSA_PSK_WITH_ARIA_128_GCM_SHA256 0xC06E
207 #define MBEDTLS_TLS_RSA_PSK_WITH_ARIA_256_GCM_SHA384 0xC06F
208 #define MBEDTLS_TLS_ECDHE_PSK_WITH_ARIA_128_CBC_SHA256 0xC070
209 #define MBEDTLS_TLS_ECDHE_PSK_WITH_ARIA_256_CBC_SHA384 0xC071
211 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 0xC072
212 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 0xC073
213 #define MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 0xC074
214 #define MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 0xC075
215 #define MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 0xC076
216 #define MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 0xC077
217 #define MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 0xC078
218 #define MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 0xC079
220 #define MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256 0xC07A
221 #define MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384 0xC07B
222 #define MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_GCM_SHA256 0xC07C
223 #define MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_GCM_SHA384 0xC07D
224 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 0xC086
225 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 0xC087
226 #define MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 0xC088
227 #define MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 0xC089
228 #define MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_GCM_SHA256 0xC08A
229 #define MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_GCM_SHA384 0xC08B
230 #define MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256 0xC08C
231 #define MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384 0xC08D
233 #define MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256 0xC08E
234 #define MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384 0xC08F
235 #define MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_128_GCM_SHA256 0xC090
236 #define MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_256_GCM_SHA384 0xC091
237 #define MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_GCM_SHA256 0xC092
238 #define MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_256_GCM_SHA384 0xC093
240 #define MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256 0xC094
241 #define MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384 0xC095
242 #define MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 0xC096
243 #define MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 0xC097
244 #define MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 0xC098
245 #define MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 0xC099
246 #define MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 0xC09A
247 #define MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 0xC09B
249 #define MBEDTLS_TLS_RSA_WITH_AES_128_CCM 0xC09C
250 #define MBEDTLS_TLS_RSA_WITH_AES_256_CCM 0xC09D
251 #define MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CCM 0xC09E
252 #define MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CCM 0xC09F
253 #define MBEDTLS_TLS_RSA_WITH_AES_128_CCM_8 0xC0A0
254 #define MBEDTLS_TLS_RSA_WITH_AES_256_CCM_8 0xC0A1
255 #define MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CCM_8 0xC0A2
256 #define MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CCM_8 0xC0A3
257 #define MBEDTLS_TLS_PSK_WITH_AES_128_CCM 0xC0A4
258 #define MBEDTLS_TLS_PSK_WITH_AES_256_CCM 0xC0A5
259 #define MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CCM 0xC0A6
260 #define MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CCM 0xC0A7
261 #define MBEDTLS_TLS_PSK_WITH_AES_128_CCM_8 0xC0A8
262 #define MBEDTLS_TLS_PSK_WITH_AES_256_CCM_8 0xC0A9
263 #define MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CCM_8 0xC0AA
264 #define MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CCM_8 0xC0AB
265 /* The last two are named with PSK_DHE in the RFC, which looks like a typo */
266
267 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CCM 0xC0AC
268 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CCM 0xC0AD
269 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 0xC0AE
270 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CCM_8 0xC0AF
272 #define MBEDTLS_TLS_ECJPAKE_WITH_AES_128_CCM_8 0xC0FF
274 /* RFC 7905 */
275 #define MBEDTLS_TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 0xCCA8
276 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 0xCCA9
277 #define MBEDTLS_TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256 0xCCAA
278 #define MBEDTLS_TLS_PSK_WITH_CHACHA20_POLY1305_SHA256 0xCCAB
279 #define MBEDTLS_TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256 0xCCAC
280 #define MBEDTLS_TLS_DHE_PSK_WITH_CHACHA20_POLY1305_SHA256 0xCCAD
281 #define MBEDTLS_TLS_RSA_PSK_WITH_CHACHA20_POLY1305_SHA256 0xCCAE
283 /* Reminder: update mbedtls_ssl_premaster_secret when adding a new key exchange.
284 * Reminder: update MBEDTLS_KEY_EXCHANGE__xxx below
285 */
286 typedef enum {
287 MBEDTLS_KEY_EXCHANGE_NONE = 0,
288 MBEDTLS_KEY_EXCHANGE_RSA,
289 MBEDTLS_KEY_EXCHANGE_DHE_RSA,
290 MBEDTLS_KEY_EXCHANGE_ECDHE_RSA,
291 MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA,
292 MBEDTLS_KEY_EXCHANGE_PSK,
293 MBEDTLS_KEY_EXCHANGE_DHE_PSK,
294 MBEDTLS_KEY_EXCHANGE_RSA_PSK,
295 MBEDTLS_KEY_EXCHANGE_ECDHE_PSK,
296 MBEDTLS_KEY_EXCHANGE_ECDH_RSA,
297 MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA,
298 MBEDTLS_KEY_EXCHANGE_ECJPAKE,
299 } mbedtls_key_exchange_type_t;
300
301 /* Key exchanges using a certificate */
302 #if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) || \
303 defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) || \
304 defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \
305 defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \
306 defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED) || \
307 defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \
308 defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED)
309 #define MBEDTLS_KEY_EXCHANGE__WITH_CERT__ENABLED
310 #endif
311
312 /* Key exchanges allowing client certificate requests */
313 #if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) || \
314 defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) || \
315 defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \
316 defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \
317 defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) || \
318 defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED)
319 #define MBEDTLS_KEY_EXCHANGE__CERT_REQ_ALLOWED__ENABLED
320 #endif
321
322 /* Key exchanges involving server signature in ServerKeyExchange */
323 #if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) || \
324 defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \
325 defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED)
326 #define MBEDTLS_KEY_EXCHANGE__WITH_SERVER_SIGNATURE__ENABLED
327 #endif
328
329 /* Key exchanges using ECDH */
330 #if defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \
331 defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED)
332 #define MBEDTLS_KEY_EXCHANGE__SOME__ECDH_ENABLED
333 #endif
334
335 /* Key exchanges that don't involve ephemeral keys */
336 #if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) || \
337 defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED) || \
338 defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED) || \
339 defined(MBEDTLS_KEY_EXCHANGE__SOME__ECDH_ENABLED)
340 #define MBEDTLS_KEY_EXCHANGE__SOME_NON_PFS__ENABLED
341 #endif
342
343 /* Key exchanges that involve ephemeral keys */
344 #if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) || \
345 defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED) || \
346 defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \
347 defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) || \
348 defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \
349 defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
350 #define MBEDTLS_KEY_EXCHANGE__SOME_PFS__ENABLED
351 #endif
352
353 /* Key exchanges using a PSK */
354 #if defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED) || \
355 defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED) || \
356 defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED) || \
357 defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED)
358 #define MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED
359 #endif
360
361 /* Key exchanges using DHE */
362 #if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) || \
363 defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED)
364 #define MBEDTLS_KEY_EXCHANGE__SOME__DHE_ENABLED
365 #endif
366
367 /* Key exchanges using ECDHE */
368 #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \
369 defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \
370 defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED)
371 #define MBEDTLS_KEY_EXCHANGE__SOME__ECDHE_ENABLED
372 #endif
373
374 typedef struct mbedtls_ssl_ciphersuite_t mbedtls_ssl_ciphersuite_t;
375
376 #define MBEDTLS_CIPHERSUITE_WEAK 0x01
377 #define MBEDTLS_CIPHERSUITE_SHORT_TAG 0x02
379 #define MBEDTLS_CIPHERSUITE_NODTLS 0x04
384 struct mbedtls_ssl_ciphersuite_t
385 {
386 int id;
387 const char * name;
388
389 mbedtls_cipher_type_t cipher;
390 mbedtls_md_type_t mac;
391 mbedtls_key_exchange_type_t key_exchange;
392
393 int min_major_ver;
394 int min_minor_ver;
395 int max_major_ver;
396 int max_minor_ver;
397
398 unsigned char flags;
399 };
400
401 const int *mbedtls_ssl_list_ciphersuites( void );
402
403 const mbedtls_ssl_ciphersuite_t *mbedtls_ssl_ciphersuite_from_string( const char *ciphersuite_name );
404 const mbedtls_ssl_ciphersuite_t *mbedtls_ssl_ciphersuite_from_id( int ciphersuite_id );
405
406 #if defined(MBEDTLS_PK_C)
407 mbedtls_pk_type_t mbedtls_ssl_get_ciphersuite_sig_pk_alg( const mbedtls_ssl_ciphersuite_t *info );
408 mbedtls_pk_type_t mbedtls_ssl_get_ciphersuite_sig_alg( const mbedtls_ssl_ciphersuite_t *info );
409 #endif
410
411 int mbedtls_ssl_ciphersuite_uses_ec( const mbedtls_ssl_ciphersuite_t *info );
412 int mbedtls_ssl_ciphersuite_uses_psk( const mbedtls_ssl_ciphersuite_t *info );
413
414 #if defined(MBEDTLS_KEY_EXCHANGE__SOME_PFS__ENABLED)
415 static inline int mbedtls_ssl_ciphersuite_has_pfs( const mbedtls_ssl_ciphersuite_t *info )
416 {
417 switch( info->key_exchange )
418 {
419 case MBEDTLS_KEY_EXCHANGE_DHE_RSA:
420 case MBEDTLS_KEY_EXCHANGE_DHE_PSK:
421 case MBEDTLS_KEY_EXCHANGE_ECDHE_RSA:
422 case MBEDTLS_KEY_EXCHANGE_ECDHE_PSK:
423 case MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA:
424 case MBEDTLS_KEY_EXCHANGE_ECJPAKE:
425 return( 1 );
426
427 default:
428 return( 0 );
429 }
430 }
431 #endif /* MBEDTLS_KEY_EXCHANGE__SOME_PFS__ENABLED */
432
433 #if defined(MBEDTLS_KEY_EXCHANGE__SOME_NON_PFS__ENABLED)
434 static inline int mbedtls_ssl_ciphersuite_no_pfs( const mbedtls_ssl_ciphersuite_t *info )
435 {
436 switch( info->key_exchange )
437 {
438 case MBEDTLS_KEY_EXCHANGE_ECDH_RSA:
439 case MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA:
440 case MBEDTLS_KEY_EXCHANGE_RSA:
441 case MBEDTLS_KEY_EXCHANGE_PSK:
442 case MBEDTLS_KEY_EXCHANGE_RSA_PSK:
443 return( 1 );
444
445 default:
446 return( 0 );
447 }
448 }
449 #endif /* MBEDTLS_KEY_EXCHANGE__SOME_NON_PFS__ENABLED */
450
451 #if defined(MBEDTLS_KEY_EXCHANGE__SOME__ECDH_ENABLED)
452 static inline int mbedtls_ssl_ciphersuite_uses_ecdh( const mbedtls_ssl_ciphersuite_t *info )
453 {
454 switch( info->key_exchange )
455 {
456 case MBEDTLS_KEY_EXCHANGE_ECDH_RSA:
457 case MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA:
458 return( 1 );
459
460 default:
461 return( 0 );
462 }
463 }
464 #endif /* MBEDTLS_KEY_EXCHANGE__SOME__ECDH_ENABLED */
465
466 static inline int mbedtls_ssl_ciphersuite_cert_req_allowed( const mbedtls_ssl_ciphersuite_t *info )
467 {
468 switch( info->key_exchange )
469 {
470 case MBEDTLS_KEY_EXCHANGE_RSA:
471 case MBEDTLS_KEY_EXCHANGE_DHE_RSA:
472 case MBEDTLS_KEY_EXCHANGE_ECDH_RSA:
473 case MBEDTLS_KEY_EXCHANGE_ECDHE_RSA:
474 case MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA:
475 case MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA:
476 return( 1 );
477
478 default:
479 return( 0 );
480 }
481 }
482
483 #if defined(MBEDTLS_KEY_EXCHANGE__SOME__DHE_ENABLED)
484 static inline int mbedtls_ssl_ciphersuite_uses_dhe( const mbedtls_ssl_ciphersuite_t *info )
485 {
486 switch( info->key_exchange )
487 {
488 case MBEDTLS_KEY_EXCHANGE_DHE_RSA:
489 case MBEDTLS_KEY_EXCHANGE_DHE_PSK:
490 return( 1 );
491
492 default:
493 return( 0 );
494 }
495 }
496 #endif /* MBEDTLS_KEY_EXCHANGE__SOME__DHE_ENABLED) */
497
498 #if defined(MBEDTLS_KEY_EXCHANGE__SOME__ECDHE_ENABLED)
499 static inline int mbedtls_ssl_ciphersuite_uses_ecdhe( const mbedtls_ssl_ciphersuite_t *info )
500 {
501 switch( info->key_exchange )
502 {
503 case MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA:
504 case MBEDTLS_KEY_EXCHANGE_ECDHE_RSA:
505 case MBEDTLS_KEY_EXCHANGE_ECDHE_PSK:
506 return( 1 );
507
508 default:
509 return( 0 );
510 }
511 }
512 #endif /* MBEDTLS_KEY_EXCHANGE__SOME__ECDHE_ENABLED) */
513
514 #if defined(MBEDTLS_KEY_EXCHANGE__WITH_SERVER_SIGNATURE__ENABLED)
515 static inline int mbedtls_ssl_ciphersuite_uses_server_signature( const mbedtls_ssl_ciphersuite_t *info )
516 {
517 switch( info->key_exchange )
518 {
519 case MBEDTLS_KEY_EXCHANGE_DHE_RSA:
520 case MBEDTLS_KEY_EXCHANGE_ECDHE_RSA:
521 case MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA:
522 return( 1 );
523
524 default:
525 return( 0 );
526 }
527 }
528 #endif /* MBEDTLS_KEY_EXCHANGE__WITH_SERVER_SIGNATURE__ENABLED */
529
530 #ifdef __cplusplus
531 }
532 #endif
533
534 #endif /* ssl_ciphersuites.h */
mbedtls_ssl_ciphersuite_from_id
const mbedtls_ssl_ciphersuite_t * mbedtls_ssl_ciphersuite_from_id(int ciphersuite_id)
mbedtls_ssl_ciphersuite_uses_psk
int mbedtls_ssl_ciphersuite_uses_psk(const mbedtls_ssl_ciphersuite_t *info)
mbedtls_ssl_ciphersuite_t::flags
unsigned char flags
Definition: ssl_ciphersuites.h:399
MBEDTLS_KEY_EXCHANGE_ECDH_RSA
Definition: ssl_ciphersuites.h:296
MBEDTLS_KEY_EXCHANGE_RSA_PSK
Definition: ssl_ciphersuites.h:294
mbedtls_pk_type_t
mbedtls_pk_type_t
Public key types.
Definition: pk.h:78
MBEDTLS_KEY_EXCHANGE_DHE_RSA
Definition: ssl_ciphersuites.h:289
MBEDTLS_KEY_EXCHANGE_NONE
Definition: ssl_ciphersuites.h:287
mbedtls_ssl_ciphersuite_t::min_minor_ver
int min_minor_ver
Definition: ssl_ciphersuites.h:395
MBEDTLS_KEY_EXCHANGE_ECDHE_RSA
Definition: ssl_ciphersuites.h:290
mbedtls_ssl_ciphersuite_t::max_major_ver
int max_major_ver
Definition: ssl_ciphersuites.h:396
mbedtls_ssl_ciphersuite_uses_ecdhe
static int mbedtls_ssl_ciphersuite_uses_ecdhe(const mbedtls_ssl_ciphersuite_t *info)
Definition: ssl_ciphersuites.h:500
mbedtls_ssl_ciphersuite_uses_server_signature
static int mbedtls_ssl_ciphersuite_uses_server_signature(const mbedtls_ssl_ciphersuite_t *info)
Definition: ssl_ciphersuites.h:516
mbedtls_cipher_type_t
mbedtls_cipher_type_t
Supported {cipher type, cipher mode} pairs.
Definition: cipher.h:104
MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA
Definition: ssl_ciphersuites.h:297
mbedtls_ssl_list_ciphersuites
const int * mbedtls_ssl_list_ciphersuites(void)
pk.h
Public Key abstraction layer.
mbedtls_ssl_ciphersuite_t::cipher
mbedtls_cipher_type_t cipher
Definition: ssl_ciphersuites.h:390
mbedtls_ssl_ciphersuite_t::key_exchange
mbedtls_key_exchange_type_t key_exchange
Definition: ssl_ciphersuites.h:392
mbedtls_ssl_ciphersuite_t::mac
mbedtls_md_type_t mac
Definition: ssl_ciphersuites.h:391
mbedtls_ssl_ciphersuite_t::max_minor_ver
int max_minor_ver
Definition: ssl_ciphersuites.h:397
mbedtls_ssl_ciphersuite_cert_req_allowed
static int mbedtls_ssl_ciphersuite_cert_req_allowed(const mbedtls_ssl_ciphersuite_t *info)
Definition: ssl_ciphersuites.h:467
MBEDTLS_KEY_EXCHANGE_ECJPAKE
Definition: ssl_ciphersuites.h:298
mbedtls_ssl_ciphersuite_uses_dhe
static int mbedtls_ssl_ciphersuite_uses_dhe(const mbedtls_ssl_ciphersuite_t *info)
Definition: ssl_ciphersuites.h:485
mbedtls_key_exchange_type_t
mbedtls_key_exchange_type_t
Definition: ssl_ciphersuites.h:286
mbedtls_ssl_ciphersuite_t::name
const char * name
Definition: ssl_ciphersuites.h:388
mbedtls_ssl_ciphersuite_t::id
int id
Definition: ssl_ciphersuites.h:387
cipher.h
This file contains an abstraction interface for use with the cipher primitives provided by the librar...
mbedtls_ssl_ciphersuite_t
This structure is used for storing ciphersuite information.
Definition: ssl_ciphersuites.h:385
md.h
This file contains the generic message-digest wrapper.
mbedtls_ssl_ciphersuite_has_pfs
static int mbedtls_ssl_ciphersuite_has_pfs(const mbedtls_ssl_ciphersuite_t *info)
Definition: ssl_ciphersuites.h:416
mbedtls_ssl_ciphersuite_t::min_major_ver
int min_major_ver
Definition: ssl_ciphersuites.h:394
MBEDTLS_KEY_EXCHANGE_DHE_PSK
Definition: ssl_ciphersuites.h:293
MBEDTLS_KEY_EXCHANGE_ECDHE_PSK
Definition: ssl_ciphersuites.h:295
mbedtls_ssl_ciphersuite_no_pfs
static int mbedtls_ssl_ciphersuite_no_pfs(const mbedtls_ssl_ciphersuite_t *info)
Definition: ssl_ciphersuites.h:435
mbedtls_ssl_ciphersuite_uses_ec
int mbedtls_ssl_ciphersuite_uses_ec(const mbedtls_ssl_ciphersuite_t *info)
MBEDTLS_KEY_EXCHANGE_PSK
Definition: ssl_ciphersuites.h:292
mbedtls_ssl_get_ciphersuite_sig_alg
mbedtls_pk_type_t mbedtls_ssl_get_ciphersuite_sig_alg(const mbedtls_ssl_ciphersuite_t *info)
MBEDTLS_KEY_EXCHANGE_RSA
Definition: ssl_ciphersuites.h:288
mbedtls_ssl_get_ciphersuite_sig_pk_alg
mbedtls_pk_type_t mbedtls_ssl_get_ciphersuite_sig_pk_alg(const mbedtls_ssl_ciphersuite_t *info)
MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA
Definition: ssl_ciphersuites.h:291
mbedtls_ssl_ciphersuite_from_string
const mbedtls_ssl_ciphersuite_t * mbedtls_ssl_ciphersuite_from_string(const char *ciphersuite_name)
mbedtls_md_type_t
mbedtls_md_type_t
Supported message digests.
Definition: md.h:58
mbedtls_ssl_ciphersuite_uses_ecdh
static int mbedtls_ssl_ciphersuite_uses_ecdh(const mbedtls_ssl_ciphersuite_t *info)
Definition: ssl_ciphersuites.h:453