]> err.no Git - yubikey-personalization/blob - sha-private.h
Merge tag 'v1.15.1'
[yubikey-personalization] / sha-private.h
1 /*************************** sha-private.h ***************************/
2 /********************** See RFC 4634 for details *********************/
3 #ifndef _SHA_PRIVATE__H
4 #define _SHA_PRIVATE__H
5 /*
6  * These definitions are defined in FIPS-180-2, section 4.1.
7  * Ch() and Maj() are defined identically in sections 4.1.1,
8  * 4.1.2 and 4.1.3.
9  *
10  * The definitions used in FIPS-180-2 are as follows:
11  */
12
13 #ifndef USE_MODIFIED_MACROS
14 #define SHA_Ch(x,y,z)        (((x) & (y)) ^ ((~(x)) & (z)))
15 #define SHA_Maj(x,y,z)       (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
16
17 #else /* USE_MODIFIED_MACROS */
18 /*
19  * The following definitions are equivalent and potentially faster.
20  */
21
22 #define SHA_Ch(x, y, z)      (((x) & ((y) ^ (z))) ^ (z))
23 #define SHA_Maj(x, y, z)     (((x) & ((y) | (z))) | ((y) & (z)))
24 #endif /* USE_MODIFIED_MACROS */
25
26 #define SHA_Parity(x, y, z)  ((x) ^ (y) ^ (z))
27
28 #endif /* _SHA_PRIVATE__H */
29