| 1 |
/* |
| 2 |
* Keccak-FIPS |
| 3 |
* (C) 2019 Jack Lloyd |
| 4 |
* |
| 5 |
* Botan is released under the Simplified BSD License (see license.txt) |
| 6 |
*/ |
| 7 |
|
| 8 |
#include <botan/internal/keccak_perm.h> |
| 9 |
|
| 10 |
#include <botan/internal/isa_extn.h> |
| 11 |
#include <botan/internal/keccak_perm_round.h> |
| 12 |
|
| 13 |
namespace Botan { |
| 14 |
|
| 15 |
void BOTAN_FN_ISA_BMI2 Keccak_Permutation::permute_bmi2() { |
| 16 |
static const uint64_t RC[24] = {0x0000000000000001, 0x0000000000008082, 0x800000000000808A, 0x8000000080008000, |
| 17 |
0x000000000000808B, 0x0000000080000001, 0x8000000080008081, 0x8000000000008009, |
| 18 |
0x000000000000008A, 0x0000000000000088, 0x0000000080008009, 0x000000008000000A, |
| 19 |
0x000000008000808B, 0x800000000000008B, 0x8000000000008089, 0x8000000000008003, |
| 20 |
0x8000000000008002, 0x8000000000000080, 0x000000000000800A, 0x800000008000000A, |
| 21 |
0x8000000080008081, 0x8000000000008080, 0x0000000080000001, 0x8000000080008008}; |
| 22 |
|
| 23 |
uint64_t T[25]; |
| 24 |
|
| 25 |
for(size_t i = 0; i != 24; i += 2) { |
| 26 |
Keccak_Permutation_round(T, state().data(), RC[i + 0]); |
| 27 |
Keccak_Permutation_round(state().data(), T, RC[i + 1]); |
| 28 |
} |
| 29 |
} |
| 30 |
|
| 31 |
} // namespace Botan |