diff --git a/CMakeLists.txt b/CMakeLists.txt index 9df06ed..fc78d68 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,16 +11,29 @@ option (WITH_OPENSSL "WithOpenSSL" OFF) option (WITH_COMMON_CRYPTO "WithCommonCrypto" OFF) option (WITH_BOTAN "WithBotan" ON) -if (WITH_BOTAN) - set (WITH_COMMON_CRYPTO OFF) - set (WITH_OPENSSL OFF) -elseif (WITH_COMMON_CRYPTO) - set (WITH_OPENSSL OFF) -endif (WITH_BOTAN) - set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeModules/") +# Include Crypto checks here so that they can set values in config.h +if (WITH_COMMON_CRYPTO) + set (WITH_BOTAN OFF) + set (WITH_OPENSSL OFF) + + find_library (SECURITY_FRAMEWORK Security) + mark_as_advanced (SECURITY_FRAMEWORK) +elseif (WITH_BOTAN) + set (WITH_COMMON_CRYPTO OFF) + set (WITH_OPENSSL OFF) + + find_package (Botan REQUIRED) +elseif (WITH_OPENSSL) + set (WITH_BOTAN OFF) + set (WITH_COMMON_CRYPTO OFF) + + find_package (OpenSSL REQUIRED) + include (OpenSSLTests) +endif (WITH_COMMON_CRYPTO) + # Tweak compiler flags. set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall") diff --git a/cipher/CMakeLists.txt b/cipher/CMakeLists.txt index 4d59d64..0805bb1 100644 --- a/cipher/CMakeLists.txt +++ b/cipher/CMakeLists.txt @@ -1,18 +1,13 @@ link_directories (${Encfs_BINARY_DIR}/base) if (WITH_COMMON_CRYPTO) - find_library (SECURITY_FRAMEWORK Security) - mark_as_advanced (SECURITY_FRAMEWORK) set (EXTRA_LIBS ${SECURITY_FRAMEWORK}) set (EXTRA_SOURCE CommonCrypto.cpp) elseif (WITH_OPENSSL) - find_package (OpenSSL REQUIRED) - include (OpenSSLTests) include_directories (${OPENSSL_INCLUDE_DIR}) set (EXTRA_LIBS ${OPENSSL_LIBRARIES}) set (EXTRA_SOURCE openssl.cpp) elseif (WITH_BOTAN) - find_package (Botan REQUIRED) set (EXTRA_LIBS ${BOTAN_LIBRARIES}) set (EXTRA_SOURCE botan.cpp) include_directories (${BOTAN_INCLUDE_DIR}) diff --git a/cipher/openssl.cpp b/cipher/openssl.cpp index ba9c6e6..c70c76a 100644 --- a/cipher/openssl.cpp +++ b/cipher/openssl.cpp @@ -131,6 +131,9 @@ class OpenSSLCipher : public BlockCipher { return false; } +#ifdef HAVE_VALGRIND_MEMCHECK_H + VALGRIND_MAKE_MEM_DEFINED(out, length); +#endif return true; }