]> Cypherpunks repositories - gostls13.git/commit
crypto/elliptic: add asm implementation for p256 on ppc64le
authorLynn Boger <laboger@linux.vnet.ibm.com>
Wed, 20 Mar 2019 13:30:27 +0000 (09:30 -0400)
committerLynn Boger <laboger@linux.vnet.ibm.com>
Mon, 28 Oct 2019 12:35:06 +0000 (12:35 +0000)
commitadef06c7a53c16cdf8dfccbd8476417ec9b9ff9a
tree106c40dc6a11b2c1dbd61b74d72a3b2842ef8d18
parentacbed0372ea000db8b1ea69eca9d7acecdf89469
crypto/elliptic: add asm implementation for p256 on ppc64le

This adds an asm implementation of the p256 functions used
in crypto/elliptic, utilizing VMX, VSX to improve performance.
On a power9 the improvement is:

elliptic benchmarks:
name            old time/op    new time/op    delta
BaseMult          1.40ms ± 0%    1.44ms ± 0%   +2.66%  (p=0.029 n=4+4)
BaseMultP256       317µs ± 0%      50µs ± 0%  -84.14%  (p=0.029 n=4+4)
ScalarMultP256     854µs ± 2%     214µs ± 0%  -74.91%  (p=0.029 n=4+4)

ecdsa benchmarks:
name           old time/op    new time/op    delta
SignP256          377µs ± 0%     111µs ± 0%  -70.57%  (p=0.029 n=4+4)
SignP384         6.55ms ± 0%    6.48ms ± 0%   -1.03%  (p=0.029 n=4+4)
VerifyP256       1.19ms ± 0%    0.26ms ± 0%  -78.54%  (p=0.029 n=4+4)
KeyGeneration     319µs ± 0%      52µs ± 0%  -83.56%  (p=0.029 n=4+4)

This implemenation is based on the s390x implementation, using
comparable instructions for most with some minor changes where the
instructions are not quite the same.

Some changes were also needed since s390x is big endian and ppc64le
is little endian.

This also enables the fuzz_test for ppc64le.

Change-Id: I59a69515703b82ad2929f68ba2f11208fa833181
Reviewed-on: https://go-review.googlesource.com/c/go/+/168478
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Munday <mike.munday@ibm.com>
src/crypto/elliptic/fuzz_test.go
src/crypto/elliptic/p256_asm_ppc64le.s [new file with mode: 0644]
src/crypto/elliptic/p256_generic.go
src/crypto/elliptic/p256_ppc64le.go [new file with mode: 0644]