libsodium/test/default
Ilya Maykov 6bece9c8c4 Relax most __attribute__ ((nonnull)) to allow 0-length inputs to be NULL.
Justifications:
- crypto_(auth|hash|generichash|onetimeauth|shorthash)*:
  it's legal to hash or HMAC a 0-length message
- crypto_box*: it's legal to encrypt a 0-length message
- crypto_sign*: it's legal to sign a 0-length message
- utils:
  comparing two 0-length byte arrays is legal
  memzero on a 0-length byte array is a no-op
  converting an empty hex string to binary results in an empty binary string
  converting an empty binary string to hex results in an empty hex string
  converting an empty b64 string to binary results in an empty binary string
  converting an empty binary string to b64 results in an empty b64 string
  sodium_add / sodium_sub on zero-length arrays is a no-op

For the functions declared in utils.h, I moved the logic into private functions that
have the __attribute__ ((nonnull)) check, but they are only called when the
corresponding length argument is non-0. I didn't do this for the hash/box/sign
functions since it would have been a lot more work and quite a large refactor.

Only memset() may have issues with a zero length.

Fix tests, use guard page instead of NULL because of Wasm
2019-04-26 15:36:58 +02:00
..
aead_aes256gcm2.c Remove unused variables 2018-12-29 16:42:09 +01:00
aead_aes256gcm2.exp Add aes256gcm tests from project wycheproof 2018-08-30 09:51:28 +02:00
aead_aes256gcm.c Use a guard page instead of NULL for opt arguments in tests 2018-12-24 15:02:59 +01:00
aead_aes256gcm.exp
aead_chacha20poly1305.c Use a guard page instead of NULL for opt arguments in tests 2018-12-24 15:02:59 +01:00
aead_chacha20poly1305.exp
aead_chacha20poly13052.c Remove unused variables 2018-12-29 16:42:09 +01:00
aead_chacha20poly13052.exp Add chacha20-poly1305 test from Project Wycheproof 2018-09-04 15:44:42 +02:00
aead_xchacha20poly1305.c Use a guard page instead of NULL for opt arguments in tests 2018-12-24 15:02:59 +01:00
aead_xchacha20poly1305.exp xchacha20 test: initialize the full nonce 2018-08-03 23:24:55 +02:00
auth2.c Indentx 2017-02-23 11:15:29 +01:00
auth2.exp
auth3.c Relax most __attribute__ ((nonnull)) to allow 0-length inputs to be NULL. 2019-04-26 15:36:58 +02:00
auth3.exp
auth5.c Relax most __attribute__ ((nonnull)) to allow 0-length inputs to be NULL. 2019-04-26 15:36:58 +02:00
auth5.exp
auth6.c Indentx 2017-02-23 11:15:29 +01:00
auth6.exp
auth7.c Relax most __attribute__ ((nonnull)) to allow 0-length inputs to be NULL. 2019-04-26 15:36:58 +02:00
auth7.exp
auth.c Relax most __attribute__ ((nonnull)) to allow 0-length inputs to be NULL. 2019-04-26 15:36:58 +02:00
auth.exp Test crypto_auth_hmacsha256_*() 2017-07-24 22:08:07 +02:00
box2.c More tests 2017-07-24 15:16:22 +02:00
box2.exp
box7.c Indent 2017-02-23 11:19:53 +01:00
box7.exp
box8.c Indent 2017-02-23 11:19:53 +01:00
box8.exp
box_easy2.c Test crypto_box_open_detached() with a weak PK 2017-07-29 21:34:28 +02:00
box_easy2.exp
box_easy.c Relax most __attribute__ ((nonnull)) to allow 0-length inputs to be NULL. 2019-04-26 15:36:58 +02:00
box_easy.exp Add a test with a null message in box_easy() 2015-11-27 14:18:43 +01:00
box_seal.c Indent 2017-02-23 11:27:45 +01:00
box_seal.exp
box_seed.c Indent 2017-02-23 11:19:53 +01:00
box_seed.exp
box.c Add *_messagebytes_max() wrappers 2017-08-03 13:34:31 +02:00
box.exp
chacha20.c Use chacha20_ietf in the tv_ietf test 2018-10-18 00:43:55 +02:00
chacha20.exp Use chacha20_ietf in the tv_ietf test 2018-10-18 00:43:55 +02:00
cmptest.h Relax most __attribute__ ((nonnull)) to allow 0-length inputs to be NULL. 2019-04-26 15:36:58 +02:00
codecs.c Relax most __attribute__ ((nonnull)) to allow 0-length inputs to be NULL. 2019-04-26 15:36:58 +02:00
codecs.exp Relax most __attribute__ ((nonnull)) to allow 0-length inputs to be NULL. 2019-04-26 15:36:58 +02:00
core1.c Indent 2017-02-23 11:19:53 +01:00
core1.exp
core2.c Indent 2017-02-23 11:19:53 +01:00
core2.exp
core3.c Remove tests for deprecated functions 2017-12-11 23:22:34 +01:00
core3.exp Add some tests for reduced-rounds salsa20 2017-12-06 13:38:46 +00:00
core4.c Fix format string sign 2017-12-01 15:28:09 +01:00
core4.exp
core5.c Indent 2017-02-23 11:19:53 +01:00
core5.exp
core6.c Indent 2017-02-23 11:19:53 +01:00
core6.exp
core_ed25519.c Add another test 2019-01-05 23:11:02 +01:00
core_ed25519.exp Add another test 2019-01-05 23:11:02 +01:00
ed25519_convert.c ED25519_NONDETERMINISTIC: derive keys from the seed the same way 2018-12-25 13:25:57 +01:00
ed25519_convert.exp
generichash2.c C++ compat 2017-12-21 22:35:02 +01:00
generichash2.exp Require the generichash state to be aligned 2017-12-21 18:21:43 +01:00
generichash3.c Use a guard page instead of NULL for opt arguments in tests 2018-12-24 15:02:59 +01:00
generichash3.exp Remove generichash tests with invalid parameters 2015-11-27 11:00:29 +01:00
generichash.c Use a guard page instead of NULL for opt arguments in tests 2018-12-24 15:02:59 +01:00
generichash.exp Remove generichash tests with invalid parameters 2015-11-27 11:00:29 +01:00
hash2.exp
hash3.c Indentx 2017-02-23 11:25:09 +01:00
hash3.exp
hash.c Indentx 2017-02-23 11:25:09 +01:00
hash.exp
index.html.tpl Add actual performance API emulation for old browsers 2017-10-05 07:52:33 +02:00
kdf.c Nits 2019-01-02 16:17:35 +01:00
kdf.exp + crypto_kdf high-level API 2017-02-19 18:13:10 +01:00
keygen.c More keygen tests 2017-09-17 23:13:38 +02:00
keygen.exp Add a keygen function to all the primitives 2017-02-19 21:15:54 +01:00
kx.c Test KX with a weak PK 2017-07-29 21:46:14 +02:00
kx.exp + crypto_kx_*() API 2017-03-12 13:15:39 +01:00
Makefile.am Add chacha20-poly1305 test from Project Wycheproof 2018-09-04 15:44:42 +02:00
Makefile.in Add -pthread to pkgconfig's Libs.private if enabled 2019-01-15 00:29:20 +01:00
metamorphic.c casts 2017-12-01 17:29:41 +01:00
metamorphic.exp + simple metamorphic tests for crypto_generichash() 2017-09-17 21:41:32 +02:00
misuse.c C++ compat 2019-01-03 09:49:33 +01:00
misuse.exp More tests, and start testing misuse cases 2017-07-17 23:09:44 +02:00
nacl-test-wrapper.sh Consistency 2017-05-19 14:58:16 +02:00
onetimeauth2.c Indent 2017-02-23 11:20:37 +01:00
onetimeauth2.exp
onetimeauth7.c Indent 2017-02-23 11:20:37 +01:00
onetimeauth7.exp
onetimeauth.c More tests, and start testing misuse cases 2017-07-17 23:09:44 +02:00
onetimeauth.exp
pre.js.inc Javascript tests: don't call FS.*() if the filesystem module is not present 2017-12-21 21:36:56 +01:00
pwhash_argon2i.c Plug memory leaks in the pwhash_argon2* tests 2017-12-16 14:53:01 +01:00
pwhash_argon2i.exp Use less memory for the pwhash tests 2017-10-05 00:42:58 +02:00
pwhash_argon2id.c C++ compat 2019-01-03 09:49:33 +01:00
pwhash_argon2id.exp Use less memory for the pwhash tests 2017-10-05 00:42:58 +02:00
pwhash_scrypt_ll.c Fix previous 2017-02-25 21:01:52 +01:00
pwhash_scrypt_ll.exp
pwhash_scrypt.c Add tests for scrypt rehash 2017-09-13 18:47:55 +02:00
pwhash_scrypt.exp More tests for scrypt 2017-07-29 22:01:13 +02:00
randombytes.c emscripten: stick to the unique randombytes implementation 2017-12-21 00:33:27 +01:00
randombytes.exp Do not use a zero nonce in randombytes_buf_deterministic() 2017-03-09 13:57:37 +01:00
scalarmult2.c Indent 2017-02-23 11:22:00 +01:00
scalarmult2.exp
scalarmult5.c Indent 2017-02-23 11:22:00 +01:00
scalarmult5.exp
scalarmult6.c Indent 2017-02-23 11:22:00 +01:00
scalarmult6.exp
scalarmult7.c Indent 2017-02-23 11:22:00 +01:00
scalarmult7.exp
scalarmult8.c Add aes256gcm tests from project wycheproof 2018-08-30 09:51:28 +02:00
scalarmult8.exp Add x25519 test vectors from project wycheproof 2018-08-29 15:08:26 +02:00
scalarmult_ed25519.c Add tests for unclamped scalars 2018-12-18 23:11:15 +01:00
scalarmult_ed25519.exp Add a test for crypto_scalarmult_ed25519 2017-11-15 16:57:29 +01:00
scalarmult.c x25519-ref10: reject low order points before the multiplication 2017-11-17 10:47:00 +01:00
scalarmult.exp x25519-ref10: reject low order points before the multiplication 2017-11-17 10:47:00 +01:00
secretbox2.c More tests, and start testing misuse cases 2017-07-17 23:09:44 +02:00
secretbox2.exp
secretbox7.c Indent 2017-02-23 11:22:36 +01:00
secretbox7.exp
secretbox8.c Indent 2017-02-23 11:22:36 +01:00
secretbox8.exp
secretbox_easy2.c Remove incorrect and useless cast 2017-12-11 19:54:10 +01:00
secretbox_easy2.exp
secretbox_easy.c secrebox: add a test with in/out buffers next to each other 2017-07-29 22:27:17 +02:00
secretbox_easy.exp secrebox: add a test with in/out buffers next to each other 2017-07-29 22:27:17 +02:00
secretbox.c Add *_messagebytes_max() wrappers 2017-08-03 13:34:31 +02:00
secretbox.exp
secretstream.c secretstream: add a test for rekeying using TAG_REKEY 2017-12-06 11:45:47 +00:00
secretstream.exp Add a couple tests for crypto_secretstream_*() 2017-08-16 14:53:54 +02:00
shorthash.c Add a test for siphashx24 2017-02-24 19:23:14 +01:00
shorthash.exp
sign.c Nits 2019-01-02 16:17:35 +01:00
sign.exp Add ed25519ph 2017-03-05 14:45:13 +01:00
siphashx24.c Trim spaces 2017-02-24 19:23:55 +01:00
siphashx24.exp Add a test for siphashx24 2017-02-24 19:23:14 +01:00
sodium_core.c Check for RDRAND presence 2017-11-25 17:53:33 +01:00
sodium_core.exp Remove error string from sodium_misuse() 2017-07-19 00:57:19 +02:00
sodium_utils2.c Use a simple memory pool for benchmarks 2017-12-16 13:07:15 +01:00
sodium_utils2.exp
sodium_utils3.c Revert "+ sodium_alloc_overhead()" 2017-08-02 14:26:56 +02:00
sodium_utils3.exp
sodium_utils.c Relax most __attribute__ ((nonnull)) to allow 0-length inputs to be NULL. 2019-04-26 15:36:58 +02:00
sodium_utils.exp Relax most __attribute__ ((nonnull)) to allow 0-length inputs to be NULL. 2019-04-26 15:36:58 +02:00
sodium_version.c + sodium_library_minimal() and SODIUM_LIBRARY_MINIMAL 2017-03-06 09:47:09 +01:00
sodium_version.exp
stream2.c Make the stream and stream2 test object code 1000x smaller 2019-04-23 10:17:38 +02:00
stream2.exp
stream3.c Indent 2017-02-23 11:23:19 +01:00
stream3.exp
stream4.c Indent 2017-02-23 11:23:19 +01:00
stream4.exp
stream.c Make the stream and stream2 test object code 1000x smaller 2019-04-23 10:17:38 +02:00
stream.exp Just use some test vectors around the counter overflow 2019-04-23 10:17:25 +02:00
verify1.c Indentx 2017-02-23 11:23:50 +01:00
verify1.exp Less deterministic crypto_verify_*() tests 2015-11-25 14:10:36 +01:00
wintest.bat
xchacha20.c One more test 2017-12-06 13:53:22 +00:00
xchacha20.exp Add tests for chacha&salsa with a counter around 2^32 2017-03-03 10:14:08 +01:00