summaryrefslogtreecommitdiff
path: root/src/test/test_crypto.c
AgeCommit message (Collapse)Author
2018-05-24Add a unit test for PEM-encrypted documents.Nick Mathewson
2016-09-16Add support for AES256 and AES192Nick Mathewson
(This will be used by prop224)
2016-09-16Simplify the crypto_cipher_t interface and structureNick Mathewson
Previously, the IV and key were stored in the structure, even though they mostly weren't needed. The only purpose they had was to support a seldom-used API where you could pass NULL when creating a cipher in order to get a random key/IV, and then pull that key/IV back out. This saves 32 bytes per AES instance, and makes it easier to support different key lengths.
2016-09-09Make a couple more tests run faster.Nick Mathewson
The point of diminishing returns has been reached.
2016-09-09Move the donna-fuzzing tests into test_slow.Nick Mathewson
This shaves another 3-4 seconds off the main-path tests for me, which is again worth it, according to XKCD#1204.
2016-09-06checkSpace.pl now forbids more identifiers.Nick Mathewson
The functions it warns about are: assert, memcmp, strcat, strcpy, sprintf, malloc, free, realloc, strdup, strndup, calloc. Also, fix a few lingering instances of these in the code. Use other conventions to indicate _intended_ use of assert and malloc/realloc/etc.
2016-08-23Introduce ed25519_{sign,checksig}_prefixed functions().George Kadianakis
2016-06-20Make base16_decodes return number of decoded bytesnikkolasg
base16_decodes() now returns the number of decoded bytes. It's interface changes from returning a "int" to a "ssize_t". Every callsite now checks the returned value. Fixes #14013 Signed-off-by: David Goulet <dgoulet@torproject.org>
2016-06-11Merge branch 'bug19180_easy_squashed'Nick Mathewson
2016-06-11Add -Wmissing-variable-declarations, with attendant fixesNick Mathewson
This is a big-ish patch, but it's very straightforward. Under this clang warning, we're not actually allowed to have a global variable without a previous extern declaration for it. The cases where we violated this rule fall into three roughly equal groups: * Stuff that should have been static. * Stuff that was global but where the extern was local to some other C file. * Stuff that was only global when built for the unit tests, that needed a conditional extern in the headers. The first two were IMO genuine problems; the last is a wart of how we build tests.
2016-06-09Reduce make check-spaces noiseAndrea Shepard
2016-06-06Repair test_crypto_openssl_version with LibreSSLNick Mathewson
2016-06-06Check tor_sscanf return value in test_crypto.cNick Mathewson
Coverity noticed that we check tor_sscanf's return value everywhere else.
2016-06-02Use tor_sscanf, not sscanf, in test_crypto.cNick Mathewson
Fixes the 0.2.9 instance of bug #19213, which prevented mingw64 from working. This case wasn't in any released Tor.
2016-05-18Fix a bad sizeof() in test_crypto.c. Harmless. Spotted by coverity.Nick Mathewson
2016-05-16Fix memory leak in test_crypto_aes_ctr_testvecNick Mathewson
2016-05-16Windows lacks truncate(3).Nick Mathewson
Fix the new crypto tests, which used truncate(3).
2016-05-16Cover all our DH code, and/or mark it unreachable.Nick Mathewson
2016-05-16At long last, unit tests for degenerate DH public keys.Nick Mathewson
Apparently, we detect and reject them correctly. Aren't you glad?
2016-05-16Slight improvements to DH coverage.Nick Mathewson
2016-05-16Improve test coverage of our strongest-rng code.Nick Mathewson
2016-05-16Test coverage on ed25519 load/store functions.Nick Mathewson
2016-05-16HKDF-SHA256 test vectors from RFC5869Nick Mathewson
2016-05-03Ed25519 test vectors from draft-irtf-cfrg-eddsa-05Nick Mathewson
2016-05-03Add test vector for AES_CTR from NIST SP800-38a sec F.5Nick Mathewson
2016-05-03Add test vector for Curve25519 from RFC7748Nick Mathewson
2016-05-03tests for some of the simpler functions in crypto.cNick Mathewson
2016-05-03White-box tests for crypto_rand_*_range(), rand_hostname().Nick Mathewson
Coverage-driven; part of ticket 16794.
2016-02-27Update the copyright year.Nick Mathewson
2016-02-23Merge branch 'bug17795'Nick Mathewson
2016-02-10Another automated rename.Nick Mathewson
Also simplify crypto_common_digests() to have no loop.
2016-02-10Rename crypto_digest_all, and digests_t.Nick Mathewson
They are no longer "all" digests, but only the "common" digests. Part of 17795. This is an automated patch I made with a couple of perl one-liners: perl -i -pe 's/crypto_digest_all/crypto_common_digests/g;' src/*/*.[ch] perl -i -pe 's/\bdigests_t\b/common_digests_t/g;' src/*/*.[ch]
2016-02-03Make crypto/rng_engine test pass on libressl. Bug not in any released tor.Nick Mathewson
2016-02-03Make Tor build happily with OpenSSL master and libressl.Nick Mathewson
Also tested with 1.0.0t and 1.0.2f. Closes ticket 19784. Closes most of 17921. (Still need to make some tests pass.)
2016-01-15Whitespace cleanupNick Mathewson
2015-12-23Unit tests for crypto_force_rand_ssleay().Nick Mathewson
Part of 16794.
2015-12-23Always test both ed25519 backends.Nick Mathewson
Part of #16794
2015-12-20Appease "make check-spaces"Nick Mathewson
2015-12-20Add the randomized large buffer test for SHA-3 incremental hashing.Yawning Angel
This creates a random 100 KiB buffer, and incrementally hashes (SHA3-512) between 1 and 5 * Rate bytes in a loop, comparing the running digest with the equivalent one shot call from the start of the buffer.
2015-12-19Add `crypto_xof_t` and assorted routines, backed by SHAKE256.Yawning Angel
This is an eXtendable-Output Function with the following claimed security strengths against *all* adversaries: Collision: min(d/2, 256) Preimage: >= min(d, 256) 2nd Preimage: min(d, 256) where d is the amount of output used, in bits.
2015-12-19Add the SHA-3 hash functions to common/crypto.h.Yawning Angel
* DIGEST_SHA3_[256,512] added as supported algorithms, which do exactly what is said on the tin. * test/bench now benchmarks all of the supported digest algorithms, so it's possible to see just how slow SHA-3 is, though the message sizes could probably use tweaking since this is very dependent on the message size vs the SHA-3 rate.
2015-11-27Unit test the full length of SHA256 and SHA512 digeststeor (Tim Wilson-Brown)
Bugfix on a tor version before the refactoring in git commit cea12251995d (23 Sep 2009). Patch by "teor".
2015-11-26Merge remote-tracking branch 'teor/rand-failure-modes-v2'Nick Mathewson
2015-11-26Fix buffer size in sha512 unit testNick Mathewson
Nobody likes a stack overflow, even in unit tests. Closes 17699; but not in any released tor.
2015-11-26Add unit tests that check for common RNG failure modesteor (Tim Wilson-Brown)
Check that crypto_rand doesn't return all zeroes, identical values, or incrementing values (OpenSSL's rand_predictable feature).
2015-11-24add SHA512 support to cryptoGeorge Tankersley
2015-07-16Break some wide linesNick Mathewson
2015-07-06Integrate and enable ed25519-donna.Yawning Angel
The runtime sanity checking is slightly different from the optimized basepoint stuff in that it uses a given implementation's self tests if available, and checks if signing/verification works with a test vector from the IETF EdDSA draft. The unit tests include a new testcase that will fuzz donna against ref0, including the blinding and curve25519 key conversion routines. If this is something that should be done at runtime (No?), the code can be stolen from there. Note: Integrating batch verification is not done yet.
2015-07-06Integrate the accelerated Curve25519 scalar basemult.Yawning Angel
Integration work scavanged from nickm's `ticket8897_9663_v2` branch, with minor modifications. Tor will still sanity check the output but now also attempts to catch extreme breakage by spot checking the optimized implementation vs known values from the NaCl documentation. Implements feature 9663.
2015-05-28Merge branch '12498_ed25519_keys_v6'Nick Mathewson
Fixed numerous conflicts, and ported code to use new base64 api.