Commit Graph
760 Commits
Author SHA1 Message Date
Frank Denis ca4361f55f Remove extra spaces 2015-11-01 02:53:22 +01:00
Frank Denis b9b722ce22 Externalize the blake2b compression function 2015-11-01 02:53:22 +01:00
Frank Denis 7f238f4c8b Assume that optimized Blake2b versions can use at least SSSE3 2015-11-01 02:53:22 +01:00
Frank Denis a3d3f351b7 Sync blake2-impl.h with ref 2015-11-01 02:53:22 +01:00
Frank Denis 28fb7bdb37 Reduce diffs between blake2b-ref and blake2b-opt 2015-11-01 02:53:22 +01:00
Frank Denis e59641cc9a Remove traces of AVX & XOP specific optimizations 2015-11-01 02:53:22 +01:00
Frank Denis 6881890d7e Import vanilla blake2b optimized implementation 2015-11-01 02:53:22 +01:00
Frank Denis e7bb1e200e Do not export crypto_onetimeauth_poly1305_set_implementation()
This is a relique from very early versions of libsodium that
should eventually just go away.
2015-11-01 01:27:10 +01:00
Frank Denis dd53b90175 \#if defined( ) -> #ifdef 2015-11-01 01:14:55 +01:00
Frank Denis c8ae529774 Remove extra empty lines 2015-11-01 01:14:49 +01:00
Frank Denis 3361e20a87 blake2b-ref micro-optimizations 2015-11-01 01:14:44 +01:00
Frank Denis 26fdfec99b Add sodium_runtime_has_ssse3() and sodium_runtime_has_sse41() 2015-10-31 23:42:44 +01:00
Frank Denis 84695c8d42 Make sodium_compare() work on little-endian numbers as expected 2015-10-31 22:36:54 +01:00
Frank Denis 9a42ee1064 UL => ULL 2015-10-31 01:35:40 +01:00
Frank Denis d47cb42f5a Replace some memcpy() with a local loop 2015-10-30 21:32:19 +01:00
Frank Denis 8deb15bd85 Refuse an output length > 256 Gb in crypto_stream_chacha20_ietf_ref() 2015-10-30 20:47:37 +01:00
Frank Denis aeb4ff95e4 Defer a memcpy() 2015-10-30 20:46:39 +01:00
angt 2042cb7dc7 Fix crypto_aead_aes256gcm_decrypt_afternm() when clen < 16 2015-10-30 19:04:32 +01:00
Frank Denis b3417560f1 chacha_encrypt_bytes(): ensure that the padding bytes are initialized
Reported by Pascal Cuoq
2015-10-26 20:44:48 +01:00
Frank Denis 771e32bd18 CompCert compatibility 2015-10-26 16:59:28 +01:00
Frank Denis 4b1478cd5b Extra sanity checks for blake2b_salt_personal() 2015-10-25 01:57:07 +02:00
Frank Denis 7ab8ddef94 Zero the stack in crypto_box_seed_keypair() 2015-10-25 01:22:11 +02:00
Frank Denis 94da855b8d Add explicit signed/unsigned conversion 2015-10-24 18:59:15 +02:00
Frank Denis 58c211a8a3 Work around gcc 5.1.1/arvm7l VRP bugs
No binary changes on other platforms
2015-10-24 16:41:22 +02:00
Frank Denis b81aa64fae Add back final \n removed by PR #309 2015-10-22 18:33:06 +02:00
unknown 0814537aea Replace __sun and __GNU_C by __SUNPRO_C to simplify logic regarding @jedisct1 comments 2015-10-22 18:13:34 +02:00
unknown 4b63cd1614 Libsodium does not compile for Solaris CC compiler #308 2015-10-22 17:41:16 +02:00
Frank Denis 63b9c02f0c Alignment 2015-10-20 18:28:52 +02:00
Frank Denis 52fe697e7a io.js has become node.js 2015-10-19 22:19:54 +02:00
Frank Denis 9ca34ef98e Work around a GCC VRP bug.
Spotted on:

