OLD | NEW |
1 diff --git a/ssl/ssl3con.c b/ssl/ssl3con.c | 1 diff --git a/lib/ssl/ssl3con.c b/lib/ssl/ssl3con.c |
2 index dabe333..6819b03 100644 | 2 index 299e414..2533679 100644 |
3 --- a/ssl/ssl3con.c | 3 --- a/lib/ssl/ssl3con.c |
4 +++ b/ssl/ssl3con.c | 4 +++ b/lib/ssl/ssl3con.c |
5 @@ -41,6 +41,21 @@ | 5 @@ -43,6 +43,21 @@ |
6 #define CKM_NSS_TLS_MASTER_KEY_DERIVE_DH_SHA256 (CKM_NSS + 24) | 6 #define CKM_NSS_TLS_MASTER_KEY_DERIVE_DH_SHA256 (CKM_NSS + 24) |
7 #endif | 7 #endif |
8 | 8 |
9 +/* This is a bodge to allow this code to be compiled against older NSS | 9 +/* This is a bodge to allow this code to be compiled against older NSS |
10 + * headers. */ | 10 + * headers. */ |
11 +#ifndef CKM_NSS_CHACHA20_POLY1305 | 11 +#ifndef CKM_NSS_CHACHA20_POLY1305 |
12 +#define CKM_NSS_CHACHA20_POLY1305 (CKM_NSS + 26) | 12 +#define CKM_NSS_CHACHA20_POLY1305 (CKM_NSS + 26) |
13 + | 13 + |
14 +typedef struct CK_NSS_AEAD_PARAMS { | 14 +typedef struct CK_NSS_AEAD_PARAMS { |
15 + CK_BYTE_PTR pIv; /* This is the nonce. */ | 15 + CK_BYTE_PTR pIv; /* This is the nonce. */ |
16 + CK_ULONG ulIvLen; | 16 + CK_ULONG ulIvLen; |
17 + CK_BYTE_PTR pAAD; | 17 + CK_BYTE_PTR pAAD; |
18 + CK_ULONG ulAADLen; | 18 + CK_ULONG ulAADLen; |
19 + CK_ULONG ulTagLen; | 19 + CK_ULONG ulTagLen; |
20 +} CK_NSS_AEAD_PARAMS; | 20 +} CK_NSS_AEAD_PARAMS; |
21 + | 21 + |
22 +#endif | 22 +#endif |
23 + | 23 + |
24 #include <stdio.h> | 24 #include <stdio.h> |
25 #ifdef NSS_ENABLE_ZLIB | 25 #ifdef NSS_ENABLE_ZLIB |
26 #include "zlib.h" | 26 #include "zlib.h" |
27 @@ -105,6 +120,8 @@ static ssl3CipherSuiteCfg cipherSuites[ssl_V3_SUITES_IMPLEME
NTED] = { | 27 @@ -110,6 +125,8 @@ static ssl3CipherSuiteCfg cipherSuites[ssl_V3_SUITES_IMPLEME
NTED] = { |
28 /* cipher_suite policy enabled isPresent */ | 28 /* cipher_suite policy enabled isPresent */ |
29 | 29 |
30 #ifndef NSS_DISABLE_ECC | 30 #ifndef NSS_DISABLE_ECC |
31 + { TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305, SSL_ALLOWED, PR_FALSE, PR_FALSE}, | 31 + { TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305, SSL_ALLOWED, PR_FALSE, PR_FALSE}, |
32 + { TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305, SSL_ALLOWED, PR_FALSE, PR_FALSE}, | 32 + { TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305, SSL_ALLOWED, PR_FALSE, PR_FALSE}, |
33 { TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, SSL_ALLOWED, PR_FALSE, PR_FALSE}, | 33 { TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, SSL_ALLOWED, PR_TRUE, PR_FALSE}, |
34 { TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, SSL_ALLOWED, PR_FALSE, PR_FALSE}, | 34 { TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, SSL_ALLOWED, PR_TRUE, PR_FALSE}, |
35 /* TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA is out of order to work around | 35 /* TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA is out of order to work around |
36 @@ -296,6 +313,7 @@ static const ssl3BulkCipherDef bulk_cipher_defs[] = { | 36 @@ -307,6 +324,7 @@ static const ssl3BulkCipherDef bulk_cipher_defs[] = { |
37 {cipher_camellia_256, calg_camellia, 32,32, type_block, 16,16, 0, 0}, | 37 {cipher_camellia_256, calg_camellia, 32,32, type_block, 16,16, 0, 0}, |
38 {cipher_seed, calg_seed, 16,16, type_block, 16,16, 0, 0}, | 38 {cipher_seed, calg_seed, 16,16, type_block, 16,16, 0, 0}, |
39 {cipher_aes_128_gcm, calg_aes_gcm, 16,16, type_aead, 4, 0,16, 8}, | 39 {cipher_aes_128_gcm, calg_aes_gcm, 16,16, type_aead, 4, 0,16, 8}, |
40 + {cipher_chacha20, calg_chacha20, 32,32, type_aead, 0, 0,16, 0}, | 40 + {cipher_chacha20, calg_chacha20, 32,32, type_aead, 0, 0,16, 0}, |
41 {cipher_missing, calg_null, 0, 0, type_stream, 0, 0, 0, 0}, | 41 {cipher_missing, calg_null, 0, 0, type_stream, 0, 0, 0, 0}, |
42 }; | 42 }; |
43 | 43 |
44 @@ -422,6 +440,8 @@ static const ssl3CipherSuiteDef cipher_suite_defs[] = | 44 @@ -433,6 +451,8 @@ static const ssl3CipherSuiteDef cipher_suite_defs[] = |
45 {TLS_RSA_WITH_AES_128_GCM_SHA256, cipher_aes_128_gcm, mac_aead, kea_rsa}, | 45 {TLS_RSA_WITH_AES_128_GCM_SHA256, cipher_aes_128_gcm, mac_aead, kea_rsa}, |
46 {TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, cipher_aes_128_gcm, mac_aead, kea_e
cdhe_rsa}, | 46 {TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, cipher_aes_128_gcm, mac_aead, kea_e
cdhe_rsa}, |
47 {TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, cipher_aes_128_gcm, mac_aead, kea
_ecdhe_ecdsa}, | 47 {TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, cipher_aes_128_gcm, mac_aead, kea
_ecdhe_ecdsa}, |
48 + {TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305, cipher_chacha20, mac_aead, kea_ecdhe
_rsa}, | 48 + {TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305, cipher_chacha20, mac_aead, kea_ecdhe
_rsa}, |
49 + {TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305, cipher_chacha20, mac_aead, kea_ecd
he_ecdsa}, | 49 + {TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305, cipher_chacha20, mac_aead, kea_ecd
he_ecdsa}, |
50 | 50 |
51 #ifndef NSS_DISABLE_ECC | 51 {TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, cipher_aes_128_gcm, mac_aead, kea_dhe
_dss}, |
52 {TLS_ECDH_ECDSA_WITH_NULL_SHA, cipher_null, mac_sha, kea_ecdh_ecdsa}
, | 52 {TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, cipher_aes_128, hmac_sha256, kea_dhe_
dss}, |
53 @@ -487,6 +507,7 @@ static const SSLCipher2Mech alg2Mech[] = { | 53 @@ -502,6 +522,7 @@ static const SSLCipher2Mech alg2Mech[] = { |
54 { calg_camellia , CKM_CAMELLIA_CBC }, | 54 { calg_camellia , CKM_CAMELLIA_CBC }, |
55 { calg_seed , CKM_SEED_CBC }, | 55 { calg_seed , CKM_SEED_CBC }, |
56 { calg_aes_gcm , CKM_AES_GCM }, | 56 { calg_aes_gcm , CKM_AES_GCM }, |
57 + { calg_chacha20 , CKM_NSS_CHACHA20_POLY1305 }, | 57 + { calg_chacha20 , CKM_NSS_CHACHA20_POLY1305 }, |
58 /* { calg_init , (CK_MECHANISM_TYPE)0x7fffffffL } */ | 58 /* { calg_init , (CK_MECHANISM_TYPE)0x7fffffffL } */ |
59 }; | 59 }; |
60 | 60 |
61 @@ -662,6 +683,8 @@ ssl3_CipherSuiteAllowedForVersionRange( | 61 @@ -679,6 +700,8 @@ ssl3_CipherSuiteAllowedForVersionRange( |
62 case TLS_RSA_WITH_NULL_SHA256: | 62 case TLS_RSA_WITH_NULL_SHA256: |
63 return vrange->max == SSL_LIBRARY_VERSION_TLS_1_2; | 63 return vrange->max == SSL_LIBRARY_VERSION_TLS_1_2; |
64 | 64 |
65 + case TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305: | 65 + case TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305: |
66 + case TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305: | 66 + case TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305: |
67 case TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256: | 67 case TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256: |
68 case TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256: | 68 case TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256: |
69 case TLS_DHE_RSA_WITH_AES_128_GCM_SHA256: | 69 case TLS_DHE_RSA_WITH_AES_128_GCM_SHA256: |
70 @@ -2070,6 +2093,46 @@ ssl3_AESGCMBypass(ssl3KeyMaterial *keys, | 70 @@ -2093,6 +2116,46 @@ ssl3_AESGCMBypass(ssl3KeyMaterial *keys, |
71 } | 71 } |
72 #endif | 72 #endif |
73 | 73 |
74 +static SECStatus | 74 +static SECStatus |
75 +ssl3_ChaCha20Poly1305( | 75 +ssl3_ChaCha20Poly1305( |
76 + ssl3KeyMaterial *keys, | 76 + ssl3KeyMaterial *keys, |
77 + PRBool doDecrypt, | 77 + PRBool doDecrypt, |
78 + unsigned char *out, | 78 + unsigned char *out, |
79 + int *outlen, | 79 + int *outlen, |
80 + int maxout, | 80 + int maxout, |
(...skipping 26 matching lines...) Expand all Loading... |
107 + out, &uOutLen, maxout, in, inlen); | 107 + out, &uOutLen, maxout, in, inlen); |
108 + } | 108 + } |
109 + *outlen = (int) uOutLen; | 109 + *outlen = (int) uOutLen; |
110 + | 110 + |
111 + return rv; | 111 + return rv; |
112 +} | 112 +} |
113 + | 113 + |
114 /* Initialize encryption and MAC contexts for pending spec. | 114 /* Initialize encryption and MAC contexts for pending spec. |
115 * Master Secret already is derived. | 115 * Master Secret already is derived. |
116 * Caller holds Spec write lock. | 116 * Caller holds Spec write lock. |
117 @@ -2103,13 +2166,17 @@ ssl3_InitPendingContextsPKCS11(sslSocket *ss) | 117 @@ -2126,13 +2189,17 @@ ssl3_InitPendingContextsPKCS11(sslSocket *ss) |
118 pwSpec->client.write_mac_context = NULL; | 118 pwSpec->client.write_mac_context = NULL; |
119 pwSpec->server.write_mac_context = NULL; | 119 pwSpec->server.write_mac_context = NULL; |
120 | 120 |
121 - if (calg == calg_aes_gcm) { | 121 - if (calg == calg_aes_gcm) { |
122 + if (calg == calg_aes_gcm || calg == calg_chacha20) { | 122 + if (calg == calg_aes_gcm || calg == calg_chacha20) { |
123 pwSpec->encode = NULL; | 123 pwSpec->encode = NULL; |
124 pwSpec->decode = NULL; | 124 pwSpec->decode = NULL; |
125 pwSpec->destroy = NULL; | 125 pwSpec->destroy = NULL; |
126 pwSpec->encodeContext = NULL; | 126 pwSpec->encodeContext = NULL; |
127 pwSpec->decodeContext = NULL; | 127 pwSpec->decodeContext = NULL; |
128 - pwSpec->aead = ssl3_AESGCM; | 128 - pwSpec->aead = ssl3_AESGCM; |
129 + if (calg == calg_aes_gcm) { | 129 + if (calg == calg_aes_gcm) { |
130 + pwSpec->aead = ssl3_AESGCM; | 130 + pwSpec->aead = ssl3_AESGCM; |
131 + } else { | 131 + } else { |
132 + pwSpec->aead = ssl3_ChaCha20Poly1305; | 132 + pwSpec->aead = ssl3_ChaCha20Poly1305; |
133 + } | 133 + } |
134 return SECSuccess; | 134 return SECSuccess; |
135 } | 135 } |
136 | 136 |
137 diff --git a/ssl/ssl3ecc.c b/ssl/ssl3ecc.c | 137 diff --git a/lib/ssl/ssl3ecc.c b/lib/ssl/ssl3ecc.c |
138 index 9b91270..31e0774 100644 | 138 index cf8e741..ab5ab14 100644 |
139 --- a/ssl/ssl3ecc.c | 139 --- a/lib/ssl/ssl3ecc.c |
140 +++ b/ssl/ssl3ecc.c | 140 +++ b/lib/ssl/ssl3ecc.c |
141 @@ -921,6 +921,7 @@ static const ssl3CipherSuite ecdhe_ecdsa_suites[] = { | 141 @@ -926,6 +926,7 @@ static const ssl3CipherSuite ecdhe_ecdsa_suites[] = { |
142 TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, | 142 TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, |
143 TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, | 143 TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, |
144 TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, | 144 TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, |
145 + TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305, | 145 + TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305, |
146 TLS_ECDHE_ECDSA_WITH_NULL_SHA, | 146 TLS_ECDHE_ECDSA_WITH_NULL_SHA, |
147 TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, | 147 TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, |
148 0 /* end of list marker */ | 148 0 /* end of list marker */ |
149 @@ -932,6 +933,7 @@ static const ssl3CipherSuite ecdhe_rsa_suites[] = { | 149 @@ -937,6 +938,7 @@ static const ssl3CipherSuite ecdhe_rsa_suites[] = { |
150 TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, | 150 TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, |
151 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, | 151 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, |
152 TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, | 152 TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, |
153 + TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305, | 153 + TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305, |
154 TLS_ECDHE_RSA_WITH_NULL_SHA, | 154 TLS_ECDHE_RSA_WITH_NULL_SHA, |
155 TLS_ECDHE_RSA_WITH_RC4_128_SHA, | 155 TLS_ECDHE_RSA_WITH_RC4_128_SHA, |
156 0 /* end of list marker */ | 156 0 /* end of list marker */ |
157 @@ -944,6 +946,7 @@ static const ssl3CipherSuite ecSuites[] = { | 157 @@ -949,6 +951,7 @@ static const ssl3CipherSuite ecSuites[] = { |
158 TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, | 158 TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, |
159 TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, | 159 TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, |
160 TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, | 160 TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, |
161 + TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305, | 161 + TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305, |
162 TLS_ECDHE_ECDSA_WITH_NULL_SHA, | 162 TLS_ECDHE_ECDSA_WITH_NULL_SHA, |
163 TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, | 163 TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, |
164 TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, | 164 TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, |
165 @@ -951,6 +954,7 @@ static const ssl3CipherSuite ecSuites[] = { | 165 @@ -956,6 +959,7 @@ static const ssl3CipherSuite ecSuites[] = { |
166 TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, | 166 TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, |
167 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, | 167 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, |
168 TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, | 168 TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, |
169 + TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305, | 169 + TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305, |
170 TLS_ECDHE_RSA_WITH_NULL_SHA, | 170 TLS_ECDHE_RSA_WITH_NULL_SHA, |
171 TLS_ECDHE_RSA_WITH_RC4_128_SHA, | 171 TLS_ECDHE_RSA_WITH_RC4_128_SHA, |
172 TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA, | 172 TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA, |
173 diff --git a/ssl/sslenum.c b/ssl/sslenum.c | 173 diff --git a/lib/ssl/sslenum.c b/lib/ssl/sslenum.c |
174 index 09ce43f..a036627 100644 | 174 index f69aed2..b4a8844 100644 |
175 --- a/ssl/sslenum.c | 175 --- a/lib/ssl/sslenum.c |
176 +++ b/ssl/sslenum.c | 176 +++ b/lib/ssl/sslenum.c |
177 @@ -37,17 +37,21 @@ | 177 @@ -37,17 +37,21 @@ |
178 * | 178 * |
179 * Exception: Because some servers ignore the high-order byte of the cipher | 179 * Exception: Because some servers ignore the high-order byte of the cipher |
180 * suite ID, we must be careful about adding cipher suites with IDs larger | 180 * suite ID, we must be careful about adding cipher suites with IDs larger |
181 - * than 0x00ff; see bug 946147. For these broken servers, the first four cipher | 181 - * than 0x00ff; see bug 946147. For these broken servers, the first four cipher |
182 + * than 0x00ff; see bug 946147. For these broken servers, the first six cipher | 182 + * than 0x00ff; see bug 946147. For these broken servers, the first six cipher |
183 * suites, with the MSB zeroed, look like: | 183 * suites, with the MSB zeroed, look like: |
184 + * TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA { 0x00,0x14 } | 184 + * TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA { 0x00,0x14 } |
185 + * TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA { 0x00,0x13 } | 185 + * TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA { 0x00,0x13 } |
186 * TLS_KRB5_EXPORT_WITH_RC4_40_MD5 { 0x00,0x2B } | 186 * TLS_KRB5_EXPORT_WITH_RC4_40_MD5 { 0x00,0x2B } |
187 * TLS_RSA_WITH_AES_128_CBC_SHA { 0x00,0x2F } | 187 * TLS_RSA_WITH_AES_128_CBC_SHA { 0x00,0x2F } |
188 * TLS_RSA_WITH_3DES_EDE_CBC_SHA { 0x00,0x0A } | 188 * TLS_RSA_WITH_3DES_EDE_CBC_SHA { 0x00,0x0A } |
189 * TLS_RSA_WITH_DES_CBC_SHA { 0x00,0x09 } | 189 * TLS_RSA_WITH_DES_CBC_SHA { 0x00,0x09 } |
190 - * The broken server only supports the third and fourth ones and will select | 190 - * The broken server only supports the third and fourth ones and will select |
191 - * the third one. | 191 - * the third one. |
192 + * The broken server only supports the fifth and sixth ones and will select | 192 + * The broken server only supports the fifth and sixth ones and will select |
193 + * the fifth one. | 193 + * the fifth one. |
194 */ | 194 */ |
195 const PRUint16 SSL_ImplementedCiphers[] = { | 195 const PRUint16 SSL_ImplementedCiphers[] = { |
196 #ifndef NSS_DISABLE_ECC | 196 #ifndef NSS_DISABLE_ECC |
197 + TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305, | 197 + TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305, |
198 + TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305, | 198 + TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305, |
199 TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, | 199 TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, |
200 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, | 200 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, |
201 /* TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA must appear before | 201 /* TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA must appear before |
202 diff --git a/ssl/sslimpl.h b/ssl/sslimpl.h | 202 diff --git a/lib/ssl/sslimpl.h b/lib/ssl/sslimpl.h |
203 index ea71975..88b2eba 100644 | 203 index 60dd243..d5f326f 100644 |
204 --- a/ssl/sslimpl.h | 204 --- a/lib/ssl/sslimpl.h |
205 +++ b/ssl/sslimpl.h | 205 +++ b/lib/ssl/sslimpl.h |
206 @@ -65,6 +65,7 @@ typedef SSLSignType SSL3SignType; | 206 @@ -66,6 +66,7 @@ typedef SSLSignType SSL3SignType; |
207 #define calg_camellia ssl_calg_camellia | 207 #define calg_camellia ssl_calg_camellia |
208 #define calg_seed ssl_calg_seed | 208 #define calg_seed ssl_calg_seed |
209 #define calg_aes_gcm ssl_calg_aes_gcm | 209 #define calg_aes_gcm ssl_calg_aes_gcm |
210 +#define calg_chacha20 ssl_calg_chacha20 | 210 +#define calg_chacha20 ssl_calg_chacha20 |
211 | 211 |
212 #define mac_null ssl_mac_null | 212 #define mac_null ssl_mac_null |
213 #define mac_md5 ssl_mac_md5 | 213 #define mac_md5 ssl_mac_md5 |
214 @@ -299,7 +300,7 @@ typedef struct { | 214 @@ -301,7 +302,7 @@ typedef struct { |
215 } ssl3CipherSuiteCfg; | 215 } ssl3CipherSuiteCfg; |
216 | 216 |
217 #ifndef NSS_DISABLE_ECC | 217 #ifndef NSS_DISABLE_ECC |
218 -#define ssl_V3_SUITES_IMPLEMENTED 61 | 218 -#define ssl_V3_SUITES_IMPLEMENTED 64 |
219 +#define ssl_V3_SUITES_IMPLEMENTED 63 | 219 +#define ssl_V3_SUITES_IMPLEMENTED 66 |
220 #else | 220 #else |
221 #define ssl_V3_SUITES_IMPLEMENTED 37 | 221 #define ssl_V3_SUITES_IMPLEMENTED 40 |
222 #endif /* NSS_DISABLE_ECC */ | 222 #endif /* NSS_DISABLE_ECC */ |
223 @@ -485,6 +486,7 @@ typedef enum { | 223 @@ -495,6 +496,7 @@ typedef enum { |
224 cipher_camellia_256, | 224 cipher_camellia_256, |
225 cipher_seed, | 225 cipher_seed, |
226 cipher_aes_128_gcm, | 226 cipher_aes_128_gcm, |
227 + cipher_chacha20, | 227 + cipher_chacha20, |
228 cipher_missing /* reserved for no such supported cipher */ | 228 cipher_missing /* reserved for no such supported cipher */ |
229 /* This enum must match ssl3_cipherName[] in ssl3con.c. */ | 229 /* This enum must match ssl3_cipherName[] in ssl3con.c. */ |
230 } SSL3BulkCipher; | 230 } SSL3BulkCipher; |
231 diff --git a/ssl/sslinfo.c b/ssl/sslinfo.c | 231 diff --git a/lib/ssl/sslinfo.c b/lib/ssl/sslinfo.c |
232 index ba230d2..845d9f0 100644 | 232 index 7048eb8..bef3190 100644 |
233 --- a/ssl/sslinfo.c | 233 --- a/lib/ssl/sslinfo.c |
234 +++ b/ssl/sslinfo.c | 234 +++ b/lib/ssl/sslinfo.c |
235 @@ -110,6 +110,7 @@ SSL_GetChannelInfo(PRFileDesc *fd, SSLChannelInfo *info, PRU
intn len) | 235 @@ -148,6 +148,7 @@ SSL_GetPreliminaryChannelInfo(PRFileDesc *fd, |
236 #define C_NULL "NULL", calg_null | 236 #define C_NULL "NULL", calg_null |
237 #define C_SJ "SKIPJACK", calg_sj | 237 #define C_SJ "SKIPJACK", calg_sj |
238 #define C_AESGCM "AES-GCM", calg_aes_gcm | 238 #define C_AESGCM "AES-GCM", calg_aes_gcm |
239 +#define C_CHACHA20 "CHACHA20POLY1305", calg_chacha20 | 239 +#define C_CHACHA20 "CHACHA20POLY1305", calg_chacha20 |
240 | 240 |
241 #define B_256 256, 256, 256 | 241 #define B_256 256, 256, 256 |
242 #define B_128 128, 128, 128 | 242 #define B_128 128, 128, 128 |
243 @@ -188,12 +189,14 @@ static const SSLCipherSuiteInfo suiteInfo[] = { | 243 @@ -229,12 +230,14 @@ static const SSLCipherSuiteInfo suiteInfo[] = { |
244 {0,CS(TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA), S_ECDSA, K_ECDHE, C_AES, B_128, M
_SHA, 1, 0, 0, }, | 244 {0,CS(TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA), S_ECDSA, K_ECDHE, C_AES, B_128, M
_SHA, 1, 0, 0, }, |
245 {0,CS(TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256), S_ECDSA, K_ECDHE, C_AES, B_128,
M_SHA256, 1, 0, 0, }, | 245 {0,CS(TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256), S_ECDSA, K_ECDHE, C_AES, B_128,
M_SHA256, 1, 0, 0, }, |
246 {0,CS(TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA), S_ECDSA, K_ECDHE, C_AES, B_256, M
_SHA, 1, 0, 0, }, | 246 {0,CS(TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA), S_ECDSA, K_ECDHE, C_AES, B_256, M
_SHA, 1, 0, 0, }, |
247 +{0,CS(TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305),S_ECDSA,K_ECDHE,C_CHACHA20,B_256,
M_AEAD_128,0, 0, 0, }, | 247 +{0,CS(TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305),S_ECDSA,K_ECDHE,C_CHACHA20,B_256,
M_AEAD_128,0, 0, 0, }, |
248 | 248 |
249 {0,CS(TLS_ECDH_RSA_WITH_NULL_SHA), S_RSA, K_ECDH, C_NULL, B_0, M_SHA
, 0, 0, 0, }, | 249 {0,CS(TLS_ECDH_RSA_WITH_NULL_SHA), S_RSA, K_ECDH, C_NULL, B_0, M_SHA
, 0, 0, 0, }, |
250 {0,CS(TLS_ECDH_RSA_WITH_RC4_128_SHA), S_RSA, K_ECDH, C_RC4, B_128, M_SH
A, 0, 0, 0, }, | 250 {0,CS(TLS_ECDH_RSA_WITH_RC4_128_SHA), S_RSA, K_ECDH, C_RC4, B_128, M_SH
A, 0, 0, 0, }, |
251 {0,CS(TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA), S_RSA, K_ECDH, C_3DES, B_3DES, M_
SHA, 1, 0, 0, }, | 251 {0,CS(TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA), S_RSA, K_ECDH, C_3DES, B_3DES, M_
SHA, 1, 0, 0, }, |
252 {0,CS(TLS_ECDH_RSA_WITH_AES_128_CBC_SHA), S_RSA, K_ECDH, C_AES, B_128, M_SH
A, 1, 0, 0, }, | 252 {0,CS(TLS_ECDH_RSA_WITH_AES_128_CBC_SHA), S_RSA, K_ECDH, C_AES, B_128, M_SH
A, 1, 0, 0, }, |
253 {0,CS(TLS_ECDH_RSA_WITH_AES_256_CBC_SHA), S_RSA, K_ECDH, C_AES, B_256, M_SH
A, 1, 0, 0, }, | 253 {0,CS(TLS_ECDH_RSA_WITH_AES_256_CBC_SHA), S_RSA, K_ECDH, C_AES, B_256, M_SH
A, 1, 0, 0, }, |
254 +{0,CS(TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305), S_RSA,K_ECDHE,C_CHACHA20,B_256,M_
AEAD_128, 0, 0, 0, }, | 254 +{0,CS(TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305), S_RSA,K_ECDHE,C_CHACHA20,B_256,M_
AEAD_128, 0, 0, 0, }, |
255 | 255 |
256 {0,CS(TLS_ECDHE_RSA_WITH_NULL_SHA), S_RSA, K_ECDHE, C_NULL, B_0, M_SH
A, 0, 0, 0, }, | 256 {0,CS(TLS_ECDHE_RSA_WITH_NULL_SHA), S_RSA, K_ECDHE, C_NULL, B_0, M_SH
A, 0, 0, 0, }, |
257 {0,CS(TLS_ECDHE_RSA_WITH_RC4_128_SHA), S_RSA, K_ECDHE, C_RC4, B_128, M_S
HA, 0, 0, 0, }, | 257 {0,CS(TLS_ECDHE_RSA_WITH_RC4_128_SHA), S_RSA, K_ECDHE, C_RC4, B_128, M_S
HA, 0, 0, 0, }, |
258 diff --git a/ssl/sslproto.h b/ssl/sslproto.h | 258 diff --git a/lib/ssl/sslproto.h b/lib/ssl/sslproto.h |
259 index e02442c..dc653c9 100644 | 259 index 2db47a5..36ae6c9 100644 |
260 --- a/ssl/sslproto.h | 260 --- a/lib/ssl/sslproto.h |
261 +++ b/ssl/sslproto.h | 261 +++ b/lib/ssl/sslproto.h |
262 @@ -258,6 +258,9 @@ | 262 @@ -260,6 +260,9 @@ |
263 #define TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 0xC02F | 263 #define TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 0xC02F |
264 #define TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256 0xC031 | 264 #define TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256 0xC031 |
265 | 265 |
266 +#define TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 0xCC13 | 266 +#define TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 0xCC13 |
267 +#define TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 0xCC14 | 267 +#define TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 0xCC14 |
268 + | 268 + |
269 /* Netscape "experimental" cipher suites. */ | 269 /* Netscape "experimental" cipher suites. */ |
270 #define SSL_RSA_OLDFIPS_WITH_3DES_EDE_CBC_SHA 0xffe0 | 270 #define SSL_RSA_OLDFIPS_WITH_3DES_EDE_CBC_SHA 0xffe0 |
271 #define SSL_RSA_OLDFIPS_WITH_DES_CBC_SHA 0xffe1 | 271 #define SSL_RSA_OLDFIPS_WITH_DES_CBC_SHA 0xffe1 |
272 diff --git a/ssl/sslt.h b/ssl/sslt.h | 272 diff --git a/lib/ssl/sslt.h b/lib/ssl/sslt.h |
273 index 430d216..fe0ad07 100644 | 273 index 5593579..a2eff62 100644 |
274 --- a/ssl/sslt.h | 274 --- a/lib/ssl/sslt.h |
275 +++ b/ssl/sslt.h | 275 +++ b/lib/ssl/sslt.h |
276 @@ -94,7 +94,8 @@ typedef enum { | 276 @@ -117,7 +117,8 @@ typedef enum { |
277 ssl_calg_aes = 7, | 277 ssl_calg_aes = 7, |
278 ssl_calg_camellia = 8, | 278 ssl_calg_camellia = 8, |
279 ssl_calg_seed = 9, | 279 ssl_calg_seed = 9, |
280 - ssl_calg_aes_gcm = 10 | 280 - ssl_calg_aes_gcm = 10 |
281 + ssl_calg_aes_gcm = 10, | 281 + ssl_calg_aes_gcm = 10, |
282 + ssl_calg_chacha20 = 11 | 282 + ssl_calg_chacha20 = 11 |
283 } SSLCipherAlgorithm; | 283 } SSLCipherAlgorithm; |
284 | 284 |
285 typedef enum { | 285 typedef enum { |
OLD | NEW |