Commit Graph

323 Commits

Author SHA1 Message Date
Frank Denis
c48eaad3cd Don't require too much memory for the pwhash_argon2i() test
so that the Javascript version can run in web browsers
2015-12-29 17:54:21 +01:00
Frank Denis
7a95e921ac Add tests for pwhash_argon2i 2015-12-29 17:12:23 +01:00
Frank Denis
14bf02af88 Rename the pwhash test as as pwhash_scrypt 2015-12-29 16:14:19 +01:00
Frank Denis
d839d74c89 lcov exclusion 2015-12-25 02:09:12 +01:00
Frank Denis
9784038ad0 Check crypto_box_detached() with a small order pk 2015-12-25 02:01:51 +01:00
Frank Denis
2f1cec7352 Test crypto_box_beforenm() with a small order pk 2015-12-25 02:00:01 +01:00
Frank Denis
b80d037b4d Check that crypto_box[_beforenm] fails with a small order pk 2015-12-24 19:35:05 +01:00
Frank Denis
60d05339fd Constify 2015-12-24 19:00:42 +01:00
Frank Denis
386ce83df1 Test crypto_onetimeauth_update() with a null size 2015-12-22 14:32:14 +01:00
Brian Silverman
63b82c28e9 Use the right type for sizeof's result 2015-12-16 22:54:06 -05:00
Frank Denis
b977a53d1d printf("%llu") is not expected work on mingw32/Windows XP. 2015-12-10 16:38:26 +01:00
Frank Denis
054579d3bb Remove dead globals, bump the number of rounds in the box{7,8} tests 2015-12-09 01:43:57 +01:00
Frank Denis
d9e38003dc Reduce the number of rounds in the box7 test, use guarded memory 2015-12-09 01:41:30 +01:00
Frank Denis
fb09514949 Shorten the verify1 test 2015-12-09 01:37:58 +01:00
Frank Denis
ea43d1b18b Shorten auth7 2015-12-07 17:41:20 +01:00
Frank Denis
4bf74c7574 C++ compat 2015-12-07 10:46:03 +01:00
Frank Denis
48b9c4e75c Ignore test/default/browser, import HTML template 2015-12-07 09:57:49 +01:00
Frank Denis
43c25a343b Reduce box8 even more 2015-12-07 09:43:34 +01:00
Frank Denis
8e54dd6d5f Use guarded memory for the box8 test 2015-12-07 09:32:53 +01:00
Frank Denis
3e2bef97dc Reduce a few expensive tests 2015-12-07 09:09:04 +01:00
Frank Denis
7ada62b1ff Reduce some test cases, generate html test files 2015-12-07 08:58:35 +01:00
Frank Denis
e262425a4a Reduce even more, for Chrome 2015-12-07 02:16:22 +01:00
Frank Denis
1600ccfdda On a web browser, reduce the number of vectors for the sign test 2015-12-07 02:12:44 +01:00
Frank Denis
0eaa2294a4 Revert "Output signatures prefix in the signature test"
This reverts commit c73cbc42d9.
2015-12-07 02:04:22 +01:00
Frank Denis
c73cbc42d9 Output signatures prefix in the signature test 2015-12-07 01:57:53 +01:00
Frank Denis
3d1e11fe81 Support a BROWSER_TESTS env variable to build tests for browsers 2015-12-07 01:44:33 +01:00
Frank Denis
ec6b86611f More checks for sodium_add() (overlaps) and sodium_increment() 2015-12-06 19:06:27 +01:00
Frank Denis
27ce39ebbe Add a test with a null message in box_easy() 2015-11-27 14:18:43 +01:00
Frank Denis
b482401b46 Add tests with null message in secretbox_easy.c 2015-11-27 14:13:21 +01:00
Frank Denis
ba6833cc16 Use sodium_malloc() for the secretbox_easy2 test 2015-11-27 12:30:13 +01:00
Frank Denis
2e5c94a34f Use guarded memory for the box_easy2() test
+ non-deterministic buffer sizes
2015-11-27 12:13:58 +01:00
Frank Denis
4ec7fb481d Remove generichash tests with invalid parameters
They must be reintroduced at some point, probably by overriding
the `abort` symbol.
2015-11-27 11:00:29 +01:00
Frank Denis
1c8e34577f Less deterministic crypto_verify_*() tests 2015-11-25 14:10:36 +01:00
Frank Denis
d8b9b395a3 Mark everything as static in tests 2015-11-23 16:07:13 +01:00
Frank Denis
5e17a7adf8 Check that scalarmult() returns -1 with a point of small order
325606250916557431795983626356110631294008115727848805560023387167927233504
is a point of order 8
2015-11-17 11:07:37 +01:00
Frank Denis
2bc5874874 Check that the output of X25519 is not the all-zero value
Return -1 if this happens, and mark crypto_scalarmult() as warn_unused_result
Mark dependent functions with warn_unused_result as well
2015-11-17 11:07:33 +01:00
Frank Denis
9337ecfa60 Add tests for sodium_add(), more tests for sodium_increment() and is_zero() 2015-11-16 23:22:01 +01:00
Frank Denis
7561a25d5a Add a is_zero() helper 2015-11-13 01:48:34 +01:00
Frank Denis
debed38314 Check a return value in the secretbox_easy2 test 2015-11-01 14:45:35 +01:00
Frank Denis
17bcbbbd45 Force functions whose result must be checked to be checked 2015-11-01 13:57:51 +01:00
Frank Denis
26fdfec99b Add sodium_runtime_has_ssse3() and sodium_runtime_has_sse41() 2015-10-31 23:42:44 +01:00
Frank Denis
84695c8d42 Make sodium_compare() work on little-endian numbers as expected 2015-10-31 22:36:54 +01:00
Frank Denis
a1e4d3df3f Add AES256-GCM tests for decryption of truncated ciphertext 2015-10-30 19:47:47 +01:00
Frank Denis
688e1c4742 C++ compat 2015-10-26 22:48:56 +01:00
Frank Denis
437ce023c9 Exercise ChaCha20 with different output sizes 2015-10-26 21:30:46 +01:00
Frank Denis
771e32bd18 CompCert compatibility 2015-10-26 16:59:28 +01:00
Frank Denis
4b1478cd5b Extra sanity checks for blake2b_salt_personal() 2015-10-25 01:57:07 +02:00
Frank Denis
5d0236c25e C++ compat 2015-10-21 17:42:22 +02:00
Frank Denis
143e1c1a14 Do not compile unused sections 2015-10-18 01:33:35 +02:00
Frank Denis
1cfa5ec6c1 Add Blake2b test vectors from the reference code 2015-10-18 00:55:10 +02:00
Frank Denis
f01c303631 Blake2b: refuse a NULL key with a length > 0 2015-10-18 00:27:03 +02:00
Frank Denis
eeb31af578 Let crypto_generichash_statebytes() return a size rounded to the alignment
Add similar check in the aead_aes256gcm test.
2015-10-18 00:16:05 +02:00
Frank Denis
a2c8ff5ccb Visual Studio doesn't have %zu 2015-10-17 21:32:25 +02:00
Frank Denis
d667efde68 Add sodium_compare()
A constant-time version of memcmp(), useful to compare nonces and counters
in little-endian format, that plays well with sodium_increment().

