aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/tests.h
Commit message (Collapse)AuthorAgeFilesLines
* Minor refactoring of Text_Based_TestJack Lloyd2016-12-191-10/+2
| | | | | | 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-4/+2
| | | | | | 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 off by one in PKCS #1 v1.5 decryption decodingJack Lloyd2016-12-081-0/+2
| | | | | | | | | | | | 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-0/+2
| | | | | | | 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-1/+3
| | | | Tests touching network are gated by --run-online-tests flag.
* This range check was in the wrong directionJack Lloyd2016-11-171-1/+1
|
* Fix TLS corruption tests.Jack Lloyd2016-11-151-4/+7
| | | | | | | | | There is a simple bit flip corruption test for the TLS stack: we shouldn't negotiate correctly if any random bit gets flipped. But it turns out this is not entirely true as the record layer version field is effectively ignored except for distinguishing TLS vs DTLS. So a small bitflip in that field is sometimes ignored, causing the test to fail. Make sure we modify something in the body instead.
* New TLS positive and negative tests.Juraj Somorovsky2016-09-301-0/+3
| | | | | | | | | | | | | | | | | | | 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/+2
| | | | | For block ciphers, stream ciphers, hashes, MACs, and cipher modes. Cipher_Mode already had it, with a slightly different usage.
* Add cpuid overload to test frameworkJack Lloyd2016-09-151-0/+3
|
* fix minimized build when pkcs11 module enabledDaniel Neus2016-08-201-0/+2
|
* add OctetString unit testsDaniel Neus2016-07-201-0/+5
| | | | and add the possibility to compare OctetStrings with the botan test-framework
* Switch to HMAC_DRBG for all RNG generation.Jack Lloyd2016-07-171-1/+1
| | | | | | | | Add support and tests for additional_data param to HMAC_DRBG Add Stateful_RNG class which has fork detection and periodic reseeding. AutoSeeded_RNG passes the current pid and time as additional_data
* add PKCS#11 supportDaniel Neus2016-06-171-2/+37
|
* Add more tests for ffiRené Korthaus2016-03-251-0/+1
|
* cppcheck fixes: Class 'X' has a constructor with 1 argument that is not ↵Daniel Neus2016-03-051-2/+2
| | | | explicit.
* Add constant time conditional swap, add, sub for bigint wordsJack Lloyd2016-02-171-0/+7
| | | | | | | | | Not optimized and relies on asm support for const time word_add/word_sub instructions. Fix a bug introduced in 46e9a89 - unpoison needs to call the valgrind API with the pointer rather than the reference. Caused values not to be unpoisoned.
* Get rid of "extra ';'" warnings and force semicolon after macrosSimon Warta2016-01-111-1/+2
|
* Fix a few clang warnings. Set clang sanitizer flagsJack Lloyd2015-12-241-1/+0
|
* Add missing try/catch in signature verification test.Jack Lloyd2015-12-211-1/+1
| | | | | | Improve diagnostics when an exception escapes a test GH #369
* Add --data-dir option to test commandJack Lloyd2015-12-201-3/+7
| | | | | | | 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/+1
| | | | | | Also fix KDF tests which failed on missing algo GH #367
* CLI rewriteJack Lloyd2015-12-191-6/+15
| | | | | | | | | | | | | | | | | | 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-0/+6
| | | | | | | | 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-28/+24
| | | | unless they are actually optional
* New reseed_with_sources call on RNGsJack Lloyd2015-11-241-1/+8
| | | | | | | | | | | | | 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.
* Add helper for test output files. Remove last uses of hardcoded data dir macrosJack Lloyd2015-11-161-7/+26
|
* Avoid calling get_files_recursive on a possible non-directory.Jack Lloyd2015-11-111-1/+1
| | | | | | | | | 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/+4
| | | | | | | | 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-167/+315
| | | | | | | | | | | 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-0/+1
| | | | 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-1/+66
| | | | | | | | 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/+2
| | | | | One a read at 0 of an empty vector, the other causing allocation of an arbitrary amount of memory.
* Have an outdata dir for testsSimon Warta2015-07-151-0/+2
| | | | ... for peaceful development
* Fix TEST_DATA_DIRSimon Warta2015-07-151-3/+3
|
* Improve test reportingSimon Warta2015-07-151-1/+1
|
* Make Botan compile when only some modules are enabledSimon Warta2015-07-031-0/+30
| | | | Fixes #146.
* Add tests for compression and SRP.lloyd2015-05-131-0/+3
| | | | | | | | 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
* Externalize the state of a RFC 6979 nonce computation.lloyd2015-03-121-1/+0
| | | | | | | | | | | | This lets you amortize quite a few memory allocations (RNG, various BigInts, etc) over many nonce generations. Change generate_rfc6979_nonce to just instantiate one of these states, call the function once, and return. This doesn't have any additional overhead versus the previous implementation of this function. Fix HMAC_DRBG to correctly reset its state to its starting position when you call clear() on it.
* Convert HKDF to the normal KDF interfacelloyd2015-02-181-1/+0
|
* 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.
* All tests now share an RNG. Uses system RNG if availablelloyd2014-12-281-1/+3
|
* 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.
* Add some secp256k1 KATs and a randomized ECC test suggested inlloyd2014-10-101-0/+1
| | | | http://crypto.stackexchange.com/questions/784
* Add RFC 6979 nonce generator. Also some HMAC_DRBG cleanups.lloyd2014-03-221-0/+1
|
* Include build.h in tests.h so feature macro checks work consistently.lloyd2014-02-081-0/+1
|
* Split up test vectors into per-algo files and app into botan-test forlloyd2014-01-101-1/+11
| | | | the tests and botan for everything else.
* Cleanupslloyd2014-01-071-2/+0
|