From c237b15b160f6f279d9c32a8f02133391e7da232 Mon Sep 17 00:00:00 2001 From: Jon Shallow Date: Fri, 4 Oct 2019 20:49:38 +0100 Subject: [PATCH] Correct Disable TCP for TLS and Windows Makefile.am: include coap_tcp_internal.h in EXTRA_DIST libcoap-2.map libcoap-2.sym: Don't expose previously static coap_socket_format_errno(). src/coap_gnutls.c: src/coap_openssl.c: src/coap_tinydtls.c: Correct ENABLE_TCP (never defined) to !COAP_DISABLE_TCP. Conditionally compile in TLS code as appropriate. src/coap_io.c: Correct #endif description. src/coap_session.c: Conditionally compile in TLS code as appropriate. src/coap_tcp.c Merge in appropriate parts of https://github.com/obgm/libcoap/pull/396 and https://github.com/obgm/libcoap/pull/345 fixes. include/coap2/coap_tcp.h: include/coap2/coap_tcp_internal.h: Rename include/coap2/coap_tcp.h to include/coap2/coap_tcp_internal.h and remove reference to coap_tcp_is_supported(). include/coap2/coap.h.in: Remove reference to coap_tcp.h. coap_config.h.windows: Include #define COAP_DISABLE_TCP 0. include/coap2/coap.h.windows: Reorder #includes include/coap2/coap_internal.h: Add #include coap_tcp_internal.h include/coap2/coap_io.h: Add in definition of coap_tcp_is_supported(). win32/libcoap.vcxproj: win32/libcoap.vcxproj.filters: Include src/coap_tcp.c and include/coap2/coap_tcp_internal.h. --- Makefile.am | 3 +- coap_config.h.windows | 4 +++ include/coap2/coap.h.in | 1 - include/coap2/coap.h.windows | 2 +- include/coap2/coap_internal.h | 1 + include/coap2/coap_io.h | 7 ++++ .../coap2/{coap_tcp.h => coap_tcp_internal.h} | 24 ++++++------- libcoap-2.map | 1 - libcoap-2.sym | 1 - src/coap_gnutls.c | 8 +++-- src/coap_io.c | 2 +- src/coap_openssl.c | 36 +++++++++++++++++-- src/coap_session.c | 10 +++++- src/coap_tcp.c | 16 +++++---- src/coap_tinydtls.c | 2 ++ win32/libcoap.vcxproj | 2 ++ win32/libcoap.vcxproj.filters | 6 ++++ 17 files changed, 93 insertions(+), 33 deletions(-) rename include/coap2/{coap_tcp.h => coap_tcp_internal.h} (73%) diff --git a/Makefile.am b/Makefile.am index 0125e90b..fec79c4a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -25,6 +25,7 @@ EXTRA_DIST = \ include/coap$(LIBCOAP_API_VERSION)/coap_internal.h \ include/coap$(LIBCOAP_API_VERSION)/coap_session_internal.h \ include/coap$(LIBCOAP_API_VERSION)/coap_subscribe_internal.h \ + include/coap$(LIBCOAP_API_VERSION)/coap_tcp_internal.h \ include/coap$(LIBCOAP_API_VERSION)/utlist.h \ tests/test_error_response.h \ tests/test_encode.h \ @@ -119,7 +120,6 @@ libcoap_include_HEADERS = \ $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_io.h \ $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_mutex.h \ $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_session.h \ - $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_tcp.h \ $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_time.h \ $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/encode.h \ $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/libcoap.h \ @@ -182,6 +182,7 @@ coap_socket_close \ coap_socket_connect_tcp1 \ coap_socket_connect_tcp2 \ coap_socket_connect_udp \ +coap_socket_format_errno \ coap_socket_read \ coap_socket_send \ coap_socket_send_pdu \ diff --git a/coap_config.h.windows b/coap_config.h.windows index dbbe5096..dc4fd209 100644 --- a/coap_config.h.windows +++ b/coap_config.h.windows @@ -69,6 +69,10 @@ #define HAVE_OPENSSL 1 +#ifndef COAP_DISABLE_TCP +#define COAP_DISABLE_TCP 0 +#endif + /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "libcoap-developers@lists.sourceforge.net" diff --git a/include/coap2/coap.h.in b/include/coap2/coap.h.in index 0aed74de..37c249f4 100644 --- a/include/coap2/coap.h.in +++ b/include/coap2/coap.h.in @@ -40,7 +40,6 @@ extern "C" { #include "coap_dtls.h" #include "coap_event.h" #include "coap_io.h" -#include "coap_tcp.h" #include "coap_time.h" #include "coap_debug.h" #include "encode.h" diff --git a/include/coap2/coap.h.windows b/include/coap2/coap.h.windows index 83a4f66b..1ecd6cf4 100644 --- a/include/coap2/coap.h.windows +++ b/include/coap2/coap.h.windows @@ -37,11 +37,11 @@ extern "C" { #include "async.h" #include "bits.h" #include "block.h" +#include "coap_debug.h" #include "coap_dtls.h" #include "coap_event.h" #include "coap_io.h" #include "coap_time.h" -#include "coap_debug.h" #include "encode.h" #include "mem.h" #include "net.h" diff --git a/include/coap2/coap_internal.h b/include/coap2/coap_internal.h index 57d3da39..727e5462 100644 --- a/include/coap2/coap_internal.h +++ b/include/coap2/coap_internal.h @@ -48,5 +48,6 @@ /* Specifically defined internal .h files */ #include "coap_session_internal.h" #include "coap_subscribe_internal.h" +#include "coap_tcp_internal.h" #endif /* COAP_INTERNAL_H_ */ diff --git a/include/coap2/coap_io.h b/include/coap2/coap_io.h index 234c74fb..1d60f952 100644 --- a/include/coap2/coap_io.h +++ b/include/coap2/coap_io.h @@ -128,6 +128,13 @@ const char *coap_socket_strerror( void ); const char *coap_socket_format_errno(int error); +/** + * Check whether TCP is available. + * + * @return @c 1 if support for TCP is enabled, or @c 0 otherwise. + */ +int coap_tcp_is_supported(void); + /** * Function interface for data transmission. This function returns the number of * bytes that have been transmitted, or a value less than zero on error. diff --git a/include/coap2/coap_tcp.h b/include/coap2/coap_tcp_internal.h similarity index 73% rename from include/coap2/coap_tcp.h rename to include/coap2/coap_tcp_internal.h index f8788e72..7339312e 100644 --- a/include/coap2/coap_tcp.h +++ b/include/coap2/coap_tcp_internal.h @@ -1,30 +1,28 @@ /* - * coap_tcp.h -- TCP functions for libcoap + * coap_tcp_internal.h -- TCP functions for libcoap * - * Copyright (C) 2019 Olaf Bergmann and others + * Copyright (C) 2019--2020 Olaf Bergmann and others * * This file is part of the CoAP library libcoap. Please see README for terms * of use. */ -#ifndef COAP_TCP_H_ -#define COAP_TCP_H_ +/** + * @file coap_tcp_internal.h + * @brief COAP tcp internal information + */ + +#ifndef COAP_TCP_INTERNAL_H_ +#define COAP_TCP_INTERNAL_H_ #include "coap_io.h" /** * @defgroup tcp TCP Support - * API functions for interfacing with the system TCP stack. + * Internal API functions for interfacing with the system TCP stack. * @{ */ -/** - * Check whether TCP is available. - * - * @return @c 1 if support for TCP is enabled, or @c 0 otherwise. - */ -int coap_tcp_is_supported(void); - int coap_socket_connect_tcp1(coap_socket_t *sock, const coap_address_t *local_if, @@ -51,4 +49,4 @@ coap_socket_accept_tcp(coap_socket_t *server, /** @} */ -#endif /* COAP_TCP_H_ */ +#endif /* COAP_TCP_INTERNAL_H_ */ diff --git a/libcoap-2.map b/libcoap-2.map index e0b1a595..7755d479 100644 --- a/libcoap-2.map +++ b/libcoap-2.map @@ -184,7 +184,6 @@ global: coap_set_show_pdu_output; coap_show_pdu; coap_show_tls_version; - coap_socket_format_errno; coap_socket_strerror; coap_split_path; coap_split_query; diff --git a/libcoap-2.sym b/libcoap-2.sym index 1990da5d..06d9e0b7 100644 --- a/libcoap-2.sym +++ b/libcoap-2.sym @@ -182,7 +182,6 @@ coap_set_log_level coap_set_show_pdu_output coap_show_pdu coap_show_tls_version -coap_socket_format_errno coap_socket_strerror coap_split_path coap_split_query diff --git a/src/coap_gnutls.c b/src/coap_gnutls.c index 7162e82f..1a318b7b 100644 --- a/src/coap_gnutls.c +++ b/src/coap_gnutls.c @@ -175,15 +175,15 @@ coap_dtls_is_supported(void) { */ int coap_tls_is_supported(void) { -#if ENABLE_TCP +#if !COAP_DISABLE_TCP if (gnutls_check_version(MIN_GNUTLS_VERSION) == NULL) { coap_log(LOG_ERR, "GnuTLS " MIN_GNUTLS_VERSION " or later is required\n"); return 0; } return 1; -#else /* !ENABLE_TCP */ +#else /* COAP_DISABLE_TCP */ return 0; -#endif /* !ENABLE_TCP */ +#endif /* COAP_DISABLE_TCP */ } coap_tls_version_t * @@ -1971,6 +1971,7 @@ unsigned int coap_dtls_get_overhead(coap_session_t *c_session UNUSED) { return 37; } +#if !COAP_DISABLE_TCP /* * return +ve data amount * 0 no more @@ -2242,6 +2243,7 @@ ssize_t coap_tls_read(coap_session_t *c_session, } return ret; } +#endif /* !COAP_DISABLE_TCP */ #else /* !HAVE_LIBGNUTLS */ diff --git a/src/coap_io.c b/src/coap_io.c index af2b5c43..a3f6cfd4 100644 --- a/src/coap_io.c +++ b/src/coap_io.c @@ -1251,7 +1251,7 @@ coap_io_process_with_fds(coap_context_t *ctx, unsigned int timeout_ms, FD_SET(sockets[i]->fd, &writefds); FD_SET(sockets[i]->fd, &exceptfds); } -#endif /* COAP_DISABLE_TCP */ +#endif /* !COAP_DISABLE_TCP */ } if ( timeout > 0 ) { diff --git a/src/coap_openssl.c b/src/coap_openssl.c index 7361c679..e01c53d5 100644 --- a/src/coap_openssl.c +++ b/src/coap_openssl.c @@ -120,7 +120,9 @@ typedef struct psk_sni_entry { typedef struct coap_openssl_context_t { coap_dtls_context_t dtls; +#if !COAP_DISABLE_TCP coap_tls_context_t tls; +#endif /* !COAP_DISABLE_TCP */ coap_dtls_pki_t setup_data; int psk_pki_enabled; size_t sni_count; @@ -157,7 +159,7 @@ int coap_dtls_is_supported(void) { } int coap_tls_is_supported(void) { -#if ENABLE_TCP +#if !COAP_DISABLE_TCP if (SSLeay() < 0x10100000L) { coap_log(LOG_WARNING, "OpenSSL version 1.1.0 or later is required\n"); return 0; @@ -169,9 +171,9 @@ int coap_tls_is_supported(void) { } #endif /* OPENSSL_VERSION_NUMBER >= 0x10101000L */ return 1; -#else /* !ENABLE_TCP */ +#else /* COAP_DISABLE_TCP */ return 0; -#endif /* !ENABLE_TCP */ +#endif /* COAP_DISABLE_TCP */ } coap_tls_version_t * @@ -565,6 +567,7 @@ static void coap_dtls_info_callback(const SSL *ssl, int where, int ret) { session->dtls_event = COAP_EVENT_DTLS_RENEGOTIATE; } +#if !COAP_DISABLE_TCP static int coap_sock_create(BIO *a) { BIO_set_init(a, 1); return 1; @@ -633,6 +636,7 @@ static long coap_sock_ctrl(BIO *a, int cmd, long num, void *ptr) { } return r; } +#endif /* !COAP_DISABLE_TCP */ void *coap_dtls_new_context(struct coap_context_t *coap_context) { coap_openssl_context_t *context; @@ -679,6 +683,7 @@ void *coap_dtls_new_context(struct coap_context_t *coap_context) { BIO_meth_set_create(context->dtls.meth, coap_dgram_create); BIO_meth_set_destroy(context->dtls.meth, coap_dgram_destroy); +#if !COAP_DISABLE_TCP /* Set up TLS context */ context->tls.ctx = SSL_CTX_new(TLS_method()); if (!context->tls.ctx) @@ -696,6 +701,7 @@ void *coap_dtls_new_context(struct coap_context_t *coap_context) { BIO_meth_set_ctrl(context->tls.meth, coap_sock_ctrl); BIO_meth_set_create(context->tls.meth, coap_sock_create); BIO_meth_set_destroy(context->tls.meth, coap_sock_destroy); +#endif /* !COAP_DISABLE_TCP */ } return context; @@ -718,14 +724,18 @@ coap_dtls_context_set_spsk(coap_context_t *c_context, SSL_CTX_set_psk_server_callback(o_context->dtls.ctx, coap_dtls_psk_server_callback); +#if !COAP_DISABLE_TCP SSL_CTX_set_psk_server_callback(o_context->tls.ctx, coap_dtls_psk_server_callback); +#endif /* !COAP_DISABLE_TCP */ if (setup_data->psk_info.hint.s) { char hint[COAP_DTLS_HINT_LENGTH]; snprintf(hint, sizeof(hint), "%.*s", (int)setup_data->psk_info.hint.length, setup_data->psk_info.hint.s); SSL_CTX_use_psk_identity_hint(o_context->dtls.ctx, hint); +#if !COAP_DISABLE_TCP SSL_CTX_use_psk_identity_hint(o_context->tls.ctx, hint); +#endif /* !COAP_DISABLE_TCP */ } if (setup_data->validate_sni_call_back) { #if OPENSSL_VERSION_NUMBER < 0x10101000L @@ -733,17 +743,21 @@ coap_dtls_context_set_spsk(coap_context_t *c_context, &c_context->spsk_setup_data); SSL_CTX_set_tlsext_servername_callback(o_context->dtls.ctx, psk_tls_server_name_call_back); +#if !COAP_DISABLE_TCP SSL_CTX_set_tlsext_servername_arg(o_context->tls.ctx, &c_context->spsk_setup_data); SSL_CTX_set_tlsext_servername_callback(o_context->tls.ctx, psk_tls_server_name_call_back); +#endif /* !COAP_DISABLE_TCP */ #else /* OPENSSL_VERSION_NUMBER >= 0x10101000L */ SSL_CTX_set_client_hello_cb(o_context->dtls.ctx, psk_tls_client_hello_call_back, NULL); +#if !COAP_DISABLE_TCP SSL_CTX_set_client_hello_cb(o_context->tls.ctx, psk_tls_client_hello_call_back, NULL); +#endif /* !COAP_DISABLE_TCP */ #endif /* OPENSSL_VERSION_NUMBER >= 0x10101000L */ } @@ -825,6 +839,7 @@ map_key_type(int asn1_private_key_type } return 0; } +#if !COAP_DISABLE_TCP static uint8_t coap_alpn[] = { 4, 'c', 'o', 'a', 'p' }; static int @@ -848,6 +863,7 @@ server_alpn_callback (SSL *ssl UNUSED, *out = tout; return (ret != OPENSSL_NPN_NEGOTIATED) ? SSL_TLSEXT_ERR_NOACK : SSL_TLSEXT_ERR_OK; } +#endif /* !COAP_DISABLE_TCP */ static void add_ca_to_cert_store(X509_STORE *st, X509 *x509) @@ -1623,6 +1639,7 @@ tls_server_name_call_back(SSL *ssl, SSL_CTX_set_info_callback(ctx, coap_dtls_info_callback); SSL_CTX_set_options(ctx, SSL_OP_NO_QUERY_MTU); } +#if !COAP_DISABLE_TCP else { /* Set up TLS context */ ctx = SSL_CTX_new(TLS_method()); @@ -1634,6 +1651,7 @@ tls_server_name_call_back(SSL *ssl, SSL_CTX_set_info_callback(ctx, coap_dtls_info_callback); SSL_CTX_set_alpn_select_cb(ctx, server_alpn_callback, NULL); } +#endif /* !COAP_DISABLE_TCP */ memset(&sni_setup_data, 0, sizeof(sni_setup_data)); sni_setup_data.pki_key.key_type = new_entry->key_type; sni_setup_data.pki_key.key.pem = new_entry->key.pem; @@ -2139,6 +2157,7 @@ coap_dtls_context_set_pki(coap_context_t *ctx, NULL); #endif /* OPENSSL_VERSION_NUMBER >= 0x10101000L */ } +#if !COAP_DISABLE_TCP if (context->tls.ctx) { /* SERVER TLS */ #if OPENSSL_VERSION_NUMBER < 0x10101000L @@ -2169,6 +2188,7 @@ coap_dtls_context_set_pki(coap_context_t *ctx, /* TLS Only */ SSL_CTX_set_alpn_select_cb(context->tls.ctx, server_alpn_callback, NULL); } +#endif /* !COAP_DISABLE_TCP */ } if (!context->dtls.ssl) { @@ -2205,6 +2225,7 @@ coap_dtls_context_set_pki_root_cas(struct coap_context_t *ctx, return 0; } } +#if !COAP_DISABLE_TCP if (context->tls.ctx) { if (!SSL_CTX_load_verify_locations(context->tls.ctx, ca_file, ca_dir)) { coap_log(LOG_WARNING, "Unable to install root CAs (%s/%s)\n", @@ -2212,6 +2233,7 @@ coap_dtls_context_set_pki_root_cas(struct coap_context_t *ctx, return 0; } } +#endif /* !COAP_DISABLE_TCP */ return 1; } @@ -2238,10 +2260,12 @@ void coap_dtls_free_context(void *handle) { BIO_meth_free(context->dtls.meth); if (context->dtls.bio_addr) BIO_ADDR_free(context->dtls.bio_addr); +#if !COAP_DISABLE_TCP if ( context->tls.ctx ) SSL_CTX_free( context->tls.ctx ); if ( context->tls.meth ) BIO_meth_free( context->tls.meth ); +#endif /* !COAP_DISABLE_TCP */ for (i = 0; i < context->sni_count; i++) { OPENSSL_free(context->sni_entry_list[i].sni); #if OPENSSL_VERSION_NUMBER < 0x10101000L @@ -2339,9 +2363,11 @@ setup_client_ssl_session(coap_session_t *session, SSL *ssl if (session->proto == COAP_PROTO_DTLS) { SSL_set_max_proto_version(ssl, DTLS1_2_VERSION); } +#if !COAP_DISABLE_TCP else { SSL_set_max_proto_version(ssl, TLS1_2_VERSION); } +#endif /* !COAP_DISABLE_TCP */ coap_log(LOG_DEBUG, "CoAP Client restricted to (D)TLS1.2 with Identity Hint callback\n"); } @@ -2351,8 +2377,10 @@ setup_client_ssl_session(coap_session_t *session, SSL *ssl if (!setup_pki_ssl(ssl, setup_data, 0)) return 0; /* libcoap is managing (D)TLS connection based on setup_data options */ +#if !COAP_DISABLE_TCP if (session->proto == COAP_PROTO_TLS) SSL_set_alpn_protos(ssl, coap_alpn, sizeof(coap_alpn)); +#endif /* !COAP_DISABLE_TCP */ /* Issue SNI if requested */ if (setup_data->client_sni && @@ -2648,6 +2676,7 @@ unsigned int coap_dtls_get_overhead(coap_session_t *session) { return overhead; } +#if !COAP_DISABLE_TCP void *coap_tls_new_client_session(coap_session_t *session, int *connected) { BIO *bio = NULL; SSL *ssl = NULL; @@ -2901,6 +2930,7 @@ ssize_t coap_tls_read(coap_session_t *session, return r; } +#endif /* !COAP_DISABLE_TCP */ #else /* !HAVE_OPENSSL */ diff --git a/src/coap_session.c b/src/coap_session.c index 991f4316..bd40979b 100644 --- a/src/coap_session.c +++ b/src/coap_session.c @@ -149,8 +149,10 @@ void coap_session_mfree(coap_session_t *session) { coap_delete_pdu(session->partial_pdu); if (session->proto == COAP_PROTO_DTLS) coap_dtls_free_session(session); +#if !COAP_DISABLE_TCP else if (session->proto == COAP_PROTO_TLS) coap_tls_free_session(session); +#endif /* !COAP_DISABLE_TCP */ if (session->sock.flags != COAP_SOCKET_EMPTY) coap_socket_close(&session->sock); if (session->psk_identity) @@ -287,6 +289,7 @@ coap_session_delay_pdu(coap_session_t *session, coap_pdu_t *pdu, return COAP_PDU_DELAYED; } +#if !COAP_DISABLE_TCP void coap_session_send_csm(coap_session_t *session) { coap_pdu_t *pdu; uint8_t buf[4]; @@ -312,18 +315,21 @@ void coap_session_send_csm(coap_session_t *session) { if (pdu) coap_delete_pdu(pdu); } +#endif /* !COAP_DISABLE_TCP */ coap_tid_t coap_session_send_ping(coap_session_t *session) { - coap_pdu_t *ping; + coap_pdu_t *ping = NULL; if (session->state != COAP_SESSION_STATE_ESTABLISHED) return COAP_INVALID_TID; if (COAP_PROTO_NOT_RELIABLE(session->proto)) { uint16_t tid = coap_new_message_id (session); ping = coap_pdu_init(COAP_MESSAGE_CON, 0, tid, 0); } +#if !COAP_DISABLE_TCP else { ping = coap_pdu_init(COAP_MESSAGE_CON, COAP_SIGNALING_PING, 0, 1); } +#endif /* !COAP_DISABLE_TCP */ if (!ping) return COAP_INVALID_TID; return coap_send(session, ping); @@ -399,8 +405,10 @@ void coap_session_disconnected(coap_session_t *session, coap_nack_reason_t reaso if ( session->tls) { if (session->proto == COAP_PROTO_DTLS) coap_dtls_free_session(session); +#if !COAP_DISABLE_TCP else if (session->proto == COAP_PROTO_TLS) coap_tls_free_session(session); +#endif /* !COAP_DISABLE_TCP */ session->tls = NULL; } diff --git a/src/coap_tcp.c b/src/coap_tcp.c index 12ac6c1c..739102ee 100644 --- a/src/coap_tcp.c +++ b/src/coap_tcp.c @@ -7,7 +7,7 @@ * of use. */ -#include "coap_config.h" +#include "coap_internal.h" #include #include @@ -27,10 +27,6 @@ # define CMSG_DATA WSA_CMSG_DATA #endif -#include "libcoap.h" -#include "coap_debug.h" -#include "coap_tcp.h" - int coap_tcp_is_supported(void) { return !COAP_DISABLE_TCP; @@ -96,7 +92,10 @@ coap_socket_connect_tcp1(coap_socket_t *sock, coap_log(LOG_WARNING, "coap_socket_connect_tcp1: setsockopt SO_REUSEADDR: %s\n", coap_socket_strerror()); - if (bind(sock->fd, &local_if->addr.sa, local_if->size) == COAP_SOCKET_ERROR) { + if (bind(sock->fd, &local_if->addr.sa, + local_if->addr.sa.sa_family == AF_INET ? + sizeof(struct sockaddr_in) : + local_if->size) == COAP_SOCKET_ERROR) { coap_log(LOG_WARNING, "coap_socket_connect_tcp1: bind: %s\n", coap_socket_strerror()); goto error; @@ -233,7 +232,10 @@ coap_socket_bind_tcp(coap_socket_t *sock, coap_log(LOG_ALERT, "coap_socket_bind_tcp: unsupported sa_family\n"); } - if (bind(sock->fd, &listen_addr->addr.sa, listen_addr->size) == COAP_SOCKET_ERROR) { + if (bind(sock->fd, &listen_addr->addr.sa, + listen_addr->addr.sa.sa_family == AF_INET ? + sizeof(struct sockaddr_in) : + listen_addr->size) == COAP_SOCKET_ERROR) { coap_log(LOG_ALERT, "coap_socket_bind_tcp: bind: %s\n", coap_socket_strerror()); goto error; diff --git a/src/coap_tinydtls.c b/src/coap_tinydtls.c index 1b53bd4f..c85b19c2 100644 --- a/src/coap_tinydtls.c +++ b/src/coap_tinydtls.c @@ -609,6 +609,7 @@ coap_dtls_context_check_keys_enabled(coap_context_t *ctx UNUSED) return 1; } +#if !COAP_DISABLE_TCP void *coap_tls_new_client_session(coap_session_t *session UNUSED, int *connected UNUSED) { return NULL; } @@ -633,6 +634,7 @@ ssize_t coap_tls_read(coap_session_t *session UNUSED, ) { return -1; } +#endif /* !COAP_DISABLE_TCP */ #undef UNUSED diff --git a/win32/libcoap.vcxproj b/win32/libcoap.vcxproj index 4ed30cf7..63c8300c 100644 --- a/win32/libcoap.vcxproj +++ b/win32/libcoap.vcxproj @@ -48,6 +48,7 @@ + @@ -77,6 +78,7 @@ + diff --git a/win32/libcoap.vcxproj.filters b/win32/libcoap.vcxproj.filters index 47905b83..1fdcd196 100644 --- a/win32/libcoap.vcxproj.filters +++ b/win32/libcoap.vcxproj.filters @@ -51,6 +51,9 @@ Source Files + + Source Files + Source Files @@ -137,6 +140,9 @@ Header Files + + Header Files + Header Files