objc2_security/generated/
CSCommon.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::cell::UnsafeCell;
4use core::marker::{PhantomData, PhantomPinned};
5use core::ptr::NonNull;
6#[cfg(feature = "objc2")]
7use objc2::__framework_prelude::*;
8use objc2_core_foundation::*;
9
10use crate::*;
11
12/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsunimplemented?language=objc)
13pub const errSecCSUnimplemented: OSStatus = -67072;
14/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsinvalidobjectref?language=objc)
15pub const errSecCSInvalidObjectRef: OSStatus = -67071;
16/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsinvalidflags?language=objc)
17pub const errSecCSInvalidFlags: OSStatus = -67070;
18/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsobjectrequired?language=objc)
19pub const errSecCSObjectRequired: OSStatus = -67069;
20/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsstaticcodenotfound?language=objc)
21pub const errSecCSStaticCodeNotFound: OSStatus = -67068;
22/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsunsupportedguestattributes?language=objc)
23pub const errSecCSUnsupportedGuestAttributes: OSStatus = -67067;
24/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsinvalidattributevalues?language=objc)
25pub const errSecCSInvalidAttributeValues: OSStatus = -67066;
26/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsnosuchcode?language=objc)
27pub const errSecCSNoSuchCode: OSStatus = -67065;
28/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsmultipleguests?language=objc)
29pub const errSecCSMultipleGuests: OSStatus = -67064;
30/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsguestinvalid?language=objc)
31pub const errSecCSGuestInvalid: OSStatus = -67063;
32/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsunsigned?language=objc)
33pub const errSecCSUnsigned: OSStatus = -67062;
34/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccssignaturefailed?language=objc)
35pub const errSecCSSignatureFailed: OSStatus = -67061;
36/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccssignaturenotverifiable?language=objc)
37pub const errSecCSSignatureNotVerifiable: OSStatus = -67060;
38/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccssignatureunsupported?language=objc)
39pub const errSecCSSignatureUnsupported: OSStatus = -67059;
40/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsbaddictionaryformat?language=objc)
41pub const errSecCSBadDictionaryFormat: OSStatus = -67058;
42/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsresourcesnotsealed?language=objc)
43pub const errSecCSResourcesNotSealed: OSStatus = -67057;
44/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsresourcesnotfound?language=objc)
45pub const errSecCSResourcesNotFound: OSStatus = -67056;
46/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsresourcesinvalid?language=objc)
47pub const errSecCSResourcesInvalid: OSStatus = -67055;
48/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsbadresource?language=objc)
49pub const errSecCSBadResource: OSStatus = -67054;
50/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsresourcerulesinvalid?language=objc)
51pub const errSecCSResourceRulesInvalid: OSStatus = -67053;
52/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsreqinvalid?language=objc)
53pub const errSecCSReqInvalid: OSStatus = -67052;
54/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsrequnsupported?language=objc)
55pub const errSecCSReqUnsupported: OSStatus = -67051;
56/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsreqfailed?language=objc)
57pub const errSecCSReqFailed: OSStatus = -67050;
58/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsbadobjectformat?language=objc)
59pub const errSecCSBadObjectFormat: OSStatus = -67049;
60/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsinternalerror?language=objc)
61pub const errSecCSInternalError: OSStatus = -67048;
62/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccshostreject?language=objc)
63pub const errSecCSHostReject: OSStatus = -67047;
64/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsnotahost?language=objc)
65pub const errSecCSNotAHost: OSStatus = -67046;
66/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccssignatureinvalid?language=objc)
67pub const errSecCSSignatureInvalid: OSStatus = -67045;
68/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccshostprotocolrelativepath?language=objc)
69pub const errSecCSHostProtocolRelativePath: OSStatus = -67044;
70/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccshostprotocolcontradiction?language=objc)
71pub const errSecCSHostProtocolContradiction: OSStatus = -67043;
72/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccshostprotocoldedicationerror?language=objc)
73pub const errSecCSHostProtocolDedicationError: OSStatus = -67042;
74/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccshostprotocolnotproxy?language=objc)
75pub const errSecCSHostProtocolNotProxy: OSStatus = -67041;
76/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccshostprotocolstateerror?language=objc)
77pub const errSecCSHostProtocolStateError: OSStatus = -67040;
78/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccshostprotocolunrelated?language=objc)
79pub const errSecCSHostProtocolUnrelated: OSStatus = -67039;
80/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsnotsupported?language=objc)
81pub const errSecCSNotSupported: OSStatus = -67037;
82/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccscmstoolarge?language=objc)
83pub const errSecCSCMSTooLarge: OSStatus = -67036;
84/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccshostprotocolinvalidhash?language=objc)
85pub const errSecCSHostProtocolInvalidHash: OSStatus = -67035;
86/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsstaticcodechanged?language=objc)
87pub const errSecCSStaticCodeChanged: OSStatus = -67034;
88/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsdbdenied?language=objc)
89pub const errSecCSDBDenied: OSStatus = -67033;
90/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsdbaccess?language=objc)
91pub const errSecCSDBAccess: OSStatus = -67032;
92/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccssigdbdenied?language=objc)
93pub const errSecCSSigDBDenied: OSStatus = -67033;
94/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccssigdbaccess?language=objc)
95pub const errSecCSSigDBAccess: OSStatus = -67032;
96/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccshostprotocolinvalidattribute?language=objc)
97pub const errSecCSHostProtocolInvalidAttribute: OSStatus = -67031;
98/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsinfoplistfailed?language=objc)
99pub const errSecCSInfoPlistFailed: OSStatus = -67030;
100/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsnomainexecutable?language=objc)
101pub const errSecCSNoMainExecutable: OSStatus = -67029;
102/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsbadbundleformat?language=objc)
103pub const errSecCSBadBundleFormat: OSStatus = -67028;
104/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsnomatches?language=objc)
105pub const errSecCSNoMatches: OSStatus = -67027;
106/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsfilehardquarantined?language=objc)
107pub const errSecCSFileHardQuarantined: OSStatus = -67026;
108/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsoutdated?language=objc)
109pub const errSecCSOutdated: OSStatus = -67025;
110/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsdbcorrupt?language=objc)
111pub const errSecCSDbCorrupt: OSStatus = -67024;
112/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsresourcedirectoryfailed?language=objc)
113pub const errSecCSResourceDirectoryFailed: OSStatus = -67023;
114/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsunsignednestedcode?language=objc)
115pub const errSecCSUnsignedNestedCode: OSStatus = -67022;
116/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsbadnestedcode?language=objc)
117pub const errSecCSBadNestedCode: OSStatus = -67021;
118/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsbadcallbackvalue?language=objc)
119pub const errSecCSBadCallbackValue: OSStatus = -67020;
120/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccshelperfailed?language=objc)
121pub const errSecCSHelperFailed: OSStatus = -67019;
122/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsvetoed?language=objc)
123pub const errSecCSVetoed: OSStatus = -67018;
124/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsbadlvarch?language=objc)
125pub const errSecCSBadLVArch: OSStatus = -67017;
126/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsresourcenotsupported?language=objc)
127pub const errSecCSResourceNotSupported: OSStatus = -67016;
128/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsregularfile?language=objc)
129pub const errSecCSRegularFile: OSStatus = -67015;
130/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsunsealedapproot?language=objc)
131pub const errSecCSUnsealedAppRoot: OSStatus = -67014;
132/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsweakresourcerules?language=objc)
133pub const errSecCSWeakResourceRules: OSStatus = -67013;
134/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsdsstoresymlink?language=objc)
135pub const errSecCSDSStoreSymlink: OSStatus = -67012;
136/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsambiguousbundleformat?language=objc)
137pub const errSecCSAmbiguousBundleFormat: OSStatus = -67011;
138/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsbadmainexecutable?language=objc)
139pub const errSecCSBadMainExecutable: OSStatus = -67010;
140/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsbadframeworkversion?language=objc)
141pub const errSecCSBadFrameworkVersion: OSStatus = -67009;
142/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsunsealedframeworkroot?language=objc)
143pub const errSecCSUnsealedFrameworkRoot: OSStatus = -67008;
144/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsweakresourceenvelope?language=objc)
145pub const errSecCSWeakResourceEnvelope: OSStatus = -67007;
146/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccscancelled?language=objc)
147pub const errSecCSCancelled: OSStatus = -67006;
148/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsinvalidplatform?language=objc)
149pub const errSecCSInvalidPlatform: OSStatus = -67005;
150/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccstoobig?language=objc)
151pub const errSecCSTooBig: OSStatus = -67004;
152/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsinvalidsymlink?language=objc)
153pub const errSecCSInvalidSymlink: OSStatus = -67003;
154/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsnotapplike?language=objc)
155pub const errSecCSNotAppLike: OSStatus = -67002;
156/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsbaddiskimageformat?language=objc)
157pub const errSecCSBadDiskImageFormat: OSStatus = -67001;
158/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsunsupporteddigestalgorithm?language=objc)
159pub const errSecCSUnsupportedDigestAlgorithm: OSStatus = -67000;
160/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsinvalidassociatedfiledata?language=objc)
161pub const errSecCSInvalidAssociatedFileData: OSStatus = -66999;
162/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsinvalidteamidentifier?language=objc)
163pub const errSecCSInvalidTeamIdentifier: OSStatus = -66998;
164/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsbadteamidentifier?language=objc)
165pub const errSecCSBadTeamIdentifier: OSStatus = -66997;
166/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccssignatureuntrusted?language=objc)
167pub const errSecCSSignatureUntrusted: OSStatus = -66996;
168/// [Apple's documentation](https://developer.apple.com/documentation/security/errsecmultipleexecsegments?language=objc)
169pub const errSecMultipleExecSegments: OSStatus = -66995;
170/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsinvalidentitlements?language=objc)
171pub const errSecCSInvalidEntitlements: OSStatus = -66994;
172/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsinvalidruntimeversion?language=objc)
173pub const errSecCSInvalidRuntimeVersion: OSStatus = -66993;
174/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsrevokednotarization?language=objc)
175pub const errSecCSRevokedNotarization: OSStatus = -66992;
176/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccscmsconstructionfailed?language=objc)
177pub const errSecCSCMSConstructionFailed: OSStatus = -66991;
178/// [Apple's documentation](https://developer.apple.com/documentation/security/errseccsremotesignerfailed?language=objc)
179pub const errSecCSRemoteSignerFailed: OSStatus = -66990;
180
181extern "C" {
182    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccferrorarchitecture?language=objc)
183    pub static kSecCFErrorArchitecture: &'static CFString;
184}
185
186extern "C" {
187    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccferrorpattern?language=objc)
188    pub static kSecCFErrorPattern: &'static CFString;
189}
190
191extern "C" {
192    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccferrorresourceseal?language=objc)
193    pub static kSecCFErrorResourceSeal: &'static CFString;
194}
195
196extern "C" {
197    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccferrorresourceadded?language=objc)
198    pub static kSecCFErrorResourceAdded: &'static CFString;
199}
200
201extern "C" {
202    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccferrorresourcealtered?language=objc)
203    pub static kSecCFErrorResourceAltered: &'static CFString;
204}
205
206extern "C" {
207    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccferrorresourcemissing?language=objc)
208    pub static kSecCFErrorResourceMissing: &'static CFString;
209}
210
211extern "C" {
212    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccferrorresourcesideband?language=objc)
213    pub static kSecCFErrorResourceSideband: &'static CFString;
214}
215
216extern "C" {
217    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccferrorresourcerecursive?language=objc)
218    pub static kSecCFErrorResourceRecursive: &'static CFString;
219}
220
221extern "C" {
222    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccferrorinfoplist?language=objc)
223    pub static kSecCFErrorInfoPlist: &'static CFString;
224}
225
226extern "C" {
227    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccferrorguestattributes?language=objc)
228    pub static kSecCFErrorGuestAttributes: &'static CFString;
229}
230
231extern "C" {
232    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccferrorrequirementsyntax?language=objc)
233    pub static kSecCFErrorRequirementSyntax: &'static CFString;
234}
235
236extern "C" {
237    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccferrorpath?language=objc)
238    pub static kSecCFErrorPath: &'static CFString;
239}
240
241/// This is the type of a reference to running code.
242///
243/// In many (but not all) calls, this can be passed to a SecStaticCodeRef
244/// argument, which performs an implicit SecCodeCopyStaticCode call and
245/// operates on the result.
246///
247/// See also [Apple's documentation](https://developer.apple.com/documentation/security/seccode?language=objc)
248#[repr(C)]
249pub struct SecCode {
250    inner: [u8; 0],
251    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
252}
253
254cf_type!(
255    unsafe impl SecCode {}
256);
257#[cfg(feature = "objc2")]
258cf_objc2_type!(
259    unsafe impl RefEncode<"__SecCode"> for SecCode {}
260);
261
262/// This is the type of a reference to static code on disk.
263///
264/// See also [Apple's documentation](https://developer.apple.com/documentation/security/secstaticcode?language=objc)
265#[repr(C)]
266pub struct SecStaticCode {
267    inner: [u8; 0],
268    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
269}
270
271cf_type!(
272    unsafe impl SecStaticCode {}
273);
274#[cfg(feature = "objc2")]
275cf_objc2_type!(
276    unsafe impl RefEncode<"__SecCode"> for SecStaticCode {}
277);
278
279/// This is the type of a reference to a code requirement.
280///
281/// See also [Apple's documentation](https://developer.apple.com/documentation/security/secrequirement?language=objc)
282#[repr(C)]
283pub struct SecRequirement {
284    inner: [u8; 0],
285    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
286}
287
288cf_type!(
289    unsafe impl SecRequirement {}
290);
291#[cfg(feature = "objc2")]
292cf_objc2_type!(
293    unsafe impl RefEncode<"__SecRequirement"> for SecRequirement {}
294);
295
296/// An abstract handle to identify a particular Guest in the context of its Host.
297///
298/// Guest handles are assigned by the host at will, with kSecNoGuest (zero) being
299/// reserved as the null value. They can be reused for new children if desired.
300///
301/// See also [Apple's documentation](https://developer.apple.com/documentation/security/secguestref?language=objc)
302pub type SecGuestRef = u32;
303
304/// [Apple's documentation](https://developer.apple.com/documentation/security/ksecnoguest?language=objc)
305pub const kSecNoGuest: SecGuestRef = 0;
306
307/// This is the type of flags arguments to Code Signing API calls.
308/// It provides a bit mask of request and option flags. All of the bits in these
309/// masks are reserved to Apple; if you set any bits not defined in these headers,
310/// the behavior is generally undefined.
311///
312/// This list describes the flags that are shared among several Code Signing API calls.
313/// Flags that only apply to one call are defined and documented with that call.
314/// Global flags are assigned from high order down (31 -> 0); call-specific flags
315/// are assigned from the bottom up (0 -> 31).
316///
317///
318/// When passed to a flags argument throughout, indicates that default behavior
319/// is desired. Do not mix with other flags values.
320///
321/// When passed to a call that performs code validation, requests that code signatures
322/// made by expired certificates be rejected. By default, expiration of participating
323/// certificates is not automatic grounds for rejection.
324///
325/// When passed to a call that performs code validation, configures the validation to
326/// not perform any work that requires the network. Using this flag disables security features
327/// like online certificate revocation and notarization checks by removing potentially
328/// slow network requests that can delay evaluations. This flag has always been usable for
329/// SecStaticCode objects and is usable with SecCode objects starting with macOS 11.3.
330///
331/// See also [Apple's documentation](https://developer.apple.com/documentation/security/seccsflags?language=objc)
332// NS_OPTIONS
333#[repr(transparent)]
334#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
335pub struct SecCSFlags(pub u32);
336bitflags::bitflags! {
337    impl SecCSFlags: u32 {
338        #[doc(alias = "kSecCSDefaultFlags")]
339        const DefaultFlags = 0;
340        #[doc(alias = "kSecCSConsiderExpiration")]
341        const ConsiderExpiration = 1<<31;
342        #[doc(alias = "kSecCSEnforceRevocationChecks")]
343        const EnforceRevocationChecks = 1<<30;
344        #[doc(alias = "kSecCSNoNetworkAccess")]
345        const NoNetworkAccess = 1<<29;
346        #[doc(alias = "kSecCSReportProgress")]
347        const ReportProgress = 1<<28;
348        #[doc(alias = "kSecCSCheckTrustedAnchors")]
349        const CheckTrustedAnchors = 1<<27;
350        #[doc(alias = "kSecCSQuickCheck")]
351        const QuickCheck = 1<<26;
352        #[doc(alias = "kSecCSApplyEmbeddedPolicy")]
353        const ApplyEmbeddedPolicy = 1<<25;
354        #[doc(alias = "kSecCSStripDisallowedXattrs")]
355        const StripDisallowedXattrs = 1<<24;
356        #[doc(alias = "kSecCSMatchGuestRequirementInKernel")]
357        const MatchGuestRequirementInKernel = 1<<23;
358    }
359}
360
361#[cfg(feature = "objc2")]
362unsafe impl Encode for SecCSFlags {
363    const ENCODING: Encoding = u32::ENCODING;
364}
365
366#[cfg(feature = "objc2")]
367unsafe impl RefEncode for SecCSFlags {
368    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
369}
370
371/// This is the type of option flags that can be embedded in a code signature
372/// during signing, and that govern the use of the signature thereafter.
373/// Some of these flags can be set through the codesign(1) command's --options
374/// argument; some are set implicitly based on signing circumstances; and all
375/// can be set with the kSecCodeSignerFlags item of a signing information dictionary.
376///
377///
378/// Indicates that the code may act as a host that controls and supervises guest
379/// code. If this flag is not set in a code signature, the code is never considered
380/// eligible to be a host, and any attempt to act like one will be ignored or rejected.
381///
382/// The code has been sealed without a signing identity. No identity may be retrieved
383/// from it, and any code requirement placing restrictions on the signing identity
384/// will fail. This flag is set by the code signing API and cannot be set explicitly.
385///
386/// Implicitly set the "hard" status bit for the code when it starts running.
387/// This bit indicates that the code prefers to be denied access to a resource
388/// if gaining such access would cause its invalidation. Since the hard bit is
389/// sticky, setting this option bit guarantees that the code will always have
390/// it set.
391///
392/// Implicitly set the "kill" status bit for the code when it starts running.
393/// This bit indicates that the code wishes to be terminated with prejudice if
394/// it is ever invalidated. Since the kill bit is sticky, setting this option bit
395/// guarantees that the code will always be dynamically valid, since it will die
396/// immediately    if it becomes invalid.
397///
398/// Forces the kSecCSConsiderExpiration flag on all validations of the code.
399///
400/// Instructs the kernel to apply runtime hardening policies as required by the
401/// hardened runtime version
402///
403/// The code was automatically signed by the linker. This signature should be
404/// ignored in any new signing operation.
405///
406/// See also [Apple's documentation](https://developer.apple.com/documentation/security/seccodesignatureflags?language=objc)
407// NS_OPTIONS
408#[repr(transparent)]
409#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
410pub struct SecCodeSignatureFlags(pub u32);
411bitflags::bitflags! {
412    impl SecCodeSignatureFlags: u32 {
413        #[doc(alias = "kSecCodeSignatureHost")]
414        const Host = 0x0001;
415        #[doc(alias = "kSecCodeSignatureAdhoc")]
416        const Adhoc = 0x0002;
417        #[doc(alias = "kSecCodeSignatureForceHard")]
418        const ForceHard = 0x0100;
419        #[doc(alias = "kSecCodeSignatureForceKill")]
420        const ForceKill = 0x0200;
421        #[doc(alias = "kSecCodeSignatureForceExpiration")]
422        const ForceExpiration = 0x0400;
423        #[doc(alias = "kSecCodeSignatureRestrict")]
424        const Restrict = 0x0800;
425        #[doc(alias = "kSecCodeSignatureEnforcement")]
426        const Enforcement = 0x1000;
427        #[doc(alias = "kSecCodeSignatureLibraryValidation")]
428        const LibraryValidation = 0x2000;
429        #[doc(alias = "kSecCodeSignatureRuntime")]
430        const Runtime = 0x10000;
431        #[doc(alias = "kSecCodeSignatureLinkerSigned")]
432        const LinkerSigned = 0x20000;
433    }
434}
435
436#[cfg(feature = "objc2")]
437unsafe impl Encode for SecCodeSignatureFlags {
438    const ENCODING: Encoding = u32::ENCODING;
439}
440
441#[cfg(feature = "objc2")]
442unsafe impl RefEncode for SecCodeSignatureFlags {
443    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
444}
445
446/// The code signing system attaches a set of status flags to each running code.
447/// These flags are maintained by the code's host, and can be read by anyone.
448/// A code may change its own flags, a host may change its guests' flags,
449/// and root may change anyone's flags.    However, these flags are sticky in that
450/// each can change in only one direction (and never back, for the lifetime of the code).
451/// Not even root can violate this restriction.
452///
453/// There are other flags in SecCodeStatus that are not publicly documented.
454/// Do not rely on them, and do not ever attempt to explicitly set them.
455///
456///
457/// Indicates that the code is dynamically valid, i.e. it started correctly
458/// and has not been invalidated since then. The valid bit can only be cleared.
459///
460/// Warning: This bit is not your one-stop shortcut to determining the validity    of code.
461/// It represents the dynamic component of the full validity function; if this
462/// bit is unset, the code is definitely invalid, but the converse is not always true.
463/// In fact, code hosts may represent the outcome of some delayed static validation work in this bit,
464/// and thus it strictly represents a blend of (all of) dynamic and (some of) static validity,
465/// depending on the implementation of the particular host managing the code. You can (only)
466/// rely that (1) dynamic invalidation will clear this bit; and (2) the combination
467/// of static validation and dynamic validity (as performed by the SecCodeCheckValidity* APIs)
468/// will give a correct answer.
469///
470///
471/// Indicates that the code prefers to be denied access to resources if gaining access
472/// would invalidate it. This bit can only be set.
473/// It is undefined whether code that is marked hard and is already invalid will still
474/// be denied access to a resource that would invalidate it if it were still valid. That is,
475/// the code may or may not get access to such a resource while being invalid, and that choice
476/// may appear random.
477///
478///
479/// Indicates that the code wants to be killed (terminated) if it ever loses its validity.
480/// This bit can only be set. Code that has the kill flag set will never be dynamically invalid
481/// (and live). Note however that a change in static validity does not necessarily trigger instant
482/// death.
483///
484///
485/// Indicated that code has been debugged by another process that was allowed to do so. The debugger
486/// causes this to be set when it attachs.
487///
488///
489/// Indicates the code is platform code, shipping with the operating system and signed by Apple.
490///
491/// See also [Apple's documentation](https://developer.apple.com/documentation/security/seccodestatus?language=objc)
492// NS_OPTIONS
493#[repr(transparent)]
494#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
495pub struct SecCodeStatus(pub u32);
496bitflags::bitflags! {
497    impl SecCodeStatus: u32 {
498        #[doc(alias = "kSecCodeStatusValid")]
499        const Valid = 0x00000001;
500        #[doc(alias = "kSecCodeStatusHard")]
501        const Hard = 0x00000100;
502        #[doc(alias = "kSecCodeStatusKill")]
503        const Kill = 0x00000200;
504        #[doc(alias = "kSecCodeStatusDebugged")]
505        const Debugged = 0x10000000;
506        #[doc(alias = "kSecCodeStatusPlatform")]
507        const Platform = 0x04000000;
508    }
509}
510
511#[cfg(feature = "objc2")]
512unsafe impl Encode for SecCodeStatus {
513    const ENCODING: Encoding = u32::ENCODING;
514}
515
516#[cfg(feature = "objc2")]
517unsafe impl RefEncode for SecCodeStatus {
518    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
519}
520
521/// An enumeration indicating different types of internal requirements for code.
522///
523/// See also [Apple's documentation](https://developer.apple.com/documentation/security/secrequirementtype?language=objc)
524// NS_ENUM
525#[repr(transparent)]
526#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
527pub struct SecRequirementType(pub u32);
528impl SecRequirementType {
529    #[doc(alias = "kSecHostRequirementType")]
530    pub const HostRequirementType: Self = Self(1);
531    #[doc(alias = "kSecGuestRequirementType")]
532    pub const GuestRequirementType: Self = Self(2);
533    #[doc(alias = "kSecDesignatedRequirementType")]
534    pub const DesignatedRequirementType: Self = Self(3);
535    #[doc(alias = "kSecLibraryRequirementType")]
536    pub const LibraryRequirementType: Self = Self(4);
537    #[doc(alias = "kSecPluginRequirementType")]
538    pub const PluginRequirementType: Self = Self(5);
539    #[doc(alias = "kSecInvalidRequirementType")]
540    pub const InvalidRequirementType: Self = Self(6);
541    #[doc(alias = "kSecRequirementTypeCount")]
542    pub const RequirementTypeCount: Self = Self(SecRequirementType::InvalidRequirementType.0);
543}
544
545#[cfg(feature = "objc2")]
546unsafe impl Encode for SecRequirementType {
547    const ENCODING: Encoding = u32::ENCODING;
548}
549
550#[cfg(feature = "objc2")]
551unsafe impl RefEncode for SecRequirementType {
552    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
553}
554
555/// Types of cryptographic digests (hashes) used to hold code signatures
556/// together.
557///
558/// Each combination of type, length, and other parameters is a separate
559/// hash type; we don't understand "families" here.
560///
561/// These type codes govern the digest links that connect a CodeDirectory
562/// to its subordinate data structures (code pages, resources, etc.)
563/// They do not directly control other uses of hashes (such as those used
564/// within X.509 certificates and CMS blobs).
565///
566/// See also [Apple's documentation](https://developer.apple.com/documentation/security/seccsdigestalgorithm?language=objc)
567// NS_ENUM
568#[repr(transparent)]
569#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
570pub struct SecCSDigestAlgorithm(pub u32);
571impl SecCSDigestAlgorithm {
572    #[doc(alias = "kSecCodeSignatureNoHash")]
573    pub const CodeSignatureNoHash: Self = Self(0);
574    #[doc(alias = "kSecCodeSignatureHashSHA1")]
575    pub const CodeSignatureHashSHA1: Self = Self(1);
576    #[doc(alias = "kSecCodeSignatureHashSHA256")]
577    pub const CodeSignatureHashSHA256: Self = Self(2);
578    #[doc(alias = "kSecCodeSignatureHashSHA256Truncated")]
579    pub const CodeSignatureHashSHA256Truncated: Self = Self(3);
580    #[doc(alias = "kSecCodeSignatureHashSHA384")]
581    pub const CodeSignatureHashSHA384: Self = Self(4);
582    #[doc(alias = "kSecCodeSignatureHashSHA512")]
583    pub const CodeSignatureHashSHA512: Self = Self(5);
584}
585
586#[cfg(feature = "objc2")]
587unsafe impl Encode for SecCSDigestAlgorithm {
588    const ENCODING: Encoding = u32::ENCODING;
589}
590
591#[cfg(feature = "objc2")]
592unsafe impl RefEncode for SecCSDigestAlgorithm {
593    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
594}