]> git.saurik.com Git - apple/security.git/blob - libsecurity_utilities/lib/ktracecodes.h
Security-55163.44.tar.gz
[apple/security.git] / libsecurity_utilities / lib / ktracecodes.h
1 /*
2 * Copyright (c) 2003-2004 Apple Computer, Inc. All Rights Reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24
25 #ifndef _KTRACE_CODES_H_
26 #define _KTRACE_CODES_H_
27
28 #include <security_utilities/debugging.h>
29 #include <sys/kdebug.h>
30
31 /*
32 we format as follows (not really done this way because bitfields are compiler dependent):
33
34 struct DebugCode
35 {
36 int DebugClass : 8;
37 int SubClass : 8;
38 int SecurityAppClass : 4;
39 int SecurityCodeClass : 10;
40 int FunctionQualifier : 2;
41 };
42 */
43
44 // Define the following as macros to keep objective c happy.
45
46 // define app class constants
47 #define APP_DEBUG_CLASS 0x40
48
49 // define the sub class for security
50 #define SECURITY_SUB_CLASS 0xAA
51
52 // define the app classes used by security
53 #define APP_CLASS_SFAUTHORIZATION 0
54 #define APP_CLASS_SECURITY_AGENT 1
55 #define APP_CLASS_AUTHORIZATION 2
56 #define APP_CLASS_SECURITY_SERVER 3
57 #define APP_CLASS_ADHOC 4
58
59 // define function qualifiers
60 #define FUNCTION_START DBG_FUNC_START
61 #define FUNCTION_END DBG_FUNC_END
62 #define FUNCTION_TIMEPOINT DBG_FUNC_NONE
63
64 // define SFAuthorization code class
65 #define CODE_CLASS_SFAUTHORIZATION_BUTTON_PRESSED 0
66 #define CODE_CLASS_SFAUTHORIZATION_AUTHORIZATION 1
67
68 // define SecurityAgent code class
69 #define CODE_CLASS_SECURITY_AGENT_START 0
70 #define CODE_CLASS_SECURITY_AGENT_STARTED_BY_SECURITY_SERVER 1
71 #define CODE_CLASS_SECURITY_AGENT_BEFORE_MECHANISM_INVOKE 2
72 #define CODE_CLASS_SECURITY_AGENT_CONFIRM_ACCESS 3
73
74 // define Authorization code classes
75 #define CODE_CLASS_AUTHORIZATION_CREATE 0
76 #define CODE_CLASS_AUTHORIZATION_COPY_RIGHTS 1
77 #define CODE_CLASS_AUTHORIZATION_COPY_INFO 2
78
79 // define SecurityServer code classes
80 #define CODE_CLASS_SECURITY_SERVER_INITIALIZE 0
81
82 // define adhoc code classes (may change by need)
83 #define CODE_CLASS_ADHOC_FINDGENERICPASSWORD_BEGIN 0
84 #define CODE_CLASS_ADHOC_UCSP_CLIENT_BEGIN 1
85 #define CODE_CLASS_ADHOC_UCSP_SERVER_DECRYPT_BEGIN 2
86 #define CODE_CLASS_ADHOC_UCSP_QUERYKEYCHAINACCESS_BEGIN 3
87
88 // define SecurityServer code classes
89 #define TRACECODE(_debugclass, _subclass, _appclass, _codeclass, _functionqualifier) \
90 ((_debugclass << 24) | (_subclass << 16) | (_appclass << 12) | (_codeclass << 2) | (_functionqualifier))
91
92 /*
93 * Trace code allocations.
94 */
95 enum {
96 kSecTraceSFAuthorizationButtonPressedStart =
97 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_SFAUTHORIZATION, CODE_CLASS_SFAUTHORIZATION_BUTTON_PRESSED, FUNCTION_START),
98 kSecTraceSFAuthorizationAuthorizationStart =
99 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_SFAUTHORIZATION, CODE_CLASS_SFAUTHORIZATION_AUTHORIZATION, FUNCTION_START),
100 kSecTraceSFAuthorizationAuthorizationEnd =
101 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_SFAUTHORIZATION, CODE_CLASS_SFAUTHORIZATION_AUTHORIZATION, FUNCTION_END),
102 kSecTraceSFAuthorizationButtonPressedEnd =
103 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_SFAUTHORIZATION, CODE_CLASS_SFAUTHORIZATION_BUTTON_PRESSED, FUNCTION_END),
104
105 kSecTraceSecurityAgentStart =
106 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_SECURITY_AGENT, CODE_CLASS_SECURITY_AGENT_START, FUNCTION_TIMEPOINT),
107 kSecTraceSecurityAgentStartedBySecurityServer =
108 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_SECURITY_AGENT, CODE_CLASS_SECURITY_AGENT_STARTED_BY_SECURITY_SERVER,
109 FUNCTION_TIMEPOINT),
110 kSecTraceSecurityAgentBeforeMechanismInvoke =
111 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_SECURITY_AGENT, CODE_CLASS_SECURITY_AGENT_BEFORE_MECHANISM_INVOKE,
112 FUNCTION_TIMEPOINT),
113 kSecTraceSecurityAgentConfimAccess =
114 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_SECURITY_AGENT, CODE_CLASS_SECURITY_AGENT_CONFIRM_ACCESS, FUNCTION_TIMEPOINT),
115
116 kSecTraceAuthorizationCreateStart =
117 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_AUTHORIZATION, CODE_CLASS_AUTHORIZATION_CREATE, FUNCTION_START),
118 kSecTraceAuthorizationCreateEnd =
119 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_AUTHORIZATION, CODE_CLASS_AUTHORIZATION_CREATE, FUNCTION_END),
120 kSecTraceAuthorizationCopyRightsStart =
121 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_AUTHORIZATION, CODE_CLASS_AUTHORIZATION_COPY_RIGHTS, FUNCTION_START),
122 kSecTraceAuthorizationCopyRightsEnd =
123 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_AUTHORIZATION, CODE_CLASS_AUTHORIZATION_COPY_RIGHTS, FUNCTION_END),
124 kSecTraceAuthorizationCopyInfoStart =
125 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_AUTHORIZATION, CODE_CLASS_AUTHORIZATION_COPY_INFO, FUNCTION_START),
126 kSecTraceAuthorizationCopyInfoEnd =
127 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_AUTHORIZATION, CODE_CLASS_AUTHORIZATION_COPY_INFO, FUNCTION_END),
128
129 kSecTraceSecurityServerStart =
130 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_SECURITY_SERVER, CODE_CLASS_SECURITY_SERVER_INITIALIZE, FUNCTION_START),
131 kSecTraceSecurityServerInitialized =
132 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_SECURITY_SERVER, CODE_CLASS_SECURITY_SERVER_INITIALIZE, FUNCTION_END),
133
134 kSecTraceSecurityFrameworkSecKeychainFindGenericPasswordBegin =
135 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_ADHOC, CODE_CLASS_ADHOC_FINDGENERICPASSWORD_BEGIN, FUNCTION_TIMEPOINT),
136 kSecTraceUCSPClientDecryptBegin =
137 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_ADHOC, CODE_CLASS_ADHOC_UCSP_CLIENT_BEGIN, FUNCTION_TIMEPOINT),
138 kSecTraceUCSPServerDecryptBegin =
139 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_ADHOC, CODE_CLASS_ADHOC_UCSP_SERVER_DECRYPT_BEGIN, FUNCTION_TIMEPOINT),
140 kSecTraceSecurityServerQueryKeychainAccess =
141 TRACECODE (APP_DEBUG_CLASS, SECURITY_SUB_CLASS, APP_CLASS_ADHOC, CODE_CLASS_ADHOC_UCSP_QUERYKEYCHAINACCESS_BEGIN, FUNCTION_TIMEPOINT)
142 };
143
144 #endif /* _KTRACE_CODES_H_ */