LEFT | RIGHT |
(no file at all) | |
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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 } | 265 } |
266 } | 266 } |
267 | 267 |
268 var H, K []byte | 268 var H, K []byte |
269 var hashFunc crypto.Hash | 269 var hashFunc crypto.Hash |
270 switch kexAlgo { | 270 switch kexAlgo { |
271 case kexAlgoDH14SHA1: | 271 case kexAlgoDH14SHA1: |
272 hashFunc = crypto.SHA1 | 272 hashFunc = crypto.SHA1 |
273 dhGroup14Once.Do(initDHGroup14) | 273 dhGroup14Once.Do(initDHGroup14) |
274 H, K, err = s.kexDH(dhGroup14, hashFunc, &magics, hostKeyAlgo) | 274 H, K, err = s.kexDH(dhGroup14, hashFunc, &magics, hostKeyAlgo) |
| 275 case keyAlgoDH1SHA1: |
| 276 hashFunc = crypto.SHA1 |
| 277 dhGroup1Once.Do(initDHGroup1) |
| 278 H, K, err = s.kexDH(dhGroup1, hashFunc, &magics, hostKeyAlgo) |
275 default: | 279 default: |
276 err = errors.New("ssh: unexpected key exchange algorithm " + kex
Algo) | 280 err = errors.New("ssh: unexpected key exchange algorithm " + kex
Algo) |
277 } | 281 } |
278 if err != nil { | 282 if err != nil { |
279 return err | 283 return err |
280 } | 284 } |
281 | 285 |
282 if err = s.writePacket([]byte{msgNewKeys}); err != nil { | 286 if err = s.writePacket([]byte{msgNewKeys}); err != nil { |
283 return err | 287 return err |
284 } | 288 } |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 func Listen(network, addr string, config *ServerConfig) (*Listener, error) { | 643 func Listen(network, addr string, config *ServerConfig) (*Listener, error) { |
640 l, err := net.Listen(network, addr) | 644 l, err := net.Listen(network, addr) |
641 if err != nil { | 645 if err != nil { |
642 return nil, err | 646 return nil, err |
643 } | 647 } |
644 return &Listener{ | 648 return &Listener{ |
645 l, | 649 l, |
646 config, | 650 config, |
647 }, nil | 651 }, nil |
648 } | 652 } |
LEFT | RIGHT |