updated build system
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
This commit is contained in:
@@ -230,18 +230,10 @@ encrypting_reader::encrypting_reader(
|
||||
stop_type_callback stop_requested_cb, std::string_view token,
|
||||
kdf_config cfg, std::optional<std::string> relative_parent_path,
|
||||
std::size_t error_return)
|
||||
: keys_(
|
||||
utils::encryption::generate_key<utils::hash::hash_256_t>(token, cfg),
|
||||
utils::encryption::generate_key<utils::hash::hash_256_t>(token)),
|
||||
stop_requested_cb_(std::move(stop_requested_cb)),
|
||||
: stop_requested_cb_(std::move(stop_requested_cb)),
|
||||
error_return_(error_return),
|
||||
source_file_(utils::file::file::open_or_create_file(source_path, true)) {
|
||||
kdf_headers_ = {cfg.to_header(), cfg.to_header()};
|
||||
|
||||
data_buffer result;
|
||||
utils::encryption::encrypt_data(
|
||||
keys_.second, reinterpret_cast<const unsigned char *>(file_name.data()),
|
||||
file_name.size(), result);
|
||||
common_initialize_kdf_keys(token, cfg);
|
||||
common_initialize(true);
|
||||
create_encrypted_paths(file_name, relative_parent_path);
|
||||
}
|
||||
@@ -251,16 +243,13 @@ encrypting_reader::encrypting_reader(stop_type_callback stop_requested_cb,
|
||||
std::string_view source_path,
|
||||
std::string_view token, kdf_config cfg,
|
||||
std::size_t error_return)
|
||||
: keys_(
|
||||
utils::encryption::generate_key<utils::hash::hash_256_t>(token, cfg),
|
||||
utils::encryption::generate_key<utils::hash::hash_256_t>(token)),
|
||||
stop_requested_cb_(std::move(stop_requested_cb)),
|
||||
: stop_requested_cb_(std::move(stop_requested_cb)),
|
||||
error_return_(error_return),
|
||||
source_file_(utils::file::file::open_or_create_file(source_path, true)),
|
||||
encrypted_file_name_(
|
||||
utils::path::strip_to_file_name(std::string{encrypted_file_path})),
|
||||
encrypted_file_path_(encrypted_file_path) {
|
||||
kdf_headers_ = {cfg.to_header(), cfg.to_header()};
|
||||
common_initialize_kdf_keys(token, cfg);
|
||||
common_initialize(true);
|
||||
}
|
||||
|
||||
@@ -271,17 +260,14 @@ encrypting_reader::encrypting_reader(
|
||||
std::array<unsigned char, crypto_aead_xchacha20poly1305_IETF_NPUBBYTES>>
|
||||
iv_list,
|
||||
std::size_t error_return)
|
||||
: keys_(
|
||||
utils::encryption::generate_key<utils::hash::hash_256_t>(token, cfg),
|
||||
utils::encryption::generate_key<utils::hash::hash_256_t>(token)),
|
||||
stop_requested_cb_(std::move(stop_requested_cb)),
|
||||
: stop_requested_cb_(std::move(stop_requested_cb)),
|
||||
error_return_(error_return),
|
||||
source_file_(utils::file::file::open_or_create_file(source_path, true)),
|
||||
encrypted_file_name_(
|
||||
utils::path::strip_to_file_name(std::string{encrypted_file_path})),
|
||||
encrypted_file_path_(encrypted_file_path),
|
||||
iv_list_(std::move(iv_list)) {
|
||||
kdf_headers_ = {cfg.to_header(), cfg.to_header()};
|
||||
common_initialize_kdf_keys(token, cfg);
|
||||
common_initialize(false);
|
||||
}
|
||||
|
||||
@@ -294,17 +280,6 @@ encrypting_reader::encrypting_reader(
|
||||
error_return_(error_return),
|
||||
source_file_(utils::file::file::open_or_create_file(source_path, true)) {
|
||||
common_initialize_kdf_data(cfg, master_key);
|
||||
|
||||
kdf_config path_cfg;
|
||||
std::tie(keys_.second, path_cfg) = cfg.create_subkey(
|
||||
kdf_context::path, utils::generate_secure_random<std::uint64_t>(),
|
||||
master_key);
|
||||
kdf_headers_->second = path_cfg.to_header();
|
||||
|
||||
data_buffer result;
|
||||
utils::encryption::encrypt_data(
|
||||
keys_.second, reinterpret_cast<const unsigned char *>(file_name.data()),
|
||||
file_name.size(), result);
|
||||
common_initialize(true);
|
||||
create_encrypted_paths(file_name, relative_parent_path);
|
||||
}
|
||||
@@ -315,8 +290,7 @@ encrypting_reader::encrypting_reader(stop_type_callback stop_requested_cb,
|
||||
const utils::hash::hash_256_t &master_key,
|
||||
const kdf_config &cfg,
|
||||
std::size_t error_return)
|
||||
: keys_(),
|
||||
stop_requested_cb_(std::move(stop_requested_cb)),
|
||||
: stop_requested_cb_(std::move(stop_requested_cb)),
|
||||
error_return_(error_return),
|
||||
source_file_(utils::file::file::open_or_create_file(source_path, true)),
|
||||
encrypted_file_name_(
|
||||
@@ -458,6 +432,14 @@ void encrypting_reader::common_initialize_kdf_data(
|
||||
kdf_headers_ = {data_cfg.to_header(), {}};
|
||||
}
|
||||
|
||||
void encrypting_reader::common_initialize_kdf_keys(std::string_view token,
|
||||
kdf_config &cfg) {
|
||||
auto key =
|
||||
utils::encryption::generate_key<utils::hash::hash_256_t>(token, cfg);
|
||||
keys_ = {key, key};
|
||||
kdf_headers_ = {cfg.to_header(), cfg.to_header()};
|
||||
}
|
||||
|
||||
void encrypting_reader::common_initialize_kdf_path(
|
||||
const utils::hash::hash_256_t &master_key) {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
Reference in New Issue
Block a user