]> git.saurik.com Git - apple/security.git/blob - keychain/securityd/CheckV12DevEnabled.m
Security-59306.41.2.tar.gz
[apple/security.git] / keychain / securityd / CheckV12DevEnabled.m
1 //
2 // CheckV12DevEnabled.m
3 // Security_ios
4 //
5 // Created by Wouter de Groot on 2018-10-20.
6 //
7
8 // TODO: remove me when keychain backup is enabled for all
9
10 #include "CheckV12DevEnabled.h"
11
12 #if __OBJC2__
13
14 #import <Foundation/Foundation.h>
15 #import <dispatch/dispatch.h>
16
17 static int realCheckV12DevEnabled() {
18 static bool enabled = NO;
19 static dispatch_once_t onceToken;
20 dispatch_once(&onceToken, ^{
21 NSUserDefaults* defaults = [[NSUserDefaults alloc] initWithSuiteName:@"com.apple.security"];
22 enabled = [defaults boolForKey:@"enableKeychainBackupDevelopment"];
23 });
24 return enabled ? 1 : 0;
25 }
26
27 int (*checkV12DevEnabled)(void) = realCheckV12DevEnabled;
28
29 void resetCheckV12DevEnabled(void) {
30 checkV12DevEnabled = realCheckV12DevEnabled;
31 }
32
33 #endif