aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/test_rng.h
Commit message (Collapse)AuthorAgeFilesLines
* Add a variant of RandomNumberGenerator::random_vecJack Lloyd2019-09-131-0/+7
| | | | | This avoids the unlock(rng.random_vec(...)) pattern which is pretty wasteful in terms of heap overhead.
* Make exceptions easier to translate to error codesJack Lloyd2018-11-231-2/+2
| | | | | | | | | | | Avoid throwing base Botan::Exception type, as it is difficult to determine what the error is in that case. Add Exception::error_code and Exception::error_type which allows (for error code) more information about the error and (for error type) allows knowing the error type without requiring a sequence of catches. See GH #1742
* Avoid calling memset, memcpy within library codeJack Lloyd2018-11-171-1/+6
| | | | | | | | | Prefer using wrappers in mem_utils for this. Current exception is where memcpy is being used to convert between two different types, since copy_mem requires input and output pointers have the same type. There should be a new function to handle conversion-via-memcpy operation.
* Remove support for Visual C++ 2013Jack Lloyd2018-10-011-1/+1
| | | | Closes GH #1557
* Add RandomNumberGenerator::accepts_inputJack Lloyd2018-09-061-0/+8
|
* Remove protected data from Fixed_Output_RNG in test codeJack Lloyd2017-10-021-31/+15
|
* Add final annotations as appropriate in the test codeJack Lloyd2017-09-221-3/+3
|
* Change header guard format to BOTAN_FOO_H_Jack Lloyd2017-09-201-2/+2
| | | | | | ISO C++ reserves names with double underscores in them Closes #512
* Refactor stateful RNG tests to cover both HMAC_DRBG and ChaCha_RNGJack Lloyd2017-08-031-0/+41
|
* Reformat code with astyle + fix code styleTomasz Frydrych2017-05-011-23/+57
|
* Content:Tomasz Frydrych2017-04-031-2/+2
| | | | | | | | | * fixes for deprecated constructions in c++11 and later (explicit rule of 3/5 or implicit rule of 0 and other violations) * `default` specifier instead of `{}` in some places(probably all) * removal of unreachable code (for example `return` after `throw`) * removal of compilation unit only visible, but not used functions * fix for `throw()` specifier - used instead `BOTAN_NOEXCEPT` * removed not needed semicolons
* Convert to using standard uintN_t integer typesJack Lloyd2016-12-181-1/+1
| | | | | | Renames a couple of functions for somewhat better name consistency, eg make_u32bit becomes make_uint32. The old typedefs remain for now since probably lots of application code uses them.
* RNG changes (GH #593)Jack Lloyd2016-08-241-27/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change reseed interval logic to count calls to `randomize` rather than bytes, to match SP 800-90A Changes RNG reseeding API: there is no implicit reference to the global entropy sources within the RNGs anymore. The entropy sources must be supplied with the API call. Adds support for reseding directly from another RNG (such as a system or hardware RNG). Stateful_RNG keeps optional references to both an RNG and a set of entropy sources. During a reseed, both sources are used if set. These can be provided to HMAC_DRBG constructor. For HMAC_DRBG, SP800-90A requires we output no more than 2**16 bytes per DRBG request. We treat requests longer than that as if the caller had instead made several sequential maximum-length requests. This means it is possible for one or more reseeds to trigger even in the course of generating a single (long) output (generate a 256-bit key and use ChaCha or HKDF if this is a problem). Adds RNG::randomize_with_ts_input which takes timestamps and uses them as the additional_data DRBG field. Stateful_RNG overrides this to also include the process ID and the reseed counter. AutoSeeded_RNG's `randomize` uses this. Officially deprecates RNG::make_rng and the Serialized_RNG construtor which creates an AutoSeeded_RNG. With these removed, it would be possible to perform a build with no AutoSeeded_RNG/HMAC_DRBG at all (eg, for applications which only use the system RNG). Tests courtesy @cordney in GH PRs #598 and #600
* Revamp entropy pollingJack Lloyd2016-07-171-0/+25
| | | | | Remove Entropy_Accumulator, instead have entropy sources directly add entropy to the RNG.
* Add ECGDSARené Korthaus2016-04-191-2/+90
|
* cppcheck fixes: Class 'X' has a constructor with 1 argument that is not ↵Daniel Neus2016-03-051-2/+2
| | | | explicit.
* Mass-prefix member vars with m_René Korthaus2016-01-081-8/+8
|
* Fix a few clang warnings. Set clang sanitizer flagsJack Lloyd2015-12-241-1/+1
|
* Missing addsJack Lloyd2015-12-111-10/+12
|
* Reroot the exception hierarchy into a toplevel Exception classJack Lloyd2015-12-111-1/+1
| | | | | | | | As the alternatives are unfortunate for applications trying to catch all library errors, and it seems deriving from std::runtime_error causes problems with MSVC DLLs (GH #340) Effectively reverts 2837e915d82e43
* New reseed_with_sources call on RNGsJack Lloyd2015-11-241-1/+3
| | | | | | | | | | | | | Provides an easier way for an application to configure a list of entropy sources they'd like to use, or add a custom entropy source to their seeding. Exposes some toggles for the global/default entropy sources to build.h Adds basic entropy tests which runs the polls and does sanity checking on the results, including compression tests if available. These are less useful for the CSPRNG outputs but a good check for the ones producing plain ASCII like the /proc reader.
* tests: Add missing overridesDaniel Seither2015-07-301-6/+6
|
* Ensure all files have copyright and license info.lloyd2015-01-101-0/+5
| | | | | Update license header line to specify the terms and refer to the file, neither of which it included before.
* Add HMAC_DRBGlloyd2014-03-211-0/+2
|
* Shuffle things around. Add NIST X.509 test to build.lloyd2014-01-011-0/+61