2 #include "aks_real_witness.h"
3 #include <TargetConditionals.h>
5 #if !TARGET_OS_SIMULATOR
8 #include <MobileKeyBag/MobileKeyBag.h>
10 #include <utilities/debugging.h>
12 bool hwaes_key_available(void)
14 keybag_handle_t handle
= bad_keybag_handle
;
15 keybag_handle_t special_handle
= bad_keybag_handle
;
17 special_handle
= session_keybag_handle
;
18 #elif TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR
19 special_handle
= device_keybag_handle
;
21 #error "supported keybag target"
24 kern_return_t kr
= aks_get_system(special_handle
, &handle
);
25 if (kr
!= kAKSReturnSuccess
) {
26 #if TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR
27 /* TODO: Remove this once the kext runs the daemon on demand if
28 there is no system keybag. */
29 int kb_state
= MKBGetDeviceLockState(NULL
);
30 secinfo("aks", "AppleKeyStore lock state: %d", kb_state
);