Coverage Report

Created: 2023-06-07 07:00

/src/botan/build/include/botan/internal/sha2_32_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_32_F_H_
8
#define BOTAN_SHA2_32_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-256 F1 Function
18
*/
19
BOTAN_FORCE_INLINE void SHA2_32_F(uint32_t A,
20
                                  uint32_t B,
21
                                  uint32_t C,
22
                                  uint32_t& D,
23
                                  uint32_t E,
24
                                  uint32_t F,
25
                                  uint32_t G,
26
                                  uint32_t& H,
27
                                  uint32_t& M1,
28
                                  uint32_t M2,
29
                                  uint32_t M3,
30
                                  uint32_t M4,
31
640
                                  uint32_t magic) {
32
640
   uint32_t A_rho = rho<2, 13, 22>(A);
33
640
   uint32_t E_rho = rho<6, 11, 25>(E);
34
640
   uint32_t M2_sigma = sigma<17, 19, 10>(M2);
35
640
   uint32_t M4_sigma = sigma<7, 18, 3>(M4);
36
640
   H += magic + E_rho + choose(E, F, G) + M1;
37
640
   D += H;
38
640
   H += A_rho + majority(A, B, C);
39
640
   M1 += M2_sigma + M3 + M4_sigma;
40
640
}
41
42
}  // namespace Botan
43
44
#endif