int accessibleWhenUnlockedOnly()

in macos/midtier.c [191:214]


int accessibleWhenUnlockedOnly(
    const char* label,
    const char* tag,
    unsigned char* hash,
    char** error) {
  CFStringRef errStr = NULL;
  CFTypeRef protection = HasSEKeyProtection(
      label, tag, hash, kSecAttrAccessibleWhenUnlockedThisDeviceOnly, &errStr);

  if (errStr || !protection) {
    if (!errStr) {
      errStr = CFSTR("error determining key protection level");
    }
    *error = CFStringToCString(errStr);
    CFRelease((CFTypeRef)errStr);
    return 0;
  }

  if (CFEqual(protection, kSecAttrAccessibleWhenUnlockedThisDeviceOnly)) {
    return 1;
  }

  return 0;
}