Merge pull request #595 from neheb/hn
hnetd: fix compilation without deprecated OpenSSL APIs
This commit is contained in:
commit
9cfb2ea631
2 changed files with 44 additions and 1 deletions
|
@ -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
|
||||
|
|
43
hnetd/patches/010-openssl-deprecated.patch
Normal file
43
hnetd/patches/010-openssl-deprecated.patch
Normal file
|
@ -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)
|
Loading…
Reference in a new issue