mirror of
https://github.com/neocturne/fastd.git
synced 2025-05-15 12:45:09 +02:00
Correctly initialize OpenSSL
This commit is contained in:
parent
c62a0f592c
commit
2f516f9cea
3 changed files with 20 additions and 1 deletions
|
@ -40,7 +40,7 @@ add_executable(fastd
|
||||||
set_property(TARGET fastd PROPERTY COMPILE_FLAGS "${FASTD_CFLAGS}")
|
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 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})
|
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)
|
add_dependencies(fastd version)
|
||||||
|
|
||||||
|
|
18
src/fastd.c
18
src/fastd.c
|
@ -44,6 +44,12 @@
|
||||||
#include <sodium/core.h>
|
#include <sodium/core.h>
|
||||||
#endif
|
#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 sighup = false;
|
||||||
static volatile bool terminate = false;
|
static volatile bool terminate = false;
|
||||||
|
@ -744,6 +750,12 @@ int main(int argc, char *argv[]) {
|
||||||
sodium_init();
|
sodium_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_OPENSSL
|
||||||
|
ERR_load_crypto_strings();
|
||||||
|
OpenSSL_add_all_algorithms();
|
||||||
|
OPENSSL_config(NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
fastd_context_t ctx = {};
|
fastd_context_t ctx = {};
|
||||||
|
|
||||||
close_fds(&ctx);
|
close_fds(&ctx);
|
||||||
|
@ -878,5 +890,11 @@ int main(int argc, char *argv[]) {
|
||||||
close_log(&ctx);
|
close_log(&ctx);
|
||||||
fastd_config_release(&ctx, &conf);
|
fastd_config_release(&ctx, &conf);
|
||||||
|
|
||||||
|
#ifdef USE_OPENSSL
|
||||||
|
CONF_modules_free();
|
||||||
|
EVP_cleanup();
|
||||||
|
ERR_free_strings();
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
|
|
||||||
|
|
||||||
#cmakedefine HAVE_LIBSODIUM
|
#cmakedefine HAVE_LIBSODIUM
|
||||||
|
#cmakedefine USE_OPENSSL
|
||||||
|
|
||||||
#define MAX_CONFIG_DEPTH @MAX_CONFIG_DEPTH_NUM@
|
#define MAX_CONFIG_DEPTH @MAX_CONFIG_DEPTH_NUM@
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue