From: Guy Harris Date: Mon, 7 Jan 2019 05:53:27 +0000 (-0800) Subject: Have and use a _U_NOSSL_ that is _U_ if we don't have OpenSSL. X-Git-Tag: libpcap-1.10-bp~669 X-Git-Url: https://git.tcpdump.org/libpcap/commitdiff_plain/a29755c32092b830abc73a97682cfa19363b7964?ds=sidebyside Have and use a _U_NOSSL_ that is _U_ if we don't have OpenSSL. That squelches some unused parameter warnings. --- diff --git a/sockutils.c b/sockutils.c index ed3acfc9..09d1a961 100644 --- a/sockutils.c +++ b/sockutils.c @@ -640,7 +640,7 @@ int sock_initaddress(const char *host, const char *port, * '-2' if we got one of those errors. * For errors, an error message is returned in the 'errbuf' variable. */ -int sock_send(SOCKET sock, SSL *ssl, const char *buffer, size_t size, +int sock_send(SOCKET sock, SSL *ssl _U_NOSSL_, const char *buffer, size_t size, char *errbuf, int errbuflen) { int remaining; @@ -661,8 +661,6 @@ int sock_send(SOCKET sock, SSL *ssl, const char *buffer, size_t size, do { #ifdef HAVE_OPENSSL if (ssl) return ssl_send(ssl, buffer, remaining, errbuf, errbuflen); -#else - (void)ssl; #endif #ifdef MSG_NOSIGNAL @@ -841,8 +839,8 @@ int sock_bufferize(const char *buffer, int size, char *tempbuf, int *offset, int * The error message is returned in the 'errbuf' variable. */ -int sock_recv(SOCKET sock, SSL *ssl, void *buffer, size_t size, int flags, - char *errbuf, int errbuflen) +int sock_recv(SOCKET sock, SSL *ssl _U_NOSSL_, void *buffer, size_t size, + int flags, char *errbuf, int errbuflen) { int recv_flags = 0; char *bufp = buffer; @@ -947,7 +945,7 @@ int sock_recv(SOCKET sock, SSL *ssl, void *buffer, size_t size, int flags, * * Returns the size of the datagram on success or -1 on error. */ -int sock_recv_dgram(SOCKET sock, SSL *ssl, void *buffer, size_t size, +int sock_recv_dgram(SOCKET sock, SSL *ssl _U_NOSSL_, void *buffer, size_t size, char *errbuf, int errbuflen) { ssize_t nread; @@ -972,12 +970,14 @@ int sock_recv_dgram(SOCKET sock, SSL *ssl, void *buffer, size_t size, return -1; } +#ifdef HAVE_OPENSSL // TODO: DTLS if (ssl) { pcap_snprintf(errbuf, errbuflen, "DTLS not implemented yet"); return -1; } +#endif /* * This should be a datagram socket, so we should get the diff --git a/sslutils.h b/sslutils.h index 185b5723..6c950409 100644 --- a/sslutils.h +++ b/sslutils.h @@ -56,11 +56,17 @@ SSL *ssl_promotion_rw(int is_server, SOCKET in, SOCKET out, char *errbuf, size_t int ssl_send(SSL *, char const *buffer, int size, char *errbuf, size_t errbuflen); int ssl_recv(SSL *, char *buffer, int size, char *errbuf, size_t errbuflen); +// The SSL parameters are used +#define _U_NOSSL_ + #else // HAVE_OPENSSL // This saves us from a lot of ifdefs: #define SSL void const +// The SSL parameters are unused +#define _U_NOSSL_ _U_ + #endif // HAVE_OPENSSL #endif // __SSLUTILS_H__