Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
derekparker committed May 11, 2024
1 parent 1e87b5c commit 687de02
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions patches/015-add-hash-sign-verify.patch
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ index 0000000000..50a39f5d0a
+}
diff --git a/src/crypto/ecdsa/ecdsa_hashsignverify_test.go b/src/crypto/ecdsa/ecdsa_hashsignverify_test.go
new file mode 100644
index 0000000000..721bd4a825
index 0000000000..6cd4c036a3
--- /dev/null
+++ b/src/crypto/ecdsa/ecdsa_hashsignverify_test.go
@@ -0,0 +1,43 @@
Expand All @@ -73,18 +73,18 @@ index 0000000000..721bd4a825
+
+ msg := []byte("testing")
+ h := crypto.SHA256
+ r, s, err := HashSign(rand.Reader, priv, msg, h)
+ hsm, err := HashSign(rand.Reader, priv, msg, h)
+ if err != nil {
+ t.Errorf("%s: error signing: %s", tag, err)
+ return
+ }
+
+ if !HashVerify(&priv.PublicKey, msg, r, s, h) {
+ if !HashVerify(&priv.PublicKey, msg, hsm, h) {
+ t.Errorf("%s: Verify failed", tag)
+ }
+
+ msg[0] ^= 0xff
+ if HashVerify(&priv.PublicKey, msg, r, s, h) {
+ if HashVerify(&priv.PublicKey, msg, hsm, h) {
+ t.Errorf("%s: Verify should not have succeeded", tag)
+ }
+}
Expand Down

0 comments on commit 687de02

Please sign in to comment.