summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authordrrossum2017-06-06 13:05:05 +0200
committerdrrossum2017-06-06 13:06:18 +0200
commitc00d75874480288224fd1a0145cf89c6c109bebd (patch)
treee0bb4a644aa715fc40d182d537cc95f1d3f13d0b
parentf743a6e0d15419a699e7300d67e8ce846e735c45 (diff)
downloadaur-c00d75874480288224fd1a0145cf89c6c109bebd.tar.gz
fix issue with openssl 1.1.0
-rw-r--r--.SRCINFO5
-rw-r--r--PKGBUILD15
-rw-r--r--telegram-cli-git.patch90
3 files changed, 105 insertions, 5 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 7a67856fc469..1fc098aff21b 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,5 +1,5 @@
# Generated by mksrcinfo v8
-# Tue Mar 29 20:28:57 UTC 2016
+# Tue Jun 6 11:02:33 UTC 2017
pkgbase = telegram-cli-git
pkgdesc = Telegram messenger CLI
pkgver = r1128.6547c0b
@@ -7,6 +7,7 @@ pkgbase = telegram-cli-git
url = https://github.com/vysheng/tg
arch = i686
arch = x86_64
+ arch = armv7h
license = GPL2
makedepends = git
depends = libconfig
@@ -16,7 +17,9 @@ pkgbase = telegram-cli-git
provides = telegram-cli
conflicts = telegram-cli
source = telegram-cli-git::git+https://github.com/vysheng/tg
+ source = telegram-cli-git.patch
sha256sums = SKIP
+ sha256sums = 720550515339552641cc5b01fffe63167634a22d2f7b2fe935d28183031d82f2
pkgname = telegram-cli-git
diff --git a/PKGBUILD b/PKGBUILD
index 4f9d07bae310..43feb845a2ad 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -5,7 +5,7 @@ pkgname=telegram-cli-git
pkgver=r1128.6547c0b
pkgrel=1
pkgdesc="Telegram messenger CLI"
-arch=('i686' 'x86_64')
+arch=('i686' 'x86_64' 'armv7h')
url="https://github.com/vysheng/tg"
license=('GPL2')
depends=('libconfig' 'libevent' 'lua' 'jansson')
@@ -13,17 +13,24 @@ makedepends=('git')
conflicts=('telegram-cli')
provides=('telegram-cli')
-source=("$pkgname"::'git+https://github.com/vysheng/tg')
-sha256sums=('SKIP')
+source=("$pkgname"::'git+https://github.com/vysheng/tg'
+ "$pkgname.patch")
+sha256sums=('SKIP'
+ '720550515339552641cc5b01fffe63167634a22d2f7b2fe935d28183031d82f2')
pkgver() {
cd "$srcdir/$pkgname"
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
+prepare() {
+ cd "$srcdir/$pkgname"
+ git submodule update --init --recursive --force
+ patch -p1 < "$srcdir/$pkgname.patch"
+}
+
build() {
cd "$srcdir/$pkgname"
- git submodule update --init --recursive
./configure
make
}
diff --git a/telegram-cli-git.patch b/telegram-cli-git.patch
new file mode 100644
index 000000000000..2d2b7b04e7e5
--- /dev/null
+++ b/telegram-cli-git.patch
@@ -0,0 +1,90 @@
+diff --git a/tgl/crypto/rsa_pem_openssl.c b/tgl/crypto/rsa_pem_openssl.c
+index db653f2..5e6a697 100644
+--- a/tgl/crypto/rsa_pem_openssl.c
++++ b/tgl/crypto/rsa_pem_openssl.c
+@@ -36,6 +36,12 @@ TGLC_WRAPPER_ASSOC(rsa,RSA)
+ // TODO: Refactor crucial struct-identity into its own header.
+ TGLC_WRAPPER_ASSOC(bn,BIGNUM)
+
++/*
++ * Since OpenSSL version 1.1.0 the RSA struct (rsa_st) is opaque,
++ * see also https://wiki.openssl.org/index.php/OpenSSL_1.1.0_Changes
++ */
++#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
++
+ 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 ());
+@@ -47,7 +53,30 @@ TGLC_rsa *TGLC_rsa_new (unsigned long e, int n_bytes, const unsigned char *n) {
+ #define RSA_GETTER(M) \
+ TGLC_bn *TGLC_rsa_ ## M (TGLC_rsa *key) { \
+ return wrap_bn (unwrap_rsa (key)->M); \
+- } \
++ }
++
++#else // OPENSSL_VERSION_NUMBER
++
++TGLC_rsa *TGLC_rsa_new (unsigned long e, int n_bytes, const unsigned char *n) {
++ RSA *ret = RSA_new ();
++ BIGNUM *ret_e = unwrap_bn (TGLC_bn_new ());
++ BIGNUM *ret_n = unwrap_bn (TGLC_bn_bin2bn (n, n_bytes, NULL));
++ RSA_set0_key (ret, ret_n, ret_e, NULL);
++ TGLC_bn_set_word (wrap_bn (ret_e), e);
++ return wrap_rsa (ret);
++}
++
++#define RSA_GETTER(M) \
++TGLC_bn *TGLC_rsa_ ## M (TGLC_rsa *key) { \
++ BIGNUM *rsa_n, *rsa_e, *rsa_d; \
++ RSA_get0_key(unwrap_rsa (key), \
++ (const BIGNUM **) &rsa_n, \
++ (const BIGNUM **) &rsa_e, \
++ (const BIGNUM **) &rsa_d); \
++ return wrap_bn (rsa_ ## M); \
++}
++
++#endif // OPENSSL_VERSION_NUMBER
+
+ RSA_GETTER(n);
+ RSA_GETTER(e);
+@@ -60,4 +89,4 @@ TGLC_rsa *TGLC_pem_read_RSAPublicKey (FILE *fp) {
+ return wrap_rsa (PEM_read_RSAPublicKey (fp, NULL, NULL, NULL));
+ }
+
+-#endif
++#endif // TGL_AVOID_OPENSSL
+diff --git a/tgl/mtproto-utils.c b/tgl/mtproto-utils.c
+index 0948bc8..cfdb216 100644
+--- a/tgl/mtproto-utils.c
++++ b/tgl/mtproto-utils.c
+@@ -98,7 +98,7 @@ static unsigned long long BN2ull (TGLC_bn *b) {
+ if (sizeof (unsigned long) == 8) {
+ return TGLC_bn_get_word (b);
+ } else if (sizeof (unsigned long long) == 8) {
+- assert (0); // As long as nobody ever uses this code, assume it is broken.
++// assert (0); // As long as nobody ever uses this code, assume it is broken.
+ unsigned long long tmp;
+ /* Here be dragons, but it should be okay due to be64toh */
+ TGLC_bn_bn2bin (b, (unsigned char *) &tmp);
+@@ -112,7 +112,7 @@ static void ull2BN (TGLC_bn *b, unsigned long long val) {
+ if (sizeof (unsigned long) == 8 || val < (1ll << 32)) {
+ TGLC_bn_set_word (b, val);
+ } else if (sizeof (unsigned long long) == 8) {
+- assert (0); // As long as nobody ever uses this code, assume it is broken.
++// assert (0); // As long as nobody ever uses this code, assume it is broken.
+ htobe64(val);
+ /* Here be dragons, but it should be okay due to htobe64 */
+ TGLC_bn_bin2bn ((unsigned char *) &val, 8, b);
+diff --git a/tgl/tl-parser/tl-parser.c b/tgl/tl-parser/tl-parser.c
+index 524b196..aeadbd2 100644
+--- a/tgl/tl-parser/tl-parser.c
++++ b/tgl/tl-parser/tl-parser.c
+@@ -1903,7 +1903,7 @@ struct tl_combinator_tree *tl_parse_args134 (struct tree *T) {
+ //assert (S->data);
+ char *name = S->data;
+ if (!name) {
+- static char s[20];
++ static char s[21];
+ sprintf (s, "%lld", lrand48 () * (1ll << 32) + lrand48 ());
+ name = s;
+ }