]> Cypherpunks repositories - gostls13.git/commit
crypto/ecdsa: implement ecdsa on s390x for P256/P384/P521 using KDSA instruction
authorRuixin Bao <ruixin.bao@ibm.com>
Wed, 15 Apr 2020 20:50:50 +0000 (16:50 -0400)
committerMichael Munday <mike.munday@ibm.com>
Mon, 27 Apr 2020 19:49:49 +0000 (19:49 +0000)
commita637ee1970ac9f005094fd46eadd64c4433168e7
tree3865e4fcc18b40383419bc5aedd9e09aa1c021e0
parentd646c035f9749d647b2a3fdab48011d04e0bc2c1
crypto/ecdsa: implement ecdsa on s390x for P256/P384/P521 using KDSA instruction

This CL revives CL 174437(also IBM CLA) and adds benchmarks and some simplifications.

The original commit message is as follows:

Utilize KDSA when available. This guarantees constant time operation on all three curves mentioned,
and is faster than conventional assembly.

Benchmarks:
name             old time/op    new time/op    delta
SignP256-8         15.2µs ±14%    14.1µs ±18%     ~     (p=0.356 n=9+10)
SignP384-8         4.28ms ±26%    0.02ms ±30%  -99.43%  (p=0.000 n=10+10)
VerifyP256-8       33.6µs ±13%    13.3µs ±38%  -60.32%  (p=0.000 n=9+10)

name             old alloc/op   new alloc/op   delta
SignP256-8         2.16kB ± 0%    1.60kB ± 0%  -25.63%  (p=0.000 n=9+10)
SignP384-8         1.75MB ± 0%    0.00MB ± 0%  -99.90%  (p=0.000 n=9+10)
VerifyP256-8       1.08kB ± 0%    0.18kB ± 0%  -83.70%  (p=0.000 n=9+10)

name             old allocs/op  new allocs/op  delta
SignP256-8           29.0 ± 0%      22.0 ± 0%  -24.14%  (p=0.000 n=10+10)
SignP384-8          14.4k ± 0%      0.0k ± 0%  -99.85%  (p=0.000 n=9+10)
VerifyP256-8         23.0 ± 0%       7.0 ± 0%  -69.57%  (p=0.000 n=10+10)

Change-Id: Ifa1fc5917fa7592dd592affa7549147dbc9b4169
Reviewed-on: https://go-review.googlesource.com/c/go/+/228580
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Munday <mike.munday@ibm.com>
src/crypto/ecdsa/ecdsa.go
src/crypto/ecdsa/ecdsa_noasm.go [new file with mode: 0644]
src/crypto/ecdsa/ecdsa_s390x.go [new file with mode: 0644]
src/crypto/ecdsa/ecdsa_s390x.s [new file with mode: 0644]
src/crypto/ecdsa/ecdsa_s390x_test.go [new file with mode: 0644]