Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Nettle
nettle
Commits
79f4ded0
Commit
79f4ded0
authored
Nov 15, 2012
by
Niels Möller
Browse files
Portability fixes for sha3-permute: long long constants, no zero shift to ROTL64.
parent
894e849b
Changes
2
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
79f4ded0
2012-11-15 Niels Möller <nisse@lysator.liu.se>
* sha3-permute.c (sha3_permute): Use ULL suffix on round
constants. Avoid passing shift count 0 to ROTL64.
* sha3.c (sha3_absorb): Fixed big-endian code. Need macros.h.
* macros.h (LE_READ_UINT64): New macro.
...
...
sha3-permute.c
View file @
79f4ded0
...
...
@@ -57,18 +57,18 @@ sha3_permute (struct sha3_state *state)
};
static
const
uint64_t
rc
[
SHA3_ROUNDS
]
=
{
0x0000000000000001
,
0
x
0000000000008082
,
0
x
800000000000808A
,
0
x
8000000080008000
,
0
x
000000000000808B
,
0
x
0000000080000001
,
0
x
8000000080008081
,
0
x
8000000000008009
,
0
x
000000000000008A
,
0
x
0000000000000088
,
0
x
0000000080008009
,
0
x
000000008000000A
,
0
x
000000008000808B
,
0
x
800000000000008B
,
0
x
8000000000008089
,
0
x
8000000000008003
,
0
x
8000000000008002
,
0
x
8000000000000080
,
0
x
000000000000800A
,
0
x
800000008000000A
,
0
x
8000000080008081
,
0
x
8000000000008080
,
0
x
0000000080000001
,
0
x
8000000080008008
,
0x0000000000000001
ULL
,
0
X
0000000000008082
ULL
,
0
X
800000000000808A
ULL
,
0
X
8000000080008000
ULL
,
0
X
000000000000808B
ULL
,
0
X
0000000080000001
ULL
,
0
X
8000000080008081
ULL
,
0
X
8000000000008009
ULL
,
0
X
000000000000008A
ULL
,
0
X
0000000000000088
ULL
,
0
X
0000000080008009
ULL
,
0
X
000000008000000A
ULL
,
0
X
000000008000808B
ULL
,
0
X
800000000000008B
ULL
,
0
X
8000000000008089
ULL
,
0
X
8000000000008003
ULL
,
0
X
8000000000008002
ULL
,
0
X
8000000000000080
ULL
,
0
X
000000000000800A
ULL
,
0
X
800000008000000A
ULL
,
0
X
8000000080008081
ULL
,
0
X
8000000000008080
ULL
,
0
X
0000000080000001
ULL
,
0
X
8000000080008008
ULL
,
};
unsigned
i
;
...
...
@@ -97,7 +97,8 @@ sha3_permute (struct sha3_state *state)
A
[
y
+
x
]
^=
D
[
x
];
/* rho and pi steps */
for
(
x
=
0
;
x
<
25
;
x
++
)
B
[
0
]
=
A
[
0
];
/* NOTE: ROTL64 doesn't work with shift count 0 */
for
(
x
=
1
;
x
<
25
;
x
++
)
B
[
perm
[
x
]]
=
ROTL64
(
rot
[
x
],
A
[
x
]);
/* chi step */
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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