Skip to content

Commit

Permalink
openpgp/clearsign: just use rand.Reader in tests
Browse files Browse the repository at this point in the history
Instead of a convoluted fake rand, it is _basically_ just as fast, and
fixes errors that pop up due to bad entropy.

Fixes golang/go#70682

Change-Id: Ib0f605398d1092b516b03135f602c644be2a060f
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/633655
Reviewed-by: Tatiana Bradley <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Auto-Submit: Roland Shoemaker <[email protected]>
Reviewed-by: Filippo Valsorda <[email protected]>
  • Loading branch information
rolandshoemaker authored and gopherbot committed Dec 4, 2024
1 parent 3e90321 commit 7042ebc
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions openpgp/clearsign/clearsign_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,24 +123,12 @@ func TestSigning(t *testing.T) {
}
}

// We use this to make test keys, so that they aren't all the same.
type quickRand byte

func (qr *quickRand) Read(p []byte) (int, error) {
for i := range p {
p[i] = byte(*qr)
}
*qr++
return len(p), nil
}

func TestMultiSign(t *testing.T) {
if testing.Short() {
t.Skip("skipping long test in -short mode")
}

zero := quickRand(0)
config := packet.Config{Rand: &zero}
var config packet.Config

for nKeys := 0; nKeys < 4; nKeys++ {
nextTest:
Expand Down

0 comments on commit 7042ebc

Please sign in to comment.