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>
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 @@ // 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)