Roland Shoemaker
7e3ac2043e
internal/wycheproof: also use Verify in TestECDSA
...
Check both Verify and VerifyASN1 in the ECDSA tests.
Change-Id: Id767354484a7da18ae4e00cd6f2a01a2909e6732
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/453755
Reviewed-by: Than McIntosh <thanm@google.com >
Run-TryBot: Roland Shoemaker <roland@golang.org >
TryBot-Result: Gopher Robot <gobot@golang.org >
Reviewed-by: Filippo Valsorda <filippo@golang.org >
2022-12-21 16:58:14 +00:00
Filippo Valsorda
0ec7e8322c
internal/wycheproof: update Go 1.20 crypto/ecdh API
...
For golang/go#56052
Change-Id: If34d01132e221ff525319e43d127ef14579f9054
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/451095
Reviewed-by: Bryan Mills <bcmills@google.com >
Reviewed-by: Joedian Reid <joedian@golang.org >
Auto-Submit: Filippo Valsorda <filippo@golang.org >
Run-TryBot: Filippo Valsorda <filippo@golang.org >
Run-TryBot: Joedian Reid <joedian@golang.org >
TryBot-Result: Gopher Robot <gobot@golang.org >
2022-11-16 16:25:40 +00:00
cui fliter
35f4265a4b
all: replace io/ioutil with io and os package
...
For golang/go#45557
Change-Id: I447530cc66896aef7a8d528ccb8d095b80e3cf47
GitHub-Last-Rev: 5f385ff46487ac318bd1147cdbbd26bb0ffd0426
GitHub-Pull-Request: golang/crypto#230
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/430797
Auto-Submit: Ian Lance Taylor <iant@google.com >
Reviewed-by: Ian Lance Taylor <iant@google.com >
Reviewed-by: Meng Zhuo <mzh@golangcn.org >
Run-TryBot: Ian Lance Taylor <iant@google.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
Reviewed-by: Cherry Mui <cherryyz@google.com >
2022-09-19 17:36:07 +00:00
Roland Shoemaker
c86fa9a7ed
internal/wycheproof: add crypto/ecdh tests
...
Alongside the existing ECDH tests, add tests that use the new
crypto/ecdh package. The test vectors include a number of private
that use non-standard sizes, which we reject, but aren't flagged,
so we need to skip them.
Change-Id: Iaaef225b0149a86833095f51748d230385d43bfe
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/424274
Reviewed-by: Russ Cox <rsc@golang.org >
Run-TryBot: Roland Shoemaker <roland@golang.org >
Reviewed-by: Filippo Valsorda <filippo@golang.org >
TryBot-Result: Gopher Robot <gobot@golang.org >
Auto-Submit: Roland Shoemaker <roland@golang.org >
2022-08-29 22:05:03 +00:00
Roland Shoemaker
2cf3adece1
internal/wycheproof: skip truncated SHA-512 RSAPSS tests for boring
...
On the boringcrypto builder, skip the RSAPSS tests that use the
truncated SHA-512 hashes, since boringcrypto does not support them.
Fixes #52670
Change-Id: I8caecd0f34eb6d2740372db2b641563e3965ac7c
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/404654
Run-TryBot: Roland Shoemaker <roland@golang.org >
Auto-Submit: Roland Shoemaker <roland@golang.org >
TryBot-Result: Gopher Robot <gobot@golang.org >
Reviewed-by: Bryan Mills <bcmills@google.com >
2022-05-07 01:19:49 +00:00
Filippo Valsorda
eb4f295cb3
internal/wycheproof: add ECDH tests, including point decompression
...
Fixes golang/go#38936
Change-Id: I231d30fcc683abd9efb36b6fd9cc05f599078ade
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/396174
Run-TryBot: Filippo Valsorda <filippo@golang.org >
TryBot-Result: Gopher Robot <gobot@golang.org >
Reviewed-by: Filippo Valsorda <valsorda@google.com >
Auto-Submit: Filippo Valsorda <filippo@golang.org >
Reviewed-by: Roland Shoemaker <roland@golang.org >
2022-04-27 17:25:11 +00:00
Bryan C. Mills
4570a0811e
internal/wycheproof: skip on builders with flaky network connections
...
This test downloads JSON test files from GitHub. If the network
connection flakes, the test may hang indefinitely, and builders with
flaky network connections might want to avoid unnecessary downloading
anyway.
Fixes golang/go#50076
Change-Id: I0655a34fce8a003794290c0c82ae75492eda4429
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/370659
Trust: Bryan Mills <bcmills@google.com >
Run-TryBot: Bryan Mills <bcmills@google.com >
Reviewed-by: Roland Shoemaker <roland@golang.org >
Reviewed-by: Katie Hockman <katie@golang.org >
TryBot-Result: Gopher Robot <gobot@golang.org >
2021-12-09 19:36:57 +00:00
Yasuhiro Matsumoto
84f357641f
all: fix typos
...
Change-Id: Ie08e43ae603cf2c691d51be0bfb5d164c8fd45ff
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/337189
Reviewed-by: Ian Lance Taylor <iant@golang.org >
Trust: Cherry Mui <cherryyz@google.com >
2021-09-20 02:37:35 +00:00
Russ Cox
5ea612d1eb
all: go fmt ./...
...
Make all our package sources use Go 1.17 gofmt format
(adding //go:build lines).
Not strictly necessary but will avoid spurious changes
as files are edited.
Part of //go:build change (#41184 ).
See https://golang.org/design/draft-gobuild
Change-Id: I70526bf588bf4078887e567795867ece785d666b
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/294415
Trust: Russ Cox <rsc@golang.org >
Run-TryBot: Russ Cox <rsc@golang.org >
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com >
Reviewed-by: Ian Lance Taylor <iant@golang.org >
2021-02-20 03:31:48 +00:00
Roland Shoemaker
7f63de1d35
internal/wycheproof: add RSA OAEP decryption tests
...
Uses only the test vectors that use the same MGF and label hashes.
Change-Id: I971f78556e7b8fdbc785978dca7a613728676697
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/234917
Trust: Roland Shoemaker <roland@golang.org >
Trust: Katie Hockman <katie@golang.org >
Run-TryBot: Roland Shoemaker <roland@golang.org >
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Katie Hockman <katie@golang.org >
2020-10-02 17:02:05 +00:00
Roland Shoemaker
123391ffb6
internal/wycheproof: add generic AEAD test
...
Add a generic AEAD test that exercises the vectors for AES GCM,
ChaCha20Poly-1305, and XChaCha20-Poly1305. Removes the existing
chacha20_poly1305_test.go test.
Change-Id: Icfaba30f8db2a1e32a9459c98cd3af5d63052027
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/234688
Run-TryBot: Katie Hockman <katie@golang.org >
TryBot-Result: Gobot Gobot <gobot@golang.org >
Reviewed-by: Katie Hockman <katie@golang.org >
2020-07-28 19:59:43 +00:00
Roland Shoemaker
70a84ac30b
internal/wycheproof: add tests for hmac generation
...
Required updating wycheproofModVer to pull the most recent test
vectors. Tests against SHA1, SHA224, SHA256, SHA384, and SHA512
constructions but not the SHA3 variants.
Change-Id: I5b66632ac0c7106bd9b405f6636922a6383d8b9e
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/234718
Run-TryBot: Katie Hockman <katie@golang.org >
TryBot-Result: Gobot Gobot <gobot@golang.org >
Reviewed-by: Katie Hockman <katie@golang.org >
2020-06-04 20:27:06 +00:00
Katie Hockman
97fc981609
internal/wycheproof: update TestEcdsa to use ecdsa.VerifyASN1
...
Change-Id: Ibd6ce156550615cb85c06e734641c34fca0cfcd0
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/220697
Run-TryBot: Katie Hockman <katie@golang.org >
TryBot-Result: Gobot Gobot <gobot@golang.org >
Reviewed-by: Filippo Valsorda <filippo@golang.org >
2020-03-20 14:53:29 +00:00
Katie Hockman
0f24fbd83d
internal/wycheproof: add test for ChaCha20-Poly1305 AEAD encryption/decryption
...
Change-Id: I71d62f95954a39c476bee55e22b6fcf96a196de1
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/214939
Run-TryBot: Katie Hockman <katie@golang.org >
TryBot-Result: Gobot Gobot <gobot@golang.org >
Reviewed-by: Filippo Valsorda <filippo@golang.org >
2020-02-21 17:05:53 +00:00
Katie Hockman
1ad67e1f0e
internal/wycheproof: add test for CBC decryption with PKCS#5 padding
...
Change-Id: Ie60bdc10065018e193271b4f90f50298f1272396
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/218323
Run-TryBot: Katie Hockman <katie@golang.org >
TryBot-Result: Gobot Gobot <gobot@golang.org >
Reviewed-by: Filippo Valsorda <filippo@golang.org >
2020-02-19 23:42:26 +00:00
Katie Hockman
a0c6ece9d3
internal/wycheproof: add test for hkdf key extraction
...
Change-Id: I501bcc2f4bd8107937756087d20e849e3a4bc182
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/214584
Run-TryBot: Katie Hockman <katie@golang.org >
TryBot-Result: Gobot Gobot <gobot@golang.org >
Reviewed-by: Filippo Valsorda <filippo@golang.org >
2020-02-06 16:14:12 +00:00
Filippo Valsorda
69ecbb4d6d
cryptobyte: fix panic due to malformed ASN.1 inputs on 32-bit archs
...
When int is 32 bits wide (on 32-bit architectures like 386 and arm), an
overflow could occur, causing a panic, due to malformed ASN.1 being
passed to any of the ASN1 methods of String.
Tested on linux/386 and darwin/amd64.
This fixes CVE-2020-7919 and was found thanks to the Project Wycheproof
test vectors.
Change-Id: I8c9696a8bfad1b40ec877cd740dba3467d66ab54
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/645211
Reviewed-by: Katie Hockman <katiehockman@google.com >
Reviewed-by: Adam Langley <agl@google.com >
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/216677
Run-TryBot: Katie Hockman <katie@golang.org >
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org >
Reviewed-by: Filippo Valsorda <filippo@golang.org >
TryBot-Result: Gobot Gobot <gobot@golang.org >
2020-01-28 17:40:31 +00:00
Katie Hockman
53104e6ec8
internal/wycheproof: skip failing test on 32-bit arm
...
Fixes golang/go#36164
Change-Id: I4248cb3e25346f6859c473b729811b36ac6cf872
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/212625
Reviewed-by: Filippo Valsorda <filippo@golang.org >
2019-12-27 16:37:50 +00:00
Katie Hockman
e9b2fee464
internal/wycheproof: add Wycheproof tests for verifying signatures
...
https://github.com/google/wycheproof provides test vectors exposing
vulnerabilities in crypto packages. This change creates a new package
called internal/wycheproof that runs these Wycheproof tests against
a number of pacakages in the standard library (and in the future,
x/crypto).
Directory structure:
- interal/wycheproof/internal/ecdsa: internal version of ecdsa package which
includes a new function that verifies ASN encoded signatures directly
- interal/wycheproof/internal/dsa: internal version of dsa package which
includes a new function that verifies ASN encoded signatures directly
- internal/wycheproof: all tests
internal/wycheproof/wycheproof_test.go provides utility functions that are
common to many tests in the package, and contains the TestMain which
fetches github.com/google/wycheproof from the source.
This change includes tests for signature verification with dsa, ecdsa,
eddsa, and rsa (both PKCS#1 v1.5 and PSS signatures).
Note that these tests download testdata from github.com/google/wycheproof
by running `go mod download` in the TestMain. This means that internet
access will be necessary in order to run these tests if the testdata is
not already in your module cache.
More tests will be added incrementally.
Change-Id: I0378d4be24b5679fdc186e9fc94c1cc0068e81f7
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/209221
Run-TryBot: Katie Hockman <katie@golang.org >
TryBot-Result: Gobot Gobot <gobot@golang.org >
Reviewed-by: Filippo Valsorda <filippo@golang.org >
2019-12-06 17:25:30 +00:00