Commit Graph
1419 Commits
Author SHA1 Message Date
Frank Denis 100a055a54 Indent 2017-08-12 16:38:11 +02:00
Frank Denis 76995c52ff Argon2: use sodium_{bin2base64,base642bin} instead of a private implementation 2017-08-09 22:41:26 +02:00
Frank Denis 265bdcfe07 bin2hex & bin2base64: return a null size on error
This might prevent applications that don't properly check return codes
from reusing previous data.
2017-08-09 22:41:20 +02:00
Frank Denis ad5a5232a2 Make that a size_t 2017-08-09 16:07:10 +02:00
Frank Denis cdbb43f444 base64 tests 2017-08-09 15:56:58 +02:00
Frank Denis eb84b00b75 glibc requires <stdint.h> for SIZE_MAX 2017-08-09 02:09:46 +02:00
Frank Denis 3f272cbbfc Add a base64 codec, due to popular request
I still think that base64 is awful, but users have spoken.
2017-08-09 01:54:57 +02:00
Frank Denis 308684790f Move the codecs from sodium/utils.c to a dedicated file 2017-08-09 01:38:14 +02:00
Frank Denis dd9416fd59 Doc 2017-08-08 14:28:12 +02:00
Frank Denis 5b141eb9ec Add some blank lines for readability 2017-08-06 19:17:25 +02:00
Frank Denis 7e91aa3f89 s/the// 2017-08-06 19:15:26 +02:00
Frank Denis 4baea3575b Merge branch 'master' of github.com:jedisct1/libsodium 2017-08-06 19:11:49 +02:00
Frank Denis 9b7db7c3f3 Document crypto_aead_aes256gcm_*() limitations 2017-08-06 19:11:19 +02:00
Frank Denis a894ec93f2 Add crypto_pwhash_str_alg() 2017-08-05 20:56:59 +02:00
Frank Denis e1fa9cc90c Add *_messagebytes_max() wrappers 2017-08-03 13:34:31 +02:00
Frank Denis f02770b2ad Revert "+ sodium_alloc_overhead()"
This reverts commit c5b61d8129.
2017-08-02 14:26:56 +02:00
Frank Denis c5b61d8129 + sodium_alloc_overhead() 2017-08-02 12:34:56 +02:00
Frank Denis c56fa3ccf9 Include private/common.h for COMPILER_ASSERT 2017-08-01 11:40:32 +02:00
Frank Denis 56eb70f8bb Sort 2017-08-01 10:38:23 +02:00
Frank Denis 6ac18dae42 The MESSAGEBYTES_MAX constants are to be used with the libsodium API
Projects using the legacy API are unlikely to use these new macros.
OTOH, people using the Sodium API would be puzzled about the missing
16 bytes in the secretbox and box APIs.

More importantly, these macros are designed for bindings.
Having these bindings enforce proper limits (for the *_easy API
that they all use) and yet have the underlying library call
sodium_misuse() would be sad.
2017-07-29 23:29:58 +02:00
Frank Denis 90bd94e4e4 Coverage exclusion 2017-07-29 22:31:13 +02:00
Frank Denis 3dd56fa91b Coverage exclusions 2017-07-29 22:07:36 +02:00
Frank Denis ff8bb6705a More tests for scrypt 2017-07-29 22:01:13 +02:00
Frank Denis 52bfc0325b Initialize the base&aligned addresses in argon2's allocate_memory
Also memzero() pseudo_rands, not the segments twice.
2017-07-29 18:54:52 +02:00
Frank Denis fc90887921 Add missing include "core.h" 2017-07-29 18:42:39 +02:00
Frank Denis c15173de1e Turn a few calls with an insane message length into a sodium_misuse() 2017-07-29 18:37:55 +02:00
Frank Denis f28fe0ae29 Cap argon2*_BYTES_MAX to SODIUM_SIZE_MAX 2017-07-29 18:05:08 +02:00
Frank Denis bac61ebf50 BYTES_MAX -> MESSAGEBYTES_MAX 2017-07-29 17:58:18 +02:00
Frank Denis 16179b87f3 Introduce *_BYTES_MAX constants
*_BYTES_MAX constants constants represent the maximum size of
a message.

No accessor functions for now. They will be renamed, as the
*_BYTES_MAX suffix was previously also used for the maximum output
size of stream ciphers.

These macros are designed to be used by language bindings, so they
can perform some sanity checks before calling the sodium API.
2017-07-29 17:39:31 +02:00
Frank Denis 568adb570d Trim crypto_pwhash_scryptsalsa208sha256_BYTES_MAX down to ~127 GB 2017-07-29 15:02:51 +02:00
Frank Denis 3525f032df Inline 2017-07-28 18:51:04 +02:00
Frank Denis 3ee2151f1d memzero(): with weak symbols, just call memset() 2017-07-28 18:26:36 +02:00
Frank Denis 105f7108d6 Argon2: wipe all blocks if the ARGON2_FLAG_CLEAR_MEMORY flag is set
Not ARGON2_FLAG_CLEAR_PASSWORD
2017-07-28 18:22:51 +02:00
Frank Denis dc2c68067b C++ compat 2017-07-28 18:08:10 +02:00
Frank Denis fb739acd7b fill_memory_blocks() cannot possibly fail 2017-07-28 18:07:45 +02:00
Frank Denis c3908f87d6 Argon2: deallocate memory if fill_memory_blocks() ever fails
Also perform a single allocation to store random numbers.
2017-07-28 17:58:16 +02:00
Frank Denis 2a2ed3df3a Volatilify the accumulator, at least for consistency with sodium_is_zero() 2017-07-24 22:20:51 +02:00
Frank Denis cd51ff29e9 Coverage exclusions 2017-07-24 22:19:50 +02:00
Frank Denis f92c82537b More tests 2017-07-24 15:16:22 +02:00
Frank Denis 47796a5b89 Indent 2017-07-23 20:17:53 +02:00
Frank Denis d7ecf04d68 Comment randombytes_uniform() 2017-07-23 19:44:22 +02:00
Frank Denis eaab512788 Add specialized ge_mul_l() to multiply by the order of the main subgroup 2017-07-23 13:50:10 +02:00
Frank Denis 6de26b59d7 ed25519_pk_to_curve25519: check that the input is in the right subgroup 2017-07-23 13:25:02 +02:00
Frank Denis 571915ea2c ed25519: un-static the check for low-order points 2017-07-23 13:15:50 +02:00
Frank Denis cc51916072 Tag sodium_runtime_has_*() symbols as weak 2017-07-19 12:30:40 +02:00
Frank Denis 8b9b6a54be Remove error string from sodium_misuse()
Returning the name of an internal function to bindings is useless.

They need way more context to recover from these errors, and
their own backtrace will be way more useful for diagnostics.
2017-07-19 00:57:19 +02:00
Frank Denis 97486f7d45 Clear the BLAKE2B state only once, on finalization
No need to clear everything, and no need to clear again
if _final() is called more than once.
2017-07-18 20:16:47 +02:00
Frank Denis 1090fcfd4d memzero() the state if we call generichash_final() twice 2017-07-18 19:19:04 +02:00
Frank Denis 6768d82ea2 Add missing return value in set_misuse_handler() 2017-07-18 03:49:58 +02:00
Frank Denis 5d56821d3d More tests, and start testing misuse cases 2017-07-17 23:09:44 +02:00