Commit Graph
576 Commits
Author SHA1 Message Date
Frank Denis 116cdf32f1 pickparams() and escrypt_init_local() cannot fail 2014-09-23 13:08:25 -07:00
Frank Denis a858a1971e lcov exclusion
Testing for this case rather belongs to the sodium-validation project.
2014-09-23 12:39:15 -07:00
Frank Denis 5fc704cbf0 lcov exclusions 2014-09-23 12:18:24 -07:00
Frank Denis ad5a165f94 crypto_sign(): read the copy, not the message, to properly handle overlaps 2014-09-21 22:06:45 -07:00
Frank Denis 51dfcfc223 Handle overlapping in/out buffers in crypto_sign() 2014-09-21 11:24:49 -07:00
Frank Denis d92d531ac0 Visual Studio: use #pragma warning(push/pop) instead of warning(default: ...) 2014-09-18 23:46:57 -07:00
Frank Denis abd5df9ba1 lcov: annotate the actual "can't happen" lines. 2014-09-18 22:22:51 -07:00
Frank Denis ef86392f39 Fix funky indentation after untabification 2014-09-18 22:03:30 -07:00
Frank Denis 9eefb2e487 More test + lcov exclusions 2014-09-18 22:02:25 -07:00
Frank Denis 877bf76716 crypto_(secret)box_easy: check SIZE_MAX overflow only where needed 2014-09-16 21:09:55 -07:00
Frank Denis c54b05a1e5 lcov exclusion 2014-09-16 20:55:59 -07:00
Frank Denis 37580f4f52 More tests 2014-09-16 20:46:43 -07:00
Frank Denis 1cf170a90e Test sodium_allocarray(), and sodium_malloc() with a huge size 2014-09-16 15:35:21 -07:00
Frank Denis fe4bbdc5ca More crypto_pwhash() tests 2014-09-16 15:07:42 -07:00
Frank Denis e333e55209 Increase generichash test coverage 2014-09-16 14:44:38 -07:00
Frank Denis 671ee78ce2 lcov exclusions 2014-09-16 10:52:42 -07:00
Frank Denis 7cf7f0a31c More lcov exclusions.
poly1305 optimized implementations will come after 1.0.
2014-09-16 10:43:38 -07:00
Frank Denis cee8af9b66 Test chacha20 with length == 0 2014-09-16 10:32:04 -07:00
Frank Denis 9177ebedf2 Merge branch 'master' of github.com:jedisct1/libsodium
* 'master' of github.com:jedisct1/libsodium:
  Take blake2s off the tree until we actually use it
