]> The Tcpdump Group git mirrors - libpcap/commitdiff
Have and use a _U_NOSSL_ that is _U_ if we don't have OpenSSL.
authorGuy Harris <[email protected]>
Mon, 7 Jan 2019 05:53:27 +0000 (21:53 -0800)
committerGuy Harris <[email protected]>
Mon, 7 Jan 2019 05:53:27 +0000 (21:53 -0800)
That squelches some unused parameter warnings.

sockutils.c
sslutils.h

index ed3acfc9d6e12195ba8a990a2596a98ee69b0dc8..09d1a9616f23aae4af4b6b2b81558995df6b44cf 100644 (file)
@@ -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
index 185b5723dda7bd6c9ae79a5ac97e2191e441e705..6c9504092b5af0cfe901b72dc8994cafa234313f 100644 (file)
@@ -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__