ohos-crypto-sys 0.1.0

Raw bindings to the CryptoArchitectureKit NDK of OpenHarmony
Documentation
// automatically generated by rust-bindgen 0.71.1

#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]

/// Crypto data struct.
///
///
/// Available since API-level: 12
#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
#[repr(C)]
pub struct Crypto_DataBlob {
    /// Data buffer.
    pub data: *mut u8,
    /// Data length.
    pub len: usize,
}
pub type CryptoResult = Result<(), CryptoErrorCode>;
#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
impl CryptoErrorCode {
    /// Indicates that input parameters is invalid.
    pub const INVALID_PARAMS: CryptoErrorCode =
        CryptoErrorCode(const { core::num::NonZero::new(401).unwrap() });
    /// Indicates that function or algorithm is not supported.
    pub const NOT_SUPPORTED: CryptoErrorCode =
        CryptoErrorCode(const { core::num::NonZero::new(801).unwrap() });
    /// Indicates the memory error.
    pub const MEMORY_ERROR: CryptoErrorCode =
        CryptoErrorCode(const { core::num::NonZero::new(17620001).unwrap() });
    /// Indicates that parameter check failed.
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub const PARAMETER_CHECK_FAILED: CryptoErrorCode =
        CryptoErrorCode(const { core::num::NonZero::new(17620003).unwrap() });
    /// Indicates that crypto operation error.
    pub const OPERTION_ERROR: CryptoErrorCode =
        CryptoErrorCode(const { core::num::NonZero::new(17630001).unwrap() });
}
#[repr(transparent)]
/// Enumerates the error codes.
///
///
/// Available since API-level: 12
#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct CryptoErrorCode(pub core::num::NonZero<::core::ffi::c_uint>);
#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
impl Crypto_CipherMode {
    /// Indicates encryption operation.
    pub const CRYPTO_ENCRYPT_MODE: Crypto_CipherMode = Crypto_CipherMode(0);
    /// Indicates decryption operation.
    pub const CRYPTO_DECRYPT_MODE: Crypto_CipherMode = Crypto_CipherMode(1);
}
#[repr(transparent)]
/// Define crypto cipher mode.
///
///
/// Available since API-level: 12
#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Crypto_CipherMode(pub ::core::ffi::c_uint);
extern "C" {
    /// Free the data of dataBlob.
    ///
    /// # Arguments
    ///
    /// * `dataBlob` - Indicates the data blob.
    ///
    /// Available since API-level: 12
    #[cfg(feature = "api-12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
    pub fn OH_Crypto_FreeDataBlob(dataBlob: *mut Crypto_DataBlob);
}