#[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_voidUser data pointer
Trait Implementations§
Source§impl Clone for signal_crypto_provider
impl Clone for signal_crypto_provider
Source§fn clone(&self) -> signal_crypto_provider
fn clone(&self) -> signal_crypto_provider
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more