]> git.saurik.com Git - apple/configd.git/blob - SystemConfiguration.fproj/dy_framework.c
e2c1089786dc6e73cf0bf4e2f882dc6e0e4d712f
[apple/configd.git] / SystemConfiguration.fproj / dy_framework.c
1 /*
2 * Copyright (c) 2002-2008, 2010-2013 Apple 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 * Modification History
26 *
27 * October 31, 2000 Allan Nathanson <ajn@apple.com>
28 * - initial revision
29 */
30
31
32 #include <sys/types.h>
33 #include <sys/param.h>
34 #include <sys/stat.h>
35 #include <dlfcn.h>
36
37 #include "dy_framework.h"
38
39
40 #pragma mark -
41 #pragma mark IOKit.framework APIs
42
43 static void *
44 __loadIOKit(void) {
45 static void *image = NULL;
46 if (NULL == image) {
47 const char *framework = "/System/Library/Frameworks/IOKit.framework/IOKit";
48 struct stat statbuf;
49 const char *suffix = getenv("DYLD_IMAGE_SUFFIX");
50 char path[MAXPATHLEN];
51
52 strlcpy(path, framework, sizeof(path));
53 if (suffix) strlcat(path, suffix, sizeof(path));
54 if (0 <= stat(path, &statbuf)) {
55 image = dlopen(path, RTLD_LAZY | RTLD_LOCAL);
56 } else {
57 image = dlopen(framework, RTLD_LAZY | RTLD_LOCAL);
58 }
59 }
60 return (void *)image;
61 }
62
63
64 __private_extern__ CFMutableDictionaryRef
65 _IOBSDNameMatching(mach_port_t masterPort, uint32_t options, const char *bsdName)
66 {
67 #undef IOBSDNameMatching
68 static typeof (IOBSDNameMatching) *dyfunc = NULL;
69 if (!dyfunc) {
70 void *image = __loadIOKit();
71 if (image) dyfunc = dlsym(image, "IOBSDNameMatching");
72 }
73 return dyfunc ? dyfunc(masterPort, options, bsdName) : NULL;
74 }
75
76
77 __private_extern__ io_object_t
78 _IOIteratorNext(io_iterator_t iterator)
79 {
80 #undef IOIteratorNext
81 static typeof (IOIteratorNext) *dyfunc = NULL;
82 if (!dyfunc) {
83 void *image = __loadIOKit();
84 if (image) dyfunc = dlsym(image, "IOIteratorNext");
85 }
86 return dyfunc ? dyfunc(iterator) : 0;
87 }
88
89
90 __private_extern__ kern_return_t
91 _IOMasterPort(mach_port_t bootstrapPort, mach_port_t *masterPort)
92 {
93 #undef IOMasterPort
94 static typeof (IOMasterPort) *dyfunc = NULL;
95 if (!dyfunc) {
96 void *image = __loadIOKit();
97 if (image) dyfunc = dlsym(image, "IOMasterPort");
98 }
99 return dyfunc ? dyfunc(bootstrapPort, masterPort) : KERN_FAILURE;
100 }
101
102
103 __private_extern__ boolean_t
104 _IOObjectConformsTo(io_object_t object, const io_name_t className)
105 {
106 #undef IOObjectConformsTo
107 static typeof (IOObjectConformsTo) *dyfunc = NULL;
108 if (!dyfunc) {
109 void *image = __loadIOKit();
110 if (image) dyfunc = dlsym(image, "IOObjectConformsTo");
111 }
112 return dyfunc ? dyfunc(object, className) : FALSE;
113 }
114
115
116 __private_extern__ boolean_t
117 _IOObjectGetClass(io_object_t object, io_name_t className)
118 {
119 #undef IOObjectGetClass
120 static typeof (IOObjectGetClass) *dyfunc = NULL;
121 if (!dyfunc) {
122 void *image = __loadIOKit();
123 if (image) dyfunc = dlsym(image, "IOObjectGetClass");
124 }
125 return dyfunc ? dyfunc(object, className) : FALSE;
126 }
127
128
129 __private_extern__ kern_return_t
130 _IOObjectRelease(io_object_t object)
131 {
132 #undef IOObjectRelease
133 static typeof (IOObjectRelease) *dyfunc = NULL;
134 if (!dyfunc) {
135 void *image = __loadIOKit();
136 if (image) dyfunc = dlsym(image, "IOObjectRelease");
137 }
138 return dyfunc ? dyfunc(object) : KERN_FAILURE;
139 }
140
141
142 __private_extern__ CFTypeRef
143 _IORegistryEntryCreateCFProperty(io_registry_entry_t entry, CFStringRef key, CFAllocatorRef allocator, IOOptionBits options)
144 {
145 #undef IORegistryEntryCreateCFProperty
146 static typeof (IORegistryEntryCreateCFProperty) *dyfunc = NULL;
147 if (!dyfunc) {
148 void *image = __loadIOKit();
149 if (image) dyfunc = dlsym(image, "IORegistryEntryCreateCFProperty");
150 }
151 return dyfunc ? dyfunc(entry, key, allocator, options) : NULL;
152 }
153
154
155 __private_extern__ kern_return_t
156 _IORegistryEntryCreateCFProperties(io_registry_entry_t entry, CFMutableDictionaryRef *properties, CFAllocatorRef allocator, IOOptionBits options)
157 {
158 #undef IORegistryEntryCreateCFProperties
159 static typeof (IORegistryEntryCreateCFProperties) *dyfunc = NULL;
160 if (!dyfunc) {
161 void *image = __loadIOKit();
162 if (image) dyfunc = dlsym(image, "IORegistryEntryCreateCFProperties");
163 }
164 return dyfunc ? dyfunc(entry, properties, allocator, options) : KERN_FAILURE;
165 }
166
167
168 __private_extern__ kern_return_t
169 _IORegistryEntryCreateIterator(mach_port_t masterPort, const io_name_t plane, IOOptionBits options, io_iterator_t *iterator)
170 {
171 #undef IORegistryEntryCreateIterator
172 static typeof (IORegistryEntryCreateIterator) *dyfunc = NULL;
173 if (!dyfunc) {
174 void *image = __loadIOKit();
175 if (image) dyfunc = dlsym(image, "IORegistryEntryCreateIterator");
176 }
177 return dyfunc ? dyfunc(masterPort, plane, options, iterator) : KERN_FAILURE;
178 }
179
180
181 __private_extern__ kern_return_t
182 _IORegistryEntryGetLocationInPlane(io_registry_entry_t entry, const io_name_t plane, io_name_t location)
183 {
184 #undef IORegistryEntryGetLocationInPlane
185 static typeof (IORegistryEntryGetLocationInPlane) *dyfunc = NULL;
186 if (!dyfunc) {
187 void *image = __loadIOKit();
188 if (image) dyfunc = dlsym(image, "IORegistryEntryGetLocationInPlane");
189 }
190 return dyfunc ? dyfunc(entry, plane, location) : KERN_FAILURE;
191 }
192
193
194 __private_extern__ kern_return_t
195 _IORegistryEntryGetName(io_registry_entry_t entry, io_name_t name)
196 {
197 #undef IORegistryEntryGetName
198 static typeof (IORegistryEntryGetName) *dyfunc = NULL;
199 if (!dyfunc) {
200 void *image = __loadIOKit();
201 if (image) dyfunc = dlsym(image, "IORegistryEntryGetName");
202 }
203 return dyfunc ? dyfunc(entry, name) : KERN_FAILURE;
204 }
205
206
207 __private_extern__ kern_return_t
208 _IORegistryEntryGetNameInPlane(io_registry_entry_t entry, const io_name_t plane, io_name_t name)
209 {
210 #undef IORegistryEntryGetNameInPlane
211 static typeof (IORegistryEntryGetNameInPlane) *dyfunc = NULL;
212 if (!dyfunc) {
213 void *image = __loadIOKit();
214 if (image) dyfunc = dlsym(image, "IORegistryEntryGetNameInPlane");
215 }
216 return dyfunc ? dyfunc(entry, plane, name) : KERN_FAILURE;
217 }
218
219
220 __private_extern__ kern_return_t
221 _IORegistryEntryGetParentEntry(io_registry_entry_t entry, const io_name_t plane, io_registry_entry_t *parent)
222 {
223 #undef IORegistryEntryGetParentEntry
224 static typeof (IORegistryEntryGetParentEntry) *dyfunc = NULL;
225 if (!dyfunc) {
226 void *image = __loadIOKit();
227 if (image) dyfunc = dlsym(image, "IORegistryEntryGetParentEntry");
228 }
229 return dyfunc ? dyfunc(entry, plane, parent) : KERN_FAILURE;
230 }
231
232
233 __private_extern__ kern_return_t
234 _IORegistryEntryGetPath(io_registry_entry_t entry, const io_name_t plane, io_string_t path)
235 {
236 #undef IORegistryEntryGetPath
237 static typeof (IORegistryEntryGetPath) *dyfunc = NULL;
238 if (!dyfunc) {
239 void *image = __loadIOKit();
240 if (image) dyfunc = dlsym(image, "IORegistryEntryGetPath");
241 }
242 return dyfunc ? dyfunc(entry, plane, path) : KERN_FAILURE;
243 }
244
245
246 __private_extern__ kern_return_t
247 _IORegistryEntryGetRegistryEntryID(io_registry_entry_t entry, uint64_t *entryID)
248 {
249 #undef IORegistryEntryGetRegistryEntryID
250 static typeof (IORegistryEntryGetRegistryEntryID) *dyfunc = NULL;
251 if (!dyfunc) {
252 void *image = __loadIOKit();
253 if (image) dyfunc = dlsym(image, "IORegistryEntryGetRegistryEntryID");
254 }
255 return dyfunc ? dyfunc(entry, entryID) : KERN_FAILURE;
256 }
257
258
259 __private_extern__ CFTypeRef
260 _IORegistryEntrySearchCFProperty(io_registry_entry_t entry, const io_name_t plane, CFStringRef key, CFAllocatorRef allocator, IOOptionBits options)
261 {
262 #undef IORegistryEntrySearchCFProperty
263 static typeof (IORegistryEntrySearchCFProperty) *dyfunc = NULL;
264 if (!dyfunc) {
265 void *image = __loadIOKit();
266 if (image) dyfunc = dlsym(image, "IORegistryEntrySearchCFProperty");
267 }
268 return dyfunc ? dyfunc(entry, plane, key, allocator, options) : NULL;
269 }
270
271
272 __private_extern__ kern_return_t
273 _IOServiceGetMatchingServices(mach_port_t masterPort, CFDictionaryRef matching, io_iterator_t *existing)
274 {
275 #undef IOServiceGetMatchingServices
276 static typeof (IOServiceGetMatchingServices) *dyfunc = NULL;
277 if (!dyfunc) {
278 void *image = __loadIOKit();
279 if (image) dyfunc = dlsym(image, "IOServiceGetMatchingServices");
280 }
281 return dyfunc ? dyfunc(masterPort, matching, existing) : KERN_FAILURE;
282 }
283
284
285 __private_extern__ CFMutableDictionaryRef
286 _IOServiceMatching(const char *name)
287 {
288 #undef IOServiceMatching
289 static typeof (IOServiceMatching) *dyfunc = NULL;
290 if (!dyfunc) {
291 void *image = __loadIOKit();
292 if (image) dyfunc = dlsym(image, "IOServiceMatching");
293 }
294 return dyfunc ? dyfunc(name) : NULL;
295 }
296
297 #pragma mark -
298 #pragma mark Security.framework APIs
299
300 static void *
301 __loadSecurity(void) {
302 static void *image = NULL;
303 if (NULL == image) {
304 const char *framework = "/System/Library/Frameworks/Security.framework/Security";
305 struct stat statbuf;
306 const char *suffix = getenv("DYLD_IMAGE_SUFFIX");
307 char path[MAXPATHLEN];
308
309 strlcpy(path, framework, sizeof(path));
310 if (suffix) strlcat(path, suffix, sizeof(path));
311 if (0 <= stat(path, &statbuf)) {
312 image = dlopen(path, RTLD_LAZY | RTLD_LOCAL);
313 } else {
314 image = dlopen(framework, RTLD_LAZY | RTLD_LOCAL);
315 }
316 }
317 return (void *)image;
318 }
319
320 #define SECURITY_FRAMEWORK_EXTERN(t, s) \
321 __private_extern__ t \
322 _ ## s() \
323 { \
324 static t *dysym = NULL; \
325 if (!dysym) { \
326 void *image = __loadSecurity(); \
327 if (image) dysym = dlsym(image, #s ); \
328 } \
329 return (dysym != NULL) ? *dysym : NULL; \
330 }
331
332 #if !TARGET_OS_IPHONE
333 SECURITY_FRAMEWORK_EXTERN(CFTypeRef, kSecAttrService)
334 SECURITY_FRAMEWORK_EXTERN(CFTypeRef, kSecClass)
335 SECURITY_FRAMEWORK_EXTERN(CFTypeRef, kSecClassGenericPassword)
336 SECURITY_FRAMEWORK_EXTERN(CFTypeRef, kSecMatchLimit)
337 SECURITY_FRAMEWORK_EXTERN(CFTypeRef, kSecMatchLimitAll)
338 SECURITY_FRAMEWORK_EXTERN(CFTypeRef, kSecMatchSearchList)
339 SECURITY_FRAMEWORK_EXTERN(CFTypeRef, kSecReturnRef)
340 SECURITY_FRAMEWORK_EXTERN(CFTypeRef, kSecGuestAttributePid)
341 SECURITY_FRAMEWORK_EXTERN(CFTypeRef, kSecCodeInfoIdentifier)
342 SECURITY_FRAMEWORK_EXTERN(CFTypeRef, kSecCodeInfoUnique)
343
344 __private_extern__ OSStatus
345 _AuthorizationMakeExternalForm(AuthorizationRef authorization, AuthorizationExternalForm *extForm)
346 {
347 #undef AuthorizationMakeExternalForm
348 static typeof (AuthorizationMakeExternalForm) *dyfunc = NULL;
349 if (!dyfunc) {
350 void *image = __loadSecurity();
351 if (image) dyfunc = dlsym(image, "AuthorizationMakeExternalForm");
352 }
353 return dyfunc ? dyfunc(authorization, extForm) : -1;
354 }
355
356 __private_extern__ OSStatus
357 _SecAccessCreate(CFStringRef descriptor, CFArrayRef trustedlist, SecAccessRef *accessRef)
358 {
359 #undef SecAccessCreate
360 static typeof (SecAccessCreate) *dyfunc = NULL;
361 if (!dyfunc) {
362 void *image = __loadSecurity();
363 if (image) dyfunc = dlsym(image, "SecAccessCreate");
364 }
365 return dyfunc ? dyfunc(descriptor, trustedlist, accessRef) : -1;
366 }
367
368 #if (__MAC_OS_X_VERSION_MIN_REQUIRED < 1070)
369 __private_extern__ OSStatus
370 _SecAccessCreateFromOwnerAndACL(const CSSM_ACL_OWNER_PROTOTYPE *owner, uint32 aclCount, const CSSM_ACL_ENTRY_INFO *acls, SecAccessRef *accessRef)
371 {
372 #undef SecAccessCreateFromOwnerAndACL
373 static typeof (SecAccessCreateFromOwnerAndACL) *dyfunc = NULL;
374 if (!dyfunc) {
375 void *image = __loadSecurity();
376 if (image) dyfunc = dlsym(image, "SecAccessCreateFromOwnerAndACL");
377 }
378 return dyfunc ? dyfunc(owner, aclCount, acls, accessRef) : -1;
379 }
380 #else // (__MAC_OS_X_VERSION_MIN_REQUIRED < 1070)
381 __private_extern__ SecAccessRef
382 _SecAccessCreateWithOwnerAndACL(uid_t userId, gid_t groupId, SecAccessOwnerType ownerType, CFArrayRef acls, CFErrorRef *error)
383 {
384 #undef SecAccessCreateWithOwnerAndACL
385 static typeof (SecAccessCreateWithOwnerAndACL) *dyfunc = NULL;
386 if (!dyfunc) {
387 void *image = __loadSecurity();
388 if (image) dyfunc = dlsym(image, "SecAccessCreateWithOwnerAndACL");
389 }
390 return dyfunc ? dyfunc(userId, groupId, ownerType, acls, error) : NULL;
391 }
392 #endif // (__MAC_OS_X_VERSION_MIN_REQUIRED < 1070)
393
394 __private_extern__ OSStatus
395 _SecItemCopyMatching(CFDictionaryRef query, CFTypeRef *result)
396 {
397 #undef SecItemCopyMatching
398 static typeof (SecItemCopyMatching) *dyfunc = NULL;
399 if (!dyfunc) {
400 void *image = __loadSecurity();
401 if (image) dyfunc = dlsym(image, "SecItemCopyMatching");
402 }
403 return dyfunc ? dyfunc(query, result) : -1;
404 }
405
406 __private_extern__ OSStatus
407 _SecKeychainCopyDomainDefault(SecPreferencesDomain domain, SecKeychainRef *keychain)
408 {
409 #undef SecKeychainCopyDomainDefault
410 static typeof (SecKeychainCopyDomainDefault) *dyfunc = NULL;
411 if (!dyfunc) {
412 void *image = __loadSecurity();
413 if (image) dyfunc = dlsym(image, "SecKeychainCopyDomainDefault");
414 }
415 return dyfunc ? dyfunc(domain, keychain) : -1;
416 }
417
418 __private_extern__ OSStatus
419 _SecKeychainGetPreferenceDomain(SecPreferencesDomain *domain)
420 {
421 #undef SecKeychainGetPreferenceDomain
422 static typeof (SecKeychainGetPreferenceDomain) *dyfunc = NULL;
423 if (!dyfunc) {
424 void *image = __loadSecurity();
425 if (image) dyfunc = dlsym(image, "SecKeychainGetPreferenceDomain");
426 }
427 return dyfunc ? dyfunc(domain) : -1;
428 }
429
430 __private_extern__ OSStatus
431 _SecKeychainOpen(const char *pathName, SecKeychainRef *keychain)
432 {
433 #undef SecKeychainOpen
434 static typeof (SecKeychainOpen) *dyfunc = NULL;
435 if (!dyfunc) {
436 void *image = __loadSecurity();
437 if (image) dyfunc = dlsym(image, "SecKeychainOpen");
438 }
439 return dyfunc ? dyfunc(pathName, keychain) : -1;
440 }
441
442 __private_extern__ OSStatus
443 _SecKeychainSetDomainDefault(SecPreferencesDomain domain, SecKeychainRef keychain)
444 {
445 #undef SecKeychainSetDomainDefault
446 static typeof (SecKeychainSetDomainDefault) *dyfunc = NULL;
447 if (!dyfunc) {
448 void *image = __loadSecurity();
449 if (image) dyfunc = dlsym(image, "SecKeychainSetDomainDefault");
450 }
451 return dyfunc ? dyfunc(domain, keychain) : -1;
452 }
453
454 __private_extern__ OSStatus
455 _SecKeychainSetPreferenceDomain(SecPreferencesDomain domain)
456 {
457 #undef SecKeychainSetPreferenceDomain
458 static typeof (SecKeychainSetPreferenceDomain) *dyfunc = NULL;
459 if (!dyfunc) {
460 void *image = __loadSecurity();
461 if (image) dyfunc = dlsym(image, "SecKeychainSetPreferenceDomain");
462 }
463 return dyfunc ? dyfunc(domain) : -1;
464 }
465
466 __private_extern__ OSStatus
467 _SecKeychainItemCopyContent(SecKeychainItemRef itemRef, SecItemClass *itemClass, SecKeychainAttributeList *attrList, UInt32 *length, void **outData)
468 {
469 #undef SecKeychainItemCopyContent
470 static typeof (SecKeychainItemCopyContent) *dyfunc = NULL;
471 if (!dyfunc) {
472 void *image = __loadSecurity();
473 if (image) dyfunc = dlsym(image, "SecKeychainItemCopyContent");
474 }
475 return dyfunc ? dyfunc(itemRef, itemClass, attrList, length, outData) : -1;
476 }
477
478 __private_extern__ OSStatus
479 _SecKeychainItemCreateFromContent(SecItemClass itemClass, SecKeychainAttributeList *attrList, UInt32 length, const void *data, SecKeychainRef keychainRef, SecAccessRef initialAccess, SecKeychainItemRef *itemRef)
480 {
481 #undef SecKeychainItemCreateFromContent
482 static typeof (SecKeychainItemCreateFromContent) *dyfunc = NULL;
483 if (!dyfunc) {
484 void *image = __loadSecurity();
485 if (image) dyfunc = dlsym(image, "SecKeychainItemCreateFromContent");
486 }
487 return dyfunc ? dyfunc(itemClass, attrList, length, data, keychainRef, initialAccess, itemRef) : -1;
488 }
489
490 __private_extern__ OSStatus
491 _SecKeychainItemDelete(SecKeychainItemRef itemRef)
492 {
493 #undef SecKeychainItemDelete
494 static typeof (SecKeychainItemDelete) *dyfunc = NULL;
495 if (!dyfunc) {
496 void *image = __loadSecurity();
497 if (image) dyfunc = dlsym(image, "SecKeychainItemDelete");
498 }
499 return dyfunc ? dyfunc(itemRef) : -1;
500 }
501
502 __private_extern__ OSStatus
503 _SecKeychainItemFreeContent(SecKeychainAttributeList *attrList, void *data)
504 {
505 #undef SecKeychainItemFreeContent
506 static typeof (SecKeychainItemFreeContent) *dyfunc = NULL;
507 if (!dyfunc) {
508 void *image = __loadSecurity();
509 if (image) dyfunc = dlsym(image, "SecKeychainItemFreeContent");
510 }
511 return dyfunc ? dyfunc(attrList, data) : -1;
512 }
513
514 __private_extern__ OSStatus
515 _SecKeychainItemModifyContent(SecKeychainItemRef itemRef, const SecKeychainAttributeList *attrList, UInt32 length, const void *data)
516 {
517 #undef SecKeychainItemModifyContent
518 static typeof (SecKeychainItemModifyContent) *dyfunc = NULL;
519 if (!dyfunc) {
520 void *image = __loadSecurity();
521 if (image) dyfunc = dlsym(image, "SecKeychainItemModifyContent");
522 }
523 return dyfunc ? dyfunc(itemRef, attrList, length, data) : -1;
524 }
525
526
527 __private_extern__ OSStatus
528 _SecTrustedApplicationCreateFromPath(const char *path, SecTrustedApplicationRef *app)
529 {
530 #undef SecTrustedApplicationCreateFromPath
531 static typeof (SecTrustedApplicationCreateFromPath) *dyfunc = NULL;
532 if (!dyfunc) {
533 void *image = __loadSecurity();
534 if (image) dyfunc = dlsym(image, "SecTrustedApplicationCreateFromPath");
535 }
536 return dyfunc ? dyfunc(path, app) : -1;
537 }
538
539 #else // TARGET_OS_IPHONE
540
541 SECURITY_FRAMEWORK_EXTERN(CFStringRef, kSecPropertyKeyValue)
542 SECURITY_FRAMEWORK_EXTERN(CFStringRef, kSecPropertyKeyLabel)
543
544 __private_extern__ CFArrayRef
545 _SecCertificateCopyProperties(SecCertificateRef certRef)
546 {
547 #undef SecCertificateCopyProperties
548 static typeof (SecCertificateCopyProperties) *dyfunc = NULL;
549 if (!dyfunc) {
550 void *image = __loadSecurity();
551 if (image) dyfunc = dlsym(image, "SecCertificateCopyProperties");
552 }
553 return dyfunc ? dyfunc(certRef) : NULL;
554 }
555
556 #endif // TARGET_OS_IPHONE
557
558 __private_extern__ SecCertificateRef
559 _SecCertificateCreateWithData(CFAllocatorRef allocator, CFDataRef data)
560 {
561 #undef SecCertificateCreateWithData
562 static typeof (SecCertificateCreateWithData) *dyfunc = NULL;
563 if (!dyfunc) {
564 void *image = __loadSecurity();
565 if (image) dyfunc = dlsym(image, "SecCertificateCreateWithData");
566 }
567 return dyfunc ? dyfunc(allocator, data) : NULL;
568 }
569
570