1 use core_foundation_sys::base::OSStatus;
2 use core_foundation_sys::string::CFStringRef;
3 use std::os::raw::c_void;
4 
5 pub enum OpaqueSecKeychainRef {}
6 pub type SecKeychainRef = *mut OpaqueSecKeychainRef;
7 
8 pub enum OpaqueSecKeychainItemRef {}
9 pub type SecKeychainItemRef = *mut OpaqueSecKeychainItemRef;
10 
11 // OSType from MacTypes.h
12 pub type SecKeychainAttrType = u32;
13 
14 #[repr(C)]
15 #[derive(Copy, Clone)]
16 pub struct SecKeychainAttribute {
17     pub tag: SecKeychainAttrType,
18     pub length: u32,
19     pub data: *mut c_void,
20 }
21 
22 #[repr(C)]
23 #[derive(Copy, Clone)]
24 pub struct SecKeychainAttributeList {
25     pub count: u32,
26     pub attr: *mut SecKeychainAttribute,
27 }
28 
29 pub enum OpaqueSecCertificateRef {}
30 pub type SecCertificateRef = *mut OpaqueSecCertificateRef;
31 
32 pub enum OpaqueSecAccessRef {}
33 pub type SecAccessRef = *mut OpaqueSecAccessRef;
34 
35 pub enum OpaqueSecKeyRef {}
36 pub type SecKeyRef = *mut OpaqueSecKeyRef;
37 
38 pub enum OpaqueSecIdentityRef {}
39 pub type SecIdentityRef = *mut OpaqueSecIdentityRef;
40 
41 pub enum OpaqueSecPolicyRef {}
42 pub type SecPolicyRef = *mut OpaqueSecPolicyRef;
43 
44 pub const errSecSuccess: OSStatus = 0;
45 pub const errSecUnimplemented: OSStatus = -4;
46 pub const errSecIO: OSStatus = -36;
47 pub const errSecParam: OSStatus = -50;
48 pub const errSecBadReq: OSStatus = -909;
49 pub const errSecAuthFailed: OSStatus = -25293;
50 pub const errSecConversionError: OSStatus = -67594;
51 pub const errSecTrustSettingDeny: OSStatus = -67654;
52 pub const errSecNotTrusted: OSStatus = -67843;
53 pub const errSecNoTrustSettings: OSStatus = -25263;
54 
55 extern "C" {
56     #[cfg(target_os = "macos")]
SecCopyErrorMessageString(status: OSStatus, reserved: *mut c_void) -> CFStringRef57     pub fn SecCopyErrorMessageString(status: OSStatus, reserved: *mut c_void) -> CFStringRef;
58 }
59