objc2_security/generated/SecTransform.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2_core_foundation::*;
6
7use crate::*;
8
9extern "C" {
10 /// The domain for CFErrorRefs created by Transforms
11 ///
12 /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksectransformerrordomain?language=objc)
13 pub static kSecTransformErrorDomain: &'static CFString;
14}
15
16extern "C" {
17 /// If multiple errors occurred, the CFErrorRef that
18 /// is returned from a Transfo]rm API will have a userInfo
19 /// dictionary and that dictionary will have the previous
20 /// error keyed by the kSecTransformPreviousErrorKey.
21 ///
22 /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksectransformpreviouserrorkey?language=objc)
23 pub static kSecTransformPreviousErrorKey: &'static CFString;
24}
25
26extern "C" {
27 /// The value of this key will be the transform that caused
28 /// the transform chain to abort.
29 ///
30 /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksectransformabortoriginatorkey?language=objc)
31 pub static kSecTransformAbortOriginatorKey: &'static CFString;
32}
33
34/// [Apple's documentation](https://developer.apple.com/documentation/security/ksectransformerrorattributenotfound?language=objc)
35#[deprecated = "SecTransform is no longer supported"]
36pub const kSecTransformErrorAttributeNotFound: CFIndex = 1;
37/// [Apple's documentation](https://developer.apple.com/documentation/security/ksectransformerrorinvalidoperation?language=objc)
38#[deprecated = "SecTransform is no longer supported"]
39pub const kSecTransformErrorInvalidOperation: CFIndex = 2;
40/// [Apple's documentation](https://developer.apple.com/documentation/security/ksectransformerrornotinitializedcorrectly?language=objc)
41#[deprecated = "SecTransform is no longer supported"]
42pub const kSecTransformErrorNotInitializedCorrectly: CFIndex = 3;
43/// [Apple's documentation](https://developer.apple.com/documentation/security/ksectransformerrormorethanoneoutput?language=objc)
44#[deprecated = "SecTransform is no longer supported"]
45pub const kSecTransformErrorMoreThanOneOutput: CFIndex = 4;
46/// [Apple's documentation](https://developer.apple.com/documentation/security/ksectransformerrorinvalidinputdictionary?language=objc)
47#[deprecated = "SecTransform is no longer supported"]
48pub const kSecTransformErrorInvalidInputDictionary: CFIndex = 5;
49/// [Apple's documentation](https://developer.apple.com/documentation/security/ksectransformerrorinvalidalgorithm?language=objc)
50#[deprecated = "SecTransform is no longer supported"]
51pub const kSecTransformErrorInvalidAlgorithm: CFIndex = 6;
52/// [Apple's documentation](https://developer.apple.com/documentation/security/ksectransformerrorinvalidlength?language=objc)
53#[deprecated = "SecTransform is no longer supported"]
54pub const kSecTransformErrorInvalidLength: CFIndex = 7;
55/// [Apple's documentation](https://developer.apple.com/documentation/security/ksectransformerrorinvalidtype?language=objc)
56#[deprecated = "SecTransform is no longer supported"]
57pub const kSecTransformErrorInvalidType: CFIndex = 8;
58/// [Apple's documentation](https://developer.apple.com/documentation/security/ksectransformerrorinvalidinput?language=objc)
59#[deprecated = "SecTransform is no longer supported"]
60pub const kSecTransformErrorInvalidInput: CFIndex = 10;
61/// [Apple's documentation](https://developer.apple.com/documentation/security/ksectransformerrornamealreadyregistered?language=objc)
62#[deprecated = "SecTransform is no longer supported"]
63pub const kSecTransformErrorNameAlreadyRegistered: CFIndex = 11;
64/// [Apple's documentation](https://developer.apple.com/documentation/security/ksectransformerrorunsupportedattribute?language=objc)
65#[deprecated = "SecTransform is no longer supported"]
66pub const kSecTransformErrorUnsupportedAttribute: CFIndex = 12;
67/// [Apple's documentation](https://developer.apple.com/documentation/security/ksectransformoperationnotsupportedongroup?language=objc)
68#[deprecated = "SecTransform is no longer supported"]
69pub const kSecTransformOperationNotSupportedOnGroup: CFIndex = 13;
70/// [Apple's documentation](https://developer.apple.com/documentation/security/ksectransformerrormissingparameter?language=objc)
71#[deprecated = "SecTransform is no longer supported"]
72pub const kSecTransformErrorMissingParameter: CFIndex = 14;
73/// [Apple's documentation](https://developer.apple.com/documentation/security/ksectransformerrorinvalidconnection?language=objc)
74#[deprecated = "SecTransform is no longer supported"]
75pub const kSecTransformErrorInvalidConnection: CFIndex = 15;
76/// [Apple's documentation](https://developer.apple.com/documentation/security/ksectransformtransformisexecuting?language=objc)
77#[deprecated = "SecTransform is no longer supported"]
78pub const kSecTransformTransformIsExecuting: CFIndex = 16;
79/// [Apple's documentation](https://developer.apple.com/documentation/security/ksectransforminvalidoverride?language=objc)
80#[deprecated = "SecTransform is no longer supported"]
81pub const kSecTransformInvalidOverride: CFIndex = 17;
82/// [Apple's documentation](https://developer.apple.com/documentation/security/ksectransformtransformisnotregistered?language=objc)
83#[deprecated = "SecTransform is no longer supported"]
84pub const kSecTransformTransformIsNotRegistered: CFIndex = 18;
85/// [Apple's documentation](https://developer.apple.com/documentation/security/ksectransformerrorabortinprogress?language=objc)
86#[deprecated = "SecTransform is no longer supported"]
87pub const kSecTransformErrorAbortInProgress: CFIndex = 19;
88/// [Apple's documentation](https://developer.apple.com/documentation/security/ksectransformerroraborted?language=objc)
89#[deprecated = "SecTransform is no longer supported"]
90pub const kSecTransformErrorAborted: CFIndex = 20;
91/// [Apple's documentation](https://developer.apple.com/documentation/security/ksectransforminvalidargument?language=objc)
92#[deprecated = "SecTransform is no longer supported"]
93pub const kSecTransformInvalidArgument: CFIndex = 21;
94
95/// [Apple's documentation](https://developer.apple.com/documentation/security/sectransform?language=objc)
96pub type SecTransform = CFType;
97
98/// [Apple's documentation](https://developer.apple.com/documentation/security/secgrouptransform?language=objc)
99pub type SecGroupTransform = CFType;
100
101/// Return the CFTypeID for a SecTransform.
102///
103/// Returns: The CFTypeID
104#[deprecated = "SecTransform is no longer supported"]
105#[inline]
106pub extern "C-unwind" fn SecTransformGetTypeID() -> CFTypeID {
107 extern "C-unwind" {
108 fn SecTransformGetTypeID() -> CFTypeID;
109 }
110 unsafe { SecTransformGetTypeID() }
111}
112
113/// Return the CFTypeID for a SecTransformGroup.
114///
115/// Returns: The CFTypeID
116#[deprecated = "SecTransform is no longer supported"]
117#[inline]
118pub extern "C-unwind" fn SecGroupTransformGetTypeID() -> CFTypeID {
119 extern "C-unwind" {
120 fn SecGroupTransformGetTypeID() -> CFTypeID;
121 }
122 unsafe { SecGroupTransformGetTypeID() }
123}
124
125extern "C" {
126 /// ************** Transform Attribute Names ***************
127 ///
128 ///
129 /// The name of the input attribute.
130 ///
131 /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksectransforminputattributename?language=objc)
132 pub static kSecTransformInputAttributeName: &'static CFString;
133}
134
135extern "C" {
136 /// The name of the output attribute.
137 ///
138 /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksectransformoutputattributename?language=objc)
139 pub static kSecTransformOutputAttributeName: &'static CFString;
140}
141
142extern "C" {
143 /// Set this attribute to a CFWriteStream.
144 /// This will signal the transform to write debugging
145 /// information to the stream.
146 /// If this attribute is set to kCFBooleanTrue then
147 /// the debugging data will be written out to
148 /// stderr.
149 ///
150 /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksectransformdebugattributename?language=objc)
151 pub static kSecTransformDebugAttributeName: &'static CFString;
152}
153
154extern "C" {
155 /// The name of the transform.
156 ///
157 /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksectransformtransformname?language=objc)
158 pub static kSecTransformTransformName: &'static CFString;
159}
160
161extern "C" {
162 /// The name of the abort attribute.
163 ///
164 /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksectransformabortattributename?language=objc)
165 pub static kSecTransformAbortAttributeName: &'static CFString;
166}
167
168/// Creates a transform instance from a CFDictionary of
169/// parameters.
170///
171///
172/// Parameter `dictionary`: The dictionary of parameters.
173///
174///
175/// Parameter `error`: An optional pointer to a CFErrorRef. This value is
176/// set if an error occurred. If not NULL the caller is
177/// responsible for releasing the CFErrorRef.
178///
179///
180/// Returns: A pointer to a SecTransformRef object. You
181/// must release the object with CFRelease when you are done
182/// with it. A NULL will be returned if an error occurred during
183/// initialization, and if the error parameter
184/// is non-null, it contains the specific error data.
185#[deprecated = "SecTransform is no longer supported"]
186#[inline]
187pub unsafe extern "C-unwind" fn SecTransformCreateFromExternalRepresentation(
188 dictionary: &CFDictionary,
189 error: *mut *mut CFError,
190) -> Option<CFRetained<SecTransform>> {
191 extern "C-unwind" {
192 fn SecTransformCreateFromExternalRepresentation(
193 dictionary: &CFDictionary,
194 error: *mut *mut CFError,
195 ) -> Option<NonNull<SecTransform>>;
196 }
197 let ret = unsafe { SecTransformCreateFromExternalRepresentation(dictionary, error) };
198 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
199}
200
201/// Create a CFDictionaryRef that contains enough
202/// information to be able to recreate a transform.
203///
204///
205/// Parameter `transformRef`: The transformRef to be externalized.
206///
207///
208/// This function returns a CFDictionaryRef that contains
209/// sufficient information to be able to recreate this
210/// transform. You can pass this CFDictionaryRef to
211/// SecTransformCreateFromExternalRepresentation
212/// to be able to recreate the transform. The dictionary
213/// can also be written out to disk using the techniques
214/// described here.
215///
216/// http://developer.apple.com/mac/library/documentation/CoreFoundation/Conceptual/CFPropertyLists/Articles/Saving.html
217#[deprecated = "SecTransform is no longer supported"]
218#[inline]
219pub unsafe extern "C-unwind" fn SecTransformCopyExternalRepresentation(
220 transform_ref: &SecTransform,
221) -> CFRetained<CFDictionary> {
222 extern "C-unwind" {
223 fn SecTransformCopyExternalRepresentation(
224 transform_ref: &SecTransform,
225 ) -> Option<NonNull<CFDictionary>>;
226 }
227 let ret = unsafe { SecTransformCopyExternalRepresentation(transform_ref) };
228 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
229 unsafe { CFRetained::from_raw(ret) }
230}
231
232/// Create a SecGroupTransformRef that acts as a
233/// container for a set of connected transforms.
234///
235///
236/// Returns: A reference to a SecGroupTransform.
237///
238///
239/// A SecGroupTransformRef is a container for all of
240/// the transforms that are in a directed graph.
241/// A SecGroupTransformRef can be used with
242/// SecTransformExecute, SecTransformExecuteAsync
243/// and SecTransformCopyExternalRepresentation
244/// APIs. While the intention is that a
245/// SecGroupTransformRef willwork just like a S
246/// SecTransformRef that is currently not the case.
247/// Using a SecGroupTransformRef with the
248/// SecTransformConnectTransforms,
249/// SecTransformSetAttribute and
250/// SecTransformGetAttribute is undefined.
251#[deprecated = "SecTransform is no longer supported"]
252#[inline]
253pub unsafe extern "C-unwind" fn SecTransformCreateGroupTransform() -> CFRetained<SecGroupTransform>
254{
255 extern "C-unwind" {
256 fn SecTransformCreateGroupTransform() -> Option<NonNull<SecGroupTransform>>;
257 }
258 let ret = unsafe { SecTransformCreateGroupTransform() };
259 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
260 unsafe { CFRetained::from_raw(ret) }
261}
262
263/// Pipe fitting for transforms.
264///
265///
266/// Parameter `sourceTransformRef`: The transform that sends the data to the
267/// destinationTransformRef.
268///
269///
270/// Parameter `sourceAttributeName`: The name of the attribute in the sourceTransformRef that
271/// supplies the data to the destinationTransformRef.
272/// Any attribute of the transform may be used as a source.
273///
274///
275/// Parameter `destinationTransformRef`: The transform that has one of its attributes
276/// be set with the data from the sourceTransformRef
277/// parameter.
278///
279///
280/// Parameter `destinationAttributeName`: The name of the attribute within the
281/// destinationTransformRef whose data is set with the
282/// data from the sourceTransformRef sourceAttributeName
283/// attribute. Any attribute of the transform may be set.
284///
285///
286/// Parameter `group`: In order to ensure referential integrity, transforms
287/// are chained together into a directed graph and
288/// placed into a group. Each transform that makes up the
289/// graph must be placed into the same group. After
290/// a SecTransformRef has been placed into a group by
291/// calling the SecTransformConnectTransforms it may be
292/// released as the group will retain the transform.
293/// CFRelease the group after you execute
294/// it, or when you determine you will never execute it.
295///
296/// In the example below, the output of trans1 is
297/// set to be the input of trans2. The output of trans2
298/// is set to be the input of trans3. Since the
299/// same group was used for the connections, the three
300/// transforms are in the same group.
301///
302/// <pre>
303///
304/// ```text
305/// SecGroupTransformRef group =SecTransformCreateGroupTransform();
306/// CFErrorRef error = NULL;
307///
308/// SecTransformRef trans1; // previously created using a
309/// // Transform construction API
310/// // like SecEncryptTransformCreate
311///
312/// SecTransformRef trans2; // previously created using a
313/// // Transform construction API
314/// // like SecEncryptTransformCreate
315///
316/// SecTransformRef trans3; // previously created using a
317/// // Transform construction API
318/// // like SecEncryptTransformCreate
319///
320///
321/// SecTransformConnectTransforms(trans1, kSecTransformOutputAttributeName,
322/// trans2, kSecTransformInputAttributeName,
323/// group, &error);
324///
325/// SecTransformConnectTransforms(trans2, kSecTransformOutputAttributeName,
326/// trans3, kSecTransformInputAttributeName.
327/// group, &error);
328/// CFRelease(trans1);
329/// CFRelease(trans2);
330/// CFRelease(trans3);
331///
332/// CFDataRef = (CFDataRef)SecTransformExecute(group, &error, NULL, NULL);
333/// CFRelease(group);
334/// ```
335///
336/// </pre>
337///
338///
339/// Parameter `error`: An optional pointer to a CFErrorRef. This value
340/// is set if an error occurred. If not NULL, the caller
341/// is responsible for releasing the CFErrorRef.
342///
343///
344/// Returns: The value returned is SecGroupTransformRef parameter.
345/// This will allow for chaining calls to
346/// SecTransformConnectTransforms.
347///
348///
349/// This function places transforms into a group by attaching
350/// the value of an attribute of one transform to the
351/// attribute of another transform. Typically the attribute
352/// supplying the data is the kSecTransformAttrOutput
353/// attribute but that is not a requirement. It can be used to
354/// set an attribute like Salt with the output attribute of
355/// a random number transform. This function returns an
356/// error and the named attribute will not be changed if
357/// SecTransformExecute had previously been called on the
358/// transform.
359#[deprecated = "SecTransform is no longer supported"]
360#[inline]
361pub unsafe extern "C-unwind" fn SecTransformConnectTransforms(
362 source_transform_ref: &SecTransform,
363 source_attribute_name: &CFString,
364 destination_transform_ref: &SecTransform,
365 destination_attribute_name: &CFString,
366 group: &SecGroupTransform,
367 error: *mut *mut CFError,
368) -> Option<CFRetained<SecGroupTransform>> {
369 extern "C-unwind" {
370 fn SecTransformConnectTransforms(
371 source_transform_ref: &SecTransform,
372 source_attribute_name: &CFString,
373 destination_transform_ref: &SecTransform,
374 destination_attribute_name: &CFString,
375 group: &SecGroupTransform,
376 error: *mut *mut CFError,
377 ) -> Option<NonNull<SecGroupTransform>>;
378 }
379 let ret = unsafe {
380 SecTransformConnectTransforms(
381 source_transform_ref,
382 source_attribute_name,
383 destination_transform_ref,
384 destination_attribute_name,
385 group,
386 error,
387 )
388 };
389 ret.map(|ret| unsafe { CFRetained::retain(ret) })
390}
391
392/// Set a static value as the value of an attribute in a
393/// transform. This is useful for things like iteration
394/// counts and other non-changing values.
395///
396///
397/// Parameter `transformRef`: The transform whose attribute is to be set.
398///
399///
400/// Parameter `key`: The name of the attribute to be set.
401///
402///
403/// Parameter `value`: The static value to set for the named attribute.
404///
405///
406/// Parameter `error`: An optional pointer to a CFErrorRef. This value
407/// is set if an error occurred. If not NULL the caller
408/// is responsible for releasing the CFErrorRef.
409///
410///
411/// Returns: Returns true if the call succeeded. If an error occurred,
412/// the error parameter has more information
413/// about the failure case.
414///
415///
416/// This API allows for setting static data into an
417/// attribute for a transform. This is in contrast to
418/// the SecTransformConnectTransforms function which sets derived
419/// data. This function will return an error and the
420/// named attribute will not be changed if SecTransformExecute
421/// has been called on the transform.
422#[deprecated = "SecTransform is no longer supported"]
423#[inline]
424pub unsafe extern "C-unwind" fn SecTransformSetAttribute(
425 transform_ref: &SecTransform,
426 key: &CFString,
427 value: &CFType,
428 error: *mut *mut CFError,
429) -> bool {
430 extern "C-unwind" {
431 fn SecTransformSetAttribute(
432 transform_ref: &SecTransform,
433 key: &CFString,
434 value: &CFType,
435 error: *mut *mut CFError,
436 ) -> Boolean;
437 }
438 let ret = unsafe { SecTransformSetAttribute(transform_ref, key, value, error) };
439 ret != 0
440}
441
442/// Get the current value of a transform attribute.
443///
444///
445/// Parameter `transformRef`: The transform whose attribute value will be retrieved.
446///
447///
448/// Parameter `key`: The name of the attribute to retrieve.
449///
450///
451/// Returns: The value of an attribute. If this attribute
452/// is being set as the output of another transform
453/// and SecTransformExecute has not been called on the
454/// transform or if the attribute does not exists
455/// then NULL will be returned.
456///
457///
458/// This may be called after SecTransformExecute.
459#[deprecated = "SecTransform is no longer supported"]
460#[inline]
461pub unsafe extern "C-unwind" fn SecTransformGetAttribute(
462 transform_ref: &SecTransform,
463 key: &CFString,
464) -> Option<CFRetained<CFType>> {
465 extern "C-unwind" {
466 fn SecTransformGetAttribute(
467 transform_ref: &SecTransform,
468 key: &CFString,
469 ) -> Option<NonNull<CFType>>;
470 }
471 let ret = unsafe { SecTransformGetAttribute(transform_ref, key) };
472 ret.map(|ret| unsafe { CFRetained::retain(ret) })
473}
474
475/// Finds a member of a transform group by its name.
476///
477///
478/// Parameter `transform`: The transform group to be searched.
479///
480///
481/// Parameter `name`: The name of the transform to be found.
482///
483///
484/// When a transform instance is created it will be given a
485/// unique name. This name can be used to find that instance
486/// in a group. While it is possible to change this unique
487/// name using the SecTransformSetAttribute API, developers
488/// should not do so. This allows
489/// SecTransformFindTransformByName to work correctly.
490///
491///
492/// Returns: The transform group member, or NULL if the member
493/// was not found.
494#[deprecated = "SecTransform is no longer supported"]
495#[inline]
496pub unsafe extern "C-unwind" fn SecTransformFindByName(
497 transform: &SecGroupTransform,
498 name: &CFString,
499) -> Option<CFRetained<SecTransform>> {
500 extern "C-unwind" {
501 fn SecTransformFindByName(
502 transform: &SecGroupTransform,
503 name: &CFString,
504 ) -> Option<NonNull<SecTransform>>;
505 }
506 let ret = unsafe { SecTransformFindByName(transform, name) };
507 ret.map(|ret| unsafe { CFRetained::retain(ret) })
508}
509
510/// Executes a Transform or transform group synchronously.
511///
512///
513/// Parameter `transformRef`: The transform to execute.
514///
515///
516/// Parameter `errorRef`: An optional pointer to a CFErrorRef. This value
517/// will be set if an error occurred during
518/// initialization or execution of the transform or group.
519/// If not NULL the caller will be responsible for releasing
520/// the returned CFErrorRef.
521///
522///
523/// Returns: This is the result of the transform. The specific value
524/// is determined by the transform being executed.
525///
526///
527/// There are two phases that occur when executing a
528/// transform. The first phase checks to see if the tranforms
529/// have all of their required attributes set.
530/// If a GroupTransform is being executed, then a required
531/// attribute for a transform is valid if it is connected
532/// to another attribute that supplies the required value.
533/// If any of the required attributes are not set or connected
534/// then SecTransformExecute will not run the transform but will
535/// return NULL and the apporiate error is placed in the
536/// error parameter if it is not NULL.
537///
538/// The second phase is the actual execution of the transform.
539/// SecTransformExecute executes the transform or
540/// GroupTransform and when all of the processing is completed
541/// it returns the result. If an error occurs during
542/// execution, then all processing will stop and NULL will be
543/// returned and the appropriate error will be placed in the
544/// error parameter if it is not NULL.
545#[deprecated = "SecTransform is no longer supported"]
546#[inline]
547pub unsafe extern "C-unwind" fn SecTransformExecute(
548 transform_ref: &SecTransform,
549 error_ref: *mut *mut CFError,
550) -> CFRetained<CFType> {
551 extern "C-unwind" {
552 fn SecTransformExecute(
553 transform_ref: &SecTransform,
554 error_ref: *mut *mut CFError,
555 ) -> Option<NonNull<CFType>>;
556 }
557 let ret = unsafe { SecTransformExecute(transform_ref, error_ref) };
558 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
559 unsafe { CFRetained::from_raw(ret) }
560}
561
562/// A SecMessageBlock is used by a transform instance to
563/// deliver messages during asynchronous operations.
564///
565///
566/// Parameter `message`: A CFType containing the message. This is where
567/// either intermediate or final results are returned.
568///
569///
570/// Parameter `error`: If an error occurred, this will contain a CFErrorRef,
571/// otherwise this will be NULL. If not NULL the caller
572/// is responsible for releasing the CFErrorRef.
573///
574///
575/// Parameter `isFinal`: If set the message returned is the final result
576/// otherwise it is an intermediate result.
577///
578/// See also [Apple's documentation](https://developer.apple.com/documentation/security/secmessageblock?language=objc)
579#[cfg(feature = "block2")]
580pub type SecMessageBlock = *mut block2::Block<dyn Fn(*const CFType, *mut CFError, Boolean)>;