2 * Copyright (c) 2009-2010,2012-2014 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 #include <securityd/spi.h>
26 #include <ipc/securityd_client.h>
27 #include <securityd/SecPolicyServer.h>
28 #include <securityd/SecItemServer.h>
29 #include <securityd/SecTrustStoreServer.h>
30 #include <SecureObjectSync/SOSPeerInfo.h>
31 #include <CoreFoundation/CFString.h>
32 #include <CoreFoundation/CFError.h>
33 #include <securityd/SOSCloudCircleServer.h>
34 #include <securityd/SecOTRRemote.h>
35 #include <securityd/SecLogSettingsServer.h>
37 #include <CoreFoundation/CFXPCBridge.h>
38 #include "utilities/iOSforOSX.h"
39 #include "utilities/SecFileLocations.h"
40 #include "OTATrustUtilities.h"
42 static struct securityd spi
= {
43 .sec_item_add
= _SecItemAdd
,
44 .sec_item_copy_matching
= _SecItemCopyMatching
,
45 .sec_item_update
= _SecItemUpdate
,
46 .sec_item_delete
= _SecItemDelete
,
47 .sec_add_shared_web_credential
= _SecAddSharedWebCredential
,
48 .sec_copy_shared_web_credential
= _SecCopySharedWebCredential
,
49 .sec_trust_store_for_domain
= SecTrustStoreForDomainName
,
50 .sec_trust_store_contains
= SecTrustStoreContainsCertificateWithDigest
,
51 .sec_trust_store_set_trust_settings
= _SecTrustStoreSetTrustSettings
,
52 .sec_trust_store_remove_certificate
= SecTrustStoreRemoveCertificateWithDigest
,
53 .sec_truststore_remove_all
= _SecTrustStoreRemoveAll
,
54 .sec_item_delete_all
= _SecItemDeleteAll
,
55 .sec_trust_evaluate
= SecTrustServerEvaluate
,
56 .sec_keychain_backup
= _SecServerKeychainBackup
,
57 .sec_keychain_restore
= _SecServerKeychainRestore
,
58 .sec_keychain_sync_update_key_parameter
= _SecServerKeychainSyncUpdateKeyParameter
,
59 .sec_keychain_backup_syncable
= _SecServerBackupSyncable
,
60 .sec_keychain_restore_syncable
= _SecServerRestoreSyncable
,
61 .sec_otr_session_create_remote
= _SecOTRSessionCreateRemote
,
62 .sec_otr_session_process_packet_remote
= _SecOTRSessionProcessPacketRemote
,
63 .sec_ota_pki_asset_version
= SecOTAPKIGetCurrentAssetVersion
,
64 .soscc_TryUserCredentials
= SOSCCTryUserCredentials_Server
,
65 .soscc_SetUserCredentials
= SOSCCSetUserCredentials_Server
,
66 .soscc_CanAuthenticate
= SOSCCCanAuthenticate_Server
,
67 .soscc_PurgeUserCredentials
= SOSCCPurgeUserCredentials_Server
,
68 .soscc_ThisDeviceIsInCircle
= SOSCCThisDeviceIsInCircle_Server
,
69 .soscc_RequestToJoinCircle
= SOSCCRequestToJoinCircle_Server
,
70 .soscc_RequestToJoinCircleAfterRestore
= SOSCCRequestToJoinCircleAfterRestore_Server
,
71 .soscc_RequestEnsureFreshParameters
= SOSCCRequestEnsureFreshParameters_Server
,
72 .soscc_ResetToOffering
= SOSCCResetToOffering_Server
,
73 .soscc_ResetToEmpty
= SOSCCResetToEmpty_Server
,
74 .soscc_RemoveThisDeviceFromCircle
= SOSCCRemoveThisDeviceFromCircle_Server
,
75 .soscc_BailFromCircle
= SOSCCBailFromCircle_Server
,
76 .soscc_AcceptApplicants
= SOSCCAcceptApplicants_Server
,
77 .soscc_RejectApplicants
= SOSCCRejectApplicants_Server
,
78 .soscc_CopyApplicantPeerInfo
= SOSCCCopyApplicantPeerInfo_Server
,
79 .soscc_CopyGenerationPeerInfo
= SOSCCCopyGenerationPeerInfo_Server
,
80 .soscc_CopyValidPeerPeerInfo
= SOSCCCopyValidPeerPeerInfo_Server
,
81 .soscc_ValidateUserPublic
= SOSCCValidateUserPublic_Server
,
82 .soscc_CopyNotValidPeerPeerInfo
= SOSCCCopyNotValidPeerPeerInfo_Server
,
83 .soscc_CopyRetirementPeerInfo
= SOSCCCopyRetirementPeerInfo_Server
,
84 .soscc_CopyPeerInfo
= SOSCCCopyPeerPeerInfo_Server
,
85 .soscc_CopyConcurringPeerInfo
= SOSCCCopyConcurringPeerPeerInfo_Server
,
86 .ota_CopyEscrowCertificates
= SecOTAPKICopyCurrentEscrowCertificates
,
87 .sec_ota_pki_get_new_asset
= SecOTAPKISignalNewAsset
,
88 .soscc_ProcessSyncWithAllPeers
= SOSCCProcessSyncWithAllPeers_Server
,
89 .soscc_EnsurePeerRegistration
= SOSCCProcessEnsurePeerRegistration_Server
,
90 .sec_roll_keys
= _SecServerRollKeys
,
91 .soscc_RequestDeviceID
= SOSCCRequestDeviceID_Server
,
92 .soscc_SetDeviceID
= SOSCCSetDeviceID_Server
,
93 .sec_keychain_sync_update_circle
= _SecServerKeychainSyncUpdateCircle
,
94 .sec_keychain_sync_update_message
= _SecServerKeychainSyncUpdateMessage
,
95 .sec_get_log_settings
= SecCopyLogSettings_Server
,
96 .sec_set_xpc_log_settings
= SecSetXPCLogSettings_Server
,
99 void securityd_init_server(void) {
101 SecPolicyServerInitalize();
104 void securityd_init(char* home_path
) {
106 SetCustomHomeURL(home_path
);
108 securityd_init_server();