diff --git a/include/botan_asio/asio_async_ops.h b/include/botan_asio/asio_async_ops.h index 1d98a9d..9082bdd 100644 --- a/include/botan_asio/asio_async_ops.h +++ b/include/botan_asio/asio_async_ops.h @@ -9,7 +9,7 @@ #ifndef BOTAN_ASIO_ASYNC_OPS_H_ #define BOTAN_ASIO_ASYNC_OPS_H_ -#include +#include #include #include #include "asio_error.h" diff --git a/include/botan_asio/asio_context.h b/include/botan_asio/asio_context.h index 0c3b43e..23b6446 100644 --- a/include/botan_asio/asio_context.h +++ b/include/botan_asio/asio_context.h @@ -9,7 +9,13 @@ #ifndef BOTAN_ASIO_TLS_CONTEXT_H_ #define BOTAN_ASIO_TLS_CONTEXT_H_ -#include +#include +#include +#include +#include +#include +#include +#include #include namespace Botan::TLS { diff --git a/include/botan_asio/asio_error.h b/include/botan_asio/asio_error.h index cdafe65..2db4406 100644 --- a/include/botan_asio/asio_error.h +++ b/include/botan_asio/asio_error.h @@ -9,7 +9,9 @@ #ifndef BOTAN_ASIO_ERROR_H_ #define BOTAN_ASIO_ERROR_H_ -#include +#include +#include +#include #include namespace boost{ diff --git a/include/botan_asio/asio_stream.h b/include/botan_asio/asio_stream.h index c11a20a..11edeed 100644 --- a/include/botan_asio/asio_stream.h +++ b/include/botan_asio/asio_stream.h @@ -9,7 +9,11 @@ #ifndef BOTAN_ASIO_STREAM_H_ #define BOTAN_ASIO_STREAM_H_ -#include +#include +#include +#include +#include +#include #include #include "asio_async_ops.h" diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 37cce15..78ca186 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -1,13 +1,23 @@ +# TODO: repo with dependencies, ExternalProject_Add(), FetchContent + add_subdirectory(spdlog-1.12.0) add_subdirectory(restbed-4.8) -add_custom_command( - COMMAND ./configure.py ARGS --amalgamation --disable-shared --minimized-build --enable-modules=argon2fmt,hotp,base32,auto_rng,system_rng,tls13,certstor_system,certstor_flatfile,md5 - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Botan-3.2.0 - OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/Botan-3.2.0/botan_all.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Botan-3.2.0/botan_all.h +include(ExternalProject) +ExternalProject_Add(project_botan + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Botan-3.2.0 + PREFIX ${CMAKE_CURRENT_BINARY_DIR}/botan + CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/Botan-3.2.0/configure.py --with-build-dir= --prefix= --disable-shared --minimized-build --build-targets=static --without-sphinx --without-rst2man --enable-modules=argon2fmt,hotp,base32,auto_rng,system_rng,tls13,certstor_system,certstor_flatfile,md5 + BUILD_COMMAND make -j libs + BUILD_BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/botan/lib/libbotan-3.a" + INSTALL_COMMAND make install + USES_TERMINAL_BUILD YES + USES_TERMINAL_INSTALL YES ) -add_library(botan STATIC Botan-3.2.0/botan_all.cpp Botan-3.2.0/botan_all.h) -target_include_directories(botan PUBLIC Botan-3.2.0) +add_library(botan INTERFACE IMPORTED) +target_link_libraries(botan INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/botan/lib/libbotan-3.a") +target_include_directories(botan INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/botan/include/botan-3") +add_dependencies(botan project_botan) add_library(miniz STATIC miniz/miniz.c miniz/miniz.h) target_include_directories(miniz PUBLIC miniz) diff --git a/src/main.cxx b/src/main.cxx index d84237a..6a4f2a4 100644 --- a/src/main.cxx +++ b/src/main.cxx @@ -1,6 +1,7 @@ #include #include -#include +#include +#include #include #include #include @@ -32,7 +33,7 @@ int main() { { auto md5_hash = Botan::HashFunction::create_or_throw("MD5"); md5_hash->update(index_html_bytes); - index_etag = Botan::hex_encode(md5_hash->final()); + index_etag = "\"" + Botan::hex_encode(md5_hash->final()) + "\""; } auto mrpc_resource = std::make_shared(); diff --git a/src/server/auth.cxx b/src/server/auth.cxx index 6f874e1..f7e64d5 100644 --- a/src/server/auth.cxx +++ b/src/server/auth.cxx @@ -1,4 +1,7 @@ -#include +#include +#include +#include +#include #include "server_internal.hxx" std::string hash_password(const std::string &password) { diff --git a/src/server/fs.cxx b/src/server/fs.cxx index cb22148..8a14eab 100644 --- a/src/server/fs.cxx +++ b/src/server/fs.cxx @@ -2,6 +2,7 @@ #include #include #include +#include #include "server_internal.hxx" mrpc::Node node_to_node(const std::shared_ptr& node) { diff --git a/src/server/mail.cxx b/src/server/mail.cxx index 8350402..b4012df 100644 --- a/src/server/mail.cxx +++ b/src/server/mail.cxx @@ -1,6 +1,8 @@ #include -#include #include +#include +#include +#include #include #include "server_internal.hxx" @@ -80,7 +82,11 @@ void Server::send_mail(const std::string &email, const std::string &title, const asio::io_service ctx; auto ssl_ctx = std::make_shared( std::make_shared(), - std::make_shared(), +#if defined(BOTAN_HAS_SYSTEM_RNG) + std::make_unique(), +#else + std::make_unique(), +#endif std::make_shared(), std::make_shared() ); diff --git a/src/server/server.cxx b/src/server/server.cxx index 33864c7..c82d2ad 100644 --- a/src/server/server.cxx +++ b/src/server/server.cxx @@ -1,3 +1,4 @@ +#include #include "server_internal.hxx" std::shared_ptr Server::get_token(const std::string &token) { diff --git a/src/server/server_internal.hxx b/src/server/server_internal.hxx index f07b965..e1599dd 100644 --- a/src/server/server_internal.hxx +++ b/src/server/server_internal.hxx @@ -1,7 +1,7 @@ #ifndef FILESERVER_SERVER_INTERNAL_HXX #define FILESERVER_SERVER_INTERNAL_HXX -#include +#include #include "server.hxx" // TODO log user action with __FUNC__ @@ -10,8 +10,10 @@ #define check_user_optional() check_user() return "Unauthorized" #if defined(BOTAN_HAS_SYSTEM_RNG) +#include static std::unique_ptr auth_rng = std::make_unique(); #else +#include static std::unique_ptr auth_rng = std::make_unique(); #endif