adb: added patch for openssl 1.1.0 compatibility
[openwrt/staging/mkresin.git] / package / utils / adb / patches / 010-openssl-1.1.patch
1 --- a/adb/adb_auth_host.c
2 +++ b/adb/adb_auth_host.c
3 @@ -83,7 +83,13 @@ static int RSA_to_RSAPublicKey(RSA *rsa,
4 }
5
6 BN_set_bit(r32, 32);
7 +#if OPENSSL_VERSION_NUMBER >= 0x10100000L
8 + const BIGNUM *rsa_n, *rsa_e;
9 + RSA_get0_key(rsa, &rsa_n, &rsa_e, NULL);
10 + BN_copy(n, rsa_n);
11 +#else
12 BN_copy(n, rsa->n);
13 +#endif
14 BN_set_bit(r, RSANUMWORDS * 32);
15 BN_mod_sqr(rr, r, n, ctx);
16 BN_div(NULL, rem, n, r32, ctx);
17 @@ -97,7 +103,11 @@ static int RSA_to_RSAPublicKey(RSA *rsa,
18 BN_div(n, rem, n, r32, ctx);
19 pkey->n[i] = BN_get_word(rem);
20 }
21 +#if OPENSSL_VERSION_NUMBER >= 0x10100000L
22 + pkey->exponent = BN_get_word(rsa_e);
23 +#else
24 pkey->exponent = BN_get_word(rsa->e);
25 +#endif
26
27 out:
28 BN_free(n0inv);