static void _HeimCredInit(void) { static dispatch_once_t once; dispatch_once(&once, ^{ _HeimCredInitCommon(); HeimCredCTX.conn = xpc_connection_create("com.apple.GSSCred", HeimCredCTX.queue); xpc_connection_set_event_handler(HeimCredCTX.conn, ^(xpc_object_t object){ HeimItemNotify(object); });
static OSStatus sendTSARequestWithXPC(const unsigned char *tsaReq, size_t tsaReqLength, const unsigned char *tsaURL, unsigned char **tsaResp, size_t *tsaRespLength) { __block OSStatus result = noErr; int timeoutInSeconds = 15; extern xpc_object_t xpc_create_with_format(const char * format, ...); dispatch_queue_t xpc_queue = dispatch_queue_create("com.apple.security.XPCTimeStampingService", DISPATCH_QUEUE_SERIAL); __block dispatch_semaphore_t waitSemaphore = dispatch_semaphore_create(0); dispatch_time_t finishTime = dispatch_time(DISPATCH_TIME_NOW, timeoutInSeconds * NSEC_PER_SEC); xpc_connection_t con = xpc_connection_create("com.apple.security.XPCTimeStampingService", xpc_queue); xpc_connection_set_event_handler(con, ^(xpc_object_t event) { xpc_type_t xtype = xpc_get_type(event); if (XPC_TYPE_ERROR == xtype) { tsaDebug("default: connection error: %s\n", xpc_dictionary_get_string(event, XPC_ERROR_KEY_DESCRIPTION)); } else { tsaDebug("default: unexpected connection event %p\n", event); } });