summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2012-09-21 15:07:11 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2012-09-21 15:10:28 +0200
commit2acd81bd7a1b364b02831ae5f8e46457d9d07865 (patch)
tree969429177db12b56e402ad767531189b7a41834c /CMakeLists.txt
parent65912e3e6fce703b03eafc2b4bf11a17a02bd39e (diff)
downloadfastd-2acd81bd7a1b364b02831ae5f8e46457d9d07865.tar
fastd-2acd81bd7a1b364b02831ae5f8e46457d9d07865.zip
Nicely encapsulate different crypto algorithm implementations
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt33
1 files changed, 33 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5c1c41e..4cdff4a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,14 +16,47 @@ find_package(UECC REQUIRED)
find_package(NaCl REQUIRED)
+set(WITH_CRYPTO_AES128CTR_NACL TRUE CACHE BOOL "Include the AES128-CTR implementation from the NaCl library")
+set(WITH_CRYPTO_AES128CTR_LINUX TRUE CACHE BOOL "Support using the AES128-CTR implementation in the Linux kernel")
+
+set(WITH_CRYPTO_GHASH_BUILTIN TRUE CACHE BOOL "Include the built-in GHASH implementation")
+set(WITH_CRYPTO_GHASH_LINUX TRUE CACHE BOOL "Support using the GHASH implementation in the Linux kernel")
+
set(WITH_METHOD_XSALSA20_POLY1305 TRUE CACHE BOOL "Include xsalsa20-poly1305 method")
set(WITH_METHOD_AES128_GCM TRUE CACHE BOOL "Include aes128-gcm method")
set(MAX_CONFIG_DEPTH 10 CACHE STRING "Maximum config include depth")
+if(WITH_CRYPTO_AES128CTR_NACL OR WITH_CRYPTO_AES128CTR_LINUX)
+ set(WITH_CRYPTO_AES128CTR TRUE)
+endif(WITH_CRYPTO_AES128CTR_NACL OR WITH_CRYPTO_AES128CTR_LINUX)
+
+if(WITH_CRYPTO_GHASH_BUILTIN OR WITH_CRYPTO_GHASH_LINUX)
+ set(WITH_CRYPTO_GHASH TRUE)
+endif(WITH_CRYPTO_GHASH_BUILTIN OR WITH_CRYPTO_GHASH_LINUX)
+
+
# Ensure the value is numeric
math(EXPR MAX_CONFIG_DEPTH_NUM ${MAX_CONFIG_DEPTH})
+set(USE_CRYPTO_AES128CTR FALSE)
+set(USE_CRYPTO_GHASH FALSE)
+
+if(WITH_METHOD_AES128_GCM)
+ set(USE_CRYPTO_AES128CTR TRUE)
+ set(USE_CRYPTO_GHASH TRUE)
+endif(WITH_METHOD_AES128_GCM)
+
+
+if(USE_CRYPTO_AES128CTR AND NOT WITH_CRYPTO_AES128CTR)
+ MESSAGE(FATAL_ERROR "No AES128-CTR implementation was selected, but a selected method needs it.")
+endif(USE_CRYPTO_AES128CTR AND NOT WITH_CRYPTO_AES128CTR)
+
+if(USE_CRYPTO_GHASH AND NOT WITH_CRYPTO_GHASH)
+ MESSAGE(FATAL_ERROR "No GHASH implementation was selected, but a selected method needs it.")
+endif(USE_CRYPTO_GHASH AND NOT WITH_CRYPTO_GHASH)
+
+
configure_file(${FASTD_SOURCE_DIR}/config.h.in ${FASTD_BINARY_DIR}/config.h)
add_subdirectory(src)