Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(760)

Side by Side Diff: ssh/common.go

Issue 9853050: code review 9853050: go.crypto/ssh: implement challenge/response auth (RFC 4... (Closed)
Patch Set: diff -r b5f1a3f28dce https://code.google.com/p/go.crypto Created 10 years, 9 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ssh/client_auth_test.go ('k') | ssh/messages.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "crypto/dsa" 8 "crypto/dsa"
9 "crypto/ecdsa" 9 "crypto/ecdsa"
10 "crypto/rsa" 10 "crypto/rsa"
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 } 322 }
323 323
324 func appendU32(buf []byte, n uint32) []byte { 324 func appendU32(buf []byte, n uint32) []byte {
325 return append(buf, byte(n>>24), byte(n>>16), byte(n>>8), byte(n)) 325 return append(buf, byte(n>>24), byte(n>>16), byte(n>>8), byte(n))
326 } 326 }
327 327
328 func appendInt(buf []byte, n int) []byte { 328 func appendInt(buf []byte, n int) []byte {
329 return appendU32(buf, uint32(n)) 329 return appendU32(buf, uint32(n))
330 } 330 }
331 331
332 func appendString(buf []byte, s string) []byte {
333 buf = appendU32(buf, uint32(len(s)))
334 buf = append(buf, s...)
335 return buf
336 }
337
338 func appendBool(buf []byte, b bool) []byte {
339 if b {
340 buf = append(buf, 1)
341 } else {
342 buf = append(buf, 0)
343 }
344 return buf
345 }
346
332 // newCond is a helper to hide the fact that there is no usable zero 347 // newCond is a helper to hide the fact that there is no usable zero
333 // value for sync.Cond. 348 // value for sync.Cond.
334 func newCond() *sync.Cond { return sync.NewCond(new(sync.Mutex)) } 349 func newCond() *sync.Cond { return sync.NewCond(new(sync.Mutex)) }
335 350
336 // window represents the buffer available to clients 351 // window represents the buffer available to clients
337 // wishing to write to a channel. 352 // wishing to write to a channel.
338 type window struct { 353 type window struct {
339 *sync.Cond 354 *sync.Cond
340 win uint32 // RFC 4254 5.2 says the window size can grow to 2^32-1 355 win uint32 // RFC 4254 5.2 says the window size can grow to 2^32-1
341 } 356 }
(...skipping 27 matching lines...) Expand all
369 for w.win == 0 { 384 for w.win == 0 {
370 w.Wait() 385 w.Wait()
371 } 386 }
372 if w.win < win { 387 if w.win < win {
373 win = w.win 388 win = w.win
374 } 389 }
375 w.win -= win 390 w.win -= win
376 w.L.Unlock() 391 w.L.Unlock()
377 return win 392 return win
378 } 393 }
OLDNEW
« no previous file with comments | « ssh/client_auth_test.go ('k') | ssh/messages.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b