Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
8517dd46
Unverified
Commit
8517dd46
authored
5 years ago
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypto/blake2b: fix non-amd64 builds
parent
22fdbee8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
4 deletions
+57
-4
blake2b_f_fuzz.go
crypto/blake2b/blake2b_f_fuzz.go
+57
-0
blake2b_ref.go
crypto/blake2b/blake2b_ref.go
+0
-4
No files found.
crypto/blake2b/blake2b_f_fuzz.go
0 → 100644
View file @
8517dd46
// +build gofuzz
package
blake2b
import
(
"encoding/binary"
)
func
Fuzz
(
data
[]
byte
)
int
{
// Make sure the data confirms to the input model
if
len
(
data
)
!=
211
{
return
0
}
// Parse everything and call all the implementations
var
(
rounds
=
binary
.
BigEndian
.
Uint16
(
data
[
0
:
2
])
h
[
8
]
uint64
m
[
16
]
uint64
t
[
2
]
uint64
f
uint64
)
for
i
:=
0
;
i
<
8
;
i
++
{
offset
:=
2
+
i
*
8
h
[
i
]
=
binary
.
LittleEndian
.
Uint64
(
data
[
offset
:
offset
+
8
])
}
for
i
:=
0
;
i
<
16
;
i
++
{
offset
:=
66
+
i
*
8
m
[
i
]
=
binary
.
LittleEndian
.
Uint64
(
data
[
offset
:
offset
+
8
])
}
t
[
0
]
=
binary
.
LittleEndian
.
Uint64
(
data
[
194
:
202
])
t
[
1
]
=
binary
.
LittleEndian
.
Uint64
(
data
[
202
:
210
])
if
data
[
210
]
%
2
==
1
{
// Avoid spinning the fuzzer to hit 0/1
f
=
0xFFFFFFFFFFFFFFFF
}
// Run the blake2b compression on all instruction sets and cross reference
want
:=
h
fGeneric
(
&
want
,
&
m
,
t
[
0
],
t
[
1
],
f
,
uint64
(
rounds
))
have
:=
h
fSSE4
(
&
have
,
&
m
,
t
[
0
],
t
[
1
],
f
,
uint64
(
rounds
))
if
have
!=
want
{
panic
(
"SSE4 mismatches generic algo"
)
}
have
=
h
fAVX
(
&
have
,
&
m
,
t
[
0
],
t
[
1
],
f
,
uint64
(
rounds
))
if
have
!=
want
{
panic
(
"AVX mismatches generic algo"
)
}
have
=
h
fAVX2
(
&
have
,
&
m
,
t
[
0
],
t
[
1
],
f
,
uint64
(
rounds
))
if
have
!=
want
{
panic
(
"AVX2 mismatches generic algo"
)
}
return
1
}
This diff is collapsed.
Click to expand it.
crypto/blake2b/blake2b_ref.go
View file @
8517dd46
...
...
@@ -6,10 +6,6 @@
package
blake2b
func
hashBlocks
(
h
*
[
8
]
uint64
,
c
*
[
2
]
uint64
,
flag
uint64
,
blocks
[]
byte
)
{
hashBlocksGeneric
(
h
,
c
,
flag
,
blocks
)
}
func
f
(
h
*
[
8
]
uint64
,
m
[
16
]
uint64
,
c0
,
c1
uint64
,
flag
uint64
,
rounds
int
)
{
fGeneric
(
h
,
m
,
c0
,
c1
,
flag
,
rounds
)
}
This diff is collapsed.
Click to expand it.
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