6 #import <Security/SecureObjectSync/SOSAccountPriv.h>
7 #import <Security/SecureObjectSync/SOSTransport.h>
8 #import <Security/SecureObjectSync/SOSTransportKeyParameter.h>
9 #import <Security/SecureObjectSync/SOSTransportMessageKVS.h>
10 #import <Security/SecureObjectSync/SOSTransportMessageIDS.h>
11 #import <Security/SecureObjectSync/SOSTransportCircleKVS.h>
12 #import <Security/SecureObjectSync/SOSTransportCircleCK.h>
13 #import <Security/SecureObjectSync/SOSAccountTrust.h>
14 #import <Security/SecureObjectSync/SOSAccountTrustClassic.h>
16 #include <Security/SecureObjectSync/SOSPeerInfoCollections.h>
17 #include "SOSCloudKeychainClient.h"
20 // MARK: Circle management
24 SOSCircleRef SOSAccountEnsureCircle(SOSAccount* a, CFStringRef name, CFErrorRef *error)
26 CFErrorRef localError = NULL;
27 SOSAccountTrustClassic *trust = a.trust;
28 SOSCircleRef circle = trust.trustedCircle;
31 circle = SOSCircleCreate(NULL, name, NULL);
32 a.key_interests_need_updating = true;
33 [trust setTrustedCircle:circle];
36 require_action_quiet(circle || !isSOSErrorCoded(localError, kSOSErrorIncompatibleCircle), fail,
37 if (error) { *error = localError; localError = NULL; });
40 CFReleaseNull(localError);