Merge pull request #1679 from DarkLordZach/deterministic-rng-2

svc: Use proper random entropy generation algorithm
This commit is contained in:
bunnei 2018-11-14 11:52:27 -08:00 committed by GitHub
commit e1ea8cc721
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 8 deletions

View file

@ -15,6 +15,7 @@
#include "core/hle/kernel/thread.h"
#include "core/hle/kernel/vm_manager.h"
#include "core/memory.h"
#include "core/settings.h"
namespace Kernel {
@ -33,6 +34,11 @@ SharedPtr<Process> Process::Create(KernelCore& kernel, std::string&& name) {
process->process_id = kernel.CreateNewProcessID();
process->svc_access_mask.set();
std::mt19937 rng(Settings::values.rng_seed.value_or(0));
std::uniform_int_distribution<u64> distribution;
std::generate(process->random_entropy.begin(), process->random_entropy.end(),
[&] { return distribution(rng); });
kernel.AppendNewProcess(process);
return process;
}