ssh: use *rsa.PublicKey or *dsa.PublicKey in interfaces.
Everywhere else in the code base, when we have an interface{} which is
a stand in for a public key, we use *foo.PublicKey rather than
foo.PublicKey. This change makes ssh reflect that.
R=dave, r
CC=golang-dev
https://golang.org/cl/5686067
diff --git a/ssh/common.go b/ssh/common.go
index 6844fb8..8850382 100644
--- a/ssh/common.go
+++ b/ssh/common.go
@@ -154,11 +154,11 @@
return ret
}
-// serialize an rsa.PublicKey or dsa.PublicKey according to RFC 4253 6.6.
+// serialize a *rsa.PublicKey or *dsa.PublicKey according to RFC 4253 6.6.
func serializePublickey(key interface{}) []byte {
algoname := algoName(key)
switch key := key.(type) {
- case rsa.PublicKey:
+ case *rsa.PublicKey:
e := new(big.Int).SetInt64(int64(key.E))
length := stringLength([]byte(algoname))
length += intLength(e)
@@ -168,7 +168,7 @@
r = marshalInt(r, e)
marshalInt(r, key.N)
return ret
- case dsa.PublicKey:
+ case *dsa.PublicKey:
length := stringLength([]byte(algoname))
length += intLength(key.P)
length += intLength(key.Q)
@@ -187,9 +187,9 @@
func algoName(key interface{}) string {
switch key.(type) {
- case rsa.PublicKey:
+ case *rsa.PublicKey:
return "ssh-rsa"
- case dsa.PublicKey:
+ case *dsa.PublicKey:
return "ssh-dss"
}
panic("unexpected key type")