updated build system
This commit is contained in:
		| @@ -111,10 +111,6 @@ public: | ||||
|     return error_return_; | ||||
|   } | ||||
|  | ||||
|   [[nodiscard]] static constexpr auto get_header_size() -> std::size_t { | ||||
|     return header_size_; | ||||
|   } | ||||
|  | ||||
|   [[nodiscard]] auto get_iv_list() | ||||
|       -> std::vector<std::array<unsigned char, | ||||
|                                 crypto_aead_xchacha20poly1305_IETF_NPUBBYTES>> { | ||||
|   | ||||
| @@ -73,8 +73,6 @@ auto read_encrypted_range(const http_range &range, const key_type &key, | ||||
|       utils::encryption::encrypting_reader::get_encrypted_chunk_size(); | ||||
|   const auto data_chunk_size = | ||||
|       utils::encryption::encrypting_reader::get_data_chunk_size(); | ||||
|   const auto header_size = | ||||
|       utils::encryption::encrypting_reader::get_header_size(); | ||||
|  | ||||
|   const auto start_chunk = | ||||
|       static_cast<std::size_t>(range.begin / data_chunk_size); | ||||
| @@ -86,8 +84,8 @@ auto read_encrypted_range(const http_range &range, const key_type &key, | ||||
|     data_buffer cypher; | ||||
|     const auto start_offset = chunk * encrypted_chunk_size; | ||||
|     const auto end_offset = std::min( | ||||
|         start_offset + (total_size - (chunk * data_chunk_size)) + header_size - | ||||
|             1U, | ||||
|         start_offset + (total_size - (chunk * data_chunk_size)) + | ||||
|             encryption_header_size - 1U, | ||||
|         static_cast<std::uint64_t>(start_offset + encrypted_chunk_size - 1U)); | ||||
|  | ||||
|     const auto result = reader(cypher, start_offset, end_offset); | ||||
|   | ||||
| @@ -203,8 +203,7 @@ encrypting_reader::encrypting_reader( | ||||
|  | ||||
|   const auto total_chunks = utils::divide_with_ceiling( | ||||
|       file_size, static_cast<std::uint64_t>(data_chunk_size_)); | ||||
|   total_size_ = | ||||
|       file_size + (total_chunks * encrypting_reader::get_header_size()); | ||||
|   total_size_ = file_size + (total_chunks * encryption_header_size); | ||||
|   last_data_chunk_ = total_chunks - 1U; | ||||
|   last_data_chunk_size_ = (file_size <= data_chunk_size_) ? file_size | ||||
|                           : (file_size % data_chunk_size_) == 0U | ||||
| @@ -244,8 +243,7 @@ encrypting_reader::encrypting_reader(std::string_view encrypted_file_path, | ||||
|  | ||||
|   const auto total_chunks = utils::divide_with_ceiling( | ||||
|       file_size, static_cast<std::uint64_t>(data_chunk_size_)); | ||||
|   total_size_ = | ||||
|       file_size + (total_chunks * encrypting_reader::get_header_size()); | ||||
|   total_size_ = file_size + (total_chunks * encryption_header_size); | ||||
|   last_data_chunk_ = total_chunks - 1U; | ||||
|   last_data_chunk_size_ = (file_size <= data_chunk_size_) ? file_size | ||||
|                           : (file_size % data_chunk_size_) == 0U | ||||
| @@ -287,8 +285,7 @@ encrypting_reader::encrypting_reader( | ||||
|  | ||||
|   const auto total_chunks = utils::divide_with_ceiling( | ||||
|       file_size, static_cast<std::uint64_t>(data_chunk_size_)); | ||||
|   total_size_ = | ||||
|       file_size + (total_chunks * encrypting_reader::get_header_size()); | ||||
|   total_size_ = file_size + (total_chunks * encryption_header_size); | ||||
|   last_data_chunk_ = total_chunks - 1U; | ||||
|   last_data_chunk_size_ = (file_size <= data_chunk_size_) ? file_size | ||||
|                           : (file_size % data_chunk_size_) == 0U | ||||
| @@ -322,7 +319,7 @@ auto encrypting_reader::calculate_decrypted_size(std::uint64_t total_size) | ||||
|   return total_size - (utils::divide_with_ceiling( | ||||
|                            total_size, static_cast<std::uint64_t>( | ||||
|                                            get_encrypted_chunk_size())) * | ||||
|                        get_header_size()); | ||||
|                        encryption_header_size); | ||||
| } | ||||
|  | ||||
| auto encrypting_reader::calculate_encrypted_size(std::string_view source_path) | ||||
| @@ -336,7 +333,7 @@ auto encrypting_reader::calculate_encrypted_size(std::string_view source_path) | ||||
|  | ||||
|   const auto total_chunks = utils::divide_with_ceiling( | ||||
|       file_size, static_cast<std::uint64_t>(data_chunk_size_)); | ||||
|   return file_size + (total_chunks * encrypting_reader::get_header_size()); | ||||
|   return file_size + (total_chunks * encryption_header_size); | ||||
| } | ||||
|  | ||||
| auto encrypting_reader::create_iostream() const | ||||
| @@ -367,7 +364,7 @@ auto encrypting_reader::reader_function(char *buffer, size_t size, | ||||
|           data_buffer file_data(chunk == last_data_chunk_ | ||||
|                                     ? last_data_chunk_size_ | ||||
|                                     : data_chunk_size_); | ||||
|           chunk_buffer.resize(file_data.size() + get_header_size()); | ||||
|           chunk_buffer.resize(file_data.size() + encryption_header_size); | ||||
|  | ||||
|           std::size_t bytes_read{}; | ||||
|           if ((ret = source_file_->read_bytes(&file_data[0u], file_data.size(), | ||||
|   | ||||
		Reference in New Issue
	
	Block a user