Commit Graph
981 Commits
Author SHA1 Message Date
Frank Denis 80d24c00cc Use calloc() instead of malloc()+memset() 2016-02-19 07:40:09 +01:00
Frank Denis 4b6a909d8a Argon2: fill_block() now XORs blocks instead of overwriting them 2016-02-17 16:26:37 +01:00
Frank Denis e153debd0d Remove ...edwards25519sha512batch_*() wrappers for the constants
The ...edwards25519sha512batch_*() functions are only here for ABI
compatibility with NaCl, where constants were only defined as macros.

Plus, these functions were only present as prototypes since 1.0.6;
the actual symbols were no defined any more.
2016-02-13 08:15:00 +01:00
Frank Denis 54915743f4 Define ZEROBYTES as BOXZEROBYTES + MACBYTES
ZEROBYTES and BOXZEROBYTES are rarely used compared to MACBYTES,
so it makes more sense to define MACBYTES and define the compat macros
based on it that the other way round.
2016-02-11 15:19:58 +01:00
Frank Denis 36e60b2d28 Wipe secret keys before public keys and nonces 2016-02-03 01:19:24 +01:00
Frank Denis 1b63773986 Comments cleanup 2016-02-01 16:08:29 +01:00
Frank Denis 7035bbb8b8 Indent 2016-01-28 14:44:41 +01:00
Frank Denis aa2ae5642b aes256gcm_encrypt_afternm() - abort() if mlen > 2^39-256 bits 2016-01-27 14:42:32 +01:00
Frank Denis 113091b2a0 On non-ELF platforms, mark pointers as volatile, not just what they point to.
See http://sk.tl/Wj3pmI vs http://sk.tl/VNsyd9
2016-01-27 08:24:19 +01:00
Frank Denis bd15b68569 Argon2: explicitly initialize ctx.secret to NULL 2016-01-26 11:14:40 +01:00
Frank Denis 367afac0bf Sync argon2 implementation with upstream 2016-01-24 20:35:00 +01:00
Frank Denis 31a153c937 argon2_core() -> argon2_ctx() 2016-01-23 22:52:11 +01:00
Frank Denis 8bd6c9e289 Caps 2016-01-22 16:16:15 +01:00
Frank Denis dc4a9791a7 Add comments to argon2-encoding.c
Upstream `decode_string()` can return `ARGON2_INCORRECT_TYPE`.
This change is not merged. Either have a function return an ARGON2 constant,
have it return 0/1, or have it return 0/-1, but mixing different systems
is confusing. (encode|decode)_string() should probably all return an ARGON2
code.
2016-01-22 16:12:24 +01:00
Frank Denis 921507cc59 Add extra sodium_memzero() in Argon2 2016-01-22 16:03:09 +01:00
Frank Denis a814810a43 Relax max sizes in argon2 decoding 2016-01-22 15:59:54 +01:00
Frank Denis 17248540e3 Add aes256gcm stubs for platforms where it is not available 2016-01-22 10:21:24 +01:00
Frank Denis d1b028abe3 Initialize ctx->pwdlen in argon2 string decoder 2016-01-21 08:42:23 +01:00
Frank Denis 82c7c45924 zero the context, in case we forget to initialize some members 2016-01-21 08:39:47 +01:00
Frank Denis ba415e1f4d Argon2: use existing constants more consistently
By @technion via the reference implementation
2016-01-21 08:35:53 +01:00
Frank Denis 53419d7b06 Merge pull request #348 from betafive/pbarker/blake2
Add crypt_generichash_blake2b_statebytes function
2016-01-16 20:15:00 +01:00
Paul Barker e20291d78e Add crypt_generichash_blake2b_statebytes function
The function crypto_generichash_statebytes exists to dynamically determine the
size of a crypto_generichash_state struct. This is useful when using libsodium
from a language which can't use sizeof on C types. However, no equivalent
existed for the crypto_generichash_blake2b_state struct for users who want to
explicitly use the blake2b algorithm.

The function crypt_generichash_blake2b_statebytes is added to fill this gap.
2016-01-16 17:25:14 +00:00
Frank Denis 8c0b916729 Add new macros for chacha20poly1305_ietf constants, for clarity 2016-01-16 12:36:30 +01:00
Frank Denis 18cc1b5682 The occasional absence of braces is disturbing. 2016-01-15 21:12:34 +01:00
Frank Denis 08d3b8a19c Reuse validate_inputs() to validate parameters in argon2-encoding.c 2016-01-15 20:58:50 +01:00
Frank Denis 936667e3f1 Untab 2016-01-12 09:26:46 +01:00
Frank Denis 20ccc09018 Argon2: Let fill_{memory_blocks,segment} return an error code 2016-01-12 09:24:50 +01:00
Frank Denis 751f3b3753 Visual Studio's preprocessor doesn't support #warning 2016-01-11 11:11:43 +01:00
Frank Denis f1ab1fd377 Add extra CRYPTO_ALIGN() required for Minix 2016-01-07 15:33:17 +01:00
Frank Denis 82ed2169b0 Make argon2i blocks allocation functions static 2015-12-30 17:30:59 +01:00
Frank Denis ff32e8f34b argon2: memory usage is m_cost KiB, not 2^m_cost KiB 2015-12-30 00:10:57 +01:00
Frank Denis dfa0ee2753 We don't need no external memory allocators 2015-12-30 00:09:16 +01:00
Frank Denis 1635f98638 Add sodium/crypto_pwhash.h to the distribution 2015-12-29 22:42:33 +01:00
Frank Denis 69cfab0522 We don't need the ability to use a custom allocator 2015-12-29 22:33:36 +01:00
Frank Denis 28ca446f73 argon2: don't dereference a pointer before testing it for NULL 2015-12-29 22:22:54 +01:00
Frank Denis b5ed4cc34b Add high-level crypto_pwhash() API 2015-12-29 21:49:55 +01:00
Frank Denis c7b9178d5a Consistent #include guards 2015-12-29 21:35:45 +01:00
Frank Denis 2bd822b1c9 Pasto 2015-12-29 19:13:48 +01:00
Frank Denis 6d9f2cae79 argon2: ensure that memory is cacheline aligned; use mmap(2) if possible 2015-12-29 19:00:52 +01:00
Frank Denis 9788147270 Require less indentation 2015-12-29 18:41:38 +01:00
Frank Denis 9ef45f8456 argon2: make blocks allocation indirect, keep the base address 2015-12-29 18:38:33 +01:00
Frank Denis 0ec2f464c8 Comment doesn't seem to be relevant any more 2015-12-29 17:53:13 +01:00
Frank Denis 96c37fc9a4 Indent 2015-12-29 17:51:00 +01:00
Frank Denis bd44342a1e Remove unneeded extern "C" 2015-12-29 17:24:31 +01:00
Frank Denis 71056e2f75 Add missing header 2015-12-29 17:22:45 +01:00
Frank Denis dfdf65c4f0 Add crypto_pwhash_argon2i_(memlimit|opslimit)_moderate()
Import missing crypto_pwhash_argon2i.h by the way
2015-12-29 16:07:47 +01:00
Frank Denis 387dd75e88 Require at least SSSE3 for optimized implementations 2015-12-29 15:34:16 +01:00
Frank Denis a916ec93c1 crypto_pwhash_argon2i_*() 2015-12-29 13:29:24 +01:00
Frank Denis da927a985f Argon2 bits - Not exposed in the API yet 2015-12-29 11:24:11 +01:00
Frank Denis 9abc0fdbd0 Back go to dev mode 2015-12-28 18:51:25 +01:00