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)]
use crate::asym_key::{OH_CryptoPrivKey, OH_CryptoPubKey};
use crate::common::{CryptoResult, Crypto_DataBlob};

/// Defines the key agreement structure.
///
///
/// Available since API-level: 20
#[cfg(feature = "api-20")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
#[repr(C)]
pub struct OH_CryptoKeyAgreement {
    _unused: [u8; 0],
}
extern "C" {
    /// Creates a key agreement context according to the given algorithm name.
    ///
    /// # Arguments
    ///
    /// * `algoName` - Indicates the algorithm name used to generate a key agreement context. e.g. "ECC", "X25519".
    ///
    /// * `ctx` - Indicates the key agreement context.
    ///
    /// # Returns
    ///
    /// * [`OH_Crypto_ErrCode#CRYPTO_SUCCESS`] 0 - If the operation is successful.
    /// [`OH_Crypto_ErrCode#CRYPTO_NOT_SUPPORTED`] 801 - If the operation is not supported.
    /// [`OH_Crypto_ErrCode#CRYPTO_MEMORY_ERROR`] 17620001 - If memory operation failed.
    /// [`OH_Crypto_ErrCode#CRYPTO_PARAMETER_CHECK_FAILED`] 17620003 - If parameter check failed.
    /// [`OH_Crypto_ErrCode#CRYPTO_OPERTION_ERROR`] 17630001 - If crypto operation failed.
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_CryptoKeyAgreement_Create(
        algoName: *const ::core::ffi::c_char,
        ctx: *mut *mut OH_CryptoKeyAgreement,
    ) -> CryptoResult;
    /// Generates a secret value.
    ///
    /// # Arguments
    ///
    /// * `ctx` - Indicates the key agreement context.
    ///
    /// * `privkey` - Indicates the private key.
    ///
    /// * `pubkey` - Indicates the public key.
    ///
    /// * `secret` - Indicates the secret value.
    ///
    /// # Returns
    ///
    /// * [`OH_Crypto_ErrCode#CRYPTO_SUCCESS`] 0 - If the operation is successful.
    /// [`OH_Crypto_ErrCode#CRYPTO_NOT_SUPPORTED`] 801 - If the operation is not supported.
    /// [`OH_Crypto_ErrCode#CRYPTO_MEMORY_ERROR`] 17620001 - If memory operation failed.
    /// [`OH_Crypto_ErrCode#CRYPTO_PARAMETER_CHECK_FAILED`] 17620003 - If parameter check failed.
    /// [`OH_Crypto_ErrCode#CRYPTO_OPERTION_ERROR`] 17630001 - If crypto operation failed.
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_CryptoKeyAgreement_GenerateSecret(
        ctx: *mut OH_CryptoKeyAgreement,
        privkey: *mut OH_CryptoPrivKey,
        pubkey: *mut OH_CryptoPubKey,
        secret: *mut Crypto_DataBlob,
    ) -> CryptoResult;
    /// Destroys the key agreement context.
    ///
    /// # Arguments
    ///
    /// * `ctx` - Indicates the key agreement context.
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_CryptoKeyAgreement_Destroy(ctx: *mut OH_CryptoKeyAgreement);
}