Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-unixfs
Commits
3994762c
Commit
3994762c
authored
Oct 26, 2014
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug
parent
317ca2f8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
11 deletions
+6
-11
crypto/spipe/handshake.go
crypto/spipe/handshake.go
+6
-11
No files found.
crypto/spipe/handshake.go
View file @
3994762c
...
...
@@ -275,7 +275,6 @@ func (s *SecurePipe) handleSecureOut(hashType string, mIV, mCKey, mMKey []byte)
myMac
,
macSize
:=
makeMac
(
hashType
,
mMKey
)
basebuf
:=
make
([]
byte
,
1
<<
22
)
for
{
var
data
[]
byte
ok
:=
true
...
...
@@ -295,23 +294,19 @@ func (s *SecurePipe) handleSecureOut(hashType string, mIV, mCKey, mMKey []byte)
continue
}
buff
:=
basebuf
[
:
len
(
data
)
+
macSize
]
buff
:=
make
([]
byte
,
len
(
data
)
+
macSize
)
encData
(
data
,
buff
,
myCipher
,
myMac
)
myCipher
.
XORKeyStream
(
buff
,
data
)
myMac
.
Write
(
buff
[
0
:
len
(
data
)])
copy
(
buff
[
len
(
data
)
:
],
myMac
.
Sum
(
nil
))
myMac
.
Reset
()
// log.Debug("[peer %s] secure out [to = %s] %d", s.local, s.remote, len(buff))
s
.
insecure
.
Out
<-
buff
}
}
func
encData
(
data
,
buff
[]
byte
,
ciph
cipher
.
Stream
,
mac
hash
.
Hash
)
{
ciph
.
XORKeyStream
(
buff
,
data
)
mac
.
Write
(
buff
[
0
:
len
(
data
)])
copy
(
buff
[
len
(
data
)
:
],
mac
.
Sum
(
nil
))
mac
.
Reset
()
}
// Determines which algorithm to use. Note: f(a, b) = f(b, a)
func
selectBest
(
myPrefs
,
theirPrefs
string
)
(
string
,
error
)
{
// Person with greatest hash gets first choice.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment