generator: memcpy -> memmove
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
595245fbce
commit
a7e8caa26e
|
@ -63,7 +63,7 @@ auto Generator::reseed(const std::string& s) -> void {
|
|||
|
||||
try {
|
||||
std::string a{do_sha(to_be_hashed)};
|
||||
std::memcpy(&G.k[0], &a[0], G.k.SizeInBytes());
|
||||
std::memmove(&G.k[0], &a[0], G.k.SizeInBytes());
|
||||
++G.ctr;
|
||||
} catch(std::exception& e) {
|
||||
fmt::print("{}", e.what());
|
||||
|
@ -128,7 +128,7 @@ auto Generator::do_crypto() -> std::string {
|
|||
// 16 bytes --> 128bit
|
||||
static constexpr const std::size_t ctr_length{16};
|
||||
CryptoPP::FixedSizeSecBlock<CryptoPP::byte, ctr_length> ctr;
|
||||
std::memcpy(&ctr, &G.ctr, ctr_length);
|
||||
std::memmove(&ctr, &G.ctr, ctr_length);
|
||||
|
||||
try {
|
||||
// fmt::print("plain text: {}\n", plain);
|
||||
|
@ -174,7 +174,7 @@ auto Generator::generate_blocks(unsigned int k_blocks) -> std::string {
|
|||
try {
|
||||
std::string da_key{""};
|
||||
da_key.resize(G.k.size());
|
||||
std::memcpy(&da_key[0], &G.k[0], G.k_length);
|
||||
std::memmove(&da_key[0], &G.k[0], G.k_length);
|
||||
// TODO(me): assert reseed_time > 100ms
|
||||
reseed(do_sha(da_key));
|
||||
} catch(std::exception& e) {
|
||||
|
@ -226,7 +226,7 @@ auto Generator::generate_random_data(uint n) -> std::string {
|
|||
|
||||
/* clear out the old key and set a new one */
|
||||
std::memset(G.k, 0x00, G.k.size());
|
||||
std::memcpy(&G.k[0], &dst[0], dst.size());
|
||||
std::memmove(&G.k[0], &dst[0], dst.size());
|
||||
} catch(std::exception& e) {
|
||||
fmt::print("{}", e.what());
|
||||
}
|
||||
|
|
Reference in New Issue