1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-20 10:37:24 -07:00
Commit Graph

681 Commits

Author SHA1 Message Date
Frank Denis
e06c260d0e Lucet removed the "fast" optimization level
We may drop Lucet support entirely until the interface gets more stable
2019-10-11 16:36:27 +02:00
Frank Denis
80807b30c5 WASI can't read its own writes without an explicit fflush() 2019-09-13 11:17:55 +02:00
Frank Denis
612d60f54a lucetc-wasi requires units with --max-heap-size 2019-07-09 20:42:46 +02:00
Frank Denis
940ef42797 1.0.18 2019-05-30 21:57:51 +02:00
Frank Denis
39083793f5 Remove an unreliable scrypt test
Fixes #837
2019-05-21 13:15:37 +02:00
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
Frank Denis
be8cfedea8 Make the stream and stream2 test object code 1000x smaller 2019-04-23 10:17:38 +02:00
Frank Denis
0f155d8736 Be positive 2019-04-23 10:17:33 +02:00
Frank Denis
fb29bda055 Just use some test vectors around the counter overflow 2019-04-23 10:17:25 +02:00
Frank Denis
d57cde5448 Remove useless tests, add more meaningful ones. 2019-04-23 10:17:10 +02:00
Frank Denis
cb5f937ca7 Additional salsa20 tests 2019-04-23 10:16:54 +02:00
Frank Denis
2e2de69de3 constcheck: ignore deprecated declarations 2019-04-22 19:53:26 +02:00
Luca Boccassi
ecdcf55173 Add -pthread to pkgconfig's Libs.private if enabled
Allows static builds to correctly inherit the pthread dependency when
used with pkg-config --static --libs libsodium

AC_SUBST doesn't require explicit values

Regen autoconf

Fixes #800
2019-01-15 00:29:20 +01:00
Frank Denis
10ac185647 Merge branch 'master' into stable-1.0.17
* master: (190 commits)
  fileinput is not used any more
  2019
  local-dynamic is enough
  Set tls-model only if TLS is supported
  Enable -ftls-model=global-dynamic if available
  Set nonce in randombytes_salsa20_random_stir() instead of random_init()
  Bump .NET version examples
  Add another test
  Avoid memory leak and overflow in addition test
  Avoid partial array initialization
  Bump SODIUM_LIBRARY_VERSION_MINOR
  More tests
  More tests
  Improve clarity
  ALLOW_MEMORY_GROWTH is now enabled
  AVX512 detection has been improved
  Add a conditional to enable retpoline support
  must -> should
  Add comments, avoid implicit array initialization
  Add comments
  ...
2019-01-06 15:43:38 +01:00
Frank Denis
0cdf963799 Add another test 2019-01-05 23:11:02 +01:00
Frank Denis
909983a9d2 Avoid memory leak and overflow in addition test 2019-01-05 23:08:03 +01:00
Frank Denis
d4eec69ef1 More tests 2019-01-05 21:17:48 +01:00
Frank Denis
0205a8035e More tests 2019-01-05 20:56:22 +01:00
Frank Denis
7ac557498f C++ compat 2019-01-03 09:49:33 +01:00
Frank Denis
f0e9c368ea Nits 2019-01-02 16:17:35 +01:00
Frank Denis
bdfda5dc83 Nits 2019-01-02 16:14:15 +01:00
Frank Denis
d333f509a2 Add a test for sodium_sub() 2019-01-02 15:32:59 +01:00
Frank Denis
1542d473da Add crypto_core_ed25519_scalar_complement(), _negate(), _add(), _sub() 2018-12-30 01:48:58 +01:00
Frank Denis
cff3d7f6c7 Remove unused variables 2018-12-29 16:42:09 +01:00
Frank Denis
cce84d05b2 Use unsigned indices 2018-12-26 18:39:07 +01:00
Frank Denis
d3976446a0 ED25519_NONDETERMINISTIC: derive keys from the seed the same way
as when ED25519_NONDETERMINISTIC is not defined
2018-12-25 13:25:57 +01:00
Frank Denis
59bd82edab Add a crypto_core_ed25519_NONREDUCEDSCALARBYTES constant
and reject 0 in crypto_core_ed25519_random()
2018-12-24 17:26:38 +01:00
Frank Denis
8dd554d2c4 Leverage sodium_add() 2018-12-24 15:25:34 +01:00
Frank Denis
902f0997c0 Add a test for scalar_reduce() 2018-12-24 15:24:04 +01:00
Frank Denis
34e787030f Use a guard page instead of NULL for opt arguments in tests 2018-12-24 15:02:59 +01:00
Frank Denis
63573bb98c Add crypto_core_ed25519_scalar_random() 2018-12-23 12:32:07 +01:00
Frank Denis
6fa0220302 Export crypto_core_ed25519_scalar_reduce, add tests 2018-12-23 02:56:11 +01:00
Frank Denis
b6051b7ee2 Add tests for unclamped scalars 2018-12-18 23:11:15 +01:00
Frank Denis
0d948d4b7e Use chacha20_ietf in the tv_ietf test
Fixes #772
2018-10-18 00:43:55 +02:00
Frank Denis
cf217e3dfc Call misuse() if we ask too much data from the IETF variant of ChaCha20
Fix #753
2018-09-08 02:12:23 +02:00
Frank Denis
69a5643477 Add chacha20-poly1305 test from Project Wycheproof 2018-09-04 15:44:42 +02:00
Frank Denis
cb22446db1 Add aes256gcm tests from project wycheproof 2018-08-30 09:51:28 +02:00
Frank Denis
cdc4822c92 Remove unneeded trailing commas 2018-08-30 09:26:16 +02:00
Frank Denis
f8377e9818 Add x25519 test vectors from project wycheproof 2018-08-29 15:08:26 +02:00
Jakob Rieck
d7df251cd0 Fixes padding for blocksizes > 256 2018-08-27 12:22:07 +02:00
Jakob Rieck
543b5ad068 Fixes padding for blocksizes > 256 2018-08-27 11:42:49 +02:00
Frank Denis
49f112da5d xchacha20 test: initialize the full nonce
Spotted by @FiloSottile, thanks!

