aboutsummaryrefslogtreecommitdiff
path: root/src/random.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Increment MIT Licence copyright header year on files modified in 2016isle29832016-12-311-1/+1
| | | | | | Edited via: $ contrib/devtools/copyright_header.py update .
* Refactor: Removed begin/end_ptr functions.Karl-Johan Alm2016-12-091-4/+3
|
* Kill insecure_random and associated global stateWladimir J. van der Laan2016-10-171-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are only a few uses of `insecure_random` outside the tests. This PR replaces uses of insecure_random (and its accompanying global state) in the core code with an FastRandomContext that is automatically seeded on creation. This is meant to be used for inner loops. The FastRandomContext can be in the outer scope, or the class itself, then rand32() is used inside the loop. Useful e.g. for pushing addresses in CNode or the fee rounding, or randomization for coin selection. As a context is created per purpose, thus it gets rid of cross-thread unprotected shared usage of a single set of globals, this should also get rid of the potential race conditions. - I'd say TxMempool::check is not called enough to warrant using a special fast random context, this is switched to GetRand() (open for discussion...) - The use of `insecure_rand` in ConnectThroughProxy has been replaced by an atomic integer counter. The only goal here is to have a different credentials pair for each connection to go on a different Tor circuit, it does not need to be random nor unpredictable. - To avoid having a FastRandomContext on every CNode, the context is passed into PushAddress as appropriate. There remains an insecure_random for test usage in `test_random.h`.
* Don't use assert for catching randomness failuresPieter Wuille2016-05-291-6/+20
|
* Always require OS randomness when generating secret keysPieter Wuille2016-05-291-1/+47
|
* Bump copyright headers to 2015MarcoFalke2015-12-131-1/+1
|
* WIN32 Seed Cleanup: Move nLastPerfmon behind win32 ifdef.21E142015-02-251-3/+4
| | | | | Code to avoid calling Perfmon too often is only needed when perfmon is actually going to get called. This is not intended to make any functional difference in the addition of entropy to the random pool.
* openssl: abstract out OPENSSL_cleanseCory Fields2015-02-151-3/+3
| | | | | | This makes it easier for us to replace it if desired, since it's now only in one spot. Also, it avoids the openssl include from allocators.h, which essentially forced openssl to be included from every compilation unit.
* Added "Core" to copyright headerssandakersmann2014-12-191-1/+1
| | | | | Github-Pull: #5494 Rebased-From: 15de949bb9277e442302bdd8dee299a8d6deee60
* Remove references to X11 licenceMichael Ford2014-12-161-1/+1
|
* Make sure that GetRandomBytes never failsWladimir J. van der Laan2014-11-071-3/+2
| | | | | | | | | We're using GetRandomBytes in several contexts where it's either unwieldy to return an error, or an error would mean a fatal exception anyhow. @gmaxwell checked OpenSSL a while ago and discovered that it never actually fails, but it can't hurt to be a bit paranoid here.
* Apply clang-format on some infrequently-updated filesPieter Wuille2014-09-191-16/+12
|
* header include cleanupPhilip Kaufmann2014-09-141-1/+3
| | | | - ensures alphabetical ordering for includes etc. in source file headers
* Split up util.cpp/hWladimir J. van der Laan2014-08-261-1/+3
| | | | | | | | | | | | | | | | Split up util.cpp/h into: - string utilities (hex, base32, base64): no internal dependencies, no dependency on boost (apart from foreach) - money utilities (parsesmoney, formatmoney) - time utilities (gettime*, sleep, format date): - and the rest (logging, argument parsing, config file parsing) The latter is basically the environment and OS handling, and is stripped of all utility functions, so we may want to rename it to something else than util.cpp/h for clarity (Matt suggested osinterface). Breaks dependency of sha256.cpp on all the things pulled in by util.
* make RandAddSeed() use OPENSSL_cleanse()Philip Kaufmann2014-07-091-2/+1
| | | | - removes the cstring include and is also used in RandAddSeedPerfmon()
* move rand functions from util to new random.h/.cppPhilip Kaufmann2014-07-091-0/+140