]> git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_cryptkit/lib/platform.h
Security-58286.1.32.tar.gz
[apple/security.git] / OSX / libsecurity_cryptkit / lib / platform.h
1 /* Copyright (c) 1998,2011,2014 Apple Inc. All Rights Reserved.
2 *
3 * NOTICE: USE OF THE MATERIALS ACCOMPANYING THIS NOTICE IS SUBJECT
4 * TO THE TERMS OF THE SIGNED "FAST ELLIPTIC ENCRYPTION (FEE) REFERENCE
5 * SOURCE CODE EVALUATION AGREEMENT" BETWEEN APPLE, INC. AND THE
6 * ORIGINAL LICENSEE THAT OBTAINED THESE MATERIALS FROM APPLE,
7 * INC. ANY USE OF THESE MATERIALS NOT PERMITTED BY SUCH AGREEMENT WILL
8 * EXPOSE YOU TO LIABILITY.
9 ***************************************************************************
10 *
11 * platform.h - platform-dependent C functions
12 *
13 * Revision History
14 * ----------------
15 * 6 Sep 96 at NeXT
16 * Created.
17 */
18
19 #ifndef _CK_PLATFORM_H_
20 #define _CK_PLATFORM_H_
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26 #include <string.h>
27 #include <stdlib.h>
28
29 /* many ways to determin macintosh - different for 68k, PPC/OS9, X */
30 #if defined(__POWERPC__) || defined(__CFM68K__) || defined(__APPLE__)
31 #undef __MAC_BUILD__
32 #define __MAC_BUILD__ 1
33 #endif
34
35 /*
36 * Make sure endianness is defined...
37 */
38 #if defined(__BIG_ENDIAN__) && defined(__LITTLE_ENDIAN__)
39 #error Hey! multiply defined endianness!
40 #endif
41 #if !defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__)
42 #if __MAC_BUILD__
43 #define __BIG_ENDIAN__ 1
44 #elif __i386__ || __i486__
45 #define __LITTLE_ENDIAN__ 1
46 #else
47 #error Platform dependent work needed
48 #endif
49 #endif /* endian */
50
51 /*
52 * Other platform-dependent functions in platform.c.
53 */
54
55 extern void CKRaise(const char *reason) __attribute__((noreturn));
56
57 /*
58 * Come up with some kind of "really" random int with which to seed the
59 * random number generator.
60 */
61 extern unsigned createRandomSeed(void);
62
63 #ifdef __cplusplus
64 }
65 #endif
66
67 #endif /*_CK_PLATFORM_H_*/