generator: add const qualifier to vars where sound
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
c4dcab3046
commit
348b921795
|
@ -167,7 +167,7 @@ auto Generator::generate_random_data(const uint64_t& n) -> std::string {
|
||||||
/* do magic to compute r
|
/* do magic to compute r
|
||||||
* r ← first-n-bytes(GenerateBlocks(G, ceil(n/16) )) */
|
* r ← first-n-bytes(GenerateBlocks(G, ceil(n/16) )) */
|
||||||
|
|
||||||
unsigned int how_many(
|
const unsigned int how_many(
|
||||||
static_cast<unsigned int>(std::ceil(static_cast<double>(n) / 16)));
|
static_cast<unsigned int>(std::ceil(static_cast<double>(n) / 16)));
|
||||||
|
|
||||||
std::string rr{generate_blocks(how_many)};
|
std::string rr{generate_blocks(how_many)};
|
||||||
|
@ -181,12 +181,11 @@ auto Generator::generate_random_data(const uint64_t& n) -> std::string {
|
||||||
|
|
||||||
/* re-key */
|
/* re-key */
|
||||||
try {
|
try {
|
||||||
std::string nu_G_k{generate_blocks(2)};
|
const std::string nu_G_k{generate_blocks(2)};
|
||||||
|
|
||||||
/* clear out the old key and set a new one */
|
/* clear out the old key and set a new one */
|
||||||
std::memset(G.k, 0x00, G.k_length);
|
std::memset(G.k, 0x00, G.k_length);
|
||||||
std::memmove(G.k, nu_G_k.c_str(), G.k_length);
|
std::memmove(G.k, nu_G_k.c_str(), G.k_length);
|
||||||
nu_G_k.clear();
|
|
||||||
}
|
}
|
||||||
catch (std::exception& e) {
|
catch (std::exception& e) {
|
||||||
fmt::print(stderr, "{}", e.what());
|
fmt::print(stderr, "{}", e.what());
|
||||||
|
|
Reference in New Issue