]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
crypto: ecdh - fix big endian bug in ECC library
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Wed, 23 Oct 2019 09:50:44 +0000 (11:50 +0200)
committerMarcelo Henrique Cerri <marcelo.cerri@canonical.com>
Fri, 17 Jan 2020 17:22:29 +0000 (14:22 -0300)
commitc0d71f756d91a1002c9a8755a9f71a7cf18f1250
tree8005f026b3dd7446f12a04b10ddf0cc1d387f421
parentf57ed0d0735b200f795c3bbdd1d7556a14a24296
crypto: ecdh - fix big endian bug in ECC library

BugLink: https://bugs.launchpad.net/bugs/1857158
commit f398243e9fd6a3a059c1ea7b380c40628dbf0c61 upstream.

The elliptic curve arithmetic library used by the EC-DH KPP implementation
assumes big endian byte order, and unconditionally reverses the byte
and word order of multi-limb quantities. On big endian systems, the byte
reordering is not necessary, while the word ordering needs to be retained.

So replace the __swab64() invocation with a call to be64_to_cpu() which
should do the right thing for both little and big endian builds.

Fixes: 3c4b23901a0c ("crypto: ecdh - Add ECDH software support")
Cc: <stable@vger.kernel.org> # v4.9+
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
crypto/ecc.c