]>
Commit | Line | Data |
---|---|---|
316670eb A |
1 | /* |
2 | * cc_config.h | |
3 | * corecrypto | |
4 | * | |
3e170ce0 A |
5 | * Created on 11/16/2010 |
6 | * | |
7 | * Copyright (c) 2010,2011,2012,2013,2014,2015 Apple Inc. All rights reserved. | |
316670eb A |
8 | * |
9 | */ | |
fe8ab488 | 10 | |
316670eb A |
11 | #ifndef _CORECRYPTO_CC_CONFIG_H_ |
12 | #define _CORECRYPTO_CC_CONFIG_H_ | |
13 | ||
fe8ab488 A |
14 | /* A word about configuration macros: |
15 | ||
16 | Conditional configuration macros specific to corecrypto should be named CORECRYPTO_xxx | |
17 | or CCxx_yyy and be defined to be either 0 or 1 in this file. You can add an | |
18 | #ifndef #error construct at the end of this file to make sure it's always defined. | |
19 | ||
20 | They should always be tested using the #if directive, never the #ifdef directive. | |
21 | ||
22 | No other conditional macros shall ever be used (except in this file) | |
23 | ||
24 | Configuration Macros that are defined outside of corecrypto (eg: KERNEL, DEBUG, ...) | |
25 | shall only be used in this file to define CCxxx macros. | |
26 | ||
27 | External macros should be assumed to be either undefined, defined with no value, | |
28 | or defined as true or false. We shall strive to build with -Wundef whenever possible, | |
29 | so the following construct should be used to test external macros in this file: | |
30 | ||
31 | #if defined(DEBUG) && (DEBUG) | |
32 | #define CORECRYPTO_DEBUG 1 | |
33 | #else | |
34 | #define CORECRYPTO_DEBUG 0 | |
35 | #endif | |
36 | ||
37 | ||
38 | It is acceptable to define a conditional CC_xxxx macro in an implementation file, | |
39 | to be used only in this file. | |
40 | ||
41 | The current code is not guaranteed to follow those rules, but should be fixed to. | |
42 | ||
43 | Corecrypto requires GNU and C99 compatibility. | |
44 | Typically enabled by passing --gnu --c99 to the compiler (eg. armcc) | |
45 | ||
46 | */ | |
47 | ||
5ba3f43e A |
48 | //Do not set this macros to 1, unless you are developing/testing for Linux under macOS |
49 | #define CORECRYPTO_SIMULATE_POSIX_ENVIRONMENT 0 | |
50 | ||
51 | //Do not set these macros to 1, unless you are developing/testing for Windows under macOS | |
39037602 | 52 | #define CORECRYPTO_SIMULATE_WINDOWS_ENVIRONMENT 0 |
5ba3f43e | 53 | #define CORECRYPTO_HACK_FOR_WINDOWS_DEVELOPMENT 0 //to be removed after <rdar://problem/27304763> port corecrypto to Windows |
39037602 A |
54 | |
55 | //this macro is used to turn on/off usage of transparent union in corecrypto | |
56 | //it should be commented out in corecrypto and be used only by the software that use corecrypto | |
57 | //#define CORECRYPTO_DONOT_USE_TRANSPARENT_UNION | |
5ba3f43e A |
58 | #if defined(__cplusplus) |
59 | #define CORECRYPTO_USE_TRANSPARENT_UNION 0 | |
60 | #elif defined(CORECRYPTO_DONOT_USE_TRANSPARENT_UNION) | |
61 | #define CORECRYPTO_USE_TRANSPARENT_UNION !CORECRYPTO_DONOT_USE_TRANSPARENT_UNION | |
39037602 A |
62 | #else |
63 | #define CORECRYPTO_USE_TRANSPARENT_UNION 1 | |
64 | #endif | |
65 | ||
66 | #if (defined(DEBUG) && (DEBUG)) || defined(_DEBUG) //MSVC defines _DEBUG | |
fe8ab488 | 67 | /* CC_DEBUG is already used in CommonCrypto */ |
39037602 | 68 | #define CORECRYPTO_DEBUG 1 |
fe8ab488 | 69 | #else |
39037602 | 70 | #define CORECRYPTO_DEBUG 0 |
fe8ab488 A |
71 | #endif |
72 | ||
39037602 A |
73 | // This macro can be used to enable prints when a condition in the macro "cc_require" |
74 | // is false. This is especially useful to confirm that negative testing fails | |
75 | // at the intended location | |
76 | #define CORECRYPTO_DEBUG_ENABLE_CC_REQUIRE_PRINTS 0 | |
77 | ||
fe8ab488 | 78 | #if defined(KERNEL) && (KERNEL) |
39037602 | 79 | #define CC_KERNEL 1 // KEXT, XNU repo or kernel components such as AppleKeyStore |
fe8ab488 | 80 | #else |
39037602 | 81 | #define CC_KERNEL 0 |
fe8ab488 A |
82 | #endif |
83 | ||
5ba3f43e | 84 | #if defined(__linux__) || CORECRYPTO_SIMULATE_POSIX_ENVIRONMENT |
39037602 | 85 | #define CC_LINUX 1 |
3e170ce0 | 86 | #else |
39037602 | 87 | #define CC_LINUX 0 |
3e170ce0 A |
88 | #endif |
89 | ||
fe8ab488 | 90 | #if defined(USE_L4) && (USE_L4) |
39037602 | 91 | #define CC_USE_L4 1 |
fe8ab488 | 92 | #else |
39037602 | 93 | #define CC_USE_L4 0 |
fe8ab488 A |
94 | #endif |
95 | ||
5ba3f43e A |
96 | #if defined(RTKIT) && (RTKIT) |
97 | #define CC_RTKIT 1 | |
98 | #else | |
99 | #define CC_RTKIT 0 | |
100 | #endif | |
101 | ||
3e170ce0 | 102 | #if defined(USE_SEPROM) && (USE_SEPROM) |
39037602 | 103 | #define CC_USE_SEPROM 1 |
3e170ce0 | 104 | #else |
39037602 | 105 | #define CC_USE_SEPROM 0 |
3e170ce0 A |
106 | #endif |
107 | ||
108 | #if defined(USE_S3) && (USE_S3) | |
39037602 | 109 | #define CC_USE_S3 1 |
3e170ce0 | 110 | #else |
39037602 | 111 | #define CC_USE_S3 0 |
3e170ce0 A |
112 | #endif |
113 | ||
39037602 A |
114 | #if (defined(ICE_FEATURES_ENABLED)) || (defined(MAVERICK) && (MAVERICK)) |
115 | #define CC_BASEBAND 1 | |
fe8ab488 | 116 | #else |
39037602 A |
117 | #define CC_BASEBAND 0 |
118 | #endif | |
119 | ||
120 | #if defined(EFI) && (EFI) | |
121 | #define CC_EFI 1 | |
122 | #else | |
123 | #define CC_EFI 0 | |
fe8ab488 A |
124 | #endif |
125 | ||
126 | #if defined(IBOOT) && (IBOOT) | |
39037602 | 127 | #define CC_IBOOT 1 |
fe8ab488 | 128 | #else |
39037602 | 129 | #define CC_IBOOT 0 |
fe8ab488 A |
130 | #endif |
131 | ||
5ba3f43e A |
132 | // Defined by the XNU build scripts |
133 | // Applies to code embedded in XNU but NOT to the kext | |
134 | #if defined(XNU_KERNEL_PRIVATE) | |
135 | #define CC_XNU_KERNEL_PRIVATE 1 | |
136 | #else | |
137 | #define CC_XNU_KERNEL_PRIVATE 0 | |
138 | #endif | |
139 | ||
140 | // handle unaligned data, if the cpu cannot. Currently for gladman AES and the C version of the SHA256 | |
141 | #define CC_HANDLE_UNALIGNED_DATA CC_BASEBAND | |
142 | ||
143 | // BaseBand configuration | |
39037602 | 144 | #if CC_BASEBAND |
fe8ab488 A |
145 | |
146 | // -- ENDIANESS | |
5ba3f43e | 147 | #if !defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__) |
39037602 A |
148 | #if defined(ENDIAN_LITTLE) || (defined(__arm__) && !defined(__BIG_ENDIAN)) |
149 | #define __LITTLE_ENDIAN__ | |
150 | #elif !defined(ENDIAN_BIG) && !defined(__BIG_ENDIAN) | |
151 | #error Baseband endianess not defined. | |
152 | #endif | |
153 | #define AESOPT_ENDIAN_NO_FILE | |
5ba3f43e | 154 | #endif |
fe8ab488 A |
155 | |
156 | // -- Architecture | |
39037602 | 157 | #define CCN_UNIT_SIZE 4 // 32 bits |
fe8ab488 A |
158 | |
159 | // -- External function | |
39037602 | 160 | #define assert ASSERT // sanity |
fe8ab488 A |
161 | |
162 | // -- Warnings | |
163 | // Ignore irrelevant warnings after verification | |
164 | // #1254-D: arithmetic on pointer to void or function type | |
165 | // #186-D: pointless comparison of unsigned integer with zero | |
166 | // #546-D: transfer of control bypasses initialization of | |
5ba3f43e A |
167 | #ifdef __arm__ |
168 | #pragma diag_suppress 186, 1254,546 | |
169 | #elif defined(__GNUC__) | |
fe8ab488 | 170 | // warning: pointer of type 'void *' used in arithmetic |
39037602 | 171 | #pragma GCC diagnostic ignored "-Wpointer-arith" |
5ba3f43e | 172 | #endif // __arm__ |
39037602 | 173 | #endif // CC_BASEBAND |
fe8ab488 | 174 | |
39037602 A |
175 | //CC_XNU_KERNEL_AVAILABLE indicates the availibity of XNU kernel functions, |
176 | //like what we have on OSX, iOS, tvOS, Watch OS | |
5ba3f43e | 177 | #if defined(__APPLE__) && defined(__MACH__) |
39037602 | 178 | #define CC_XNU_KERNEL_AVAILABLE 1 |
316670eb | 179 | #else |
39037602 | 180 | #define CC_XNU_KERNEL_AVAILABLE 0 |
316670eb | 181 | #endif |
39037602 | 182 | |
5ba3f43e A |
183 | //arm arch64 definition for gcc |
184 | #if defined(__GNUC__) && defined(__aarch64__) && !defined(__arm64__) | |
185 | #define __arm64__ | |
186 | #endif | |
187 | ||
39037602 A |
188 | #if !defined(CCN_UNIT_SIZE) |
189 | #if defined(__arm64__) || defined(__x86_64__) || defined(_WIN64) | |
190 | #define CCN_UNIT_SIZE 8 | |
191 | #elif defined(__arm__) || defined(__i386__) || defined(_WIN32) | |
192 | #define CCN_UNIT_SIZE 4 | |
193 | #else | |
194 | #error undefined architecture | |
195 | #endif | |
316670eb A |
196 | #endif /* !defined(CCN_UNIT_SIZE) */ |
197 | ||
39037602 A |
198 | |
199 | //this allows corecrypto Windows development using xcode | |
200 | #if defined(CORECRYPTO_SIMULATE_WINDOWS_ENVIRONMENT) | |
201 | #if CORECRYPTO_SIMULATE_WINDOWS_ENVIRONMENT && CC_XNU_KERNEL_AVAILABLE && CORECRYPTO_DEBUG | |
202 | #define CC_USE_ASM 0 | |
203 | #define CC_USE_HEAP_FOR_WORKSPACE 1 | |
204 | #if (CCN_UNIT_SIZE==8) | |
205 | #define CCN_UINT128_SUPPORT_FOR_64BIT_ARCH 0 | |
206 | #else | |
207 | #define CCN_UINT128_SUPPORT_FOR_64BIT_ARCH 1 | |
208 | #endif | |
209 | #endif | |
210 | #endif | |
211 | ||
212 | #if !defined(CCN_UINT128_SUPPORT_FOR_64BIT_ARCH) | |
213 | #if defined(_WIN64) && defined(_WIN32) && (CCN_UNIT_SIZE==8) | |
214 | #define CCN_UINT128_SUPPORT_FOR_64BIT_ARCH 0 | |
215 | #elif defined(_WIN32) | |
216 | #define CCN_UINT128_SUPPORT_FOR_64BIT_ARCH 1//should not be a problem | |
217 | #else | |
218 | #define CCN_UINT128_SUPPORT_FOR_64BIT_ARCH 1 | |
219 | #endif | |
220 | #endif | |
221 | ||
5ba3f43e A |
222 | #if defined(_MSC_VER) |
223 | #if defined(__clang__) | |
224 | #define CC_ALIGNED(x) __attribute__ ((aligned(x))) //clang compiler | |
225 | #else | |
226 | #define CC_ALIGNED(x) __declspec(align(x)) //MS complier | |
227 | #endif | |
39037602 | 228 | #else |
5ba3f43e A |
229 | #if __clang__ || CCN_UNIT_SIZE==8 |
230 | #define CC_ALIGNED(x) __attribute__ ((aligned(x))) | |
231 | #else | |
232 | #define CC_ALIGNED(x) __attribute__ ((aligned((x)>8?8:(x)))) | |
233 | #endif | |
39037602 A |
234 | #endif |
235 | ||
5ba3f43e A |
236 | #if defined(__arm__) |
237 | //this is copied from <arm/arch.h>, because <arm/arch.h> is not available on SEPROM environment | |
238 | #if defined (__ARM_ARCH_7A__) || defined (__ARM_ARCH_7S__) || defined (__ARM_ARCH_7F__) || defined (__ARM_ARCH_7K__) | |
239 | #define _ARM_ARCH_7 | |
240 | #endif | |
241 | ||
242 | #if defined(__ARM_ARCH_6M__) || defined(__TARGET_ARCH_6S_M) || defined (__armv6m__) | |
243 | #define _ARM_ARCH_6M | |
244 | #endif | |
245 | #endif | |
39037602 | 246 | |
5ba3f43e A |
247 | #if defined(__arm64__) || defined(__arm__) |
248 | #define CCN_IOS 1 | |
249 | #define CCN_OSX 0 | |
250 | #elif defined(__x86_64__) || defined(__i386__) | |
39037602 A |
251 | #define CCN_IOS 0 |
252 | #define CCN_OSX 1 | |
fe8ab488 A |
253 | #endif |
254 | ||
3e170ce0 | 255 | #if CC_USE_L4 || CC_USE_S3 |
316670eb | 256 | /* No dynamic linking allowed in L4, e.g. avoid nonlazy symbols */ |
3e170ce0 | 257 | /* For corecrypto kext, CC_STATIC should be undefined */ |
39037602 | 258 | #define CC_STATIC 1 |
fe8ab488 | 259 | #endif |
316670eb | 260 | |
39037602 | 261 | #if !defined(CC_USE_HEAP_FOR_WORKSPACE) |
5ba3f43e | 262 | #if CC_USE_S3 || CC_USE_SEPROM || CC_RTKIT |
39037602 | 263 | #define CC_USE_HEAP_FOR_WORKSPACE 0 |
5ba3f43e A |
264 | #else |
265 | #define CC_USE_HEAP_FOR_WORKSPACE 1 | |
39037602 | 266 | #endif |
fe8ab488 A |
267 | #endif |
268 | ||
3e170ce0 | 269 | /* memset_s is only available in few target */ |
5ba3f43e | 270 | #if CC_USE_SEPROM || defined(__CC_ARM) \ |
39037602 A |
271 | || defined(__hexagon__) || CC_EFI |
272 | #define CC_HAS_MEMSET_S 0 | |
3e170ce0 | 273 | #else |
39037602 | 274 | #define CC_HAS_MEMSET_S 1 |
3e170ce0 A |
275 | #endif |
276 | ||
39037602 A |
277 | // Include target conditionals if available. |
278 | #if defined(__has_include) /* portability */ | |
279 | #if __has_include(<TargetConditionals.h>) | |
280 | #include <TargetConditionals.h> | |
281 | #endif /* __has_include(<TargetConditionals.h>) */ | |
282 | #endif /* defined(__has_include) */ | |
283 | ||
5ba3f43e | 284 | // Disable RSA Keygen on iBridge |
743345f9 A |
285 | #if defined(TARGET_OS_BRIDGE) && TARGET_OS_BRIDGE && CC_KERNEL |
286 | #define CC_DISABLE_RSAKEYGEN 1 /* for iBridge */ | |
287 | #else | |
288 | #define CC_DISABLE_RSAKEYGEN 0 /* default */ | |
289 | #endif | |
290 | ||
39037602 A |
291 | //- functions implemented in assembly ------------------------------------------ |
292 | //this the list of corecrypto clients that use assembly and the clang compiler | |
5ba3f43e | 293 | #if !(CC_XNU_KERNEL_AVAILABLE || CC_KERNEL || CC_USE_L4 || CC_IBOOT || CC_RTKIT || CC_USE_SEPROM || CC_USE_S3) && !defined(_WIN32) && CORECRYPTO_DEBUG |
39037602 | 294 | #warning "You are using the default corecrypto configuration, assembly optimizations may not be available for your platform" |
316670eb A |
295 | #endif |
296 | ||
5ba3f43e A |
297 | // Use this macro to strictly disable assembly regardless of cpu/os/compiler/etc. |
298 | // Our assembly code is not gcc compatible. Clang defines the __GNUC__ macro as well. | |
39037602 | 299 | #if !defined(CC_USE_ASM) |
5ba3f43e | 300 | #if defined(_WIN32) || CC_EFI || CC_BASEBAND || CC_XNU_KERNEL_PRIVATE || (defined(__GNUC__) && !defined(__clang__)) || defined(__ANDROID_API__) |
39037602 A |
301 | #define CC_USE_ASM 0 |
302 | #else | |
303 | #define CC_USE_ASM 1 | |
304 | #endif | |
3e170ce0 A |
305 | #endif |
306 | ||
39037602 A |
307 | //-(1) ARM V7 |
308 | #if defined(_ARM_ARCH_7) && __clang__ && CC_USE_ASM | |
309 | #define CCN_DEDICATED_SQR 1 | |
310 | #define CCN_MUL_KARATSUBA 0 // no performance improvement | |
311 | #define CCN_ADD_ASM 1 | |
312 | #define CCN_SUB_ASM 1 | |
313 | #define CCN_MUL_ASM 0 | |
314 | #define CCN_ADDMUL1_ASM 1 | |
315 | #define CCN_MUL1_ASM 1 | |
316 | #define CCN_CMP_ASM 1 | |
317 | #define CCN_ADD1_ASM 0 | |
318 | #define CCN_SUB1_ASM 0 | |
319 | #define CCN_N_ASM 1 | |
320 | #define CCN_SET_ASM 1 | |
321 | #define CCN_SHIFT_RIGHT_ASM 1 | |
322 | #define CCAES_ARM_ASM 1 | |
323 | #define CCAES_INTEL_ASM 0 | |
5ba3f43e | 324 | #if CC_KERNEL || CC_USE_L4 || CC_IBOOT || CC_RTKIT || CC_USE_SEPROM || CC_USE_S3 |
39037602 A |
325 | #define CCAES_MUX 0 |
326 | #else | |
327 | #define CCAES_MUX 1 | |
328 | #endif | |
329 | #define CCN_USE_BUILTIN_CLZ 1 | |
330 | #define CCSHA1_VNG_INTEL 0 | |
331 | #define CCSHA2_VNG_INTEL 0 | |
332 | ||
333 | #if defined(__ARM_NEON__) || CC_KERNEL | |
334 | #define CCSHA1_VNG_ARMV7NEON 1 | |
335 | #define CCSHA2_VNG_ARMV7NEON 1 | |
336 | #else /* !defined(__ARM_NEON__) */ | |
337 | #define CCSHA1_VNG_ARMV7NEON 0 | |
338 | #define CCSHA2_VNG_ARMV7NEON 0 | |
339 | #endif /* !defined(__ARM_NEON__) */ | |
340 | #define CCSHA256_ARMV6M_ASM 0 | |
341 | ||
342 | //-(2) ARM 64 | |
5ba3f43e A |
343 | #elif defined(__arm64__) && __clang__ && CC_USE_ASM |
344 | #define CCN_DEDICATED_SQR 1 | |
345 | #define CCN_MUL_KARATSUBA 1 // 4*n CCN_UNIT extra memory required. | |
346 | #define CCN_ADD_ASM 1 | |
347 | #define CCN_SUB_ASM 1 | |
348 | #define CCN_MUL_ASM 1 | |
349 | #define CCN_ADDMUL1_ASM 0 | |
350 | #define CCN_MUL1_ASM 0 | |
351 | #define CCN_CMP_ASM 1 | |
352 | #define CCN_ADD1_ASM 0 | |
353 | #define CCN_SUB1_ASM 0 | |
354 | #define CCN_N_ASM 1 | |
355 | #define CCN_SET_ASM 0 | |
356 | #define CCN_SHIFT_RIGHT_ASM 1 | |
357 | #define CCAES_ARM_ASM 1 | |
358 | #define CCAES_INTEL_ASM 0 | |
359 | #define CCAES_MUX 0 // On 64bit SoC, asm is much faster than HW | |
360 | #define CCN_USE_BUILTIN_CLZ 1 | |
361 | #define CCSHA1_VNG_INTEL 0 | |
362 | #define CCSHA2_VNG_INTEL 0 | |
363 | #define CCSHA1_VNG_ARMV7NEON 1 // reused this to avoid making change to xcode project, put arm64 assembly code with armv7 code | |
364 | #define CCSHA2_VNG_ARMV7NEON 1 | |
365 | #define CCSHA256_ARMV6M_ASM 0 | |
366 | ||
367 | //-(3) Intel 32/64 | |
39037602 A |
368 | #elif (defined(__x86_64__) || defined(__i386__)) && __clang__ && CC_USE_ASM |
369 | #define CCN_DEDICATED_SQR 1 | |
370 | #define CCN_MUL_KARATSUBA 1 // 4*n CCN_UNIT extra memory required. | |
371 | /* These assembly routines only work for a single CCN_UNIT_SIZE. */ | |
372 | #if (defined(__x86_64__) && CCN_UNIT_SIZE == 8) || (defined(__i386__) && CCN_UNIT_SIZE == 4) | |
373 | #define CCN_ADD_ASM 1 | |
374 | #define CCN_SUB_ASM 1 | |
375 | #define CCN_MUL_ASM 1 | |
376 | #else | |
377 | #define CCN_ADD_ASM 0 | |
378 | #define CCN_SUB_ASM 0 | |
379 | #define CCN_MUL_ASM 0 | |
380 | #endif | |
381 | ||
382 | #if (defined(__x86_64__) && CCN_UNIT_SIZE == 8) | |
383 | #define CCN_CMP_ASM 1 | |
384 | #define CCN_N_ASM 1 | |
385 | #define CCN_SHIFT_RIGHT_ASM 1 | |
386 | #else | |
387 | #define CCN_CMP_ASM 0 | |
388 | #define CCN_N_ASM 0 | |
389 | #define CCN_SHIFT_RIGHT_ASM 0 | |
390 | #endif | |
391 | ||
392 | #define CCN_ADDMUL1_ASM 0 | |
393 | #define CCN_MUL1_ASM 0 | |
394 | #define CCN_ADD1_ASM 0 | |
395 | #define CCN_SUB1_ASM 0 | |
396 | #define CCN_SET_ASM 0 | |
397 | #define CCAES_ARM_ASM 0 | |
398 | #define CCAES_INTEL_ASM 1 | |
399 | #define CCAES_MUX 0 | |
400 | #define CCN_USE_BUILTIN_CLZ 0 | |
401 | #define CCSHA1_VNG_INTEL 1 | |
402 | #define CCSHA2_VNG_INTEL 1 | |
403 | #define CCSHA1_VNG_ARMV7NEON 0 | |
404 | #define CCSHA2_VNG_ARMV7NEON 0 | |
405 | #define CCSHA256_ARMV6M_ASM 0 | |
406 | ||
407 | //-(4) disable assembly | |
316670eb | 408 | #else |
39037602 A |
409 | #if CCN_UINT128_SUPPORT_FOR_64BIT_ARCH |
410 | #define CCN_DEDICATED_SQR 1 | |
411 | #else | |
412 | #define CCN_DEDICATED_SQR 0 //when assembly is off and 128-bit integers are not supported, dedicated square is off. This is the case on Windows | |
413 | #endif | |
414 | #define CCN_MUL_KARATSUBA 1 // 4*n CCN_UNIT extra memory required. | |
415 | #define CCN_ADD_ASM 0 | |
416 | #define CCN_SUB_ASM 0 | |
417 | #define CCN_MUL_ASM 0 | |
418 | #define CCN_ADDMUL1_ASM 0 | |
419 | #define CCN_MUL1_ASM 0 | |
420 | #define CCN_CMP_ASM 0 | |
421 | #define CCN_ADD1_ASM 0 | |
422 | #define CCN_SUB1_ASM 0 | |
423 | #define CCN_N_ASM 0 | |
424 | #define CCN_SET_ASM 0 | |
425 | #define CCN_SHIFT_RIGHT_ASM 0 | |
426 | #define CCAES_ARM_ASM 0 | |
427 | #define CCAES_INTEL_ASM 0 | |
428 | #define CCAES_MUX 0 | |
429 | #define CCN_USE_BUILTIN_CLZ 0 | |
430 | #define CCSHA1_VNG_INTEL 0 | |
431 | #define CCSHA2_VNG_INTEL 0 | |
432 | #define CCSHA1_VNG_ARMV7NEON 0 | |
433 | #define CCSHA2_VNG_ARMV7NEON 0 | |
434 | #define CCSHA256_ARMV6M_ASM 0 | |
435 | ||
436 | #endif | |
316670eb | 437 | |
316670eb A |
438 | #define CC_INLINE static inline |
439 | ||
39037602 A |
440 | #if CORECRYPTO_USE_TRANSPARENT_UNION |
441 | // Non null for transparent unions is ambiguous and cause problems | |
442 | // for most tools (GCC and others: 23919290). | |
443 | #define CC_NONNULL_TU(N) | |
fe8ab488 | 444 | #else |
39037602 | 445 | #define CC_NONNULL_TU(N) CC_NONNULL(N) |
fe8ab488 | 446 | #endif |
39037602 A |
447 | |
448 | #ifdef __GNUC__ | |
449 | #define CC_NORETURN __attribute__((__noreturn__)) | |
450 | #define CC_NOTHROW __attribute__((__nothrow__)) | |
451 | #define CC_NONNULL(N) __attribute__((__nonnull__ N)) | |
452 | #define CC_NONNULL1 __attribute__((__nonnull__(1))) | |
453 | #define CC_NONNULL2 __attribute__((__nonnull__(2))) | |
454 | #define CC_NONNULL3 __attribute__((__nonnull__(3))) | |
455 | #define CC_NONNULL4 __attribute__((__nonnull__(4))) | |
456 | #define CC_NONNULL5 __attribute__((__nonnull__(5))) | |
457 | #define CC_NONNULL6 __attribute__((__nonnull__(6))) | |
458 | #define CC_NONNULL7 __attribute__((__nonnull__(7))) | |
459 | #define CC_NONNULL_ALL __attribute__((__nonnull__)) | |
460 | #define CC_SENTINEL __attribute__((__sentinel__)) | |
461 | #define CC_CONST __attribute__((__const__)) | |
462 | #define CC_PURE __attribute__((__pure__)) | |
463 | #define CC_WARN_RESULT __attribute__((__warn_unused_result__)) | |
464 | #define CC_MALLOC __attribute__((__malloc__)) | |
465 | #define CC_UNUSED __attribute__((unused)) | |
316670eb A |
466 | #else /* !__GNUC__ */ |
467 | /*! @parseOnly */ | |
39037602 | 468 | #define CC_UNUSED |
fe8ab488 | 469 | /*! @parseOnly */ |
39037602 | 470 | #define CC_NONNULL(N) |
fe8ab488 | 471 | /*! @parseOnly */ |
39037602 | 472 | #define CC_NORETURN |
316670eb | 473 | /*! @parseOnly */ |
39037602 | 474 | #define CC_NOTHROW |
316670eb | 475 | /*! @parseOnly */ |
39037602 | 476 | #define CC_NONNULL1 |
316670eb | 477 | /*! @parseOnly */ |
39037602 | 478 | #define CC_NONNULL2 |
316670eb | 479 | /*! @parseOnly */ |
39037602 | 480 | #define CC_NONNULL3 |
316670eb | 481 | /*! @parseOnly */ |
39037602 | 482 | #define CC_NONNULL4 |
316670eb | 483 | /*! @parseOnly */ |
39037602 | 484 | #define CC_NONNULL5 |
316670eb | 485 | /*! @parseOnly */ |
39037602 | 486 | #define CC_NONNULL6 |
316670eb | 487 | /*! @parseOnly */ |
39037602 | 488 | #define CC_NONNULL7 |
316670eb | 489 | /*! @parseOnly */ |
39037602 | 490 | #define CC_NONNULL_ALL |
316670eb | 491 | /*! @parseOnly */ |
39037602 | 492 | #define CC_SENTINEL |
316670eb | 493 | /*! @parseOnly */ |
39037602 | 494 | #define CC_CONST |
316670eb | 495 | /*! @parseOnly */ |
39037602 | 496 | #define CC_PURE |
316670eb | 497 | /*! @parseOnly */ |
39037602 | 498 | #define CC_WARN_RESULT |
316670eb | 499 | /*! @parseOnly */ |
39037602 | 500 | #define CC_MALLOC |
316670eb A |
501 | #endif /* !__GNUC__ */ |
502 | ||
5ba3f43e A |
503 | // Enable FIPSPOST function tracing only when supported. */ |
504 | #ifdef CORECRYPTO_POST_TRACE | |
505 | #define CC_FIPSPOST_TRACE 1 | |
506 | #else | |
507 | #define CC_FIPSPOST_TRACE 0 | |
508 | #endif | |
3e170ce0 | 509 | |
316670eb | 510 | #endif /* _CORECRYPTO_CC_CONFIG_H_ */ |