aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/test_bigint.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix a bug in Barrett reductionJack Lloyd2018-06-051-0/+4
| | | | | | -x*n % n would reduce to n instead of zero. Also some small optimizations and cleanups.
* Make the tests VarMap an actual type instead of a hashmap typedef.Jack Lloyd2018-05-291-45/+45
|
* Speed up DSA param genJack Lloyd2018-05-211-6/+0
| | | | Using Barrett reduction instead of division is ~10x faster.
* Fix some corner cases for small values in power_modJack Lloyd2018-03-241-2/+2
|
* Increase sample count in random_integer Chi-square testJack Lloyd2018-03-061-1/+1
|
* Replace BigInt::random_integer test with a Chi-square testJack Lloyd2018-03-061-41/+52
| | | | GH #1476
* Correctly handle generating small primesJack Lloyd2018-01-161-5/+9
|
* Remove various unused variablesJack Lloyd2017-10-021-3/+0
| | | | Sonar finds
* Add a GCD testJack Lloyd2017-09-251-0/+22
|
* Add final annotations as appropriate in the test codeJack Lloyd2017-09-221-14/+14
|
* More include header cleanupsJack Lloyd2017-09-211-2/+1
|
* Header file cleanupsJack Lloyd2017-09-211-0/+1
| | | | Some help from include-what-you-use
* Support a negative base in power_modJack Lloyd2017-09-021-0/+6
| | | | Closes #1168
* Reformat code with astyle + fix code styleTomasz Frydrych2017-05-011-30/+40
|
* Increase value of ITERATIONS_PER_POSSIBLE_VALUE to 750Simon Warta2017-01-021-1/+2
| | | | to avoid test failures
* Simplify loop to foreach in test_random_integer()Simon Warta2017-01-021-2/+2
|
* Fix math in test_random_integer()Simon Warta2017-01-021-5/+3
| | | | | Removes complicated extra variable "dev", which was calculated incorrectly: if ratio = 0.0 then dev = 0.0, resulting in a test success.
* Rename ITERATIONS -> ITERATIONS_PER_POSSIBLE_VALUESimon Warta2017-01-021-3/+3
|
* Add more tests for random prime and DL group generationJack Lloyd2016-12-301-0/+85
|
* Speed up DSA param gen testJack Lloyd2016-12-261-6/+8
| | | | Record counter value in test data, and start the search from there.
* Long test was too longJack Lloyd2016-12-241-6/+3
|
* Add test option --run-long-testsJack Lloyd2016-12-241-8/+5
| | | | | | Previously longer tests were hidden behind higher 'soak levels' but these arbitrary cutoffs are confusing compared to a simple short tests/long tests split.
* Add additional primality testsJack Lloyd2016-12-191-7/+8
| | | | | | | Add a long list of 'false' primes from Google's Wycheproof tests: https://github.com/google/wycheproof/blob/master/java/com/google/security/wycheproof/testcases/BigIntegerTest.java Split vector file format into Prime and NonPrime sections for easier reading.
* Minor refactoring of Text_Based_TestJack Lloyd2016-12-191-13/+13
| | | | | | Turns out astyle has some bugs wrt C++11 initialize lists. Rather than having astyle mangle all of the tests, convert to using a string which is split once at the start instead of a vector of keys.
* Convert to using standard uintN_t integer typesJack Lloyd2016-12-181-5/+5
| | | | | | 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.
* Fix exponentiation bug, related fixesJack Lloyd2016-12-141-3/+28
| | | | | | | | | | | | | | | GH #754 exposed a bug in the non-Montgomery exponentiation case. It turned out then when the fixed window was picked to any value > 1, the result would be incorrect due to an off by one. This is the one line fix in powm_fw.cpp Also fix a bug in bigint_mul which caused incorrect results, because the output BigInt was not being zeroed out before use. This is only exposed in rare cases, found (somewhat indirectly) in OSS-Fuzz #287. Add more modular exponentiation tests, which would have caught these issues earlier.
* Fix test, catching wrong exception typeJack Lloyd2016-11-051-1/+1
|
* Handle missing SHA-x in DSA param gen testJack Lloyd2016-11-041-8/+13
|
* Add test for DSA parameter generationJack Lloyd2016-11-031-2/+44
| | | | | Limited to 1024 bit params by default to keep runtimes reasonable, but test vectors for all sizes from FIPS 186-3 do pass.
* Fix leading zero bytes in DSA, ECDSA, ECGDSA and ECKCDSA signaturesRené Korthaus2016-08-171-0/+27
|
* test BigInt::operator%=(word y)Daniel Neus2016-07-261-0/+9
|
* Fix for GCC 6Jack Lloyd2016-05-231-0/+1
|
* Add more tests for modular inverseJack Lloyd2016-02-211-4/+7
| | | | | The result of fuzzing with AFL for a while, then running cmin on the result.
* For odd moduli use a input-independent modular inverse algorithm.Jack Lloyd2016-02-201-2/+12
| | | | Also adds a (not const time) implementation of almost Montgomery reduction.
* Add tests and timings for inverse_modJack Lloyd2016-02-201-2/+31
|
* Split up BigInt testsJack Lloyd2016-02-171-127/+248
| | | | | | Removes a fair number of the power mod test cases for size and test time. Would be better to add a randomized or fuzzer-based test. Otherwise no change.
* Fix (nearly) infinite loop in RESSOL (modular square root).Jack Lloyd2016-02-011-0/+18
| | | | | | | It first computed the first i for q**(2**i) == 1, then checked that i was smaller than s. Given a composite modulus (for which the algorithm does not work), the loop might do a very large amount of work before returning the failure.
* add missing overridesDaniel Neus2016-01-081-1/+1
| | | | found by gcc with -Wsuggest-override
* some trivial compiler/PVS-Studio warning fixesDaniel Neus2015-12-221-1/+1
|
* Add --data-dir option to test commandJack Lloyd2015-12-201-1/+1
| | | | | | | Understand using '-' on the command line to mean stdin Fix last few unit tests that wanted to write to the filesystem; removes outdata directory.
* Fix occasional test failsJack Lloyd2015-11-111-5/+31
| | | | | | | | Increase the iterations of the BigInt::random_integer test. Since things get slow quickly, leave the larger range tests to higher soak levels. In TLS, if the corrupted data causes an exception immediately that's ok because it's corrupted data.
* Update and consolidate the test framework.Jack Lloyd2015-11-111-494/+237
| | | | | | | | | | | The tests previously had used 4 to 6 different schemes internally (the vec file reader framework, Catch, the old InSiTo Boost.Test tests, the PK/BigInt tests which escaped the rewrite in 1.11.7, plus a number of one-offs). Converge on a design that works everywhere, and update all the things. Fix also a few bugs found by the test changes: SHA-512-256 name incorrect, OpenSSL RC4 name incorrect, signature of FFI function botan_pubkey_destroy was wrong.
* Add power analysis countermeasures for ECC point multiplications.Jack Lloyd2015-08-211-49/+0
| | | | | | | | The plain PointGFp operator* now uses Montgomery ladder exclusively. Adds a blinded point multiply algorithm which uses exponent and point randomization, as well as a Montgomery ladder technique that takes a random walk of the possible addition chains for k.
* Restrict input values to NIST reductions to defined rangeJack Lloyd2015-08-081-3/+13
|
* Expose the NIST prime values and reduction operations as plain functions.Jack Lloyd2015-08-081-16/+138
| | | | | | Previously they were hidden away as private functions on the CurveGFp types. This allows directly testing the reduction functions against other computational methods.
* Better living through macrosJack Lloyd2015-07-241-30/+32
|
* BigInt::to_u32bit failed on 32-bit integers. GH #220Jack Lloyd2015-07-231-1/+47
|
* Make Botan compile when only some modules are enabledSimon Warta2015-07-031-0/+15
| | | | Fixes #146.
* Avoid DEBUG define; Use NDEBUG if necessarySimon Warta2015-07-031-3/+1
|
* ifstream/ostream take std::stringSimon Warta2015-06-231-1/+1
|