From 0d8b61ea93fb1cd54d30d21823b0bc4d15347f2a Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Thu, 17 Sep 2020 18:14:58 +0100 Subject: Avoid mismatch between library and test crypto configuration I was investigating libarchive test failures on FreeBSD and it turns out we get a reproducible SIGBUS for test_archive_m5, etc. Debugging this shows that libarchive and the tests disagree when it comes to the definition of archive_md5_ctx: libarchive assumes it's the OpenSSL type whereas the test use the libmd type. The latter is not necessarily aligned enough to store a pointer (16 bytes for CHERI RISC-V), so we were crashing when storing EVP_MD_CTX* to an 8-byte-aligned archive_md5_ctx. To avoid problems like this in the future, add a new macro to the config header and use that to ensure that all configuration check macros have been defined in archive_digest_private.h. --- configure.ac | 2 ++ 1 file changed, 2 insertions(+) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index fbb7b3c2..65c889a2 100644 --- a/configure.ac +++ b/configure.ac @@ -47,6 +47,8 @@ ARCHIVE_REVISION=$(( LIBARCHIVE_VERSION_N() % 1000 )) ARCHIVE_LIBTOOL_VERSION=$ARCHIVE_INTERFACE:$ARCHIVE_REVISION:$ARCHIVE_MINOR # Stick the version numbers into config.h +AC_DEFINE([__LIBARCHIVE_CONFIG_H_INCLUDED], [1], + [Internal macro for sanity checks]) AC_DEFINE([LIBARCHIVE_VERSION_STRING],"LIBARCHIVE_VERSION_S()", [Version number of libarchive]) AC_DEFINE_UNQUOTED([LIBARCHIVE_VERSION_NUMBER],"LIBARCHIVE_VERSION_N()", -- cgit v1.2.1