objc2_security/generated/
SecCode.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 SecCode {
10    /// Returns the type identifier of all SecCode instances.
11    #[doc(alias = "SecCodeGetTypeID")]
12    #[inline]
13    fn type_id() -> CFTypeID {
14        extern "C-unwind" {
15            fn SecCodeGetTypeID() -> CFTypeID;
16        }
17        unsafe { SecCodeGetTypeID() }
18    }
19}
20
21#[cfg(feature = "CSCommon")]
22impl SecCode {
23    /// Obtains a SecCode object for the code making the call.
24    /// The calling code is determined in a way that is subject to modification over
25    /// time, but obeys the following rules. If it is a UNIX process, its process id (pid)
26    /// is always used.
27    ///
28    ///
29    /// Parameter `flags`: Optional flags. Pass kSecCSDefaultFlags for standard behavior.
30    ///
31    /// Parameter `self`: Upon successful return, contains a SecCodeRef representing the caller.
32    ///
33    ///
34    /// Returns: Upon success, errSecSuccess. Upon error, an OSStatus value documented in
35    /// CSCommon.h or certain other Security framework headers.
36    ///
37    /// # Safety
38    ///
39    /// `self` must be a valid pointer.
40    #[doc(alias = "SecCodeCopySelf")]
41    #[cfg(feature = "CSCommon")]
42    #[inline]
43    pub unsafe fn copy_self(flags: SecCSFlags, self_: NonNull<*mut SecCode>) -> OSStatus {
44        extern "C-unwind" {
45            fn SecCodeCopySelf(flags: SecCSFlags, self_: NonNull<*mut SecCode>) -> OSStatus;
46        }
47        unsafe { SecCodeCopySelf(flags, self_) }
48    }
49}
50
51/// [Apple's documentation](https://developer.apple.com/documentation/security/kseccsuseallarchitectures?language=objc)
52pub const kSecCSUseAllArchitectures: u32 = 1;
53
54#[cfg(feature = "CSCommon")]
55impl SecCode {
56    /// # Safety
57    ///
58    /// `static_code` must be a valid pointer.
59    #[doc(alias = "SecCodeCopyStaticCode")]
60    #[cfg(feature = "CSCommon")]
61    #[inline]
62    pub unsafe fn copy_static_code(
63        &self,
64        flags: SecCSFlags,
65        static_code: NonNull<*const SecStaticCode>,
66    ) -> OSStatus {
67        extern "C-unwind" {
68            fn SecCodeCopyStaticCode(
69                code: &SecCode,
70                flags: SecCSFlags,
71                static_code: NonNull<*const SecStaticCode>,
72            ) -> OSStatus;
73        }
74        unsafe { SecCodeCopyStaticCode(self, flags, static_code) }
75    }
76
77    /// Given a SecCode object, identify the (different) SecCode object that acts
78    /// as its host. A SecCode's host acts as a supervisor and controller,
79    /// and is the ultimate authority on the its dynamic validity and status.
80    /// The host relationship is securely established (absent reported errors).
81    ///
82    ///
83    /// Parameter `guest`: A valid SecCode object reference representing code running
84    /// on the system.
85    ///
86    /// Parameter `flags`: Optional flags. Pass kSecCSDefaultFlags for standard behavior.
87    ///
88    /// Parameter `host`: On successful return, a SecCode object reference identifying
89    /// the code's host.
90    ///
91    /// Returns: Upon success, errSecSuccess. Upon error, an OSStatus value documented in
92    /// CSCommon.h or certain other Security framework headers.
93    ///
94    /// # Safety
95    ///
96    /// `host` must be a valid pointer.
97    #[doc(alias = "SecCodeCopyHost")]
98    #[cfg(feature = "CSCommon")]
99    #[inline]
100    pub unsafe fn copy_host(&self, flags: SecCSFlags, host: NonNull<*mut SecCode>) -> OSStatus {
101        extern "C-unwind" {
102            fn SecCodeCopyHost(
103                guest: &SecCode,
104                flags: SecCSFlags,
105                host: NonNull<*mut SecCode>,
106            ) -> OSStatus;
107        }
108        unsafe { SecCodeCopyHost(self, flags, host) }
109    }
110}
111
112extern "C" {
113    /// [Apple's documentation](https://developer.apple.com/documentation/security/ksecguestattributecanonical?language=objc)
114    pub static kSecGuestAttributeCanonical: &'static CFString;
115}
116
117extern "C" {
118    /// [Apple's documentation](https://developer.apple.com/documentation/security/ksecguestattributehash?language=objc)
119    pub static kSecGuestAttributeHash: &'static CFString;
120}
121
122extern "C" {
123    /// [Apple's documentation](https://developer.apple.com/documentation/security/ksecguestattributemachport?language=objc)
124    pub static kSecGuestAttributeMachPort: &'static CFString;
125}
126
127extern "C" {
128    /// [Apple's documentation](https://developer.apple.com/documentation/security/ksecguestattributepid?language=objc)
129    pub static kSecGuestAttributePid: &'static CFString;
130}
131
132extern "C" {
133    /// [Apple's documentation](https://developer.apple.com/documentation/security/ksecguestattributeaudit?language=objc)
134    pub static kSecGuestAttributeAudit: &'static CFString;
135}
136
137extern "C" {
138    /// [Apple's documentation](https://developer.apple.com/documentation/security/ksecguestattributedynamiccode?language=objc)
139    pub static kSecGuestAttributeDynamicCode: &'static CFString;
140}
141
142extern "C" {
143    /// [Apple's documentation](https://developer.apple.com/documentation/security/ksecguestattributedynamiccodeinfoplist?language=objc)
144    pub static kSecGuestAttributeDynamicCodeInfoPlist: &'static CFString;
145}
146
147extern "C" {
148    /// [Apple's documentation](https://developer.apple.com/documentation/security/ksecguestattributearchitecture?language=objc)
149    pub static kSecGuestAttributeArchitecture: &'static CFString;
150}
151
152extern "C" {
153    /// [Apple's documentation](https://developer.apple.com/documentation/security/ksecguestattributesubarchitecture?language=objc)
154    pub static kSecGuestAttributeSubarchitecture: &'static CFString;
155}
156
157#[cfg(feature = "CSCommon")]
158impl SecCode {
159    /// This is the omnibus API function for obtaining dynamic code references.
160    /// In general, it asks a particular code acting as a code host to locate
161    /// and return a guest with given attributes. Different hosts support
162    /// different combinations of attributes and values for guest selection.
163    ///
164    /// Asking the NULL host invokes system default    procedures for obtaining
165    /// any running code in the system with the    attributes given. The returned
166    /// code may be anywhere in the system.
167    ///
168    /// The methods a host uses to identify, separate, and control its guests
169    /// are specific to each type of host. This call provides a generic abstraction layer
170    /// that allows uniform interrogation of all hosts. A SecCode that does not
171    /// act as a host will always return errSecCSNoSuchCode. A SecCode that does
172    /// support hosting may return itself to signify that the attribute refers to
173    /// itself rather than one of its hosts.
174    ///
175    ///
176    /// Parameter `host`: A valid SecCode object reference representing code running
177    /// on the system that acts as a Code Signing host. As a special case, passing
178    /// NULL indicates that the Code Signing root of trust should be used as a starting
179    /// point. Currently, that is the system kernel.
180    ///
181    /// Parameter `attributes`: A CFDictionary containing zero or more attribute selector
182    /// values. Each selector has a CFString key and associated CFTypeRef value.
183    /// The key name identifies the attribute being specified; the associated value,
184    /// whose type depends on the the key name, selects a particular value or other
185    /// constraint on that attribute. Each host only supports particular combinations
186    /// of keys and values,    and errors will be returned if any unsupported set is requested.
187    /// As a special case, NULL is taken to mean an empty attribute set.
188    /// Note that some hosts that support hosting chains (guests being hosts)
189    /// may return sub-guests in this call. In other words, do not assume that
190    /// a SecCodeRef returned by this call is a direct guest of the queried host
191    /// (though it will be a proximate guest, i.e. a guest's guest some way down).
192    /// Asking the NULL host for NULL attributes returns a code reference for the system root
193    /// of trust (at present, the running Darwin kernel).
194    ///
195    /// Parameter `flags`: Optional flags. Pass kSecCSDefaultFlags for standard behavior.
196    ///
197    /// Parameter `guest`: On successful return, a SecCode object reference identifying
198    /// the particular guest of the host that owns the attribute value(s) specified.
199    /// This argument will not be changed if the call fails (does not return errSecSuccess).
200    ///
201    /// Returns: Upon success, errSecSuccess. Upon error, an OSStatus value documented in
202    /// CSCommon.h or certain other Security framework headers. In particular:
203    /// errSecCSUnsupportedGuestAttributes The host does not support the attribute
204    /// type given by attributeType.
205    /// errSecCSInvalidAttributeValues The type of value given for a guest
206    /// attribute is not supported by the host.
207    /// errSecCSNoSuchCode The host has no guest with the attribute value given
208    /// by attributeValue, even though the value is of a supported type. This may also
209    /// be returned if the host code does not currently act as a Code Signing host.
210    /// errSecCSNotAHost The specified host cannot, in fact, act as a code
211    /// host. (It is missing the kSecCodeSignatureHost option flag in its code
212    /// signature.)
213    /// errSecCSMultipleGuests The attributes specified do not uniquely identify
214    /// a guest (the specification is ambiguous).
215    ///
216    /// # Safety
217    ///
218    /// - `attributes` generics must be of the correct type.
219    /// - `guest` must be a valid pointer.
220    #[doc(alias = "SecCodeCopyGuestWithAttributes")]
221    #[cfg(feature = "CSCommon")]
222    #[inline]
223    pub unsafe fn copy_guest_with_attributes(
224        host: Option<&SecCode>,
225        attributes: Option<&CFDictionary>,
226        flags: SecCSFlags,
227        guest: NonNull<*mut SecCode>,
228    ) -> OSStatus {
229        extern "C-unwind" {
230            fn SecCodeCopyGuestWithAttributes(
231                host: Option<&SecCode>,
232                attributes: Option<&CFDictionary>,
233                flags: SecCSFlags,
234                guest: NonNull<*mut SecCode>,
235            ) -> OSStatus;
236        }
237        unsafe { SecCodeCopyGuestWithAttributes(host, attributes, flags, guest) }
238    }
239
240    /// Performs dynamic validation of the given SecCode object. The call obtains and
241    /// verifies the signature on the code object. It checks the validity of only those
242    /// sealed components required to establish identity. It checks the SecCode's
243    /// dynamic validity status as reported by its host. It ensures that the SecCode's
244    /// host is in turn valid. Finally, it validates the code against a SecRequirement
245    /// if one is given. The call succeeds if all these conditions are satisfactory.
246    /// It fails otherwise.
247    ///
248    /// This call is secure against attempts to modify the file system source of the
249    /// SecCode.
250    ///
251    ///
252    /// Parameter `code`: The code object to be validated.
253    ///
254    /// Parameter `flags`: Optional flags. Pass kSecCSDefaultFlags for standard behavior.
255    ///
256    /// Parameter `requirement`: An optional code requirement specifying additional conditions
257    /// the code object must satisfy to be considered valid. If NULL, no additional
258    /// requirements are imposed.
259    ///
260    /// Returns: If validation passes, errSecSuccess. If validation fails, an OSStatus value
261    /// documented in CSCommon.h or certain other Security framework headers.
262    #[doc(alias = "SecCodeCheckValidity")]
263    #[cfg(feature = "CSCommon")]
264    #[inline]
265    pub unsafe fn check_validity(
266        &self,
267        flags: SecCSFlags,
268        requirement: Option<&SecRequirement>,
269    ) -> OSStatus {
270        extern "C-unwind" {
271            fn SecCodeCheckValidity(
272                code: &SecCode,
273                flags: SecCSFlags,
274                requirement: Option<&SecRequirement>,
275            ) -> OSStatus;
276        }
277        unsafe { SecCodeCheckValidity(self, flags, requirement) }
278    }
279
280    /// Performs dynamic validation of the given SecCode object. The call obtains and
281    /// verifies the signature on the code object. It checks the validity of only those
282    /// sealed components required to establish identity. It checks the SecCode's
283    /// dynamic validity status as reported by its host. It ensures that the SecCode's
284    /// host is in turn valid. Finally, it validates the code against a SecRequirement
285    /// if one is given. The call succeeds if all these conditions are satisfactory.
286    /// It fails otherwise.
287    ///
288    /// This call is secure against attempts to modify the file system source of the
289    /// SecCode.
290    ///
291    ///
292    /// Parameter `code`: The code object to be validated.
293    ///
294    /// Parameter `flags`: Optional flags. Pass kSecCSDefaultFlags for standard behavior.
295    ///
296    /// Parameter `requirement`: An optional code requirement specifying additional conditions
297    /// the code object must satisfy to be considered valid. If NULL, no additional
298    /// requirements are imposed.
299    ///
300    /// Parameter `errors`: An optional pointer to a CFErrorRef variable. If the call fails
301    /// (and something other than errSecSuccess is returned), and this argument is non-NULL,
302    /// a CFErrorRef is stored there further describing the nature and circumstances
303    /// of the failure. The caller must CFRelease() this error object when done with it.
304    ///
305    /// Returns: If validation passes, errSecSuccess. If validation fails, an OSStatus value
306    /// documented in CSCommon.h or certain other Security framework headers.
307    ///
308    /// # Safety
309    ///
310    /// `errors` must be a valid pointer or null.
311    #[doc(alias = "SecCodeCheckValidityWithErrors")]
312    #[cfg(feature = "CSCommon")]
313    #[inline]
314    pub unsafe fn check_validity_with_errors(
315        &self,
316        flags: SecCSFlags,
317        requirement: Option<&SecRequirement>,
318        errors: *mut *mut CFError,
319    ) -> OSStatus {
320        extern "C-unwind" {
321            fn SecCodeCheckValidityWithErrors(
322                code: &SecCode,
323                flags: SecCSFlags,
324                requirement: Option<&SecRequirement>,
325                errors: *mut *mut CFError,
326            ) -> OSStatus;
327        }
328        unsafe { SecCodeCheckValidityWithErrors(self, flags, requirement, errors) }
329    }
330
331    /// For a SecStaticCodeRef, check that a given CFData object faithfully represents
332    /// a plain-file resource in its resource seal.
333    /// This call will fail if the file is missing in the bundle, even if it is optional.
334    ///
335    ///
336    /// Parameter `code`: A code or StaticCode object.
337    ///
338    /// Parameter `relativePath`: A CFStringRef containing the relative path to a sealed resource
339    /// file. This path is relative to the resource base, which is either Contents or
340    /// the bundle root, depending on bundle format.
341    ///
342    /// Parameter `fileData`: A CFDataRef containing the exact contents of that resource file.
343    ///
344    /// Parameter `flags`: Pass kSecCSDefaultFlags.
345    ///
346    /// Returns: noErr if fileData is the exact content of the file at relativePath at the
347    /// time it was signed. Various error codes if it is different, there was no such file,
348    /// it was not a plain file, or anything is irregular.
349    #[doc(alias = "SecCodeValidateFileResource")]
350    #[cfg(feature = "CSCommon")]
351    #[inline]
352    pub unsafe fn validate_file_resource(
353        code: &SecStaticCode,
354        relative_path: &CFString,
355        file_data: &CFData,
356        flags: SecCSFlags,
357    ) -> OSStatus {
358        extern "C-unwind" {
359            fn SecCodeValidateFileResource(
360                code: &SecStaticCode,
361                relative_path: &CFString,
362                file_data: &CFData,
363                flags: SecCSFlags,
364            ) -> OSStatus;
365        }
366        unsafe { SecCodeValidateFileResource(code, relative_path, file_data, flags) }
367    }
368
369    /// For a given Code or StaticCode object, returns a URL to a location on disk where the
370    /// code object can be found. For single files, the URL points to that file.
371    /// For bundles, it points to the directory containing the entire bundle.
372    ///
373    ///
374    /// Parameter `staticCode`: The Code or StaticCode object to be located. For a Code
375    /// argument, its StaticCode is processed as per SecCodeCopyStaticCode.
376    ///
377    /// Parameter `flags`: Optional flags. Pass kSecCSDefaultFlags for standard behavior.
378    ///
379    /// Parameter `path`: On successful return, contains a CFURL identifying the location
380    /// on disk of the staticCode object.
381    ///
382    /// Returns: On success, errSecSuccess. On error, an OSStatus value
383    /// documented in CSCommon.h or certain other Security framework headers.
384    ///
385    /// # Safety
386    ///
387    /// `path` must be a valid pointer.
388    #[doc(alias = "SecCodeCopyPath")]
389    #[cfg(feature = "CSCommon")]
390    #[inline]
391    pub unsafe fn copy_path(
392        static_code: &SecStaticCode,
393        flags: SecCSFlags,
394        path: NonNull<*const CFURL>,
395    ) -> OSStatus {
396        extern "C-unwind" {
397            fn SecCodeCopyPath(
398                static_code: &SecStaticCode,
399                flags: SecCSFlags,
400                path: NonNull<*const CFURL>,
401            ) -> OSStatus;
402        }
403        unsafe { SecCodeCopyPath(static_code, flags, path) }
404    }
405
406    /// For a given Code or StaticCode object, determines its Designated Code Requirement.
407    /// The Designated Requirement is the SecRequirement that the code believes
408    /// should be used to properly identify it in the future.
409    ///
410    /// If the SecCode contains an explicit Designated Requirement, a copy of that
411    /// is returned. If it does not, a SecRequirement is implicitly constructed from
412    /// its signing authority and its embedded unique identifier. No Designated
413    /// Requirement can be obtained from code that is unsigned. Code that is modified
414    /// after signature, improperly signed, or has become invalid, may or may not yield
415    /// a Designated Requirement. This call does not validate the SecStaticCode argument.
416    ///
417    ///
418    /// Parameter `code`: The Code or StaticCode object to be interrogated. For a Code
419    /// argument, its StaticCode is processed as per SecCodeCopyStaticCode.
420    ///
421    /// Parameter `flags`: Optional flags. Pass kSecCSDefaultFlags for standard behavior.
422    ///
423    /// Parameter `requirement`: On successful return, contains a copy of a SecRequirement
424    /// object representing the code's Designated Requirement. On error, unchanged.
425    ///
426    /// Returns: On success, errSecSuccess. On error, an OSStatus value
427    /// documented in CSCommon.h or certain other Security framework headers.
428    ///
429    /// # Safety
430    ///
431    /// `requirement` must be a valid pointer.
432    #[doc(alias = "SecCodeCopyDesignatedRequirement")]
433    #[cfg(feature = "CSCommon")]
434    #[inline]
435    pub unsafe fn copy_designated_requirement(
436        code: &SecStaticCode,
437        flags: SecCSFlags,
438        requirement: NonNull<*mut SecRequirement>,
439    ) -> OSStatus {
440        extern "C-unwind" {
441            fn SecCodeCopyDesignatedRequirement(
442                code: &SecStaticCode,
443                flags: SecCSFlags,
444                requirement: NonNull<*mut SecRequirement>,
445            ) -> OSStatus;
446        }
447        unsafe { SecCodeCopyDesignatedRequirement(code, flags, requirement) }
448    }
449}
450
451/// [Apple's documentation](https://developer.apple.com/documentation/security/kseccsinternalinformation?language=objc)
452pub const kSecCSInternalInformation: u32 = 1;
453/// [Apple's documentation](https://developer.apple.com/documentation/security/kseccssigninginformation?language=objc)
454pub const kSecCSSigningInformation: u32 = 2;
455/// [Apple's documentation](https://developer.apple.com/documentation/security/kseccsrequirementinformation?language=objc)
456pub const kSecCSRequirementInformation: u32 = 4;
457/// [Apple's documentation](https://developer.apple.com/documentation/security/kseccsdynamicinformation?language=objc)
458pub const kSecCSDynamicInformation: u32 = 8;
459/// [Apple's documentation](https://developer.apple.com/documentation/security/kseccscontentinformation?language=objc)
460pub const kSecCSContentInformation: u32 = 16;
461/// [Apple's documentation](https://developer.apple.com/documentation/security/kseccsskipresourcedirectory?language=objc)
462pub const kSecCSSkipResourceDirectory: u32 = 32;
463/// [Apple's documentation](https://developer.apple.com/documentation/security/kseccscalculatecmsdigest?language=objc)
464pub const kSecCSCalculateCMSDigest: u32 = 64;
465
466extern "C" {
467    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccodeinfocertificates?language=objc)
468    pub static kSecCodeInfoCertificates: &'static CFString;
469}
470
471extern "C" {
472    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccodeinfochangedfiles?language=objc)
473    pub static kSecCodeInfoChangedFiles: &'static CFString;
474}
475
476extern "C" {
477    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccodeinfocms?language=objc)
478    pub static kSecCodeInfoCMS: &'static CFString;
479}
480
481extern "C" {
482    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccodeinfodesignatedrequirement?language=objc)
483    pub static kSecCodeInfoDesignatedRequirement: &'static CFString;
484}
485
486extern "C" {
487    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccodeinfoentitlements?language=objc)
488    pub static kSecCodeInfoEntitlements: &'static CFString;
489}
490
491extern "C" {
492    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccodeinfoentitlementsdict?language=objc)
493    pub static kSecCodeInfoEntitlementsDict: &'static CFString;
494}
495
496extern "C" {
497    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccodeinfoflags?language=objc)
498    pub static kSecCodeInfoFlags: &'static CFString;
499}
500
501extern "C" {
502    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccodeinfoformat?language=objc)
503    pub static kSecCodeInfoFormat: &'static CFString;
504}
505
506extern "C" {
507    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccodeinfodigestalgorithm?language=objc)
508    pub static kSecCodeInfoDigestAlgorithm: &'static CFString;
509}
510
511extern "C" {
512    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccodeinfodigestalgorithms?language=objc)
513    pub static kSecCodeInfoDigestAlgorithms: &'static CFString;
514}
515
516extern "C" {
517    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccodeinfoplatformidentifier?language=objc)
518    pub static kSecCodeInfoPlatformIdentifier: &'static CFString;
519}
520
521extern "C" {
522    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccodeinfoidentifier?language=objc)
523    pub static kSecCodeInfoIdentifier: &'static CFString;
524}
525
526extern "C" {
527    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccodeinfoimplicitdesignatedrequirement?language=objc)
528    pub static kSecCodeInfoImplicitDesignatedRequirement: &'static CFString;
529}
530
531extern "C" {
532    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccodeinfodefaultdesignatedlightweightcoderequirement?language=objc)
533    pub static kSecCodeInfoDefaultDesignatedLightweightCodeRequirement: &'static CFString;
534}
535
536extern "C" {
537    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccodeinfomainexecutable?language=objc)
538    pub static kSecCodeInfoMainExecutable: &'static CFString;
539}
540
541extern "C" {
542    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccodeinfoplist?language=objc)
543    pub static kSecCodeInfoPList: &'static CFString;
544}
545
546extern "C" {
547    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccodeinforequirements?language=objc)
548    pub static kSecCodeInfoRequirements: &'static CFString;
549}
550
551extern "C" {
552    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccodeinforequirementdata?language=objc)
553    pub static kSecCodeInfoRequirementData: &'static CFString;
554}
555
556extern "C" {
557    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccodeinfosource?language=objc)
558    pub static kSecCodeInfoSource: &'static CFString;
559}
560
561extern "C" {
562    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccodeinfostatus?language=objc)
563    pub static kSecCodeInfoStatus: &'static CFString;
564}
565
566extern "C" {
567    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccodeinfoteamidentifier?language=objc)
568    pub static kSecCodeInfoTeamIdentifier: &'static CFString;
569}
570
571extern "C" {
572    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccodeinfotime?language=objc)
573    pub static kSecCodeInfoTime: &'static CFString;
574}
575
576extern "C" {
577    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccodeinfotimestamp?language=objc)
578    pub static kSecCodeInfoTimestamp: &'static CFString;
579}
580
581extern "C" {
582    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccodeinfotrust?language=objc)
583    pub static kSecCodeInfoTrust: &'static CFString;
584}
585
586extern "C" {
587    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccodeinfounique?language=objc)
588    pub static kSecCodeInfoUnique: &'static CFString;
589}
590
591extern "C" {
592    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccodeinfocdhashes?language=objc)
593    pub static kSecCodeInfoCdHashes: &'static CFString;
594}
595
596extern "C" {
597    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccodeinforuntimeversion?language=objc)
598    pub static kSecCodeInfoRuntimeVersion: &'static CFString;
599}
600
601extern "C" {
602    /// [Apple's documentation](https://developer.apple.com/documentation/security/kseccodeinfostaplednotarizationticket?language=objc)
603    pub static kSecCodeInfoStapledNotarizationTicket: &'static CFString;
604}
605
606#[cfg(feature = "CSCommon")]
607impl SecCode {
608    /// # Safety
609    ///
610    /// `information` must be a valid pointer.
611    #[doc(alias = "SecCodeCopySigningInformation")]
612    #[cfg(feature = "CSCommon")]
613    #[inline]
614    pub unsafe fn copy_signing_information(
615        code: &SecStaticCode,
616        flags: SecCSFlags,
617        information: NonNull<*const CFDictionary>,
618    ) -> OSStatus {
619        extern "C-unwind" {
620            fn SecCodeCopySigningInformation(
621                code: &SecStaticCode,
622                flags: SecCSFlags,
623                information: NonNull<*const CFDictionary>,
624            ) -> OSStatus;
625        }
626        unsafe { SecCodeCopySigningInformation(code, flags, information) }
627    }
628
629    #[doc(alias = "SecCodeMapMemory")]
630    #[cfg(feature = "CSCommon")]
631    #[inline]
632    pub unsafe fn map_memory(code: &SecStaticCode, flags: SecCSFlags) -> OSStatus {
633        extern "C-unwind" {
634            fn SecCodeMapMemory(code: &SecStaticCode, flags: SecCSFlags) -> OSStatus;
635        }
636        unsafe { SecCodeMapMemory(code, flags) }
637    }
638}
639
640extern "C-unwind" {
641    #[cfg(feature = "CSCommon")]
642    #[deprecated = "renamed to `SecCode::copy_self`"]
643    pub fn SecCodeCopySelf(flags: SecCSFlags, self_: NonNull<*mut SecCode>) -> OSStatus;
644}
645
646extern "C-unwind" {
647    #[cfg(feature = "CSCommon")]
648    #[deprecated = "renamed to `SecCode::copy_static_code`"]
649    pub fn SecCodeCopyStaticCode(
650        code: &SecCode,
651        flags: SecCSFlags,
652        static_code: NonNull<*const SecStaticCode>,
653    ) -> OSStatus;
654}
655
656extern "C-unwind" {
657    #[cfg(feature = "CSCommon")]
658    #[deprecated = "renamed to `SecCode::copy_host`"]
659    pub fn SecCodeCopyHost(
660        guest: &SecCode,
661        flags: SecCSFlags,
662        host: NonNull<*mut SecCode>,
663    ) -> OSStatus;
664}
665
666extern "C-unwind" {
667    #[cfg(feature = "CSCommon")]
668    #[deprecated = "renamed to `SecCode::copy_guest_with_attributes`"]
669    pub fn SecCodeCopyGuestWithAttributes(
670        host: Option<&SecCode>,
671        attributes: Option<&CFDictionary>,
672        flags: SecCSFlags,
673        guest: NonNull<*mut SecCode>,
674    ) -> OSStatus;
675}
676
677extern "C-unwind" {
678    #[cfg(feature = "CSCommon")]
679    #[deprecated = "renamed to `SecCode::check_validity`"]
680    pub fn SecCodeCheckValidity(
681        code: &SecCode,
682        flags: SecCSFlags,
683        requirement: Option<&SecRequirement>,
684    ) -> OSStatus;
685}
686
687extern "C-unwind" {
688    #[cfg(feature = "CSCommon")]
689    #[deprecated = "renamed to `SecCode::check_validity_with_errors`"]
690    pub fn SecCodeCheckValidityWithErrors(
691        code: &SecCode,
692        flags: SecCSFlags,
693        requirement: Option<&SecRequirement>,
694        errors: *mut *mut CFError,
695    ) -> OSStatus;
696}
697
698extern "C-unwind" {
699    #[cfg(feature = "CSCommon")]
700    #[deprecated = "renamed to `SecCode::validate_file_resource`"]
701    pub fn SecCodeValidateFileResource(
702        code: &SecStaticCode,
703        relative_path: &CFString,
704        file_data: &CFData,
705        flags: SecCSFlags,
706    ) -> OSStatus;
707}
708
709extern "C-unwind" {
710    #[cfg(feature = "CSCommon")]
711    #[deprecated = "renamed to `SecCode::copy_path`"]
712    pub fn SecCodeCopyPath(
713        static_code: &SecStaticCode,
714        flags: SecCSFlags,
715        path: NonNull<*const CFURL>,
716    ) -> OSStatus;
717}
718
719extern "C-unwind" {
720    #[cfg(feature = "CSCommon")]
721    #[deprecated = "renamed to `SecCode::copy_designated_requirement`"]
722    pub fn SecCodeCopyDesignatedRequirement(
723        code: &SecStaticCode,
724        flags: SecCSFlags,
725        requirement: NonNull<*mut SecRequirement>,
726    ) -> OSStatus;
727}
728
729extern "C-unwind" {
730    #[cfg(feature = "CSCommon")]
731    #[deprecated = "renamed to `SecCode::copy_signing_information`"]
732    pub fn SecCodeCopySigningInformation(
733        code: &SecStaticCode,
734        flags: SecCSFlags,
735        information: NonNull<*const CFDictionary>,
736    ) -> OSStatus;
737}
738
739extern "C-unwind" {
740    #[cfg(feature = "CSCommon")]
741    #[deprecated = "renamed to `SecCode::map_memory`"]
742    pub fn SecCodeMapMemory(code: &SecStaticCode, flags: SecCSFlags) -> OSStatus;
743}