Skip to content

Commit 2cf3ade

Browse files
rolandshoemakergopherbot
authored andcommitted
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 <[email protected]> Auto-Submit: Roland Shoemaker <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Bryan Mills <[email protected]>
1 parent eb4f295 commit 2cf3ade

File tree

3 files changed

+31
-8
lines changed

3 files changed

+31
-8
lines changed

internal/wycheproof/boring.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Copyright 2022 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
//go:build boringcrypto
6+
7+
package wycheproof
8+
9+
const boringcryptoEnabled = true

internal/wycheproof/notboring.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Copyright 2022 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
//go:build !boringcrypto
6+
7+
package wycheproof
8+
9+
const boringcryptoEnabled = false

internal/wycheproof/rsa_pss_test.go

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,17 +112,22 @@ func TestRsaPss(t *testing.T) {
112112
// works deterministically to auto-detect the length when
113113
// verifying, so these tests actually pass as they should.
114114
filesOverrideToPassZeroSLen := map[string][]int{
115-
"rsa_pss_2048_sha1_mgf1_20_test.json": []int{46, 47},
116-
"rsa_pss_2048_sha256_mgf1_0_test.json": []int{67, 68},
117-
"rsa_pss_2048_sha256_mgf1_32_test.json": []int{67, 68},
118-
"rsa_pss_2048_sha512_256_mgf1_28_test.json": []int{13, 14, 15},
119-
"rsa_pss_2048_sha512_256_mgf1_32_test.json": []int{13, 14},
120-
"rsa_pss_3072_sha256_mgf1_32_test.json": []int{67, 68},
121-
"rsa_pss_4096_sha256_mgf1_32_test.json": []int{67, 68},
122-
"rsa_pss_4096_sha512_mgf1_32_test.json": []int{136, 137},
115+
"rsa_pss_2048_sha1_mgf1_20_test.json": []int{46, 47},
116+
"rsa_pss_2048_sha256_mgf1_0_test.json": []int{67, 68},
117+
"rsa_pss_2048_sha256_mgf1_32_test.json": []int{67, 68},
118+
"rsa_pss_3072_sha256_mgf1_32_test.json": []int{67, 68},
119+
"rsa_pss_4096_sha256_mgf1_32_test.json": []int{67, 68},
120+
"rsa_pss_4096_sha512_mgf1_32_test.json": []int{136, 137},
123121
// "rsa_pss_misc_test.json": nil, // TODO: This ones seems to be broken right now, but can enable later on.
124122
}
125123

124+
if !boringcryptoEnabled {
125+
// boringcrypto doesn't support the truncated SHA-512 hashes, so only
126+
// test them if boringcrypto isn't enabled.
127+
filesOverrideToPassZeroSLen["rsa_pss_2048_sha512_256_mgf1_28_test.json"] = []int{13, 14, 15}
128+
filesOverrideToPassZeroSLen["rsa_pss_2048_sha512_256_mgf1_32_test.json"] = []int{13, 14}
129+
}
130+
126131
for f := range filesOverrideToPassZeroSLen {
127132
var root Root
128133
readTestVector(t, f, &root)

0 commit comments

Comments
 (0)