diff --git a/src/common/utils/cryptography.cpp b/src/common/utils/cryptography.cpp index 824cb9a7..802f8bcf 100644 --- a/src/common/utils/cryptography.cpp +++ b/src/common/utils/cryptography.cpp @@ -1,5 +1,8 @@ #include "string.hpp" #include "cryptography.hpp" + +#include + #include "nt.hpp" #include "finally.hpp" @@ -116,11 +119,17 @@ namespace utils::cryptography int i[4]; // uninitialized data auto* i_ptr = &i; - this->add_entropy(reinterpret_cast(&i), sizeof(i)); - this->add_entropy(reinterpret_cast(&i_ptr), sizeof(i_ptr)); + this->add_entropy(&i, sizeof(i)); + this->add_entropy(&i_ptr, sizeof(i_ptr)); auto t = time(nullptr); - this->add_entropy(reinterpret_cast(&t), sizeof(t)); + this->add_entropy(&t, sizeof(t)); + + std::random_device rd{}; + for (auto j = 0; j < 4; ++j) { + const auto x = rd(); + this->add_entropy(&x, sizeof(x)); + } } };