Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
eabcc981
Commit
eabcc981
authored
Nov 04, 2009
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gofmt-ify crypto
R=agl CC=rsc
http://go/go-review/1017032
parent
2ce57ec1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
17 deletions
+23
-17
src/pkg/crypto/block/ecb_test.go
src/pkg/crypto/block/ecb_test.go
+10
-10
src/pkg/crypto/block/xor_test.go
src/pkg/crypto/block/xor_test.go
+1
-3
src/pkg/crypto/tls/common.go
src/pkg/crypto/tls/common.go
+4
-2
src/pkg/crypto/tls/record_write.go
src/pkg/crypto/tls/record_write.go
+8
-2
No files found.
src/pkg/crypto/block/ecb_test.go
View file @
eabcc981
...
...
@@ -15,9 +15,9 @@ import (
// Simple Cipher for testing: adds an incrementing amount
// to each byte in each
type
IncCipher
struct
{
blockSize
int
;
delta
byte
;
encrypting
bool
;
blockSize
int
;
delta
byte
;
encrypting
bool
;
}
func
(
c
*
IncCipher
)
BlockSize
()
int
{
...
...
@@ -60,10 +60,10 @@ func TestECBEncrypter(t *testing.T) {
// compute encrypted version
delta
:=
byte
(
0
);
for
i
:=
0
;
i
<
len
(
crypt
);
i
++
{
if
i
%
block
==
0
{
if
i
%
block
==
0
{
delta
++
;
}
crypt
[
i
]
=
plain
[
i
]
+
delta
;
crypt
[
i
]
=
plain
[
i
]
+
delta
;
}
for
frag
:=
0
;
frag
<
2
;
frag
++
{
...
...
@@ -110,24 +110,24 @@ func TestECBEncrypter(t *testing.T) {
}
func
testECBDecrypter
(
t
*
testing
.
T
,
maxio
int
)
{
var
readers
=
[]
func
(
io
.
Reader
)
io
.
Reader
{
func
(
r
io
.
Reader
)
io
.
Reader
{
return
r
},
var
readers
=
[]
func
(
io
.
Reader
)
io
.
Reader
{
func
(
r
io
.
Reader
)
io
.
Reader
{
return
r
},
iotest
.
OneByteReader
,
iotest
.
HalfReader
,
};
var
plain
,
crypt
[
256
]
byte
;
for
i
:=
0
;
i
<
len
(
plain
);
i
++
{
plain
[
i
]
=
byte
(
255
-
i
);
plain
[
i
]
=
byte
(
255
-
i
);
}
b
:=
new
(
bytes
.
Buffer
);
for
block
:=
1
;
block
<=
64
&&
block
<=
maxio
;
block
*=
2
{
// compute encrypted version
delta
:=
byte
(
0
);
for
i
:=
0
;
i
<
len
(
crypt
);
i
++
{
if
i
%
block
==
0
{
if
i
%
block
==
0
{
delta
++
;
}
crypt
[
i
]
=
plain
[
i
]
+
delta
;
crypt
[
i
]
=
plain
[
i
]
+
delta
;
}
for
mode
:=
0
;
mode
<
len
(
readers
);
mode
++
{
...
...
src/pkg/crypto/block/xor_test.go
View file @
eabcc981
...
...
@@ -98,9 +98,7 @@ func TestXorWriter(t *testing.T) {
func
testXorReader
(
t
*
testing
.
T
,
maxio
int
)
{
var
readers
=
[]
func
(
io
.
Reader
)
io
.
Reader
{
func
(
r
io
.
Reader
)
io
.
Reader
{
return
r
;
},
func
(
r
io
.
Reader
)
io
.
Reader
{
return
r
},
iotest
.
OneByteReader
,
iotest
.
HalfReader
,
};
...
...
src/pkg/crypto/tls/common.go
View file @
eabcc981
...
...
@@ -106,7 +106,8 @@ func mutualVersion(theirMajor, theirMinor uint8) (major, minor uint8, ok bool) {
// A nop implements the NULL encryption and MAC algorithms.
type
nop
struct
{}
func
(
nop
)
XORKeyStream
(
buf
[]
byte
)
{}
func
(
nop
)
XORKeyStream
(
buf
[]
byte
)
{
}
func
(
nop
)
Write
(
buf
[]
byte
)
(
int
,
os
.
Error
)
{
return
len
(
buf
),
nil
;
...
...
@@ -116,7 +117,8 @@ func (nop) Sum() []byte {
return
nil
;
}
func
(
nop
)
Reset
()
{}
func
(
nop
)
Reset
()
{
}
func
(
nop
)
Size
()
int
{
return
0
;
...
...
src/pkg/crypto/tls/record_write.go
View file @
eabcc981
...
...
@@ -74,10 +74,16 @@ func (w *recordWriter) loop(writer io.Writer, appChan <-chan []byte, controlChan
}
if
!
closed
(
appChan
)
{
go
func
()
{
for
_
=
range
appChan
{}
}();
go
func
()
{
for
_
=
range
appChan
{
}
}();
}
if
!
closed
(
controlChan
)
{
go
func
()
{
for
_
=
range
controlChan
{}
}();
go
func
()
{
for
_
=
range
controlChan
{
}
}();
}
}
...
...
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