fix possible test failure

This commit is contained in:
Sun Yimin 2023-03-07 08:55:09 +08:00 committed by GitHub
parent 08e9fb79c1
commit 71657b8d34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -14,7 +14,7 @@ import (
func randomK(r io.Reader, ord *big.Int) (k *big.Int, err error) {
for {
k, err = rand.Int(r, ord)
if k.Sign() > 0 || err != nil {
if err != nil || (k.Sign() > 0 && len(k.Bytes()) == 32) {
return
}
}

View File

@ -12,7 +12,7 @@ import (
func randomK(r io.Reader) (k *big.Int, err error) {
for {
k, err = rand.Int(r, Order)
if k.Sign() > 0 || err != nil {
if err != nil || k.Sign() > 0 {
return
}
}