aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/golang.org/x/crypto/bcrypt/bcrypt.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/golang.org/x/crypto/bcrypt/bcrypt.go')
-rw-r--r--vendor/golang.org/x/crypto/bcrypt/bcrypt.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/vendor/golang.org/x/crypto/bcrypt/bcrypt.go b/vendor/golang.org/x/crypto/bcrypt/bcrypt.go
index f8b807f..202fa8a 100644
--- a/vendor/golang.org/x/crypto/bcrypt/bcrypt.go
+++ b/vendor/golang.org/x/crypto/bcrypt/bcrypt.go
@@ -12,9 +12,10 @@ import (
12 "crypto/subtle" 12 "crypto/subtle"
13 "errors" 13 "errors"
14 "fmt" 14 "fmt"
15 "golang.org/x/crypto/blowfish"
16 "io" 15 "io"
17 "strconv" 16 "strconv"
17
18 "golang.org/x/crypto/blowfish"
18) 19)
19 20
20const ( 21const (
@@ -205,7 +206,6 @@ func bcrypt(password []byte, cost int, salt []byte) ([]byte, error) {
205} 206}
206 207
207func expensiveBlowfishSetup(key []byte, cost uint32, salt []byte) (*blowfish.Cipher, error) { 208func expensiveBlowfishSetup(key []byte, cost uint32, salt []byte) (*blowfish.Cipher, error) {
208
209 csalt, err := base64Decode(salt) 209 csalt, err := base64Decode(salt)
210 if err != nil { 210 if err != nil {
211 return nil, err 211 return nil, err
@@ -213,7 +213,8 @@ func expensiveBlowfishSetup(key []byte, cost uint32, salt []byte) (*blowfish.Cip
213 213
214 // Bug compatibility with C bcrypt implementations. They use the trailing 214 // Bug compatibility with C bcrypt implementations. They use the trailing
215 // NULL in the key string during expansion. 215 // NULL in the key string during expansion.
216 ckey := append(key, 0) 216 // We copy the key to prevent changing the underlying array.
217 ckey := append(key[:len(key):len(key)], 0)
217 218
218 c, err := blowfish.NewSaltedCipher(ckey, csalt) 219 c, err := blowfish.NewSaltedCipher(ckey, csalt)
219 if err != nil { 220 if err != nil {