0010-adb-added-patch-for-openssl-1.1.0-compatibility.patch 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. From bb3da0e32be4f2260940edf3ee0f88103dfd0dcc Mon Sep 17 00:00:00 2001
  2. From: Eneas U de Queiroz <cote2004-github@yahoo.com>
  3. Date: Tue, 5 Feb 2019 01:12:19 +0200
  4. Subject: [PATCH] adb: added patch for openssl 1.1.0 compatibility
  5. Signed-off-by: Eneas U de Queiroz <cote2004-github@yahoo.com>
  6. [Vadim: took only adb related part from
  7. https://github.com/lede-project/source/commit/f63f20fb93c7e67775cb01d97fc88b5b29452b81]
  8. Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
  9. ---
  10. core/adb/adb_auth_host.c | 10 ++++++++++
  11. 1 file changed, 10 insertions(+)
  12. diff --git a/core/adb/adb_auth_host.c b/core/adb/adb_auth_host.c
  13. index 9039d42..debd2ef 100644
  14. --- a/core/adb/adb_auth_host.c
  15. +++ b/core/adb/adb_auth_host.c
  16. @@ -79,7 +79,13 @@ static int RSA_to_RSAPublicKey(RSA *rsa, RSAPublicKey *pkey)
  17. }
  18. BN_set_bit(r32, 32);
  19. +#if OPENSSL_VERSION_NUMBER >= 0x10100000L
  20. + const BIGNUM *rsa_n, *rsa_e;
  21. + RSA_get0_key(rsa, &rsa_n, &rsa_e, NULL);
  22. + BN_copy(n, rsa_n);
  23. +#else
  24. BN_copy(n, rsa->n);
  25. +#endif
  26. BN_set_bit(r, RSANUMWORDS * 32);
  27. BN_mod_sqr(rr, r, n, ctx);
  28. BN_div(NULL, rem, n, r32, ctx);
  29. @@ -93,7 +99,11 @@ static int RSA_to_RSAPublicKey(RSA *rsa, RSAPublicKey *pkey)
  30. BN_div(n, rem, n, r32, ctx);
  31. pkey->n[i] = BN_get_word(rem);
  32. }
  33. +#if OPENSSL_VERSION_NUMBER >= 0x10100000L
  34. + pkey->exponent = BN_get_word(rsa_e);
  35. +#else
  36. pkey->exponent = BN_get_word(rsa->e);
  37. +#endif
  38. out:
  39. BN_free(n0inv);
  40. --
  41. 2.14.1