Commit Graph

5 Commits

Author SHA1 Message Date
Shawn Hoffman 2c2fb869a2 use std-provided randomness for JitArm64 unittests
decreases runtime significantly and lessens dependency on mbedtls
2023-02-22 12:55:12 -08:00
Pierre Bourdon e149ad4f0a
treewide: convert GPLv2+ license info to SPDX tags
SPDX standardizes how source code conveys its copyright and licensing
information. See https://spdx.github.io/spdx-spec/1-rationale/ . SPDX
tags are adopted in many large projects, including things like the Linux
kernel.
2021-07-05 04:35:56 +02:00
MerryMage f65c1df094 Random: Add seeded PRNG 2021-01-31 13:16:45 +00:00
Lioncash 189d277cfc Common/Random: Add convenience template for simple arithmetic values
In cases where we just want a random value for a primitive arithmetic
type, we can wrap this in a template to allow convenient direct
assignment instead of keeping declaration and initialization separate
(making it more difficult to use values uninitialized). This also allows
the use of Common::Random with functions such as std::generate, making
it more flexible in how random values can be generated.
2018-06-14 10:31:13 -04:00
Léo Lam fff1db9730 Common: Add Random utilities
This makes it easier to generate random numbers or fill a buffer with
random data in a cryptographically secure way.

This also replaces existing usages of RNG functions in the codebase:

* <random> is pretty hard to use correctly, and std::random_device does
  not give enough guarantees about its results (it's
  implementation-defined, non cryptographically secure and could be
  deterministic on some platforms).
  Doing things correctly is error prone and verbose.

* rand() is terrible and should not be used especially in crypto code.
2018-05-31 17:54:43 +02:00