Fixes #742
2018-08-03 23:24:55 +02:00
Frank Denis
ccb2390e9c xchacha20 test: initialize the full nonce
Spotted by @FiloSottile, thanks!

Fixes #742
2018-08-03 23:23:53 +02:00
Frank Denis
415f079692 zap trailing spaces 2018-04-29 17:49:01 +02:00
Frank Denis
9c6b2e0ceb zap trailing spaces 2018-04-29 17:48:39 +02:00
Emil Bay
1600dda632 Missing test for abytes 2018-04-29 17:47:55 +02:00
Emil Bay
2ad8162218
Missing test for abytes 2018-04-12 17:24:10 +02:00
Frank Denis
06ee95c3f1 Regen autoconf scripts 2018-03-14 12:03:49 -07:00
Frank Denis
6a60818982 C++ compat 2017-12-21 22:35:02 +01:00
Frank Denis
8a2833f01a Remove the dummy FS call from the Javascript tests 2017-12-21 21:37:02 +01:00
Frank Denis
72ab8739a2 Javascript tests: don't call FS.*() if the filesystem module is not present 2017-12-21 21:36:56 +01:00
Frank Denis
6b38e87f01 Remove the dummy FS call from the Javascript tests 2017-12-21 21:36:15 +01:00
Frank Denis
f8ad9651f9 Javascript tests: don't call FS.*() if the filesystem module is not present 2017-12-21 21:27:50 +01:00
Frank Denis
bd631649c1 Emscripten: run the tests in benchmark mode 2017-12-21 18:52:59 +01:00
Frank Denis
eeb135010d Emscripten: run the tests in benchmark mode 2017-12-21 18:51:56 +01:00
Frank Denis
69834d667e Static 2017-12-21 18:50:11 +01:00
Frank Denis
d7f8f6bc80 Static 2017-12-21 18:47:43 +01:00
Frank Denis
0187ba70ad Require the generichash state to be aligned
Alignment is already required by other functions anyway.
2017-12-21 18:21:43 +01:00
Frank Denis
1e7839a90c Lift alignment requirements in crypto_generichash() 2017-12-21 18:14:17 +01:00
Frank Denis
266571b5b1 Use default randombytes implementation for tests on emscripten 2017-12-21 02:04:21 +01:00
Frank Denis
dce1614eee Use default randombytes implementation for tests on emscripten 2017-12-21 02:02:39 +01:00
Frank Denis
dd0aa7cccf emscripten: stick to the unique randombytes implementation 2017-12-21 00:33:27 +01:00
Frank Denis
13201046e6 emscripten: stick to the unique randombytes implementation 2017-12-21 00:32:42 +01:00
Frank Denis
69642f0409 Undefine printf if required 2017-12-16 21:01:23 +01:00
Frank Denis
83b031bfd7 Undefine printf if required 2017-12-16 21:01:12 +01:00
Frank Denis
192fd92cc7 Plug memory leaks in the pwhash_argon2* tests 2017-12-16 14:53:01 +01:00
Frank Denis
bfc8ec1248 Add a memleak checker to the benchmark code
Plug the leaks it surfaced in pwhash_argon2* tests
2017-12-16 14:51:11 +01:00
Frank Denis
afbef83c6b Add missing sodium_free() calls in the kdf test 2017-12-16 14:31:41 +01:00
Frank Denis
b84e4b9ddf Add missing sodium_free() calls in the kdf test 2017-12-16 14:31:01 +01:00
Frank Denis
765710c1f4 Sort 2017-12-16 13:29:53 +01:00
Frank Denis
7e02306443 + #include <limits.h> 2017-12-16 13:29:49 +01:00
Frank Denis
99fe302562 Make things more explicit 2017-12-16 13:12:07 +01:00
Frank Denis
b6dab1029d Sort 2017-12-16 13:08:55 +01:00
Frank Denis
31b13ada14 + #include <limits.h> 2017-12-16 13:08:34 +01:00
Frank Denis
18d5940bc6 Use a simple memory pool for benchmarks
In the test suite, a significant amount of time is spent in memory
allocations. A memory pool helps achieve more relevant results with
less iterations.
2017-12-16 13:07:15 +01:00
Frank Denis
5bc564cac1 1.0.16
* master: (221 commits)
  Comment
  Comments
  msys2 build scripts: just use -Ofast
  Always prefer vararrays to alloca()
  Don't redefine alloca
  Return -1 if the scalar is 0 in crypto_scalarmult_ed25519()
  Remove trailing space
  Import the regen-msvc script
  Update ChangeLog
  Do not wipe the workspace after argon2 completes
  Remove tests for deprecated functions
  Give the compiler a change to inline index_alpha()
  Immediately allocate all required memory in argon2/scrypt
  Check reduced-round salsa variants in non-minimal mode
  Coverage exclusion -- this is just an extra, redundant check
  Remove incorrect and useless cast
  -fomit-frame-pointer makes a different on mips
  WebAssembly benefits from the 128-bit types, too
  Remove extra spaces
  Undef devel
  ...
