killpoco: avoid using Poco::Random which likes /dev/random.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I34659b3fda8a22a1b34416a37e18f483d7961f5e
This commit is contained in:
Michael Meeks 2024-04-05 14:20:52 +01:00 committed by Andras Timar
parent 5e08727bd5
commit 29ef73868f
2 changed files with 8 additions and 2 deletions

View file

@ -373,7 +373,8 @@ shared_headers = common/Common.hpp \
net/ServerSocket.hpp \
net/Socket.hpp \
net/WebSocketHandler.hpp \
tools/Replay.hpp
tools/Replay.hpp \
wasm/base64.hpp
if ENABLE_SSL
shared_headers += net/Ssl.hpp \
net/SslSocket.hpp

View file

@ -51,6 +51,7 @@
#include <NetUtil.hpp>
#include <Log.hpp>
#include <Watchdog.hpp>
#include <wasm/base64.hpp>
// Bug in pre C++17 where static constexpr must be defined. Fixed in C++17.
constexpr std::chrono::microseconds SocketPoll::DefaultPollTimeoutMicroS;
@ -1465,7 +1466,11 @@ namespace {
return computeAccept(key);
}
static std::string generateKey() { return createKey(); }
static std::string generateKey()
{
auto random = Util::rng::getBytes(16);
return macaron::Base64::Encode(std::string(random.begin(), random.end()));
}
};
}