2018-01-14 17:17:34 +11:00
|
|
|
###############################################################################
|
|
|
|
cmake_minimum_required(VERSION 3.7.0)
|
|
|
|
project(cruft-crypto CXX)
|
|
|
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
list (APPEND sources
|
|
|
|
fwd.hpp
|
|
|
|
|
2018-01-22 19:51:16 +11:00
|
|
|
hash/blake.cpp
|
|
|
|
hash/blake.hpp
|
|
|
|
hash/blake2.cpp
|
|
|
|
hash/blake2.hpp
|
2018-01-14 17:17:34 +11:00
|
|
|
hash/md2.cpp
|
|
|
|
hash/md2.hpp
|
|
|
|
hash/md4.cpp
|
|
|
|
hash/md4.hpp
|
|
|
|
hash/md5.cpp
|
|
|
|
hash/md5.hpp
|
2018-01-22 19:51:16 +11:00
|
|
|
hash/md6.cpp
|
|
|
|
hash/md6.hpp
|
2018-01-14 17:17:34 +11:00
|
|
|
hash/ripemd.cpp
|
|
|
|
hash/ripemd.hpp
|
|
|
|
hash/sha1.cpp
|
|
|
|
hash/sha1.hpp
|
|
|
|
hash/sha2.cpp
|
|
|
|
hash/sha2.hpp
|
|
|
|
|
2018-01-22 19:51:16 +11:00
|
|
|
hash/pbkdf2.cpp
|
|
|
|
hash/pbkdf2.hpp
|
2018-01-14 17:17:34 +11:00
|
|
|
hash/hmac.cpp
|
|
|
|
hash/hmac.hpp
|
|
|
|
|
|
|
|
hash/hotp.cpp
|
|
|
|
hash/hotp.hpp
|
|
|
|
|
2018-01-22 19:51:16 +11:00
|
|
|
stream/chacha.cpp
|
|
|
|
stream/chacha.hpp
|
|
|
|
stream/rabbit.cpp
|
|
|
|
stream/rabbit.hpp
|
2018-01-14 17:17:34 +11:00
|
|
|
stream/rc4.cpp
|
|
|
|
stream/rc4.hpp
|
2018-01-22 19:51:16 +11:00
|
|
|
stream/rc5.cpp
|
|
|
|
stream/rc5.hpp
|
|
|
|
stream/rc6.cpp
|
|
|
|
stream/rc6.hpp
|
2018-01-14 17:17:34 +11:00
|
|
|
stream/salsa.cpp
|
|
|
|
stream/salsa.hpp
|
|
|
|
|
|
|
|
block/tea.cpp
|
|
|
|
block/tea.hpp
|
|
|
|
block/xtea.cpp
|
|
|
|
block/xtea.hpp
|
|
|
|
block/xxtea.cpp
|
|
|
|
block/xxtea.hpp
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
option (TESTS "enable unit testing" ON)
|
|
|
|
|
|
|
|
if (TESTS)
|
|
|
|
include (CTest)
|
|
|
|
enable_testing ()
|
|
|
|
|
|
|
|
list (APPEND tests
|
2018-01-22 19:51:16 +11:00
|
|
|
hash/blake
|
|
|
|
hash/blake2
|
2018-01-14 17:17:34 +11:00
|
|
|
hash/md2
|
|
|
|
hash/md4
|
|
|
|
hash/md5
|
2018-01-22 19:51:16 +11:00
|
|
|
hash/md6
|
2018-01-14 17:17:34 +11:00
|
|
|
hash/ripemd
|
|
|
|
hash/sha1
|
|
|
|
hash/sha2
|
|
|
|
|
|
|
|
hash/hmac
|
|
|
|
hash/hotp
|
|
|
|
|
|
|
|
stream/rc4
|
|
|
|
stream/salsa
|
|
|
|
|
|
|
|
block/tea
|
|
|
|
block/xtea
|
|
|
|
block/xxtea
|
|
|
|
)
|
|
|
|
|
|
|
|
foreach (t ${tests})
|
|
|
|
string(REPLACE "/" "_" name "test/${t}")
|
2018-01-22 19:51:16 +11:00
|
|
|
add_executable(crypto_${name} test/${t}.cpp)
|
|
|
|
target_link_libraries(crypto_${name} PRIVATE cruft-crypto)
|
|
|
|
target_include_directories(crypto_${name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
add_test(NAME crypto_${name} COMMAND crypto_${name})
|
2018-01-14 17:17:34 +11:00
|
|
|
endforeach()
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
add_library (cruft-crypto STATIC ${sources})
|
2018-08-05 14:51:17 +10:00
|
|
|
target_link_libraries (cruft-crypto INTERFACE cruft)
|
2018-01-14 17:17:34 +11:00
|
|
|
|
|
|
|
|
|
|
|
##-----------------------------------------------------------------------------
|
|
|
|
add_executable (crypto_hash tools/hash.cpp)
|
|
|
|
target_link_libraries (crypto_hash cruft-crypto)
|
|
|
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
configure_file(libcruft-crypto.pc.in libcruft-crypto.pc)
|
|
|
|
configure_file(Doxyfile.in Doxyfile)
|