From ebf7acbb697b490a77c4b61b7b71c39133654cc5 Mon Sep 17 00:00:00 2001 From: jorgicio Date: Wed, 27 Mar 2019 01:41:11 -0300 Subject: [PATCH] Fixes #162 --- net-im/telegram-cli/Manifest | 2 + ...legram-cli-1.3.1-openssl-1_1-support.patch | 94 +++++++++++++++++++ .../telegram-cli/telegram-cli-1.3.1-r3.ebuild | 66 +++++++++++++ 3 files changed, 162 insertions(+) create mode 100644 net-im/telegram-cli/files/telegram-cli-1.3.1-openssl-1_1-support.patch create mode 100644 net-im/telegram-cli/telegram-cli-1.3.1-r3.ebuild diff --git a/net-im/telegram-cli/Manifest b/net-im/telegram-cli/Manifest index 926ca0f9..fb78fbdf 100644 --- a/net-im/telegram-cli/Manifest +++ b/net-im/telegram-cli/Manifest @@ -1,8 +1,10 @@ AUX telegram-cli-1.3.1-assertion-issue.patch 305 BLAKE2B fdadc44fcb9ef1b36317b7ad98ed82b67b60a5399c5f7c2824b87baf537e08c3ad9a31f9a826b67c8fbbac6f82d0d90d7e313a552a04d706c7b50be468dc8c5a SHA512 93e44aaaea22e970871706a1d6c94f703b390071b97055984fbc5d9fc59ebd1bd79774d350a401ff2d0b2baed81fd51d2c05089115e6a365fddb26e5f138ccdb +AUX telegram-cli-1.3.1-openssl-1_1-support.patch 2672 BLAKE2B 0c55bc8b607bb75be3b1bdd38c0f44971c207acfc00cab28fb7f74f2d763c794ac35114af5c0e63f4fdce25dfdd8d0ffa5af38257abc9620277f6e24c1f1937e SHA512 5f6587e427645620d64da61f0f2c14bc890d9739f3935d5c8907625d01f4d0dc0da45b7e03bcad09574d3071500fb13bbf34de3be982bbc6d162d4f79a11aa0a DIST telegram-cli-1.3.1.tar.gz 278051 BLAKE2B 9c5c8c3578217c6f82ae154dcf187f01709cb5f9f60bc61377ec1a35833128c99ffd7e5e064d5a330ef3b56c09ca2382faa0984e564da4f359c318581706dee0 SHA512 ac8341e8f951922fa78a1db74d9b1a87b03c3339307bd9c46da71656d8d6e55bf0b546abba1638ae01843341a4d2134b6ab244e15547e8806d74b21ac1306114 DIST tgl-20150514.tar.gz 250793 BLAKE2B 1bf3c462fd42b57aaf7d4807f526022951b18498bbfb393dbd594786bfcb405863885a03099098adc2fa054f83d1d48f097ff56167899173e41abaff03237606 SHA512 6d690533c4c1a6add623bfacfbbc6bd13bf1afda3c1ea1c5fd6170bef76a9933cd26697786ce6e176be20e75a3b42ebde4dcbcb1d3e19537ca02aca50e031be4 DIST tl-parser-20141119.tar.gz 78660 BLAKE2B a69a2c2caeefff147bfbbc0b86e2efafc364b6f359c24dfaac5607a21541a1f0d3cf848f46f5f103935e72ad76c445308376995d5a19e3cee050da5a39439410 SHA512 b65ff5ed74b8434792e7c591d7ed0af811ecc36b6d056c20369a465600a454f0201b75654d2d8765f5860060943f99a5100802645af613a2b65e0f4a2f86ae04 EBUILD telegram-cli-1.3.1-r1.ebuild 1549 BLAKE2B 0a60f8f4c1cca21ab0b78edd03b5807ada3a14c06fdfccab7319658d3f38cf1f2b6fdb49b31930ad98acab28da565e70c4261011daae2d62ccb51c674c8bfcb1 SHA512 e407d3767af0b46fd023cc5bb917eb04f1accf605ac6bbd393e29f1576361eae8f348d1ef7b89dfef676ef1ef228e173dc86e16eefd013307cfa2866df8ff549 EBUILD telegram-cli-1.3.1-r2.ebuild 1539 BLAKE2B 5c1b4222e2f9814c92687607854979b2e278404f4071c537f7cbb401a251c0660a5cb4c94d01e926533cc86468c29434d72205ff83991da0a7e263348618465a SHA512 945a25954f88aba1b0616225e2664ab04bd3d62a260a615cf057c8fb0a797b5ecb128cbec2f93860bcd0186b1352729fb895965c82e5b28bafc3e8c16ed713b0 +EBUILD telegram-cli-1.3.1-r3.ebuild 1592 BLAKE2B e05a93051705f6f3bf26763f174364dcca27c631aa0a33d2749de4d1587d026a9d13081453d0f86099e115a4fb94eea7b82f1a82a96e9833b99a20a6a6fa4b03 SHA512 b769726ad463c150e2a509655605e8124a62c294a2aae61fbc788ae3a73a15a603e143588fccb1cbf609cae60cd0b982b774badbd3db8b10d2ee641ed313c3fd EBUILD telegram-cli-9999.ebuild 1539 BLAKE2B 5c1b4222e2f9814c92687607854979b2e278404f4071c537f7cbb401a251c0660a5cb4c94d01e926533cc86468c29434d72205ff83991da0a7e263348618465a SHA512 945a25954f88aba1b0616225e2664ab04bd3d62a260a615cf057c8fb0a797b5ecb128cbec2f93860bcd0186b1352729fb895965c82e5b28bafc3e8c16ed713b0 MISC metadata.xml 317 BLAKE2B a064dab932a673a4ccd23732ebc842cd57c3b9faca938fe291ad7286b5649ff5f3cd8ac1191b340e621a20f3888dcab3470ec041aae115e3cba0a9eab7b67068 SHA512 2b7cae78785fa166c52e6d3eba008543924b3b057ffce125c9afce60453dbde9e8b65546042de78bd48cf4697d6487213a281e7ccad4ac44a944b41d89f2387b diff --git a/net-im/telegram-cli/files/telegram-cli-1.3.1-openssl-1_1-support.patch b/net-im/telegram-cli/files/telegram-cli-1.3.1-openssl-1_1-support.patch new file mode 100644 index 00000000..7cb64251 --- /dev/null +++ b/net-im/telegram-cli/files/telegram-cli-1.3.1-openssl-1_1-support.patch @@ -0,0 +1,94 @@ +From 66758bbea27515c5f35e3fafc64d3a3601a5b777 Mon Sep 17 00:00:00 2001 +From: pollolobo +Date: Mon, 6 Mar 2017 01:26:49 +0100 +Subject: [PATCH] OpenSSL 1.1 compatibility + +--- + crypto/rsa_pem_openssl.c | 63 ++++++++++++++++++++++++++++++++++------ + 1 file changed, 54 insertions(+), 9 deletions(-) + +diff --git a/crypto/rsa_pem_openssl.c b/crypto/rsa_pem_openssl.c +index db653f2..06b630f 100644 +--- a/crypto/rsa_pem_openssl.c ++++ b/crypto/rsa_pem_openssl.c +@@ -31,6 +31,47 @@ + #include "meta.h" + #include "rsa_pem.h" + ++#if OPENSSL_VERSION_NUMBER < 0x10100000L ++ ++int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d) ++{ ++ /* If the fields n and e in r are NULL, the corresponding input ++ * parameters MUST be non-NULL for n and e. d may be ++ * left NULL (in case only the public key is used). ++ */ ++ if ((r->n == NULL && n == NULL) ++ || (r->e == NULL && e == NULL)) ++ return 0; ++ ++ if (n != NULL) { ++ BN_free(r->n); ++ r->n = n; ++ } ++ if (e != NULL) { ++ BN_free(r->e); ++ r->e = e; ++ } ++ if (d != NULL) { ++ BN_free(r->d); ++ r->d = d; ++ } ++ ++ return 1; ++} ++ ++void RSA_get0_key(const RSA *r, ++ const BIGNUM **n, const BIGNUM **e, const BIGNUM **d) ++{ ++ if (n != NULL) ++ *n = r->n; ++ if (e != NULL) ++ *e = r->e; ++ if (d != NULL) ++ *d = r->d; ++} ++ ++#endif ++ + TGLC_WRAPPER_ASSOC(rsa,RSA) + + // TODO: Refactor crucial struct-identity into its own header. +@@ -38,19 +79,23 @@ TGLC_WRAPPER_ASSOC(bn,BIGNUM) + + TGLC_rsa *TGLC_rsa_new (unsigned long e, int n_bytes, const unsigned char *n) { + RSA *ret = RSA_new (); +- ret->e = unwrap_bn (TGLC_bn_new ()); +- TGLC_bn_set_word (wrap_bn (ret->e), e); +- ret->n = unwrap_bn (TGLC_bn_bin2bn (n, n_bytes, NULL)); ++ TGLC_bn* e_tglcbn = TGLC_bn_new (); ++ TGLC_bn_set_word (e_tglcbn, e); ++ RSA_set0_key(ret, unwrap_bn (TGLC_bn_bin2bn (n, n_bytes, NULL)), unwrap_bn(e_tglcbn), NULL); + return wrap_rsa (ret); + } + +-#define RSA_GETTER(M) \ +- TGLC_bn *TGLC_rsa_ ## M (TGLC_rsa *key) { \ +- return wrap_bn (unwrap_rsa (key)->M); \ +- } \ ++TGLC_bn *TGLC_rsa_n (TGLC_rsa * key) { ++ const BIGNUM *n; ++ RSA_get0_key( unwrap_rsa(key), &n, NULL, NULL); ++ return wrap_bn(n); ++} + +-RSA_GETTER(n); +-RSA_GETTER(e); ++TGLC_bn *TGLC_rsa_e (TGLC_rsa * key) { ++ const BIGNUM *e; ++ RSA_get0_key( unwrap_rsa(key), NULL, &e, NULL); ++ return wrap_bn(e); ++} + + void TGLC_rsa_free (TGLC_rsa *p) { + RSA_free (unwrap_rsa (p)); diff --git a/net-im/telegram-cli/telegram-cli-1.3.1-r3.ebuild b/net-im/telegram-cli/telegram-cli-1.3.1-r3.ebuild new file mode 100644 index 00000000..b593eff9 --- /dev/null +++ b/net-im/telegram-cli/telegram-cli-1.3.1-r3.ebuild @@ -0,0 +1,66 @@ +# Copyright 1999-2019 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python{2_7,3_{5,6,7}} ) + +inherit flag-o-matic python-r1 + +DESCRIPTION="Command line interface client for Telegram" +HOMEPAGE="https://github.com/vysheng/tg" +LICENSE="GPL-2 LGPL-2.1" +SLOT="0" +IUSE="+lua +json libressl" + +if [[ ${PV} == 9999 ]];then + inherit git-r3 + EGIT_REPO_URI="${HOMEPAGE}" +else + TGL_COMMIT="b3dcce35110f5c995366318c2886065287815d09" + TL_PARSER_COMMIT="ec8a8ed7a4f22428b83e21a9d3b5815f7a6f3bd9" + SRC_URI=" + ${HOMEPAGE}/archive/${PV}.tar.gz -> ${P}.tar.gz + https://github.com/vysheng/tgl/archive/${TGL_COMMIT}.tar.gz -> tgl-20150514.tar.gz + https://github.com/vysheng/tl-parser/archive/${TL_PARSER_COMMIT}.tar.gz -> tl-parser-20141119.tar.gz + " + KEYWORDS="~amd64 ~x86" + S="${WORKDIR}/tg-${PV}" +fi + +DEPEND="sys-libs/zlib + sys-libs/readline + dev-libs/libconfig + !libressl? ( dev-libs/openssl ) + libressl? ( dev-libs/libressl ) + dev-libs/libevent + lua? ( dev-lang/lua ) + json? ( dev-libs/jansson )" + +RDEPEND="${DEPEND}" +BDEPEND="${PYTHON_DEPS}" + +if [[ ${PV} != 9999 ]];then + src_prepare(){ + cp -r ../tgl-${TGL_COMMIT}/* tgl + cp -r ../tl-parser-${TL_PARSER_COMMIT}/* tgl/tl-parser + PATCHES=( + "${FILESDIR}/${P}-assertion-issue.patch" + "${FILESDIR}/${P}-openssl-1_1-support.patch" + ) + default_src_prepare + } +fi + +src_configure() { + append-cflags $(test-flags-CC -Wno-cast-function-type) + econf \ + $(use_enable lua liblua ) \ + $(use_enable json ) +} + +src_install() { + dobin bin/${PN} + insinto /etc/${PN} + newins tg-server.pub server.pub +}