diff options
| author | 2018-11-13 12:25:43 -0500 | |
|---|---|---|
| committer | 2018-11-13 12:26:03 -0500 | |
| commit | ab552e4a252b66ca02c04724a1773edbefec6837 (patch) | |
| tree | 544702301230e785639d7ff4cfbaa2e99294a4b9 /src/core/hle/kernel/process.h | |
| parent | Merge pull request #1628 from greggameplayer/Texture2DArray (diff) | |
| download | yuzu-ab552e4a252b66ca02c04724a1773edbefec6837.tar.gz yuzu-ab552e4a252b66ca02c04724a1773edbefec6837.tar.xz yuzu-ab552e4a252b66ca02c04724a1773edbefec6837.zip | |
svc: Use proper random entropy generation algorithm
Diffstat (limited to 'src/core/hle/kernel/process.h')
| -rw-r--r-- | src/core/hle/kernel/process.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/core/hle/kernel/process.h b/src/core/hle/kernel/process.h index 8d2616c79..95aa63ea1 100644 --- a/src/core/hle/kernel/process.h +++ b/src/core/hle/kernel/process.h | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #include <bitset> | 8 | #include <bitset> |
| 9 | #include <cstddef> | 9 | #include <cstddef> |
| 10 | #include <memory> | 10 | #include <memory> |
| 11 | #include <random> | ||
| 11 | #include <string> | 12 | #include <string> |
| 12 | #include <vector> | 13 | #include <vector> |
| 13 | #include <boost/container/static_vector.hpp> | 14 | #include <boost/container/static_vector.hpp> |
| @@ -119,6 +120,8 @@ struct CodeSet final { | |||
| 119 | 120 | ||
| 120 | class Process final : public Object { | 121 | class Process final : public Object { |
| 121 | public: | 122 | public: |
| 123 | static constexpr std::size_t RANDOM_ENTROPY_SIZE = 4; | ||
| 124 | |||
| 122 | static SharedPtr<Process> Create(KernelCore& kernel, std::string&& name); | 125 | static SharedPtr<Process> Create(KernelCore& kernel, std::string&& name); |
| 123 | 126 | ||
| 124 | std::string GetTypeName() const override { | 127 | std::string GetTypeName() const override { |
| @@ -212,6 +215,11 @@ public: | |||
| 212 | total_process_running_time_ticks += ticks; | 215 | total_process_running_time_ticks += ticks; |
| 213 | } | 216 | } |
| 214 | 217 | ||
| 218 | /// Gets 8 bytes of random data for svcGetInfo RandomEntropy | ||
| 219 | u64 GetRandomEntropy(std::size_t index) const { | ||
| 220 | return random_entropy.at(index); | ||
| 221 | } | ||
| 222 | |||
| 215 | /** | 223 | /** |
| 216 | * Loads process-specifics configuration info with metadata provided | 224 | * Loads process-specifics configuration info with metadata provided |
| 217 | * by an executable. | 225 | * by an executable. |
| @@ -321,6 +329,9 @@ private: | |||
| 321 | /// Per-process handle table for storing created object handles in. | 329 | /// Per-process handle table for storing created object handles in. |
| 322 | HandleTable handle_table; | 330 | HandleTable handle_table; |
| 323 | 331 | ||
| 332 | /// Random values for svcGetInfo RandomEntropy | ||
| 333 | std::array<u64, RANDOM_ENTROPY_SIZE> random_entropy; | ||
| 334 | |||
| 324 | std::string name; | 335 | std::string name; |
| 325 | }; | 336 | }; |
| 326 | 337 | ||