]> git.saurik.com Git - apple/xnu.git/blob - libkern/crypto/intel/sha1edp.h
xnu-1699.26.8.tar.gz
[apple/xnu.git] / libkern / crypto / intel / sha1edp.h
1 #if !defined sha1edp_h
2 #define sha1edp_h
3
4
5 /* This file is included in sha1edpLittleEndian.s and sha1edpBigEndian.s to
6 define the symbols below for use in assembly code.
7
8 It is also included in sha1_locl.h and compiled in C to test that the
9 hard-coded values here match the values used in C. CC_SHA1_BLOCK_BYTES
10 is defined in another header, so an error will be generated if its
11 definition here conflicts. The other symbols are tested below, with
12 the CheckAssertion definition.
13 */
14
15
16 // Number of bytes in a SHA-1 block.
17 #define CC_SHA1_BLOCK_BYTES 64
18
19 // Offset of h0 to h4 members in SHA-1 context structure.
20 #define Contexth0 (0*4)
21 #define Contexth1 (1*4)
22 #define Contexth2 (2*4)
23 #define Contexth3 (3*4)
24 #define Contexth4 (4*4)
25
26
27 #if !defined __ASSEMBLER__
28
29 #include <stddef.h> // Get offsetof macro.
30
31 /* Declare CheckAssertion so that if any of the declarations below
32 differ from it, the compiler will report an error.
33 */
34 extern char CheckAssertion[1];
35
36 /* Ensure that Contexth0 through Contexth4 are the byte offsets of the
37 h0 through h4 members of the SHA-1 context structure.
38 */
39 extern char CheckAssertion[Contexth0 == offsetof(SHA_CTX, h0)];
40 extern char CheckAssertion[Contexth1 == offsetof(SHA_CTX, h1)];
41 extern char CheckAssertion[Contexth2 == offsetof(SHA_CTX, h2)];
42 extern char CheckAssertion[Contexth3 == offsetof(SHA_CTX, h3)];
43 extern char CheckAssertion[Contexth4 == offsetof(SHA_CTX, h4)];
44 /* If these assertions fail, change the definitions of Contexth0 to
45 Contexth4 to match the offsets of the members.
46 */
47
48 #endif // !defined __ASSEMBLER__
49
50
51 #endif // !defined sha1edp_h