summaryrefslogtreecommitdiffstats
path: root/src/crypto/cipher/CMakeLists.txt
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-11-02 04:32:18 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-11-02 04:32:18 +0100
commit20ee3b5a4f110f53a73746e18fc0eb0cbbb7845c (patch)
treebbf62cb65ba716e7cefcfc41904bb3460c3ddb58 /src/crypto/cipher/CMakeLists.txt
parentde66ca829d22f939900635968d1b3fd7a7d598da (diff)
downloadfastd-20ee3b5a4f110f53a73746e18fc0eb0cbbb7845c.tar
fastd-20ee3b5a4f110f53a73746e18fc0eb0cbbb7845c.zip
Implement the first step towards a more flexible way to support crypto methods
Diffstat (limited to 'src/crypto/cipher/CMakeLists.txt')
-rw-r--r--src/crypto/cipher/CMakeLists.txt34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/crypto/cipher/CMakeLists.txt b/src/crypto/cipher/CMakeLists.txt
new file mode 100644
index 0000000..00b8560
--- /dev/null
+++ b/src/crypto/cipher/CMakeLists.txt
@@ -0,0 +1,34 @@
+set(CIPHERS "")
+
+if(WITH_CIPHER_AES128_CTR)
+ list(APPEND CIPHERS aes128_ctr)
+endif(WITH_CIPHER_AES128_CTR)
+
+set(CIPHER_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/ciphers.c")
+
+set(CIPHER_DEFINITIONS "")
+set(CIPHER_IMPLS "")
+set(CIPHER_LIST "")
+
+foreach(cipher ${CIPHERS})
+ add_subdirectory(${cipher})
+
+ list(APPEND CIPHER_SOURCES ${IMPL_SOURCES})
+
+ set(CIPHER_LIST "${CIPHER_LIST}\n{\"${CIPHER_NAME}\", cipher_${cipher}_impls},")
+ set(CIPHER_IMPLS "${CIPHER_IMPLS}\nstatic const fastd_cipher_t *const cipher_${cipher}_impls[] = {")
+
+ foreach(impl ${IMPLS})
+ set(CIPHER_DEFINITIONS "${CIPHER_DEFINITIONS}\nextern const fastd_cipher_t fastd_cipher_${cipher}_${impl};")
+ set(CIPHER_IMPLS "${CIPHER_IMPLS}&fastd_cipher_${cipher}_${impl}, ")
+ endforeach(impl)
+
+ set(CIPHER_IMPLS "${CIPHER_IMPLS}NULL};")
+
+endforeach(cipher)
+
+
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ciphers.c.in ${CMAKE_CURRENT_BINARY_DIR}/ciphers.c)
+
+
+set(CIPHER_SOURCES "${CIPHER_SOURCES}" PARENT_SCOPE)