gcc (SUSE Linux) 5.1.1 20150713 [gcc-5-branch revision 225736]
openSUSE 20151014 (armv7hl)
VERSION = 20151014
CODENAME = Tumbleweed
2015-10-19 10:47:24 +02:00
Frank Denis 8b4be96453 Make it explicit that aes256gcm_statebytes() returns a rounded value
No actual changes to the returned value
2015-10-18 10:33:32 +02:00
Frank Denis f01c303631 Blake2b: refuse a NULL key with a length > 0 2015-10-18 00:27:03 +02:00
Frank Denis eeb31af578 Let crypto_generichash_statebytes() return a size rounded to the alignment
Add similar check in the aead_aes256gcm test.
2015-10-18 00:16:05 +02:00
Frank Denis d667efde68 Add sodium_compare()
A constant-time version of memcmp(), useful to compare nonces and counters
in little-endian format, that plays well with sodium_increment().

Unlike sodium_memcmp() which can compare anything for equality,
sodium_compare() is designed to compare things that are comparable, byte by
byte. Therefore, the prototype is slightly different: its arguments are
supposed to be `const unsigned char *`.

The names sodium_memcmp() and sodium_compare() are slightly confusing.
But we're not going to rename sodium_memcmp(), and I cannot think of a
better name for sodium_compare() than sodium_compare().
2015-10-17 21:25:30 +02:00
Frank Denis 1647b30f1a Constify 2015-10-16 22:43:28 +02:00
Frank Denis beb826f6fd S_IFNAM -> S_ISNAM (for QNX) 2015-10-14 20:19:57 +02:00
Frank Denis 684a7e3788 Avoid variable shadowing 2015-10-14 16:42:57 +02:00
Frank Denis 3f8d23f226 Rename acc to accv for consistency 2015-10-14 16:29:38 +02:00
Frank Denis e868211d72 Reuse previous declaration 2015-10-14 16:22:03 +02:00
Frank Denis 9aec6662b2 Name round counters "roundctr", not a generic "i" 2015-10-14 16:12:13 +02:00
Frank Denis 14cc1e4836 Avoid variable shadowing 2015-10-14 11:29:39 +02:00
Frank Denis da35396e90 Don't mix code and declarations 2015-10-13 14:32:37 +02:00
Frank Denis 98550acafb Add tests for the aes256gcm functions returning sizes
Which spotted a typo by the way.
2015-10-11 19:19:31 +02:00
Frank Denis aa965a580b Expose only crypto_aead_aes256gcm_*() not crypto_aead_aes256gcm_aesni_*()
libsodium typically doesn't expose specific implementations.
It shouldn't be the case for that construction either, especially since
an ARM8 implementation might be added later.
We want a single interface for both.
2015-10-11 14:29:25 +02:00
Frank Denis dadc5d9906 Add crypto_aead_aes256gcm_aesni_is_available() 2015-10-11 13:05:32 +02:00
Frank Denis 76846bd3ee Indent 2015-10-11 12:59:34 +02:00
Frank Denis 16beebb2ec Don't use implementation-specific functions to expose sizes 2015-10-11 11:58:34 +02:00
Frank Denis 1dddd63a19 Merge branch 'aes256gcm'
* aes256gcm: (25 commits)
  aes256gcm: we can expect the accumulator and the padding buffer to be aligned
  aesgcm: don't expect input & output buffers to be aligned
  aes256gcm doesn't use SSE4.1 instructions any more
  Don't read past the AD buffer, even through an SIMD register
  Convert more functions to macros
  Add do { ... } while(0) when relevant
  Turn reduce4 into a macro That's too much registers for a function call in 32-bit mode. And in MSVC, this is even the case if the function is marked inline.
  Enable aes256gcm on Visual Studio
  Don't declare new variables after a line of code
  Declare __m128 arrays used as parameters as pointers Required for MSVC
  Proper casts for aeskeygenassist()
  Let's hope that requiring ssse3 is not required any more
  Try to enable specific cflags before testing each intructions set
  ssse3 target is required in addition to sse4.1
  Use SIMD-specific compiler flags only for files needing them
  Define __SSSE3__ if required
  Do not try to compile aesni code if this is not going to compile
  Check for AESNI & PCLMUL presence/usability
  Replace the aes256gcm implementation with Romain Dolbeau's implementation which is slightly faster than mine. Reimplement features from the previous implementation: add batch mode and use two passes in the decryption function in order to check the tag before decrypting.
  Explicit cast
  ...
2015-10-11 02:45:36 +02:00
Frank Denis 82e9c729f1 aes256gcm: we can expect the accumulator and the padding buffer to be aligned 2015-10-11 02:39:28 +02:00
Frank Denis 66d55c1939 aesgcm: don't expect input & output buffers to be aligned 2015-10-11 02:39:28 +02:00