0001-crypt_openssl_mgt-define-DISABLE_ENGINES-after-OPENS.patch 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. From 48f8d6918977673125d53a85d19d709136106739 Mon Sep 17 00:00:00 2001
  2. From: orbea <orbea@riseup.net>
  3. Date: Thu, 31 Aug 2023 14:35:52 -0700
  4. Subject: [PATCH] crypt_openssl_mgt: define DISABLE_ENGINES after
  5. OPENSSL_NO_ENGINE
  6. With LibreSSL-3.8.1 these engines are no long available causing a build
  7. failure, but LibreSSL correctly defines OPENSSL_NO_ENGINE as part of its
  8. opensslfeatures.h. However Tor includes crypto_openssl_mgt.h before any
  9. of the openssl includes which would define OPENSSL_NO_ENGINE and then
  10. fails to define DISABLE_ENGINES.
  11. As the define is used in only a single .c file it is best to move it
  12. there.
  13. Signed-off-by: orbea <orbea@riseup.net>
  14. Upstream: https://gitlab.torproject.org/tpo/core/tor/-/commit/48f8d6918977673125d53a85d19d709136106739
  15. Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
  16. ---
  17. src/lib/crypt_ops/crypto_openssl_mgt.c | 5 +++++
  18. src/lib/crypt_ops/crypto_openssl_mgt.h | 5 -----
  19. 2 files changed, 5 insertions(+), 5 deletions(-)
  20. diff --git a/src/lib/crypt_ops/crypto_openssl_mgt.c b/src/lib/crypt_ops/crypto_openssl_mgt.c
  21. index 6c01cb6aa8..ca12a82518 100644
  22. --- a/src/lib/crypt_ops/crypto_openssl_mgt.c
  23. +++ b/src/lib/crypt_ops/crypto_openssl_mgt.c
  24. @@ -40,6 +40,11 @@ ENABLE_GCC_WARNING("-Wredundant-decls")
  25. #include <string.h>
  26. +#ifdef OPENSSL_NO_ENGINE
  27. +/* Android's OpenSSL seems to have removed all of its Engine support. */
  28. +#define DISABLE_ENGINES
  29. +#endif
  30. +
  31. #ifndef NEW_THREAD_API
  32. /** A number of preallocated mutexes for use by OpenSSL. */
  33. static tor_mutex_t **openssl_mutexes_ = NULL;
  34. diff --git a/src/lib/crypt_ops/crypto_openssl_mgt.h b/src/lib/crypt_ops/crypto_openssl_mgt.h
  35. index 96a37721dd..eac0ec1977 100644
  36. --- a/src/lib/crypt_ops/crypto_openssl_mgt.h
  37. +++ b/src/lib/crypt_ops/crypto_openssl_mgt.h
  38. @@ -49,11 +49,6 @@
  39. #define OPENSSL_V_SERIES(a,b,c) \
  40. OPENSSL_VER((a),(b),(c),0,0)
  41. -#ifdef OPENSSL_NO_ENGINE
  42. -/* Android's OpenSSL seems to have removed all of its Engine support. */
  43. -#define DISABLE_ENGINES
  44. -#endif
  45. -
  46. #if OPENSSL_VERSION_NUMBER >= OPENSSL_VER(1,1,0,0,5)
  47. /* OpenSSL as of 1.1.0pre4 has an "new" thread API, which doesn't require
  48. * setting up various callbacks.
  49. --
  50. GitLab