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:
Shenghou Ma
2013-02-19 19:16:34 +08:00
parent bf5456312c
commit eccdd1285a
+3 -2
View File
@@ -220,8 +220,9 @@ func expensiveBlowfishSetup(key []byte, cost uint32, salt []byte) (*blowfish.Cip
return nil, err
}
rounds := 1 << cost
for i := 0; i < rounds; i++ {
var i, rounds uint64
rounds = 1 << cost
for i = 0; i < rounds; i++ {
blowfish.ExpandKey(ckey, c)
blowfish.ExpandKey(csalt, c)
}