]> git.saurik.com Git - apple/security.git/blob - keychain/SecureObjectSync/SOSRingTypes.h
Security-59306.11.20.tar.gz
[apple/security.git] / keychain / SecureObjectSync / SOSRingTypes.h
1 /*
2 * Copyright (c) 2015-2016 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 // SOSRingTypes.h
26 //
27
28 #ifndef _sec_SOSRingTypes_
29 #define _sec_SOSRingTypes_
30
31
32 #include <CoreFoundation/CFRuntime.h>
33 #include <CoreFoundation/CoreFoundation.h>
34 #include "keychain/SecureObjectSync/SOSAccount.h"
35 #include "keychain/SecureObjectSync/SOSRingUtils.h"
36
37 typedef struct ringfuncs_t {
38 char *typeName;
39 int version;
40 SOSRingRef (*sosRingCreate)(CFStringRef name, CFStringRef myPeerID, CFErrorRef *error);
41 bool (*sosRingResetToEmpty)(SOSRingRef ring, CFStringRef myPeerID, CFErrorRef *error);
42 bool (*sosRingResetToOffering)(SOSRingRef ring, SecKeyRef user_privkey, SOSFullPeerInfoRef requestor, CFErrorRef *error);
43 SOSRingStatus (*sosRingDeviceIsInRing)(SOSRingRef ring, CFStringRef peerID);
44 bool (*sosRingApply)(SOSRingRef ring, SecKeyRef user_pubkey, SOSFullPeerInfoRef requestor, CFErrorRef *error);
45 bool (*sosRingWithdraw)(SOSRingRef ring, SecKeyRef user_privkey, SOSFullPeerInfoRef requestor, CFErrorRef *error);
46 bool (*sosRingGenerationSign)(SOSRingRef ring, SecKeyRef user_privkey, SOSFullPeerInfoRef requestor, CFErrorRef *error);
47 bool (*sosRingConcordanceSign)(SOSRingRef ring, SOSFullPeerInfoRef requestor, CFErrorRef *error);
48 SOSConcordanceStatus (*sosRingConcordanceTrust)(SOSFullPeerInfoRef me, CFSetRef peers,
49 SOSRingRef knownRing, SOSRingRef proposedRing,
50 SecKeyRef knownPubkey, SecKeyRef userPubkey,
51 CFStringRef excludePeerID, CFErrorRef *error);
52 bool (*sosRingAccept)(SOSRingRef ring, SecKeyRef user_privkey, SOSFullPeerInfoRef requestor, CFErrorRef *error);
53 bool (*sosRingReject)(SOSRingRef ring, SecKeyRef user_privkey, SOSFullPeerInfoRef requestor, CFErrorRef *error);
54 bool (*sosRingSetPayload)(SOSRingRef ring, SecKeyRef user_privkey, CFDataRef payload, SOSFullPeerInfoRef requestor, CFErrorRef *error);
55 CFDataRef (*sosRingGetPayload)(SOSRingRef ring, CFErrorRef *error);
56 } ringFuncStruct, *ringFuncs;
57
58 static inline SOSRingRef SOSRingCreate_ForType(CFStringRef name, SOSRingType type, CFStringRef myPeerID, CFErrorRef *error) {
59 SOSRingRef retval = NULL;
60 retval = SOSRingCreate_Internal(name, type, error);
61 if(!retval) return NULL;
62 SOSRingSetLastModifier(retval, myPeerID);
63 return retval;
64 }
65
66 #endif /* defined(_sec_SOSRingTypes_) */