1 /************************ sha-private.h ************************/
2 /***************** See RFC 6234 for details. *******************/
3 /* Copyright (c) 2011 IETF Trust and the persons identified as */
4 /* authors of the code. All rights reserved. */
5 /* See sha.h for terms of use and redistribution. */
7 #ifndef _SHA_PRIVATE__H
8 #define _SHA_PRIVATE__H
10 * These definitions are defined in FIPS 180-3, section 4.1.
11 * Ch() and Maj() are defined identically in sections 4.1.1,
14 * The definitions used in FIPS 180-3 are as follows:
17 #ifndef USE_MODIFIED_MACROS
18 #define SHA_Ch(x,y,z) (((x) & (y)) ^ ((~(x)) & (z)))
19 #define SHA_Maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
20 #else /* USE_MODIFIED_MACROS */
22 * The following definitions are equivalent and potentially faster.
25 #define SHA_Ch(x, y, z) (((x) & ((y) ^ (z))) ^ (z))
26 #define SHA_Maj(x, y, z) (((x) & ((y) | (z))) | ((y) & (z)))
28 #endif /* USE_MODIFIED_MACROS */
30 #define SHA_Parity(x, y, z) ((x) ^ (y) ^ (z))
32 #endif /* _SHA_PRIVATE__H */