Guest User

Untitled

a guest
Sep 20th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. diff --git a/lib/mosquitto_internal.h b/lib/mosquitto_internal.h
  2. index 4b4cf85..700bbb0 100644
  3. --- a/lib/mosquitto_internal.h
  4. +++ b/lib/mosquitto_internal.h
  5. @@ -25,6 +25,9 @@ Contributors:
  6.  
  7. #ifdef WITH_TLS
  8. # include <openssl/ssl.h>
  9. +# if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
  10. +# define HAVE_OPENSSL_OPAQUE_STRUCTS
  11. +# endif
  12. #else
  13. # include <time.h>
  14. #endif
  15. diff --git a/src/mosquitto_passwd.c b/src/mosquitto_passwd.c
  16. index de9a719..5b854d9 100644
  17. --- a/src/mosquitto_passwd.c
  18. +++ b/src/mosquitto_passwd.c
  19. @@ -90,7 +90,7 @@ int output_new_password(FILE *fptr, const char *username, const char *password)
  20. unsigned char hash[EVP_MAX_MD_SIZE];
  21. unsigned int hash_len;
  22. const EVP_MD *digest;
  23. -#if OPENSSL_VERSION_NUMBER < 0x10100000L
  24. +#ifndef HAVE_OPENSSL_OPAQUE_STRUCTS
  25. EVP_MD_CTX context;
  26. #else
  27. EVP_MD_CTX *context;
  28. @@ -117,7 +117,7 @@ int output_new_password(FILE *fptr, const char *username, const char *password)
  29. return 1;
  30. }
  31.  
  32. -#if OPENSSL_VERSION_NUMBER < 0x10100000L
  33. +#ifndef HAVE_OPENSSL_OPAQUE_STRUCTS
  34. EVP_MD_CTX_init(&context);
  35. EVP_DigestInit_ex(&context, digest, NULL);
  36. EVP_DigestUpdate(&context, password, strlen(password));
  37. diff --git a/src/security_default.c b/src/security_default.c
  38. index 64ca846..9ad8708 100644
  39. --- a/src/security_default.c
  40. +++ b/src/security_default.c
  41. @@ -770,7 +770,7 @@ int mosquitto_psk_key_get_default(struct mosquitto_db *db, const char *hint, con
  42. int _pw_digest(const char *password, const unsigned char *salt, unsigned int salt_len, unsigned char *hash, unsigned int *hash_len)
  43. {
  44. const EVP_MD *digest;
  45. -#if OPENSSL_VERSION_NUMBER < 0x10100000L
  46. +#ifndef HAVE_OPENSSL_OPAQUE_STRUCTS
  47. EVP_MD_CTX context;
  48.  
  49. digest = EVP_get_digestbyname("sha512");
Add Comment
Please, Sign In to add comment