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.

65 lines
1.8 KiB

  1. From 8349ff1ec3d001aa85cc94a9004509cca8ebf036 Mon Sep 17 00:00:00 2001
  2. From: Rosen Penev <rosenp@gmail.com>
  3. Date: Wed, 7 Nov 2018 17:17:53 -0800
  4. Subject: [PATCH] crypto: Fix compilation for OpenSSL without deprecated
  5. APIs
  6. Added missing bn.h include.
  7. Made engine.h include conditional, otherwise it would fail.
  8. DSA_generate_parameters was deprecated long before 1.1.0.
  9. Signed-off-by: Rosen Penev <rosenp@gmail.com>
  10. ---
  11. src/libcrypto-compat.c | 5 ++++-
  12. src/libcrypto-compat.h | 1 +
  13. src/pki_crypto.c | 2 +-
  14. 3 files changed, 6 insertions(+), 2 deletions(-)
  15. diff --git a/src/libcrypto-compat.c b/src/libcrypto-compat.c
  16. index 4b1f36a5..b8b4f11a 100644
  17. --- a/src/libcrypto-compat.c
  18. +++ b/src/libcrypto-compat.c
  19. @@ -8,9 +8,12 @@
  20. */
  21. #include <string.h>
  22. -#include <openssl/engine.h>
  23. #include "libcrypto-compat.h"
  24. +#ifndef OPENSSL_NO_ENGINE
  25. +#include <openssl/engine.h>
  26. +#endif
  27. +
  28. static void *OPENSSL_zalloc(size_t num)
  29. {
  30. void *ret = OPENSSL_malloc(num);
  31. diff --git a/src/libcrypto-compat.h b/src/libcrypto-compat.h
  32. index 21542c65..00e4f2a3 100644
  33. --- a/src/libcrypto-compat.h
  34. +++ b/src/libcrypto-compat.h
  35. @@ -10,6 +10,7 @@
  36. #include <openssl/dh.h>
  37. #include <openssl/evp.h>
  38. #include <openssl/hmac.h>
  39. +#include <openssl/bn.h>
  40. int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d);
  41. int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q);
  42. diff --git a/src/pki_crypto.c b/src/pki_crypto.c
  43. index d9f7753a..c1aac409 100644
  44. --- a/src/pki_crypto.c
  45. +++ b/src/pki_crypto.c
  46. @@ -451,7 +451,7 @@ int pki_key_generate_rsa(ssh_key key, int parameter){
  47. int pki_key_generate_dss(ssh_key key, int parameter){
  48. int rc;
  49. -#if OPENSSL_VERSION_NUMBER > 0x10100000L
  50. +#if OPENSSL_VERSION_NUMBER > 0x00908000L
  51. key->dsa = DSA_new();
  52. if (key->dsa == NULL) {
  53. return SSH_ERROR;
  54. --
  55. 2.19.1