Browse code

openssl update

Hanno Böck authored on 19/03/2015 20:46:20
Showing 5 changed files
... ...
@@ -7,6 +7,9 @@ AUX openssl-1.0.1-x32.patch 3273 SHA256 a4f05b8757e225a05a9c5a3ea485159066760d87
7 7
 AUX openssl-1.0.1e-s_client-verify.patch 592 SHA256 6f540fce663eefbe68cee16ad7d8d561d6c898eeb4180c2f4a4caa7e43c6d0c9 SHA512 117b1017e1259667078d3ccdcd9fd46357c6f85cf2702794f49c612b37acdc044fe88f871dbe46fcad9ed4cd8aaaaee800dddb5286203322802efd7549a43b68 WHIRLPOOL 70a4cc36b1dcb24d7e9bcef016684fb2394977f7f20aa332ebd0aa15e3f4c16c74563d2fc0ba8d70669f6cc9a13bf8a30cdb28ebafe2d102cd2859a4e32c38d7
8 8
 AUX openssl-1.0.1f-revert-alpha-perl-generation.patch 3102 SHA256 6e502275b32ac0eca80f28448ae1bb88506f9135258f420fd857ea0b9b485778 SHA512 c80439da3d268e70fd492d0ca73c0a17ddb088b9330610794a338d1921ee13dad9caca4c81ca103b82a7541c8712f77e51f352ec1b1b02789d9aed291acb0cdc WHIRLPOOL cb760366c8759b1c78c5307134bb48c4fc12b1556276c2ef55455ea54725d20cb433ade966a7453f512d2feb5ae89a9798078ab535e4605366633a8e003c7ac6
9 9
 AUX openssl-1.0.1h-ipv6.patch 17788 SHA256 7adeeb88cc544f8b210efbe2baff48fccf5029b582dff7010ae70e0e1f097d7b SHA512 0f0990d4294abcb5f3e51c84080883046a054c710b57a23f99b3323727d5e9aeb5ddeb6b6c2565b4be364f7c21419c90ce5288154e404cd663678f87e0d1c259 WHIRLPOOL cfe7a2e141a4a6252ffcfe215b16dd1082bc14a757dad7eb01bb9819de41ef0ee51a4b2dbf110c27b52e483341c337bf4d1f77f4f9f3172d2fee9e348c30af7e
10
+AUX openssl-1.0.2-CVE-2015-0209.patch 1282 SHA256 6be2b1fa0d440bc1c1b15da4a9d32811a04c3e7c701678eb8ee72454bbf87401 SHA512 db5b73c815582453d3231d49c9c24d60824e56f67a74f815818d0f90bccd485e98a98b449386aa297fa055b5fc27e2a058c03bc410478fb98051a729ac75b4db WHIRLPOOL 46ddfaff115622e2426c544e757bf882fc5069f35d169189cf277d90a5ad36c274beaf1ff89cdc593e2e5cd1593588c389262dce3bb6a166c5fd7eb908458fec
11
+AUX openssl-1.0.2-CVE-2015-0288.patch 800 SHA256 613acdc06a22ec5cbc274cc39022b1fa1fd73e409551493bcab6d4a273983484 SHA512 4785d9c4620492c4997cbe7c83a42a9804a9e8c3d94e35dd7d3e6bd16f607a9b294b77123686f24c953e6330f96907008dccf1379648d806fa85bbdd20b81ca0 WHIRLPOOL 738831379e3c117f260306e2f39aacd51b895ed4bcb7dd0189f14a7301c09ffd4fbd882fbd05d7e71cd6c9524fc289124909e5fd2dcc23607fa4ce71ba3a0df7
12
+AUX openssl-1.0.2-CVE-2015-0291.patch 16069 SHA256 be4f9fa463a027e7c77396a8d3ddc1d6ad6c0bbc8b07c2f7af0738621c619710 SHA512 2ee10f21ce02f1c46ee6c446c60d4e1e3af05366769603f38c971018ce07341369db87cb050432d0501f152cabf377c03848df501694ea46ef2f6578d19cf030 WHIRLPOOL 1ea004fe43633b18c91a8cf390285c274b1c05d3bed313ccc6f9bebb92e0b313504f17d4fe41a643feedc626a8851c6e568b34b2d5bf7d62683e170f5c3e5301
10 13
 AUX openssl-1.0.2-ipv6.patch 18811 SHA256 9ff3150c75f3f3e6a9773ffe54d90994cbf68cc919134aea68e09e7ed921763d SHA512 58e293f8f19a3fad08729b842dd977b73fedb0c49208d87a056bfea857c0e2b79a310d7d098c04429b65564fce64defeda6d1dcc3068ad5a80ef276db6421e54 WHIRLPOOL 36a0fffc7238011b93077bed94c9507f2ffc1cf199e6c06e94d01589cdc84a6568b9122e1a120b8262bd0a1c43f25169a29796c92a78338dd9f03b4cc2cdf0b8
11 14
 AUX openssl-1.0.2-parallel-build.patch 10661 SHA256 bc5622150a964dc2d9909f41557140b696ce1bdfa4e2b12cc3e0e51029ead32b SHA512 a4957304a4424016cd8a1c6552c422cd042d737e12f96235ec54d1e601ccbe8cb79d931ac8777d1a599bd4a70eac4e6700a24362f14fb04eb273df82f2de0d01 WHIRLPOOL 5b34e45dcb0db6649e26d275925ca008f5201afbc22184e15c5324513bc0ed40ee271a70686e10a20bb219b3c4bd2148323b317ead97cdc27a3c897c0a07d228
