diff options
| author | Pierre Bourdon <delroth@gmail.com> | 2023-02-24 19:47:18 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-24 19:47:18 +0900 |
| commit | 88fc431dce1d422cc02215d62e544b67476504ad (patch) | |
| tree | 08db3f59171104c3680b5e3795ef84177d65c5e3 /Source/Core/Common/Random.cpp | |
| parent | c5775c5b90d0d36414bf417a3e32dbf151730a4e (diff) | |
| parent | 2c2fb869a22130aafbcc2e5b2586342f9854d5e1 (diff) | |
Merge pull request #11598 from shuffle2/std-prng
use std-provided randomness for JitArm64 unittests
Diffstat (limited to 'Source/Core/Common/Random.cpp')
| -rw-r--r-- | Source/Core/Common/Random.cpp | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/Source/Core/Common/Random.cpp b/Source/Core/Common/Random.cpp index 501da563b9..0c859eaa12 100644 --- a/Source/Core/Common/Random.cpp +++ b/Source/Core/Common/Random.cpp @@ -10,38 +10,6 @@ namespace Common::Random { -struct PRNG::Impl -{ - Impl(void* seed, std::size_t size) - { - mbedtls_hmac_drbg_init(&m_context); - const int ret = mbedtls_hmac_drbg_seed_buf( - &m_context, mbedtls_md_info_from_type(MBEDTLS_MD_SHA256), static_cast<u8*>(seed), size); - ASSERT(ret == 0); - } - - ~Impl() { mbedtls_hmac_drbg_free(&m_context); } - - void Generate(void* buffer, std::size_t size) - { - const int ret = mbedtls_hmac_drbg_random(&m_context, static_cast<u8*>(buffer), size); - ASSERT(ret == 0); - } - - mbedtls_hmac_drbg_context m_context; -}; - -PRNG::PRNG(void* seed, std::size_t size) : m_impl(std::make_unique<Impl>(seed, size)) -{ -} - -PRNG::~PRNG() = default; - -void PRNG::Generate(void* buffer, std::size_t size) -{ - m_impl->Generate(buffer, size); -} - class EntropySeededPRNG final { public: |
