Skip to content

Commit

Permalink
Fixes #162
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgicio committed Mar 27, 2019
1 parent 2d21dd1 commit 4e42e11
Show file tree
Hide file tree
Showing 4 changed files with 157 additions and 20 deletions.
4 changes: 3 additions & 1 deletion net-im/telegram-cli/Manifest
Original file line number Diff line number Diff line change
@@ -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-9999.ebuild 1539 BLAKE2B 5c1b4222e2f9814c92687607854979b2e278404f4071c537f7cbb401a251c0660a5cb4c94d01e926533cc86468c29434d72205ff83991da0a7e263348618465a SHA512 945a25954f88aba1b0616225e2664ab04bd3d62a260a615cf057c8fb0a797b5ecb128cbec2f93860bcd0186b1352729fb895965c82e5b28bafc3e8c16ed713b0
EBUILD telegram-cli-1.3.1-r3.ebuild 1016 BLAKE2B 9db8e941388c54543d6c5dccd6f2d4998b27aab70729addd82be352528f9745f24317e2c345b1db901cd7bfa0d3fff269ea30c4e4f0b441abbb9bd663612c909 SHA512 cc22e77d8a0e95672647c6e364c97d0d2f374f90111334ff4eed982abfed47f5ce95246ce9297dd9ed4dc012837d33a49b288a8e47db6134311c9233e83401e1
EBUILD telegram-cli-9999.ebuild 1016 BLAKE2B 9db8e941388c54543d6c5dccd6f2d4998b27aab70729addd82be352528f9745f24317e2c345b1db901cd7bfa0d3fff269ea30c4e4f0b441abbb9bd663612c909 SHA512 cc22e77d8a0e95672647c6e364c97d0d2f374f90111334ff4eed982abfed47f5ce95246ce9297dd9ed4dc012837d33a49b288a8e47db6134311c9233e83401e1
MISC metadata.xml 317 BLAKE2B a064dab932a673a4ccd23732ebc842cd57c3b9faca938fe291ad7286b5649ff5f3cd8ac1191b340e621a20f3888dcab3470ec041aae115e3cba0a9eab7b67068 SHA512 2b7cae78785fa166c52e6d3eba008543924b3b057ffce125c9afce60453dbde9e8b65546042de78bd48cf4697d6487213a281e7ccad4ac44a944b41d89f2387b
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
From 66758bbea27515c5f35e3fafc64d3a3601a5b777 Mon Sep 17 00:00:00 2001
From: pollolobo <[email protected]>
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));
52 changes: 52 additions & 0 deletions net-im/telegram-cli/telegram-cli-1.3.1-r3.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# 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 git-r3 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"
EGIT_REPO_URI="${HOMEPAGE}"
SRC_URI=""

if [[ ${PV} == 9999 ]];then
KEYWORDS=""
else
EGIT_COMMIT="${PV}"
KEYWORDS="~amd64 ~x86"
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}"

PATCHES=(
"${FILESDIR}/${P}-assertion-issue.patch"
)

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
}
27 changes: 8 additions & 19 deletions net-im/telegram-cli/telegram-cli-9999.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,21 @@ EAPI=7

PYTHON_COMPAT=( python{2_7,3_{5,6,7}} )

inherit flag-o-matic python-r1
inherit flag-o-matic git-r3 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"
EGIT_REPO_URI="${HOMEPAGE}"
SRC_URI=""

if [[ ${PV} == 9999 ]];then
inherit git-r3
EGIT_REPO_URI="${HOMEPAGE}"
KEYWORDS=""
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
"
EGIT_COMMIT="${PV}"
KEYWORDS="~amd64 ~x86"
S="${WORKDIR}/tg-${PV}"
fi

DEPEND="sys-libs/zlib
Expand All @@ -40,14 +34,9 @@ DEPEND="sys-libs/zlib
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" )
default_src_prepare
}
fi
PATCHES=(
"${FILESDIR}/${P}-assertion-issue.patch"
)

src_configure() {
append-cflags $(test-flags-CC -Wno-cast-function-type)
Expand Down

0 comments on commit 4e42e11

Please sign in to comment.