]> git.saurik.com Git - apple/security.git/blobdiff - Security/libsecurity_cryptkit/lib/platform.h
Security-57031.1.35.tar.gz
[apple/security.git] / Security / libsecurity_cryptkit / lib / platform.h
diff --git a/Security/libsecurity_cryptkit/lib/platform.h b/Security/libsecurity_cryptkit/lib/platform.h
new file mode 100644 (file)
index 0000000..7a9e9a9
--- /dev/null
@@ -0,0 +1,73 @@
+/* Copyright (c) 1998,2011,2014 Apple Inc.  All Rights Reserved.
+ *
+ * NOTICE: USE OF THE MATERIALS ACCOMPANYING THIS NOTICE IS SUBJECT
+ * TO THE TERMS OF THE SIGNED "FAST ELLIPTIC ENCRYPTION (FEE) REFERENCE
+ * SOURCE CODE EVALUATION AGREEMENT" BETWEEN APPLE, INC. AND THE
+ * ORIGINAL LICENSEE THAT OBTAINED THESE MATERIALS FROM APPLE,
+ * INC.  ANY USE OF THESE MATERIALS NOT PERMITTED BY SUCH AGREEMENT WILL
+ * EXPOSE YOU TO LIABILITY.
+ ***************************************************************************
+ *
+ * platform.h - platform-dependent C functions
+ *
+ * Revision History
+ * ----------------
+ *  6 Sep 96 at NeXT
+ *     Created.
+ */
+
+#ifndef        _CK_PLATFORM_H_
+#define _CK_PLATFORM_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <string.h>
+#include <stdlib.h>
+
+/* many ways to determin macintosh - different for 68k, PPC/OS9, X */
+#if    defined(__POWERPC__) || defined(__CFM68K__) || defined(__APPLE__)
+       #undef  __MAC_BUILD__
+       #define __MAC_BUILD__   1
+#endif
+
+/*
+ * Make sure endianness is defined...
+ */
+#if defined(__BIG_ENDIAN__) && defined(__LITTLE_ENDIAN__)
+#error Hey! multiply defined  endianness!
+#endif
+#if    !defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__)
+    #if        __MAC_BUILD__
+       #define __BIG_ENDIAN__          1
+    #elif __i386__ || __i486__
+       #define __LITTLE_ENDIAN__       1
+    #else
+       #error Platform dependent work needed
+    #endif
+#endif /* endian */
+
+#ifndef        NeXT
+    #define bcopy(s, d, l)     memmove(d, s, l)
+    #define bzero(s, l)                memset(s, 0, l)
+    #define bcmp(s, d, l)      memcmp(s, d, l)
+#endif
+
+/*
+ * Other platform-dependent functions in platform.c.
+ */
+
+extern void CKRaise(const char *reason);
+
+/*
+ * Come up with some kind of "really" random int with which to seed the
+ * random number generator.
+ */
+extern unsigned createRandomSeed(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*_CK_PLATFORM_H_*/