sha3: another speedup for SHA3_SMALL=0 case
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
6830ade6aa
commit
07a54e21dd
@ -1041,6 +1041,7 @@ static void KeccakF(uint64_t *state)
|
|||||||
|
|
||||||
/* Chi */
|
/* Chi */
|
||||||
for (y = 0; y <= 20; y += 5) {
|
for (y = 0; y <= 20; y += 5) {
|
||||||
|
if (SHA3_SMALL) {
|
||||||
uint64_t BC[5];
|
uint64_t BC[5];
|
||||||
BC[0] = state[y + 0];
|
BC[0] = state[y + 0];
|
||||||
BC[1] = state[y + 1];
|
BC[1] = state[y + 1];
|
||||||
@ -1052,6 +1053,20 @@ static void KeccakF(uint64_t *state)
|
|||||||
BC[x] ^ ((~BC[KeccakF_Mod5[x + 1]]) &
|
BC[x] ^ ((~BC[KeccakF_Mod5[x + 1]]) &
|
||||||
BC[KeccakF_Mod5[x + 2]]);
|
BC[KeccakF_Mod5[x + 2]]);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
/* 32-bit x86: +50 bytes code, 10% faster */
|
||||||
|
uint64_t BC0, BC1, BC2, BC3, BC4;
|
||||||
|
BC0 = state[y + 0];
|
||||||
|
BC1 = state[y + 1];
|
||||||
|
BC2 = state[y + 2];
|
||||||
|
state[y + 0] = BC0 ^ ((~BC1) & BC2);
|
||||||
|
BC3 = state[y + 3];
|
||||||
|
state[y + 1] = BC1 ^ ((~BC2) & BC3);
|
||||||
|
BC4 = state[y + 4];
|
||||||
|
state[y + 2] = BC2 ^ ((~BC3) & BC4);
|
||||||
|
state[y + 3] = BC3 ^ ((~BC4) & BC0);
|
||||||
|
state[y + 4] = BC4 ^ ((~BC0) & BC1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Iota */
|
/* Iota */
|
||||||
|
Loading…
Reference in New Issue
Block a user