Unlike sodium_memcmp() which can compare anything for equality,
sodium_compare() is designed to compare things that are comparable, byte by
byte. Therefore, the prototype is slightly different: its arguments are
supposed to be `const unsigned char *`.

The names sodium_memcmp() and sodium_compare() are slightly confusing.
But we're not going to rename sodium_memcmp(), and I cannot think of a
better name for sodium_compare() than sodium_compare().
2015-10-17 21:25:30 +02:00
Frank Denis
2aef671fd9 Indent 2015-10-17 21:10:52 +02:00
Frank Denis
bfed7b91b6 Explicit cast 2015-10-14 15:54:27 +02:00
Frank Denis
2ee2e86f80 Explicit cast 2015-10-14 11:29:38 +02:00
Frank Denis
f169623d4e C++ compat 2015-10-12 14:44:00 +02:00
Frank Denis
84625742c6 More test vectors 2015-10-12 13:58:10 +02:00
Frank Denis
40ba7ea531 More test vectors
from http://www.ieee802.org/1/files/public/docs2011/bn-randall-test-vectors-0511-v1.pdf
2015-10-12 10:03:09 +02:00
Frank Denis
98550acafb Add tests for the aes256gcm functions returning sizes
Which spotted a typo by the way.
2015-10-11 19:19:31 +02:00
Frank Denis
7082a3c8d1 Ignore the aes256gcm test if aes256gcm hasn't been compiled in 2015-10-11 19:14:29 +02:00
Frank Denis
20e384988c Test for presence of new sodium_runtime_has_*() functions 2015-10-11 18:51:30 +02:00
Frank Denis
c8be336506 C++ compat 2015-10-11 14:35:32 +02:00
Frank Denis
aa965a580b Expose only crypto_aead_aes256gcm_*() not crypto_aead_aes256gcm_aesni_*()
libsodium typically doesn't expose specific implementations.
It shouldn't be the case for that construction either, especially since
an ARM8 implementation might be added later.
We want a single interface for both.
2015-10-11 14:29:25 +02:00
Frank Denis
dadc5d9906 Add crypto_aead_aes256gcm_aesni_is_available() 2015-10-11 13:05:32 +02:00
Frank Denis
93295855cf Add aes256gcm test vectors 2015-10-11 12:56:20 +02:00
Frank Denis
dca2131f45 C++ compat 2015-09-21 16:05:53 +02:00
Frank Denis
6be1ce3f34 scalarmult: add the exact test from the irtf-cfrg-curves draft
Use guarded memory by the way.
2015-09-21 15:45:32 +02:00
Frank Denis
7fa840e486 C++ compat 2015-09-09 17:42:38 +02:00
Frank Denis
8ee4950eb3 Use sodium_malloc() for the secretbox_*() tests 2015-09-09 10:00:18 +02:00
Frank Denis
0f1f8a6ea6 Check that secretbox works as expected when m and c are overlapping 2015-09-09 09:00:08 +02:00
Frank Denis
f51fb6a90e Add a test for crypto_secretbox() with c == m 2015-09-09 08:51:19 +02:00
Frank Denis
90d9f5debd Remove bashisms in nacl-test-wrapper.sh 2015-08-02 14:39:17 +02:00
Frank Denis
7fca230be8 Nits after pnacl merge 2015-08-02 13:53:22 +02:00
Frank Denis
f610f781f2 Merge remote-tracking branch 'arbinger/pnacl' into nacl
* arbinger/pnacl:
  removed comment
  Added .final and .nexe output files to CLEANFILES
  revert original hack
  Initial patch for Chrome NaCl implementation
  Added patch to obtain random bytes for Chrome NaCl via IRT -- allows build with NaCl SDK toolchain
