diff options
| author | Roland Shoemaker <roland@golang.org> | 2022-05-06 11:46:21 -0700 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2022-05-07 01:19:49 +0000 |
| commit | 2cf3adece1227c48e1673f1c37d70357e1a6b9d3 (patch) | |
| tree | 8d4047572bfe0723fa0f32eec80ec75e0ecaacaa | |
| parent | eb4f295cb31f7fb5d52810411604a2638c9b19a2 (diff) | |
| download | go-x-crypto-2cf3adece1227c48e1673f1c37d70357e1a6b9d3.tar.xz | |
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>
| -rw-r--r-- | internal/wycheproof/boring.go | 9 | ||||
| -rw-r--r-- | internal/wycheproof/notboring.go | 9 | ||||
| -rw-r--r-- | internal/wycheproof/rsa_pss_test.go | 21 |
3 files changed, 31 insertions, 8 deletions
diff --git a/internal/wycheproof/boring.go b/internal/wycheproof/boring.go new file mode 100644 index 0000000..aefa3ab --- /dev/null +++ b/internal/wycheproof/boring.go @@ -0,0 +1,9 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build boringcrypto + +package wycheproof + +const boringcryptoEnabled = true diff --git a/internal/wycheproof/notboring.go b/internal/wycheproof/notboring.go new file mode 100644 index 0000000..746af13 --- /dev/null +++ b/internal/wycheproof/notboring.go @@ -0,0 +1,9 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !boringcrypto + +package wycheproof + +const boringcryptoEnabled = false diff --git a/internal/wycheproof/rsa_pss_test.go b/internal/wycheproof/rsa_pss_test.go index 365ca92..2ad9a43 100644 --- a/internal/wycheproof/rsa_pss_test.go +++ b/internal/wycheproof/rsa_pss_test.go @@ -112,17 +112,22 @@ func TestRsaPss(t *testing.T) { // works deterministically to auto-detect the length when // verifying, so these tests actually pass as they should. filesOverrideToPassZeroSLen := map[string][]int{ - "rsa_pss_2048_sha1_mgf1_20_test.json": []int{46, 47}, - "rsa_pss_2048_sha256_mgf1_0_test.json": []int{67, 68}, - "rsa_pss_2048_sha256_mgf1_32_test.json": []int{67, 68}, - "rsa_pss_2048_sha512_256_mgf1_28_test.json": []int{13, 14, 15}, - "rsa_pss_2048_sha512_256_mgf1_32_test.json": []int{13, 14}, - "rsa_pss_3072_sha256_mgf1_32_test.json": []int{67, 68}, - "rsa_pss_4096_sha256_mgf1_32_test.json": []int{67, 68}, - "rsa_pss_4096_sha512_mgf1_32_test.json": []int{136, 137}, + "rsa_pss_2048_sha1_mgf1_20_test.json": []int{46, 47}, + "rsa_pss_2048_sha256_mgf1_0_test.json": []int{67, 68}, + "rsa_pss_2048_sha256_mgf1_32_test.json": []int{67, 68}, + "rsa_pss_3072_sha256_mgf1_32_test.json": []int{67, 68}, + "rsa_pss_4096_sha256_mgf1_32_test.json": []int{67, 68}, + "rsa_pss_4096_sha512_mgf1_32_test.json": []int{136, 137}, // "rsa_pss_misc_test.json": nil, // TODO: This ones seems to be broken right now, but can enable later on. } + if !boringcryptoEnabled { + // boringcrypto doesn't support the truncated SHA-512 hashes, so only + // test them if boringcrypto isn't enabled. + filesOverrideToPassZeroSLen["rsa_pss_2048_sha512_256_mgf1_28_test.json"] = []int{13, 14, 15} + filesOverrideToPassZeroSLen["rsa_pss_2048_sha512_256_mgf1_32_test.json"] = []int{13, 14} + } + for f := range filesOverrideToPassZeroSLen { var root Root readTestVector(t, f, &root) |
