mbed TLS v2.2.0
ssl_ciphersuites.h
Go to the documentation of this file.
1 
23 #ifndef MBEDTLS_SSL_CIPHERSUITES_H
24 #define MBEDTLS_SSL_CIPHERSUITES_H
25 
26 #include "pk.h"
27 #include "cipher.h"
28 #include "md.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 /*
35  * Supported ciphersuites (Official IANA names)
36  */
37 #define MBEDTLS_TLS_RSA_WITH_NULL_MD5 0x01
38 #define MBEDTLS_TLS_RSA_WITH_NULL_SHA 0x02
40 #define MBEDTLS_TLS_RSA_WITH_RC4_128_MD5 0x04
41 #define MBEDTLS_TLS_RSA_WITH_RC4_128_SHA 0x05
42 #define MBEDTLS_TLS_RSA_WITH_DES_CBC_SHA 0x09
44 #define MBEDTLS_TLS_RSA_WITH_3DES_EDE_CBC_SHA 0x0A
45 
46 #define MBEDTLS_TLS_DHE_RSA_WITH_DES_CBC_SHA 0x15
47 #define MBEDTLS_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA 0x16
48 
49 #define MBEDTLS_TLS_PSK_WITH_NULL_SHA 0x2C
50 #define MBEDTLS_TLS_DHE_PSK_WITH_NULL_SHA 0x2D
51 #define MBEDTLS_TLS_RSA_PSK_WITH_NULL_SHA 0x2E
52 #define MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA 0x2F
53 
54 #define MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CBC_SHA 0x33
55 #define MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA 0x35
56 #define MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CBC_SHA 0x39
57 
58 #define MBEDTLS_TLS_RSA_WITH_NULL_SHA256 0x3B
59 #define MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA256 0x3C
60 #define MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA256 0x3D
62 #define MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA 0x41
63 #define MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA 0x45
64 
65 #define MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 0x67
66 #define MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 0x6B
68 #define MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA 0x84
69 #define MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA 0x88
70 
71 #define MBEDTLS_TLS_PSK_WITH_RC4_128_SHA 0x8A
72 #define MBEDTLS_TLS_PSK_WITH_3DES_EDE_CBC_SHA 0x8B
73 #define MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA 0x8C
74 #define MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA 0x8D
75 
76 #define MBEDTLS_TLS_DHE_PSK_WITH_RC4_128_SHA 0x8E
77 #define MBEDTLS_TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA 0x8F
78 #define MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CBC_SHA 0x90
79 #define MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CBC_SHA 0x91
80 
81 #define MBEDTLS_TLS_RSA_PSK_WITH_RC4_128_SHA 0x92
82 #define MBEDTLS_TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA 0x93
83 #define MBEDTLS_TLS_RSA_PSK_WITH_AES_128_CBC_SHA 0x94
84 #define MBEDTLS_TLS_RSA_PSK_WITH_AES_256_CBC_SHA 0x95
85 
86 #define MBEDTLS_TLS_RSA_WITH_AES_128_GCM_SHA256 0x9C
87 #define MBEDTLS_TLS_RSA_WITH_AES_256_GCM_SHA384 0x9D
88 #define MBEDTLS_TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 0x9E
89 #define MBEDTLS_TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 0x9F
91 #define MBEDTLS_TLS_PSK_WITH_AES_128_GCM_SHA256 0xA8
92 #define MBEDTLS_TLS_PSK_WITH_AES_256_GCM_SHA384 0xA9
93 #define MBEDTLS_TLS_DHE_PSK_WITH_AES_128_GCM_SHA256 0xAA
94 #define MBEDTLS_TLS_DHE_PSK_WITH_AES_256_GCM_SHA384 0xAB
95 #define MBEDTLS_TLS_RSA_PSK_WITH_AES_128_GCM_SHA256 0xAC
96 #define MBEDTLS_TLS_RSA_PSK_WITH_AES_256_GCM_SHA384 0xAD
98 #define MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA256 0xAE
99 #define MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA384 0xAF
100 #define MBEDTLS_TLS_PSK_WITH_NULL_SHA256 0xB0
101 #define MBEDTLS_TLS_PSK_WITH_NULL_SHA384 0xB1
103 #define MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CBC_SHA256 0xB2
104 #define MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CBC_SHA384 0xB3
105 #define MBEDTLS_TLS_DHE_PSK_WITH_NULL_SHA256 0xB4
106 #define MBEDTLS_TLS_DHE_PSK_WITH_NULL_SHA384 0xB5
108 #define MBEDTLS_TLS_RSA_PSK_WITH_AES_128_CBC_SHA256 0xB6
109 #define MBEDTLS_TLS_RSA_PSK_WITH_AES_256_CBC_SHA384 0xB7
110 #define MBEDTLS_TLS_RSA_PSK_WITH_NULL_SHA256 0xB8
111 #define MBEDTLS_TLS_RSA_PSK_WITH_NULL_SHA384 0xB9
113 #define MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256 0xBA
114 #define MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 0xBE
116 #define MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256 0xC0
117 #define MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 0xC4
119 #define MBEDTLS_TLS_ECDH_ECDSA_WITH_NULL_SHA 0xC001
120 #define MBEDTLS_TLS_ECDH_ECDSA_WITH_RC4_128_SHA 0xC002
121 #define MBEDTLS_TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA 0xC003
122 #define MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA 0xC004
123 #define MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA 0xC005
125 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_NULL_SHA 0xC006
126 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_RC4_128_SHA 0xC007
127 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA 0xC008
128 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA 0xC009
129 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA 0xC00A
131 #define MBEDTLS_TLS_ECDH_RSA_WITH_NULL_SHA 0xC00B
132 #define MBEDTLS_TLS_ECDH_RSA_WITH_RC4_128_SHA 0xC00C
133 #define MBEDTLS_TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA 0xC00D
134 #define MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA 0xC00E
135 #define MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA 0xC00F
137 #define MBEDTLS_TLS_ECDHE_RSA_WITH_NULL_SHA 0xC010
138 #define MBEDTLS_TLS_ECDHE_RSA_WITH_RC4_128_SHA 0xC011
139 #define MBEDTLS_TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA 0xC012
140 #define MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA 0xC013
141 #define MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA 0xC014
143 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 0xC023
144 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 0xC024
145 #define MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256 0xC025
146 #define MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 0xC026
147 #define MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 0xC027
148 #define MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 0xC028
149 #define MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256 0xC029
150 #define MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 0xC02A
152 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 0xC02B
153 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 0xC02C
154 #define MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 0xC02D
155 #define MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 0xC02E
156 #define MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 0xC02F
157 #define MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 0xC030
158 #define MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256 0xC031
159 #define MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384 0xC032
161 #define MBEDTLS_TLS_ECDHE_PSK_WITH_RC4_128_SHA 0xC033
162 #define MBEDTLS_TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA 0xC034
163 #define MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA 0xC035
164 #define MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA 0xC036
165 #define MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256 0xC037
166 #define MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384 0xC038
167 #define MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA 0xC039
168 #define MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA256 0xC03A
169 #define MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA384 0xC03B
171 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 0xC072
172 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 0xC073
173 #define MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 0xC074
174 #define MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 0xC075
175 #define MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 0xC076
176 #define MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 0xC077
177 #define MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 0xC078
178 #define MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 0xC079
180 #define MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256 0xC07A
181 #define MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384 0xC07B
182 #define MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_GCM_SHA256 0xC07C
183 #define MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_GCM_SHA384 0xC07D
184 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 0xC086
185 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 0xC087
186 #define MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 0xC088
187 #define MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 0xC089
188 #define MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_GCM_SHA256 0xC08A
189 #define MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_GCM_SHA384 0xC08B
190 #define MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256 0xC08C
191 #define MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384 0xC08D
193 #define MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256 0xC08E
194 #define MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384 0xC08F
195 #define MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_128_GCM_SHA256 0xC090
196 #define MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_256_GCM_SHA384 0xC091
197 #define MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_GCM_SHA256 0xC092
198 #define MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_256_GCM_SHA384 0xC093
200 #define MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256 0xC094
201 #define MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384 0xC095
202 #define MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 0xC096
203 #define MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 0xC097
204 #define MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 0xC098
205 #define MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 0xC099
206 #define MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 0xC09A
207 #define MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 0xC09B
209 #define MBEDTLS_TLS_RSA_WITH_AES_128_CCM 0xC09C
210 #define MBEDTLS_TLS_RSA_WITH_AES_256_CCM 0xC09D
211 #define MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CCM 0xC09E
212 #define MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CCM 0xC09F
213 #define MBEDTLS_TLS_RSA_WITH_AES_128_CCM_8 0xC0A0
214 #define MBEDTLS_TLS_RSA_WITH_AES_256_CCM_8 0xC0A1
215 #define MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CCM_8 0xC0A2
216 #define MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CCM_8 0xC0A3
217 #define MBEDTLS_TLS_PSK_WITH_AES_128_CCM 0xC0A4
218 #define MBEDTLS_TLS_PSK_WITH_AES_256_CCM 0xC0A5
219 #define MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CCM 0xC0A6
220 #define MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CCM 0xC0A7
221 #define MBEDTLS_TLS_PSK_WITH_AES_128_CCM_8 0xC0A8
222 #define MBEDTLS_TLS_PSK_WITH_AES_256_CCM_8 0xC0A9
223 #define MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CCM_8 0xC0AA
224 #define MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CCM_8 0xC0AB
225 /* The last two are named with PSK_DHE in the RFC, which looks like a typo */
226 
227 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CCM 0xC0AC
228 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CCM 0xC0AD
229 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 0xC0AE
230 #define MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CCM_8 0xC0AF
232 #define MBEDTLS_TLS_ECJPAKE_WITH_AES_128_CCM_8 0xC0FF
234 /* Reminder: update mbedtls_ssl_premaster_secret when adding a new key exchange.
235  * Reminder: update MBEDTLS_KEY_EXCHANGE__xxx below
236  */
237 typedef enum {
251 
252 /* Key exchanges using a certificate */
253 #if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) || \
254  defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) || \
255  defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \
256  defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \
257  defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED) || \
258  defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \
259  defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED)
260 #define MBEDTLS_KEY_EXCHANGE__WITH_CERT__ENABLED
261 #endif
262 
263 /* Key exchanges using a PSK */
264 #if defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED) || \
265  defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED) || \
266  defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED) || \
267  defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED)
268 #define MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED
269 #endif
270 
271 /* Key exchanges using a ECDHE */
272 #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \
273  defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \
274  defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED)
275 #define MBEDTLS_KEY_EXCHANGE__SOME__ECDHE_ENABLED
276 #endif
277 
279 
280 #define MBEDTLS_CIPHERSUITE_WEAK 0x01
281 #define MBEDTLS_CIPHERSUITE_SHORT_TAG 0x02
283 #define MBEDTLS_CIPHERSUITE_NODTLS 0x04
288 struct mbedtls_ssl_ciphersuite_t
289 {
290  int id;
291  const char * name;
297  int min_major_ver;
302  unsigned char flags;
303 };
304 
305 const int *mbedtls_ssl_list_ciphersuites( void );
306 
307 const mbedtls_ssl_ciphersuite_t *mbedtls_ssl_ciphersuite_from_string( const char *ciphersuite_name );
309 
310 #if defined(MBEDTLS_PK_C)
311 mbedtls_pk_type_t mbedtls_ssl_get_ciphersuite_sig_pk_alg( const mbedtls_ssl_ciphersuite_t *info );
312 #endif
313 
316 
317 #ifdef __cplusplus
318 }
319 #endif
320 
321 #endif /* ssl_ciphersuites.h */
const mbedtls_ssl_ciphersuite_t * mbedtls_ssl_ciphersuite_from_id(int ciphersuite_id)
int mbedtls_ssl_ciphersuite_uses_psk(const mbedtls_ssl_ciphersuite_t *info)
mbedtls_pk_type_t
Public key types.
Definition: pk.h:74
mbedtls_cipher_type_t
Definition: cipher.h:79
const int * mbedtls_ssl_list_ciphersuites(void)
Public Key abstraction layer.
mbedtls_cipher_type_t cipher
mbedtls_key_exchange_type_t key_exchange
mbedtls_key_exchange_type_t
Generic cipher wrapper.
This structure is used for storing ciphersuite information.
Generic message digest wrapper.
int mbedtls_ssl_ciphersuite_uses_ec(const mbedtls_ssl_ciphersuite_t *info)
const mbedtls_ssl_ciphersuite_t * mbedtls_ssl_ciphersuite_from_string(const char *ciphersuite_name)
mbedtls_md_type_t
Definition: md.h:39