]> git.saurik.com Git - apple/security.git/blob - keychain/escrowrequest/EscrowRequestXPCProtocol.m
Security-59306.101.1.tar.gz
[apple/security.git] / keychain / escrowrequest / EscrowRequestXPCProtocol.m
1
2 #import <Foundation/Foundation.h>
3 #import <objc/runtime.h>
4
5 #import "keychain/escrowrequest/EscrowRequestXPCProtocol.h"
6 #import "utilities/debugging.h"
7
8 NSXPCInterface* SecEscrowRequestSetupControlProtocol(NSXPCInterface* interface) {
9 static NSMutableSet *errClasses;
10
11 static dispatch_once_t onceToken;
12
13 dispatch_once(&onceToken, ^{
14 errClasses = [NSMutableSet set];
15 char *classes[] = {
16 "NSArray",
17 "NSData",
18 "NSDate",
19 "NSDictionary",
20 "NSError",
21 "NSNull",
22 "NSNumber",
23 "NSOrderedSet",
24 "NSSet",
25 "NSString",
26 "NSURL",
27 };
28
29 for (unsigned n = 0; n < sizeof(classes)/sizeof(classes[0]); n++) {
30 Class cls = objc_getClass(classes[n]);
31 if (cls) {
32 [errClasses addObject:cls];
33 }
34 }
35 });
36
37 @try {
38 [interface setClasses:errClasses forSelector:@selector(triggerEscrowUpdate:reply:) argumentIndex:0 ofReply:YES];
39 [interface setClasses:errClasses forSelector:@selector(cachePrerecord:serializedPrerecord:reply:) argumentIndex:0 ofReply:YES];
40 [interface setClasses:errClasses forSelector:@selector(fetchPrerecord:reply:) argumentIndex:1 ofReply:YES];
41 [interface setClasses:errClasses forSelector:@selector(fetchRequestWaitingOnPasscode:) argumentIndex:1 ofReply:YES];
42
43 }
44 @catch(NSException* e) {
45 secerror("SecEscrowRequestSetupControlProtocol failed, continuing, but you might crash later: %@", e);
46 #if DEBUG
47 @throw e;
48 #endif
49 }
50
51 return interface;
52 }
53