12 15
 AUX openssl-1.0.2-s_client-verify.patch 648 SHA256 b6ca2278dd9833f87a1d0037cb3cac8aee0f8326ff13ece1f08a536b8545eb77 SHA512 78b09ae700096205582785584a268776af46fc5bc94a0faa1ce6087ffcc945649e69269ff7fa88dedd5df1a5cdecc53e885de1e39506470f23b02028ca962104 WHIRLPOOL 8e7c90d37c1736b4b2f2c38d1c12dcfee4996a50a2a7dd07645a0c0b6616006d11232dd0f88ab735833e1c46aa171ceb5e1288c3d57296010bdda59295de7599
... ...
@@ -14,10 +17,9 @@ DIST openssl-1.0.1i.tar.gz 4422117 SHA256 3c179f46ca77069a6a0bac70212a9b3b838b2f
14 17
 DIST openssl-1.0.1j.tar.gz 4432964 SHA256 1b60ca8789ba6f03e8ef20da2293b8dc131c39d83814e775069f02d26354edf3 SHA512 a786bb99b68d88c1de79d3c5372767f091ebeefb5abc1d4883253fd3ab5a86af53389f5ff36fdd8faa27c5fb78be8bbff406392c373358697da80d250eadebb8 WHIRLPOOL 467aa3b02d04837e3281670401985e492d15b561c03b97246e3c8e61b0d3b1927332e3a226de4ed5bd02265a04fb31ce84c3501f4af9685633d00a9b43c56978
15 18
 DIST openssl-1.0.1k.tar.gz 4434910 SHA256 8f9faeaebad088e772f4ef5e38252d472be4d878c6b3a2718c10a4fcebe7a41c SHA512 8b000fbd1bf919d9913a314f99aedd48a69f6caa4ccf43237889e73e08cbe0d82bfc27e9c7c4cade09fc459f91d6c4a831a9b3fc8bca0344fb864eadd7d1e8e8 WHIRLPOOL 5236a966d610c971e473cfc30e5412a72eef116fd259ada9c50da08bcd4ca967f80bb19babf530b4e5b9f1f24e9275e00391eb2e12a26d4544f593e2b4ba20b8
16 19
 DIST openssl-1.0.2.tar.gz 5265809 SHA256 8c48baf3babe0d505d16cfc0cf272589c66d3624264098213db0fb00034728e9 SHA512 dea46225a5445edc4986b02b99fbc90153819374b9a9bfdd892b60cd18ac7fefaf21a7e9d2bb05d0e3bfa4d2704e0ee24b06cc8e7081a542d7598cc9e73c67c5 WHIRLPOOL fe628a38125390deb75728b31427c308efbf65637a569fd1f139f6313fea533514ef05bf3d01bbdc793f77eb259400c95c53074a294d32d73576939d16f22e25
17
-DIST openssl-1.0.2a.tar.gz 5262089 SHA256 15b6393c20030aab02c8e2fe0243cb1d1d18062f6c095d67bca91871dc7f324a SHA512 02d228578824add52b73433d64697706e6503c2334933fe8dd6b477f59c430977012c3c34da207096229a425e1dcb6f3ae806043894b5ac98c27bbcddb794dd4 WHIRLPOOL a590c71794f5d29b80afa28b18621b7535e96b714b3690d793c1422a90b09a89cbcb912841d400c5982a8197bb02c13051190e96ba0e4d530509b48b43067cd7
18 20
 DIST openssl-c_rehash.sh.1.7 4167 SHA256 4999ee79892f52bd6a4a7baba9fac62262454d573bbffd72685d3aae9e48cee0 SHA512 55e8c2e827750a4f375cb83c86bfe2d166c01ffa5d7e9b16657b72b38b747c8985dd2c98f854c911dfbbee2ff3e92aff39fdf089d979b2e3534b7685ee8b80da WHIRLPOOL c88f06a3b8651f76b6289552cccceb64e13f6697c5f0ce3ff114c781ce1c218912b8ee308af9d087cd76a9600fdacda1953175bff07d7d3eb21b0c0b7f4f1ce1
19 21
 EBUILD openssl-1.0.1i.ebuild 8776 SHA256 99e7d64748e9448cd1f3d8738e1a97b5daab3c56b3e5f0168186f6644d83bbd8 SHA512 e1b922da0678ac59ed09f4cffd714b45ba8e028aa844e089a4385391fcb4e02b7fc731f855e2537acf10e817710e06aa61fac91233db78a053416212e83a9bf2 WHIRLPOOL 3537527dde49f7fd39c73c7a4053c5bf44fdf3e2544fd7148019729abd01120c7f3fe85e83a38b89630ff0bb38b7d044e42234cfaf4cf68612b630900e5b209a
20 22
 EBUILD openssl-1.0.1j.ebuild 8848 SHA256 823be5d97748b5b7e6f134746f13850b5a97cbf4ad0639c7238367d741386cb6 SHA512 f426b8bcd82113fc27eb001491e2c5ff03f276fd449f3ab763b58e1e5366f75d77eb5bb26648130ed1775e418181cc9d4cc744e507185cb12855b117bd86096c WHIRLPOOL 690246218ae96ec269249c23b65f6ec5f59e3e19388cb2bcd2f1e125fc75ba43124e9f63dc5ea4b0af62fd8aee024a9cff5fddf9ddd123e6fe9dc3a164860c48
