Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keccak1600: remove not needed spill + make it easier to make rounds l… #96

Merged
merged 1 commit into from
Oct 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions src/common/keccak/keccak1600/amd64/bmi1/keccakf1600.jinc
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,13 @@ inline fn __set_row_bmi1(
}


inline fn __round_bmi1(reg ptr u64[25] e a, stack u64 s_rc) -> reg ptr u64[25]
inline fn __round_bmi1(reg ptr u64[25] e a, reg u64 rc) -> reg ptr u64[25]
{
inline int y;
reg u64[5] b c d;
stack u64 s_rc;

s_rc = rc;

c = __theta_sum_bmi1(a);
d = __theta_rol_bmi1(c);
Expand All @@ -130,7 +133,6 @@ inline fn __keccakf1600_bmi1(reg ptr u64[25] a) -> reg ptr u64[25]
stack u64[25] s_e;
reg ptr u64[25] e;
reg u64 c rc;
stack u64 s_c s_rc;

RC = KECCAK1600_RC;
s_RC = RC;
Expand All @@ -139,19 +141,14 @@ inline fn __keccakf1600_bmi1(reg ptr u64[25] a) -> reg ptr u64[25]
c = 0;
while (c < KECCAK_ROUNDS - 1)
{
s_c = c;

RC = s_RC;
rc = RC[(int) c];
s_rc = rc;
e = __round_bmi1(e, a, s_rc);
e = __round_bmi1(e, a, rc);

RC = s_RC;
rc = RC[(int) c + 1];
s_rc = rc;
a = __round_bmi1(a, e, s_rc);
a = __round_bmi1(a, e, rc);

c = s_c;
c += 2;
}

Expand Down
15 changes: 6 additions & 9 deletions src/common/keccak/keccak1600/amd64/ref1/keccakf1600.jinc
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,13 @@ inline fn __set_row_ref1(
}


inline fn __round_ref1(reg ptr u64[25] e a, stack u64 s_rc) -> reg ptr u64[25]
inline fn __round_ref1(reg ptr u64[25] e a, reg u64 rc) -> reg ptr u64[25]
{
inline int y;
reg u64[5] b c d;
stack u64 s_rc;

s_rc = rc;

c = __theta_sum_ref1(a);
d = __theta_rol_ref1(c);
Expand All @@ -131,7 +134,6 @@ inline fn __keccakf1600_ref1(reg ptr u64[25] a) -> reg ptr u64[25]
stack u64[25] s_e;
reg ptr u64[25] e;
reg u64 c rc;
stack u64 s_c s_rc;

RC = KECCAK1600_RC;
s_RC = RC;
Expand All @@ -140,19 +142,14 @@ inline fn __keccakf1600_ref1(reg ptr u64[25] a) -> reg ptr u64[25]
c = 0;
while (c < KECCAK_ROUNDS - 1)
{
s_c = c;

RC = s_RC;
rc = RC[(int) c];
s_rc = rc;
e = __round_ref1(e, a, s_rc);
e = __round_ref1(e, a, rc);

RC = s_RC;
rc = RC[(int) c + 1];
s_rc = rc;
a = __round_ref1(a, e, s_rc);
a = __round_ref1(a, e, rc);

c = s_c;
c += 2;
}

Expand Down