diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-10-29 03:45:34 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-10-29 03:45:34 +0100 |
commit | bb324029ad442a1f6dd7049a6e6fc1cbe4a05799 (patch) | |
tree | e3f3e7c33a8077ba5bc721009dd71ea8644f1c1d /src | |
parent | fc8c8d82f05911836208cc9169e103d5578ffd70 (diff) | |
download | fastd-bb324029ad442a1f6dd7049a6e6fc1cbe4a05799.tar fastd-bb324029ad442a1f6dd7049a6e6fc1cbe4a05799.zip |
Allow using libsodium instead of NaCl
As libsodium has some strange include files (like a version.h), we try to use
absolute include paths whenever possible in fastd now and rename our generated
headers.
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 10 | ||||
-rw-r--r-- | src/compat.h | 2 | ||||
-rw-r--r-- | src/fastd.c | 10 | ||||
-rw-r--r-- | src/handshake.c | 2 | ||||
-rw-r--r-- | src/methods/aes128_gcm/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/methods/aes128_gcm/aes128_gcm.c | 4 | ||||
-rw-r--r-- | src/methods/common.h | 2 | ||||
-rw-r--r-- | src/methods/null/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/methods/null/null.c | 2 | ||||
-rw-r--r-- | src/methods/xsalsa20_poly1305/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c | 2 | ||||
-rw-r--r-- | src/options.c | 2 | ||||
-rw-r--r-- | src/protocols/ec25519_fhmqvc/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.c | 8 | ||||
-rw-r--r-- | src/types.h | 2 |
15 files changed, 31 insertions, 23 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d3fa991..4f8ab25 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,8 +1,8 @@ set_directory_properties(PROPERTIES COMPILE_DEFINITIONS _GNU_SOURCE) -set(FASTD_CFLAGS "-Wall -pthread ${UECC_CFLAGS_OTHER}") +set(FASTD_CFLAGS "-Wall -pthread ${UECC_CFLAGS_OTHER} ${NACL_CFLAGS_OTHER}") -include_directories(BEFORE ${FASTD_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CAP_INCLUDE_DIR} ${NACL_INCLUDE_DIR}) -link_directories(${UECC_LIBRARY_DIRS}) +include_directories(${FASTD_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CAP_INCLUDE_DIR} ${NACL_INCLUDE_DIRS}) +link_directories(${UECC_LIBRARY_DIRS} ${NACL_LIBRARY_DIRS}) add_subdirectory(protocols) @@ -35,8 +35,8 @@ add_executable(fastd ${METHOD_SOURCES} ) set_property(TARGET fastd PROPERTY COMPILE_FLAGS "${FASTD_CFLAGS}") -set_property(TARGET fastd PROPERTY LINK_FLAGS "-pthread ${UECC_LDFLAGS_OTHER}") -target_link_libraries(fastd ${RT_LIBRARY} ${CAP_LIBRARY} ${UECC_LIBRARIES} ${NACL_LIBRARY}) +set_property(TARGET fastd PROPERTY LINK_FLAGS "-pthread ${UECC_LDFLAGS_OTHER} ${NACL_LDFLAGS_OTHER}") +target_link_libraries(fastd ${RT_LIBRARY} ${CAP_LIBRARY} ${UECC_LIBRARIES} ${NACL_LIBRARIES}) add_dependencies(fastd version) diff --git a/src/compat.h b/src/compat.h index c127100..ba77f65 100644 --- a/src/compat.h +++ b/src/compat.h @@ -27,7 +27,7 @@ #ifndef _FASTD_COMPAT_H_ #define _FASTD_COMPAT_H_ -#include <config.h> +#include <fastd_config.h> #include <stdint.h> #include <unistd.h> diff --git a/src/fastd.c b/src/fastd.c index c434216..ea197d3 100644 --- a/src/fastd.c +++ b/src/fastd.c @@ -28,7 +28,7 @@ #include "crypto.h" #include "handshake.h" #include "peer.h" -#include <version.h> +#include <fastd_version.h> #include <fcntl.h> #include <grp.h> @@ -39,6 +39,10 @@ #include <syslog.h> #include <sys/resource.h> +#ifdef USE_LIBSODIUM +#include <sodium/core.h> +#endif + static volatile bool sighup = false; static volatile bool terminate = false; @@ -751,6 +755,10 @@ static void drop_caps(fastd_context_t *ctx) { } int main(int argc, char *argv[]) { +#ifdef USE_LIBSODIUM + sodium_init(); +#endif + fastd_context_t ctx = {}; close_fds(&ctx); diff --git a/src/handshake.c b/src/handshake.c index 2986b90..aecce23 100644 --- a/src/handshake.c +++ b/src/handshake.c @@ -26,7 +26,7 @@ #include "handshake.h" #include "peer.h" -#include <version.h> +#include <fastd_version.h> static const char *const RECORD_TYPES[RECORD_MAX] = { diff --git a/src/methods/aes128_gcm/CMakeLists.txt b/src/methods/aes128_gcm/CMakeLists.txt index 1c5aa3f..6d07318 100644 --- a/src/methods/aes128_gcm/CMakeLists.txt +++ b/src/methods/aes128_gcm/CMakeLists.txt @@ -1,4 +1,4 @@ -include_directories(BEFORE ${FASTD_SOURCE_DIR}/src ${FASTD_BINARY_DIR} ${NACL_INCLUDE_DIR}) +include_directories(${FASTD_SOURCE_DIR}/src ${FASTD_BINARY_DIR} ${NACL_INCLUDE_DIRS}) add_library(method_aes128_gcm OBJECT aes128_gcm.c diff --git a/src/methods/aes128_gcm/aes128_gcm.c b/src/methods/aes128_gcm/aes128_gcm.c index 610df7c..0b0ad56 100644 --- a/src/methods/aes128_gcm/aes128_gcm.c +++ b/src/methods/aes128_gcm/aes128_gcm.c @@ -24,8 +24,8 @@ */ -#include <fastd.h> -#include <crypto.h> +#include "../../fastd.h" +#include "../../crypto.h" #include "../common.h" diff --git a/src/methods/common.h b/src/methods/common.h index 0337265..0a26a32 100644 --- a/src/methods/common.h +++ b/src/methods/common.h @@ -27,7 +27,7 @@ #ifndef _FASTD_METHODS_COMMON_H_ #define _FASTD_METHODS_COMMON_H_ -#include <fastd.h> +#include "../fastd.h" #define COMMON_NONCEBYTES 7 diff --git a/src/methods/null/CMakeLists.txt b/src/methods/null/CMakeLists.txt index 91c1832..90ead47 100644 --- a/src/methods/null/CMakeLists.txt +++ b/src/methods/null/CMakeLists.txt @@ -1,4 +1,4 @@ -include_directories(BEFORE ${FASTD_SOURCE_DIR}/src ${FASTD_BINARY_DIR}) +include_directories(${FASTD_SOURCE_DIR}/src ${FASTD_BINARY_DIR}) add_library(method_null OBJECT null.c diff --git a/src/methods/null/null.c b/src/methods/null/null.c index 643e5e1..720cb79 100644 --- a/src/methods/null/null.c +++ b/src/methods/null/null.c @@ -24,7 +24,7 @@ */ -#include <fastd.h> +#include "../../fastd.h" struct fastd_method_session_state { diff --git a/src/methods/xsalsa20_poly1305/CMakeLists.txt b/src/methods/xsalsa20_poly1305/CMakeLists.txt index 09b029c..170a1ed 100644 --- a/src/methods/xsalsa20_poly1305/CMakeLists.txt +++ b/src/methods/xsalsa20_poly1305/CMakeLists.txt @@ -1,4 +1,4 @@ -include_directories(BEFORE ${FASTD_SOURCE_DIR}/src ${FASTD_BINARY_DIR} ${NACL_INCLUDE_DIR}) +include_directories(${FASTD_SOURCE_DIR}/src ${FASTD_BINARY_DIR} ${NACL_INCLUDE_DIRS}) add_library(method_xsalsa20_poly1305 OBJECT xsalsa20_poly1305.c diff --git a/src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c b/src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c index 0a9f2c8..825a4b8 100644 --- a/src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c +++ b/src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c @@ -24,7 +24,7 @@ */ -#include <fastd.h> +#include "../../fastd.h" #include "../common.h" #include <crypto_secretbox_xsalsa20poly1305.h> diff --git a/src/options.c b/src/options.c index 8d93bf9..333061a 100644 --- a/src/options.c +++ b/src/options.c @@ -26,7 +26,7 @@ #include "fastd.h" #include "peer.h" -#include <version.h> +#include <fastd_version.h> #include <arpa/inet.h> diff --git a/src/protocols/ec25519_fhmqvc/CMakeLists.txt b/src/protocols/ec25519_fhmqvc/CMakeLists.txt index ff1e246..91d6eaa 100644 --- a/src/protocols/ec25519_fhmqvc/CMakeLists.txt +++ b/src/protocols/ec25519_fhmqvc/CMakeLists.txt @@ -1,4 +1,4 @@ -include_directories(BEFORE ${FASTD_SOURCE_DIR}/src ${FASTD_BINARY_DIR} ${UECC_INCLUDE_DIRS}) +include_directories(${FASTD_SOURCE_DIR}/src ${FASTD_BINARY_DIR} ${UECC_INCLUDE_DIRS}) add_library(protocol_ec25519_fhmqvc OBJECT ec25519_fhmqvc.c diff --git a/src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.c b/src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.c index 9fe1414..d894512 100644 --- a/src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.c +++ b/src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.c @@ -24,10 +24,10 @@ */ -#include <fastd.h> -#include <handshake.h> -#include <peer.h> -#include <sha256.h> +#include "../../fastd.h" +#include "../../handshake.h" +#include "../../peer.h" +#include "../../sha256.h" #include <libuecc/ecc.h> diff --git a/src/types.h b/src/types.h index 8e70326..a2b7d38 100644 --- a/src/types.h +++ b/src/types.h @@ -33,7 +33,7 @@ #ifndef _FASTD_TYPES_H_ #define _FASTD_TYPES_H_ -#include <config.h> +#include <fastd_config.h> #include <stdbool.h> |