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