[PATCH] adb, use openssl 1.1

DoneSubmitted by Giovanni Biscuolo.
Details
2 participants
  • Giovanni Biscuolo
  • Leo Famulari
Owner
unassigned
Severity
normal
G
G
Giovanni Biscuolo wrote on 12 Aug 19:04 +0200
(address . guix-patches@gnu.org)
87czqifvbp.fsf@xelera.eu
Hello maintainers,
As promised in [bug#49859] I was able to assemble a patch for adb to useopenssl 1.1 instead of the old and unsopported openssl 1.0.
From f0c275121a74d7c20b4383e3bb65d6c27ad7a0e7 Mon Sep 17 00:00:00 2001From: Giovanni Biscuolo <g@xelera.eu>Date: Thu, 12 Aug 2021 18:09:02 +0200Subject: [PATCH] gnu: adb: Make compatible with openssl 1.1
OpenSSL version 1.1 brought some API changes which broke the build here, fixthat by accessing rsa->n (and e) directly, using RSA_get0_key instead.
Patch from: https://sources.debian.org/data/main/a/android-platform-system-core/1%3A7.0.0%2Br33-1/debian/patches/adb_libssl_11.diff
* gnu/local.mk (dist_patch_DATA): Add adb-libssl_11-compat.patch
* gnu/packages/android.scm: (android-platform-system-core) Addadb-libssl_11-compat.patch; (adb) Use openssl as input
* gnu/packages/patches/adb-libssl_11-compat.patch: New file--- gnu/local.mk | 1 + gnu/packages/android.scm | 3 +- .../patches/adb-libssl_11-compat.patch | 35 +++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/adb-libssl_11-compat.patch
Toggle diff (76 lines)diff --git a/gnu/local.mk b/gnu/local.mkindex 32ac19d20e..ba6b7732c4 100644--- a/gnu/local.mk+++ b/gnu/local.mk@@ -806,6 +806,7 @@ dist_patch_DATA = \ %D%/packages/patches/abseil-cpp-fix-gtest.patch \ %D%/packages/patches/abseil-cpp-fix-strerror_test.patch \ %D%/packages/patches/adb-add-libraries.patch \+ %D%/packages/patches/adb-libssl_11-compat.patch \ %D%/packages/patches/aegis-constness-error.patch \ %D%/packages/patches/aegis-perl-tempdir1.patch \ %D%/packages/patches/aegis-perl-tempdir2.patch \diff --git a/gnu/packages/android.scm b/gnu/packages/android.scmindex eb538f6540..43cd9b72f9 100644--- a/gnu/packages/android.scm+++ b/gnu/packages/android.scm@@ -148,6 +148,7 @@ use their packages mostly unmodified in our Android NDK build system.") "libutils-remove-damaging-includes.patch" "libutils-add-includes.patch" "adb-add-libraries.patch"+ "adb-libssl_11-compat.patch" "libziparchive-add-includes.patch")))) (define (android-platform-system-extras version)@@ -388,7 +389,7 @@ various Android core host applications.") `(("android-libbase" ,android-libbase) ("android-libcutils" ,android-libcutils) ("android-liblog" ,android-liblog)- ("openssl" ,openssl-1.0)))+ ("openssl" ,openssl))) (home-page "https://developer.android.com/studio/command-line/adb.html") (synopsis "Android Debug Bridge") (descriptiondiff --git a/gnu/packages/patches/adb-libssl_11-compat.patch b/gnu/packages/patches/adb-libssl_11-compat.patchnew file mode 100644index 0000000000..9affe58b5d--- /dev/null+++ b/gnu/packages/patches/adb-libssl_11-compat.patch@@ -0,0 +1,35 @@+This patch is taken from Debian+URL: https://sources.debian.org/data/main/a/android-platform-system-core/1%3A7.0.0%2Br33-1/debian/patches/adb_libssl_11.diff+Description: adb: Make compatible with openssl 1.1+ OpenSSL version 1.1 brought some API changes which broke the build here,+ fix that by accessing rsa->n (and e) directly, using RSA_get0_key instead.+Author: Chirayu Desai <chirayudesai1@gmail.com+Last-Update: 2016-11-10+--- a/adb/adb_auth_host.cpp++++ b/adb/adb_auth_host.cpp+@@ -71,6 +71,7 @@+ BIGNUM* rem = BN_new();+ BIGNUM* n = BN_new();+ BIGNUM* n0inv = BN_new();++ BIGNUM* e = BN_new();+ + if (RSA_size(rsa) != RSANUMBYTES) {+ ret = 0;+@@ -78,7 +79,7 @@+ }+ + BN_set_bit(r32, 32);+- BN_copy(n, rsa->n);++ RSA_get0_key(rsa, &n, &e, NULL);+ BN_set_bit(r, RSANUMWORDS * 32);+ BN_mod_sqr(rr, r, n, ctx);+ BN_div(NULL, rem, n, r32, ctx);+@@ -92,7 +93,7 @@+ BN_div(n, rem, n, r32, ctx);+ pkey->n[i] = BN_get_word(rem);+ }+- pkey->exponent = BN_get_word(rsa->e);++ pkey->exponent = BN_get_word(e);+ + out:+ BN_free(n0inv);-- 2.32.0
As described in the patch, I got the patch from Debian [1] andfortunately it applies as-is! (I'm not able to asses the code but I'mpretty sure Debian maintener did it for me).
I was able to build and install the package and tested it by connectingto my Android phone with adb via wi-fi: is this a viable test to checkif the patch is OK?
Happy hacking! Gio'

[1] https://sources.debian.org/data/main/a/android-platform-system-core/1%3A7.0.0%2Br33-1/debian/patches/adb_libssl_11.diff
-- Giovanni Biscuolo
Xelera IT Infrastructures
-----BEGIN PGP SIGNATURE-----
iQJABAEBCgAqFiEERcxjuFJYydVfNLI5030Op87MORIFAmEVVKoMHGdAeGVsZXJhLmV1AAoJENN9DqfOzDkS8RkP/jxrE8oiVnQ6xU6gc84eN09+bk32S/gq4c5fxR+gFB2H9xgPhA8zUrgK5OExdcnwUIZANQug6oJNa6Jp5gccN/emMLIbnLKAxHjL2Y09wvi4dTfcHEYPj6VVpwBgczmuRL2H7UpmwucpWiHiqMiMljEH8HLPgi4pPtp+dvr7Di2KBk1mIsbtHSY3Z/OX2wTKDL3DpsYQaCsD5mpsx7OnwjdJpnAZFZYl446i2Y194b6dh+UCYXkT/in61pWbiIpd+5dceRBPtU65daiCUeCxtQP57cnkbrT065EV5hf/Nkcs8as4dp1w+8XaKgdy6WNdqorLBMGiEvwkdhEyMXyRME9U0QVooigdKCmuI/AjSeS3hNHJ5WhMb7N2s14mjdTAGIKwR5jNNnuODjZe+Pj2+td3UMb6h+hG0i7BwxyZobueu5KG63tUMVw4o6WbvzRIIJcOuyr4Nezi0mQU4hZkJKgTr7aYcrM1T45F2danArXcI/4hA72mOdevhYG9gGL3xp//Zj9w4+D1WaLhrqHgFaeMFCqhDrh0m16iQfyz8aHG8hCpoxbBQzm/dAau6vVWCJXprLd4/WmtPpDOtTBD+5PoBAfpYULKbMBgxkLKc1hhaZjKAFiqgri9fwi+rMmXNycofMXgqx7dzz/BSkCtyuKtGvFImw8JiYEVJy9LUabS=QeZY-----END PGP SIGNATURE-----
L
L
Leo Famulari wrote on 15 Aug 19:43 +0200
(address . control@debbugs.gnu.org)
4f66aed1-def0-4f4f-9544-59c0221484d6@www.fastmail.com
block 46602 with 50029
L
L
Leo Famulari wrote on 16 Aug 00:09 +0200
(name . Giovanni Biscuolo)(address . g@xelera.eu)(address . 50029-done@debbugs.gnu.org)
YRmQf9ZkwRQg03wL@jasmine.lan
On Thu, Aug 12, 2021 at 07:04:42PM +0200, Giovanni Biscuolo wrote:
Toggle quote (5 lines)> Hello maintainers,> > As promised in [bug#49859] I was able to assemble a patch for adb to use> openssl 1.1 instead of the old and unsopported openssl 1.0.
Awesome!
Toggle quote (17 lines)> From f0c275121a74d7c20b4383e3bb65d6c27ad7a0e7 Mon Sep 17 00:00:00 2001> From: Giovanni Biscuolo <g@xelera.eu>> Date: Thu, 12 Aug 2021 18:09:02 +0200> Subject: [PATCH] gnu: adb: Make compatible with openssl 1.1> > OpenSSL version 1.1 brought some API changes which broke the build here, fix> that by accessing rsa->n (and e) directly, using RSA_get0_key instead.> > Patch from: https://sources.debian.org/data/main/a/android-platform-system-core/1%3A7.0.0%2Br33-1/debian/patches/adb_libssl_11.diff> > * gnu/local.mk (dist_patch_DATA): Add adb-libssl_11-compat.patch> > * gnu/packages/android.scm: (android-platform-system-core) Add> adb-libssl_11-compat.patch; (adb) Use openssl as input> > * gnu/packages/patches/adb-libssl_11-compat.patch: New file
I cleaned up the commit message and renamed the patch toadb-libssl_11-compatibility.patch and pushed as05effbbfc2fc6223aafacf8a3cb2b2d970b6bb66
Closed
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send email to 50029@debbugs.gnu.org