mirror of
https://github.com/golang/go.git
synced 2026-02-02 00:52:04 +03:00
[dev.boringcrypto] crypto/rsa: fix boringFakeRandomBlind to work with (*big.Int).ModInverse
http://golang.org/cl/108996 removed the local modInverse and its call in decrypt in favor of (*big.Int).ModInverse. boringFakeRandomBlind copies decrypt, so it needs to be updated as well. Change-Id: I59a6c17c2fb9cc7f38cbb59dd9ed11846737d220 Reviewed-on: https://go-review.googlesource.com/113676 Run-TryBot: Filippo Valsorda <filippo@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
@@ -147,6 +147,7 @@ func boringFakeRandomBlind(random io.Reader, priv *PrivateKey) {
|
||||
boring.UnreachableExceptTests()
|
||||
|
||||
// Copied from func decrypt.
|
||||
ir := new(big.Int)
|
||||
for {
|
||||
r, err := rand.Int(random, priv.N)
|
||||
if err != nil {
|
||||
@@ -155,8 +156,8 @@ func boringFakeRandomBlind(random io.Reader, priv *PrivateKey) {
|
||||
if r.Cmp(bigZero) == 0 {
|
||||
r = bigOne
|
||||
}
|
||||
_, ok := modInverse(r, priv.N)
|
||||
if ok {
|
||||
ok := ir.ModInverse(r, priv.N)
|
||||
if ok != nil {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user