File tree 1 file changed +6
-2
lines changed
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,11 @@ func testECDSASignAndVerify(t *testing.T, c elliptic.Curve) {
70
70
if ! openssl .VerifyECDSA (pub , hashed [:], signed ) {
71
71
t .Errorf ("Verify failed" )
72
72
}
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
74
78
if openssl .VerifyECDSA (pub , hashed [:], signed ) {
75
79
t .Errorf ("Verify succeeded despite intentionally invalid hash!" )
76
80
}
@@ -81,7 +85,7 @@ func testECDSASignAndVerify(t *testing.T, c elliptic.Curve) {
81
85
if ! openssl .HashVerifyECDSA (pub , crypto .SHA256 , msg , signed ) {
82
86
t .Errorf ("Verify failed" )
83
87
}
84
- signed [0 ] ^= 0xff
88
+ signed [len ( signed ) - 1 ] ^= 0xff
85
89
if openssl .HashVerifyECDSA (pub , crypto .SHA256 , msg , signed ) {
86
90
t .Errorf ("Verify failed" )
87
91
}
You can’t perform that action at this time.
0 commit comments