6 #include "keychain/SecureObjectSync/SOSAccountPriv.h"
7 #import "keychain/SecureObjectSync/SOSTransport.h"
8 #import "keychain/SecureObjectSync/SOSTransportKeyParameter.h"
9 #import "keychain/SecureObjectSync/SOSTransportMessageKVS.h"
10 #import "keychain/SecureObjectSync/SOSTransportCircleKVS.h"
11 #import "keychain/SecureObjectSync/SOSTransportCircleCK.h"
12 #import "keychain/SecureObjectSync/SOSAccountTrust.h"
13 #import "keychain/SecureObjectSync/SOSAccountTrustClassic.h"
15 #include "keychain/SecureObjectSync/SOSPeerInfoCollections.h"
16 #include "SOSCloudKeychainClient.h"
19 // MARK: Circle management
23 SOSCircleRef CF_RETURNS_RETAINED SOSAccountEnsureCircle(SOSAccount* a, CFStringRef name, CFErrorRef *error)
25 CFErrorRef localError = NULL;
26 SOSAccountTrustClassic *trust = a.trust;
27 SOSCircleRef circle = trust.trustedCircle;
30 circle = SOSCircleCreate(NULL, name, NULL);
31 a.key_interests_need_updating = true;
32 [trust setTrustedCircle:circle];
37 require_action_quiet(circle || !isSOSErrorCoded(localError, kSOSErrorIncompatibleCircle), fail,
38 if (error) { *error = localError; localError = NULL; });
41 CFReleaseNull(localError);