Skip to content

Instantly share code, notes, and snippets.

@kgleong
Created February 9, 2018 22:45
Show Gist options
  • Select an option

  • Save kgleong/c267f61a15a2b7d9828af77a2c9f2686 to your computer and use it in GitHub Desktop.

Select an option

Save kgleong/c267f61a15a2b7d9828af77a2c9f2686 to your computer and use it in GitHub Desktop.
SecItemUpdate
OSStatus
SecItemUpdate(CFDictionaryRef query, CFDictionaryRef attributesToUpdate)
{
    ...
	OSStatus status_osx = errSecItemNotFound, status_ios = errSecItemNotFound;
	bool can_target_ios, can_target_osx;
	OSStatus status = SecItemCategorizeQuery(query, can_target_ios, can_target_osx);
    ...

	if (can_target_ios) {
          ...
          status_ios = SecItemUpdate_ios(attrs_ios, attributesToUpdate);
        ...
	}

	if (can_target_osx) {
         ...
         if (SecItemHasSynchronizableUpdate(false, attributesToUpdate))
            status_osx = SecItemChangeSynchronizability(attrs_osx, attributesToUpdate, true);
         else
            status_osx = SecItemUpdate_osx(attrs_osx, attributesToUpdate);
         ...
	}
    ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment