Skip to content

Commit 8f070c7

Browse files
qmuntaldagood
andauthored
Avoid SymCrypt provider logs in TestECDSASignAndVerify (#155)
* avoid SymCrypt provider logs in TestECDSASignAndVerify * Update ecdsa_test.go Co-authored-by: Davis Goodin <[email protected]> --------- Co-authored-by: Davis Goodin <[email protected]>
1 parent 8af1b8f commit 8f070c7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Diff for: ecdsa_test.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,11 @@ func testECDSASignAndVerify(t *testing.T, c elliptic.Curve) {
7070
if !openssl.VerifyECDSA(pub, hashed[:], signed) {
7171
t.Errorf("Verify failed")
7272
}
73-
signed[0] ^= 0xff
73+
// Alter the signature to intentionally make it invalid. Change the last
74+
// byte (rather than the first) to avoid corrupting the DER encoding, which
75+
// would cause some OpenSSL providers, such as SymCrypt-OpenSSL, to write a
76+
// noisy warning to stderr.
77+
signed[len(signed)-1] ^= 0xff
7478
if openssl.VerifyECDSA(pub, hashed[:], signed) {
7579
t.Errorf("Verify succeeded despite intentionally invalid hash!")
7680
}
@@ -81,7 +85,7 @@ func testECDSASignAndVerify(t *testing.T, c elliptic.Curve) {
8185
if !openssl.HashVerifyECDSA(pub, crypto.SHA256, msg, signed) {
8286
t.Errorf("Verify failed")
8387
}
84-
signed[0] ^= 0xff
88+
signed[len(signed)-1] ^= 0xff
8589
if openssl.HashVerifyECDSA(pub, crypto.SHA256, msg, signed) {
8690
t.Errorf("Verify failed")
8791
}

0 commit comments

Comments
 (0)