OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Table enumerating all implemented cipher suites | 2 * Table enumerating all implemented cipher suites |
3 * Part of public API. | 3 * Part of public API. |
4 * | 4 * |
5 * This Source Code Form is subject to the terms of the Mozilla Public | 5 * This Source Code Form is subject to the terms of the Mozilla Public |
6 * License, v. 2.0. If a copy of the MPL was not distributed with this | 6 * License, v. 2.0. If a copy of the MPL was not distributed with this |
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 7 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
8 | 8 |
9 #include "ssl.h" | 9 #include "ssl.h" |
10 #include "sslproto.h" | 10 #include "sslproto.h" |
11 | 11 |
12 /* | 12 /* |
13 * The ciphers are listed in the following order: | |
14 * - stronger ciphers before weaker ciphers | |
15 * - national ciphers before international ciphers | |
16 * - faster ciphers before slower ciphers | |
17 * | |
18 * National ciphers such as Camellia are listed before international ciphers | |
19 * such as AES and RC4 to allow servers that prefer Camellia to negotiate | |
20 * Camellia without having to disable AES and RC4, which are needed for | |
21 * interoperability with clients that don't yet implement Camellia. | |
22 * | |
23 * The ordering of cipher suites in this table must match the ordering in | 13 * The ordering of cipher suites in this table must match the ordering in |
24 * the cipherSuites table in ssl3con.c. | 14 * the cipherSuites table in ssl3con.c. |
25 * | 15 * |
26 * If new ECC cipher suites are added, also update the ssl3CipherSuite arrays | 16 * If new ECC cipher suites are added, also update the ssl3CipherSuite arrays |
27 * in ssl3ecc.c. | 17 * in ssl3ecc.c. |
28 * | 18 * |
29 * Finally, update the ssl_V3_SUITES_IMPLEMENTED macro in sslimpl.h. | 19 * Finally, update the ssl_V3_SUITES_IMPLEMENTED macro in sslimpl.h. |
20 * | |
21 * The ordering is as follows: | |
22 * * No-encryption cipher suites last | |
23 * * Export/weak/obsolete cipher suites before no-encryption cipher suites | |
24 * * Order by key exchange algorithm: ECDHE, then DHE, then ECDH, RSA. | |
25 * * Within key agreement sections, order by symmetric encryption algorithm: | |
26 * AES-128, then Camellia-128, then AES-256, then Camellia-256, then SEED, | |
27 * then FIPS-3DES, then 3DES, then RC4. AES is commonly accepted as a | |
28 * strong cipher internationally, and is often hardware-accelerated. | |
29 * Camellia also has wide international support across standards | |
30 * organizations. SEED is only recommended by the Korean government. 3DES | |
31 * only provides 112 bits of security. RC4 is now deprecated or forbidden | |
32 * by many standards organizations. | |
33 * * Within symmetric algorithm sections, order by message authentication | |
34 * algorithm: GCM, then HMAC-SHA1, then HMAC-SHA256, then HMAC-MD5. | |
35 * * Within message authentication algorithm sections, order by asymmetric | |
36 * signature algorithm: ECDSA, then RSA, then DSS. | |
37 * | |
38 * Exception: Because some servers ignore the high-order byte of the cipher | |
39 * suite ID, we must be careful about adding cipher suites with IDs larger | |
40 * than 0x00ff; see bug 946147. For these broken servers, the first four cipher | |
41 * suites, with the MSB zeroed, look like: | |
42 * TLS_KRB5_EXPORT_WITH_RC4_40_MD5 {0x00,0x2B } | |
43 * TLS_RSA_WITH_AES_128_CBC_SHA { 0x00,0x2F } | |
44 * TLS_RSA_WITH_3DES_EDE_CBC_SHA { 0x00,0x0A } | |
45 * TLS_RSA_WITH_DES_CBC_SHA { 0x00,0x09 } | |
46 * The broken server only supports the third and fourth ones and will select | |
47 * the third one. | |
wtc
2014/01/04 22:54:21
This paragraph was written without the two CHACHA2
| |
30 */ | 48 */ |
31 const PRUint16 SSL_ImplementedCiphers[] = { | 49 const PRUint16 SSL_ImplementedCiphers[] = { |
32 /* AES-GCM */ | |
33 #ifdef NSS_ENABLE_ECC | 50 #ifdef NSS_ENABLE_ECC |
34 TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305, | 51 TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305, |
35 TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305, | 52 TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305, |
36 TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, | 53 TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, |
37 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, | 54 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, |
55 /* TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA must appear before | |
56 * TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA to work around bug 946147. | |
57 */ | |
58 TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, | |
59 TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, | |
60 TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, | |
61 TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, | |
62 TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, | |
63 TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, | |
64 TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA, | |
65 TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, | |
66 TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, | |
67 TLS_ECDHE_RSA_WITH_RC4_128_SHA, | |
38 #endif /* NSS_ENABLE_ECC */ | 68 #endif /* NSS_ENABLE_ECC */ |
69 | |
39 TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, | 70 TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, |
40 TLS_RSA_WITH_AES_128_GCM_SHA256, | 71 TLS_DHE_RSA_WITH_AES_128_CBC_SHA, |
41 | 72 TLS_DHE_DSS_WITH_AES_128_CBC_SHA, |
42 /* 256-bit */ | 73 TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, |
43 #ifdef NSS_ENABLE_ECC | 74 TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA, |
44 TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, | 75 TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA, |
45 TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, | 76 TLS_DHE_RSA_WITH_AES_256_CBC_SHA, |
46 #endif /* NSS_ENABLE_ECC */ | 77 TLS_DHE_DSS_WITH_AES_256_CBC_SHA, |
78 TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, | |
47 TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA, | 79 TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA, |
48 TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA, | 80 TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA, |
49 TLS_DHE_RSA_WITH_AES_256_CBC_SHA, | 81 SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA, |
50 TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, | 82 SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA, |
51 TLS_DHE_DSS_WITH_AES_256_CBC_SHA, | 83 TLS_DHE_DSS_WITH_RC4_128_SHA, |
84 | |
52 #ifdef NSS_ENABLE_ECC | 85 #ifdef NSS_ENABLE_ECC |
86 TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, | |
87 TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, | |
88 TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA, | |
53 TLS_ECDH_RSA_WITH_AES_256_CBC_SHA, | 89 TLS_ECDH_RSA_WITH_AES_256_CBC_SHA, |
54 TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA, | 90 TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA, |
91 TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA, | |
92 TLS_ECDH_ECDSA_WITH_RC4_128_SHA, | |
93 TLS_ECDH_RSA_WITH_RC4_128_SHA, | |
55 #endif /* NSS_ENABLE_ECC */ | 94 #endif /* NSS_ENABLE_ECC */ |
56 TLS_RSA_WITH_CAMELLIA_256_CBC_SHA, | 95 |
96 TLS_RSA_WITH_AES_128_GCM_SHA256, | |
97 TLS_RSA_WITH_AES_128_CBC_SHA, | |
98 TLS_RSA_WITH_AES_128_CBC_SHA256, | |
99 TLS_RSA_WITH_CAMELLIA_128_CBC_SHA, | |
57 TLS_RSA_WITH_AES_256_CBC_SHA, | 100 TLS_RSA_WITH_AES_256_CBC_SHA, |
58 TLS_RSA_WITH_AES_256_CBC_SHA256, | 101 TLS_RSA_WITH_AES_256_CBC_SHA256, |
59 | 102 TLS_RSA_WITH_CAMELLIA_256_CBC_SHA, |
60 /* 128-bit */ | |
61 #ifdef NSS_ENABLE_ECC | |
62 TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, | |
63 TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, | |
64 TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, | |
65 TLS_ECDHE_RSA_WITH_RC4_128_SHA, | |
66 TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, | |
67 TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, | |
68 #endif /* NSS_ENABLE_ECC */ | |
69 TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA, | |
70 TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA, | |
71 TLS_DHE_DSS_WITH_RC4_128_SHA, | |
72 TLS_DHE_RSA_WITH_AES_128_CBC_SHA, | |
73 TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, | |
74 TLS_DHE_DSS_WITH_AES_128_CBC_SHA, | |
75 #ifdef NSS_ENABLE_ECC | |
76 TLS_ECDH_RSA_WITH_RC4_128_SHA, | |
77 TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, | |
78 TLS_ECDH_ECDSA_WITH_RC4_128_SHA, | |
79 TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, | |
80 #endif /* NSS_ENABLE_ECC */ | |
81 TLS_RSA_WITH_SEED_CBC_SHA, | 103 TLS_RSA_WITH_SEED_CBC_SHA, |
82 TLS_RSA_WITH_CAMELLIA_128_CBC_SHA, | 104 SSL_RSA_FIPS_WITH_3DES_EDE_CBC_SHA, |
105 SSL_RSA_WITH_3DES_EDE_CBC_SHA, | |
83 SSL_RSA_WITH_RC4_128_SHA, | 106 SSL_RSA_WITH_RC4_128_SHA, |
84 SSL_RSA_WITH_RC4_128_MD5, | 107 SSL_RSA_WITH_RC4_128_MD5, |
85 TLS_RSA_WITH_AES_128_CBC_SHA, | |
86 TLS_RSA_WITH_AES_128_CBC_SHA256, | |
87 | |
88 /* 112-bit 3DES */ | |
89 #ifdef NSS_ENABLE_ECC | |
90 TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA, | |
91 TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, | |
92 #endif /* NSS_ENABLE_ECC */ | |
93 SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA, | |
94 SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA, | |
95 #ifdef NSS_ENABLE_ECC | |
96 TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA, | |
97 TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA, | |
98 #endif /* NSS_ENABLE_ECC */ | |
99 SSL_RSA_FIPS_WITH_3DES_EDE_CBC_SHA, | |
100 SSL_RSA_WITH_3DES_EDE_CBC_SHA, | |
101 | 108 |
102 /* 56-bit DES "domestic" cipher suites */ | 109 /* 56-bit DES "domestic" cipher suites */ |
103 SSL_DHE_RSA_WITH_DES_CBC_SHA, | 110 SSL_DHE_RSA_WITH_DES_CBC_SHA, |
104 SSL_DHE_DSS_WITH_DES_CBC_SHA, | 111 SSL_DHE_DSS_WITH_DES_CBC_SHA, |
105 SSL_RSA_FIPS_WITH_DES_CBC_SHA, | 112 SSL_RSA_FIPS_WITH_DES_CBC_SHA, |
106 SSL_RSA_WITH_DES_CBC_SHA, | 113 SSL_RSA_WITH_DES_CBC_SHA, |
107 | 114 |
108 /* export ciphersuites with 1024-bit public key exchange keys */ | 115 /* export ciphersuites with 1024-bit public key exchange keys */ |
109 TLS_RSA_EXPORT1024_WITH_RC4_56_SHA, | 116 TLS_RSA_EXPORT1024_WITH_RC4_56_SHA, |
110 TLS_RSA_EXPORT1024_WITH_DES_CBC_SHA, | 117 TLS_RSA_EXPORT1024_WITH_DES_CBC_SHA, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
143 SSL_GetImplementedCiphers(void) | 150 SSL_GetImplementedCiphers(void) |
144 { | 151 { |
145 return SSL_ImplementedCiphers; | 152 return SSL_ImplementedCiphers; |
146 } | 153 } |
147 | 154 |
148 PRUint16 | 155 PRUint16 |
149 SSL_GetNumImplementedCiphers(void) | 156 SSL_GetNumImplementedCiphers(void) |
150 { | 157 { |
151 return SSL_NumImplementedCiphers; | 158 return SSL_NumImplementedCiphers; |
152 } | 159 } |
OLD | NEW |