From cbecee4df2a91fa5c6d80d56965f7e7fe09add7d Mon Sep 17 00:00:00 2001 From: Lars Wendler Date: Thu, 19 Mar 2015 14:28:25 +0000 Subject: [PATCH] Security bump (bug #543552) Package-Manager: portage-2.2.18/cvs/Linux x86_64 Manifest-Sign-Key: 0x981CA6FC --- dev-libs/openssl/ChangeLog | 11 +- dev-libs/openssl/Manifest | 32 +- .../files/openssl-1.0.1l-CVE-2015-0286.patch | 356 ++++++++++++++ .../files/openssl-1.0.2-CVE-2015-0291.patch | 459 ++++++++++++++++++ dev-libs/openssl/openssl-1.0.1l-r1.ebuild | 259 ++++++++++ dev-libs/openssl/openssl-1.0.2-r3.ebuild | 262 ++++++++++ 6 files changed, 1364 insertions(+), 15 deletions(-) create mode 100644 dev-libs/openssl/files/openssl-1.0.1l-CVE-2015-0286.patch create mode 100644 dev-libs/openssl/files/openssl-1.0.2-CVE-2015-0291.patch create mode 100644 dev-libs/openssl/openssl-1.0.1l-r1.ebuild create mode 100644 dev-libs/openssl/openssl-1.0.2-r3.ebuild diff --git a/dev-libs/openssl/ChangeLog b/dev-libs/openssl/ChangeLog index ebc3daa80842..9241a6d632be 100644 --- a/dev-libs/openssl/ChangeLog +++ b/dev-libs/openssl/ChangeLog @@ -1,6 +1,15 @@ # ChangeLog for dev-libs/openssl # Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-libs/openssl/ChangeLog,v 1.631 2015/03/04 16:41:25 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-libs/openssl/ChangeLog,v 1.632 2015/03/19 14:28:24 polynomial-c Exp $ + +*openssl-1.0.2-r3 (19 Mar 2015) +*openssl-1.0.1l-r1 (19 Mar 2015) + + 19 Mar 2015; Lars Wendler + +openssl-1.0.1l-r1.ebuild, +openssl-1.0.2-r3.ebuild, + +files/openssl-1.0.1l-CVE-2015-0286.patch, + +files/openssl-1.0.2-CVE-2015-0291.patch: + Security bump (bug #543552). 04 Mar 2015; Mike Frysinger openssl-1.0.2-r2.ebuild: Require recent lksctp-tools #506046#8 by Maciej Szmigiero. diff --git a/dev-libs/openssl/Manifest b/dev-libs/openssl/Manifest index 108ac4c0fae9..57632505fff7 100644 --- a/dev-libs/openssl/Manifest +++ b/dev-libs/openssl/Manifest @@ -17,8 +17,10 @@ AUX openssl-1.0.1-x32.patch 3273 SHA256 a4f05b8757e225a05a9c5a3ea485159066760d87 AUX openssl-1.0.1e-s_client-verify.patch 592 SHA256 6f540fce663eefbe68cee16ad7d8d561d6c898eeb4180c2f4a4caa7e43c6d0c9 SHA512 117b1017e1259667078d3ccdcd9fd46357c6f85cf2702794f49c612b37acdc044fe88f871dbe46fcad9ed4cd8aaaaee800dddb5286203322802efd7549a43b68 WHIRLPOOL 70a4cc36b1dcb24d7e9bcef016684fb2394977f7f20aa332ebd0aa15e3f4c16c74563d2fc0ba8d70669f6cc9a13bf8a30cdb28ebafe2d102cd2859a4e32c38d7 AUX openssl-1.0.1f-revert-alpha-perl-generation.patch 3102 SHA256 6e502275b32ac0eca80f28448ae1bb88506f9135258f420fd857ea0b9b485778 SHA512 c80439da3d268e70fd492d0ca73c0a17ddb088b9330610794a338d1921ee13dad9caca4c81ca103b82a7541c8712f77e51f352ec1b1b02789d9aed291acb0cdc WHIRLPOOL cb760366c8759b1c78c5307134bb48c4fc12b1556276c2ef55455ea54725d20cb433ade966a7453f512d2feb5ae89a9798078ab535e4605366633a8e003c7ac6 AUX openssl-1.0.1h-ipv6.patch 17788 SHA256 7adeeb88cc544f8b210efbe2baff48fccf5029b582dff7010ae70e0e1f097d7b SHA512 0f0990d4294abcb5f3e51c84080883046a054c710b57a23f99b3323727d5e9aeb5ddeb6b6c2565b4be364f7c21419c90ce5288154e404cd663678f87e0d1c259 WHIRLPOOL cfe7a2e141a4a6252ffcfe215b16dd1082bc14a757dad7eb01bb9819de41ef0ee51a4b2dbf110c27b52e483341c337bf4d1f77f4f9f3172d2fee9e348c30af7e +AUX openssl-1.0.1l-CVE-2015-0286.patch 10790 SHA256 3d234f4b7bd79b7de1a6fe2f42016531732c81dcb73af45edc5b280858d32cb8 SHA512 432a9e556df26e3f0059f53556dbc088cfe7e30e2c38354e7a7879bb4db204330702ab8050b9b31b3ef48badb8f0abdbf047445b71aa0c4c96f5aeb0bf16f9df WHIRLPOOL c4834efebdca3bee769819fee40099f2d83f4282db98a96da853164dae2639adaef18fe3caf87801f52e53b47752a99fd693aab66239e30344b714119c4c1c7a AUX openssl-1.0.2-CVE-2015-0209.patch 1282 SHA256 6be2b1fa0d440bc1c1b15da4a9d32811a04c3e7c701678eb8ee72454bbf87401 SHA512 db5b73c815582453d3231d49c9c24d60824e56f67a74f815818d0f90bccd485e98a98b449386aa297fa055b5fc27e2a058c03bc410478fb98051a729ac75b4db WHIRLPOOL 46ddfaff115622e2426c544e757bf882fc5069f35d169189cf277d90a5ad36c274beaf1ff89cdc593e2e5cd1593588c389262dce3bb6a166c5fd7eb908458fec AUX openssl-1.0.2-CVE-2015-0288.patch 800 SHA256 613acdc06a22ec5cbc274cc39022b1fa1fd73e409551493bcab6d4a273983484 SHA512 4785d9c4620492c4997cbe7c83a42a9804a9e8c3d94e35dd7d3e6bd16f607a9b294b77123686f24c953e6330f96907008dccf1379648d806fa85bbdd20b81ca0 WHIRLPOOL 738831379e3c117f260306e2f39aacd51b895ed4bcb7dd0189f14a7301c09ffd4fbd882fbd05d7e71cd6c9524fc289124909e5fd2dcc23607fa4ce71ba3a0df7 +AUX openssl-1.0.2-CVE-2015-0291.patch 16069 SHA256 be4f9fa463a027e7c77396a8d3ddc1d6ad6c0bbc8b07c2f7af0738621c619710 SHA512 2ee10f21ce02f1c46ee6c446c60d4e1e3af05366769603f38c971018ce07341369db87cb050432d0501f152cabf377c03848df501694ea46ef2f6578d19cf030 WHIRLPOOL 1ea004fe43633b18c91a8cf390285c274b1c05d3bed313ccc6f9bebb92e0b313504f17d4fe41a643feedc626a8851c6e568b34b2d5bf7d62683e170f5c3e5301 AUX openssl-1.0.2-ipv6.patch 18811 SHA256 9ff3150c75f3f3e6a9773ffe54d90994cbf68cc919134aea68e09e7ed921763d SHA512 58e293f8f19a3fad08729b842dd977b73fedb0c49208d87a056bfea857c0e2b79a310d7d098c04429b65564fce64defeda6d1dcc3068ad5a80ef276db6421e54 WHIRLPOOL 36a0fffc7238011b93077bed94c9507f2ffc1cf199e6c06e94d01589cdc84a6568b9122e1a120b8262bd0a1c43f25169a29796c92a78338dd9f03b4cc2cdf0b8 AUX openssl-1.0.2-parallel-build.patch 10661 SHA256 bc5622150a964dc2d9909f41557140b696ce1bdfa4e2b12cc3e0e51029ead32b SHA512 a4957304a4424016cd8a1c6552c422cd042d737e12f96235ec54d1e601ccbe8cb79d931ac8777d1a599bd4a70eac4e6700a24362f14fb04eb273df82f2de0d01 WHIRLPOOL 5b34e45dcb0db6649e26d275925ca008f5201afbc22184e15c5324513bc0ed40ee271a70686e10a20bb219b3c4bd2148323b317ead97cdc27a3c897c0a07d228 AUX openssl-1.0.2-s_client-verify.patch 648 SHA256 b6ca2278dd9833f87a1d0037cb3cac8aee0f8326ff13ece1f08a536b8545eb77 SHA512 78b09ae700096205582785584a268776af46fc5bc94a0faa1ce6087ffcc945649e69269ff7fa88dedd5df1a5cdecc53e885de1e39506470f23b02028ca962104 WHIRLPOOL 8e7c90d37c1736b4b2f2c38d1c12dcfee4996a50a2a7dd07645a0c0b6616006d11232dd0f88ab735833e1c46aa171ceb5e1288c3d57296010bdda59295de7599 @@ -41,25 +43,27 @@ EBUILD openssl-0.9.8z_p5.ebuild 5021 SHA256 82deb7f4a4fdd0e0717d7f13d99bef53cae6 EBUILD openssl-1.0.0q.ebuild 7075 SHA256 aeddad6e3cf7a01dc270ca928bf9e2c2d9d3315579afc3fc2317c96f0c0634d1 SHA512 088beca351809a7a8cd85a7b409a985e4e9c82df7abdc1829526c8f4d923b568d406d5d52ef6600b7beab2d4cda58ee4c644fb9bc329d7cda95ccefd19e15e3f WHIRLPOOL bd816ac0f6659c5dda70c4dffccab98c9d379f29288099f0855f8cc7f4c216271c46c8e81a7d32774792f9167f664f4192aa1283532be8b867e6f0c0bc6a9a2d EBUILD openssl-1.0.1j.ebuild 8781 SHA256 d95067eb3e8a17a63af329b7fe90dbf1f8f172512d0d6c87d2468295c3a13492 SHA512 e6687805ace2465600d6a212f07f84d549d6949c29e336104966691081773d0729c3b165356be07e52c9eacb1135924a2f4c1dddfc919096a815a3bb92f4333d WHIRLPOOL 5195724f3e59bb54cff52cdfd7532860da8edbd8752276c6aa7aef7baf2cfdf9c0bde46055140ed5c636b4763f6a4cf7d723ae73afe3393be0fe5fd218f63e51 EBUILD openssl-1.0.1k.ebuild 8785 SHA256 15a9925bac0ded537ef3f17292d8c76fa921fc6149d9a41c9f9c25a8dac8fdb1 SHA512 182fdaeff959ec9227241af5c6ae5559f3faf821c71150404bdea4b88657b8d01fa3ff54d700e118a16b0459d8c9d8235e8d337fa4f94038f12e170665ff0546 WHIRLPOOL 23fd4b7c4f4905403cb13588093740f4ab3617ec2a7ee043e8b50e6a6db9898630f0937bfa28ffa48eb98bc84ce0e1eb31b81df2dbdef294074dcad3e23f6498 +EBUILD openssl-1.0.1l-r1.ebuild 8866 SHA256 59e7da112950c303230821d07881365c4c68a45f18aebde73369a5769f9648a1 SHA512 5bf2ba0a483fd78542affd6997895b3b2ee245d71d12b7470111ab7db0b567622e01a10cf759b76e99df0e513034621750bf73f90d69527f0929853ee2ec173e WHIRLPOOL ec5382200c2fe85a6ba41bdc4c74fc4a6ed57be3063962699d7711800b2fac4c2d98cc8279b2cc75e76cba541d12564adba5bc56e498519d1b6cbdc35dfcbf3c EBUILD openssl-1.0.1l.ebuild 8793 SHA256 f745217205fdb90496bcb3ce539b0d856b915623d17514c238a9e52ef6f1addd SHA512 145f809f24f0ec6707f0dc79d9c7ae52b5d35c69eed5e622fbb377c77e80c6f97dbb80ded3e142cac3646e3845a6cdf94f445968620b8f8924754dfea41b3cde WHIRLPOOL d08368fcab1a6d933424c6d67905b72bbe2d418320ea5fa1312fcd7e476d3c69fd085892242efb57548743b092a964a4bea75ad6e1f62b1b394a08670992e05d EBUILD openssl-1.0.2-r1.ebuild 8731 SHA256 648eb0511e4ddaf96bdfd9743d10a49e3be0068b6b2d6e88f2b83c58db0fb478 SHA512 e588f7fd3953e744ea1e1c03de718a5910390e47eb5692a66e14949ef4475a13aa871eb3c76c5a32a5e2e632e96104ddc872ea605abffe2ea37517ca1ee0f6f3 WHIRLPOOL e38e904d6580f83f12096a27d1906bfa722b8002c509cc242e7225568f99bb0dbde1cadcb3bbc2aed8e0de9da818199fb664c759b1d45d1c061a2e9dec5633a3 EBUILD openssl-1.0.2-r2.ebuild 8837 SHA256 94368907488d088c3bafccb5304bfcb1affc830d442715495e711b2c97f3c204 SHA512 21d57f56ccc5a15f02eef7a8b8684fb793173eacb29939958702fb277b6c5c028677704bbb2bc4880b32a29fc913b64d7a83ca5f1ab09a8aa6c26869b9a40dc6 WHIRLPOOL 7623ed6ac7858b6a533a12a17fd541cc91645a1fa41c2dce466b24afd51867ce98841a8aa6212bd4c76542918edb3e7da54148c0abe8e99e2500d7340e4ff026 -MISC ChangeLog 96817 SHA256 afb7a0d4f0efed2dce4e265745206a8ed593d386e65c17c6de20c1bd3f6c3b1f SHA512 012e1ce1fdbe2865d4a8817dccef5b1eaa27b6b79688585a1df991cf1e7840fe29af5061b706eb71ef6d25420b9fe9d035a57fb8c42d649b1bd3febffa92b8d8 WHIRLPOOL 18d924e62f3a2d0cb1141572e65a653e2b8dfd5f989b9b685ac07a836f4b0995c808a710c859a286efe95a39b440b6c1f373191a51b44632f90a860a97786e92 +EBUILD openssl-1.0.2-r3.ebuild 8898 SHA256 22f9818f36e4024fb97de00d63f968d802c46591f63943b57b6aa1f5f7c9ef09 SHA512 c3074774fcc69a08bef04e6ead96822a550458cb5a1476bb432302c6e586f8bade74df35c8a5467704863c81881619db2664e4d5e3f7675f7e7968e3ddbda2a7 WHIRLPOOL aca3af606654ae81d7c9fd56700814fe7c0b139c54c28b8032af9b0c0d904efe97438587471cd5356c62adcd3f548b3bfd57a5bbc8125157f3dacbe167e6fad7 +MISC ChangeLog 97119 SHA256 0194e621c8c35e98ac7d0adf3bdc3adfc8535568648767f355253fa69f28d3ff SHA512 a2886c363ffceda510bf91fd1246ab11db10b947c334a52de1065ced5f19b1600f5173670e11bee47c912eaa2df89c03019a70b833aa07df9c5e1b56a75da876 WHIRLPOOL fb7d8478654e8215bc78dce68aed05dbf1662da50eb1aa0649fbc3788df0c118baac684897b48aa1a5fb018f2e9518490e60b09ec69254a026794dc506a26fa2 MISC metadata.xml 637 SHA256 7b96f0e49fc5ab28bf914be847a89300bf3c7e65f652d748a48721a40c444b8d SHA512 a92ca59f6fc42237f7d30c4b0cd7339a7e82455ef31e155fb09d61012b3e3892d235d09a8c535f1db73b1468d483bb697575167cfe0d1ab45ef184bb95dc37db WHIRLPOOL f6fe48fc5b7a3a94eff327c5a8d6930efe2a7c92e7fb8a3366d8af0133b466420e68e168883742f993e89e45db12dab8c5a11e665242e368f012b0dc26d3c9ef -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 -iQIcBAEBCAAGBQJU9zW3AAoJEPGu1DbS6WIAnHQQAJLRWqn5TPsw4RKtY6SeYnAO -ZzUN6PlfpejuSD9EwmX1ZCvZWwFpseOhj/ED/JYoAhWI1TAz5J1v0Dm9jSGOVMDE -8TGNrca7eVGJWJPQq1SkXe4xRYErkrIfZ+Ei3yDah96GJFtH0ps5HwP4YMfODkyq -OjdD4mWdy4Z29PFLa8/b9d7YCRlYX/HuI1+1vmt0mneq7UcdPZwC4MnM7xaKLwE2 -v2LQd7mCbW44wNPzMC6+lKUYpb5XcrC5uVJuIr1WG5Ombh7mNWQajwaV17RawWvY -4+fTW5yfmqWHcyhCcnh5QvsQKtNW0QB629qRNiQMwAf0diWCiyAQIj0s/DS4eQOx -GIrLvvhBuCaKlnvMMqUBOI5ystrUVJhqaGmuOOajUD6FQ9Y/DRKJoWdBlHOTlMhr -thjqja/gbrcwnJqcNP4q5RqZzfiYjpP0Op3NZ3NybIKsr3q7SglTMFs645XWJpLQ -rOokhfnnxEZ+mtrOJRh5RmIKgTRBt6/KeFgy6mIcJTYXjXLkaZJRSzOYrVkeluR2 -vw0/Te7Es83CttkN3bJlHddKANmgxSJnChepqqfknnJuCPQl/CY+Cu1/VQaFCErU -FsHMr0D33/MKFTjqVsKbsdIYtFJ9B9+f8rptTAyb94y/Q73dZSrTCW+PJ9w+7YOd -ASK9IgByfE4C+s5D8noA -=yrFC +iQIcBAEBCAAGBQJVCt0JAAoJEPiazRVxLXTFCGgP/Ro9ejRRDPLUaKr/K5SM50yw +QZ73PkkAPCB2I/ZWWuwgCQdrGbvSR9b8e5v6XbJYUkUXyCE2ve6JSYgg40qpmgpQ +KG7hh0dkql+rk+4fXY1LlEejYufCvuAeZvDgv6IQKg+qIQFMGzIUAx5QIsHvKok+ +HpyMDo1V1+Y1/G5AxHRIQrmPJXlOgHROQ7EyjkIJ6Odb8bB1jvVq1Vf7yp/6NlT3 +wZdoT5EiTTd0NIuQNLS8rxTyXipJigK91o021GbZNsMMUrmKisFNGw3qm5q4febx +s1yfEW3RbaHVIn6CXZwdjm8YN5T9MfCY1l03UZO2se3LdUrxFokxr1f07sq5jeMt +a8AJmQXSRH4deKhm0Sm1LwDGijilW9zDwgU/Y6BS1MftXUNcvRuCjQsatc+YV+zV +6F5obT/0eJ1PwP0lBOY03ZnJvAqp+8nUFms+P4N+MjHak6RmeWAsgnhin03GHQIQ +KcSyFm51WygQbuJzG5CjKWgWbyebr45dVgOxyqypi2XPpYlkicNTvFNPVXe6fu81 +N7SlAJfbhXk3LRNgKAcZWQgFAUvdalA5CIA7xCsP6pqO5ASomCPNffrVd4AU9qNp +kB06bangmr3dHwJNDCgsfPcxq5GrYggXZZBEMmXokQpeif4V454LoOWbVVQgk+Q5 +FHl7+QqO3h0KhKHYEs1a +=8Xbm -----END PGP SIGNATURE----- diff --git a/dev-libs/openssl/files/openssl-1.0.1l-CVE-2015-0286.patch b/dev-libs/openssl/files/openssl-1.0.1l-CVE-2015-0286.patch new file mode 100644 index 000000000000..811f573a1107 --- /dev/null +++ b/dev-libs/openssl/files/openssl-1.0.1l-CVE-2015-0286.patch @@ -0,0 +1,356 @@ +--- openssl-1.0.1l/crypto/asn1/a_type.c ++++ openssl-1.0.1l/crypto/asn1/a_type.c +@@ -124,6 +124,9 @@ + case V_ASN1_OBJECT: + result = OBJ_cmp(a->value.object, b->value.object); + break; ++ case V_ASN1_BOOLEAN: ++ result = a->value.boolean - b->value.boolean; ++ break; + case V_ASN1_NULL: + result = 0; /* They do not have content. */ + break; +--- openssl-1.0.1l/crypto/asn1/tasn_dec.c ++++ openssl-1.0.1l/crypto/asn1/tasn_dec.c +@@ -130,11 +130,17 @@ + { + ASN1_TLC c; + ASN1_VALUE *ptmpval = NULL; +- if (!pval) +- pval = &ptmpval; + asn1_tlc_clear_nc(&c); +- if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0) +- return *pval; ++ if (pval && *pval && it->itype == ASN1_ITYPE_PRIMITIVE) ++ ptmpval = *pval; ++ if (ASN1_item_ex_d2i(&ptmpval, in, len, it, -1, 0, 0, &c) > 0) { ++ if (pval && it->itype != ASN1_ITYPE_PRIMITIVE) { ++ if (*pval) ++ ASN1_item_free(*pval, it); ++ *pval = ptmpval; ++ } ++ return ptmpval; ++ } + return NULL; + } + +@@ -311,9 +317,16 @@ + if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it, NULL)) + goto auxerr; + +- /* Allocate structure */ +- if (!*pval && !ASN1_item_ex_new(pval, it)) +- { ++ if (*pval) { ++ /* Free up and zero CHOICE value if initialised */ ++ i = asn1_get_choice_selector(pval, it); ++ if ((i >= 0) && (i < it->tcount)) { ++ tt = it->templates + i; ++ pchptr = asn1_get_field_ptr(pval, tt); ++ ASN1_template_free(pchptr, tt); ++ asn1_set_choice_selector(pval, -1, it); ++ } ++ } else if (!ASN1_item_ex_new(pval, it)) { + ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, + ERR_R_NESTED_ASN1_ERROR); + goto err; +@@ -407,6 +420,17 @@ + if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it, NULL)) + goto auxerr; + ++ /* Free up and zero any ADB found */ ++ for (i = 0, tt = it->templates; i < it->tcount; i++, tt++) { ++ if (tt->flags & ASN1_TFLG_ADB_MASK) { ++ const ASN1_TEMPLATE *seqtt; ++ ASN1_VALUE **pseqval; ++ seqtt = asn1_do_adb(pval, tt, 1); ++ pseqval = asn1_get_field_ptr(pval, seqtt); ++ ASN1_template_free(pseqval, seqtt); ++ } ++ } ++ + /* Get each field entry */ + for (i = 0, tt = it->templates; i < it->tcount; i++, tt++) + { +--- openssl-1.0.1l/crypto/pkcs7/pk7_doit.c ++++ openssl-1.0.1l/crypto/pkcs7/pk7_doit.c +@@ -272,6 +272,25 @@ + PKCS7_RECIP_INFO *ri=NULL; + ASN1_OCTET_STRING *os=NULL; + ++ if (p7 == NULL) { ++ PKCS7err(PKCS7_F_PKCS7_DATAINIT, PKCS7_R_INVALID_NULL_POINTER); ++ return NULL; ++ } ++ /* ++ * The content field in the PKCS7 ContentInfo is optional, but that really ++ * only applies to inner content (precisely, detached signatures). ++ * ++ * When reading content, missing outer content is therefore treated as an ++ * error. ++ * ++ * When creating content, PKCS7_content_new() must be called before ++ * calling this method, so a NULL p7->d is always an error. ++ */ ++ if (p7->d.ptr == NULL) { ++ PKCS7err(PKCS7_F_PKCS7_DATAINIT, PKCS7_R_NO_CONTENT); ++ return NULL; ++ } ++ + i=OBJ_obj2nid(p7->type); + p7->state=PKCS7_S_HEADER; + +@@ -433,6 +452,16 @@ + unsigned char *ek = NULL, *tkey = NULL; + int eklen = 0, tkeylen = 0; + ++ if (p7 == NULL) { ++ PKCS7err(PKCS7_F_PKCS7_DATADECODE, PKCS7_R_INVALID_NULL_POINTER); ++ return NULL; ++ } ++ ++ if (p7->d.ptr == NULL) { ++ PKCS7err(PKCS7_F_PKCS7_DATADECODE, PKCS7_R_NO_CONTENT); ++ return NULL; ++ } ++ + i=OBJ_obj2nid(p7->type); + p7->state=PKCS7_S_HEADER; + +@@ -752,6 +781,16 @@ + STACK_OF(PKCS7_SIGNER_INFO) *si_sk=NULL; + ASN1_OCTET_STRING *os=NULL; + ++ if (p7 == NULL) { ++ PKCS7err(PKCS7_F_PKCS7_DATAFINAL, PKCS7_R_INVALID_NULL_POINTER); ++ return 0; ++ } ++ ++ if (p7->d.ptr == NULL) { ++ PKCS7err(PKCS7_F_PKCS7_DATAFINAL, PKCS7_R_NO_CONTENT); ++ return 0; ++ } ++ + EVP_MD_CTX_init(&ctx_tmp); + i=OBJ_obj2nid(p7->type); + p7->state=PKCS7_S_HEADER; +@@ -796,6 +835,7 @@ + /* If detached data then the content is excluded */ + if(PKCS7_type_is_data(p7->d.sign->contents) && p7->detached) { + M_ASN1_OCTET_STRING_free(os); ++ os = NULL; + p7->d.sign->contents->d.data = NULL; + } + break; +@@ -806,6 +846,7 @@ + if(PKCS7_type_is_data(p7->d.digest->contents) && p7->detached) + { + M_ASN1_OCTET_STRING_free(os); ++ os = NULL; + p7->d.digest->contents->d.data = NULL; + } + break; +@@ -878,24 +919,31 @@ + M_ASN1_OCTET_STRING_set(p7->d.digest->digest, md_data, md_len); + } + +- if (!PKCS7_is_detached(p7) && !(os->flags & ASN1_STRING_FLAG_NDEF)) +- { ++ if (!PKCS7_is_detached(p7)) { ++ /* ++ * NOTE(emilia): I think we only reach os == NULL here because detached ++ * digested data support is broken. ++ */ ++ if (os == NULL) ++ goto err; ++ if (!(os->flags & ASN1_STRING_FLAG_NDEF)) { + char *cont; + long contlen; +- btmp=BIO_find_type(bio,BIO_TYPE_MEM); +- if (btmp == NULL) +- { +- PKCS7err(PKCS7_F_PKCS7_DATAFINAL,PKCS7_R_UNABLE_TO_FIND_MEM_BIO); +- goto err; +- } ++ btmp = BIO_find_type(bio, BIO_TYPE_MEM); ++ if (btmp == NULL) { ++ PKCS7err(PKCS7_F_PKCS7_DATAFINAL, PKCS7_R_UNABLE_TO_FIND_MEM_BIO); ++ goto err; ++ } + contlen = BIO_get_mem_data(btmp, &cont); +- /* Mark the BIO read only then we can use its copy of the data ++ /* ++ * Mark the BIO read only then we can use its copy of the data + * instead of making an extra copy. + */ + BIO_set_flags(btmp, BIO_FLAGS_MEM_RDONLY); + BIO_set_mem_eof_return(btmp, 0); + ASN1_STRING_set0(os, (unsigned char *)cont, contlen); +- } ++ } ++ } + ret=1; + err: + EVP_MD_CTX_cleanup(&ctx_tmp); +@@ -971,6 +1019,16 @@ + STACK_OF(X509) *cert; + X509 *x509; + ++ if (p7 == NULL) { ++ PKCS7err(PKCS7_F_PKCS7_DATAVERIFY, PKCS7_R_INVALID_NULL_POINTER); ++ return 0; ++ } ++ ++ if (p7->d.ptr == NULL) { ++ PKCS7err(PKCS7_F_PKCS7_DATAVERIFY, PKCS7_R_NO_CONTENT); ++ return 0; ++ } ++ + if (PKCS7_type_is_signed(p7)) + { + cert=p7->d.sign->cert; +--- openssl-1.0.1l/crypto/pkcs7/pk7_lib.c ++++ openssl-1.0.1l/crypto/pkcs7/pk7_lib.c +@@ -71,6 +71,7 @@ + + switch (cmd) + { ++ /* NOTE(emilia): does not support detached digested data. */ + case PKCS7_OP_SET_DETACHED_SIGNATURE: + if (nid == NID_pkcs7_signed) + { +@@ -459,6 +460,8 @@ + + STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7) + { ++ if (p7 == NULL || p7->d.ptr == NULL) ++ return NULL; + if (PKCS7_type_is_signed(p7)) + { + return(p7->d.sign->signer_info); +--- openssl-1.0.1l/doc/crypto/d2i_X509.pod ++++ openssl-1.0.1l/doc/crypto/d2i_X509.pod +@@ -199,6 +199,12 @@ + persist if they are not present in the new one. As a result the use + of this "reuse" behaviour is strongly discouraged. + ++Current versions of OpenSSL will not modify B<*px> if an error occurs. ++If parsing succeeds then B<*px> is freed (if it is not NULL) and then ++set to the value of the newly decoded structure. As a result B<*px> ++B be allocated on the stack or an attempt will be made to ++free an invalid pointer. ++ + i2d_X509() will not return an error in many versions of OpenSSL, + if mandatory fields are not initialized due to a programming error + then the encoded structure may contain invalid data or omit the +@@ -210,7 +216,9 @@ + + d2i_X509(), d2i_X509_bio() and d2i_X509_fp() return a valid B structure + or B if an error occurs. The error code that can be obtained by +-L. ++L. If the "reuse" capability has been used ++with a valid X509 structure being passed in via B then the object is not ++modified in the event of error. + + i2d_X509() returns the number of bytes successfully encoded or a negative + value if an error occurs. The error code can be obtained by +--- openssl-1.0.1l/ssl/s2_lib.c ++++ openssl-1.0.1l/ssl/s2_lib.c +@@ -488,7 +488,7 @@ + + OPENSSL_assert(s->session->master_key_length >= 0 + && s->session->master_key_length +- < (int)sizeof(s->session->master_key)); ++ <= (int)sizeof(s->session->master_key)); + EVP_DigestUpdate(&ctx,s->session->master_key,s->session->master_key_length); + EVP_DigestUpdate(&ctx,&c,1); + c++; +--- openssl-1.0.1l/ssl/s2_srvr.c ++++ openssl-1.0.1l/ssl/s2_srvr.c +@@ -454,10 +454,6 @@ + SSLerr(SSL_F_GET_CLIENT_MASTER_KEY,SSL_R_NO_PRIVATEKEY); + return(-1); + } +- i=ssl_rsa_private_decrypt(s->cert,s->s2->tmp.enc, +- &(p[s->s2->tmp.clear]),&(p[s->s2->tmp.clear]), +- (s->s2->ssl2_rollback)?RSA_SSLV23_PADDING:RSA_PKCS1_PADDING); +- + is_export=SSL_C_IS_EXPORT(s->session->cipher); + + if (!ssl_cipher_get_evp(s->session,&c,&md,NULL,NULL,NULL)) +@@ -475,21 +471,59 @@ + else + ek=5; + ++ /* ++ * The format of the CLIENT-MASTER-KEY message is ++ * 1 byte message type ++ * 3 bytes cipher ++ * 2-byte clear key length (stored in s->s2->tmp.clear) ++ * 2-byte encrypted key length (stored in s->s2->tmp.enc) ++ * 2-byte key args length (IV etc) ++ * clear key ++ * encrypted key ++ * key args ++ * ++ * If the cipher is an export cipher, then the encrypted key bytes ++ * are a fixed portion of the total key (5 or 8 bytes). The size of ++ * this portion is in |ek|. If the cipher is not an export cipher, ++ * then the entire key material is encrypted (i.e., clear key length ++ * must be zero). ++ */ ++ if ((!is_export && s->s2->tmp.clear != 0) || ++ (is_export && s->s2->tmp.clear + ek != EVP_CIPHER_key_length(c))) { ++ ssl2_return_error(s, SSL2_PE_UNDEFINED_ERROR); ++ SSLerr(SSL_F_GET_CLIENT_MASTER_KEY,SSL_R_BAD_LENGTH); ++ return -1; ++ } ++ /* ++ * The encrypted blob must decrypt to the encrypted portion of the key. ++ * Decryption can't be expanding, so if we don't have enough encrypted ++ * bytes to fit the key in the buffer, stop now. ++ */ ++ if ((is_export && s->s2->tmp.enc < ek) || ++ (!is_export && s->s2->tmp.enc < EVP_CIPHER_key_length(c))) { ++ ssl2_return_error(s,SSL2_PE_UNDEFINED_ERROR); ++ SSLerr(SSL_F_GET_CLIENT_MASTER_KEY,SSL_R_LENGTH_TOO_SHORT); ++ return -1; ++ } ++ ++ i = ssl_rsa_private_decrypt(s->cert, s->s2->tmp.enc, ++ &(p[s->s2->tmp.clear]), ++ &(p[s->s2->tmp.clear]), ++ (s->s2->ssl2_rollback) ? RSA_SSLV23_PADDING : ++ RSA_PKCS1_PADDING); ++ + /* bad decrypt */ + #if 1 + /* If a bad decrypt, continue with protocol but with a + * random master secret (Bleichenbacher attack) */ +- if ((i < 0) || +- ((!is_export && (i != EVP_CIPHER_key_length(c))) +- || (is_export && ((i != ek) || (s->s2->tmp.clear+(unsigned int)i != +- (unsigned int)EVP_CIPHER_key_length(c)))))) +- { ++ if ((i < 0) || ((!is_export && i != EVP_CIPHER_key_length(c)) ++ || (is_export && i != ek))) { + ERR_clear_error(); + if (is_export) + i=ek; + else + i=EVP_CIPHER_key_length(c); +- if (RAND_pseudo_bytes(p,i) <= 0) ++ if (RAND_pseudo_bytes(&p[s->s2->tmp.clear], i) <= 0) + return 0; + } + #else +@@ -513,7 +547,8 @@ + } + #endif + +- if (is_export) i+=s->s2->tmp.clear; ++ if (is_export) ++ i = EVP_CIPHER_key_length(c); + + if (i > SSL_MAX_MASTER_KEY_LENGTH) + { diff --git a/dev-libs/openssl/files/openssl-1.0.2-CVE-2015-0291.patch b/dev-libs/openssl/files/openssl-1.0.2-CVE-2015-0291.patch new file mode 100644 index 000000000000..852d06e9181a --- /dev/null +++ b/dev-libs/openssl/files/openssl-1.0.2-CVE-2015-0291.patch @@ -0,0 +1,459 @@ +--- openssl-1.0.2/crypto/asn1/a_type.c ++++ openssl-1.0.2/crypto/asn1/a_type.c +@@ -119,6 +119,9 @@ + case V_ASN1_OBJECT: + result = OBJ_cmp(a->value.object, b->value.object); + break; ++ case V_ASN1_BOOLEAN: ++ result = a->value.boolean - b->value.boolean; ++ break; + case V_ASN1_NULL: + result = 0; /* They do not have content. */ + break; +--- openssl-1.0.2/crypto/asn1/tasn_dec.c ++++ openssl-1.0.2/crypto/asn1/tasn_dec.c +@@ -140,11 +140,17 @@ + { + ASN1_TLC c; + ASN1_VALUE *ptmpval = NULL; +- if (!pval) +- pval = &ptmpval; + asn1_tlc_clear_nc(&c); +- if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0) +- return *pval; ++ if (pval && *pval && it->itype == ASN1_ITYPE_PRIMITIVE) ++ ptmpval = *pval; ++ if (ASN1_item_ex_d2i(&ptmpval, in, len, it, -1, 0, 0, &c) > 0) { ++ if (pval && it->itype != ASN1_ITYPE_PRIMITIVE) { ++ if (*pval) ++ ASN1_item_free(*pval, it); ++ *pval = ptmpval; ++ } ++ return ptmpval; ++ } + return NULL; + } + +@@ -304,9 +310,16 @@ + case ASN1_ITYPE_CHOICE: + if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it, NULL)) + goto auxerr; +- +- /* Allocate structure */ +- if (!*pval && !ASN1_item_ex_new(pval, it)) { ++ if (*pval) { ++ /* Free up and zero CHOICE value if initialised */ ++ i = asn1_get_choice_selector(pval, it); ++ if ((i >= 0) && (i < it->tcount)) { ++ tt = it->templates + i; ++ pchptr = asn1_get_field_ptr(pval, tt); ++ ASN1_template_free(pchptr, tt); ++ asn1_set_choice_selector(pval, -1, it); ++ } ++ } else if (!ASN1_item_ex_new(pval, it)) { + ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR); + goto err; + } +@@ -386,6 +399,17 @@ + if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it, NULL)) + goto auxerr; + ++ /* Free up and zero any ADB found */ ++ for (i = 0, tt = it->templates; i < it->tcount; i++, tt++) { ++ if (tt->flags & ASN1_TFLG_ADB_MASK) { ++ const ASN1_TEMPLATE *seqtt; ++ ASN1_VALUE **pseqval; ++ seqtt = asn1_do_adb(pval, tt, 1); ++ pseqval = asn1_get_field_ptr(pval, seqtt); ++ ASN1_template_free(pseqval, seqtt); ++ } ++ } ++ + /* Get each field entry */ + for (i = 0, tt = it->templates; i < it->tcount; i++, tt++) { + const ASN1_TEMPLATE *seqtt; +--- openssl-1.0.2/crypto/pkcs7/pk7_doit.c ++++ openssl-1.0.2/crypto/pkcs7/pk7_doit.c +@@ -261,6 +261,25 @@ + PKCS7_RECIP_INFO *ri = NULL; + ASN1_OCTET_STRING *os = NULL; + ++ if (p7 == NULL) { ++ PKCS7err(PKCS7_F_PKCS7_DATAINIT, PKCS7_R_INVALID_NULL_POINTER); ++ return NULL; ++ } ++ /* ++ * The content field in the PKCS7 ContentInfo is optional, but that really ++ * only applies to inner content (precisely, detached signatures). ++ * ++ * When reading content, missing outer content is therefore treated as an ++ * error. ++ * ++ * When creating content, PKCS7_content_new() must be called before ++ * calling this method, so a NULL p7->d is always an error. ++ */ ++ if (p7->d.ptr == NULL) { ++ PKCS7err(PKCS7_F_PKCS7_DATAINIT, PKCS7_R_NO_CONTENT); ++ return NULL; ++ } ++ + i = OBJ_obj2nid(p7->type); + p7->state = PKCS7_S_HEADER; + +@@ -411,6 +430,16 @@ + unsigned char *ek = NULL, *tkey = NULL; + int eklen = 0, tkeylen = 0; + ++ if (p7 == NULL) { ++ PKCS7err(PKCS7_F_PKCS7_DATADECODE, PKCS7_R_INVALID_NULL_POINTER); ++ return NULL; ++ } ++ ++ if (p7->d.ptr == NULL) { ++ PKCS7err(PKCS7_F_PKCS7_DATADECODE, PKCS7_R_NO_CONTENT); ++ return NULL; ++ } ++ + i = OBJ_obj2nid(p7->type); + p7->state = PKCS7_S_HEADER; + +@@ -707,6 +736,16 @@ + STACK_OF(PKCS7_SIGNER_INFO) *si_sk = NULL; + ASN1_OCTET_STRING *os = NULL; + ++ if (p7 == NULL) { ++ PKCS7err(PKCS7_F_PKCS7_DATAFINAL, PKCS7_R_INVALID_NULL_POINTER); ++ return 0; ++ } ++ ++ if (p7->d.ptr == NULL) { ++ PKCS7err(PKCS7_F_PKCS7_DATAFINAL, PKCS7_R_NO_CONTENT); ++ return 0; ++ } ++ + EVP_MD_CTX_init(&ctx_tmp); + i = OBJ_obj2nid(p7->type); + p7->state = PKCS7_S_HEADER; +@@ -746,6 +785,7 @@ + /* If detached data then the content is excluded */ + if (PKCS7_type_is_data(p7->d.sign->contents) && p7->detached) { + M_ASN1_OCTET_STRING_free(os); ++ os = NULL; + p7->d.sign->contents->d.data = NULL; + } + break; +@@ -755,6 +795,7 @@ + /* If detached data then the content is excluded */ + if (PKCS7_type_is_data(p7->d.digest->contents) && p7->detached) { + M_ASN1_OCTET_STRING_free(os); ++ os = NULL; + p7->d.digest->contents->d.data = NULL; + } + break; +@@ -820,22 +861,30 @@ + M_ASN1_OCTET_STRING_set(p7->d.digest->digest, md_data, md_len); + } + +- if (!PKCS7_is_detached(p7) && !(os->flags & ASN1_STRING_FLAG_NDEF)) { +- char *cont; +- long contlen; +- btmp = BIO_find_type(bio, BIO_TYPE_MEM); +- if (btmp == NULL) { +- PKCS7err(PKCS7_F_PKCS7_DATAFINAL, PKCS7_R_UNABLE_TO_FIND_MEM_BIO); +- goto err; +- } +- contlen = BIO_get_mem_data(btmp, &cont); ++ if (!PKCS7_is_detached(p7)) { + /* +- * Mark the BIO read only then we can use its copy of the data +- * instead of making an extra copy. ++ * NOTE(emilia): I think we only reach os == NULL here because detached ++ * digested data support is broken. + */ +- BIO_set_flags(btmp, BIO_FLAGS_MEM_RDONLY); +- BIO_set_mem_eof_return(btmp, 0); +- ASN1_STRING_set0(os, (unsigned char *)cont, contlen); ++ if (os == NULL) ++ goto err; ++ if (!(os->flags & ASN1_STRING_FLAG_NDEF)) { ++ char *cont; ++ long contlen; ++ btmp = BIO_find_type(bio, BIO_TYPE_MEM); ++ if (btmp == NULL) { ++ PKCS7err(PKCS7_F_PKCS7_DATAFINAL, PKCS7_R_UNABLE_TO_FIND_MEM_BIO); ++ goto err; ++ } ++ contlen = BIO_get_mem_data(btmp, &cont); ++ /* ++ * Mark the BIO read only then we can use its copy of the data ++ * instead of making an extra copy. ++ */ ++ BIO_set_flags(btmp, BIO_FLAGS_MEM_RDONLY); ++ BIO_set_mem_eof_return(btmp, 0); ++ ASN1_STRING_set0(os, (unsigned char *)cont, contlen); ++ } + } + ret = 1; + err: +@@ -910,6 +959,16 @@ + STACK_OF(X509) *cert; + X509 *x509; + ++ if (p7 == NULL) { ++ PKCS7err(PKCS7_F_PKCS7_DATAVERIFY, PKCS7_R_INVALID_NULL_POINTER); ++ return 0; ++ } ++ ++ if (p7->d.ptr == NULL) { ++ PKCS7err(PKCS7_F_PKCS7_DATAVERIFY, PKCS7_R_NO_CONTENT); ++ return 0; ++ } ++ + if (PKCS7_type_is_signed(p7)) { + cert = p7->d.sign->cert; + } else if (PKCS7_type_is_signedAndEnveloped(p7)) { +--- openssl-1.0.2/crypto/pkcs7/pk7_lib.c ++++ openssl-1.0.2/crypto/pkcs7/pk7_lib.c +@@ -70,6 +70,7 @@ + nid = OBJ_obj2nid(p7->type); + + switch (cmd) { ++ /* NOTE(emilia): does not support detached digested data. */ + case PKCS7_OP_SET_DETACHED_SIGNATURE: + if (nid == NID_pkcs7_signed) { + ret = p7->detached = (int)larg; +@@ -444,6 +445,8 @@ + + STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7) + { ++ if (p7 == NULL || p7->d.ptr == NULL) ++ return NULL; + if (PKCS7_type_is_signed(p7)) { + return (p7->d.sign->signer_info); + } else if (PKCS7_type_is_signedAndEnveloped(p7)) { +--- openssl-1.0.2/crypto/rsa/rsa_ameth.c ++++ openssl-1.0.2/crypto/rsa/rsa_ameth.c +@@ -698,9 +698,10 @@ + RSAerr(RSA_F_RSA_ITEM_VERIFY, RSA_R_UNSUPPORTED_SIGNATURE_TYPE); + return -1; + } +- if (rsa_pss_to_ctx(ctx, NULL, sigalg, pkey)) ++ if (rsa_pss_to_ctx(ctx, NULL, sigalg, pkey) > 0) { + /* Carry on */ + return 2; ++ } + return -1; + } + +--- openssl-1.0.2/doc/crypto/d2i_X509.pod ++++ openssl-1.0.2/doc/crypto/d2i_X509.pod +@@ -207,6 +207,12 @@ + persist if they are not present in the new one. As a result the use + of this "reuse" behaviour is strongly discouraged. + ++Current versions of OpenSSL will not modify B<*px> if an error occurs. ++If parsing succeeds then B<*px> is freed (if it is not NULL) and then ++set to the value of the newly decoded structure. As a result B<*px> ++B be allocated on the stack or an attempt will be made to ++free an invalid pointer. ++ + i2d_X509() will not return an error in many versions of OpenSSL, + if mandatory fields are not initialized due to a programming error + then the encoded structure may contain invalid data or omit the +@@ -233,7 +239,9 @@ + + d2i_X509(), d2i_X509_bio() and d2i_X509_fp() return a valid B structure + or B if an error occurs. The error code that can be obtained by +-L. ++L. If the "reuse" capability has been used ++with a valid X509 structure being passed in via B then the object is not ++modified in the event of error. + + i2d_X509() returns the number of bytes successfully encoded or a negative + value if an error occurs. The error code can be obtained by +--- openssl-1.0.2/ssl/d1_lib.c ++++ openssl-1.0.2/ssl/d1_lib.c +@@ -543,6 +543,9 @@ + { + int ret; + ++ /* Ensure there is no state left over from a previous invocation */ ++ SSL_clear(s); ++ + SSL_set_options(s, SSL_OP_COOKIE_EXCHANGE); + s->d1->listen = 1; + +--- openssl-1.0.2/ssl/s2_lib.c ++++ openssl-1.0.2/ssl/s2_lib.c +@@ -493,7 +493,7 @@ + + OPENSSL_assert(s->session->master_key_length >= 0 + && s->session->master_key_length +- < (int)sizeof(s->session->master_key)); ++ <= (int)sizeof(s->session->master_key)); + EVP_DigestUpdate(&ctx, s->session->master_key, + s->session->master_key_length); + EVP_DigestUpdate(&ctx, &c, 1); +--- openssl-1.0.2/ssl/s2_srvr.c ++++ openssl-1.0.2/ssl/s2_srvr.c +@@ -454,11 +454,6 @@ + SSLerr(SSL_F_GET_CLIENT_MASTER_KEY, SSL_R_NO_PRIVATEKEY); + return (-1); + } +- i = ssl_rsa_private_decrypt(s->cert, s->s2->tmp.enc, +- &(p[s->s2->tmp.clear]), +- &(p[s->s2->tmp.clear]), +- (s->s2->ssl2_rollback) ? RSA_SSLV23_PADDING : +- RSA_PKCS1_PADDING); + + is_export = SSL_C_IS_EXPORT(s->session->cipher); + +@@ -475,23 +470,61 @@ + } else + ek = 5; + ++ /* ++ * The format of the CLIENT-MASTER-KEY message is ++ * 1 byte message type ++ * 3 bytes cipher ++ * 2-byte clear key length (stored in s->s2->tmp.clear) ++ * 2-byte encrypted key length (stored in s->s2->tmp.enc) ++ * 2-byte key args length (IV etc) ++ * clear key ++ * encrypted key ++ * key args ++ * ++ * If the cipher is an export cipher, then the encrypted key bytes ++ * are a fixed portion of the total key (5 or 8 bytes). The size of ++ * this portion is in |ek|. If the cipher is not an export cipher, ++ * then the entire key material is encrypted (i.e., clear key length ++ * must be zero). ++ */ ++ if ((!is_export && s->s2->tmp.clear != 0) || ++ (is_export && s->s2->tmp.clear + ek != EVP_CIPHER_key_length(c))) { ++ ssl2_return_error(s, SSL2_PE_UNDEFINED_ERROR); ++ SSLerr(SSL_F_GET_CLIENT_MASTER_KEY,SSL_R_BAD_LENGTH); ++ return -1; ++ } ++ /* ++ * The encrypted blob must decrypt to the encrypted portion of the key. ++ * Decryption can't be expanding, so if we don't have enough encrypted ++ * bytes to fit the key in the buffer, stop now. ++ */ ++ if ((is_export && s->s2->tmp.enc < ek) || ++ (!is_export && s->s2->tmp.enc < EVP_CIPHER_key_length(c))) { ++ ssl2_return_error(s,SSL2_PE_UNDEFINED_ERROR); ++ SSLerr(SSL_F_GET_CLIENT_MASTER_KEY,SSL_R_LENGTH_TOO_SHORT); ++ return -1; ++ } ++ ++ i = ssl_rsa_private_decrypt(s->cert, s->s2->tmp.enc, ++ &(p[s->s2->tmp.clear]), ++ &(p[s->s2->tmp.clear]), ++ (s->s2->ssl2_rollback) ? RSA_SSLV23_PADDING : ++ RSA_PKCS1_PADDING); ++ + /* bad decrypt */ + # if 1 + /* + * If a bad decrypt, continue with protocol but with a random master + * secret (Bleichenbacher attack) + */ +- if ((i < 0) || ((!is_export && (i != EVP_CIPHER_key_length(c))) +- || (is_export && ((i != ek) +- || (s->s2->tmp.clear + +- (unsigned int)i != (unsigned int) +- EVP_CIPHER_key_length(c)))))) { ++ if ((i < 0) || ((!is_export && i != EVP_CIPHER_key_length(c)) ++ || (is_export && i != ek))) { + ERR_clear_error(); + if (is_export) + i = ek; + else + i = EVP_CIPHER_key_length(c); +- if (RAND_pseudo_bytes(p, i) <= 0) ++ if (RAND_pseudo_bytes(&p[s->s2->tmp.clear], i) <= 0) + return 0; + } + # else +@@ -513,7 +546,7 @@ + # endif + + if (is_export) +- i += s->s2->tmp.clear; ++ i = EVP_CIPHER_key_length(c); + + if (i > SSL_MAX_MASTER_KEY_LENGTH) { + ssl2_return_error(s, SSL2_PE_UNDEFINED_ERROR); +--- openssl-1.0.2/ssl/s3_pkt.c ++++ openssl-1.0.2/ssl/s3_pkt.c +@@ -780,7 +780,7 @@ + + i = ssl3_write_pending(s, type, &buf[tot], nw); + if (i <= 0) { +- if (i < 0) { ++ if (i < 0 && (!s->wbio || !BIO_should_retry(s->wbio))) { + OPENSSL_free(wb->buf); + wb->buf = NULL; + } +--- openssl-1.0.2/ssl/s3_srvr.c ++++ openssl-1.0.2/ssl/s3_srvr.c +@@ -2251,10 +2251,17 @@ + if (alg_k & (SSL_kEDH | SSL_kDHr | SSL_kDHd)) { + int idx = -1; + EVP_PKEY *skey = NULL; +- if (n) ++ if (n) { + n2s(p, i); +- else ++ } else { ++ if (alg_k & SSL_kDHE) { ++ al = SSL_AD_HANDSHAKE_FAILURE; ++ SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, ++ SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG); ++ goto f_err; ++ } + i = 0; ++ } + if (n && n != i + 2) { + if (!(s->options & SSL_OP_SSLEAY_080_CLIENT_DH_BUG)) { + SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, +--- openssl-1.0.2/ssl/t1_lib.c ++++ openssl-1.0.2/ssl/t1_lib.c +@@ -2965,6 +2965,7 @@ + if (s->cert->shared_sigalgs) { + OPENSSL_free(s->cert->shared_sigalgs); + s->cert->shared_sigalgs = NULL; ++ s->cert->shared_sigalgslen = 0; + } + /* Clear certificate digests and validity flags */ + for (i = 0; i < SSL_PKEY_NUM; i++) { +@@ -3618,6 +3619,7 @@ + if (c->shared_sigalgs) { + OPENSSL_free(c->shared_sigalgs); + c->shared_sigalgs = NULL; ++ c->shared_sigalgslen = 0; + } + /* If client use client signature algorithms if not NULL */ + if (!s->server && c->client_sigalgs && !is_suiteb) { +@@ -3640,12 +3642,14 @@ + preflen = c->peer_sigalgslen; + } + nmatch = tls12_do_shared_sigalgs(NULL, pref, preflen, allow, allowlen); +- if (!nmatch) +- return 1; +- salgs = OPENSSL_malloc(nmatch * sizeof(TLS_SIGALGS)); +- if (!salgs) +- return 0; +- nmatch = tls12_do_shared_sigalgs(salgs, pref, preflen, allow, allowlen); ++ if (nmatch) { ++ salgs = OPENSSL_malloc(nmatch * sizeof(TLS_SIGALGS)); ++ if (!salgs) ++ return 0; ++ nmatch = tls12_do_shared_sigalgs(salgs, pref, preflen, allow, allowlen); ++ } else { ++ salgs = NULL; ++ } + c->shared_sigalgs = salgs; + c->shared_sigalgslen = nmatch; + return 1; diff --git a/dev-libs/openssl/openssl-1.0.1l-r1.ebuild b/dev-libs/openssl/openssl-1.0.1l-r1.ebuild new file mode 100644 index 000000000000..caf863c4f090 --- /dev/null +++ b/dev-libs/openssl/openssl-1.0.1l-r1.ebuild @@ -0,0 +1,259 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-libs/openssl/openssl-1.0.1l-r1.ebuild,v 1.1 2015/03/19 14:28:24 polynomial-c Exp $ + +EAPI="4" + +inherit eutils flag-o-matic toolchain-funcs multilib multilib-minimal + +REV="1.7" +DESCRIPTION="full-strength general purpose cryptography library (including SSL and TLS)" +HOMEPAGE="http://www.openssl.org/" +SRC_URI="mirror://openssl/source/${P}.tar.gz + http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/${PN}/${PN}-c_rehash.sh?rev=${REV} -> ${PN}-c_rehash.sh.${REV}" + +LICENSE="openssl" +SLOT="0" +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" +IUSE="bindist gmp kerberos rfc3779 cpu_flags_x86_sse2 static-libs test +tls-heartbeat vanilla zlib" + +# The blocks are temporary just to make sure people upgrade to a +# version that lack runtime version checking. We'll drop them in +# the future. +RDEPEND="gmp? ( >=dev-libs/gmp-5.1.3-r1[static-libs(+)?,${MULTILIB_USEDEP}] ) + zlib? ( >=sys-libs/zlib-1.2.8-r1[static-libs(+)?,${MULTILIB_USEDEP}] ) + kerberos? ( >=app-crypt/mit-krb5-1.11.4[${MULTILIB_USEDEP}] ) + abi_x86_32? ( + !<=app-emulation/emul-linux-x86-baselibs-20140406-r3 + !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] + ) + ! "${WORKDIR}"/c_rehash || die #416717 +} + +MULTILIB_WRAPPED_HEADERS=( + usr/include/openssl/opensslconf.h +) + +src_prepare() { + # Make sure we only ever touch Makefile.org and avoid patching a file + # that gets blown away anyways by the Configure script in src_configure + rm -f Makefile + + if ! use vanilla ; then + epatch "${FILESDIR}"/${PN}-1.0.0a-ldflags.patch #327421 + epatch "${FILESDIR}"/${PN}-1.0.0d-windres.patch #373743 + epatch "${FILESDIR}"/${PN}-1.0.0h-pkg-config.patch + epatch "${FILESDIR}"/${PN}-1.0.1-parallel-build.patch + epatch "${FILESDIR}"/${PN}-1.0.1-x32.patch + epatch "${FILESDIR}"/${PN}-1.0.1h-ipv6.patch + epatch "${FILESDIR}"/${PN}-1.0.1e-s_client-verify.patch #472584 + epatch "${FILESDIR}"/${PN}-1.0.1f-revert-alpha-perl-generation.patch #499086 + epatch "${FILESDIR}"/${PN}-1.0.1l-CVE-2015-0286.patch #543552 + epatch_user #332661 + fi + + # disable fips in the build + # make sure the man pages are suffixed #302165 + # don't bother building man pages if they're disabled + sed -i \ + -e '/DIRS/s: fips : :g' \ + -e '/^MANSUFFIX/s:=.*:=ssl:' \ + -e '/^MAKEDEPPROG/s:=.*:=$(CC):' \ + -e $(has noman FEATURES \ + && echo '/^install:/s:install_docs::' \ + || echo '/^MANDIR=/s:=.*:='${EPREFIX}'/usr/share/man:') \ + Makefile.org \ + || die + # show the actual commands in the log + sed -i '/^SET_X/s:=.*:=set -x:' Makefile.shared + + # since we're forcing $(CC) as makedep anyway, just fix + # the conditional as always-on + # helps clang (#417795), and versioned gcc (#499818) + sed -i 's/expr.*MAKEDEPEND.*;/true;/' util/domd || die + + # quiet out unknown driver argument warnings since openssl + # doesn't have well-split CFLAGS and we're making it even worse + # and 'make depend' uses -Werror for added fun (#417795 again) + [[ ${CC} == *clang* ]] && append-flags -Qunused-arguments + + # allow openssl to be cross-compiled + cp "${FILESDIR}"/gentoo.config-1.0.1 gentoo.config || die + chmod a+rx gentoo.config + + append-flags -fno-strict-aliasing + append-flags $(test-flags-CC -Wa,--noexecstack) + + sed -i '1s,^:$,#!'${EPREFIX}'/usr/bin/perl,' Configure #141906 + # The config script does stupid stuff to prompt the user. Kill it. + sed -i '/stty -icanon min 0 time 50; read waste/d' config || die + ./config --test-sanity || die "I AM NOT SANE" + + multilib_copy_sources +} + +multilib_src_configure() { + unset APPS #197996 + unset SCRIPTS #312551 + unset CROSS_COMPILE #311473 + + tc-export CC AR RANLIB RC + + # Clean out patent-or-otherwise-encumbered code + # Camellia: Royalty Free http://en.wikipedia.org/wiki/Camellia_(cipher) + # IDEA: Expired http://en.wikipedia.org/wiki/International_Data_Encryption_Algorithm + # EC: ????????? ??/??/2015 http://en.wikipedia.org/wiki/Elliptic_Curve_Cryptography + # MDC2: Expired http://en.wikipedia.org/wiki/MDC-2 + # RC5: 5,724,428 03/03/2015 http://en.wikipedia.org/wiki/RC5 + + use_ssl() { usex $1 "enable-${2:-$1}" "no-${2:-$1}" " ${*:3}" ; } + echoit() { echo "$@" ; "$@" ; } + + local krb5=$(has_version app-crypt/mit-krb5 && echo "MIT" || echo "Heimdal") + + # See if our toolchain supports __uint128_t. If so, it's 64bit + # friendly and can use the nicely optimized code paths. #460790 + local ec_nistp_64_gcc_128 + # Disable it for now though #469976 + #if ! use bindist ; then + # echo "__uint128_t i;" > "${T}"/128.c + # if ${CC} ${CFLAGS} -c "${T}"/128.c -o /dev/null >&/dev/null ; then + # ec_nistp_64_gcc_128="enable-ec_nistp_64_gcc_128" + # fi + #fi + + local sslout=$(./gentoo.config) + einfo "Use configuration ${sslout:-(openssl knows best)}" + local config="Configure" + [[ -z ${sslout} ]] && config="config" + + echoit \ + ./${config} \ + ${sslout} \ + $(use cpu_flags_x86_sse2 || echo "no-sse2") \ + enable-camellia \ + $(use_ssl !bindist ec) \ + ${ec_nistp_64_gcc_128} \ + enable-idea \ + enable-mdc2 \ + $(use_ssl !bindist rc5) \ + enable-tlsext \ + $(use_ssl gmp gmp -lgmp) \ + $(use_ssl kerberos krb5 --with-krb5-flavor=${krb5}) \ + $(use_ssl rfc3779) \ + $(use_ssl tls-heartbeat heartbeats) \ + $(use_ssl zlib) \ + --prefix="${EPREFIX}"/usr \ + --openssldir="${EPREFIX}"${SSL_CNF_DIR} \ + --libdir=$(get_libdir) \ + shared threads \ + || die + + # Clean out hardcoded flags that openssl uses + local CFLAG=$(grep ^CFLAG= Makefile | LC_ALL=C sed \ + -e 's:^CFLAG=::' \ + -e 's:-fomit-frame-pointer ::g' \ + -e 's:-O[0-9] ::g' \ + -e 's:-march=[-a-z0-9]* ::g' \ + -e 's:-mcpu=[-a-z0-9]* ::g' \ + -e 's:-m[a-z0-9]* ::g' \ + ) + sed -i \ + -e "/^CFLAG/s|=.*|=${CFLAG} ${CFLAGS}|" \ + -e "/^SHARED_LDFLAGS=/s|$| ${LDFLAGS}|" \ + Makefile || die +} + +multilib_src_compile() { + # depend is needed to use $confopts; it also doesn't matter + # that it's -j1 as the code itself serializes subdirs + emake -j1 depend + emake all + # rehash is needed to prep the certs/ dir; do this + # separately to avoid parallel build issues. + emake rehash +} + +multilib_src_test() { + emake -j1 test +} + +multilib_src_install() { + emake INSTALL_PREFIX="${D}" install +} + +multilib_src_install_all() { + dobin "${WORKDIR}"/c_rehash #333117 + dodoc CHANGES* FAQ NEWS README doc/*.txt doc/c-indentation.el + dohtml -r doc/* + use rfc3779 && dodoc engines/ccgost/README.gost + + # This is crappy in that the static archives are still built even + # when USE=static-libs. But this is due to a failing in the openssl + # build system: the static archives are built as PIC all the time. + # Only way around this would be to manually configure+compile openssl + # twice; once with shared lib support enabled and once without. + use static-libs || rm -f "${ED}"/usr/lib*/lib*.a + + # create the certs directory + dodir ${SSL_CNF_DIR}/certs + cp -RP certs/* "${ED}"${SSL_CNF_DIR}/certs/ || die + rm -r "${ED}"${SSL_CNF_DIR}/certs/{demo,expired} + + # Namespace openssl programs to prevent conflicts with other man pages + cd "${ED}"/usr/share/man + local m d s + for m in $(find . -type f | xargs grep -L '#include') ; do + d=${m%/*} ; d=${d#./} ; m=${m##*/} + [[ ${m} == openssl.1* ]] && continue + [[ -n $(find -L ${d} -type l) ]] && die "erp, broken links already!" + mv ${d}/{,ssl-}${m} + # fix up references to renamed man pages + sed -i '/^[.]SH "SEE ALSO"/,/^[.]/s:\([^(, ]*(1)\):ssl-\1:g' ${d}/ssl-${m} + ln -s ssl-${m} ${d}/openssl-${m} + # locate any symlinks that point to this man page ... we assume + # that any broken links are due to the above renaming + for s in $(find -L ${d} -type l) ; do + s=${s##*/} + rm -f ${d}/${s} + ln -s ssl-${m} ${d}/ssl-${s} + ln -s ssl-${s} ${d}/openssl-${s} + done + done + [[ -n $(find -L ${d} -type l) ]] && die "broken manpage links found :(" + + dodir /etc/sandbox.d #254521 + echo 'SANDBOX_PREDICT="/dev/crypto"' > "${ED}"/etc/sandbox.d/10openssl + + diropts -m0700 + keepdir ${SSL_CNF_DIR}/private +} + +pkg_preinst() { + has_version ${CATEGORY}/${PN}:0.9.8 && return 0 + preserve_old_lib /usr/$(get_libdir)/lib{crypto,ssl}.so.0.9.8 +} + +pkg_postinst() { + ebegin "Running 'c_rehash ${EROOT%/}${SSL_CNF_DIR}/certs/' to rebuild hashes #333069" + c_rehash "${EROOT%/}${SSL_CNF_DIR}/certs" >/dev/null + eend $? + + has_version ${CATEGORY}/${PN}:0.9.8 && return 0 + preserve_old_lib_notify /usr/$(get_libdir)/lib{crypto,ssl}.so.0.9.8 +} diff --git a/dev-libs/openssl/openssl-1.0.2-r3.ebuild b/dev-libs/openssl/openssl-1.0.2-r3.ebuild new file mode 100644 index 000000000000..effd7811966e --- /dev/null +++ b/dev-libs/openssl/openssl-1.0.2-r3.ebuild @@ -0,0 +1,262 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $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 $ + +EAPI="4" + +inherit eutils flag-o-matic toolchain-funcs multilib multilib-minimal + +REV="1.7" +MY_P=${P/_/-} +DESCRIPTION="full-strength general purpose cryptography library (including SSL and TLS)" +HOMEPAGE="http://www.openssl.org/" +SRC_URI="mirror://openssl/source/${MY_P}.tar.gz + http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/${PN}/${PN}-c_rehash.sh?rev=${REV} -> ${PN}-c_rehash.sh.${REV}" + +LICENSE="openssl" +SLOT="0" +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" +IUSE="bindist gmp kerberos rfc3779 sctp cpu_flags_x86_sse2 static-libs test +tls-heartbeat vanilla zlib" + +# The blocks are temporary just to make sure people upgrade to a +# version that lack runtime version checking. We'll drop them in +# the future. +RDEPEND="gmp? ( >=dev-libs/gmp-5.1.3-r1[static-libs(+)?,${MULTILIB_USEDEP}] ) + zlib? ( >=sys-libs/zlib-1.2.8-r1[static-libs(+)?,${MULTILIB_USEDEP}] ) + kerberos? ( >=app-crypt/mit-krb5-1.11.4[${MULTILIB_USEDEP}] ) + abi_x86_32? ( + !<=app-emulation/emul-linux-x86-baselibs-20140508 + !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] + ) + ! "${WORKDIR}"/c_rehash || die #416717 + + # Make sure we only ever touch Makefile.org and avoid patching a file + # that gets blown away anyways by the Configure script in src_configure + rm -f Makefile + + epatch "${FILESDIR}"/${P}-CVE-2015-0209.patch #541502 + epatch "${FILESDIR}"/${P}-CVE-2015-0288.patch #542038 + if ! use vanilla ; then + epatch "${FILESDIR}"/${PN}-1.0.0a-ldflags.patch #327421 + epatch "${FILESDIR}"/${PN}-1.0.0d-windres.patch #373743 + epatch "${FILESDIR}"/${PN}-1.0.2-parallel-build.patch + epatch "${FILESDIR}"/${PN}-1.0.2-ipv6.patch + epatch "${FILESDIR}"/${PN}-1.0.2-s_client-verify.patch #472584 + epatch "${FILESDIR}"/${PN}-1.0.2-CVE-2015-0291.patch + + epatch_user #332661 + fi + + # disable fips in the build + # make sure the man pages are suffixed #302165 + # don't bother building man pages if they're disabled + sed -i \ + -e '/DIRS/s: fips : :g' \ + -e '/^MANSUFFIX/s:=.*:=ssl:' \ + -e '/^MAKEDEPPROG/s:=.*:=$(CC):' \ + -e $(has noman FEATURES \ + && echo '/^install:/s:install_docs::' \ + || echo '/^MANDIR=/s:=.*:='${EPREFIX}'/usr/share/man:') \ + Makefile.org \ + || die + # show the actual commands in the log + sed -i '/^SET_X/s:=.*:=set -x:' Makefile.shared + + # since we're forcing $(CC) as makedep anyway, just fix + # the conditional as always-on + # helps clang (#417795), and versioned gcc (#499818) + sed -i 's/expr.*MAKEDEPEND.*;/true;/' util/domd || die + + # quiet out unknown driver argument warnings since openssl + # doesn't have well-split CFLAGS and we're making it even worse + # and 'make depend' uses -Werror for added fun (#417795 again) + [[ ${CC} == *clang* ]] && append-flags -Qunused-arguments + + # allow openssl to be cross-compiled + cp "${FILESDIR}"/gentoo.config-1.0.1 gentoo.config || die + chmod a+rx gentoo.config + + append-flags -fno-strict-aliasing + append-flags $(test-flags-CC -Wa,--noexecstack) + append-cppflags -DOPENSSL_NO_BUF_FREELISTS + + sed -i '1s,^:$,#!'${EPREFIX}'/usr/bin/perl,' Configure #141906 + # The config script does stupid stuff to prompt the user. Kill it. + sed -i '/stty -icanon min 0 time 50; read waste/d' config || die + ./config --test-sanity || die "I AM NOT SANE" + + multilib_copy_sources +} + +multilib_src_configure() { + unset APPS #197996 + unset SCRIPTS #312551 + unset CROSS_COMPILE #311473 + + tc-export CC AR RANLIB RC + + # Clean out patent-or-otherwise-encumbered code + # Camellia: Royalty Free http://en.wikipedia.org/wiki/Camellia_(cipher) + # IDEA: Expired http://en.wikipedia.org/wiki/International_Data_Encryption_Algorithm + # EC: ????????? ??/??/2015 http://en.wikipedia.org/wiki/Elliptic_Curve_Cryptography + # MDC2: Expired http://en.wikipedia.org/wiki/MDC-2 + # RC5: Expirted http://en.wikipedia.org/wiki/RC5 + + use_ssl() { usex $1 "enable-${2:-$1}" "no-${2:-$1}" " ${*:3}" ; } + echoit() { echo "$@" ; "$@" ; } + + local krb5=$(has_version app-crypt/mit-krb5 && echo "MIT" || echo "Heimdal") + + # See if our toolchain supports __uint128_t. If so, it's 64bit + # friendly and can use the nicely optimized code paths. #460790 + local ec_nistp_64_gcc_128 + # Disable it for now though #469976 + #if ! use bindist ; then + # echo "__uint128_t i;" > "${T}"/128.c + # if ${CC} ${CFLAGS} -c "${T}"/128.c -o /dev/null >&/dev/null ; then + # ec_nistp_64_gcc_128="enable-ec_nistp_64_gcc_128" + # fi + #fi + + local sslout=$(./gentoo.config) + einfo "Use configuration ${sslout:-(openssl knows best)}" + local config="Configure" + [[ -z ${sslout} ]] && config="config" + + echoit \ + ./${config} \ + ${sslout} \ + $(use sctp && echo "sctp") \ + $(use cpu_flags_x86_sse2 || echo "no-sse2") \ + enable-camellia \ + $(use_ssl !bindist ec) \ + ${ec_nistp_64_gcc_128} \ + enable-idea \ + enable-mdc2 \ + enable-rc5 \ + enable-tlsext \ + $(use_ssl gmp gmp -lgmp) \ + $(use_ssl kerberos krb5 --with-krb5-flavor=${krb5}) \ + $(use_ssl rfc3779) \ + $(use_ssl tls-heartbeat heartbeats) \ + $(use_ssl zlib) \ + --prefix="${EPREFIX}"/usr \ + --openssldir="${EPREFIX}"${SSL_CNF_DIR} \ + --libdir=$(get_libdir) \ + shared threads \ + || die + + # Clean out hardcoded flags that openssl uses + local CFLAG=$(grep ^CFLAG= Makefile | LC_ALL=C sed \ + -e 's:^CFLAG=::' \ + -e 's:-fomit-frame-pointer ::g' \ + -e 's:-O[0-9] ::g' \ + -e 's:-march=[-a-z0-9]* ::g' \ + -e 's:-mcpu=[-a-z0-9]* ::g' \ + -e 's:-m[a-z0-9]* ::g' \ + ) + sed -i \ + -e "/^CFLAG/s|=.*|=${CFLAG} ${CFLAGS}|" \ + -e "/^SHARED_LDFLAGS=/s|$| ${LDFLAGS}|" \ + Makefile || die +} + +multilib_src_compile() { + # depend is needed to use $confopts; it also doesn't matter + # that it's -j1 as the code itself serializes subdirs + emake -j1 depend + emake all + # rehash is needed to prep the certs/ dir; do this + # separately to avoid parallel build issues. + emake rehash +} + +multilib_src_test() { + emake -j1 test +} + +multilib_src_install() { + emake INSTALL_PREFIX="${D}" install +} + +multilib_src_install_all() { + dobin "${WORKDIR}"/c_rehash #333117 + dodoc CHANGES* FAQ NEWS README doc/*.txt doc/c-indentation.el + dohtml -r doc/* + use rfc3779 && dodoc engines/ccgost/README.gost + + # This is crappy in that the static archives are still built even + # when USE=static-libs. But this is due to a failing in the openssl + # build system: the static archives are built as PIC all the time. + # Only way around this would be to manually configure+compile openssl + # twice; once with shared lib support enabled and once without. + use static-libs || rm -f "${ED}"/usr/lib*/lib*.a + + # create the certs directory + dodir ${SSL_CNF_DIR}/certs + cp -RP certs/* "${ED}"${SSL_CNF_DIR}/certs/ || die + rm -r "${ED}"${SSL_CNF_DIR}/certs/{demo,expired} + + # Namespace openssl programs to prevent conflicts with other man pages + cd "${ED}"/usr/share/man + local m d s + for m in $(find . -type f | xargs grep -L '#include') ; do + d=${m%/*} ; d=${d#./} ; m=${m##*/} + [[ ${m} == openssl.1* ]] && continue + [[ -n $(find -L ${d} -type l) ]] && die "erp, broken links already!" + mv ${d}/{,ssl-}${m} + # fix up references to renamed man pages + sed -i '/^[.]SH "SEE ALSO"/,/^[.]/s:\([^(, ]*(1)\):ssl-\1:g' ${d}/ssl-${m} + ln -s ssl-${m} ${d}/openssl-${m} + # locate any symlinks that point to this man page ... we assume + # that any broken links are due to the above renaming + for s in $(find -L ${d} -type l) ; do + s=${s##*/} + rm -f ${d}/${s} + ln -s ssl-${m} ${d}/ssl-${s} + ln -s ssl-${s} ${d}/openssl-${s} + done + done + [[ -n $(find -L ${d} -type l) ]] && die "broken manpage links found :(" + + dodir /etc/sandbox.d #254521 + echo 'SANDBOX_PREDICT="/dev/crypto"' > "${ED}"/etc/sandbox.d/10openssl + + diropts -m0700 + keepdir ${SSL_CNF_DIR}/private +} + +pkg_preinst() { + has_version ${CATEGORY}/${PN}:0.9.8 && return 0 + preserve_old_lib /usr/$(get_libdir)/lib{crypto,ssl}.so.0.9.8 +} + +pkg_postinst() { + ebegin "Running 'c_rehash ${EROOT%/}${SSL_CNF_DIR}/certs/' to rebuild hashes #333069" + c_rehash "${EROOT%/}${SSL_CNF_DIR}/certs" >/dev/null + eend $? + + has_version ${CATEGORY}/${PN}:0.9.8 && return 0 + preserve_old_lib_notify /usr/$(get_libdir)/lib{crypto,ssl}.so.0.9.8 +} -- 2.26.2