Repository: the-tcpdump-group/tcpdump

Issue #45: 3.8.1: configure fails to detect openssl/evp.h
Created: 2013-04-16T00:35:44Z
Converted from SourceForge issue 892961, submitted by vda
On my system configure says
checking for openssl/evp.h... no
but
ls -l /usr/include/openssl/evp.h
-rw-r--r--   1 root     root        27263 Dec 25  2002
/usr/include/openssl/evp.h
Details from config.log:
configure:4937: checking for openssl/evp.h
configure:4947: gcc -E  -I$(srcdir)/missing -I$(srcdir)
-I$(srcdir)/missing -I/usr/include conftest.c

/dev/null 2>conftest.out
cpp0: warning: changing search order for system
directory "/usr/include"
cpp0: warning:   as it has already been specified as a
non-system directory
configure: failed program was:
line 4942 "configure"
include "confdefs.h"
include <openssl/evp.h>

Duplicate issue #46: 3.8.1 won't build if HAVE_LIBCRYPTO && !HAVE_OPENSSL_EVP_H
Created: 2013-04-16T00:35:48Z
Converted from SourceForge issue 892966, submitted by vda
print-esp.c:
ifdef HAVE_LIBCRYPTO
ifdef HAVE_OPENSSL_EVP_H
include <openssl/evp.h>
endif
endif

# ifdef HAVE_LIBCRYPTO
struct sa_list {
struct sa_list  *next;
struct sockaddr_storage daddr;
u_int32_t       spi;
const EVP_CIPHER *evp;
^^^^^^^^^^^^^^^^^^^^^
This blews up if I HAVE_LIBCRYPTO
but !HAVE_OPENSSL_EVP_H

Closing comment (2013-06-05T14:59:13Z): This problem reproduces on the current revision of the source code, that is, the configure script detects whether openssl/evp.h is present, but never raises a fatal error and the build eventially breaks trying to compile print-esp.c. This issue isn't a duplicate of #45, although it could be triggered by it, as well as by the header that is actually missing.
Contents of the original patch is below:
--- print-esp.c 19 Nov 2003 05:37:18 -0000  1.48
+++ print-esp.c 23 Mar 2004 16:45:13 -0000
@@ -39,6 +39,8 @@
 #ifdef HAVE_LIBCRYPTO
 #ifdef HAVE_OPENSSL_EVP_H
 #include <openssl/evp.h>
+#else
+#undef HAVE_LIBCRYPTO
 #endif
 #endif

After commits 5fa8fc6 and edea963 it would need to be:
--- a/print-esp.c
+++ b/print-esp.c
@@ -39,6 +39,8 @@ static const char rcsid[] _U_ =
 #ifdef HAVE_LIBCRYPTO
 #ifdef HAVE_OPENSSL_EVP_H
 #include <openssl/evp.h>
+#else
+#undef HAVE_LIBCRYPTO
 #endif
 #endif

--- a/print-isakmp.c
+++ b/print-isakmp.c
@@ -60,6 +60,10 @@ static const char rcsid[] _U_ =
 #define sockaddr_storage sockaddr
 #endif

+#ifndef HAVE_OPENSSL_EVP_H
+#undef HAVE_LIBCRYPTO
+#endif
+
 #define DECLARE_PRINTER(func) static const u_char *ike##func##_print( \
                netdissect_options *ndo, u_char tpay,                 \
                const struct isakmp_gen *ext,                         \
Another approach to this issue would be treating evp.h as a mandatory pre-requisite of OpenSSL:
--- a/configure.in
+++ b/configure.in
@@ -1032,8 +1032,7 @@ AC_ARG_WITH(crypto,
        AC_MSG_RESULT([yes, if available])
 ])
 if test "$want_libcrypto" != "no"; then
-       AC_CHECK_LIB(crypto, DES_cbc_encrypt)
-       AC_CHECK_HEADERS(openssl/evp.h)
+       AC_CHECK_HEADER(openssl/evp.h, [AC_CHECK_LIB(crypto, DES_cbc_encrypt)])
 fi

 dnl
--- a/print-esp.c
+++ b/print-esp.c
@@ -37,10 +37,8 @@ static const char rcsid[] _U_ =
 #include <stdlib.h>

 #ifdef HAVE_LIBCRYPTO
-#ifdef HAVE_OPENSSL_EVP_H
 #include <openssl/evp.h>
 #endif
-#endif

 #include <stdio.h>

@fenner and @mcr, could you share your vision if OpenSSL without EVP makes enough sense to justify multiple HAVE_OPENSSL_EVP_H checks, as opposed to a single check in the configure script? Thank you.