Commit Graph
1368 Commits
Author SHA1 Message Date
Frank Denis 8a70f258fd No more abort() calls! 2017-07-16 23:11:36 +02:00
Frank Denis c3b24c1d22 Explain why some abort() calls are still around 2017-07-16 20:09:27 +02:00
Frank Denis 74703c63a6 More abort() -> sodium_misuse() 2017-07-16 20:03:03 +02:00
Frank Denis a0e997b8ae More abort() -> sodium_misuse()
Keep the abort() call on the hash function, which should never fail.
2017-07-16 19:51:08 +02:00
Frank Denis ea9281cb03 More abort() -> sodium_misuse() 2017-07-16 19:24:46 +02:00
Frank Denis a61dddd496 Back to dev mode. If you want a stable version, use the stable branch. 2017-07-16 19:07:43 +02:00
Frank Denis bcf98b5546 Start replacing abort() with an internal sodium_misuse() function
This function will eventually be able to call a user-defined hook,
that may be useful to people writing bindings for other languages.

The function will not return, though, and will keep calling
abort() after the hook. So, hooks should not return either.

They should gracefully kill the current process or thread instead.

There are many more abort() instances to replace.
This is long and boring.
2017-07-16 19:01:22 +02:00
Frank Denis c86080e7b9 Fix funky indentation 2017-07-16 18:50:50 +02:00
Frank Denis 8b99f44ff9 Abort on misuse in crypto_kx_server_session_keys() too 2017-07-16 16:43:47 +02:00
Frank Denis 765ba55cdc crypto_kx(): abort if the function is called without any non-NULL pointer 2017-07-16 16:37:47 +02:00
Frank Denis 90658321d3 Only include sodium/crypto_pwhash_scryptsalsa208sha256.h on !minimal 2017-07-16 12:15:06 +02:00
Frank Denis 1f826df2d4 is_zero(): volatilize the accumulator 2017-07-16 01:07:38 +02:00
Frank Denis 3d400363b6 sodium_compare: x1, x2 don't have to be volatile 2017-07-16 01:05:47 +02:00
Frank Denis 99f8c19a1b memzero(): call the weak function after zeroing
A weak function cannot be inlined, but even if it's a little bit
far stretched, a compiler could add code taking different paths
according to the callee.

With a weak function called after the zeroing, we can be sure
that the zeroing has to happen.
2017-07-16 00:49:31 +02:00
Frank Denis f0c15da02f We don't need these extra loads 2017-07-15 20:54:57 +02:00
Frank Denis bcdb042ad9 Revert "Explicitly include <limits.h>"
This reverts commit 0fd9aae17a.
2017-07-15 20:33:34 +02:00
Frank Denis 7dbbd266b5 Simple SSE2 implementation of crypto_verify*()
`z` being volatile implies more load/store than needed, but this should
be safer if we want to stick with pure C code, and gives us a chance to
zero the registers.

It's still way faster than byte-by-byte comparisons anyway.