2017-12-13 16:21:20 +01:00
Frank Denis
ac8dffbecb Return -1 if the scalar is 0 in crypto_scalarmult_ed25519()
For consistency with _base()
2017-12-12 14:35:08 +01:00
Frank Denis
21c1a3160c Remove tests for deprecated functions 2017-12-11 23:22:34 +01:00
Frank Denis
cf59e049e7 Check reduced-round salsa variants in non-minimal mode 2017-12-11 20:11:27 +01:00
Frank Denis
bdca518edc Remove incorrect and useless cast 2017-12-11 19:54:10 +01:00
Frank Denis
99fa31a595 More tests 2017-12-06 14:08:00 +00:00
Frank Denis
609e42be75 One more test 2017-12-06 13:53:22 +00:00
Frank Denis
43fa5ecc49 Add some tests for reduced-rounds salsa20 2017-12-06 13:38:46 +00:00
Frank Denis
0b6370dd0a Always undef NDEBUG in tests 2017-12-06 12:17:57 +00:00
Frank Denis
625e313e74 Avoid an expression in a assert() with side effects 2017-12-06 12:16:37 +00:00
Frank Denis
e89c43edf6 secretstream: add a test for rekeying using TAG_REKEY 2017-12-06 11:45:47 +00:00
Frank Denis
22b65dc57c Add a call to sodium_stackzero() 2017-12-05 17:49:58 +00:00
Frank Denis
01072a2f6a More tests 2017-12-03 21:16:46 +01:00
Frank Denis
cdd7d5f37d Add explicit cast 2017-12-03 21:02:17 +01:00
Frank Denis
8ad6ffa9d6 More tests 2017-12-03 20:56:17 +01:00
Frank Denis
b6262d982f Don't even try to compile non-minimal code 2017-12-03 16:55:46 +01:00
Frank Denis
139cadc76d Skip tests 13&14 in minimal mode 2017-12-03 16:49:55 +01:00
Frank Denis
99fe9eb67f More misuse tests 2017-12-03 16:39:05 +01:00
Frank Denis
947cf4ada5 casts 2017-12-01 17:29:41 +01:00
Frank Denis
229dac07ee casts 2017-12-01 17:29:29 +01:00
Frank Denis
217a9330a4 More tests 2017-12-01 17:21:59 +01:00
Frank Denis
84047b703a More tests 2017-12-01 17:04:09 +01:00
Frank Denis
dbaa94fe27 Casts 2017-12-01 16:33:10 +01:00
Frank Denis
e44614505b Casts 2017-12-01 16:32:25 +01:00
Frank Denis
18af4c61eb Fix format string sign 2017-12-01 15:28:09 +01:00