Skip to content

Commit

Permalink
mosquitto: Fix compilation without deprecetated OpenSSL APIs
Browse files Browse the repository at this point in the history
Signed-off-by: Rosen Penev <[email protected]>
  • Loading branch information
neheb committed Jan 2, 2019
1 parent 582f402 commit 9797b16
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 1 deletion.
2 changes: 1 addition & 1 deletion net/mosquitto/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=mosquitto
PKG_VERSION:=1.5.5
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE.txt
PKG_CPE_ID:=cpe:/a:eclipse:mosquitto
Expand Down
62 changes: 62 additions & 0 deletions net/mosquitto/patches/010-openssl-deprecated.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
--- a/lib/net_mosq.c
+++ b/lib/net_mosq.c
@@ -87,9 +87,11 @@ int net__init(void)
#endif

#ifdef WITH_TLS
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
SSL_load_error_strings();
SSL_library_init();
OpenSSL_add_all_algorithms();
+#endif
if(tls_ex_index_mosq == -1){
tls_ex_index_mosq = SSL_get_ex_new_index(0, "client context", NULL, NULL, NULL);
}
@@ -101,15 +103,15 @@ void net__cleanup(void)
{
#ifdef WITH_TLS
#if OPENSSL_VERSION_NUMBER < 0x10100000L
- ERR_remove_state(0);
- #endif
+ ERR_remove_thread_state(NULL);
#ifndef OPENSSL_NO_ENGINE
ENGINE_cleanup();
#endif
- CONF_modules_unload(1);
- ERR_free_strings();
- EVP_cleanup();
- CRYPTO_cleanup_all_ex_data();
+ CONF_modules_unload(1);
+ ERR_free_strings();
+ EVP_cleanup();
+ CRYPTO_cleanup_all_ex_data();
+ #endif
#endif

#ifdef WITH_SRV
diff --git a/lib/tls_mosq.h b/lib/tls_mosq.h
index 6694818..619d612 100644
--- a/lib/tls_mosq.h
+++ b/lib/tls_mosq.h
@@ -26,6 +26,7 @@ Contributors:
#ifdef WITH_TLS

#include <openssl/ssl.h>
+#include <openssl/bn.h>

int mosquitto__server_certificate_verify(int preverify_ok, X509_STORE_CTX *ctx);
int mosquitto__verify_certificate_hostname(X509 *cert, const char *hostname);
diff --git a/src/mosquitto_passwd.c b/src/mosquitto_passwd.c
index 5b303c1..5dcd2a2 100644
--- a/src/mosquitto_passwd.c
+++ b/src/mosquitto_passwd.c
@@ -387,7 +387,9 @@ int main(int argc, char *argv[])
signal(SIGINT, handle_sigint);
signal(SIGTERM, handle_sigint);

+#if OPENSSL_VERSION_NUMBER < 0x10100000L
OpenSSL_add_all_digests();
+#endif

if(argc == 1){
print_usage();

0 comments on commit 9797b16

Please sign in to comment.