summaryrefslogtreecommitdiffstats
path: root/crypto/ec/curve25519.c
AgeCommit message (Collapse)Author
2018-03-13ec/curve25519.c: resolve regression with Android NDK's arm64 gcc.Andy Polyakov
Unlike "upstream", Android NDK's arm64 gcc [but not clang] performs 64x64=128-bit multiplications with library calls, which appears to have devastating impact on performance. [The condition is reduced to __ANDROID__ [&& !__clang__], because x86_64 has corresponding assembly module.] Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5589)
2018-02-24{ec/curve25519,poly1305/poly1305}.c: relax pedantic constraint.Andy Polyakov
As it turns out gcc -pedantic doesn't seem to consider __uint128_t as non-standard, unlike __int128 that is. Fix even MSVC warnings in curve25519.c. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5449)
2018-02-21ec/curve25519.c: facilitate assembly implementations.Andy Polyakov
Currently it's limited to 64-bit platforms only as minimum radix expected in assembly is 2^51. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/5408)
2018-02-21crypto/ec/curve25519.c: remove redundant fe[51]_cswap.Andy Polyakov
3 least significant bits of the input scalar are explicitly cleared, hence swap variable has fixed value [of zero] upon exit from the loop. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/5408)
2018-01-19Copyright update of more files that have changed this yearRichard Levitte
Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/5110)
2018-01-07ec/curve25519.c: avoid 2^51 radix on SPARC.Andy Polyakov
SPARC ISA doesn't have provisions to back up 128-bit multiplications and additions. And so multiplications are done with library calls and carries with comparisons and conditional moves. As result base 2^51 code is >40% slower... Reviewed-by: Tim Hudson <tjh@openssl.org>
2017-12-28ec/curve25519.c: "double" ecdhx25519 performance on 64-bit platforms.Andy Polyakov
"Double" is in quotes because improvement coefficient varies significantly depending on platform and compiler. You're likely to measure ~2x improvement on popular desktop and server processors, but not so much on mobile ones, even minor regression on ARM Cortex series. Latter is because they have rather "weak" umulh instruction. On low-end x86_64 problem is that contemporary gcc and clang tend to opt for double-precision shift for >>51, which can be devastatingly slow on some processors. Just in case for reference, trick is to use 2^51 radix [currently only for DH]. Reviewed-by: Rich Salz <rsalz@openssl.org>
2017-11-13Resolve warnings in VC-WIN32 build, which allows to add /WX.Andy Polyakov
It's argued that /WX allows to keep better focus on new code, which motivates its comeback... Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4721)
2017-08-25Clear secret stack values after use in the ED25519-functionsBernd Edlinger
Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4242)
2017-08-25Clear secret stack values after use in curve25519.cBernd Edlinger
Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4242)
2017-06-02Left shift of a negative number is undefined behaviourMatt Caswell
Fix undefined behaviour in curve25519.c. Prior to this running with ubsan produces errors like this: crypto/ec/curve25519.c:3871:18: runtime error: left shift of negative value -22867 [extended tests] Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3600)
2017-05-30Clear sensitive data in ED25519_signDr. Stephen Henson
Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3503)
2017-05-30Make Ed25519 consistent with X25519Dr. Stephen Henson
Rename and change ED25519_keypair_from_seed to ED25519_public_from_private to be consistent with X25519 API. Modidy ED25519_sign to take separate public key argument instead of requiring it to follow the private key. Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3503)
2017-05-30Add Ed25519 algorithm.Dr. Stephen Henson
Reinstate Ed25519 algorithm to curv25519.c this is largely just a copy of the code from BoringSSL with some adjustments so it compiles under OpenSSL. Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3503)
2016-05-17Copyright consolidation 05/10Rich Salz
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-05-05Document inversion ladder in curve25519Emilia Kasper
This demystifies two for-loops that do nothing. They were used to write the ladder in a unified way. Now that the ladder is otherwise commented, remove the dead loops. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-04Curve25519: fix const-initializationEmilia Kasper
Clang is permissive of this, but gcc fails. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-04Curve25519: avoid undefined behaviourEmilia Kasper
Appease the sanitizer: avoid left shifts of negative values. This could've been done entirely with casts to uint and back, but using masks seemed slightly more readable. There are also implementation-defined signed right shifts in this code. Those remain. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-03Clean up curve25519 buildEmilia Kasper
- Remove OPENSSL_X25519_X86_64 which never worked, because we don't have the assembly. - Also remove OPENSSL_SMALL (which should have been OPENSSL_SMALL_FOOTPRINT) which isn't a priority at the moment. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-02curve25519: add missing const-qualifierEmilia Kasper
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
2016-03-02Make k25519Precomp constKurt Roeckx
Reviewed-by: Dr. Stephen Henson <steve@openssl.org> MR: #2184
2016-02-29remove unused variablesDr. Stephen Henson
Reviewed-by: Emilia Käsper <emilia@openssl.org>
2016-02-28Remove unused code.Dr. Stephen Henson
Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Emilia Käsper <emilia@openssl.org>
2016-02-28Change BORINGSSL defines to OPENSSLDr. Stephen Henson
Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Emilia Käsper <emilia@openssl.org>
2016-02-28Initial adaptations for Curve25519 code.Dr. Stephen Henson
Fix "mixed declarations and code" warnings. Use OpenSSL headers. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Emilia Käsper <emilia@openssl.org>
2016-02-28Place under OpenSSL license.Emilia Kasper
Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Stephen Henson <steve@openssl.org>
2016-02-28Add X25519 code from BoringSSL.Dr. Stephen Henson
Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Emilia Käsper <emilia@openssl.org>