SecKeybagSupport.h [plain text]
#ifndef _SECURITYD_SECKEYBAGSUPPORT_H_
#define _SECURITYD_SECKEYBAGSUPPORT_H_
#include <CoreFoundation/CoreFoundation.h>
#include <utilities/SecAKSWrappers.h>
#if TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_IPHONE_SIMULATOR)
#define USE_KEYSTORE 1
#elif TARGET_OS_EMBEDDED && !TARGET_IPHONE_SIMULATOR
#define USE_KEYSTORE 1
#else
#define USE_KEYSTORE 0
#endif
#if USE_KEYSTORE
#include <Kernel/IOKit/crypto/AppleKeyStoreDefs.h>
#endif
__BEGIN_DECLS
#if USE_KEYSTORE
typedef int32_t keyclass_t;
#else
typedef int32_t keyclass_t;
typedef int32_t key_handle_t;
enum key_classes {
key_class_ak = 6,
key_class_ck,
key_class_dk,
key_class_aku,
key_class_cku,
key_class_dku,
key_class_akpu
};
#endif
enum SecKsCryptoOp {
kSecKsWrap = 10,
kSecKsUnwrap,
kSecKsDelete
};
#define KEYBAG_NONE (-1)
#define KEYBAG_DEVICE (g_keychain_keybag)
extern keybag_handle_t g_keychain_keybag;
bool use_hwaes(void);
bool ks_crypt(uint32_t operation, keybag_handle_t keybag,
keyclass_t keyclass, uint32_t textLength, const uint8_t *source, keyclass_t *actual_class,
CFMutableDataRef dest, CFErrorRef *error);
#if USE_KEYSTORE
bool ks_crypt_acl(uint32_t operation, keybag_handle_t keybag,
keyclass_t keyclass, uint32_t textLength, const uint8_t *source,
CFMutableDataRef dest, CFDataRef acl, CFDataRef acm_context, CFDataRef caller_access_groups,
CFErrorRef *error);
#endif
bool ks_open_keybag(CFDataRef keybag, CFDataRef password, keybag_handle_t *handle, CFErrorRef *error);
bool ks_close_keybag(keybag_handle_t keybag, CFErrorRef *error);
__END_DECLS
#endif