1
0
mirror of https://github.com/golang/go synced 2024-11-08 04:56:16 -07:00
go/src/crypto
Bryan A Ford d58bf64d5a crypto/subtle: simplify and speed up constant-time primitives
This changes improves the ConstantTimeByteEq and ConstantTimeEq
primitives to both simplify them and improve their performance.

Also, since there were no benchmarks for this package before,
this change adds benchmarks for ConstantTimeByteEq,
ConstantTimeEq, and ConstantTimeLessOrEq.

benchmarks on darwin/amd64, 10 runs on old vs new code:

name                    old time/op  new time/op  delta
ConstantTimeByteEq-4    2.28ns ±16%  1.53ns ± 2%  -33.09%  (p=0.000 n=10+9)
ConstantTimeEq-4        2.77ns ±10%  1.51ns ± 2%  -45.59%  (p=0.000 n=10+9)
ConstantTimeLessOrEq-4  1.52ns ± 8%  1.50ns ± 2%     ~     (p=0.866 n=9+9)

Change-Id: I29b8cbcf158e1f30411720db82d38b4ecd166b15
Reviewed-on: https://go-review.googlesource.com/45310
Reviewed-by: Adam Langley <agl@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-11-10 03:47:57 +00:00
..
aes crypto/aes: use s390x KMA instruction for AES-GCM if available 2017-11-06 07:58:37 +00:00
cipher crypto/cipher, crypto/rc4: make overlap rules wording consistent 2017-10-31 22:36:43 +00:00
des crypto: revise wording about cryptographically broken algorithms 2017-05-04 12:31:18 +00:00
dsa all: fix article typos 2017-09-15 02:39:16 +00:00
ecdsa crypto/{ecdsa,rsa}: rename argument to PrivateKey.Sign. 2017-10-29 19:45:11 +00:00
elliptic all: change github.com issue links to golang.org 2017-11-04 04:13:41 +00:00
hmac
internal/cipherhw
md5 crypto, hash: implement BinaryMarshaler, BinaryUnmarshaler in hash implementations 2017-11-01 21:04:12 +00:00
rand crypto/rand: batch large calls to linux getrandom 2017-08-09 19:29:14 +00:00
rc4 crypto/cipher, crypto/rc4: make overlap rules wording consistent 2017-10-31 22:36:43 +00:00
rsa crypto/{ecdsa,rsa}: rename argument to PrivateKey.Sign. 2017-10-29 19:45:11 +00:00
sha1 crypto, hash: implement BinaryMarshaler, BinaryUnmarshaler in hash implementations 2017-11-01 21:04:12 +00:00
sha256 crypto, hash: implement BinaryMarshaler, BinaryUnmarshaler in hash implementations 2017-11-01 21:04:12 +00:00
sha512 crypto, hash: implement BinaryMarshaler, BinaryUnmarshaler in hash implementations 2017-11-01 21:04:12 +00:00
subtle crypto/subtle: simplify and speed up constant-time primitives 2017-11-10 03:47:57 +00:00
tls crypto/tls: limit number of consecutive warning alerts 2017-11-08 23:18:52 +00:00
x509 crypto/x509: enforce EKU nesting at chain-construction time. 2017-11-07 23:14:10 +00:00
crypto.go crypto: add BLAKE2b and BLAKE2s hash constants 2017-03-01 19:26:16 +00:00
issue21104_test.go crypto/{aes,cipher,rc4}: fix out of bounds write in stream ciphers 2017-08-09 04:17:51 +00:00