1Description: adb: Make compatible with openssl 1.1
2 OpenSSL version 1.1 brought some API changes which broke the build here,
3 fix that by accessing rsa->n (and e) directly, using RSA_get0_key instead.
4Author: Chirayu Desai <chirayudesai1@gmail.com
5Last-Update: 2016-11-10
6---
7Upstream-Status: Pending
8
9This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
10---
11Upstream-Status: Pending
12
13 system/core/adb/adb_auth_host.c |    5 +++--
14 1 file changed, 3 insertions(+), 2 deletions(-)
15
16--- a/adb/adb_auth_host.c
17+++ b/adb/adb_auth_host.c
18@@ -75,6 +75,7 @@ static int RSA_to_RSAPublicKey(RSA *rsa,
19     BIGNUM* rem = BN_new();
20     BIGNUM* n = BN_new();
21     BIGNUM* n0inv = BN_new();
22+    BIGNUM* e = BN_new();
23
24     if (RSA_size(rsa) != RSANUMBYTES) {
25         ret = 0;
26@@ -82,7 +83,7 @@ static int RSA_to_RSAPublicKey(RSA *rsa,
27     }
28
29     BN_set_bit(r32, 32);
30-    BN_copy(n, rsa->n);
31+    RSA_get0_key(rsa, &n, &e, NULL);
32     BN_set_bit(r, RSANUMWORDS * 32);
33     BN_mod_sqr(rr, r, n, ctx);
34     BN_div(NULL, rem, n, r32, ctx);
35@@ -96,7 +97,7 @@ static int RSA_to_RSAPublicKey(RSA *rsa,
36         BN_div(n, rem, n, r32, ctx);
37         pkey->n[i] = BN_get_word(rem);
38     }
39-    pkey->exponent = BN_get_word(rsa->e);
40+    pkey->exponent = BN_get_word(e);
41
42 out:
43     BN_free(n0inv);
44