pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

android-tools-adb: fix build with openssl 1.1.x.



Module Name:	pkgsrc-wip
Committed By:	coypu <coypu%sdf.org@localhost>
Pushed By:	coypu
Date:		Wed Jun 13 23:33:21 2018 +0300
Changeset:	ab36090b86365525a28bb9591ad082507966537f

Modified Files:
	android-tools-adb/distinfo
Added Files:
	android-tools-adb/patches/patch-adb__auth__host.c

Log Message:
android-tools-adb: fix build with openssl 1.1.x.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=ab36090b86365525a28bb9591ad082507966537f

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 android-tools-adb/distinfo                        |  1 +
 android-tools-adb/patches/patch-adb__auth__host.c | 56 +++++++++++++++++++++++
 2 files changed, 57 insertions(+)

diffs:
diff --git a/android-tools-adb/distinfo b/android-tools-adb/distinfo
index b759513c36..41393f9e84 100644
--- a/android-tools-adb/distinfo
+++ b/android-tools-adb/distinfo
@@ -3,5 +3,6 @@ $NetBSD: distinfo,v 1.2 2015/03/07 16:28:33 tnn2 Exp $
 SHA1 (platform_system_core-android-5.0.2_r1.tar.gz) = fc5626cf84cc18175be498ea3e664d7c7b188c27
 RMD160 (platform_system_core-android-5.0.2_r1.tar.gz) = e1e73c0f6ac99cd0641b8ff575fe56f3a79decfb
 Size (platform_system_core-android-5.0.2_r1.tar.gz) = 1202992 bytes
+SHA1 (patch-adb__auth__host.c) = f0e559f3643e660960c69cd466cf73ec5078b091
 SHA1 (patch-get__my__path__freebsd.c) = 608d3d51d46519487e1494918647dfa6540bccb0
 SHA1 (patch-usb__libusb.c) = d41f8a5d7639682c6d186121cd56f0a5ba87dcd7
diff --git a/android-tools-adb/patches/patch-adb__auth__host.c b/android-tools-adb/patches/patch-adb__auth__host.c
new file mode 100644
index 0000000000..accec60f4b
--- /dev/null
+++ b/android-tools-adb/patches/patch-adb__auth__host.c
@@ -0,0 +1,56 @@
+$NetBSD$
+
+OpenSSL 1.1.x compatibility.
+Use getter for rsa->n, suggested by
+https://wiki.openssl.org/index.php/OpenSSL_1.1.0_Changes
+
+--- adb_auth_host.c.orig	2014-10-22 00:46:49.000000000 +0000
++++ adb_auth_host.c
+@@ -50,6 +50,18 @@
+ #define ANDROID_PATH   ".android"
+ #define ADB_KEY_FILE   "adbkey"
+ 
++#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER < 0x10100000L
++static inline void RSA_get0_key(const RSA *r,
++     const BIGNUM **n, const BIGNUM **e, const BIGNUM **d)
++{
++	if (n)
++		*n = r->n;
++	if (e)
++		*e = r->e;
++	if (d)
++		*d = r->d;
++}
++#endif
+ 
+ struct adb_private_key {
+     struct listnode node;
+@@ -73,13 +85,17 @@ static int RSA_to_RSAPublicKey(RSA *rsa,
+     BIGNUM* n = BN_new();
+     BIGNUM* n0inv = BN_new();
+ 
++    const BIGNUM* getter1;
++    const BIGNUM* getter2;
++
+     if (RSA_size(rsa) != RSANUMBYTES) {
+         ret = 0;
+         goto out;
+     }
+ 
+     BN_set_bit(r32, 32);
+-    BN_copy(n, rsa->n);
++    RSA_get0_key(rsa, &getter1, NULL, NULL);
++    BN_copy(n, getter1);
+     BN_set_bit(r, RSANUMWORDS * 32);
+     BN_mod_sqr(rr, r, n, ctx);
+     BN_div(NULL, rem, n, r32, ctx);
+@@ -93,7 +109,8 @@ static int RSA_to_RSAPublicKey(RSA *rsa,
+         BN_div(n, rem, n, r32, ctx);
+         pkey->n[i] = BN_get_word(rem);
+     }
+-    pkey->exponent = BN_get_word(rsa->e);
++    RSA_get0_key(rsa, NULL, &getter2, NULL);
++    pkey->exponent = BN_get_word(getter2);
+ 
+ out:
+     BN_free(n0inv);


Home | Main Index | Thread Index | Old Index