diff options
Diffstat (limited to 'meta')
-rw-r--r-- | meta/recipes-connectivity/openssl/openssl-1.0.1e/openssl-fix-CVE-2014-3566.patch | 502 | ||||
-rw-r--r-- | meta/recipes-connectivity/openssl/openssl_1.0.1e.bb | 1 |
2 files changed, 503 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/openssl/openssl-1.0.1e/openssl-fix-CVE-2014-3566.patch b/meta/recipes-connectivity/openssl/openssl-1.0.1e/openssl-fix-CVE-2014-3566.patch new file mode 100644 index 0000000000..5b8110c380 --- /dev/null +++ b/meta/recipes-connectivity/openssl/openssl-1.0.1e/openssl-fix-CVE-2014-3566.patch | |||
@@ -0,0 +1,502 @@ | |||
1 | From 6bfe55380abbf7528e04e59f18921bd6c896af1c Mon Sep 17 00:00:00 2001 | ||
2 | From: Bodo Moeller <bodo@openssl.org> | ||
3 | Date: Wed, 15 Oct 2014 04:05:42 +0200 | ||
4 | Subject: [PATCH] Support TLS_FALLBACK_SCSV. | ||
5 | |||
6 | Upstream-Status: Backport | ||
7 | |||
8 | Reviewed-by: Rich Salz <rsalz@openssl.org> | ||
9 | Signed-off-by: Catalin Popeanga <catalin.popeanga@enea.com> | ||
10 | --- | ||
11 | CHANGES | 6 +++++ | ||
12 | apps/s_client.c | 10 +++++++++ | ||
13 | crypto/err/openssl.ec | 1 + | ||
14 | ssl/d1_lib.c | 10 +++++++++ | ||
15 | ssl/dtls1.h | 3 ++- | ||
16 | ssl/s23_clnt.c | 3 +++ | ||
17 | ssl/s23_srvr.c | 3 +++ | ||
18 | ssl/s2_lib.c | 4 +++- | ||
19 | ssl/s3_enc.c | 2 +- | ||
20 | ssl/s3_lib.c | 29 +++++++++++++++++++++++- | ||
21 | ssl/ssl.h | 9 ++++++++ | ||
22 | ssl/ssl3.h | 7 +++++- | ||
23 | ssl/ssl_err.c | 2 ++ | ||
24 | ssl/ssl_lib.c | 60 +++++++++++++++++++++++++++++++++++++------------ | ||
25 | ssl/t1_enc.c | 1 + | ||
26 | ssl/tls1.h | 15 ++++++++----- | ||
27 | 16 files changed, 140 insertions(+), 25 deletions(-) | ||
28 | |||
29 | diff --git a/CHANGES b/CHANGES | ||
30 | index 79477f6..c79f4d0 100644 | ||
31 | --- a/CHANGES | ||
32 | +++ b/CHANGES | ||
33 | @@ -2,6 +2,14 @@ | ||
34 | OpenSSL CHANGES | ||
35 | _______________ | ||
36 | |||
37 | + Changes added due to poodle vulnerability | ||
38 | + | ||
39 | + *) Add support for TLS_FALLBACK_SCSV. | ||
40 | + Client applications doing fallback retries should call | ||
41 | + SSL_set_mode(s, SSL_MODE_SEND_FALLBACK_SCSV). | ||
42 | + (CVE-2014-3566) | ||
43 | + [Adam Langley, Bodo Moeller] | ||
44 | + | ||
45 | Changes between 1.0.1d and 1.0.1e [11 Feb 2013] | ||
46 | |||
47 | *) | ||
48 | diff --git a/apps/s_client.c b/apps/s_client.c | ||
49 | index 4625467..c2e160c 100644 | ||
50 | --- a/apps/s_client.c | ||
51 | +++ b/apps/s_client.c | ||
52 | @@ -337,6 +337,7 @@ static void sc_usage(void) | ||
53 | BIO_printf(bio_err," -tls1_1 - just use TLSv1.1\n"); | ||
54 | BIO_printf(bio_err," -tls1 - just use TLSv1\n"); | ||
55 | BIO_printf(bio_err," -dtls1 - just use DTLSv1\n"); | ||
56 | + BIO_printf(bio_err," -fallback_scsv - send TLS_FALLBACK_SCSV\n"); | ||
57 | BIO_printf(bio_err," -mtu - set the link layer MTU\n"); | ||
58 | BIO_printf(bio_err," -no_tls1_2/-no_tls1_1/-no_tls1/-no_ssl3/-no_ssl2 - turn off that protocol\n"); | ||
59 | BIO_printf(bio_err," -bugs - Switch on all SSL implementation bug workarounds\n"); | ||
60 | @@ -617,6 +618,7 @@ int MAIN(int argc, char **argv) | ||
61 | char *sess_out = NULL; | ||
62 | struct sockaddr peer; | ||
63 | int peerlen = sizeof(peer); | ||
64 | + int fallback_scsv = 0; | ||
65 | int enable_timeouts = 0 ; | ||
66 | long socket_mtu = 0; | ||
67 | #ifndef OPENSSL_NO_JPAKE | ||
68 | @@ -823,6 +825,10 @@ int MAIN(int argc, char **argv) | ||
69 | meth=DTLSv1_client_method(); | ||
70 | socket_type=SOCK_DGRAM; | ||
71 | } | ||
72 | + else if (strcmp(*argv,"-fallback_scsv") == 0) | ||
73 | + { | ||
74 | + fallback_scsv = 1; | ||
75 | + } | ||
76 | else if (strcmp(*argv,"-timeout") == 0) | ||
77 | enable_timeouts=1; | ||
78 | else if (strcmp(*argv,"-mtu") == 0) | ||
79 | @@ -1235,6 +1241,10 @@ bad: | ||
80 | SSL_set_session(con, sess); | ||
81 | SSL_SESSION_free(sess); | ||
82 | } | ||
83 | + | ||
84 | + if (fallback_scsv) | ||
85 | + SSL_set_mode(con, SSL_MODE_SEND_FALLBACK_SCSV); | ||
86 | + | ||
87 | #ifndef OPENSSL_NO_TLSEXT | ||
88 | if (servername != NULL) | ||
89 | { | ||
90 | diff --git a/crypto/err/openssl.ec b/crypto/err/openssl.ec | ||
91 | index e0554b4..34754e5 100644 | ||
92 | --- a/crypto/err/openssl.ec | ||
93 | +++ b/crypto/err/openssl.ec | ||
94 | @@ -71,6 +71,7 @@ R SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION 1060 | ||
95 | R SSL_R_TLSV1_ALERT_PROTOCOL_VERSION 1070 | ||
96 | R SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY 1071 | ||
97 | R SSL_R_TLSV1_ALERT_INTERNAL_ERROR 1080 | ||
98 | +R SSL_R_SSLV3_ALERT_INAPPROPRIATE_FALLBACK 1086 | ||
99 | R SSL_R_TLSV1_ALERT_USER_CANCELLED 1090 | ||
100 | R SSL_R_TLSV1_ALERT_NO_RENEGOTIATION 1100 | ||
101 | R SSL_R_TLSV1_UNSUPPORTED_EXTENSION 1110 | ||
102 | diff --git a/ssl/d1_lib.c b/ssl/d1_lib.c | ||
103 | index 6bde16f..82ca653 100644 | ||
104 | --- a/ssl/d1_lib.c | ||
105 | +++ b/ssl/d1_lib.c | ||
106 | @@ -266,6 +266,16 @@ long dtls1_ctrl(SSL *s, int cmd, long larg, void *parg) | ||
107 | case DTLS_CTRL_LISTEN: | ||
108 | ret = dtls1_listen(s, parg); | ||
109 | break; | ||
110 | + case SSL_CTRL_CHECK_PROTO_VERSION: | ||
111 | + /* For library-internal use; checks that the current protocol | ||
112 | + * is the highest enabled version (according to s->ctx->method, | ||
113 | + * as version negotiation may have changed s->method). */ | ||
114 | +#if DTLS_MAX_VERSION != DTLS1_VERSION | ||
115 | +# error Code needs update for DTLS_method() support beyond DTLS1_VERSION. | ||
116 | +#endif | ||
117 | + /* Just one protocol version is supported so far; | ||
118 | + * fail closed if the version is not as expected. */ | ||
119 | + return s->version == DTLS_MAX_VERSION; | ||
120 | |||
121 | default: | ||
122 | ret = ssl3_ctrl(s, cmd, larg, parg); | ||
123 | diff --git a/ssl/dtls1.h b/ssl/dtls1.h | ||
124 | index e65d501..192c5de 100644 | ||
125 | --- a/ssl/dtls1.h | ||
126 | +++ b/ssl/dtls1.h | ||
127 | @@ -84,6 +84,8 @@ extern "C" { | ||
128 | #endif | ||
129 | |||
130 | #define DTLS1_VERSION 0xFEFF | ||
131 | +#define DTLS_MAX_VERSION DTLS1_VERSION | ||
132 | + | ||
133 | #define DTLS1_BAD_VER 0x0100 | ||
134 | |||
135 | #if 0 | ||
136 | @@ -284,4 +286,3 @@ typedef struct dtls1_record_data_st | ||
137 | } | ||
138 | #endif | ||
139 | #endif | ||
140 | - | ||
141 | diff --git a/ssl/s23_clnt.c b/ssl/s23_clnt.c | ||
142 | index 2b93c63..d4e43c3 100644 | ||
143 | --- a/ssl/s23_clnt.c | ||
144 | +++ b/ssl/s23_clnt.c | ||
145 | @@ -736,6 +736,9 @@ static int ssl23_get_server_hello(SSL *s) | ||
146 | goto err; | ||
147 | } | ||
148 | |||
149 | + /* ensure that TLS_MAX_VERSION is up-to-date */ | ||
150 | + OPENSSL_assert(s->version <= TLS_MAX_VERSION); | ||
151 | + | ||
152 | if (p[0] == SSL3_RT_ALERT && p[5] != SSL3_AL_WARNING) | ||
153 | { | ||
154 | /* fatal alert */ | ||
155 | diff --git a/ssl/s23_srvr.c b/ssl/s23_srvr.c | ||
156 | index 2901a6b..567a6b1 100644 | ||
157 | --- a/ssl/s23_srvr.c | ||
158 | +++ b/ssl/s23_srvr.c | ||
159 | @@ -421,6 +421,9 @@ int ssl23_get_client_hello(SSL *s) | ||
160 | } | ||
161 | } | ||
162 | |||
163 | + /* ensure that TLS_MAX_VERSION is up-to-date */ | ||
164 | + OPENSSL_assert(s->version <= TLS_MAX_VERSION); | ||
165 | + | ||
166 | #ifdef OPENSSL_FIPS | ||
167 | if (FIPS_mode() && (s->version < TLS1_VERSION)) | ||
168 | { | ||
169 | diff --git a/ssl/s2_lib.c b/ssl/s2_lib.c | ||
170 | index c0bdae5..c63be30 100644 | ||
171 | --- a/ssl/s2_lib.c | ||
172 | +++ b/ssl/s2_lib.c | ||
173 | @@ -391,6 +391,8 @@ long ssl2_ctrl(SSL *s, int cmd, long larg, void *parg) | ||
174 | case SSL_CTRL_GET_SESSION_REUSED: | ||
175 | ret=s->hit; | ||
176 | break; | ||
177 | + case SSL_CTRL_CHECK_PROTO_VERSION: | ||
178 | + return ssl3_ctrl(s, SSL_CTRL_CHECK_PROTO_VERSION, larg, parg); | ||
179 | default: | ||
180 | break; | ||
181 | } | ||
182 | @@ -437,7 +439,7 @@ int ssl2_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p) | ||
183 | if (p != NULL) | ||
184 | { | ||
185 | l=c->id; | ||
186 | - if ((l & 0xff000000) != 0x02000000) return(0); | ||
187 | + if ((l & 0xff000000) != 0x02000000 && l != SSL3_CK_FALLBACK_SCSV) return(0); | ||
188 | p[0]=((unsigned char)(l>>16L))&0xFF; | ||
189 | p[1]=((unsigned char)(l>> 8L))&0xFF; | ||
190 | p[2]=((unsigned char)(l ))&0xFF; | ||
191 | diff --git a/ssl/s3_enc.c b/ssl/s3_enc.c | ||
192 | index 9962677..9db45af 100644 | ||
193 | --- a/ssl/s3_enc.c | ||
194 | +++ b/ssl/s3_enc.c | ||
195 | @@ -900,7 +900,7 @@ int ssl3_alert_code(int code) | ||
196 | case SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE: return(SSL3_AD_HANDSHAKE_FAILURE); | ||
197 | case SSL_AD_BAD_CERTIFICATE_HASH_VALUE: return(SSL3_AD_HANDSHAKE_FAILURE); | ||
198 | case SSL_AD_UNKNOWN_PSK_IDENTITY:return(TLS1_AD_UNKNOWN_PSK_IDENTITY); | ||
199 | + case SSL_AD_INAPPROPRIATE_FALLBACK:return(TLS1_AD_INAPPROPRIATE_FALLBACK); | ||
200 | default: return(-1); | ||
201 | } | ||
202 | } | ||
203 | - | ||
204 | diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c | ||
205 | index e17f126..3f17453 100644 | ||
206 | --- a/ssl/s3_lib.c | ||
207 | +++ b/ssl/s3_lib.c | ||
208 | @@ -3355,6 +3355,33 @@ long ssl3_ctrl(SSL *s, int cmd, long larg, void *parg) | ||
209 | #endif | ||
210 | |||
211 | #endif /* !OPENSSL_NO_TLSEXT */ | ||
212 | + | ||
213 | + case SSL_CTRL_CHECK_PROTO_VERSION: | ||
214 | + /* For library-internal use; checks that the current protocol | ||
215 | + * is the highest enabled version (according to s->ctx->method, | ||
216 | + * as version negotiation may have changed s->method). */ | ||
217 | + if (s->version == s->ctx->method->version) | ||
218 | + return 1; | ||
219 | + /* Apparently we're using a version-flexible SSL_METHOD | ||
220 | + * (not at its highest protocol version). */ | ||
221 | + if (s->ctx->method->version == SSLv23_method()->version) | ||
222 | + { | ||
223 | +#if TLS_MAX_VERSION != TLS1_2_VERSION | ||
224 | +# error Code needs update for SSLv23_method() support beyond TLS1_2_VERSION. | ||
225 | +#endif | ||
226 | + if (!(s->options & SSL_OP_NO_TLSv1_2)) | ||
227 | + return s->version == TLS1_2_VERSION; | ||
228 | + if (!(s->options & SSL_OP_NO_TLSv1_1)) | ||
229 | + return s->version == TLS1_1_VERSION; | ||
230 | + if (!(s->options & SSL_OP_NO_TLSv1)) | ||
231 | + return s->version == TLS1_VERSION; | ||
232 | + if (!(s->options & SSL_OP_NO_SSLv3)) | ||
233 | + return s->version == SSL3_VERSION; | ||
234 | + if (!(s->options & SSL_OP_NO_SSLv2)) | ||
235 | + return s->version == SSL2_VERSION; | ||
236 | + } | ||
237 | + return 0; /* Unexpected state; fail closed. */ | ||
238 | + | ||
239 | default: | ||
240 | break; | ||
241 | } | ||
242 | @@ -3714,6 +3741,7 @@ long ssl3_ctx_callback_ctrl(SSL_CTX *ctx, int cmd, void (*fp)(void)) | ||
243 | break; | ||
244 | #endif | ||
245 | #endif | ||
246 | + | ||
247 | default: | ||
248 | return(0); | ||
249 | } | ||
250 | @@ -4296,4 +4324,3 @@ long ssl_get_algorithm2(SSL *s) | ||
251 | return SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256; | ||
252 | return alg2; | ||
253 | } | ||
254 | - | ||
255 | diff --git a/ssl/ssl.h b/ssl/ssl.h | ||
256 | index b73da5e..b78a1cc 100644 | ||
257 | --- a/ssl/ssl.h | ||
258 | +++ b/ssl/ssl.h | ||
259 | @@ -642,6 +642,11 @@ | ||
260 | * or just freed (depending on the context's setting for freelist_max_len). */ | ||
261 | #define SSL_MODE_RELEASE_BUFFERS 0x00000010L | ||
262 | |||
263 | +/* Send TLS_FALLBACK_SCSV in the ClientHello. | ||
264 | + * To be set by applications that reconnect with a downgraded protocol | ||
265 | + * version; see draft-ietf-tls-downgrade-scsv-00 for details. */ | ||
266 | +#define SSL_MODE_SEND_FALLBACK_SCSV 0x00000080L | ||
267 | + | ||
268 | /* Note: SSL[_CTX]_set_{options,mode} use |= op on the previous value, | ||
269 | * they cannot be used to clear bits. */ | ||
270 | |||
271 | @@ -1499,6 +1504,7 @@ | ||
272 | #define SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE | ||
273 | #define SSL_AD_BAD_CERTIFICATE_HASH_VALUE TLS1_AD_BAD_CERTIFICATE_HASH_VALUE | ||
274 | #define SSL_AD_UNKNOWN_PSK_IDENTITY TLS1_AD_UNKNOWN_PSK_IDENTITY /* fatal */ | ||
275 | +#define SSL_AD_INAPPROPRIATE_FALLBACK TLS1_AD_INAPPROPRIATE_FALLBACK /* fatal */ | ||
276 | |||
277 | #define SSL_ERROR_NONE 0 | ||
278 | #define SSL_ERROR_SSL 1 | ||
279 | @@ -1608,6 +1614,7 @@ | ||
280 | |||
281 | #define SSL_CTRL_GET_EXTRA_CHAIN_CERTS 82 | ||
282 | #define SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS 83 | ||
283 | +#define SSL_CTRL_CHECK_PROTO_VERSION 119 | ||
284 | |||
285 | #define DTLSv1_get_timeout(ssl, arg) \ | ||
286 | SSL_ctrl(ssl,DTLS_CTRL_GET_TIMEOUT,0, (void *)arg) | ||
287 | @@ -2362,6 +2369,7 @@ | ||
288 | #define SSL_R_HTTPS_PROXY_REQUEST 155 | ||
289 | #define SSL_R_HTTP_REQUEST 156 | ||
290 | #define SSL_R_ILLEGAL_PADDING 283 | ||
291 | +#define SSL_R_INAPPROPRIATE_FALLBACK 373 | ||
292 | #define SSL_R_INCONSISTENT_COMPRESSION 340 | ||
293 | #define SSL_R_INVALID_CHALLENGE_LENGTH 158 | ||
294 | #define SSL_R_INVALID_COMMAND 280 | ||
295 | @@ -2508,6 +2516,7 @@ | ||
296 | #define SSL_R_TLSV1_ALERT_DECRYPTION_FAILED 1021 | ||
297 | #define SSL_R_TLSV1_ALERT_DECRYPT_ERROR 1051 | ||
298 | #define SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION 1060 | ||
299 | +#define SSL_R_TLSV1_ALERT_INAPPROPRIATE_FALLBACK 1086 | ||
300 | #define SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY 1071 | ||
301 | #define SSL_R_TLSV1_ALERT_INTERNAL_ERROR 1080 | ||
302 | #define SSL_R_TLSV1_ALERT_NO_RENEGOTIATION 1100 | ||
303 | diff --git a/ssl/ssl3.h b/ssl/ssl3.h | ||
304 | index 37f19e3..85f1504 100644 | ||
305 | --- a/ssl/ssl3.h | ||
306 | +++ b/ssl/ssl3.h | ||
307 | @@ -128,9 +128,14 @@ | ||
308 | extern "C" { | ||
309 | #endif | ||
310 | |||
311 | -/* Signalling cipher suite value: from draft-ietf-tls-renegotiation-03.txt */ | ||
312 | +/* Signalling cipher suite value from RFC 5746 | ||
313 | + * (TLS_EMPTY_RENEGOTIATION_INFO_SCSV) */ | ||
314 | #define SSL3_CK_SCSV 0x030000FF | ||
315 | |||
316 | +/* Signalling cipher suite value from draft-ietf-tls-downgrade-scsv-00 | ||
317 | + * (TLS_FALLBACK_SCSV) */ | ||
318 | +#define SSL3_CK_FALLBACK_SCSV 0x03005600 | ||
319 | + | ||
320 | #define SSL3_CK_RSA_NULL_MD5 0x03000001 | ||
321 | #define SSL3_CK_RSA_NULL_SHA 0x03000002 | ||
322 | #define SSL3_CK_RSA_RC4_40_MD5 0x03000003 | ||
323 | diff --git a/ssl/ssl_err.c b/ssl/ssl_err.c | ||
324 | index d2f0dec..1b7eb47 100644 | ||
325 | --- a/ssl/ssl_err.c | ||
326 | +++ b/ssl/ssl_err.c | ||
327 | @@ -383,6 +383,7 @@ static ERR_STRING_DATA SSL_str_reasons[]= | ||
328 | {ERR_REASON(SSL_R_HTTPS_PROXY_REQUEST) ,"https proxy request"}, | ||
329 | {ERR_REASON(SSL_R_HTTP_REQUEST) ,"http request"}, | ||
330 | {ERR_REASON(SSL_R_ILLEGAL_PADDING) ,"illegal padding"}, | ||
331 | +{ERR_REASON(SSL_R_INAPPROPRIATE_FALLBACK),"inappropriate fallback"}, | ||
332 | {ERR_REASON(SSL_R_INCONSISTENT_COMPRESSION),"inconsistent compression"}, | ||
333 | {ERR_REASON(SSL_R_INVALID_CHALLENGE_LENGTH),"invalid challenge length"}, | ||
334 | {ERR_REASON(SSL_R_INVALID_COMMAND) ,"invalid command"}, | ||
335 | @@ -529,6 +530,7 @@ static ERR_STRING_DATA SSL_str_reasons[]= | ||
336 | {ERR_REASON(SSL_R_TLSV1_ALERT_DECRYPTION_FAILED),"tlsv1 alert decryption failed"}, | ||
337 | {ERR_REASON(SSL_R_TLSV1_ALERT_DECRYPT_ERROR),"tlsv1 alert decrypt error"}, | ||
338 | {ERR_REASON(SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION),"tlsv1 alert export restriction"}, | ||
339 | +{ERR_REASON(SSL_R_TLSV1_ALERT_INAPPROPRIATE_FALLBACK),"tlsv1 alert inappropriate fallback"}, | ||
340 | {ERR_REASON(SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY),"tlsv1 alert insufficient security"}, | ||
341 | {ERR_REASON(SSL_R_TLSV1_ALERT_INTERNAL_ERROR),"tlsv1 alert internal error"}, | ||
342 | {ERR_REASON(SSL_R_TLSV1_ALERT_NO_RENEGOTIATION),"tlsv1 alert no renegotiation"}, | ||
343 | diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c | ||
344 | index cc094e4..3f66fc0 100644 | ||
345 | --- a/ssl/ssl_lib.c | ||
346 | +++ b/ssl/ssl_lib.c | ||
347 | @@ -1387,6 +1387,8 @@ int ssl_cipher_list_to_bytes(SSL *s,STACK_OF(SSL_CIPHER) *sk,unsigned char *p, | ||
348 | |||
349 | if (sk == NULL) return(0); | ||
350 | q=p; | ||
351 | + if (put_cb == NULL) | ||
352 | + put_cb = s->method->put_cipher_by_char; | ||
353 | |||
354 | for (i=0; i<sk_SSL_CIPHER_num(sk); i++) | ||
355 | { | ||
356 | @@ -1402,24 +1402,36 @@ int ssl_cipher_list_to_bytes(SSL *s,STAC | ||
357 | s->psk_client_callback == NULL) | ||
358 | continue; | ||
359 | #endif /* OPENSSL_NO_PSK */ | ||
360 | - j = put_cb ? put_cb(c,p) : ssl_put_cipher_by_char(s,c,p); | ||
361 | + j = put_cb(c,p); | ||
362 | p+=j; | ||
363 | } | ||
364 | - /* If p == q, no ciphers and caller indicates an error. Otherwise | ||
365 | + /* If p == q, no ciphers; caller indicates an error. Otherwise | ||
366 | * add SCSV if not renegotiating. | ||
367 | */ | ||
368 | - if (p != q && !s->renegotiate) | ||
369 | + if (p != q) | ||
370 | { | ||
371 | - static SSL_CIPHER scsv = | ||
372 | + if (!s->renegotiate) | ||
373 | { | ||
374 | - 0, NULL, SSL3_CK_SCSV, 0, 0, 0, 0, 0, 0, 0, 0, 0 | ||
375 | - }; | ||
376 | - j = put_cb ? put_cb(&scsv,p) : ssl_put_cipher_by_char(s,&scsv,p); | ||
377 | - p+=j; | ||
378 | + static SSL_CIPHER scsv = | ||
379 | + { | ||
380 | + 0, NULL, SSL3_CK_SCSV, 0, 0, 0, 0, 0, 0, 0, 0, 0 | ||
381 | + }; | ||
382 | + j = put_cb(&scsv,p); | ||
383 | + p+=j; | ||
384 | #ifdef OPENSSL_RI_DEBUG | ||
385 | - fprintf(stderr, "SCSV sent by client\n"); | ||
386 | + fprintf(stderr, "TLS_EMPTY_RENEGOTIATION_INFO_SCSV sent by client\n"); | ||
387 | #endif | ||
388 | - } | ||
389 | + } | ||
390 | + if (s->mode & SSL_MODE_SEND_FALLBACK_SCSV) | ||
391 | + { | ||
392 | + static SSL_CIPHER scsv = | ||
393 | + { | ||
394 | + 0, NULL, SSL3_CK_FALLBACK_SCSV, 0, 0, 0, 0, 0, 0, 0, 0, 0 | ||
395 | + }; | ||
396 | + j = put_cb(&scsv,p); | ||
397 | + p+=j; | ||
398 | + } | ||
399 | + } | ||
400 | |||
401 | return(p-q); | ||
402 | } | ||
403 | @@ -1439,11 +1453,12 @@ STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s,unsigned char *p,int num, | ||
404 | const SSL_CIPHER *c; | ||
405 | STACK_OF(SSL_CIPHER) *sk; | ||
406 | int i,n; | ||
407 | + | ||
408 | if (s->s3) | ||
409 | s->s3->send_connection_binding = 0; | ||
410 | |||
411 | n=ssl_put_cipher_by_char(s,NULL,NULL); | ||
412 | - if ((num%n) != 0) | ||
413 | + if (n == 0 || (num%n) != 0) | ||
414 | { | ||
415 | SSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST,SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST); | ||
416 | return(NULL); | ||
417 | @@ -1458,7 +1473,7 @@ STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s,unsigned char *p,int num, | ||
418 | |||
419 | for (i=0; i<num; i+=n) | ||
420 | { | ||
421 | - /* Check for SCSV */ | ||
422 | + /* Check for TLS_EMPTY_RENEGOTIATION_INFO_SCSV */ | ||
423 | if (s->s3 && (n != 3 || !p[0]) && | ||
424 | (p[n-2] == ((SSL3_CK_SCSV >> 8) & 0xff)) && | ||
425 | (p[n-1] == (SSL3_CK_SCSV & 0xff))) | ||
426 | @@ -1478,6 +1493,23 @@ STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s,unsigned char *p,int num, | ||
427 | continue; | ||
428 | } | ||
429 | |||
430 | + /* Check for TLS_FALLBACK_SCSV */ | ||
431 | + if ((n != 3 || !p[0]) && | ||
432 | + (p[n-2] == ((SSL3_CK_FALLBACK_SCSV >> 8) & 0xff)) && | ||
433 | + (p[n-1] == (SSL3_CK_FALLBACK_SCSV & 0xff))) | ||
434 | + { | ||
435 | + /* The SCSV indicates that the client previously tried a higher version. | ||
436 | + * Fail if the current version is an unexpected downgrade. */ | ||
437 | + if (!SSL_ctrl(s, SSL_CTRL_CHECK_PROTO_VERSION, 0, NULL)) | ||
438 | + { | ||
439 | + SSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST,SSL_R_INAPPROPRIATE_FALLBACK); | ||
440 | + if (s->s3) | ||
441 | + ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_INAPPROPRIATE_FALLBACK); | ||
442 | + goto err; | ||
443 | + } | ||
444 | + continue; | ||
445 | + } | ||
446 | + | ||
447 | c=ssl_get_cipher_by_char(s,p); | ||
448 | p+=n; | ||
449 | if (c != NULL) | ||
450 | diff --git a/ssl/t1_enc.c b/ssl/t1_enc.c | ||
451 | index 1427484..1923cf3 100644 | ||
452 | --- a/ssl/t1_enc.c | ||
453 | +++ b/ssl/t1_enc.c | ||
454 | @@ -1241,6 +1241,7 @@ int tls1_alert_code(int code) | ||
455 | case SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE: return(TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE); | ||
456 | case SSL_AD_BAD_CERTIFICATE_HASH_VALUE: return(TLS1_AD_BAD_CERTIFICATE_HASH_VALUE); | ||
457 | case SSL_AD_UNKNOWN_PSK_IDENTITY:return(TLS1_AD_UNKNOWN_PSK_IDENTITY); | ||
458 | + case SSL_AD_INAPPROPRIATE_FALLBACK:return(TLS1_AD_INAPPROPRIATE_FALLBACK); | ||
459 | #if 0 /* not appropriate for TLS, not used for DTLS */ | ||
460 | case DTLS1_AD_MISSING_HANDSHAKE_MESSAGE: return | ||
461 | (DTLS1_AD_MISSING_HANDSHAKE_MESSAGE); | ||
462 | diff --git a/ssl/tls1.h b/ssl/tls1.h | ||
463 | index c992091..6ae8876 100644 | ||
464 | --- a/ssl/tls1.h | ||
465 | +++ b/ssl/tls1.h | ||
466 | @@ -159,17 +159,19 @@ extern "C" { | ||
467 | |||
468 | #define TLS1_ALLOW_EXPERIMENTAL_CIPHERSUITES 0 | ||
469 | |||
470 | +#define TLS1_VERSION 0x0301 | ||
471 | +#define TLS1_1_VERSION 0x0302 | ||
472 | #define TLS1_2_VERSION 0x0303 | ||
473 | -#define TLS1_2_VERSION_MAJOR 0x03 | ||
474 | -#define TLS1_2_VERSION_MINOR 0x03 | ||
475 | +#define TLS_MAX_VERSION TLS1_2_VERSION | ||
476 | + | ||
477 | +#define TLS1_VERSION_MAJOR 0x03 | ||
478 | +#define TLS1_VERSION_MINOR 0x01 | ||
479 | |||
480 | -#define TLS1_1_VERSION 0x0302 | ||
481 | #define TLS1_1_VERSION_MAJOR 0x03 | ||
482 | #define TLS1_1_VERSION_MINOR 0x02 | ||
483 | |||
484 | -#define TLS1_VERSION 0x0301 | ||
485 | -#define TLS1_VERSION_MAJOR 0x03 | ||
486 | -#define TLS1_VERSION_MINOR 0x01 | ||
487 | +#define TLS1_2_VERSION_MAJOR 0x03 | ||
488 | +#define TLS1_2_VERSION_MINOR 0x03 | ||
489 | |||
490 | #define TLS1_get_version(s) \ | ||
491 | ((s->version >> 8) == TLS1_VERSION_MAJOR ? s->version : 0) | ||
492 | @@ -187,6 +189,7 @@ extern "C" { | ||
493 | #define TLS1_AD_PROTOCOL_VERSION 70 /* fatal */ | ||
494 | #define TLS1_AD_INSUFFICIENT_SECURITY 71 /* fatal */ | ||
495 | #define TLS1_AD_INTERNAL_ERROR 80 /* fatal */ | ||
496 | +#define TLS1_AD_INAPPROPRIATE_FALLBACK 86 /* fatal */ | ||
497 | #define TLS1_AD_USER_CANCELLED 90 | ||
498 | #define TLS1_AD_NO_RENEGOTIATION 100 | ||
499 | /* codes 110-114 are from RFC3546 */ | ||
500 | -- | ||
501 | 1.7.9.5 | ||
502 | |||
diff --git a/meta/recipes-connectivity/openssl/openssl_1.0.1e.bb b/meta/recipes-connectivity/openssl/openssl_1.0.1e.bb index d639d0a6ad..7623f0d985 100644 --- a/meta/recipes-connectivity/openssl/openssl_1.0.1e.bb +++ b/meta/recipes-connectivity/openssl/openssl_1.0.1e.bb | |||
@@ -44,6 +44,7 @@ SRC_URI += "file://configure-targets.patch \ | |||
44 | file://openssl-1.0.1e-cve-2014-0224.patch \ | 44 | file://openssl-1.0.1e-cve-2014-0224.patch \ |
45 | file://openssl-1.0.1e-cve-2014-3470.patch \ | 45 | file://openssl-1.0.1e-cve-2014-3470.patch \ |
46 | file://openssl-CVE-2010-5298.patch \ | 46 | file://openssl-CVE-2010-5298.patch \ |
47 | file://openssl-fix-CVE-2014-3566.patch \ | ||
47 | " | 48 | " |
48 | 49 | ||
49 | SRC_URI[md5sum] = "66bf6f10f060d561929de96f9dfe5b8c" | 50 | SRC_URI[md5sum] = "66bf6f10f060d561929de96f9dfe5b8c" |