diff --git a/src/pkg/crypto/rsa/rsa.go b/src/pkg/crypto/rsa/rsa.go index 8ca87485a8..65258781bd 100644 --- a/src/pkg/crypto/rsa/rsa.go +++ b/src/pkg/crypto/rsa/rsa.go @@ -16,6 +16,7 @@ import ( "os"; ) +var bigZero = big.NewInt(0) var bigOne = big.NewInt(1) // randomSafePrime returns a number, p, of the given size, such that p and @@ -322,6 +323,9 @@ func decrypt(rand io.Reader, priv *PrivateKey, c *big.Int) (m *big.Int, err os.E err = err1; return; } + if big.CmpInt(r, bigZero) == 0 { + r = bigOne; + } ir = modInverse(r, priv.N); bigE := big.NewInt(int64(priv.E)); rpowe := new(big.Int).Exp(r, bigE, priv.N);