Curve25519: avoid undefined behaviour
authorEmilia Kasper <emilia@openssl.org>
Wed, 2 Mar 2016 22:50:58 +0000 (23:50 +0100)
committerEmilia Kasper <emilia@openssl.org>
Fri, 4 Mar 2016 11:28:01 +0000 (12:28 +0100)
commitb95779846dc876cf959ccf96c49d4c0a48ea3082
treedb298430049e9aa2b52c52a4abea1fc7b05d034c
parenta66ec57c6e5c303e288b9bee7272319375ce25ae
Curve25519: avoid undefined behaviour

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