diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-11-27 19:19:38 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-11-27 19:55:54 +0100 |
commit | 2f516f9ceaaf5b964de953aae82498818db9091b (patch) | |
tree | 90a4b7b26347429dd76ca8d6053c444156dbcf59 /src | |
parent | c62a0f592c49b41d393fae580ce9f1293ee7a16d (diff) | |
download | fastd-2f516f9ceaaf5b964de953aae82498818db9091b.tar fastd-2f516f9ceaaf5b964de953aae82498818db9091b.zip |
Correctly initialize OpenSSL
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/fastd.c | 18 | ||||
-rw-r--r-- | src/fastd_config.h.in | 1 |
3 files changed, 20 insertions, 1 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index da20721..4bcbb65 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -40,7 +40,7 @@ add_executable(fastd set_property(TARGET fastd PROPERTY COMPILE_FLAGS "${FASTD_CFLAGS}") set_property(TARGET fastd PROPERTY LINK_FLAGS "-pthread ${UECC_LDFLAGS_OTHER} ${NACL_LDFLAGS_OTHER} ${OPENSSL_CRYPTO_LDFLAGS_OTHER}") set_property(TARGET fastd APPEND PROPERTY INCLUDE_DIRECTORIES ${CAP_INCLUDE_DIR} ${NACL_INCLUDE_DIRS}) -target_link_libraries(fastd protocols methods ciphers macs ${RT_LIBRARY} ${CAP_LIBRARY} ${UECC_LIBRARIES} ${NACL_LIBRARIES}) +target_link_libraries(fastd protocols methods ciphers macs ${RT_LIBRARY} ${CAP_LIBRARY} ${UECC_LIBRARIES} ${NACL_LIBRARIES} ${OPENSSL_CRYPTO_LIBRARIES}) add_dependencies(fastd version) diff --git a/src/fastd.c b/src/fastd.c index 469fc6f..28ff207 100644 --- a/src/fastd.c +++ b/src/fastd.c @@ -44,6 +44,12 @@ #include <sodium/core.h> #endif +#ifdef USE_OPENSSL +#include <openssl/conf.h> +#include <openssl/evp.h> +#include <openssl/err.h> +#endif + static volatile bool sighup = false; static volatile bool terminate = false; @@ -744,6 +750,12 @@ int main(int argc, char *argv[]) { sodium_init(); #endif +#ifdef USE_OPENSSL + ERR_load_crypto_strings(); + OpenSSL_add_all_algorithms(); + OPENSSL_config(NULL); +#endif + fastd_context_t ctx = {}; close_fds(&ctx); @@ -878,5 +890,11 @@ int main(int argc, char *argv[]) { close_log(&ctx); fastd_config_release(&ctx, &conf); +#ifdef USE_OPENSSL + CONF_modules_free(); + EVP_cleanup(); + ERR_free_strings(); +#endif + return 0; } diff --git a/src/fastd_config.h.in b/src/fastd_config.h.in index 8ef3aa0..8a6ae22 100644 --- a/src/fastd_config.h.in +++ b/src/fastd_config.h.in @@ -46,6 +46,7 @@ #cmakedefine HAVE_LIBSODIUM +#cmakedefine USE_OPENSSL #define MAX_CONFIG_DEPTH @MAX_CONFIG_DEPTH_NUM@ |