svc: Use proper random entropy generation algorithm

This commit is contained in:
Zach Hilman
2018-11-13 12:25:43 -05:00
parent 65bd03d74c
commit ab552e4a25
6 changed files with 33 additions and 8 deletions

View File

@ -17,6 +17,7 @@
#include "core/hle/kernel/thread.h"
#include "core/hle/kernel/vm_manager.h"
#include "core/memory.h"
#include "core/settings.h"
namespace Kernel {
@ -35,6 +36,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;
}