objc2-security 0.3.2

Bindings to the Security framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2_core_foundation::*;

use crate::*;

extern "C" {
    /// Specifies an MD2 digest
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecdigestmd2?language=objc)
    #[deprecated = "SecTransform is no longer supported"]
    pub static kSecDigestMD2: &'static CFString;
}

extern "C" {
    /// Specifies an MD4 digest
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecdigestmd4?language=objc)
    #[deprecated = "SecTransform is no longer supported"]
    pub static kSecDigestMD4: &'static CFString;
}

extern "C" {
    /// Specifies an MD5 digest
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecdigestmd5?language=objc)
    #[deprecated = "SecTransform is no longer supported"]
    pub static kSecDigestMD5: &'static CFString;
}

extern "C" {
    /// Specifies a SHA1 digest
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecdigestsha1?language=objc)
    #[deprecated = "SecTransform is no longer supported"]
    pub static kSecDigestSHA1: &'static CFString;
}

extern "C" {
    /// Specifies a SHA2 digest.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecdigestsha2?language=objc)
    #[deprecated = "SecTransform is no longer supported"]
    pub static kSecDigestSHA2: &'static CFString;
}

extern "C" {
    /// Specifies an HMAC using the MD5 digest algorithm.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecdigesthmacmd5?language=objc)
    #[deprecated = "SecTransform is no longer supported"]
    pub static kSecDigestHMACMD5: &'static CFString;
}

extern "C" {
    /// Specifies an HMAC using the SHA1 digest algorithm.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecdigesthmacsha1?language=objc)
    #[deprecated = "SecTransform is no longer supported"]
    pub static kSecDigestHMACSHA1: &'static CFString;
}

extern "C" {
    /// Specifies an HMAC using one of the SHA2 digest algorithms.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecdigesthmacsha2?language=objc)
    #[deprecated = "SecTransform is no longer supported"]
    pub static kSecDigestHMACSHA2: &'static CFString;
}

extern "C" {
    /// Used with SecTransformGetAttribute to query the attribute type.
    /// Returns one of the strings defined in the previous section.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecdigesttypeattribute?language=objc)
    #[deprecated = "SecTransform is no longer supported"]
    pub static kSecDigestTypeAttribute: &'static CFString;
}

extern "C" {
    /// Used with SecTransformGetAttribute to query the length attribute.
    /// Returns a CFNumberRef that contains the length in bytes.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecdigestlengthattribute?language=objc)
    #[deprecated = "SecTransform is no longer supported"]
    pub static kSecDigestLengthAttribute: &'static CFString;
}

extern "C" {
    /// When set and used with one of the HMAC digest types, sets the key
    /// for the HMAC operation.  The data type for this attribute must be
    /// a CFDataRef.  If this value is not set, the transform will assume
    /// a zero length key.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecdigesthmackeyattribute?language=objc)
    #[deprecated = "SecTransform is no longer supported"]
    pub static kSecDigestHMACKeyAttribute: &'static CFString;
}

/// Creates a digest computation object.
///
/// Parameter `digestType`: The type of digest to compute.  You may pass NULL
/// for this parameter, in which case an appropriate
/// algorithm will be chosen for you.
///
/// Parameter `digestLength`: The desired digest length.  Note that certain
/// algorithms may only support certain sizes. You may
/// pass 0 for this parameter, in which case an
/// appropriate length will be chosen for you.
///
/// Parameter `error`: A pointer to a CFErrorRef.  This pointer will be set
/// if an error occurred.  This value may be NULL if you
/// do not want an error returned.
///
/// Returns: A pointer to a SecTransformRef object.  This object must
/// be released with CFRelease when you are done with
/// it.  This function will return NULL if an error
/// occurred.
///
/// This function creates a transform which computes a
/// cryptographic digest.
///
/// # Safety
///
/// - `digest_type` should be of the correct type.
/// - `error` must be a valid pointer or null.
#[cfg(feature = "SecTransform")]
#[deprecated = "SecTransform is no longer supported"]
#[inline]
pub unsafe extern "C-unwind" fn SecDigestTransformCreate(
    digest_type: Option<&CFType>,
    digest_length: CFIndex,
    error: *mut *mut CFError,
) -> CFRetained<SecTransform> {
    extern "C-unwind" {
        fn SecDigestTransformCreate(
            digest_type: Option<&CFType>,
            digest_length: CFIndex,
            error: *mut *mut CFError,
        ) -> Option<NonNull<SecTransform>>;
    }
    let ret = unsafe { SecDigestTransformCreate(digest_type, digest_length, error) };
    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
    unsafe { CFRetained::from_raw(ret) }
}

/// Return the CFTypeID of a SecDigestTransform
///
/// Returns: The CFTypeID
#[deprecated = "SecTransform is no longer supported"]
#[inline]
pub extern "C-unwind" fn SecDigestTransformGetTypeID() -> CFTypeID {
    extern "C-unwind" {
        fn SecDigestTransformGetTypeID() -> CFTypeID;
    }
    unsafe { SecDigestTransformGetTypeID() }
}