diff --git a/CMakeLists.txt b/CMakeLists.txt index 4cfacf0..198d17d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,7 @@ add_library(wormhole_lib src/http/response.cpp src/http/mime.cpp src/http/error_response.cpp + src/crypt/rsa.cpp src/config/config_http.cpp src/config/config_db.cpp src/config/config_loader.cpp @@ -40,7 +41,7 @@ find_package(RapidJSON) find_package(PkgConfig REQUIRED) find_package(Threads REQUIRED) find_package(SQLite3) -find_package(OpenSSL) +find_package(OpenSSL REQUIRED) pkg_check_modules(LIBMICROHTTPD REQUIRED libmicrohttpd) pkg_check_modules(YAML_CPP REQUIRED yaml-cpp) @@ -82,7 +83,8 @@ set(WORMHOLE_INCLUDE_DIRS ${LIBMICROHTTPD_INCLUDE_DIRS} ${YAML_CPP_INCLUDE_DIRS} ${SQLite3_INCLUDE_DIRS} - ${RapidJSON_INCLUDE_DIRS} + ${OPENSSL_INCLUDE_DIR} + ${RAPIDJSON_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/src/ CACHE INTERNAL "") @@ -100,7 +102,7 @@ target_link_libraries(wormhole wormhole_lib wormhole_host_meta_module ${CMAKE_DL_LIBS} ${LIBMICROHTTPD_LIBRARIES} - ${YAML_CPP_LIBRARIES} ${SQLite3_LIBRARIES} - ${RapidJSON_LIBRARIES} + ${YAML_CPP_LIBRARIES} + ${OPENSSL_CRYPTO_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) diff --git a/src/crypt/rsa.cpp b/src/crypt/rsa.cpp index 98fdb23..737b9da 100644 --- a/src/crypt/rsa.cpp +++ b/src/crypt/rsa.cpp @@ -35,12 +35,12 @@ Rsa::Rsa(std::shared_ptr<::RSA> key) {} RsaFactory::RsaFactory() - : e(BN_new(), DeleterBN{}), + : e(BN_new(), DeleterBN{}) { std::srand(std::time(nullptr)); } -RSA RsaFactory::generate_key(const size_t bits /* = 2<<10 */) +Rsa RsaFactory::generate_key(const size_t bits /* = 2<<10 */) { int code; RSA* rsa = RSA_new(); @@ -48,5 +48,5 @@ RSA RsaFactory::generate_key(const size_t bits /* = 2<<10 */) if (!code) throw std::runtime_error(ERR_reason_error_string(ERR_get_error())); - return { std::shared_ptr<::RSA>{rsa, DeleterRSA{}} }; + return Rsa{ std::shared_ptr<::RSA>{rsa, DeleterRSA{}} }; } diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0cadbf1..cdc8cb8 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -4,5 +4,5 @@ target_link_libraries(request_test wormhole_lib) add_test(NAME request_test COMMAND $) add_executable(rsa_test rsa_gen_test.cpp) -target_link_libraries(rsa_test wormhole_lib) +target_link_libraries(rsa_test wormhole_lib ${OPENSSL_CRYPTO_LIBRARIES}) add_test(NAME rsa_test COMMAND $)