diff options
| -rw-r--r-- | meta/recipes-connectivity/openssl/openssl-1.0.1e/0001-Fix-DTLS-retransmission-from-previous-session.patch | 81 | ||||
| -rw-r--r-- | meta/recipes-connectivity/openssl/openssl_1.0.1e.bb | 1 |
2 files changed, 82 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/openssl/openssl-1.0.1e/0001-Fix-DTLS-retransmission-from-previous-session.patch b/meta/recipes-connectivity/openssl/openssl-1.0.1e/0001-Fix-DTLS-retransmission-from-previous-session.patch new file mode 100644 index 0000000000..39592e2d67 --- /dev/null +++ b/meta/recipes-connectivity/openssl/openssl-1.0.1e/0001-Fix-DTLS-retransmission-from-previous-session.patch | |||
| @@ -0,0 +1,81 @@ | |||
| 1 | From 34628967f1e65dc8f34e000f0f5518e21afbfc7b Mon Sep 17 00:00:00 2001 | ||
| 2 | From: "Dr. Stephen Henson" <steve@openssl.org> | ||
| 3 | Date: Fri, 20 Dec 2013 15:26:50 +0000 | ||
| 4 | Subject: [PATCH] Fix DTLS retransmission from previous session. | ||
| 5 | |||
| 6 | Upstream-Status: Backport | ||
| 7 | commit 34628967f1e65dc8f34e000f0f5518e21afbfc7b upstream | ||
| 8 | |||
| 9 | For DTLS we might need to retransmit messages from the previous session | ||
| 10 | so keep a copy of write context in DTLS retransmission buffers instead | ||
| 11 | of replacing it after sending CCS. CVE-2013-6450. | ||
| 12 | --- | ||
| 13 | ssl/d1_both.c | 6 ++++++ | ||
| 14 | ssl/ssl_locl.h | 2 ++ | ||
| 15 | ssl/t1_enc.c | 17 +++++++++++------ | ||
| 16 | 4 files changed, 24 insertions(+), 6 deletions(-) | ||
| 17 | |||
| 18 | diff --git a/ssl/d1_both.c b/ssl/d1_both.c | ||
| 19 | index 65ec001..7a5596a 100644 | ||
| 20 | --- a/ssl/d1_both.c | ||
| 21 | +++ b/ssl/d1_both.c | ||
| 22 | @@ -214,6 +214,12 @@ dtls1_hm_fragment_new(unsigned long frag_len, int reassembly) | ||
| 23 | static void | ||
| 24 | dtls1_hm_fragment_free(hm_fragment *frag) | ||
| 25 | { | ||
| 26 | + | ||
| 27 | + if (frag->msg_header.is_ccs) | ||
| 28 | + { | ||
| 29 | + EVP_CIPHER_CTX_free(frag->msg_header.saved_retransmit_state.enc_write_ctx); | ||
| 30 | + EVP_MD_CTX_destroy(frag->msg_header.saved_retransmit_state.write_hash); | ||
| 31 | + } | ||
| 32 | if (frag->fragment) OPENSSL_free(frag->fragment); | ||
| 33 | if (frag->reassembly) OPENSSL_free(frag->reassembly); | ||
| 34 | OPENSSL_free(frag); | ||
| 35 | diff --git a/ssl/ssl_locl.h b/ssl/ssl_locl.h | ||
| 36 | index 96ce9a7..e485907 100644 | ||
| 37 | --- a/ssl/ssl_locl.h | ||
| 38 | +++ b/ssl/ssl_locl.h | ||
| 39 | @@ -621,6 +621,8 @@ extern SSL3_ENC_METHOD TLSv1_enc_data; | ||
| 40 | extern SSL3_ENC_METHOD SSLv3_enc_data; | ||
| 41 | extern SSL3_ENC_METHOD DTLSv1_enc_data; | ||
| 42 | |||
| 43 | +#define SSL_IS_DTLS(s) (s->method->version == DTLS1_VERSION) | ||
| 44 | + | ||
| 45 | #define IMPLEMENT_tls_meth_func(version, func_name, s_accept, s_connect, \ | ||
| 46 | s_get_meth) \ | ||
| 47 | const SSL_METHOD *func_name(void) \ | ||
| 48 | diff --git a/ssl/t1_enc.c b/ssl/t1_enc.c | ||
| 49 | index 72015f5..56db834 100644 | ||
| 50 | --- a/ssl/t1_enc.c | ||
| 51 | +++ b/ssl/t1_enc.c | ||
| 52 | @@ -414,15 +414,20 @@ int tls1_change_cipher_state(SSL *s, int which) | ||
| 53 | s->mac_flags |= SSL_MAC_FLAG_WRITE_MAC_STREAM; | ||
| 54 | else | ||
| 55 | s->mac_flags &= ~SSL_MAC_FLAG_WRITE_MAC_STREAM; | ||
| 56 | - if (s->enc_write_ctx != NULL) | ||
| 57 | + if (s->enc_write_ctx != NULL && !SSL_IS_DTLS(s)) | ||
| 58 | reuse_dd = 1; | ||
| 59 | - else if ((s->enc_write_ctx=OPENSSL_malloc(sizeof(EVP_CIPHER_CTX))) == NULL) | ||
| 60 | + else if ((s->enc_write_ctx=EVP_CIPHER_CTX_new()) == NULL) | ||
| 61 | goto err; | ||
| 62 | - else | ||
| 63 | - /* make sure it's intialized in case we exit later with an error */ | ||
| 64 | - EVP_CIPHER_CTX_init(s->enc_write_ctx); | ||
| 65 | dd= s->enc_write_ctx; | ||
| 66 | - mac_ctx = ssl_replace_hash(&s->write_hash,NULL); | ||
| 67 | + if (SSL_IS_DTLS(s)) | ||
| 68 | + { | ||
| 69 | + mac_ctx = EVP_MD_CTX_create(); | ||
| 70 | + if (!mac_ctx) | ||
| 71 | + goto err; | ||
| 72 | + s->write_hash = mac_ctx; | ||
| 73 | + } | ||
| 74 | + else | ||
| 75 | + mac_ctx = ssl_replace_hash(&s->write_hash,NULL); | ||
| 76 | #ifndef OPENSSL_NO_COMP | ||
| 77 | if (s->compress != NULL) | ||
| 78 | { | ||
| 79 | -- | ||
| 80 | 1.7.5.4 | ||
| 81 | |||
diff --git a/meta/recipes-connectivity/openssl/openssl_1.0.1e.bb b/meta/recipes-connectivity/openssl/openssl_1.0.1e.bb index 3e92234031..4b9fd369de 100644 --- a/meta/recipes-connectivity/openssl/openssl_1.0.1e.bb +++ b/meta/recipes-connectivity/openssl/openssl_1.0.1e.bb | |||
| @@ -36,6 +36,7 @@ SRC_URI += "file://configure-targets.patch \ | |||
| 36 | file://initial-aarch64-bits.patch \ | 36 | file://initial-aarch64-bits.patch \ |
| 37 | file://find.pl \ | 37 | file://find.pl \ |
| 38 | file://0001-Fix-for-TLS-record-tampering-bug-CVE-2013-4353.patch \ | 38 | file://0001-Fix-for-TLS-record-tampering-bug-CVE-2013-4353.patch \ |
| 39 | file://0001-Fix-DTLS-retransmission-from-previous-session.patch \ | ||
| 39 | " | 40 | " |
| 40 | 41 | ||
| 41 | SRC_URI[md5sum] = "66bf6f10f060d561929de96f9dfe5b8c" | 42 | SRC_URI[md5sum] = "66bf6f10f060d561929de96f9dfe5b8c" |