2015-08-02 12:54:05 +02:00
Frank Denis
c8e8983430 Test crypto_stream_*() with an output buffer previously filled with junk
Obviously, the previous content shouldn't change the output.
2015-07-21 13:37:06 +02:00
James Robson
e119c3e502 Added .final and .nexe output files to CLEANFILES 2015-06-22 14:16:07 -05:00
James Robson
1b633bb8ca Merge branch 'master' into pnacl 2015-06-22 13:19:33 -05:00
James Robson
34a4931d9a Initial patch for Chrome NaCl implementation 2015-06-22 13:02:21 -05:00
Frank Denis
e2fca8cac5 Add sodium_increment() 2015-06-22 15:44:58 +02:00
Frank Denis
bf920dc717 Add IETF-compatible version of chacha20poly1305 2015-05-09 16:12:03 +02:00
Frank Denis
ee97d5e3f8 Add tests for custom randombytes_uniform.
Check for crypto_auth_hmacsha512256_statebytes() presence.
2015-05-09 15:54:18 +02:00
Frank Denis
1b0e51da5e Use sodium_malloc() in the pwhash test. 2015-05-01 17:35:45 +02:00
Frank Denis
eb4e9e48f9 Turn ASAN errors into warnings in sodium_utils{2,3} tests 2015-04-24 15:11:29 +02:00
Frank Denis
575ce93058 + crypto_box_seal() 2015-04-17 01:01:32 +02:00
Frank Denis
f379ab8766 Add a test for sodium_allocarray(0, x) 2015-03-23 21:47:44 +01:00
Frank Denis
3316db5c87 Use proper nonce length now that's it's a pointer in box_easy2 test. 2015-02-17 18:42:57 +01:00
Frank Denis
a1b3da7dd9 Add crypto_stream_xsalsa20_ic() 2015-02-02 21:27:19 +01:00
Frank Denis
666fd4323b Add a test for crypto_stream_salsa20_xor_ic() 2015-02-02 21:27:12 +01:00
Frank Denis
5db61c617b Add statebytes for crypto_hmac_* 2015-01-23 23:08:49 +01:00
Frank Denis
b5deb4d070 + crypto_hash_sha(256|512)_statebytes 2015-01-23 11:17:40 +01:00
Frank Denis
9e538624f4 + crypto_generichash_statebytes() 2015-01-23 11:00:57 +01:00
Frank Denis
c9ba75a48f Add crypto_generichash_statebytes()
sizeof() is not always an option when accessing the library from
other languages.
2015-01-23 10:56:01 +01:00
Frank Denis
4921836512 Move quirks inclusion to cmptest.h, emscsripten quirks to quirks.h 2015-01-23 10:41:28 +01:00
Frank Denis
4724440492 quirks\windows\windows-quirks.h -> quirks\quirks.h 2015-01-23 10:35:20 +01:00
Frank Denis
8088e486ee strcmp() with optimization level > 1 is broken on Emscripten (!)
Trivial workaround that should eventually go to the quirks file
until this is fixed in Emscripten.
2015-01-22 19:06:21 +01:00
Frank Denis
388baa5380 Add an extra test for randombytes 2015-01-18 10:34:31 +01:00
Frank Denis
feaba594db || -> | spotted by Ahmad 2015-01-18 10:17:53 +01:00
Frank Denis
add0fcede4 randombytes_random() is 32 bits, even in JS. 2015-01-18 09:50:17 +01:00