mirror of
https://github.com/Dingo-Shenanigans/ReSkate.git
synced 2026-10-17 17:27:19 +02:00
Give the Linux server 64 bits of session entropy and a pinned Steam lib
Two follow-ups to the Linux server support in #6. Both are Linux-only, so neither reached a Windows player. Session codes - nonce()'s fallback for a container with no /dev/urandom read "i < 4 && !value", which ended the loop as soon as the first round produced anything: one round of sixteen bits instead of four. Over 200k draws that is 62k distinct codes with a ceiling of 0xffff, rather than 200k across the full range. libsteam_api.so - It was fetched from a mirror's main branch with no hash, by CI and by the script every server operator runs, and it is loaded into the server process. A branch name is whatever that branch holds on the day it runs. - Pinned to mirror commit df2baabf574a and checked against its SHA-256 (385840 bytes, eb2dd015...). The size and export checks already there catch a wrong file; a hash is what catches a swapped one. - --sdk-url still overrides the URL and drops the check, since a different URL has a different hash; --sdk-sha256 keeps it.
This commit is contained in:
1 parent
c6618daabb
commit
984656150d
3 files changed
+34
-6
No files matched your search
@@ -32,7 +32,9 @@ std::uint64_t nonce() {
|
||||
std::ifstream urandom("/dev/urandom", std::ios::binary);
|
||||
if (urandom.read(reinterpret_cast<char *>(&value), sizeof(value)) && value) return value;
|
||||
std::random_device device;
|
||||
for (int i = 0; i < 4 && !value; ++i)
|
||||
// Four rounds of sixteen bits each. Stopping as soon as `value` was
|
||||
// non-zero would leave a session code with sixteen bits of entropy.
|
||||
for (int i = 0; i < 4; ++i)
|
||||
value = (value << 16) ^ static_cast<std::uint64_t>(device() & 0xFFFF);
|
||||
if (!value) throw std::runtime_error("Cannot generate a session code.");
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user