go.crypto: gofmt -w -s
R=golang-dev, dave CC=golang-dev https://golang.org/cl/6948057
This commit is contained in:
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
// algorithm. See http://www.usenix.org/event/usenix99/provos/provos.pdf
|
// algorithm. See http://www.usenix.org/event/usenix99/provos/provos.pdf
|
||||||
package bcrypt
|
package bcrypt
|
||||||
|
|
||||||
// The code is a port of Provos and Mazières's C implementation.
|
// The code is a port of Provos and Mazières's C implementation.
|
||||||
import (
|
import (
|
||||||
"code.google.com/p/go.crypto/blowfish"
|
"code.google.com/p/go.crypto/blowfish"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ func SerializeEncryptedKey(w io.Writer, pub *PublicKey, cipherFunc CipherFunctio
|
|||||||
binary.BigEndian.PutUint64(buf[1:9], pub.KeyId)
|
binary.BigEndian.PutUint64(buf[1:9], pub.KeyId)
|
||||||
buf[9] = byte(pub.PubKeyAlgo)
|
buf[9] = byte(pub.PubKeyAlgo)
|
||||||
|
|
||||||
keyBlock := make([]byte, 1 /* cipher type */ +len(key)+2 /* checksum */ )
|
keyBlock := make([]byte, 1 /* cipher type */ +len(key)+2 /* checksum */)
|
||||||
keyBlock[0] = byte(cipherFunc)
|
keyBlock[0] = byte(cipherFunc)
|
||||||
copy(keyBlock[1:], key)
|
copy(keyBlock[1:], key)
|
||||||
checksum := checksumKeyMaterial(key)
|
checksum := checksumKeyMaterial(key)
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ func (pk *PrivateKey) Serialize(w io.Writer) (err error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
buf.WriteByte(0 /* no encryption */ )
|
buf.WriteByte(0 /* no encryption */)
|
||||||
|
|
||||||
privateKeyBuf := bytes.NewBuffer(nil)
|
privateKeyBuf := bytes.NewBuffer(nil)
|
||||||
|
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ func TestEncryption(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buf := new(bytes.Buffer)
|
buf := new(bytes.Buffer)
|
||||||
w, err := Encrypt(buf, kring[:1], signed, nil, /* no hints */ nil)
|
w, err := Encrypt(buf, kring[:1], signed, nil /* no hints */, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("#%d: error in Encrypt: %s", i, err)
|
t.Errorf("#%d: error in Encrypt: %s", i, err)
|
||||||
continue
|
continue
|
||||||
@@ -187,7 +187,7 @@ func TestEncryption(t *testing.T) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
md, err := ReadMessage(buf, kring, nil, /* no prompt */ nil)
|
md, err := ReadMessage(buf, kring, nil /* no prompt */, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("#%d: error reading message: %s", i, err)
|
t.Errorf("#%d: error reading message: %s", i, err)
|
||||||
continue
|
continue
|
||||||
|
|||||||
+1
-1
@@ -76,7 +76,7 @@ func smix(b []byte, r, N int, v, xy []byte) {
|
|||||||
|
|
||||||
// Key derives a key from the password, salt, and cost parameters, returning
|
// Key derives a key from the password, salt, and cost parameters, returning
|
||||||
// a byte slice of length keyLen that can be used as cryptographic key.
|
// a byte slice of length keyLen that can be used as cryptographic key.
|
||||||
//
|
//
|
||||||
// N is a CPU/memory cost parameter, which must be a power of two greater than 1.
|
// N is a CPU/memory cost parameter, which must be a power of two greater than 1.
|
||||||
// r and p must satisfy r * p < 2³⁰. If the parameters do not satisfy the
|
// r and p must satisfy r * p < 2³⁰. If the parameters do not satisfy the
|
||||||
// limits, the function returns a nil byte slice and an error.
|
// limits, the function returns a nil byte slice and an error.
|
||||||
|
|||||||
+1
-1
@@ -57,7 +57,7 @@ func (c *ClientConn) authenticate(session []byte) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func keys(m map[string]bool) (s []string) {
|
func keys(m map[string]bool) (s []string) {
|
||||||
for k, _ := range m {
|
for k := range m {
|
||||||
s = append(s, k)
|
s = append(s, k)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user