hnetd: fix compilation without deprecated OpenSSL APIs 595/head
authorRosen Penev <rosenp@gmail.com>
Tue, 11 Aug 2020 19:28:00 +0000 (12:28 -0700)
committerRosen Penev <rosenp@gmail.com>
Tue, 11 Aug 2020 19:37:46 +0000 (12:37 -0700)
Signed-off-by: Rosen Penev <rosenp@gmail.com>
hnetd/Makefile
hnetd/patches/010-openssl-deprecated.patch [new file with mode: 0644]

index 86899728f8e48712ae90b74d43e7f2401f48c382..2d1b2ccabbe800a80fa4e6f07702940350a078d4 100644 (file)
@@ -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 (file)
index 0000000..23bdefb
--- /dev/null
@@ -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)