updated build system
	
		
			
	
		
	
	
		
	
		
			Some checks failed
		
		
	
	
		
			
				
	
				BlockStorage/repertory/pipeline/head There was a failure building this commit
				
			
		
		
	
	
				
					
				
			
		
			Some checks failed
		
		
	
	BlockStorage/repertory/pipeline/head There was a failure building this commit
				
			This commit is contained in:
		| @@ -46,7 +46,7 @@ struct com_init_wrapper final { | ||||
|   [[nodiscard]] auto is_initialized() const -> bool { return initialized_; } | ||||
|  | ||||
| private: | ||||
|   BOOL initialized_; | ||||
|   BOOL initialized_{}; | ||||
| }; | ||||
| } // namespace repertory::utils | ||||
|  | ||||
|   | ||||
| @@ -107,7 +107,6 @@ | ||||
| #include <cerrno> | ||||
| #include <chrono> | ||||
| #include <climits> | ||||
| #include <codecvt> | ||||
| #include <condition_variable> | ||||
| #include <csignal> | ||||
| #include <cstdint> | ||||
| @@ -149,6 +148,9 @@ | ||||
| #include <version> | ||||
| #endif // defined(__cplusplus) | ||||
|  | ||||
| #include <unicode/uchar.h> | ||||
| #include <unicode/utf.h> | ||||
|  | ||||
| #if defined(PROJECT_ENABLE_CURL) | ||||
| #include "curl/curl.h" | ||||
| #include "curl/multi.h" | ||||
|   | ||||
| @@ -97,7 +97,7 @@ private: | ||||
|  | ||||
| private: | ||||
|   std::unordered_map<std::size_t, data_buffer> chunk_buffers_; | ||||
|   std::optional<std::array<std::uint8_t, kdf_config::size()>> kdf_header_; | ||||
|   std::optional<data_buffer> kdf_header_; | ||||
|   std::size_t last_data_chunk_{}; | ||||
|   std::size_t last_data_chunk_size_{}; | ||||
|   std::uint64_t read_offset_{}; | ||||
|   | ||||
| @@ -101,27 +101,19 @@ struct kdf_config final { | ||||
|   salt_t salt{}; | ||||
|   std::uint64_t checksum{}; | ||||
|  | ||||
|   [[nodiscard]] static constexpr auto size() -> std::size_t { | ||||
|     return sizeof(kdf_config); | ||||
|   } | ||||
|   [[nodiscard]] static auto from_header(std::span<const unsigned char> data, | ||||
|                                         kdf_config &cfg) -> bool; | ||||
|  | ||||
|   [[nodiscard]] auto generate_checksum() const -> std::uint64_t; | ||||
|  | ||||
|   void generate_salt(); | ||||
|  | ||||
|   [[nodiscard]] static auto from_header(std::span<const unsigned char> data, | ||||
|                                         kdf_config &cfg) -> bool; | ||||
|  | ||||
|   [[nodiscard]] auto to_header() -> auto { | ||||
|     kdf_config tmp{*this}; | ||||
|     tmp.checksum = boost::endian::native_to_big(tmp.checksum); | ||||
|     tmp.magic = boost::endian::native_to_big(tmp.magic); | ||||
|  | ||||
|     std::array<std::uint8_t, size()> ret{}; | ||||
|     std::memcpy(ret.data(), &tmp, size()); | ||||
|     return ret; | ||||
|   [[nodiscard]] static constexpr auto size() -> std::size_t { | ||||
|     return sizeof(kdf_config); | ||||
|   } | ||||
|  | ||||
|   [[nodiscard]] auto to_header() const -> data_buffer; | ||||
|  | ||||
|   [[nodiscard]] auto operator==(const kdf_config &) const -> bool = default; | ||||
|   [[nodiscard]] auto operator!=(const kdf_config &) const -> bool = default; | ||||
| }; | ||||
|   | ||||
| @@ -28,10 +28,33 @@ | ||||
| #include "utils/error.hpp" | ||||
|  | ||||
| namespace repertory::utils::hash { | ||||
| using hash_32_t = std::array<unsigned char, 4U>; | ||||
| using hash_64_t = std::array<unsigned char, 8U>; | ||||
| using hash_128_t = std::array<unsigned char, 16U>; | ||||
| using hash_256_t = std::array<unsigned char, 32U>; | ||||
| using hash_384_t = std::array<unsigned char, 48U>; | ||||
| using hash_512_t = std::array<unsigned char, 64U>; | ||||
|  | ||||
| [[nodiscard]] auto create_hash_blake2b_32(std::string_view data) -> hash_32_t; | ||||
|  | ||||
| [[nodiscard]] auto create_hash_blake2b_32(std::wstring_view data) -> hash_32_t; | ||||
|  | ||||
| [[nodiscard]] auto create_hash_blake2b_32(const data_buffer &data) -> hash_32_t; | ||||
|  | ||||
| [[nodiscard]] auto create_hash_blake2b_64(std::string_view data) -> hash_64_t; | ||||
|  | ||||
| [[nodiscard]] auto create_hash_blake2b_64(std::wstring_view data) -> hash_64_t; | ||||
|  | ||||
| [[nodiscard]] auto create_hash_blake2b_64(const data_buffer &data) -> hash_64_t; | ||||
|  | ||||
| [[nodiscard]] auto create_hash_blake2b_128(std::string_view data) -> hash_128_t; | ||||
|  | ||||
| [[nodiscard]] auto create_hash_blake2b_128(std::wstring_view data) | ||||
|     -> hash_128_t; | ||||
|  | ||||
| [[nodiscard]] auto create_hash_blake2b_128(const data_buffer &data) | ||||
|     -> hash_128_t; | ||||
|  | ||||
| [[nodiscard]] auto create_hash_blake2b_256(std::string_view data) -> hash_256_t; | ||||
|  | ||||
| [[nodiscard]] auto create_hash_blake2b_256(std::wstring_view data) | ||||
| @@ -123,6 +146,27 @@ auto create_hash_blake2b_t(const unsigned char *data, std::size_t data_size) | ||||
|   return hash; | ||||
| } | ||||
|  | ||||
| inline const std::function<hash_32_t(const unsigned char *data, | ||||
|                                      std::size_t size)> | ||||
|     blake2b_32_hasher = | ||||
|         [](const unsigned char *data, std::size_t data_size) -> hash_32_t { | ||||
|   return create_hash_blake2b_t<hash_32_t>(data, data_size); | ||||
| }; | ||||
|  | ||||
| inline const std::function<hash_64_t(const unsigned char *data, | ||||
|                                      std::size_t size)> | ||||
|     blake2b_64_hasher = | ||||
|         [](const unsigned char *data, std::size_t data_size) -> hash_64_t { | ||||
|   return create_hash_blake2b_t<hash_64_t>(data, data_size); | ||||
| }; | ||||
|  | ||||
| inline const std::function<hash_128_t(const unsigned char *data, | ||||
|                                       std::size_t size)> | ||||
|     blake2b_128_hasher = | ||||
|         [](const unsigned char *data, std::size_t data_size) -> hash_128_t { | ||||
|   return create_hash_blake2b_t<hash_128_t>(data, data_size); | ||||
| }; | ||||
|  | ||||
| inline const std::function<hash_256_t(const unsigned char *data, | ||||
|                                       std::size_t size)> | ||||
|     blake2b_256_hasher = | ||||
| @@ -158,6 +202,24 @@ inline const std::function<hash_512_t(const unsigned char *data, | ||||
|   return create_hash_sha512(data, data_size); | ||||
| }; | ||||
|  | ||||
| template <> | ||||
| [[nodiscard]] inline auto default_create_hash<hash_32_t>() -> const | ||||
|     std::function<hash_32_t(const unsigned char *data, std::size_t size)> & { | ||||
|   return blake2b_32_hasher; | ||||
| } | ||||
|  | ||||
| template <> | ||||
| [[nodiscard]] inline auto default_create_hash<hash_64_t>() -> const | ||||
|     std::function<hash_64_t(const unsigned char *data, std::size_t size)> & { | ||||
|   return blake2b_64_hasher; | ||||
| } | ||||
|  | ||||
| template <> | ||||
| [[nodiscard]] inline auto default_create_hash<hash_128_t>() -> const | ||||
|     std::function<hash_128_t(const unsigned char *data, std::size_t size)> & { | ||||
|   return blake2b_128_hasher; | ||||
| } | ||||
|  | ||||
| template <> | ||||
| [[nodiscard]] inline auto default_create_hash<hash_256_t>() -> const | ||||
|     std::function<hash_256_t(const unsigned char *data, std::size_t size)> & { | ||||
|   | ||||
| @@ -34,13 +34,23 @@ void free_console(); | ||||
|  | ||||
| [[nodiscard]] auto get_last_error_code() -> DWORD; | ||||
|  | ||||
| [[nodiscard]] auto get_startup_folder() -> std::wstring; | ||||
|  | ||||
| [[nodiscard]] auto get_thread_id() -> std::uint64_t; | ||||
|  | ||||
| [[nodiscard]] auto is_process_elevated() -> bool; | ||||
|  | ||||
| [[nodiscard]] auto run_process_elevated(std::vector<const char *> args) -> int; | ||||
|  | ||||
| void set_last_error_code(DWORD errorCode); | ||||
| [[nodiscard]] | ||||
| auto create_shortcut(const std::wstring &exe_path, | ||||
|                      const std::wstring &arguments, | ||||
|                      const std::wstring &working_directory, | ||||
|                      const std::wstring &shortcut_name = L"", | ||||
|                      const std::wstring &location = get_startup_folder()) | ||||
|     -> bool; | ||||
|  | ||||
| void set_last_error_code(DWORD error_code); | ||||
| } // namespace repertory::utils | ||||
|  | ||||
| #endif // defined(_WIN32) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user