Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add expected failure assertion in pkcs unpadded signature test #273

Open
wants to merge 1 commit into
base: go1.19-fips-release
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions patches/013-fix-pkcs-test.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
diff --git a/src/crypto/rsa/pkcs1v15_test.go b/src/crypto/rsa/pkcs1v15_test.go
index c164ec5706..42b479aa50 100644
--- a/src/crypto/rsa/pkcs1v15_test.go
+++ b/src/crypto/rsa/pkcs1v15_test.go
@@ -16,6 +16,7 @@ import (
"encoding/hex"
"io"
"math/big"
+ "strings"
"testing"
"testing/quick"
)
@@ -268,6 +269,12 @@ func TestUnpaddedSignature(t *testing.T) {

sig, err := SignPKCS1v15(nil, boringRsaPrivateKey, crypto.Hash(0), msg)
if err != nil {
+ if boring.Enabled() {
+ if !strings.Contains(err.Error(), "operation not supported for this keytype") {
+ t.Fatal("unexpected error message in FIPS mode:", err)
+ }
+ t.Skip("skipping test in FIPS mode with expected error:", err)
+ }
t.Fatalf("SignPKCS1v15 failed: %s", err)
}
if !bytes.Equal(sig, expectedSig) {
@@ -325,10 +332,9 @@ var rsaPrivateKey = &PrivateKey{
},
}

-
// This key is generated with the following command:
//
-// openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -out key.pem
+// openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -out key.pem
//
// In order to generate new test vectors you'll need the PEM form of this key (and s/TESTING/PRIVATE/):
// -----BEGIN RSA TESTING KEY-----
Loading