From c62a0f592c49b41d393fae580ce9f1293ee7a16d Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 25 Nov 2013 23:18:11 +0100 Subject: Move crypto algorithm information out of implementation --- src/crypto/mac/CMakeLists.txt | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'src/crypto/mac/CMakeLists.txt') diff --git a/src/crypto/mac/CMakeLists.txt b/src/crypto/mac/CMakeLists.txt index ca3b71d..22bc95e 100644 --- a/src/crypto/mac/CMakeLists.txt +++ b/src/crypto/mac/CMakeLists.txt @@ -1,26 +1,25 @@ add_library(macs STATIC "${CMAKE_CURRENT_BINARY_DIR}/macs.c") -function(fastd_mac name) - string(REPLACE - _ name_ "${name}") - string(TOUPPER "${name_}" NAME) +macro(fastd_mac name) + fastd_module(mac enabled "MAC" ${name} ${ARGN}) - set(WITH_MAC_${NAME} TRUE CACHE BOOL "Include the ${name} MAC") - - if(WITH_MAC_${NAME}) + if(${enabled}) set_property(GLOBAL APPEND PROPERTY FASTD_MACS ${name}) - endif(WITH_MAC_${NAME}) -endfunction(fastd_mac) + endif(${enabled}) +endmacro(fastd_mac) macro(fastd_mac_impl mac name) string(REPLACE - _ mac_ "${mac}") string(TOUPPER "${mac_}" MAC) - fastd_module(mac enabled "MAC implementation" "${mac} ${name}" ${ARGN}) + if(WITH_MAC_${MAC}) + fastd_module(mac enabled "MAC implementation" "${mac} ${name}" ${ARGN}) - if(${enabled}) - set_property(GLOBAL APPEND PROPERTY FASTD_MAC_${MAC}_IMPLS ${name}) - endif(${enabled}) + if(${enabled}) + set_property(TARGET "mac_${mac_}" APPEND PROPERTY FASTD_MAC_IMPLS ${name}) + endif(${enabled}) + endif(WITH_MAC_${MAC}) endmacro(fastd_mac_impl) macro(fastd_mac_impl_include_directories mac name) @@ -48,16 +47,18 @@ foreach(mac ${MACS}) string(REPLACE - _ mac_ "${mac}") string(TOUPPER "${mac_}" MAC) - set(MAC_LIST "${MAC_LIST}\n{\"${mac}\", mac_${mac_}_impls},") - set(MAC_IMPLS "${MAC_IMPLS}\nstatic const fastd_mac_t *const mac_${mac_}_impls[] = {") + set(MAC_DEFINITIONS "${MAC_DEFINITIONS}\nextern const fastd_mac_info_t fastd_mac_info_${mac_};") + set(MAC_LIST "${MAC_LIST}\n{\"${mac}\", &fastd_mac_info_${mac_}, mac_${mac_}_impls},") + set(MAC_IMPLS "${MAC_IMPLS}\nstatic const fastd_mac_impl_t mac_${mac_}_impls[] = {") + - get_property(IMPLS GLOBAL PROPERTY FASTD_MAC_${MAC}_IMPLS) + get_property(IMPLS TARGET "mac_${mac_}" PROPERTY FASTD_MAC_IMPLS) foreach(impl ${IMPLS}) set(MAC_DEFINITIONS "${MAC_DEFINITIONS}\nextern const fastd_mac_t fastd_mac_${mac_}_${impl};") - set(MAC_IMPLS "${MAC_IMPLS}&fastd_mac_${mac_}_${impl}, ") + set(MAC_IMPLS "${MAC_IMPLS}{\"${impl}\", &fastd_mac_${mac_}_${impl}}, ") endforeach(impl) - set(MAC_IMPLS "${MAC_IMPLS}NULL};") + set(MAC_IMPLS "${MAC_IMPLS}{NULL, NULL}};") endforeach(mac) get_property(LIBS TARGET macs PROPERTY FASTD_LINK_LIBRARIES) -- cgit v1.2.3