go.crypto/bcrypt: fix interger overflow for cost == 31
Fixes golang/go#4803. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/7329043
This commit is contained in:
+3
-2
@@ -220,8 +220,9 @@ func expensiveBlowfishSetup(key []byte, cost uint32, salt []byte) (*blowfish.Cip
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
rounds := 1 << cost
|
var i, rounds uint64
|
||||||
for i := 0; i < rounds; i++ {
|
rounds = 1 << cost
|
||||||
|
for i = 0; i < rounds; i++ {
|
||||||
blowfish.ExpandKey(ckey, c)
|
blowfish.ExpandKey(ckey, c)
|
||||||
blowfish.ExpandKey(csalt, c)
|
blowfish.ExpandKey(csalt, c)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user