ec/curve25519.c: "double" ecdhx25519 performance on 64-bit platforms.
authorAndy Polyakov <appro@openssl.org>
Wed, 27 Dec 2017 10:55:34 +0000 (11:55 +0100)
committerAndy Polyakov <appro@openssl.org>
Thu, 28 Dec 2017 18:37:43 +0000 (19:37 +0100)
commitcfc32a1efb464205885e18e503bcb7051c307008
tree703383b9e61d647c8b63e10a2f04c085b3aa01d2
parentc6a623adaa0ac4ea6b148172aaa466f287b1d8ae
ec/curve25519.c: "double" ecdhx25519 performance on 64-bit platforms.

"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>
crypto/ec/curve25519.c