mirror of
https://github.com/openwrt/routing.git
synced 2025-02-21 06:56:20 +00:00
Fixed compilation with newer libubox. libubox added a sys/stat.h include, which happens to break compilation. The reason being __unused is a variable in musl and an attribute here. Fixed by undefining right before including the headers. Clean up Makefile for consistency between packages. Refreshed patches. Signed-off-by: Rosen Penev <rosenp@gmail.com>
44 lines
1.1 KiB
Diff
44 lines
1.1 KiB
Diff
--- 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 *ps
|
|
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)
|