Debian Codegraph @

src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/inc/azure_c_shared_utility/sha-private.h

raw
1 // Copyright (c) Microsoft. All rights reserved.
2 // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
4 /*************************** sha-private.h ***************************/
5 /********************** See RFC 4634 for details *********************/
6 #ifndef _SHA_PRIVATE__H
7 #define _SHA_PRIVATE__H
8 /*
9 * These definitions are defined in FIPS-180-2, section 4.1.
10 * Ch() and Maj() are defined identically in sections 4.1.1,
11 * 4.1.2 and 4.1.3.
12 *
13 * The definitions used in FIPS-180-2 are as follows:
14 */
15
16 #ifndef USE_MODIFIED_MACROS
17 #define SHA_Ch(x,y,z) (((x) & (y)) ^ ((~(x)) & (z)))
18 #define SHA_Maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
19
20 #else /* USE_MODIFIED_MACROS */
21 /*
22 * The following definitions are equivalent and potentially faster.
23 */
24
25 #define SHA_Ch(x, y, z) (((x) & ((y) ^ (z))) ^ (z))
26 #define SHA_Maj(x, y, z) (((x) & ((y) | (z))) | ((y) & (z)))
27
28 #endif /* USE_MODIFIED_MACROS */
29
30 #define SHA_Parity(x, y, z) ((x) ^ (y) ^ (z))
31
32 #endif /* _SHA_PRIVATE__H */
33