/src/botan/build/include/internal/botan/internal/sha2_64_f.h
Line | Count | Source |
1 | | /* |
2 | | * (C) 2023 Jack Lloyd |
3 | | * |
4 | | * Botan is released under the Simplified BSD License (see license.txt) |
5 | | */ |
6 | | |
7 | | #ifndef BOTAN_SHA2_64_F_H_ |
8 | | #define BOTAN_SHA2_64_F_H_ |
9 | | |
10 | | #include <botan/types.h> |
11 | | #include <botan/internal/bit_ops.h> |
12 | | #include <botan/internal/rotate.h> |
13 | | |
14 | | namespace Botan { |
15 | | |
16 | | /* |
17 | | * SHA-512 F1 Function |
18 | | */ |
19 | | BOTAN_FORCE_INLINE void SHA2_64_F(uint64_t A, |
20 | | uint64_t B, |
21 | | uint64_t C, |
22 | | uint64_t& D, |
23 | | uint64_t E, |
24 | | uint64_t F, |
25 | | uint64_t G, |
26 | | uint64_t& H, |
27 | | uint64_t& M1, |
28 | | uint64_t M2, |
29 | | uint64_t M3, |
30 | | uint64_t M4, |
31 | 3.96M | uint64_t magic) { |
32 | 3.96M | const uint64_t E_rho = rho<14, 18, 41>(E); |
33 | 3.96M | const uint64_t A_rho = rho<28, 34, 39>(A); |
34 | 3.96M | const uint64_t M2_sigma = sigma<19, 61, 6>(M2); |
35 | 3.96M | const uint64_t M4_sigma = sigma<1, 8, 7>(M4); |
36 | 3.96M | H += magic + E_rho + choose(E, F, G) + M1; |
37 | 3.96M | D += H; |
38 | 3.96M | H += A_rho + majority(A, B, C); |
39 | 3.96M | M1 += M2_sigma + M3 + M4_sigma; |
40 | 3.96M | } |
41 | | |
42 | | } // namespace Botan |
43 | | |
44 | | #endif |