diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2018-11-01 16:00:09 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2018-11-07 16:46:14 +0000 |
commit | 5fe2c96196572a2bd57a163c0fa6da6dd581a868 (patch) | |
tree | 00bba69db40352ff45aa76bd0e2fe00e3f655fe8 /community/tg | |
parent | 0a74fd7c49457f1e98562756203162a07ef49476 (diff) | |
download | aports-5fe2c96196572a2bd57a163c0fa6da6dd581a868.tar.bz2 aports-5fe2c96196572a2bd57a163c0fa6da6dd581a868.tar.xz |
community/tg: rebuild against openssl 1.1
Diffstat (limited to 'community/tg')
-rw-r--r-- | community/tg/APKBUILD | 9 | ||||
-rw-r--r-- | community/tg/openssl-1.1.patch | 102 |
2 files changed, 108 insertions, 3 deletions
diff --git a/community/tg/APKBUILD b/community/tg/APKBUILD index e098cc1376..3ebc8f3467 100644 --- a/community/tg/APKBUILD +++ b/community/tg/APKBUILD @@ -2,14 +2,14 @@ # Maintainer: Leonardo Arena <rnalrd@alpinelinux.org> pkgname=tg pkgver=1.3.1 -pkgrel=9 +pkgrel=10 _tglver=2.0.1 _tlparserver=0_git20151118 pkgdesc="Command line Telegram client" url="https://github.com/vysheng/tg" arch="all !s390x" license="GPL-3.0" -depends_dev="readline-dev libressl-dev libconfig-dev libevent-dev jansson-dev lua5.3-dev" +depends_dev="readline-dev openssl-dev libconfig-dev libevent-dev jansson-dev lua5.3-dev" makedepends="$depends_dev zlib-dev grep" provides="telegram-cli" source="$pkgname-$pkgver.tar.gz::https://github.com/vysheng/tg/archive/$pkgver.tar.gz @@ -19,7 +19,9 @@ source="$pkgname-$pkgver.tar.gz::https://github.com/vysheng/tg/archive/$pkgver.t makefile-tl-parser-nocrc32.patch musl-include-fix.patch makefile-remove-werror.patch + openssl-1.1.patch " +# tgl-openssl-1.1.patch::https://github.com/vysheng/tgl/pull/126/commits/66758bbea27515c5f35e3fafc64d3a3601a5b777.patch pkgusers="telegram" pkggroups="telegram" builddir="$srcdir/$pkgname-$pkgver" @@ -63,4 +65,5 @@ sha512sums="ac8341e8f951922fa78a1db74d9b1a87b03c3339307bd9c46da71656d8d6e55bf0b5 a7f16bd2cdedf62a1dbd180fcf957850d3b1c1c08b99f4f389ef5a83e228eb773e5da84e3127455880f4ebb526787bdae097200b337ae6df74b50bebec7c92fe tl-parser-0_git20151118.tar.gz b61e5907c6cf035ce067cfbc19995a04afa1f04cef00be52a02943e850d4a2754dba67732fa6ca958f2e48a741b2048fb38652c17b73e46359c550257e563f42 makefile-tl-parser-nocrc32.patch 4e26e7421db48b7074197e4cea1c6a6fce33a2b259f0da0e378f9a83f115e961016586b63d960d491cb5c4866fffbf454a5e0eda47ad16b3b77d117c8508f1f2 musl-include-fix.patch -1f8fab90948079abc94169751851347a6753dc13cf19973ba05a6f533ac173ba6ce70863988f2b167c27a347f4aeaa710c70cc960c0ba4090c43461386f8b217 makefile-remove-werror.patch" +1f8fab90948079abc94169751851347a6753dc13cf19973ba05a6f533ac173ba6ce70863988f2b167c27a347f4aeaa710c70cc960c0ba4090c43461386f8b217 makefile-remove-werror.patch +46ada5490a7db962aa70b73fe867f737a852fa5fcad331d9221afaae93e0bb2f0129568bb9c9eb337fad3ead8935b5eb5262e87d156411f12860aa1e740d5b39 openssl-1.1.patch" diff --git a/community/tg/openssl-1.1.patch b/community/tg/openssl-1.1.patch new file mode 100644 index 0000000000..fd79156308 --- /dev/null +++ b/community/tg/openssl-1.1.patch @@ -0,0 +1,102 @@ +diff --git a/tgl/mtproto-client.c b/tgl/mtproto-client.c +index 075decc..0f6c3f2 100644 +--- a/tgl/mtproto-client.c ++++ b/tgl/mtproto-client.c +@@ -143,7 +143,9 @@ static int decrypt_buffer[ENCRYPT_BUFFER_INTS]; + + static int encrypt_packet_buffer (struct tgl_state *TLS, struct tgl_dc *DC) { + RSA *key = TLS->rsa_key_loaded[DC->rsa_key_idx]; +- return tgl_pad_rsa_encrypt (TLS, (char *) packet_buffer, (packet_ptr - packet_buffer) * 4, (char *) encrypt_buffer, ENCRYPT_BUFFER_INTS * 4, key->n, key->e); ++ const BIGNUM *n, *e; ++ RSA_get0_key(key, &n, &e, NULL); ++ return tgl_pad_rsa_encrypt (TLS, (char *) packet_buffer, (packet_ptr - packet_buffer) * 4, (char *) encrypt_buffer, ENCRYPT_BUFFER_INTS * 4, n, e); + } + + static int encrypt_packet_buffer_aes_unauth (const char server_nonce[16], const char hidden_client_nonce[32]) { +diff --git a/tgl/mtproto-common.c b/tgl/mtproto-common.c +index f3b6582..b782256 100644 +--- a/tgl/mtproto-common.c ++++ b/tgl/mtproto-common.c +@@ -178,10 +178,12 @@ int tgl_serialize_bignum (BIGNUM *b, char *buffer, int maxlen) { + long long tgl_do_compute_rsa_key_fingerprint (RSA *key) { + static char tempbuff[4096]; + static unsigned char sha[20]; +- assert (key->n && key->e); +- int l1 = tgl_serialize_bignum (key->n, tempbuff, 4096); ++ const BIGNUM *n, *e; ++ RSA_get0_key(key, &n, &e, NULL); ++ assert (n && e); ++ int l1 = tgl_serialize_bignum (n, tempbuff, 4096); + assert (l1 > 0); +- int l2 = tgl_serialize_bignum (key->e, tempbuff + l1, 4096 - l1); ++ int l2 = tgl_serialize_bignum (e, tempbuff + l1, 4096 - l1); + assert (l2 > 0 && l1 + l2 <= 4096); + SHA1 ((unsigned char *)tempbuff, l1 + l2, sha); + return *(long long *)(sha + 12); +@@ -258,21 +260,20 @@ int tgl_pad_rsa_encrypt (struct tgl_state *TLS, char *from, int from_len, char * + assert (size >= chunks * 256); + assert (RAND_pseudo_bytes ((unsigned char *) from + from_len, pad) >= 0); + int i; +- BIGNUM x, y; +- BN_init (&x); +- BN_init (&y); ++ BIGNUM *x = BN_new(); ++ BIGNUM *y = BN_new(); + rsa_encrypted_chunks += chunks; + for (i = 0; i < chunks; i++) { +- BN_bin2bn ((unsigned char *) from, 255, &x); +- assert (BN_mod_exp (&y, &x, E, N, TLS->BN_ctx) == 1); +- unsigned l = 256 - BN_num_bytes (&y); ++ BN_bin2bn ((unsigned char *) from, 255, x); ++ assert (BN_mod_exp (y, x, E, N, TLS->BN_ctx) == 1); ++ unsigned l = 256 - BN_num_bytes (y); + assert (l <= 256); + memset (to, 0, l); +- BN_bn2bin (&y, (unsigned char *) to + l); ++ BN_bn2bin (y, (unsigned char *) to + l); + to += 256; + } +- BN_free (&x); +- BN_free (&y); ++ BN_free (x); ++ BN_free (y); + return chunks * 256; + } + +@@ -285,26 +286,25 @@ int tgl_pad_rsa_decrypt (struct tgl_state *TLS, char *from, int from_len, char * + assert (bits >= 2041 && bits <= 2048); + assert (size >= chunks * 255); + int i; +- BIGNUM x, y; +- BN_init (&x); +- BN_init (&y); ++ BIGNUM *x = BN_new(); ++ BIGNUM *y = BN_new(); + for (i = 0; i < chunks; i++) { + ++rsa_decrypted_chunks; +- BN_bin2bn ((unsigned char *) from, 256, &x); +- assert (BN_mod_exp (&y, &x, D, N, TLS->BN_ctx) == 1); +- int l = BN_num_bytes (&y); ++ BN_bin2bn ((unsigned char *) from, 256, x); ++ assert (BN_mod_exp (y, x, D, N, TLS->BN_ctx) == 1); ++ int l = BN_num_bytes (y); + if (l > 255) { +- BN_free (&x); +- BN_free (&y); ++ BN_free (x); ++ BN_free (y); + return -1; + } + assert (l >= 0 && l <= 255); + memset (to, 0, 255 - l); +- BN_bn2bin (&y, (unsigned char *) to + 255 - l); ++ BN_bn2bin (y, (unsigned char *) to + 255 - l); + to += 255; + } +- BN_free (&x); +- BN_free (&y); ++ BN_free (x); ++ BN_free (y); + return chunks * 255; + } + |