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.

98 lines
2.3 KiB

  1. From 5e0e401dc69b9c25e5f85de7484a70ea97862e16 Mon Sep 17 00:00:00 2001
  2. From: Rosen Penev <rosenp@gmail.com>
  3. Date: Wed, 12 Dec 2018 13:45:59 -0800
  4. Subject: [PATCH 2/2] Fix compilation without deprecated OpenSSL APIs
  5. This is an optional part of OpenWrt designed to save space.
  6. ---
  7. src/connection.c | 4 ++--
  8. src/connection.h | 4 ++++
  9. src/net_setup.c | 1 +
  10. src/tincd.c | 5 +++++
  11. 4 files changed, 12 insertions(+), 2 deletions(-)
  12. diff --git a/src/connection.c b/src/connection.c
  13. index 38b3ccfe..d137af12 100644
  14. --- a/src/connection.c
  15. +++ b/src/connection.c
  16. @@ -96,13 +96,13 @@ void free_connection_partially(connection_t *c) {
  17. c->outbudget = 0;
  18. if(c->inctx) {
  19. - EVP_CIPHER_CTX_cleanup(c->inctx);
  20. + EVP_CIPHER_CTX_reset(c->inctx);
  21. free(c->inctx);
  22. c->inctx = NULL;
  23. }
  24. if(c->outctx) {
  25. - EVP_CIPHER_CTX_cleanup(c->outctx);
  26. + EVP_CIPHER_CTX_reset(c->outctx);
  27. free(c->outctx);
  28. c->outctx = NULL;
  29. }
  30. diff --git a/src/connection.h b/src/connection.h
  31. index 629e16b9..4f554672 100644
  32. --- a/src/connection.h
  33. +++ b/src/connection.h
  34. @@ -24,6 +24,10 @@
  35. #include <openssl/rsa.h>
  36. #include <openssl/evp.h>
  37. +#if OPENSSL_VERSION_NUMBER < 0x10100000L
  38. +#define EVP_CIPHER_CTX_reset(c) EVP_CIPHER_CTX_cleanup(c)
  39. +#endif
  40. +
  41. #include "avl_tree.h"
  42. #define OPTION_INDIRECT 0x0001
  43. diff --git a/src/net_setup.c b/src/net_setup.c
  44. index cac7455d..f26007bd 100644
  45. --- a/src/net_setup.c
  46. +++ b/src/net_setup.c
  47. @@ -27,6 +27,7 @@
  48. #include <openssl/rand.h>
  49. #include <openssl/err.h>
  50. #include <openssl/evp.h>
  51. +#include <openssl/bn.h>
  52. #include "avl_tree.h"
  53. #include "conf.h"
  54. diff --git a/src/tincd.c b/src/tincd.c
  55. index bdac0c9d..e8a60449 100644
  56. --- a/src/tincd.c
  57. +++ b/src/tincd.c
  58. @@ -40,6 +40,7 @@
  59. #ifndef OPENSSL_NO_ENGINE
  60. #include <openssl/engine.h>
  61. #endif
  62. +#include <openssl/bn.h>
  63. #ifdef HAVE_LZO
  64. #include LZO1X_H
  65. @@ -692,7 +693,9 @@ int main(int argc, char **argv) {
  66. ENGINE_register_all_complete();
  67. #endif
  68. +#if OPENSSL_VERSION_NUMBER < 0x10100000L
  69. OpenSSL_add_all_algorithms();
  70. +#endif
  71. if(generate_keys) {
  72. read_server_config();
  73. @@ -811,10 +814,12 @@ end:
  74. free(priority);
  75. +#if OPENSSL_VERSION_NUMBER < 0x10100000L
  76. EVP_cleanup();
  77. ERR_free_strings();
  78. #ifndef OPENSSL_NO_ENGINE
  79. ENGINE_cleanup();
  80. +#endif
  81. #endif
  82. exit_configuration(&config_tree);
  83. --
  84. 2.20.0