Commit Graph
556 Commits
Author SHA1 Message Date
Frank Denis 136af03cc3 blake2b-ref: memcpy() -> memmove() for overlapping regions 2014-09-15 17:45: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
Frank Denis 5aee93a277 Remove try.c
These tests are still in git and may be added to the test suite later.
2014-08-02 15:50:22 -07:00
Frank Denis 92b3d09e89 Implementation-specific symbols are not needed any more, even for RbNacl 2014-08-02 15:38:39 -07:00
Frank Denis 5957d47d5b crypto_pwhash_scryptsalsa208sha256.h requires <stdint.h> 2014-08-02 15:38:33 -07:00
Frank Denis 2acb19520a Add crypto_pwhash_scryptsalsa208sha256_STRPREFIX 2014-08-02 12:29:15 -07:00
Frank Denis 9ac321368a randombytes_salsa20 example: rekey after 16 blocks or after calling _buf() 2014-07-31 22:00:29 -07:00
Frank Denis e907196101 Do not recommend AES128 over AES256. 2014-07-30 22:42:53 -07:00
Frank Denis 1089114026 Replace ftime() with ftime_s() 2014-07-29 09:28:52 -07:00
Frank Denis 051507e266 Check for Windows-specific functions by checking _WIN32, not HAVE_* definitions 2014-07-29 08:55:53 -07:00
Frank Denis a91e0123cf Clarify what sodium_memcmp() is for. 2014-07-28 16:10:19 -07:00
Frank Denis 07f3610eef Do not export crypto_onetimeauth_pick_best_implementation() 2014-07-22 20:10:22 -07:00
Frank Denis 1dca7edfab --enable-minimal should compile only what is required for the high-level API
This doesn't include aes128ctr.
2014-07-14 18:43:46 -07:00
Frank Denis 931ce38f61 A double verification of 32 bytes is fast; so is comparing 2 pointers 2014-07-10 23:57:57 -07:00
Frank Denis c9c49c61fd Do not directly return the result of crypto_verify() 2014-07-10 23:21:18 -07:00
Frank Denis a362711903 Add crypto_sign_verify_detached() 2014-07-10 22:29:05 -07:00
Frank Denis 5b4a3b5715 Reformat 2014-07-10 22:04:01 -07:00
Frank Denis f7c79dbea7 Combine crypto_hash_sha512_update() calls 2014-07-10 15:57:14 -07:00
Frank Denis 0b065e0748 Add crypto_sign_ed25519_detached() 2014-07-10 15:46:37 -07:00
Frank Denis f6519378b4 + --enable-minimal to build a smaller library without less-used functions. 2014-07-09 20:24:04 -07:00
Frank Denis e4c751b214 Merge branch 'master' of github.com:jedisct1/libsodium
* 'master' of github.com:jedisct1/libsodium:
  Shave a few lines in the ChangeLog file
  Use unsigned constants for all sizes
  Use unsigned types for sizes in tests.
  Having dead code in the tree is sad, but keeps the diff with the reference implementation to a minimum.
2014-07-03 00:31:40 -07:00
Frank Denis fca020945c Align aes256 tables 2014-07-03 00:31:15 -07:00