3 * Copyright (c) 2017 Apple Inc. All Rights Reserved.
5 * @APPLE_LICENSE_HEADER_START@
7 * This file contains Original Code and/or Modifications of Original Code
8 * as defined in and that are subject to the Apple Public Source License
9 * Version 2.0 (the 'License'). You may not use this file except in
10 * compliance with the License. Please obtain a copy of the License at
11 * http://www.opensource.apple.com/apsl/ and read it before using this
14 * The Original Code and all software distributed under the License are
15 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
19 * Please see the License for the specific language governing rights and
20 * limitations under the License.
22 * @APPLE_LICENSE_HEADER_END@
25 #ifndef _SECSIGNPOST_H_
26 #define _SECSIGNPOST_H_
29 #include <CoreFoundation/CoreFoundation.h>
31 #if !TARGET_IPHONE_SIMULATOR
32 #import <System/sys/kdebug.h>
36 If you update this file, please also update SecurityCustomSignposts.plist.
39 static unsigned int SecSignpostComponent
= 82;
41 typedef CF_ENUM(unsigned int, SecSignpostType
) {
42 /* between 0 and SecSignpostImpulse, use every even number
43 * After SecSignpostImpulse, its free for all for custom impulse points
44 * Remeber to update SecurityCustomSignposts.plist
46 SecSignpostRestoreKeychain
= 0,
47 SecSignpostRestoreOpenKeybag
= 2,
48 SecSignpostUnlockKeybag
= 4,
49 SecSignpostBackupKeychain
= 6,
50 SecSignpostBackupOpenKeybag
= 8,
51 SecSignpostUpgradePhase1
= 10,
52 SecSignpostUpgradePhase2
= 12,
53 SecSignpostBackupKeychainBackupable
= 14,
54 SecSignpostRestoreKeychainBackupable
= 16,
56 SecSignpostSecItemAdd
= 18,
57 SecSignpostSecItemUpdate
= 20,
58 SecSignpostSecItemDelete
= 22,
59 SecSignpostSecItemCopyMatching
= 24,
62 SecSignpostImpulse
= 0x1000,
63 SecSignpostImpulseBackupClassCount
= 0x1001,
64 SecSignpostImpulseRestoreClassCount
= 0x1002,
68 static inline void SecSignpostStart(SecSignpostType type
) {
69 #if !TARGET_IPHONE_SIMULATOR
70 kdebug_trace(ARIADNEDBG_CODE(SecSignpostComponent
, type
+ 0), 0, 0, 0, 0);
74 static inline void SecSignpostStop(SecSignpostType type
) {
75 #if !TARGET_IPHONE_SIMULATOR
76 kdebug_trace(ARIADNEDBG_CODE(SecSignpostComponent
, type
+ 1), 0, 0, 0, 0);
80 static inline void SecSignpostBackupCount(SecSignpostType type
,
84 #if !TARGET_IPHONE_SIMULATOR
85 if (CFStringGetLength(cls
) != 4)
87 unsigned char ucls
[5];
88 if (!CFStringGetCString(cls
, (char *)ucls
, sizeof(ucls
), kCFStringEncodingUTF8
))
90 uint32_t c
= (ucls
[0] & 0xff) | (ucls
[1] << 8) | (ucls
[2] << 16) | (ucls
[3] << 24);
91 kdebug_trace(ARIADNEDBG_CODE(SecSignpostComponent
, type
), c
, count
, filter
, 0);
96 #endif /* _SECSIGNPOST_H_ */