signal_crypto_provider

Struct signal_crypto_provider 

Source
#[repr(C)]
pub struct signal_crypto_provider { pub random_func: Option<unsafe extern "C" fn(data: *mut u8, len: usize, user_data: *mut c_void) -> c_int>, pub hmac_sha256_init_func: Option<unsafe extern "C" fn(hmac_context: *mut *mut c_void, key: *const u8, key_len: usize, user_data: *mut c_void) -> c_int>, pub hmac_sha256_update_func: Option<unsafe extern "C" fn(hmac_context: *mut c_void, data: *const u8, data_len: usize, user_data: *mut c_void) -> c_int>, pub hmac_sha256_final_func: Option<unsafe extern "C" fn(hmac_context: *mut c_void, output: *mut *mut signal_buffer, user_data: *mut c_void) -> c_int>, pub hmac_sha256_cleanup_func: Option<unsafe extern "C" fn(hmac_context: *mut c_void, user_data: *mut c_void)>, pub sha512_digest_init_func: Option<unsafe extern "C" fn(digest_context: *mut *mut c_void, user_data: *mut c_void) -> c_int>, pub sha512_digest_update_func: Option<unsafe extern "C" fn(digest_context: *mut c_void, data: *const u8, data_len: usize, user_data: *mut c_void) -> c_int>, pub sha512_digest_final_func: Option<unsafe extern "C" fn(digest_context: *mut c_void, output: *mut *mut signal_buffer, user_data: *mut c_void) -> c_int>, pub sha512_digest_cleanup_func: Option<unsafe extern "C" fn(digest_context: *mut c_void, user_data: *mut c_void)>, pub encrypt_func: Option<unsafe extern "C" fn(output: *mut *mut signal_buffer, cipher: c_int, key: *const u8, key_len: usize, iv: *const u8, iv_len: usize, plaintext: *const u8, plaintext_len: usize, user_data: *mut c_void) -> c_int>, pub decrypt_func: Option<unsafe extern "C" fn(output: *mut *mut signal_buffer, cipher: c_int, key: *const u8, key_len: usize, iv: *const u8, iv_len: usize, ciphertext: *const u8, ciphertext_len: usize, user_data: *mut c_void) -> c_int>, pub user_data: *mut c_void, }

Fields§

§random_func: Option<unsafe extern "C" fn(data: *mut u8, len: usize, user_data: *mut c_void) -> c_int>

Callback for a secure random number generator. This function shall fill the provided buffer with random bytes.

@param data pointer to the output buffer @param len size of the output buffer @return 0 on success, negative on failure

§hmac_sha256_init_func: Option<unsafe extern "C" fn(hmac_context: *mut *mut c_void, key: *const u8, key_len: usize, user_data: *mut c_void) -> c_int>

Callback for an HMAC-SHA256 implementation. This function shall initialize an HMAC context with the provided key.

@param hmac_context private HMAC context pointer @param key pointer to the key @param key_len length of the key @return 0 on success, negative on failure

§hmac_sha256_update_func: Option<unsafe extern "C" fn(hmac_context: *mut c_void, data: *const u8, data_len: usize, user_data: *mut c_void) -> c_int>

Callback for an HMAC-SHA256 implementation. This function shall update the HMAC context with the provided data

@param hmac_context private HMAC context pointer @param data pointer to the data @param data_len length of the data @return 0 on success, negative on failure

§hmac_sha256_final_func: Option<unsafe extern "C" fn(hmac_context: *mut c_void, output: *mut *mut signal_buffer, user_data: *mut c_void) -> c_int>

Callback for an HMAC-SHA256 implementation. This function shall finalize an HMAC calculation and populate the output buffer with the result.

@param hmac_context private HMAC context pointer @param output buffer to be allocated and populated with the result @return 0 on success, negative on failure

§hmac_sha256_cleanup_func: Option<unsafe extern "C" fn(hmac_context: *mut c_void, user_data: *mut c_void)>

Callback for an HMAC-SHA256 implementation. This function shall free the private context allocated in hmac_sha256_init_func.

@param hmac_context private HMAC context pointer

§sha512_digest_init_func: Option<unsafe extern "C" fn(digest_context: *mut *mut c_void, user_data: *mut c_void) -> c_int>

Callback for a SHA512 message digest implementation. This function shall initialize a digest context.

@param digest_context private digest context pointer @return 0 on success, negative on failure

§sha512_digest_update_func: Option<unsafe extern "C" fn(digest_context: *mut c_void, data: *const u8, data_len: usize, user_data: *mut c_void) -> c_int>

Callback for a SHA512 message digest implementation. This function shall update the digest context with the provided data.

@param digest_context private digest context pointer @param data pointer to the data @param data_len length of the data @return 0 on success, negative on failure

§sha512_digest_final_func: Option<unsafe extern "C" fn(digest_context: *mut c_void, output: *mut *mut signal_buffer, user_data: *mut c_void) -> c_int>

Callback for a SHA512 message digest implementation. This function shall finalize the digest calculation, populate the output buffer with the result, and prepare the context for reuse.

@param digest_context private digest context pointer @param output buffer to be allocated and populated with the result @return 0 on success, negative on failure

§sha512_digest_cleanup_func: Option<unsafe extern "C" fn(digest_context: *mut c_void, user_data: *mut c_void)>

Callback for a SHA512 message digest implementation. This function shall free the private context allocated in sha512_digest_init_func.

@param digest_context private digest context pointer

§encrypt_func: Option<unsafe extern "C" fn(output: *mut *mut signal_buffer, cipher: c_int, key: *const u8, key_len: usize, iv: *const u8, iv_len: usize, plaintext: *const u8, plaintext_len: usize, user_data: *mut c_void) -> c_int>

Callback for an AES encryption implementation.

@param output buffer to be allocated and populated with the ciphertext @param cipher specific cipher variant to use, either SG_CIPHER_AES_CTR_NOPADDING or SG_CIPHER_AES_CBC_PKCS5 @param key the encryption key @param key_len length of the encryption key @param iv the initialization vector @param iv_len length of the initialization vector @param plaintext the plaintext to encrypt @param plaintext_len length of the plaintext @return 0 on success, negative on failure

§decrypt_func: Option<unsafe extern "C" fn(output: *mut *mut signal_buffer, cipher: c_int, key: *const u8, key_len: usize, iv: *const u8, iv_len: usize, ciphertext: *const u8, ciphertext_len: usize, user_data: *mut c_void) -> c_int>

Callback for an AES decryption implementation.

@param output buffer to be allocated and populated with the plaintext @param cipher specific cipher variant to use, either SG_CIPHER_AES_CTR_NOPADDING or SG_CIPHER_AES_CBC_PKCS5 @param key the encryption key @param key_len length of the encryption key @param iv the initialization vector @param iv_len length of the initialization vector @param ciphertext the ciphertext to decrypt @param ciphertext_len length of the ciphertext @return 0 on success, negative on failure

§user_data: *mut c_void

User data pointer

Trait Implementations§

Source§

impl Clone for signal_crypto_provider

Source§

fn clone(&self) -> signal_crypto_provider

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for signal_crypto_provider

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for signal_crypto_provider

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.