Build botan with ExternalProject and without amalgamation
All checks were successful
/ Build the server (push) Successful in 3m4s
All checks were successful
/ Build the server (push) Successful in 3m4s
This commit is contained in:
parent
13579acd8f
commit
023ef2ec49
@ -9,7 +9,7 @@
|
||||
#ifndef BOTAN_ASIO_ASYNC_OPS_H_
|
||||
#define BOTAN_ASIO_ASYNC_OPS_H_
|
||||
|
||||
#include <botan_all.h>
|
||||
#include <botan/types.h>
|
||||
#include <asio.hpp>
|
||||
#include <asio/yield.hpp>
|
||||
#include "asio_error.h"
|
||||
|
@ -9,7 +9,13 @@
|
||||
#ifndef BOTAN_ASIO_TLS_CONTEXT_H_
|
||||
#define BOTAN_ASIO_TLS_CONTEXT_H_
|
||||
|
||||
#include <botan_all.h>
|
||||
#include <botan/credentials_manager.h>
|
||||
#include <botan/ocsp.h>
|
||||
#include <botan/rng.h>
|
||||
#include <botan/tls_callbacks.h>
|
||||
#include <botan/tls_policy.h>
|
||||
#include <botan/tls_server_info.h>
|
||||
#include <botan/tls_session_manager.h>
|
||||
#include <functional>
|
||||
|
||||
namespace Botan::TLS {
|
||||
|
@ -9,7 +9,9 @@
|
||||
#ifndef BOTAN_ASIO_ERROR_H_
|
||||
#define BOTAN_ASIO_ERROR_H_
|
||||
|
||||
#include <botan_all.h>
|
||||
#include <botan/exceptn.h>
|
||||
#include <botan/tls_alert.h>
|
||||
#include <botan/tls_exceptn.h>
|
||||
#include <asio/error_code.hpp>
|
||||
|
||||
namespace boost{
|
||||
|
@ -9,7 +9,11 @@
|
||||
#ifndef BOTAN_ASIO_STREAM_H_
|
||||
#define BOTAN_ASIO_STREAM_H_
|
||||
|
||||
#include <botan_all.h>
|
||||
#include <botan/tls_callbacks.h>
|
||||
#include <botan/tls_channel.h>
|
||||
#include <botan/tls_client.h>
|
||||
#include <botan/tls_magic.h>
|
||||
#include <botan/tls_server.h>
|
||||
#include <asio.hpp>
|
||||
|
||||
#include "asio_async_ops.h"
|
||||
|
@ -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=<BINARY_DIR> --prefix=<INSTALL_DIR> --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)
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <memory>
|
||||
#include <csignal>
|
||||
#include <botan_all.h>
|
||||
#include <botan/hash.h>
|
||||
#include <botan/hex.h>
|
||||
#include <corvusoft/restbed/request.hpp>
|
||||
#include <corvusoft/restbed/resource.hpp>
|
||||
#include <corvusoft/restbed/session.hpp>
|
||||
@ -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<restbed::Resource>();
|
||||
|
@ -1,4 +1,7 @@
|
||||
#include <botan_all.h>
|
||||
#include <botan/argon2fmt.h>
|
||||
#include <botan/hex.h>
|
||||
#include <botan/mac.h>
|
||||
#include <botan/base32.h>
|
||||
#include "server_internal.hxx"
|
||||
|
||||
std::string hash_password(const std::string &password) {
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <fstream>
|
||||
#include <stack>
|
||||
#include <unordered_set>
|
||||
#include <botan/base64.h>
|
||||
#include "server_internal.hxx"
|
||||
|
||||
mrpc::Node node_to_node(const std::shared_ptr<Node>& node) {
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include <asio.hpp>
|
||||
#include <botan_all.h>
|
||||
#include <botan_asio/asio_stream.h>
|
||||
#include <botan/certstor_system.h>
|
||||
#include <botan/tls_session_manager_noop.h>
|
||||
#include <botan/base64.h>
|
||||
#include <spdlog/spdlog.h>
|
||||
#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<Botan::TLS::Context>(
|
||||
std::make_shared<CredMan>(),
|
||||
std::make_shared<Botan::AutoSeeded_RNG>(),
|
||||
#if defined(BOTAN_HAS_SYSTEM_RNG)
|
||||
std::make_unique<Botan::System_RNG>(),
|
||||
#else
|
||||
std::make_unique<Botan::AutoSeeded_RNG>(),
|
||||
#endif
|
||||
std::make_shared<Botan::TLS::Session_Manager_Noop>(),
|
||||
std::make_shared<Policy>()
|
||||
);
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include <botan/otp.h>
|
||||
#include "server_internal.hxx"
|
||||
|
||||
std::shared_ptr<Token> Server::get_token(const std::string &token) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef FILESERVER_SERVER_INTERNAL_HXX
|
||||
#define FILESERVER_SERVER_INTERNAL_HXX
|
||||
|
||||
#include <botan_all.h>
|
||||
#include <botan/rng.h>
|
||||
#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 <botan/system_rng.h>
|
||||
static std::unique_ptr<Botan::RNG> auth_rng = std::make_unique<Botan::System_RNG>();
|
||||
#else
|
||||
#include <botan/auto_rng.h>
|
||||
static std::unique_ptr<Botan::RNG> auth_rng = std::make_unique<Botan::AutoSeeded_RNG>();
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user