21 23
 EBUILD openssl-1.0.1k.ebuild 8848 SHA256 654fb54cb45c343adea6b81d0850a2f9a62c43bd663c3f2d9a402ab90af0f05f SHA512 4372499d07a14131a05f9f62ef99eab1a86b50ab12356d58037e5d7d3754450a6c35947811282ad990c4d1897bc9ce6a4e16bf60ce6926d532e308ad80d28264 WHIRLPOOL 8f4c9224f9637cccb1362a343cfd17cd6b322eb96b15f18f34e2e26c8688d4eb0278a48618eee61e771c65c0d22e11e19a5e81e1fefdca3c9faaca75d74d7930
22 24
 EBUILD openssl-1.0.2-r1.ebuild 8829 SHA256 b07881d45227d608973c699e146081b2d3d164b741cc127995d2537cc8bb5c95 SHA512 0dbaae39454349726633993ffb71596344b0898cfe420fcc315b07fa0d314e780e9b61a978881b2c091b113523fd0ab37410a771c831b58f8bcd2c67e5c84234 WHIRLPOOL 1b167afb27753e66aa474e23ca2df504e8e3d70d67428af8179e88b238350e988014d8d33f5fe683d4fb345c847b0d954a558b5b69d22836b154c4bc6c15738a
23
-EBUILD openssl-1.0.2a.ebuild 8937 SHA256 9c7fb1f83273b492cf63ade7dab998c606222ca0aa2bad5c42f1fdb30964c93d SHA512 956a6640f3ffa41afcaf9a54967a63ce8b23216d5c54949c460ca780ed536961f918e0c6ce34e9bee5b0011de9400eba150ffe1e6c87a053eeae8efb35048c44 WHIRLPOOL 99003d7ad1bc559998e6c8d625c24ef776b96fc715b842bef2e9fb302508049480dc65c5f29b49ce8779d00f939abc3c25558b625c41634ccd154c76098ee3df
25
+EBUILD openssl-1.0.2-r3.ebuild 8996 SHA256 e28bc2726e4b8d1c7e779348d9c27412b3a37dea7009f3399a202b57f4aa8c58 SHA512 8e1a8bd531ee2eefb5f2e6b80f038528c51f05e474de5a8bf1191f438509ef195ee0decd4866e0bce12351100d88a2c1d9320795fcd001826b9b8241093e255b WHIRLPOOL f5f38405792f046187cd45ecf37d3f1cf4b19b87c605d4482c2d5fb4fc22c5d3f0736ef712f78255fe0efcb545a0eecec709b043aabe06c0c242a735d2bc062a
24 26
new file mode 100644
... ...
@@ -0,0 +1,49 @@
1
+https://bugs.gentoo.org/541502
2
+
3
+From 1b4a8df38fc9ab3c089ca5765075ee53ec5bd66a Mon Sep 17 00:00:00 2001
4
+From: Matt Caswell <matt@openssl.org>
5
+Date: Mon, 9 Feb 2015 11:38:41 +0000
6
+Subject: [PATCH] Fix a failure to NULL a pointer freed on error.
7
+MIME-Version: 1.0
8
+Content-Type: text/plain; charset=UTF-8
9
+Content-Transfer-Encoding: 8bit
10
+
11
+Inspired by BoringSSL commit 517073cd4b by Eric Roman <eroman@chromium.org>
12
+
13
+CVE-2015-0209
14
+
15
+Reviewed-by: Emilia Käsper <emilia@openssl.org>
16
+---
17
+ crypto/ec/ec_asn1.c | 6 +++---
18
+ 1 file changed, 3 insertions(+), 3 deletions(-)
19
+
20
+diff --git a/crypto/ec/ec_asn1.c b/crypto/ec/ec_asn1.c
21
+index 30b7df4..d3e8316 100644
22
+--- a/crypto/ec/ec_asn1.c
23
+@@ -1014,8 +1014,6 @@ EC_KEY *d2i_ECPrivateKey(EC_KEY **a, const unsigned char **in, long len)
24
+             ECerr(EC_F_D2I_ECPRIVATEKEY, ERR_R_MALLOC_FAILURE);
25
+             goto err;
26
+         }
27
+-        if (a)
28
+-            *a = ret;
29
+     } else
30
+         ret = *a;
31
+ 
32
+@@ -1067,10 +1065,12 @@ EC_KEY *d2i_ECPrivateKey(EC_KEY **a, const unsigned char **in, long len)
33
+         }
34
+     }
35
+ 
36
++    if (a)
37
++        *a = ret;
38
+     ok = 1;
39
+  err:
40
+     if (!ok) {
41
+-        if (ret)
42
++        if (ret && (a == NULL || *a != ret))
43
+             EC_KEY_free(ret);
44
+         ret = NULL;
45
+     }
46
+-- 
47
+2.3.1
48
+
0 49
new file mode 100644
... ...
@@ -0,0 +1,31 @@
1
+https://bugs.gentoo.org/542038
2
+
3
+From 28a00bcd8e318da18031b2ac8778c64147cd54f9 Mon Sep 17 00:00:00 2001
4
+From: "Dr. Stephen Henson" <steve@openssl.org>
5
+Date: Wed, 18 Feb 2015 00:34:59 +0000
6
+Subject: [PATCH] Check public key is not NULL.
7
+
8
+CVE-2015-0288
9
+PR#3708
10
+
11
+Reviewed-by: Matt Caswell <matt@openssl.org>
12
+---
13
+ crypto/x509/x509_req.c | 2 ++
14
+ 1 file changed, 2 insertions(+)
15
+
16
+diff --git a/crypto/x509/x509_req.c b/crypto/x509/x509_req.c
17
+index bc6e566..01795f4 100644
18
+--- a/crypto/x509/x509_req.c
19
+@@ -92,6 +92,8 @@ X509_REQ *X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md)
20
+         goto err;
21
+ 
22
+     pktmp = X509_get_pubkey(x);
23
++    if (pktmp == NULL)
24
++        goto err;
25
+     i = X509_REQ_set_pubkey(ret, pktmp);
26
+     EVP_PKEY_free(pktmp);
27
+     if (!i)
28
+-- 
29
+2.3.1
30
+
0 31
new file mode 100644
... ...
@@ -0,0 +1,459 @@
1
+--- openssl-1.0.2/crypto/asn1/a_type.c
2
+@@ -119,6 +119,9 @@
3
+     case V_ASN1_OBJECT:
4
+         result = OBJ_cmp(a->value.object, b->value.object);
5
+         break;
6
++    case V_ASN1_BOOLEAN:
7
++        result = a->value.boolean - b->value.boolean;
8
++        break;
9
+     case V_ASN1_NULL:
10
+         result = 0;             /* They do not have content. */
11
+         break;
12
+--- openssl-1.0.2/crypto/asn1/tasn_dec.c
13
+@@ -140,11 +140,17 @@
14
+ {
15
+     ASN1_TLC c;
16
+     ASN1_VALUE *ptmpval = NULL;
17
+-    if (!pval)
18
+-        pval = &ptmpval;
19
+     asn1_tlc_clear_nc(&c);
20
+-    if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0)
21
+-        return *pval;
22
++    if (pval && *pval && it->itype == ASN1_ITYPE_PRIMITIVE)
23
++        ptmpval = *pval;
24
++    if (ASN1_item_ex_d2i(&ptmpval, in, len, it, -1, 0, 0, &c) > 0) {
25
++        if (pval && it->itype != ASN1_ITYPE_PRIMITIVE) {
26
++            if (*pval)
27
++                ASN1_item_free(*pval, it);
28
++            *pval = ptmpval;
29
++        }
30
++        return ptmpval;
31
++    }
32
+     return NULL;
33
+ }
34
+ 
35
+@@ -304,9 +310,16 @@
36
+     case ASN1_ITYPE_CHOICE:
37
+         if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it, NULL))
38
+             goto auxerr;
39
+-
40
+-        /* Allocate structure */
41
+-        if (!*pval && !ASN1_item_ex_new(pval, it)) {
42
++        if (*pval) {
43
++            /* Free up and zero CHOICE value if initialised */
44
++            i = asn1_get_choice_selector(pval, it);
45
++            if ((i >= 0) && (i < it->tcount)) {
46
++                tt = it->templates + i;
47
++                pchptr = asn1_get_field_ptr(pval, tt);
48
++                ASN1_template_free(pchptr, tt);
49
++                asn1_set_choice_selector(pval, -1, it);
50
++            }
51
++        } else if (!ASN1_item_ex_new(pval, it)) {
52
+             ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
53
+             goto err;
54
+         }
55
+@@ -386,6 +399,17 @@
56
+         if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it, NULL))
57
+             goto auxerr;
58
+ 
59
++        /* Free up and zero any ADB found */
60
++        for (i = 0, tt = it->templates; i < it->tcount; i++, tt++) {
61
++            if (tt->flags & ASN1_TFLG_ADB_MASK) {
62
++                const ASN1_TEMPLATE *seqtt;
63
++                ASN1_VALUE **pseqval;
64
++                seqtt = asn1_do_adb(pval, tt, 1);
65
++                pseqval = asn1_get_field_ptr(pval, seqtt);
66
++                ASN1_template_free(pseqval, seqtt);
67
++            }
68
++        }
69
++
70
+         /* Get each field entry */
71
+         for (i = 0, tt = it->templates; i < it->tcount; i++, tt++) {
72
+             const ASN1_TEMPLATE *seqtt;
73
+--- openssl-1.0.2/crypto/pkcs7/pk7_doit.c
74
+@@ -261,6 +261,25 @@
75
+     PKCS7_RECIP_INFO *ri = NULL;
76
+     ASN1_OCTET_STRING *os = NULL;
77
+ 
78
++    if (p7 == NULL) {
79
++        PKCS7err(PKCS7_F_PKCS7_DATAINIT, PKCS7_R_INVALID_NULL_POINTER);
80
++        return NULL;
81
++    }
82
++    /*
83
++     * The content field in the PKCS7 ContentInfo is optional, but that really
84
++     * only applies to inner content (precisely, detached signatures).
85
++     *
86
++     * When reading content, missing outer content is therefore treated as an
87
++     * error.
88
++     *
89
++     * When creating content, PKCS7_content_new() must be called before
90
++     * calling this method, so a NULL p7->d is always an error.
91
++     */
92
++    if (p7->d.ptr == NULL) {
93
++        PKCS7err(PKCS7_F_PKCS7_DATAINIT, PKCS7_R_NO_CONTENT);
94
++        return NULL;
95
++    }
96
++
97
+     i = OBJ_obj2nid(p7->type);
98
+     p7->state = PKCS7_S_HEADER;
99
+ 
100
+@@ -411,6 +430,16 @@
101
+     unsigned char *ek = NULL, *tkey = NULL;
102
+     int eklen = 0, tkeylen = 0;
103
+ 
104
++    if (p7 == NULL) {
105
++        PKCS7err(PKCS7_F_PKCS7_DATADECODE, PKCS7_R_INVALID_NULL_POINTER);
106
++        return NULL;
107
++    }
108
++
109
++    if (p7->d.ptr == NULL) {
110
++        PKCS7err(PKCS7_F_PKCS7_DATADECODE, PKCS7_R_NO_CONTENT);
111
++        return NULL;
112
++    }
113
++
114
+     i = OBJ_obj2nid(p7->type);
115
+     p7->state = PKCS7_S_HEADER;
116
+ 
117
+@@ -707,6 +736,16 @@
118
+     STACK_OF(PKCS7_SIGNER_INFO) *si_sk = NULL;
119
+     ASN1_OCTET_STRING *os = NULL;
120
+ 
121
++    if (p7 == NULL) {
122
++        PKCS7err(PKCS7_F_PKCS7_DATAFINAL, PKCS7_R_INVALID_NULL_POINTER);
123
++        return 0;
124
++    }
125
++
126
++    if (p7->d.ptr == NULL) {
127
++        PKCS7err(PKCS7_F_PKCS7_DATAFINAL, PKCS7_R_NO_CONTENT);
128
++        return 0;
129
++    }
130
++
131
+     EVP_MD_CTX_init(&ctx_tmp);
132
+     i = OBJ_obj2nid(p7->type);
133
+     p7->state = PKCS7_S_HEADER;
134
+@@ -746,6 +785,7 @@
135
+         /* If detached data then the content is excluded */
136
+         if (PKCS7_type_is_data(p7->d.sign->contents) && p7->detached) {
137
+             M_ASN1_OCTET_STRING_free(os);
138
++            os = NULL;
139
+             p7->d.sign->contents->d.data = NULL;
140
+         }
141
+         break;
142
+@@ -755,6 +795,7 @@
143
+         /* If detached data then the content is excluded */
144
+         if (PKCS7_type_is_data(p7->d.digest->contents) && p7->detached) {
145
+             M_ASN1_OCTET_STRING_free(os);
146
++            os = NULL;
147
+             p7->d.digest->contents->d.data = NULL;
148
+         }
149
+         break;
150
+@@ -820,22 +861,30 @@
151
+         M_ASN1_OCTET_STRING_set(p7->d.digest->digest, md_data, md_len);
152
+     }
153
+ 
154
+-    if (!PKCS7_is_detached(p7) && !(os->flags & ASN1_STRING_FLAG_NDEF)) {
155
+-        char *cont;
156
+-        long contlen;
157
+-        btmp = BIO_find_type(bio, BIO_TYPE_MEM);
158
+-        if (btmp == NULL) {
159
+-            PKCS7err(PKCS7_F_PKCS7_DATAFINAL, PKCS7_R_UNABLE_TO_FIND_MEM_BIO);
160
+-            goto err;
161
+-        }
162
+-        contlen = BIO_get_mem_data(btmp, &cont);
163
++    if (!PKCS7_is_detached(p7)) {
164
+         /*
165
+-         * Mark the BIO read only then we can use its copy of the data
166
+-         * instead of making an extra copy.
167
++         * NOTE(emilia): I think we only reach os == NULL here because detached
168
++         * digested data support is broken.
169
+          */
170
+-        BIO_set_flags(btmp, BIO_FLAGS_MEM_RDONLY);
171
+-        BIO_set_mem_eof_return(btmp, 0);
172
+-        ASN1_STRING_set0(os, (unsigned char *)cont, contlen);
173
++        if (os == NULL)
174
++            goto err;
175
++        if (!(os->flags & ASN1_STRING_FLAG_NDEF)) {
176
++            char *cont;
177
++            long contlen;
178
++            btmp = BIO_find_type(bio, BIO_TYPE_MEM);
179
++            if (btmp == NULL) {
180
++                PKCS7err(PKCS7_F_PKCS7_DATAFINAL, PKCS7_R_UNABLE_TO_FIND_MEM_BIO);
181
++                goto err;
182
++            }
183
++            contlen = BIO_get_mem_data(btmp, &cont);
184
++            /*
185
++             * Mark the BIO read only then we can use its copy of the data
186
++             * instead of making an extra copy.
187
++             */
188
++            BIO_set_flags(btmp, BIO_FLAGS_MEM_RDONLY);
189
++            BIO_set_mem_eof_return(btmp, 0);
190
++            ASN1_STRING_set0(os, (unsigned char *)cont, contlen);
191
++        }
192
+     }
193
+     ret = 1;
194
+  err:
195
+@@ -910,6 +959,16 @@
196
+     STACK_OF(X509) *cert;
197
+     X509 *x509;
198
+ 
199
++    if (p7 == NULL) {
200
++        PKCS7err(PKCS7_F_PKCS7_DATAVERIFY, PKCS7_R_INVALID_NULL_POINTER);
201
++        return 0;
202
++    }
203
++
204
++    if (p7->d.ptr == NULL) {
205
++        PKCS7err(PKCS7_F_PKCS7_DATAVERIFY, PKCS7_R_NO_CONTENT);
206
++        return 0;
207
++    }
208
++
209
+     if (PKCS7_type_is_signed(p7)) {
210
+         cert = p7->d.sign->cert;
211
+     } else if (PKCS7_type_is_signedAndEnveloped(p7)) {
212
+--- openssl-1.0.2/crypto/pkcs7/pk7_lib.c
213
+@@ -70,6 +70,7 @@
214
+     nid = OBJ_obj2nid(p7->type);
215
+ 
216
+     switch (cmd) {
217
++    /* NOTE(emilia): does not support detached digested data. */
218
+     case PKCS7_OP_SET_DETACHED_SIGNATURE:
219
+         if (nid == NID_pkcs7_signed) {
220
+             ret = p7->detached = (int)larg;
221
+@@ -444,6 +445,8 @@
222
+ 
223
+ STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7)
224
+ {
225
++    if (p7 == NULL || p7->d.ptr == NULL)
226
++        return NULL;
227
+     if (PKCS7_type_is_signed(p7)) {
228
+         return (p7->d.sign->signer_info);
229
+     } else if (PKCS7_type_is_signedAndEnveloped(p7)) {
230
+--- openssl-1.0.2/crypto/rsa/rsa_ameth.c
231
+@@ -698,9 +698,10 @@
232
+         RSAerr(RSA_F_RSA_ITEM_VERIFY, RSA_R_UNSUPPORTED_SIGNATURE_TYPE);
233
+         return -1;
234
+     }
235
+-    if (rsa_pss_to_ctx(ctx, NULL, sigalg, pkey))
236
++    if (rsa_pss_to_ctx(ctx, NULL, sigalg, pkey) > 0) {
237
+         /* Carry on */
238
+         return 2;
239
++    }
240
+     return -1;
241
+ }
242
+ 
243
+--- openssl-1.0.2/doc/crypto/d2i_X509.pod
244
+@@ -207,6 +207,12 @@
245
+ persist if they are not present in the new one. As a result the use
246
+ of this "reuse" behaviour is strongly discouraged.
247
+ 
248
++Current versions of OpenSSL will not modify B<*px> if an error occurs.
249
++If parsing succeeds then B<*px> is freed (if it is not NULL) and then
250
++set to the value of the newly decoded structure. As a result B<*px>
251
++B<must not> be allocated on the stack or an attempt will be made to
252
++free an invalid pointer.
253
++
254
+ i2d_X509() will not return an error in many versions of OpenSSL,
255
+ if mandatory fields are not initialized due to a programming error
256
+ then the encoded structure may contain invalid data or omit the
257
+@@ -233,7 +239,9 @@
258
+ 
259
+ d2i_X509(), d2i_X509_bio() and d2i_X509_fp() return a valid B<X509> structure
260
+ or B<NULL> if an error occurs. The error code that can be obtained by
261
+-L<ERR_get_error(3)|ERR_get_error(3)>. 
262
++L<ERR_get_error(3)|ERR_get_error(3)>. If the "reuse" capability has been used
263
++with a valid X509 structure being passed in via B<px> then the object is not
264
++modified in the event of error.
265
+ 
266
+ i2d_X509() returns the number of bytes successfully encoded or a negative
267
+ value if an error occurs. The error code can be obtained by
268
+--- openssl-1.0.2/ssl/d1_lib.c
269
+@@ -543,6 +543,9 @@
270
+ {
271
+     int ret;
272
+ 
273
++    /* Ensure there is no state left over from a previous invocation */
274
++    SSL_clear(s);
275
++
276
+     SSL_set_options(s, SSL_OP_COOKIE_EXCHANGE);
277
+     s->d1->listen = 1;
278
+ 
279
+--- openssl-1.0.2/ssl/s2_lib.c
280
+@@ -493,7 +493,7 @@
281
+ 
282
+         OPENSSL_assert(s->session->master_key_length >= 0
283
+                        && s->session->master_key_length
284
+-                       < (int)sizeof(s->session->master_key));
285
++                       <= (int)sizeof(s->session->master_key));
286
+         EVP_DigestUpdate(&ctx, s->session->master_key,
287
+                          s->session->master_key_length);
288
+         EVP_DigestUpdate(&ctx, &c, 1);
289
+--- openssl-1.0.2/ssl/s2_srvr.c
290
+@@ -454,11 +454,6 @@
291
+         SSLerr(SSL_F_GET_CLIENT_MASTER_KEY, SSL_R_NO_PRIVATEKEY);
292
+         return (-1);
293
+     }
294
+-    i = ssl_rsa_private_decrypt(s->cert, s->s2->tmp.enc,
295
+-                                &(p[s->s2->tmp.clear]),
296
+-                                &(p[s->s2->tmp.clear]),
297
+-                                (s->s2->ssl2_rollback) ? RSA_SSLV23_PADDING :
298
+-                                RSA_PKCS1_PADDING);
299
+ 
300
+     is_export = SSL_C_IS_EXPORT(s->session->cipher);
301
+ 
302
+@@ -475,23 +470,61 @@
303
+     } else
304
+         ek = 5;
305
+ 
306
++    /*
307
++     * The format of the CLIENT-MASTER-KEY message is
308
++     * 1 byte message type
309
++     * 3 bytes cipher
310
++     * 2-byte clear key length (stored in s->s2->tmp.clear)
311
++     * 2-byte encrypted key length (stored in s->s2->tmp.enc)
312
++     * 2-byte key args length (IV etc)
313
++     * clear key
314
++     * encrypted key
315
++     * key args
316
++     *
317
++     * If the cipher is an export cipher, then the encrypted key bytes
318
++     * are a fixed portion of the total key (5 or 8 bytes). The size of
319
++     * this portion is in |ek|. If the cipher is not an export cipher,
320
++     * then the entire key material is encrypted (i.e., clear key length
321
++     * must be zero).
322
++     */
323
++    if ((!is_export && s->s2->tmp.clear != 0) ||
324
++        (is_export && s->s2->tmp.clear + ek != EVP_CIPHER_key_length(c))) {
325
++        ssl2_return_error(s, SSL2_PE_UNDEFINED_ERROR);
326
++        SSLerr(SSL_F_GET_CLIENT_MASTER_KEY,SSL_R_BAD_LENGTH);
327
++        return -1;
328
++    }
329
++    /*
330
++     * The encrypted blob must decrypt to the encrypted portion of the key.
331
++     * Decryption can't be expanding, so if we don't have enough encrypted
332
++     * bytes to fit the key in the buffer, stop now.
333
++     */
334
++    if ((is_export && s->s2->tmp.enc < ek) ||
335
++        (!is_export && s->s2->tmp.enc < EVP_CIPHER_key_length(c))) {
336
++        ssl2_return_error(s,SSL2_PE_UNDEFINED_ERROR);
337
++        SSLerr(SSL_F_GET_CLIENT_MASTER_KEY,SSL_R_LENGTH_TOO_SHORT);
338
++        return -1;
339
++    }
340
++
341
++    i = ssl_rsa_private_decrypt(s->cert, s->s2->tmp.enc,
342
++                                &(p[s->s2->tmp.clear]),
343
++                                &(p[s->s2->tmp.clear]),
344
++                                (s->s2->ssl2_rollback) ? RSA_SSLV23_PADDING :
345
++                                RSA_PKCS1_PADDING);
346
++
347
+     /* bad decrypt */
348
+ # if 1
349
+     /*
350
+      * If a bad decrypt, continue with protocol but with a random master
351
+      * secret (Bleichenbacher attack)
352
+      */
353
+-    if ((i < 0) || ((!is_export && (i != EVP_CIPHER_key_length(c)))
354
+-                    || (is_export && ((i != ek)
355
+-                                      || (s->s2->tmp.clear +
356
+-                                          (unsigned int)i != (unsigned int)
357
+-                                          EVP_CIPHER_key_length(c)))))) {
358
++    if ((i < 0) || ((!is_export && i != EVP_CIPHER_key_length(c))
359
++                    || (is_export && i != ek))) {
360
+         ERR_clear_error();
361
+         if (is_export)
362
+             i = ek;
363
+         else
364
+             i = EVP_CIPHER_key_length(c);
365
+-        if (RAND_pseudo_bytes(p, i) <= 0)
366
++        if (RAND_pseudo_bytes(&p[s->s2->tmp.clear], i) <= 0)
367
+             return 0;
368
+     }
369
+ # else
370
+@@ -513,7 +546,7 @@
371
+ # endif
372
+ 
373
+     if (is_export)
374
+-        i += s->s2->tmp.clear;
375
++        i = EVP_CIPHER_key_length(c);
376
+ 
377
+     if (i > SSL_MAX_MASTER_KEY_LENGTH) {
378
+         ssl2_return_error(s, SSL2_PE_UNDEFINED_ERROR);
379
+--- openssl-1.0.2/ssl/s3_pkt.c
380
+@@ -780,7 +780,7 @@
381
+ 
382
+             i = ssl3_write_pending(s, type, &buf[tot], nw);
383
+             if (i <= 0) {
384
+-                if (i < 0) {
385
++                if (i < 0 && (!s->wbio || !BIO_should_retry(s->wbio))) {
386
+                     OPENSSL_free(wb->buf);
387
+                     wb->buf = NULL;
388
+                 }
389
+--- openssl-1.0.2/ssl/s3_srvr.c
390
+@@ -2251,10 +2251,17 @@
391
+     if (alg_k & (SSL_kEDH | SSL_kDHr | SSL_kDHd)) {
392
+         int idx = -1;
393
+         EVP_PKEY *skey = NULL;
394
+-        if (n)
395
++        if (n) {
396
+             n2s(p, i);
397
+-        else
398
++        } else {
399
++            if (alg_k & SSL_kDHE) {
400
++                al = SSL_AD_HANDSHAKE_FAILURE;
401
++                SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,
402
++                       SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG);
403
++                goto f_err;
404
++            }
405
+             i = 0;
406
++        }
407
+         if (n && n != i + 2) {
408
+             if (!(s->options & SSL_OP_SSLEAY_080_CLIENT_DH_BUG)) {
409
+                 SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,
410
+--- openssl-1.0.2/ssl/t1_lib.c
411
+@@ -2965,6 +2965,7 @@
412
+     if (s->cert->shared_sigalgs) {
413
+         OPENSSL_free(s->cert->shared_sigalgs);
414
+         s->cert->shared_sigalgs = NULL;
415
++        s->cert->shared_sigalgslen = 0;
416
+     }
417
+     /* Clear certificate digests and validity flags */
418
+     for (i = 0; i < SSL_PKEY_NUM; i++) {
419
+@@ -3618,6 +3619,7 @@
420
+     if (c->shared_sigalgs) {
421
+         OPENSSL_free(c->shared_sigalgs);
422
+         c->shared_sigalgs = NULL;
423
++        c->shared_sigalgslen = 0;
424
+     }
425
+     /* If client use client signature algorithms if not NULL */
426
+     if (!s->server && c->client_sigalgs && !is_suiteb) {
427
+@@ -3640,12 +3642,14 @@
428
+         preflen = c->peer_sigalgslen;
429
+     }
430
+     nmatch = tls12_do_shared_sigalgs(NULL, pref, preflen, allow, allowlen);
431
+-    if (!nmatch)
432
+-        return 1;
433
+-    salgs = OPENSSL_malloc(nmatch * sizeof(TLS_SIGALGS));
434
+-    if (!salgs)
435
+-        return 0;
436
+-    nmatch = tls12_do_shared_sigalgs(salgs, pref, preflen, allow, allowlen);
437
++    if (nmatch) {
438
++        salgs = OPENSSL_malloc(nmatch * sizeof(TLS_SIGALGS));
439
++        if (!salgs)
440
++            return 0;
441
++        nmatch = tls12_do_shared_sigalgs(salgs, pref, preflen, allow, allowlen);
442
++    } else {
443
++        salgs = NULL;
444
++    }
445
+     c->shared_sigalgs = salgs;
446
+     c->shared_sigalgslen = nmatch;
447
+     return 1;
0 448
similarity index 95%
1 449
rename from dev-libs/openssl/openssl-1.0.2a.ebuild
2 450
rename to dev-libs/openssl/openssl-1.0.2-r3.ebuild
... ...
@@ -1,6 +1,6 @@
1 1
 # Copyright 1999-2015 Gentoo Foundation
2 2
 # Distributed under the terms of the GNU General Public License v2
3
-# $Header: /var/cvsroot/gentoo-x86/dev-libs/openssl/openssl-1.0.2-r2.ebuild,v 1.2 2015/03/04 16:41:25 vapier Exp $
3
+# $Header: /var/cvsroot/gentoo-x86/dev-libs/openssl/openssl-1.0.2-r3.ebuild,v 1.1 2015/03/19 14:28:24 polynomial-c Exp $
4 4
 
5 5
 EAPI="4"
6 6
 
... ...
@@ -15,7 +15,7 @@ SRC_URI="mirror://openssl/source/${MY_P}.tar.gz
15 15
 
16 16
 LICENSE="openssl"
17 17
 SLOT="0"
18
-KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~arm-linux ~x86-linux"
18
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~arm-linux ~x86-linux"
19 19
 IUSE="bindist gmp kerberos rfc3779 sctp cpu_flags_x86_sse2 static-libs test +tls-heartbeat vanilla zlib insecure-ssl2 insecure-ssl3"
20 20
 
21 21
 # The blocks are temporary just to make sure people upgrade to a
... ...
@@ -55,14 +55,15 @@ src_prepare() {
55 55
 	# that gets blown away anyways by the Configure script in src_configure
56 56
 	rm -f Makefile
57 57
 
58
-	#epatch "${FILESDIR}"/${P}-CVE-2015-0209.patch #541502
59
-	#epatch "${FILESDIR}"/${P}-CVE-2015-0288.patch #542038
58
+	epatch "${FILESDIR}"/${P}-CVE-2015-0209.patch #541502
59
+	epatch "${FILESDIR}"/${P}-CVE-2015-0288.patch #542038
60 60
 	if ! use vanilla ; then
61 61
 		epatch "${FILESDIR}"/${PN}-1.0.0a-ldflags.patch #327421
62 62
 		epatch "${FILESDIR}"/${PN}-1.0.0d-windres.patch #373743
63 63
 		epatch "${FILESDIR}"/${PN}-1.0.2-parallel-build.patch
64 64
 		epatch "${FILESDIR}"/${PN}-1.0.2-ipv6.patch
65 65
 		epatch "${FILESDIR}"/${PN}-1.0.2-s_client-verify.patch #472584
66
+		epatch "${FILESDIR}"/${PN}-1.0.2-CVE-2015-0291.patch
66 67
 
67 68
 		epatch_user #332661
68 69
 	fi
... ...
@@ -149,9 +150,6 @@ multilib_src_configure() {
149 150
 		$(use sctp && echo "sctp") \
150 151
 		$(use cpu_flags_x86_sse2 || echo "no-sse2") \
151 152
 		enable-camellia \
152
- 		$(use_ssl insecure-ssl2 ssl2) \
153
- 		$(use_ssl insecure-ssl3 ssl3) \
154
-
155 153
 		$(use_ssl !bindist ec) \
156 154
 		${ec_nistp_64_gcc_128} \
157 155
 		enable-idea \
... ...
@@ -163,6 +161,8 @@ multilib_src_configure() {
163 161
 		$(use_ssl rfc3779) \
164 162
 		$(use_ssl tls-heartbeat heartbeats) \
165 163
 		$(use_ssl zlib) \
164
+ 		$(use_ssl insecure-ssl2 ssl2) \
165
+ 		$(use_ssl insecure-ssl3 ssl3) \
166 166
 		--prefix="${EPREFIX}"/usr \
167 167
 		--openssldir="${EPREFIX}"${SSL_CNF_DIR} \
168 168
 		--libdir=$(get_libdir) \