You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
2.6 KiB

  1. --- a/lib/crypto/c_src/crypto.c
  2. +++ b/lib/crypto/c_src/crypto.c
  3. @@ -41,6 +41,7 @@
  4. #include <openssl/des.h>
  5. #endif /* #ifndef OPENSSL_NO_DES */
  6. /* #include <openssl/idea.h> This is not supported on the openssl OTP requires */
  7. +#include <openssl/dh.h>
  8. #include <openssl/dsa.h>
  9. #include <openssl/rsa.h>
  10. #include <openssl/aes.h>
  11. @@ -197,8 +198,10 @@
  12. /* If OPENSSL_NO_EC is set, there will be an error in ec.h included from engine.h
  13. So if EC is disabled, you can't use Engine either....
  14. */
  15. +#if !defined(OPENSSL_NO_ENGINE)
  16. # define HAS_ENGINE_SUPPORT
  17. #endif
  18. +#endif
  19. #if defined(HAS_ENGINE_SUPPORT)
  20. @@ -1186,7 +1189,11 @@ static int initialize(ErlNifEnv* env, ERL_NIF_TERM load_info)
  21. #ifdef OPENSSL_THREADS
  22. if (nlocks > 0) {
  23. CRYPTO_set_locking_callback(ccb->locking_function);
  24. +#if OPENSSL_VERSION_NUMBER < 0x10000000
  25. CRYPTO_set_id_callback(ccb->id_function);
  26. +#else
  27. + CRYPTO_THREADID_set_callback(ccb->id_function);
  28. +#endif
  29. CRYPTO_set_dynlock_create_callback(ccb->dyn_create_function);
  30. CRYPTO_set_dynlock_lock_callback(ccb->dyn_lock_function);
  31. CRYPTO_set_dynlock_destroy_callback(ccb->dyn_destroy_function);
  32. --- a/lib/crypto/c_src/crypto_callback.c
  33. +++ b/lib/crypto/c_src/crypto_callback.c
  34. @@ -115,10 +115,17 @@ static void locking_function(int mode, int n, const char *file, int line)
  35. locking(mode, lock_vec[n]);
  36. }
  37. +#if OPENSSL_VERSION_NUMBER < 0x10000000
  38. static unsigned long id_function(void)
  39. {
  40. return (unsigned long) enif_thread_self();
  41. }
  42. +#else
  43. +static void id_function(CRYPTO_THREADID *id)
  44. +{
  45. + CRYPTO_THREADID_set_numeric(id, (unsigned long) enif_thread_self());
  46. +}
  47. +#endif
  48. /* Dynamic locking, not used by current openssl version (0.9.8)
  49. */
  50. --- a/lib/crypto/c_src/crypto_callback.h
  51. +++ b/lib/crypto/c_src/crypto_callback.h
  52. @@ -36,7 +36,11 @@ struct crypto_callbacks
  53. /* openssl callbacks */
  54. #ifdef OPENSSL_THREADS
  55. void (*locking_function)(int mode, int n, const char *file, int line);
  56. + #if OPENSSL_VERSION_NUMBER < 0x10000000
  57. unsigned long (*id_function)(void);
  58. + #else
  59. + void (*id_function)(CRYPTO_THREADID *id);
  60. + #endif
  61. struct CRYPTO_dynlock_value* (*dyn_create_function)(const char *file,
  62. int line);
  63. void (*dyn_lock_function)(int mode, struct CRYPTO_dynlock_value* ptr,
  64. --- a/lib/crypto/c_src/otp_test_engine.c
  65. +++ b/lib/crypto/c_src/otp_test_engine.c
  66. @@ -42,8 +42,10 @@
  67. && !defined(OPENSSL_NO_EC) \
  68. && !defined(OPENSSL_NO_ECDH) \
  69. && !defined(OPENSSL_NO_ECDSA)
  70. +#if !defined(OPENSSL_NO_ENGINE)
  71. # define HAVE_EC
  72. #endif
  73. +#endif
  74. #if defined(HAVE_EC)
  75. /* If OPENSSL_NO_EC is set, there will be an error in ec.h included from engine.h