objc2_security/generated/
SecDigestTransform.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
8extern "C" {
9    /// Specifies an MD2 digest
10    ///
11    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecdigestmd2?language=objc)
12    #[deprecated = "SecTransform is no longer supported"]
13    pub static kSecDigestMD2: &'static CFString;
14}
15
16extern "C" {
17    /// Specifies an MD4 digest
18    ///
19    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecdigestmd4?language=objc)
20    #[deprecated = "SecTransform is no longer supported"]
21    pub static kSecDigestMD4: &'static CFString;
22}
23
24extern "C" {
25    /// Specifies an MD5 digest
26    ///
27    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecdigestmd5?language=objc)
28    #[deprecated = "SecTransform is no longer supported"]
29    pub static kSecDigestMD5: &'static CFString;
30}
31
32extern "C" {
33    /// Specifies a SHA1 digest
34    ///
35    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecdigestsha1?language=objc)
36    #[deprecated = "SecTransform is no longer supported"]
37    pub static kSecDigestSHA1: &'static CFString;
38}
39
40extern "C" {
41    /// Specifies a SHA2 digest.
42    ///
43    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecdigestsha2?language=objc)
44    #[deprecated = "SecTransform is no longer supported"]
45    pub static kSecDigestSHA2: &'static CFString;
46}
47
48extern "C" {
49    /// Specifies an HMAC using the MD5 digest algorithm.
50    ///
51    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecdigesthmacmd5?language=objc)
52    #[deprecated = "SecTransform is no longer supported"]
53    pub static kSecDigestHMACMD5: &'static CFString;
54}
55
56extern "C" {
57    /// Specifies an HMAC using the SHA1 digest algorithm.
58    ///
59    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecdigesthmacsha1?language=objc)
60    #[deprecated = "SecTransform is no longer supported"]
61    pub static kSecDigestHMACSHA1: &'static CFString;
62}
63
64extern "C" {
65    /// Specifies an HMAC using one of the SHA2 digest algorithms.
66    ///
67    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecdigesthmacsha2?language=objc)
68    #[deprecated = "SecTransform is no longer supported"]
69    pub static kSecDigestHMACSHA2: &'static CFString;
70}
71
72extern "C" {
73    /// Used with SecTransformGetAttribute to query the attribute type.
74    /// Returns one of the strings defined in the previous section.
75    ///
76    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecdigesttypeattribute?language=objc)
77    #[deprecated = "SecTransform is no longer supported"]
78    pub static kSecDigestTypeAttribute: &'static CFString;
79}
80
81extern "C" {
82    /// Used with SecTransformGetAttribute to query the length attribute.
83    /// Returns a CFNumberRef that contains the length in bytes.
84    ///
85    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecdigestlengthattribute?language=objc)
86    #[deprecated = "SecTransform is no longer supported"]
87    pub static kSecDigestLengthAttribute: &'static CFString;
88}
89
90extern "C" {
91    /// When set and used with one of the HMAC digest types, sets the key
92    /// for the HMAC operation.  The data type for this attribute must be
93    /// a CFDataRef.  If this value is not set, the transform will assume
94    /// a zero length key.
95    ///
96    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecdigesthmackeyattribute?language=objc)
97    #[deprecated = "SecTransform is no longer supported"]
98    pub static kSecDigestHMACKeyAttribute: &'static CFString;
99}
100
101/// Creates a digest computation object.
102///
103/// Parameter `digestType`: The type of digest to compute.  You may pass NULL
104/// for this parameter, in which case an appropriate
105/// algorithm will be chosen for you.
106///
107/// Parameter `digestLength`: The desired digest length.  Note that certain
108/// algorithms may only support certain sizes. You may
109/// pass 0 for this parameter, in which case an
110/// appropriate length will be chosen for you.
111///
112/// Parameter `error`: A pointer to a CFErrorRef.  This pointer will be set
113/// if an error occurred.  This value may be NULL if you
114/// do not want an error returned.
115///
116/// Returns: A pointer to a SecTransformRef object.  This object must
117/// be released with CFRelease when you are done with
118/// it.  This function will return NULL if an error
119/// occurred.
120///
121/// This function creates a transform which computes a
122/// cryptographic digest.
123///
124/// # Safety
125///
126/// - `digest_type` should be of the correct type.
127/// - `error` must be a valid pointer or null.
128#[cfg(feature = "SecTransform")]
129#[deprecated = "SecTransform is no longer supported"]
130#[inline]
131pub unsafe extern "C-unwind" fn SecDigestTransformCreate(
132    digest_type: Option<&CFType>,
133    digest_length: CFIndex,
134    error: *mut *mut CFError,
135) -> CFRetained<SecTransform> {
136    extern "C-unwind" {
137        fn SecDigestTransformCreate(
138            digest_type: Option<&CFType>,
139            digest_length: CFIndex,
140            error: *mut *mut CFError,
141        ) -> Option<NonNull<SecTransform>>;
142    }
143    let ret = unsafe { SecDigestTransformCreate(digest_type, digest_length, error) };
144    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
145    unsafe { CFRetained::from_raw(ret) }
146}
147
148/// Return the CFTypeID of a SecDigestTransform
149///
150/// Returns: The CFTypeID
151#[deprecated = "SecTransform is no longer supported"]
152#[inline]
153pub extern "C-unwind" fn SecDigestTransformGetTypeID() -> CFTypeID {
154    extern "C-unwind" {
155        fn SecDigestTransformGetTypeID() -> CFTypeID;
156    }
157    unsafe { SecDigestTransformGetTypeID() }
158}