2 * Copyright (c) 2002-2008, 2010-2015, 2017, 2018 Apple Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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
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.
21 * @APPLE_LICENSE_HEADER_END@
25 #ifndef _DY_FRAMEWORK_H
26 #define _DY_FRAMEWORK_H
28 #include <os/availability.h>
29 #include <TargetConditionals.h>
30 #include <sys/cdefs.h>
31 #include <mach/mach.h>
32 #include <CoreFoundation/CoreFoundation.h>
33 #include <IOKit/IOKitLib.h>
35 #include <IOKit/pwr_mgt/IOPMLibPrivate.h>
36 #endif // !TARGET_OS_IPHONE
37 #include <Security/Security.h>
38 #include <Security/SecCertificatePriv.h>
39 #include <Security/SecItem.h> // only needed for Mac OS X 10.6[.x]
45 #pragma mark IOKit.framework APIs
47 CFMutableDictionaryRef
49 mach_port_t masterPort
,
53 #define IOBSDNameMatching _IOBSDNameMatching
57 io_iterator_t iterator
59 #define IOIteratorNext _IOIteratorNext
63 mach_port_t bootstrapPort
,
64 mach_port_t
*masterPort
66 #define IOMasterPort _IOMasterPort
71 const io_name_t className
73 #define IOObjectConformsTo _IOObjectConformsTo
80 #define IOObjectGetClass _IOObjectGetClass
86 #define IOObjectRelease _IOObjectRelease
91 _IOPMConnectionAcknowledgeEvent (
92 IOPMConnection myConnection
,
93 IOPMConnectionMessageToken token
95 #define IOPMConnectionAcknowledgeEvent _IOPMConnectionAcknowledgeEvent
98 _IOPMConnectionCreate (
100 IOPMCapabilityBits interests
,
101 IOPMConnection
*newConnection
103 #define IOPMConnectionCreate _IOPMConnectionCreate
106 _IOPMConnectionGetSystemCapabilities (void);
107 #define IOPMConnectionGetSystemCapabilities _IOPMConnectionGetSystemCapabilities
110 _IOPMConnectionRelease (
111 IOPMConnection myConnection
113 #define IOPMConnectionRelease _IOPMConnectionRelease
116 _IOPMConnectionSetDispatchQueue (
117 IOPMConnection myConnection
,
118 dispatch_queue_t myQueue
120 #define IOPMConnectionSetDispatchQueue _IOPMConnectionSetDispatchQueue
123 _IOPMConnectionSetNotification (
124 IOPMConnection myConnection
,
126 IOPMEventHandlerType handler
128 #define IOPMConnectionSetNotification _IOPMConnectionSetNotification
130 #endif // !TARGET_OS_IPHONE
133 _IORegistryEntryCreateCFProperty (
134 io_registry_entry_t entry
,
136 CFAllocatorRef allocator
,
139 #define IORegistryEntryCreateCFProperty _IORegistryEntryCreateCFProperty
142 _IORegistryEntryCreateCFProperties (
143 io_registry_entry_t entry
,
144 CFMutableDictionaryRef
*properties
,
145 CFAllocatorRef allocator
,
148 #define IORegistryEntryCreateCFProperties _IORegistryEntryCreateCFProperties
151 _IORegistryEntryCreateIterator (
152 io_registry_entry_t entry
,
153 const io_name_t plane
,
154 IOOptionBits options
,
155 io_iterator_t
*iterator
157 #define IORegistryEntryCreateIterator _IORegistryEntryCreateIterator
160 _IORegistryEntryGetLocationInPlane (
161 io_registry_entry_t entry
,
162 const io_name_t plane
,
165 #define IORegistryEntryGetLocationInPlane _IORegistryEntryGetLocationInPlane
168 _IORegistryEntryGetName (
169 io_registry_entry_t entry
,
172 #define IORegistryEntryGetName _IORegistryEntryGetName
175 _IORegistryEntryGetNameInPlane (
176 io_registry_entry_t entry
,
177 const io_name_t plane
,
180 #define IORegistryEntryGetNameInPlane _IORegistryEntryGetNameInPlane
183 _IORegistryEntryGetParentEntry (
184 io_registry_entry_t entry
,
185 const io_name_t plane
,
186 io_registry_entry_t
*parent
188 #define IORegistryEntryGetParentEntry _IORegistryEntryGetParentEntry
191 _IORegistryEntryGetPath (
192 io_registry_entry_t entry
,
193 const io_name_t plane
,
196 #define IORegistryEntryGetPath _IORegistryEntryGetPath
199 _IORegistryEntryGetRegistryEntryID (
200 io_registry_entry_t entry
,
203 #define IORegistryEntryGetRegistryEntryID _IORegistryEntryGetRegistryEntryID
206 _IORegistryEntrySearchCFProperty (
207 io_registry_entry_t entry
,
208 const io_name_t plane
,
210 CFAllocatorRef allocator
,
212 ) CF_RETURNS_RETAINED
;
213 #define IORegistryEntrySearchCFProperty _IORegistryEntrySearchCFProperty
216 _IOServiceGetMatchingServices (
217 mach_port_t masterPort
,
218 CFDictionaryRef matching
,
219 io_iterator_t
*existing
221 #define IOServiceGetMatchingServices _IOServiceGetMatchingServices
223 CFMutableDictionaryRef
227 #define IOServiceMatching _IOServiceMatching
230 #pragma mark Security.framework APIs
232 #if !TARGET_OS_IPHONE
234 CFTypeRef
_kSecAttrService(void);
235 #define kSecAttrService _kSecAttrService()
237 CFTypeRef
_kSecClass(void);
238 #define kSecClass _kSecClass()
240 CFTypeRef
_kSecClassGenericPassword(void);
241 #define kSecClassGenericPassword _kSecClassGenericPassword()
243 CFTypeRef
_kSecMatchLimit(void);
244 #define kSecMatchLimit _kSecMatchLimit()
246 CFTypeRef
_kSecMatchLimitAll(void);
247 #define kSecMatchLimitAll _kSecMatchLimitAll()
249 CFTypeRef
_kSecMatchSearchList(void);
250 #define kSecMatchSearchList _kSecMatchSearchList()
252 CFTypeRef
_kSecReturnRef(void);
253 #define kSecReturnRef _kSecReturnRef()
255 CFTypeRef
_kSecGuestAttributePid(void);
256 #define kSecGuestAttributePid _kSecGuestAttributePid()
258 CFTypeRef
_kSecCodeInfoIdentifier(void);
259 #define kSecCodeInfoIdentifier _kSecCodeInfoIdentifier()
261 CFTypeRef
_kSecCodeInfoUnique(void);
262 #define kSecCodeInfoUnique _kSecCodeInfoUnique()
265 _AuthorizationMakeExternalForm (
266 AuthorizationRef authorization
,
267 AuthorizationExternalForm
*extForm
269 #define AuthorizationMakeExternalForm _AuthorizationMakeExternalForm
273 CFStringRef descriptor
,
274 CFArrayRef trustedlist
,
275 SecAccessRef
*accessRef
277 #define SecAccessCreate _SecAccessCreate
279 #if (__MAC_OS_X_VERSION_MIN_REQUIRED < 1070)
281 _SecAccessCreateFromOwnerAndACL (
282 const CSSM_ACL_OWNER_PROTOTYPE
*owner
,
284 const CSSM_ACL_ENTRY_INFO
*acls
,
285 SecAccessRef
*accessRef
287 #define SecAccessCreateFromOwnerAndACL _SecAccessCreateFromOwnerAndACL
288 #else // (__MAC_OS_X_VERSION_MIN_REQUIRED < 1070)
290 _SecAccessCreateWithOwnerAndACL (
293 SecAccessOwnerType ownerType
,
297 #define SecAccessCreateWithOwnerAndACL _SecAccessCreateWithOwnerAndACL
298 #endif // (__MAC_OS_X_VERSION_MIN_REQUIRED < 1070)
301 _SecItemCopyMatching (
302 CFDictionaryRef query
,
305 #define SecItemCopyMatching _SecItemCopyMatching
308 _SecKeychainCopyDomainDefault (
309 SecPreferencesDomain domain
,
310 SecKeychainRef
*keychain
312 #define SecKeychainCopyDomainDefault _SecKeychainCopyDomainDefault
316 const char *pathName
,
317 SecKeychainRef
*keychain
319 #define SecKeychainOpen _SecKeychainOpen
322 _SecKeychainSetDomainDefault (
323 SecPreferencesDomain domain
,
324 SecKeychainRef keychain
326 #define SecKeychainSetDomainDefault _SecKeychainSetDomainDefault
329 _SecKeychainItemCopyContent (
330 SecKeychainItemRef itemRef
,
331 SecItemClass
*itemClass
,
332 SecKeychainAttributeList
*attrList
,
336 #define SecKeychainItemCopyContent _SecKeychainItemCopyContent
339 _SecKeychainItemCreateFromContent (
340 SecItemClass itemClass
,
341 SecKeychainAttributeList
*attrList
,
344 SecKeychainRef keychainRef
,
345 SecAccessRef initialAccess
,
346 SecKeychainItemRef
*itemRef
348 #define SecKeychainItemCreateFromContent _SecKeychainItemCreateFromContent
351 _SecKeychainItemDelete (
352 SecKeychainItemRef itemRef
354 #define SecKeychainItemDelete _SecKeychainItemDelete
357 _SecKeychainItemFreeContent (
358 SecKeychainAttributeList
*attrList
,
361 #define SecKeychainItemFreeContent _SecKeychainItemFreeContent
364 _SecKeychainItemModifyContent (
365 SecKeychainItemRef itemRef
,
366 const SecKeychainAttributeList
*attrList
,
370 #define SecKeychainItemModifyContent _SecKeychainItemModifyContent
374 _SecTrustedApplicationCreateFromPath (
376 SecTrustedApplicationRef
*app
378 #define SecTrustedApplicationCreateFromPath _SecTrustedApplicationCreateFromPath
380 #else // TARGET_OS_IPHONE
382 CFStringRef
_kSecPropertyKeyValue(void);
383 #define kSecPropertyKeyValue _kSecPropertyKeyValue()
385 CFStringRef
_kSecPropertyKeyLabel(void);
386 #define kSecPropertyKeyLabel _kSecPropertyKeyLabel()
389 _SecCertificateCopyProperties (
390 SecCertificateRef certRef
392 #define SecCertificateCopyProperties _SecCertificateCopyProperties
394 #endif // TARGET_OS_IPHONE
397 _SecCertificateCreateWithData (
398 CFAllocatorRef allocator
,
401 #define SecCertificateCreateWithData _SecCertificateCreateWithData
409 #endif // _DY_FRAMEWORK_H