From 33ddb02b91ab3cd3de565f3a3ded9d6b5a325f6a Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Tue, 11 Aug 2020 12:28:00 -0700 Subject: [PATCH] hnetd: fix compilation without deprecated OpenSSL APIs Signed-off-by: Rosen Penev --- hnetd/Makefile | 2 +- hnetd/patches/010-openssl-deprecated.patch | 43 ++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 hnetd/patches/010-openssl-deprecated.patch diff --git a/hnetd/Makefile b/hnetd/Makefile index 8689972..2d1b2cc 100644 --- a/hnetd/Makefile +++ b/hnetd/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=hnetd PKG_SOURCE_VERSION:=606d7e904603ad8792ac1a7ba825618df97b5a4e PKG_VERSION:=2016-06-28-$(PKG_SOURCE_VERSION) -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/sbyx/hnetd.git diff --git a/hnetd/patches/010-openssl-deprecated.patch b/hnetd/patches/010-openssl-deprecated.patch new file mode 100644 index 0000000..23bdefb --- /dev/null +++ b/hnetd/patches/010-openssl-deprecated.patch @@ -0,0 +1,43 @@ +--- a/src/dtls.c ++++ b/src/dtls.c +@@ -698,8 +698,10 @@ dtls dtls_create(uint16_t port) + if (!_ssl_initialized) + { + _ssl_initialized = true; ++#if OPENSSL_VERSION_NUMBER < 0x10100000L + SSL_load_error_strings(); + SSL_library_init(); ++#endif + } + if (!d) + goto fail; +@@ -711,9 +713,9 @@ dtls dtls_create(uint16_t port) + goto fail; + + #ifdef USE_ONE_CONTEXT +- SSL_CTX *ctx = SSL_CTX_new(DTLSv1_method()); ++ SSL_CTX *ctx = SSL_CTX_new(DTLS_method()); + #else +- SSL_CTX *ctx = SSL_CTX_new(DTLSv1_server_method()); ++ SSL_CTX *ctx = SSL_CTX_new(DTLS_server_method()); + #endif /* USE_ONE_CONTEXT */ + if (!ctx) + { +@@ -1002,6 +1004,7 @@ _client_psk(SSL *ssl, + + bool dtls_set_psk(dtls d, const char *psk, size_t psk_len) + { ++#ifndef OPENSSL_NO_PSK + free(d->psk); + d->psk = malloc(psk_len); + if (!d->psk) +@@ -1011,6 +1014,9 @@ bool dtls_set_psk(dtls d, const char *psk, size_t psk_len) + SSL_CTX_set_psk_client_callback(d->ssl_client_ctx, _client_psk); + SSL_CTX_set_psk_server_callback(d->ssl_server_ctx, _server_psk); + return true; ++#else ++ return false; ++#endif + } + + bool dtls_cert_to_pem_buf(dtls_cert cert, char *buf, int buf_len) -- 2.30.2