]> git.saurik.com Git - apple/security.git/blob - cdsa/cdsa_utilities/ktracecodes.h
Security-179.tar.gz
[apple/security.git] / cdsa / cdsa_utilities / ktracecodes.h
1 #ifndef _KTRACE_CODES_H_
2 #define _KTRACE_CODES_H_
3
4 #include <Security/debugging.h>
5 #include <sys/kdebug.h>
6
7 /*
8 we format as follows (not really done this way because bitfields are compiler dependent):
9
10 struct DebugCode
11 {
12 int DebugClass : 8;
13 int SubClass : 8;
14 int SecurityAppClass : 4;
15 int SecurityCodeClass : 10;
16 int FunctionQualifier : 2;
17 };
18 */
19
20 // Define the following as macros to keep objective c happy.
21
22 // define app class constants
23 #define APP_DEBUG_CLASS 0x40
24
25 // define the sub class for security
26 #define SECURITY_SUB_CLASS 0xAA
27
28 // define the app classes used by security
29 #define APP_CLASS_SFAUTHORIZATION 0
30 #define APP_CLASS_SECURITY_AGENT 1
31 #define APP_CLASS_AUTHORIZATION 2
32 #define APP_CLASS_SECURITY_SERVER 3
33 #define APP_CLASS_ADHOC 4
34
35 // define function qualifiers
36 #define FUNCTION_START DBG_FUNC_START
37 #define FUNCTION_END DBG_FUNC_END
38 #define FUNCTION_TIMEPOINT DBG_FUNC_NONE
39
40 // define SFAuthorization code class
41 #define CODE_CLASS_SFAUTHORIZATION_BUTTON_PRESSED 0
42 #define CODE_CLASS_SFAUTHORIZATION_AUTHORIZATION 1
43
44 // define SecurityAgent code class
45 #define CODE_CLASS_SECURITY_AGENT_START 0
46 #define CODE_CLASS_SECURITY_AGENT_STARTED_BY_SECURITY_SERVER 1
47 #define CODE_CLASS_SECURITY_AGENT_BEFORE_MECHANISM_INVOKE 2
48 #define CODE_CLASS_SECURITY_AGENT_CONFIRM_ACCESS 3
49
50 // define Authorization code classes
51 #define CODE_CLASS_AUTHORIZATION_CREATE 0
52 #define CODE_CLASS_AUTHORIZATION_COPY_RIGHTS 1
53 #define CODE_CLASS_AUTHORIZATION_COPY_INFO 2
54
55 // define SecurityServer code classes
56 #define CODE_CLASS_SECURITY_SERVER_INITIALIZE 0
57
58 // define adhoc code classes (may change by need)
59 #define CODE_CLASS_ADHOC_FINDGENERICPASSWORD_BEGIN 0
60 #define CODE_CLASS_ADHOC_UCSP_CLIENT_BEGIN 1
61 #define CODE_CLASS_ADHOC_UCSP_SERVER_DECRYPT_BEGIN 2
62 #define CODE_CLASS_ADHOC_UCSP_QUERYKEYCHAINACCESS_BEGIN 3
63
64 // define SecurityServer code classes
65 #define TRACECODE(_debugclass, _subclass, _appclass, _codeclass, _functionqualifier) \
66 ((_debugclass << 24) | (_subclass << 16) | (_appclass << 12) | (_codeclass << 2) | (_functionqualifier))
67
68 /*
69 * Trace code allocations.
70 */
71 enum {
72 kSecTraceSFAuthorizationButtonPressedStart =
73 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_SFAUTHORIZATION, CODE_CLASS_SFAUTHORIZATION_BUTTON_PRESSED, FUNCTION_START),
74 kSecTraceSFAuthorizationAuthorizationStart =
75 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_SFAUTHORIZATION, CODE_CLASS_SFAUTHORIZATION_AUTHORIZATION, FUNCTION_START),
76 kSecTraceSFAuthorizationAuthorizationEnd =
77 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_SFAUTHORIZATION, CODE_CLASS_SFAUTHORIZATION_AUTHORIZATION, FUNCTION_END),
78 kSecTraceSFAuthorizationButtonPressedEnd =
79 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_SFAUTHORIZATION, CODE_CLASS_SFAUTHORIZATION_BUTTON_PRESSED, FUNCTION_END),
80
81 kSecTraceSecurityAgentStart =
82 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_SECURITY_AGENT, CODE_CLASS_SECURITY_AGENT_START, FUNCTION_TIMEPOINT),
83 kSecTraceSecurityAgentStartedBySecurityServer =
84 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_SECURITY_AGENT, CODE_CLASS_SECURITY_AGENT_STARTED_BY_SECURITY_SERVER,
85 FUNCTION_TIMEPOINT),
86 kSecTraceSecurityAgentBeforeMechanismInvoke =
87 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_SECURITY_AGENT, CODE_CLASS_SECURITY_AGENT_BEFORE_MECHANISM_INVOKE,
88 FUNCTION_TIMEPOINT),
89 kSecTraceSecurityAgentConfimAccess =
90 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_SECURITY_AGENT, CODE_CLASS_SECURITY_AGENT_CONFIRM_ACCESS, FUNCTION_TIMEPOINT),
91
92 kSecTraceAuthorizationCreateStart =
93 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_AUTHORIZATION, CODE_CLASS_AUTHORIZATION_CREATE, FUNCTION_START),
94 kSecTraceAuthorizationCreateEnd =
95 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_AUTHORIZATION, CODE_CLASS_AUTHORIZATION_CREATE, FUNCTION_END),
96 kSecTraceAuthorizationCopyRightsStart =
97 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_AUTHORIZATION, CODE_CLASS_AUTHORIZATION_COPY_RIGHTS, FUNCTION_START),
98 kSecTraceAuthorizationCopyRightsEnd =
99 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_AUTHORIZATION, CODE_CLASS_AUTHORIZATION_COPY_RIGHTS, FUNCTION_END),
100 kSecTraceAuthorizationCopyInfoStart =
101 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_AUTHORIZATION, CODE_CLASS_AUTHORIZATION_COPY_INFO, FUNCTION_START),
102 kSecTraceAuthorizationCopyInfoEnd =
103 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_AUTHORIZATION, CODE_CLASS_AUTHORIZATION_COPY_INFO, FUNCTION_END),
104
105 kSecTraceSecurityServerStart =
106 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_SECURITY_SERVER, CODE_CLASS_SECURITY_SERVER_INITIALIZE, FUNCTION_START),
107 kSecTraceSecurityServerInitialized =
108 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_SECURITY_SERVER, CODE_CLASS_SECURITY_SERVER_INITIALIZE, FUNCTION_END),
109
110 kSecTraceSecurityFrameworkSecKeychainFindGenericPasswordBegin =
111 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_ADHOC, CODE_CLASS_ADHOC_FINDGENERICPASSWORD_BEGIN, FUNCTION_TIMEPOINT),
112 kSecTraceUCSPClientDecryptBegin =
113 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_ADHOC, CODE_CLASS_ADHOC_UCSP_CLIENT_BEGIN, FUNCTION_TIMEPOINT),
114 kSecTraceUCSPServerDecryptBegin =
115 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_ADHOC, CODE_CLASS_ADHOC_UCSP_SERVER_DECRYPT_BEGIN, FUNCTION_TIMEPOINT),
116 kSecTraceSecurityServerQueryKeychainAccess =
117 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_ADHOC, CODE_CLASS_ADHOC_UCSP_QUERYKEYCHAINACCESS_BEGIN, FUNCTION_TIMEPOINT)
118 };
119
120 #endif /* _KTRACE_CODES_H_ */