2014-09-15 17:45:58 -07:00
Frank Denis 136af03cc3 blake2b-ref: memcpy() -> memmove() for overlapping regions 2014-09-15 17:45:07 -07:00
Frank Denis 7d630186d9 Take blake2s off the tree until we actually use it 2014-09-15 11:33:07 -07:00
Frank Denis f812967fb8 Coverage exclusion when relevant 2014-09-14 15:44:13 -07:00
Frank Denis 7dde13e1b4 Sync Blake2s changes with Blake2b
Note: Blake2s code is not compiled yet
2014-09-13 13:14:56 -07:00
Frank Denis a7d38ef15d Check outlen in blake2b_final
Not required in Sodium since the check is already performed in
higher-level functions, but it doesn't hurt either.
2014-09-13 13:09:25 -07:00
Frank Denis 8994dc340f Blake2 load/store functions must accept unaligned pointers even on LE 2014-09-13 12:59:11 -07:00
Frank Denis 59a207e4ff __cpuidex() is not really required for now, just use __cpuid() 2014-09-13 12:22:53 -07:00
Frank Denis a4264a221f Disable MSVC deprecation warning just for _ftime() 2014-09-13 12:04:00 -07:00
Frank Denis fe586939f6 _ftime_s() was not available on Windows XP. And people still run XP. 2014-09-13 10:28:46 -07:00
Frank Denis c8c2c7a93d Revert "The C standard says nothing about accesses via lvalue expressions with volatile types"
This reverts commit fc1bc0718b.
2014-09-05 18:27:48 -07:00
Frank Denis fc1bc0718b The C standard says nothing about accesses via lvalue expressions with volatile types 2014-09-04 13:22:54 -07:00
Frank Denis c6ca4c6ef8 randombytes() -> randombytes_buf()
Since randombytes() wraps randombytes_buf(), that's one more function
the linker can strip out until it's actually used by the app.
2014-08-27 11:39:45 -07:00
Frank Denis 7c7f1cfacc Reorder randombytes prototypes; mention that randombytes() is a compat API. 2014-08-27 10:50:49 -07:00
Frank Denis f789f8a05a Rephrase 2014-08-19 21:13:14 -07:00
Frank Denis 6dfada1ebc Remove unneeded #include 2014-08-15 17:14:04 -07:00
Frank Denis 2997ed2619 Comment out loops not being executed. 2014-08-15 15:15:29 -07:00
Frank Denis d01e1f4875 On error path, do not set the signature len if a NULL pointer was given. 2014-08-15 15:10:24 -07:00
Frank Denis 6c8df6adad Remove unused variable 2014-08-15 14:36:52 -07:00
Frank Denis 0e23192159 Add crypto_sign_ed25519_sk_to_seed() and crypto_sign_ed25519_sk_to_pk() 2014-08-15 13:52:08 -07:00
Frank Denis d3403d1e01 memzero az in crypto_signed_detached. via Stanford SCS. 2014-08-15 13:21:09 -07:00
Frank Denis 2947ea863d Clear the seed in crypto_sign_keypair() - Reported by the Stanford SCS group. 2014-08-15 12:00:59 -07:00
Frank Denis 473e1718cc Add sodium_{malloc,allocarray,free}() and sodium_mprotect_*()
ptr = sodium_malloc(size) returns a pointer from which exactly "size" bytes
can be accessed.

ptr = sodium_allocarray(count, size) allocates enough storage space for
"count" pointers or scalars of unit size "size".

In both cases, the region is immediately followed by a guard page.
As a result, any attempt to access a memory location after ptr[size - 1] will
immediately trigger a segmentation fault.

The allocated region is mlock()ed and filled with 0xd0 bytes.

A read-only page with the size, a guard page, as well as a canary are
placed before the returned pointer.

The canary is checked by sodium_free(); as a result, altering data right
before ptr is likely to cause sodium_free() to kill the process.

sodium_free() munlock()s the region and fills it with zeros before
actually calling free().

sodium_mprotect_noaccess(), sodium_mprotect_readonly() and
sodium_mprotect_readwrite() can be used to change the protection on the set
of allocated pages.

Reverting the protection to read+write is not required before calling
sodium_free().
2014-08-14 21:41:05 -07:00
Frank Denis 6c78c9815c Remove compat.c 2014-08-13 17:40:06 -07:00
Frank Denis b06951dd20 Zero the nonce in crypto_sign() 2014-08-05 14:08:00 -07:00
Frank Denis eae4add8de Implement ed25519 -> curve25519 keys conversion 2014-08-05 13:32:25 -07:00
Frank Denis 7b0eeda1c6 Remove aes256estream.
AES-256 will be reintroduced, but not until we have a bitsliced implementation.
2014-08-05 00:57:10 -07:00
Frank Denis 88de46b6ae Document the maximum number of bytes for crypto_stream_aes256estream*()
abort() if these functions are misused.
2014-08-04 20:15:07 -07:00
Frank Denis 4d02391067 Remove scryptx() compatibility functions 2014-08-03 21:18:06 -07:00
Frank Denis c5a9d46386 Double check for crypto_auth_verify() 2014-08-03 21:15:04 -07:00
Frank Denis be41f72e0e Bypass gcc optimization 2014-08-03 20:10:38 -07:00
Frank Denis 2350dbe13e Remove _sodium_alignedcalloc 2014-08-02 15:51:37 -07:00