aboutsummaryrefslogtreecommitdiffstats
path: root/extra
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2024-09-15 11:57:21 +0200
committerMattias Andrée <maandree@kth.se>2024-09-15 11:57:21 +0200
commit7897170e09aa19122053ff24797b4d7c23f47cbc (patch)
tree7d13e4ed39c46ffe803076603b742bb47479122d /extra
parentm (diff)
downloadlibkeccak-7897170e09aa19122053ff24797b4d7c23f47cbc.tar.gz
libkeccak-7897170e09aa19122053ff24797b4d7c23f47cbc.tar.bz2
libkeccak-7897170e09aa19122053ff24797b4d7c23f47cbc.tar.xz
Optimisation for w=8,16,32
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'extra')
-rw-r--r--extra/libkeccak_state_marshal.c4
-rw-r--r--extra/libkeccak_state_unmarshal.c4
-rw-r--r--extra/libkeccak_state_wipe_sponge.c2
3 files changed, 5 insertions, 5 deletions
diff --git a/extra/libkeccak_state_marshal.c b/extra/libkeccak_state_marshal.c
index 7541164..f4fd4b5 100644
--- a/extra/libkeccak_state_marshal.c
+++ b/extra/libkeccak_state_marshal.c
@@ -28,7 +28,7 @@ libkeccak_state_marshal(const struct libkeccak_state *restrict state, void *rest
if (!data) {
return 7 * sizeof(long int) +
- 1 * sizeof(int64_t) +
+ 1 * sizeof(uint64_t) +
sizeof(state->S) +
2 * sizeof(size_t) +
state->mptr;
@@ -42,7 +42,7 @@ libkeccak_state_marshal(const struct libkeccak_state *restrict state, void *rest
set(wmod);
set(l);
set(nr);
- __builtin_memcpy(data, state->S, sizeof(state->S));
+ __builtin_memcpy(data, &state->S, sizeof(state->S));
data += sizeof(state->S);
set(mptr);
set(mlen);
diff --git a/extra/libkeccak_state_unmarshal.c b/extra/libkeccak_state_unmarshal.c
index 4714566..0938ba1 100644
--- a/extra/libkeccak_state_unmarshal.c
+++ b/extra/libkeccak_state_unmarshal.c
@@ -30,7 +30,7 @@ libkeccak_state_unmarshal(struct libkeccak_state *restrict state, const void *re
if (!state) {
data += 7U * sizeof(long int);
- data += 1U * sizeof(int64_t);
+ data += 1U * sizeof(uint64_t);
data += sizeof(state->S);
mptr = *(const size_t *)data;
data += 2U * sizeof(size_t);
@@ -46,7 +46,7 @@ libkeccak_state_unmarshal(struct libkeccak_state *restrict state, const void *re
get(wmod);
get(l);
get(nr);
- memcpy(state->S, data, sizeof(state->S));
+ memcpy(&state->S, data, sizeof(state->S));
data += sizeof(state->S);
get(mptr);
get(mlen);
diff --git a/extra/libkeccak_state_wipe_sponge.c b/extra/libkeccak_state_wipe_sponge.c
index 91e845a..69aa46a 100644
--- a/extra/libkeccak_state_wipe_sponge.c
+++ b/extra/libkeccak_state_wipe_sponge.c
@@ -10,7 +10,7 @@
void
libkeccak_state_wipe_sponge(volatile struct libkeccak_state *state)
{
- volatile int64_t *restrict S = state->S;
+ volatile uint64_t *restrict S = state->S.w64;
size_t i;
for (i = 0; i < 25; i++)