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