]> git.saurik.com Git - apple/xnu.git/blob - EXTERNAL_HEADERS/corecrypto/cc_config.h
xnu-2050.7.9.tar.gz
[apple/xnu.git] / EXTERNAL_HEADERS / corecrypto / cc_config.h
1 /*
2 * cc_config.h
3 * corecrypto
4 *
5 * Created by Michael Brouwer on 10/18/10.
6 * Copyright 2010,2011 Apple Inc. All rights reserved.
7 *
8 */
9 #ifndef _CORECRYPTO_CC_CONFIG_H_
10 #define _CORECRYPTO_CC_CONFIG_H_
11
12 #if !defined(CCN_UNIT_SIZE)
13 #if defined(__x86_64__)
14 #define CCN_UNIT_SIZE 8
15 #elif defined(__arm__) || defined(__i386__)
16 #define CCN_UNIT_SIZE 4
17 #else
18 #define CCN_UNIT_SIZE 2
19 #endif
20 #endif /* !defined(CCN_UNIT_SIZE) */
21
22 /* No dynamic linking allowed in L4, e.g. avoid nonlazy symbols */
23 /* For corecrypto kext, CC_STATIC should be 0 */
24
25 #if defined(__x86_64__) || defined(__i386__)
26
27 /* These assembly routines only work for a single CCN_UNIT_SIZE. */
28 #if (defined(__x86_64__) && CCN_UNIT_SIZE == 8) || (defined(__i386__) && CCN_UNIT_SIZE == 4)
29 #define CCN_ADD_ASM 1
30 #define CCN_SUB_ASM 1
31 #define CCN_MUL_ASM 1
32 #else
33 #define CCN_ADD_ASM 0
34 #define CCN_SUB_ASM 0
35 #define CCN_MUL_ASM 0
36 #endif
37
38 #define CCN_ADDMUL1_ASM 0
39 #define CCN_MUL1_ASM 0
40 #define CCN_CMP_ASM 0
41 #define CCN_ADD1_ASM 0
42 #define CCN_SUB1_ASM 0
43 #define CCN_N_ASM 0
44 #define CCN_SET_ASM 0
45 #define CCAES_ARM 0
46 #define CCAES_INTEL 1
47 #define CCN_USE_BUILTIN_CLZ 0
48 #define CCSHA1_VNG_INTEL 1
49 #define CCSHA2_VNG_INTEL 1
50 #define CCSHA1_VNG_ARMV7NEON 0
51 #define CCSHA2_VNG_ARMV7NEON 0
52
53 #else
54
55 #define CCN_ADD_ASM 0
56 #define CCN_SUB_ASM 0
57 #define CCN_MUL_ASM 0
58 #define CCN_ADDMUL1_ASM 0
59 #define CCN_MUL1_ASM 0
60 #define CCN_CMP_ASM 0
61 #define CCN_ADD1_ASM 0
62 #define CCN_SUB1_ASM 0
63 #define CCN_N_ASM 0
64 #define CCN_SET_ASM 0
65 #define CCAES_ARM 0
66 #define CCAES_INTEL 0
67 #define CCN_USE_BUILTIN_CLZ 0
68 #define CCSHA1_VNG_INTEL 0
69 #define CCSHA2_VNG_INTEL 0
70 #define CCSHA1_VNG_ARMV7NEON 0
71 #define CCSHA2_VNG_ARMV7NEON 0
72
73 #endif /* !defined(__i386__) */
74
75 #define CCN_N_INLINE 0
76 #define CCN_CMP_INLINE 0
77
78 #define CC_INLINE static inline
79
80 #ifdef __GNUC__
81 #define CC_NORETURN __attribute__((__noreturn__))
82 #define CC_NOTHROW __attribute__((__nothrow__))
83 #define CC_NONNULL(N) __attribute__((__nonnull__ N))
84 #define CC_NONNULL1 __attribute__((__nonnull__(1)))
85 #define CC_NONNULL2 __attribute__((__nonnull__(2)))
86 #define CC_NONNULL3 __attribute__((__nonnull__(3)))
87 #define CC_NONNULL4 __attribute__((__nonnull__(4)))
88 #define CC_NONNULL5 __attribute__((__nonnull__(5)))
89 #define CC_NONNULL6 __attribute__((__nonnull__(6)))
90 #define CC_NONNULL7 __attribute__((__nonnull__(7)))
91 #define CC_NONNULL_ALL __attribute__((__nonnull__))
92 #define CC_SENTINEL __attribute__((__sentinel__))
93 #define CC_CONST __attribute__((__const__))
94 #define CC_PURE __attribute__((__pure__))
95 #define CC_WARN_RESULT __attribute__((__warn_unused_result__))
96 #define CC_MALLOC __attribute__((__malloc__))
97 #define CC_UNUSED __attribute__((unused))
98 #else /* !__GNUC__ */
99 /*! @parseOnly */
100 #define CC_NORETURN
101 /*! @parseOnly */
102 #define CC_NOTHROW
103 /*! @parseOnly */
104 #define CC_NONNULL1
105 /*! @parseOnly */
106 #define CC_NONNULL2
107 /*! @parseOnly */
108 #define CC_NONNULL3
109 /*! @parseOnly */
110 #define CC_NONNULL4
111 /*! @parseOnly */
112 #define CC_NONNULL5
113 /*! @parseOnly */
114 #define CC_NONNULL6
115 /*! @parseOnly */
116 #define CC_NONNULL7
117 /*! @parseOnly */
118 #define CC_NONNULL_ALL
119 /*! @parseOnly */
120 #define CC_SENTINEL
121 /*! @parseOnly */
122 #define CC_CONST
123 /*! @parseOnly */
124 #define CC_PURE
125 /*! @parseOnly */
126 #define CC_WARN_RESULT
127 /*! @parseOnly */
128 #define CC_MALLOC
129 #endif /* !__GNUC__ */
130
131 #endif /* _CORECRYPTO_CC_CONFIG_H_ */