LEFT | RIGHT |
1 // Copyright 2011 The Go Authors. All rights reserved. | 1 // Copyright 2011 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 package ssh | 5 package ssh |
6 | 6 |
7 import ( | 7 import ( |
8 "bytes" | 8 "bytes" |
9 "crypto" | 9 "crypto" |
10 "crypto/rand" | 10 "crypto/rand" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 switch hostKeyAlgo { | 214 switch hostKeyAlgo { |
215 case hostAlgoRSA: | 215 case hostAlgoRSA: |
216 sig, err = rsa.SignPKCS1v15(s.config.rand(), s.config.rsa, hashF
unc, hh) | 216 sig, err = rsa.SignPKCS1v15(s.config.rand(), s.config.rsa, hashF
unc, hh) |
217 if err != nil { | 217 if err != nil { |
218 return | 218 return |
219 } | 219 } |
220 default: | 220 default: |
221 return nil, nil, errors.New("internal error") | 221 return nil, nil, errors.New("internal error") |
222 } | 222 } |
223 | 223 |
224 » serializedSig := serializeRSASignature(sig) | 224 » serializedSig := serializeSignature(hostAlgoRSA, sig) |
225 | 225 |
226 kexDHReply := kexDHReplyMsg{ | 226 kexDHReply := kexDHReplyMsg{ |
227 HostKey: serializedHostKey, | 227 HostKey: serializedHostKey, |
228 Y: Y, | 228 Y: Y, |
229 Signature: serializedSig, | 229 Signature: serializedSig, |
230 } | 230 } |
231 packet = marshal(msgKexDHReply, kexDHReply) | 231 packet = marshal(msgKexDHReply, kexDHReply) |
232 | 232 |
233 err = s.writePacket(packet) | 233 err = s.writePacket(packet) |
234 return | 234 return |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 func Listen(network, addr string, config *ServerConfig) (*Listener, error) { | 662 func Listen(network, addr string, config *ServerConfig) (*Listener, error) { |
663 l, err := net.Listen(network, addr) | 663 l, err := net.Listen(network, addr) |
664 if err != nil { | 664 if err != nil { |
665 return nil, err | 665 return nil, err |
666 } | 666 } |
667 return &Listener{ | 667 return &Listener{ |
668 l, | 668 l, |
669 config, | 669 config, |
670 }, nil | 670 }, nil |
671 } | 671 } |
LEFT | RIGHT |