]> git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_cryptkit/lib/platform.c
Security-58286.60.28.tar.gz
[apple/security.git] / OSX / libsecurity_cryptkit / lib / platform.c
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.c - platform-dependent C functions
12 *
13 * Revision History
14 * ----------------
15 * 6 Sep 96 at NeXT
16 * Created.
17 */
18
19 #include "platform.h"
20 #include <stdio.h>
21 #include "feeDebug.h"
22
23 #ifdef NeXT
24
25 /*
26 * OpenStep....
27 */
28 void CKRaise(const char *reason) {
29 #if FEE_DEBUG
30 printf("CryptKit fatal error: %s\n", reason);
31 #endif
32 abort();
33 }
34
35 #elif WIN32
36
37 /*
38 * OpenStep on Windows.
39 */
40
41 void CKRaise(const char *reason) {
42 #if FEE_DEBUG
43 printf("CryptKit fatal error: %s\n", reason);
44 #endif
45 abort();
46 }
47
48 #elif __MAC_BUILD__
49
50 /*
51 * Macintosh, all flavors.
52 */
53 #include <stdlib.h>
54 #include <CrashReporterClient.h>
55
56 void CKRaise(const char *reason) {
57 #if FEE_DEBUG
58 printf("CryptKit fatal error: %s\n", reason);
59 #endif
60 char * msg = NULL;
61 if(asprintf(&msg, "CryptKit fatal error: %s", reason)) {
62 CRSetCrashLogMessage(msg);
63 } else {
64 CRSetCrashLogMessage("CryptKit fatal error");
65 }
66 abort();
67 }
68
69 #elif unix
70
71 /* try for generic UNIX */
72
73 void CKRaise(const char *reason) {
74 #if FEE_DEBUG
75 printf("CryptKit fatal error: %s\n", reason);
76 #endif
77 abort();
78 }
79
80 #else
81
82 #error platform-specific work needed in security_cryptkit/platform.c
83
84 #endif