Xored secrets don't matter much when compared byte-by-byte, but they
can be more annoying in 128-bit registers.
2017-07-15 20:29:27 +02:00
Frank Denis 94a8b3327f Simplify crypto_verify_*()
Do not expect any modern compiler not to be able to inline this.
2017-07-15 18:31:21 +02:00
Frank Denis 37e99aa4fc Make it more difficult for the compiler to optimize crypto_verify_*() 2017-07-15 18:17:44 +02:00
Frank Denis c746eb2776 Revert "Bail out if SIZE_MAX < crypto_pwhash_MEMLIMIT_MAX"
This reverts commit c2ef7d0882.
2017-07-15 17:59:55 +02:00
Frank Denis 0fd9aae17a Explicitly include <limits.h> 2017-07-15 17:53:18 +02:00
Frank Denis c2ef7d0882 Bail out if SIZE_MAX < crypto_pwhash_MEMLIMIT_MAX 2017-07-15 17:51:10 +02:00
Frank Denis 28e32dd5a2 Remove scrypt from minimal builds 2017-07-11 22:08:02 +02:00
Frank Denis ccb842f488 Add a xchacha version of crypto_box_seal
No high level API for it, no reasons to, so not available in minimal mode.
2017-07-06 15:30:36 +02:00
Frank Denis c8425e6386 Encode Argon2id hashes 2017-06-28 15:49:28 +02:00
Frank Denis 16e9619d87 Indent 2017-06-28 15:09:18 +02:00
Frank Denis beac509209 Let crypto_pwhash_str_verify work both with Argon2i and Argon2id 2017-06-27 16:33:09 +02:00
Frank Denis 313225f68a Group pick_best_implementation_*() prototypes in a private header 2017-06-27 16:23:12 +02:00
Frank Denis 77b1d8eeb3 implementations.h doesn't need C++ guards 2017-06-27 16:18:55 +02:00
Frank Denis efd27c6489 Remove redundant Argon2 algorithm ids 2017-06-27 16:12:07 +02:00
Frank Denis 2cb841539e Public Argon2id API 2017-06-27 16:06:43 +02:00
Frank Denis 989189890b More argon2id bits 2017-06-27 15:43:40 +02:00
Frank Denis 7057cca8a7 Prepare for Argon2id support 2017-06-27 14:42:11 +02:00
Frank Denis 935557cdf7 Add AVX2-optimized Argon2 blamka function 2017-06-27 14:26:40 +02:00
Frank Denis b1d847d6dd Indent 2017-06-27 14:17:35 +02:00
Frank Denis 624d4dd1e0 Indent 2017-06-27 13:39:26 +02:00
Frank Denis fbe3eb265f secretbox: avoid a useless memmove() if the source and destination addresses are the same 2017-06-14 15:57:06 +02:00
Frank Denis 00212b2604 Merge branch 'master' of github.com:jedisct1/libsodium
* 'master' of github.com:jedisct1/libsodium:
  Fix `crypto_pwhash_argon2i_str_verify()` and its tests after `errno` changes
  Add crypto_pwhash_MISMATCH errno (#541)
2017-05-16 12:41:30 +02:00
Frank Denis f72bcfacd7 Move CRYPTO_ALIGN after the struct keyword
Fixes #543
2017-05-16 12:40:36 +02:00
Frank Denis 3e85167657 Fix crypto_pwhash_argon2i_str_verify() and its tests after errno changes 2017-05-12 15:09:54 +02:00
Emil Bay 94760400a6 Add crypto_pwhash_MISMATCH errno (#541)
* Add crypto_pwhash_MISMATCH errno

* Use EINVAL for invalid password

* Only set errno on mismatch
2017-05-12 14:30:26 +02:00
Frank Denis f6cab99f64 Indent 2017-04-28 12:19:32 +02:00
Frank Denis be5e5a53b3 Remove useless cast 2017-04-21 01:03:23 +02:00
Frank Denis db1dd21762 Prevent possible compiler optimizations 2017-04-21 01:02:40 +02:00
Frank Denis 68d576cc95 Prevent possible optimizations in sodium_compare() 2017-04-21 00:30:19 +02:00
Frank Denis bdd06e9074 Space 2017-04-04 18:06:38 -07:00
Chris Fogelklou 3f65a21212 Fix ref10 slide on PPC-VLE (#525)
* Use intermediate variables in slide() which removes ambiguity for the compiler and fixes a crash in the PPC_VLE build with -O1 flag (added bonus: smaller compiled code.)

* Fix formatting in slide() loop counter to match the previously just-formatted version.
2017-04-03 21:00:36 -07:00
Frank Denis 7fa678bdca April 1st is over
This reverts commit 1668847409.
2017-04-01 20:50:58 +02:00
Frank Denis 1668847409 Add support for random.org as a CSPRNG 2017-04-01 10:01:26 +02:00
Frank Denis 7a6a47a5a5 Format 2017-03-31 10:17:45 +02:00