summaryrefslogtreecommitdiff
path: root/src/pkg/crypto/rand/util.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/crypto/rand/util.go')
-rw-r--r--src/pkg/crypto/rand/util.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/pkg/crypto/rand/util.go b/src/pkg/crypto/rand/util.go
index 77028476e..fc5fe6c65 100644
--- a/src/pkg/crypto/rand/util.go
+++ b/src/pkg/crypto/rand/util.go
@@ -5,16 +5,16 @@
package rand
import (
- "big"
+ "errors"
"io"
- "os"
+ "math/big"
)
// Prime returns a number, p, of the given size, such that p is prime
// with high probability.
-func Prime(rand io.Reader, bits int) (p *big.Int, err os.Error) {
+func Prime(rand io.Reader, bits int) (p *big.Int, err error) {
if bits < 1 {
- err = os.EINVAL
+ err = errors.New("crypto/rand: prime size must be positive")
}
b := uint(bits % 8)
@@ -48,7 +48,7 @@ func Prime(rand io.Reader, bits int) (p *big.Int, err os.Error) {
}
// Int returns a uniform random value in [0, max).
-func Int(rand io.Reader, max *big.Int) (n *big.Int, err os.Error) {
+func Int(rand io.Reader, max *big.Int) (n *big.Int, err error) {
k := (max.BitLen() + 7) / 8
// b is the number of bits in the most significant byte of max.