updated build system
Some checks reported errors
BlockStorage/repertory/pipeline/head Something is wrong with the build of this commit
Some checks reported errors
BlockStorage/repertory/pipeline/head Something is wrong with the build of this commit
This commit is contained in:
@ -25,6 +25,7 @@
|
||||
|
||||
#include "utils/config.hpp"
|
||||
|
||||
#include "utils/error.hpp"
|
||||
#include "utils/hash.hpp"
|
||||
|
||||
namespace repertory::utils::encryption {
|
||||
@ -108,6 +109,8 @@ encrypt_data(const std::array<unsigned char,
|
||||
const std::array<arr_t, arr_size> &key,
|
||||
const unsigned char *buffer, std::size_t buffer_size,
|
||||
result_t &res) {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
std::array<unsigned char, crypto_aead_xchacha20poly1305_IETF_ABYTES> mac{};
|
||||
|
||||
const std::uint32_t size = boost::endian::native_to_big(
|
||||
@ -121,7 +124,10 @@ encrypt_data(const std::array<unsigned char,
|
||||
mac.data(), &mac_length, buffer, buffer_size,
|
||||
reinterpret_cast<const unsigned char *>(&size), sizeof(size), nullptr,
|
||||
iv.data(), key.data()) != 0) {
|
||||
throw std::runtime_error("encryption failed");
|
||||
throw repertory::utils::error::create_exception({
|
||||
function_name,
|
||||
"encryption failed",
|
||||
});
|
||||
}
|
||||
|
||||
std::memcpy(res.data(), iv.data(), iv.size());
|
||||
|
Reference in New Issue
Block a user