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.

69 lines
2.2 KiB

  1. diff --git a/src/openssl.c b/src/openssl.c
  2. index 4f63ef9..411f9f6 100644
  3. --- a/src/openssl.c
  4. +++ b/src/openssl.c
  5. @@ -1062,6 +1062,7 @@ _libssh2_pub_priv_keyfile(LIBSSH2_SESSION *session,
  6. "Unable to extract public key from private key "
  7. "file: Unable to open private key file");
  8. }
  9. +#if OPENSSL_VERSION_NUMBER < 0x10100000L
  10. if (!EVP_get_cipherbyname("des")) {
  11. /* If this cipher isn't loaded it's a pretty good indication that none
  12. * are. I have *NO DOUBT* that there's a better way to deal with this
  13. @@ -1070,6 +1071,7 @@ _libssh2_pub_priv_keyfile(LIBSSH2_SESSION *session,
  14. */
  15. OpenSSL_add_all_ciphers();
  16. }
  17. +#endif
  18. BIO_reset(bp);
  19. pk = PEM_read_bio_PrivateKey(bp, NULL, NULL, (void*)passphrase);
  20. BIO_free(bp);
  21. @@ -1138,6 +1140,7 @@ _libssh2_pub_priv_keyfilememory(LIBSSH2_SESSION *session,
  22. if (!bp) {
  23. return -1;
  24. }
  25. +#if OPENSSL_VERSION_NUMBER < 0x10100000L
  26. if (!EVP_get_cipherbyname("des")) {
  27. /* If this cipher isn't loaded it's a pretty good indication that none
  28. * are. I have *NO DOUBT* that there's a better way to deal with this
  29. @@ -1146,6 +1149,7 @@ _libssh2_pub_priv_keyfilememory(LIBSSH2_SESSION *session,
  30. */
  31. OpenSSL_add_all_ciphers();
  32. }
  33. +#endif
  34. BIO_reset(bp);
  35. pk = PEM_read_bio_PrivateKey(bp, NULL, NULL, (void*)passphrase);
  36. BIO_free(bp);
  37. diff --git a/src/openssl.h b/src/openssl.h
  38. index 3ca71fa..7a89793 100644
  39. --- a/src/openssl.h
  40. +++ b/src/openssl.h
  41. @@ -40,7 +40,9 @@
  42. #include <openssl/opensslconf.h>
  43. #include <openssl/sha.h>
  44. #include <openssl/rsa.h>
  45. +#ifndef OPENSSL_NO_ENGINE
  46. #include <openssl/engine.h>
  47. +#endif
  48. #ifndef OPENSSL_NO_DSA
  49. #include <openssl/dsa.h>
  50. #endif
  51. @@ -226,10 +228,18 @@ int _libssh2_md5_init(libssh2_md5_ctx *ctx);
  52. #define libssh2_hmac_cleanup(ctx) HMAC_cleanup(ctx)
  53. #endif
  54. +#if OPENSSL_VERSION_NUMBER < 0x10100000L
  55. +#ifndef OPENSSL_NO_ENGINE
  56. #define libssh2_crypto_init() \
  57. OpenSSL_add_all_algorithms(); \
  58. ENGINE_load_builtin_engines(); \
  59. ENGINE_register_all_complete()
  60. +#else
  61. +#define libssh2_crypto_init() OpenSSL_add_all_algorithms()
  62. +#endif
  63. +#else
  64. +#define libssh2_crypto_init()
  65. +#endif
  66. #define libssh2_crypto_exit()