Skip to content

Commit

Permalink
Tests: Fix flakey ECDSA testing (#6005)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonpaulos authored May 30, 2024
1 parent 2335b35 commit 2f852b7
Showing 1 changed file with 4 additions and 4 deletions.
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

0 comments on commit 2f852b7

Please sign in to comment.