openpgp/clearsign: just use rand.Reader in tests
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 <tatianabradley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Roland Shoemaker <roland@golang.org> Reviewed-by: Filippo Valsorda <filippo@golang.org>
This commit is contained in:
committed by
Gopher Robot
parent
3e90321ac7
commit
7042ebcbe0
@@ -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) {
|
func TestMultiSign(t *testing.T) {
|
||||||
if testing.Short() {
|
if testing.Short() {
|
||||||
t.Skip("skipping long test in -short mode")
|
t.Skip("skipping long test in -short mode")
|
||||||
}
|
}
|
||||||
|
|
||||||
zero := quickRand(0)
|
var config packet.Config
|
||||||
config := packet.Config{Rand: &zero}
|
|
||||||
|
|
||||||
for nKeys := 0; nKeys < 4; nKeys++ {
|
for nKeys := 0; nKeys < 4; nKeys++ {
|
||||||
nextTest:
|
nextTest:
|
||||||
|
|||||||
Reference in New Issue
Block a user