objc2_security/generated/
SecStaticCode.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2_core_foundation::*;
5
6use crate::*;
7
8#[cfg(feature = "CSCommon")]
9unsafe impl ConcreteType for SecStaticCode {
10    /// Returns the type identifier of all SecStaticCode instances.
11    #[doc(alias = "SecStaticCodeGetTypeID")]
12    #[inline]
13    fn type_id() -> CFTypeID {
14        extern "C-unwind" {
15            fn SecStaticCodeGetTypeID() -> CFTypeID;
16        }
17        unsafe { SecStaticCodeGetTypeID() }
18    }
19}
20
21extern "C-unwind" {
22    /// Given a path to a file system object, create a SecStaticCode object representing
23    /// the code at that location, if possible. Such a SecStaticCode is not inherently
24    /// linked to running code in the system.
25    ///
26    /// It is possible to create a SecStaticCode object from an unsigned code object.
27    /// Most uses of such an object will return the errSecCSUnsigned error. However,
28    /// SecCodeCopyPath and SecCodeCopySigningInformation can be safely applied to such objects.
29    ///
30    ///
31    /// Parameter `path`: A path to a location in the file system. Only file:// URLs are
32    /// currently supported. For bundles, pass a URL to the root directory of the
33    /// bundle. For single files, pass a URL to the file. If you pass a URL to the
34    /// main executable of a bundle, the bundle as a whole will be generally recognized.
35    /// Caution: Paths containing embedded // or /../ within a bundle's directory
36    /// may cause the bundle to be misconstrued. If you expect to submit such paths,
37    /// first clean them with realpath(3) or equivalent.
38    ///
39    /// Parameter `flags`: Optional flags. Pass kSecCSDefaultFlags for standard behavior.
40    ///
41    /// Parameter `staticCode`: On successful return, contains a reference to the StaticCode object
42    /// representing the code at path. Unchanged on error.
43    ///
44    /// Returns: Upon success, errSecSuccess. Upon error, an OSStatus value documented in
45    /// CSCommon.h or certain other Security framework headers.
46    #[cfg(feature = "CSCommon")]
47    pub fn SecStaticCodeCreateWithPath(
48        path: &CFURL,
49        flags: SecCSFlags,
50        static_code: NonNull<*const SecStaticCode>,
51    ) -> OSStatus;
52}
53
54extern "C" {
55    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccodeattributearchitecture?language=objc)
56    pub static kSecCodeAttributeArchitecture: &'static CFString;
57}
58
59extern "C" {
60    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccodeattributesubarchitecture?language=objc)
61    pub static kSecCodeAttributeSubarchitecture: &'static CFString;
62}
63
64extern "C" {
65    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccodeattributeuniversalfileoffset?language=objc)
66    pub static kSecCodeAttributeUniversalFileOffset: &'static CFString;
67}
68
69extern "C" {
70    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccodeattributebundleversion?language=objc)
71    pub static kSecCodeAttributeBundleVersion: &'static CFString;
72}
73
74extern "C-unwind" {
75    /// Given a path to a file system object, create a SecStaticCode object representing
76    /// the code at that location, if possible. Such a SecStaticCode is not inherently
77    /// linked to running code in the system.
78    ///
79    /// It is possible to create a SecStaticCode object from an unsigned code object.
80    /// Most uses of such an object will return the errSecCSUnsigned error. However,
81    /// SecCodeCopyPath and SecCodeCopySigningInformation can be safely applied to such objects.
82    ///
83    ///
84    /// Parameter `path`: A path to a location in the file system. Only file:// URLs are
85    /// currently supported. For bundles, pass a URL to the root directory of the
86    /// bundle. For single files, pass a URL to the file. If you pass a URL to the
87    /// main executable of a bundle, the bundle as a whole will be generally recognized.
88    /// Caution: Paths containing embedded // or /../ within a bundle's directory
89    /// may cause the bundle to be misconstrued. If you expect to submit such paths,
90    /// first clean them with realpath(3) or equivalent.
91    ///
92    /// Parameter `flags`: Optional flags. Pass kSecCSDefaultFlags for standard behavior.
93    ///
94    /// Parameter `attributes`: A CFDictionary containing additional attributes of the code sought.
95    ///
96    /// Parameter `staticCode`: On successful return, contains a reference to the StaticCode object
97    /// representing the code at path. Unchanged on error.
98    ///
99    /// Returns: Upon success, errSecSuccess. Upon error, an OSStatus value documented in
100    /// CSCommon.h or certain other Security framework headers.
101    ///
102    ///
103    /// This can be a CFString containing a canonical architecture name ("i386" etc.), or a CFNumber
104    /// specifying an architecture numerically (see mach/machine.h). This key is ignored if the code
105    /// is not in Mach-O binary form. If the code is Mach-O but not universal ("thin"), the architecture
106    /// specified must agree with the actual file contents.
107    ///
108    /// (using the kSecCodeAttributeArchitecture key), specifies any sub-architecture by number.
109    /// This key is ignored if no main architecture is specified; if it is specified by name; or
110    /// if the code is not in Mach-O form.
111    ///
112    ///
113    /// then select the specified framework version. This key is otherwise ignored.
114    #[cfg(feature = "CSCommon")]
115    pub fn SecStaticCodeCreateWithPathAndAttributes(
116        path: &CFURL,
117        flags: SecCSFlags,
118        attributes: &CFDictionary,
119        static_code: NonNull<*const SecStaticCode>,
120    ) -> OSStatus;
121}
122
123/// [Apple's documentation](https://developer.apple.com/documentation/security/kseccscheckallarchitectures?language=objc)
124pub const kSecCSCheckAllArchitectures: u32 = 1;
125/// [Apple's documentation](https://developer.apple.com/documentation/security/kseccsdonotvalidateexecutable?language=objc)
126pub const kSecCSDoNotValidateExecutable: u32 = 2;
127/// [Apple's documentation](https://developer.apple.com/documentation/security/kseccsdonotvalidateresources?language=objc)
128pub const kSecCSDoNotValidateResources: u32 = 4;
129/// [Apple's documentation](https://developer.apple.com/documentation/security/kseccsbasicvalidateonly?language=objc)
130pub const kSecCSBasicValidateOnly: u32 = 6;
131/// [Apple's documentation](https://developer.apple.com/documentation/security/kseccschecknestedcode?language=objc)
132pub const kSecCSCheckNestedCode: u32 = 8;
133/// [Apple's documentation](https://developer.apple.com/documentation/security/kseccsstrictvalidate?language=objc)
134pub const kSecCSStrictValidate: u32 = 16;
135/// [Apple's documentation](https://developer.apple.com/documentation/security/kseccsfullreport?language=objc)
136pub const kSecCSFullReport: u32 = 32;
137/// [Apple's documentation](https://developer.apple.com/documentation/security/kseccscheckgatekeeperarchitectures?language=objc)
138pub const kSecCSCheckGatekeeperArchitectures: u32 = 65;
139/// [Apple's documentation](https://developer.apple.com/documentation/security/kseccsrestrictsymlinks?language=objc)
140pub const kSecCSRestrictSymlinks: u32 = 128;
141/// [Apple's documentation](https://developer.apple.com/documentation/security/kseccsrestricttoapplike?language=objc)
142pub const kSecCSRestrictToAppLike: u32 = 256;
143/// [Apple's documentation](https://developer.apple.com/documentation/security/kseccsrestrictsidebanddata?language=objc)
144pub const kSecCSRestrictSidebandData: u32 = 512;
145/// [Apple's documentation](https://developer.apple.com/documentation/security/kseccsusesoftwaresigningcert?language=objc)
146pub const kSecCSUseSoftwareSigningCert: u32 = 1024;
147/// [Apple's documentation](https://developer.apple.com/documentation/security/kseccsvalidatepeh?language=objc)
148pub const kSecCSValidatePEH: u32 = 2048;
149/// [Apple's documentation](https://developer.apple.com/documentation/security/kseccssinglethreaded?language=objc)
150pub const kSecCSSingleThreaded: u32 = 4096;
151/// [Apple's documentation](https://developer.apple.com/documentation/security/kseccsallownetworkaccess?language=objc)
152pub const kSecCSAllowNetworkAccess: u32 = 65536;
153/// [Apple's documentation](https://developer.apple.com/documentation/security/kseccsfastexecutablevalidation?language=objc)
154pub const kSecCSFastExecutableValidation: u32 = 131072;
155
156extern "C-unwind" {
157    #[cfg(feature = "CSCommon")]
158    pub fn SecStaticCodeCheckValidity(
159        static_code: &SecStaticCode,
160        flags: SecCSFlags,
161        requirement: Option<&SecRequirement>,
162    ) -> OSStatus;
163}
164
165extern "C-unwind" {
166    #[cfg(feature = "CSCommon")]
167    pub fn SecStaticCodeCheckValidityWithErrors(
168        static_code: &SecStaticCode,
169        flags: SecCSFlags,
170        requirement: Option<&SecRequirement>,
171        errors: *mut *mut CFError,
172    ) -> OSStatus;
173}