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

Tests: Fix flakey ECDSA testing #6005

Merged
merged 1 commit into from
May 30, 2024
Merged
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
8 changes: 4 additions & 4 deletions data/transactions/logic/crypto_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -606,8 +606,8 @@ ecdsa_verify Secp256r1

ri, si, err := ecdsa.Sign(rand.Reader, key, msg[:])
require.NoError(t, err)
r := ri.Bytes()
s := si.Bytes()
r := ri.FillBytes(make([]byte, 32))
s := si.FillBytes(make([]byte, 32))

rTampered := slices.Clone(r)
rTampered[0] += byte(1) // intentional overflow
Expand Down Expand Up @@ -826,8 +826,8 @@ func benchmarkEcdsaGenData(b *testing.B, curve EcdsaCurve) (data []benchmarkEcds
} else if curve == Secp256r1 {
r, s, err := ecdsa.Sign(rand.Reader, key, data[i].msg[:])
require.NoError(b, err)
data[i].r = r.Bytes()
data[i].s = s.Bytes()
data[i].r = r.FillBytes(make([]byte, 32))
data[i].s = s.FillBytes(make([]byte, 32))
}
}
return data
Expand Down
Loading