aboutsummaryrefslogtreecommitdiff
path: root/ssh/cipher.go
diff options
context:
space:
mode:
authorAdam Langley <agl@golang.org>2012-04-20 15:17:42 -0400
committerAdam Langley <agl@golang.org>2012-04-20 15:17:42 -0400
commit63f855d724c1fff8ec15a0191dcda32ec7761cc4 (patch)
tree5f5614323b139c2a90b1b49ea0cf05c4ed54fdb5 /ssh/cipher.go
parent81e0b644eb2f05832b1801391bc9386a81e4fe45 (diff)
downloadgo-x-crypto-63f855d724c1fff8ec15a0191dcda32ec7761cc4.tar.xz
ssh: cosmetic cleanups
These are the cosmetic cleanups from the bits of code that I rereviewed. 1) stringLength now takes a int; the length of the string. Too many callers were allocating with stringLength([]byte(s)) and stringLength only needs to call len(). 2) agent.go now has sendAndReceive to remove logic that was duplicated. 3) We now reject negative DH values 4) We now reject empty packets rather than crashing. R=dave, jonathan.mark.pittman CC=golang-dev https://golang.org/cl/6061052
Diffstat (limited to 'ssh/cipher.go')
-rw-r--r--ssh/cipher.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/ssh/cipher.go b/ssh/cipher.go
index d91929a..0646e1e 100644
--- a/ssh/cipher.go
+++ b/ssh/cipher.go
@@ -35,10 +35,10 @@ func newRC4(key, iv []byte) (cipher.Stream, error) {
}
type cipherMode struct {
- keySize int
- ivSize int
- skip int
- createFn func(key, iv []byte) (cipher.Stream, error)
+ keySize int
+ ivSize int
+ skip int
+ createFunc func(key, iv []byte) (cipher.Stream, error)
}
func (c *cipherMode) createCipher(key, iv []byte) (cipher.Stream, error) {
@@ -49,7 +49,7 @@ func (c *cipherMode) createCipher(key, iv []byte) (cipher.Stream, error) {
panic("ssh: iv too small for cipher")
}
- stream, err := c.createFn(key[:c.keySize], iv[:c.ivSize])
+ stream, err := c.createFunc(key[:c.keySize], iv[:c.ivSize])
if err != nil {
return nil, err
}