boringssl/crypto/curve25519
David Benjamin 05c7bb4565 Avoid shifting negative numbers in curve25519.
C is still kind of unsure about the whole two's complement thing and leaves
left-shifting of negative numbers undefined. Sadly, some sanitizers believe in
teaching the controversy and complain when code relies on the theory of two's
complement.

Shushing these sanitizers in this case is easier than fighting with build
configuration, so replace the shifts with masks. (This is equivalent as the
left-shift was of a value right-shifted by the same amount. Instead, we store
the unshifted value in carry0, etc., and mask off the bottom bits.) A few other
places get casts to unsigned types which, by some miracle, C compilers are
forbidden from miscompiling.

This is imported from upstream's b95779846dc876cf959ccf96c49d4c0a48ea3082 and
5b7af0dd6c9315ca76fba16813b66f5792c7fe6e.

Change-Id: I6bf8156ba692165940c0c4ea1edd5b3e88ca263e
Reviewed-on: https://boringssl-review.googlesource.com/7320
Reviewed-by: Adam Langley <agl@google.com>
2016-03-05 00:23:09 +00:00
..
asm Add #ifdef guards to crypto/curve25519 assembly files. 2016-02-02 16:03:33 +00:00
CMakeLists.txt Add SPAKE2 over Ed25519. 2016-03-01 19:34:10 +00:00
curve25519.c Avoid shifting negative numbers in curve25519. 2016-03-05 00:23:09 +00:00
ed25519_test.cc Enable Ed25519 when building with OPENSSL_SMALL. 2015-12-18 23:15:33 +00:00
ed25519_tests.txt Add X25519 and Ed25519 support. 2015-11-17 21:56:12 +00:00
internal.h Add SPAKE2 over Ed25519. 2016-03-01 19:34:10 +00:00
spake25519_test.cc Add SPAKE2 over Ed25519. 2016-03-01 19:34:10 +00:00
spake25519.c Add SPAKE2 over Ed25519. 2016-03-01 19:34:10 +00:00
x25519_test.cc Update draft-irtf-cfrg-curves-11 references to RFC 7748. 2016-01-28 00:53:26 +00:00
x25519-x86_64.c Add x86-64 assembly for X25519. 2015-12-22 16:22:38 +00:00