aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/tests.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add positive DH test vectors from NIST CAVPRené Korthaus2017-01-021-0/+21
|
* Improve filter testsJack Lloyd2016-12-311-1/+1
| | | | | | | Fix a bug in Pipe::check_available that must date back 15 years... Add destructors to compression filter so unique_ptr destructor runs without user having to include an extra header for the owned type.
* Add more tests for random prime and DL group generationJack Lloyd2016-12-301-0/+12
|
* Add test option --run-long-testsJack Lloyd2016-12-241-15/+25
| | | | | | Previously longer tests were hidden behind higher 'soak levels' but these arbitrary cutoffs are confusing compared to a simple short tests/long tests split.
* Minor refactoring of Text_Based_TestJack Lloyd2016-12-191-17/+5
| | | | | | 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.
* Fix off by one in PKCS #1 v1.5 decryption decodingJack Lloyd2016-12-081-0/+14
| | | | | | | | | | | | When the code was changed in b8966d0f89e, the offset was not changed, so it would reject ciphertexts with exactly 8 bytes of random padding (the required minimum). Found by pkcs1 fuzzer which also had problems due to not having been updated at the same time. Add a test suite for decoding of PK decryption padding to cover the problem cases.
* Add test for various functions previously missed (T::clone, PBKDF::name, ↵Jack Lloyd2016-11-261-1/+11
| | | | | | | AEAD::output_length) Fix a bug in CCM, GCM, and OCB decryption which caused `output_length(tag_size())` to fail even though empty plaintexts are certainly defined for all three modes.
* Better OCSP tests including online testsJack Lloyd2016-11-231-0/+9
| | | | Tests touching network are gated by --run-online-tests flag.
* Add missing try/catch blocks.Jack Lloyd2016-10-071-2/+10
| | | | Document that create_*_op is public but not for public consumption.
* New TLS positive and negative tests.Juraj Somorovsky2016-09-301-0/+23
| | | | | | | | | | | | | | | | | | | TLS message parsing: - CertificateVerify - HelloVerify - ClientHello (with extensions) - ServerHello (with extensions) - NewSessionTicket - Alert TLS message processing: - HelloVerify TLS Policy tests Unit tests with TLS client authentication Added test_throws method that checks the correct exception message.
* Add T::provider() to allow user to inquire about implementation usedJack Lloyd2016-09-151-0/+7
| | | | | For block ciphers, stream ciphers, hashes, MACs, and cipher modes. Cipher_Mode already had it, with a slightly different usage.
* Fix build on PowerPC. Fix test runs on non-x86Jack Lloyd2016-09-151-4/+1
|
* Add cpuid overload to test frameworkJack Lloyd2016-09-151-15/+98
|
* RNG changes (GH #593)Jack Lloyd2016-08-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* fix minimized build when pkcs11 module enabledDaniel Neus2016-08-201-0/+12
|
* add OctetString unit testsDaniel Neus2016-07-201-0/+17
| | | | and add the possibility to compare OctetStrings with the botan test-framework
* add PKCS#11 supportDaniel Neus2016-06-171-28/+9
|
* Add more tests for ffiRené Korthaus2016-03-251-0/+14
|
* String comparision fixesDaniel Neus2016-01-041-2/+2
| | | | fix PVS-Studio perfomance warnings
* some trivial compiler/PVS-Studio warning fixesDaniel Neus2015-12-221-3/+3
|
* Add missing try/catch in signature verification test.Jack Lloyd2015-12-211-6/+10
| | | | | | Improve diagnostics when an exception escapes a test GH #369
* Add --data-dir option to test commandJack Lloyd2015-12-201-26/+23
| | | | | | | Understand using '-' on the command line to mean stdin Fix last few unit tests that wanted to write to the filesystem; removes outdata directory.
* If skipping a test due to diabled algo, only print if in verbose mode.Jack Lloyd2015-12-191-1/+5
| | | | | | Also fix KDF tests which failed on missing algo GH #367
* CLI rewriteJack Lloyd2015-12-191-18/+6
| | | | | | | | | | | | | | | | | | The command line tools' origin as a collection of examples and test programs glued together led to some unfortunate problems; lots of hardcoded values, missing parameters, and obsolete crypto. Adds a small library for writing command line programs of the sort needed here (cli.h), which cuts the length of many of the commands in half and makes commands more pleasant to write and extend. Generalizes a lot of the commands also, eg previously only signing/verification with DSA/SHA-1 was included! Removes the fuzzer entry point since that's fairly useless outside of an instrumented build. Removes the in-library API for benchmarking.
* Reroot the exception hierarchy into a toplevel Exception classJack Lloyd2015-12-111-14/+14
| | | | | | | | 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
* Convert const char* arguments on Test:: to std::stringsJack Lloyd2015-11-281-32/+21
| | | | unless they are actually optional
* Add helper for test output files. Remove last uses of hardcoded data dir macrosJack Lloyd2015-11-161-2/+15
|
* Add TLS_PSK testsJack Lloyd2015-11-131-2/+2
| | | | | | | | | | | Fix a bug which rejected any short server key exchanges. These can occur with a plain PSK with short or empty identity hints. Disable SHA-224 by default. Remove some vestigal RC4 cruft. Push more on the TLS corruption tests.
* Avoid calling get_files_recursive on a possible non-directory.Jack Lloyd2015-11-111-8/+9
| | | | | | | | | The Boost directory iterator throws an exception in that case. Interestingly the current VC version does not seem to. In the interests of portability just avoid this operation rather than trying to hack around it in the Boost fs version. GH #328
* Fix occasional test failsJack Lloyd2015-11-111-0/+17
| | | | | | | | 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-241/+643
| | | | | | | | | | | 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.
* Fix cert validation bugs found by x509test.Jack Lloyd2015-10-231-2/+3
| | | | Add test suite with certs from x509test
* McEliece cleanupsJack Lloyd2015-09-291-0/+2
| | | | | | | | | | | | | | | | | | | | Remove and consolidate various headers Reduce memory usage of GF2m_Field by sharing the log and exponent tables across all instances of a particular word size. Remove McEliece_Public_Operation and McEliece_Private_Operation which were difficult to use safely. Instead only the KEM operations are exposed. Add McEliece_PublicKey::random_plaintext_element Add command line `mce` tool and some McEliece documentation Convert the speed program to check McEliece keys of the suggested size Add McEliece KATs for both key generation and KEM Fix HMAC_DRBG constructor which derefed a pointer before its time
* Add power analysis countermeasures for ECC point multiplications.Jack Lloyd2015-08-211-0/+1
| | | | | | | | 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.
* Fix two crashes in the BER decoder found with afl.Jack Lloyd2015-08-021-0/+1
| | | | | One a read at 0 of an empty vector, the other causing allocation of an arbitrary amount of memory.
* Refactor internal/filesystem.hSimon Warta2015-07-161-6/+15
| | | | Closes #198
* Add initial catchy test: base64Simon Warta2015-07-151-0/+19
|
* Check if there are test vector files in a given test dirSimon Warta2015-07-151-2/+8
|
* Improve test reportingSimon Warta2015-07-151-6/+8
|
* Add seperator above test summarySimon Warta2015-07-031-0/+1
|
* Add missing test report for TSS testsSimon Warta2015-06-251-0/+1
|
* Replace \n by std::endl in tests to ensure proper flushingSimon Warta2015-06-191-10/+10
| | | | | | | - Remove additional newlines in CHECK_MESSAGE call - Remove redundant output of algo in aead_test() Closes #115
* Add tests for compression and SRP.lloyd2015-05-131-0/+2
| | | | | | | | Fix zlib decompression which was not ignoring Z_BUF_ERROR which is harmless in this context as process is already checking avail_in and avail_out after run returns. Bump version to 1.11.17
* Hide all uses of boost filesystem in fs.cpp. Use readdir as anlloyd2015-02-211-24/+4
| | | | | alternate implementation for Unix and add some feature checks so a boost-free build of the tests and command line are possible again.
* Convert HKDF to the normal KDF interfacelloyd2015-02-181-1/+0
|
* Remove algo factory, engines, global RNG, global state, etc.lloyd2015-02-041-3/+0
| | | | | | | | | | | | | | | Convert all uses of Algorithm_Factory and the engines to using Algo_Registry The shared pool of entropy sources remains but is moved to EntropySource. With that and few remaining initializations (default OIDs and aliases) moved elsewhere, the global state is empty and init and shutdown are no-ops. Remove almost all of the headers and code for handling the global state, except LibraryInitializer which remains as a compatability stub. Update seeding for blinding so only one hacky almost-global RNG instance needs to be setup instead of across all pubkey uses (it uses either the system RNG or an AutoSeeded_RNG if the system RNG is not available).
* Ensure all files have copyright and license info.lloyd2015-01-101-0/+6
| | | | | Update license header line to specify the terms and refer to the file, neither of which it included before.
* All tests now share an RNG. Uses system RNG if availablelloyd2014-12-281-0/+16
|
* Add Curve25519 based on curve25519-donna by Adam Langley.lloyd2014-12-271-0/+1
| | | | | | This uses only the c64 version from curve25519-donna; on systems that don't have a native uint128_t type, a donna128 type stands in for just enough 128-bit operations to satisfy donna.cpp
* Add an implementation of McEliece encryption based on HyMESfstrenzke2014-11-261-0/+1
| | | | | | | (https://www.rocq.inria.fr/secret/CBCrypto/index.php?pg=hymes). The original version is LGPL but cryptsource GmbH has secured permission to release it under a BSD license. Also includes the Overbeck CCA2 message encoding scheme.