libsignal-protocol-c  master
signal_crypto_provider Struct Reference

Public Attributes

int(* random_func )(uint8_t *data, size_t len, void *user_data)
 
int(* hmac_sha256_init_func )(void **hmac_context, const uint8_t *key, size_t key_len, void *user_data)
 
int(* hmac_sha256_update_func )(void *hmac_context, const uint8_t *data, size_t data_len, void *user_data)
 
int(* hmac_sha256_final_func )(void *hmac_context, signal_buffer **output, void *user_data)
 
void(* hmac_sha256_cleanup_func )(void *hmac_context, void *user_data)
 
int(* sha512_digest_init_func )(void **digest_context, void *user_data)
 
int(* sha512_digest_update_func )(void *digest_context, const uint8_t *data, size_t data_len, void *user_data)
 
int(* sha512_digest_final_func )(void *digest_context, signal_buffer **output, void *user_data)
 
void(* sha512_digest_cleanup_func )(void *digest_context, void *user_data)
 
int(* encrypt_func )(signal_buffer **output, int cipher, const uint8_t *key, size_t key_len, const uint8_t *iv, size_t iv_len, const uint8_t *plaintext, size_t plaintext_len, void *user_data)
 
int(* decrypt_func )(signal_buffer **output, int cipher, const uint8_t *key, size_t key_len, const uint8_t *iv, size_t iv_len, const uint8_t *ciphertext, size_t ciphertext_len, void *user_data)
 
void * user_data
 

Member Data Documentation

◆ decrypt_func

int(* signal_crypto_provider::decrypt_func) (signal_buffer **output, int cipher, const uint8_t *key, size_t key_len, const uint8_t *iv, size_t iv_len, const uint8_t *ciphertext, size_t ciphertext_len, void *user_data)

Callback for an AES decryption implementation.

Parameters
outputbuffer to be allocated and populated with the plaintext
cipherspecific cipher variant to use, either SG_CIPHER_AES_CTR_NOPADDING or SG_CIPHER_AES_CBC_PKCS5
keythe encryption key
key_lenlength of the encryption key
ivthe initialization vector
iv_lenlength of the initialization vector
ciphertextthe ciphertext to decrypt
ciphertext_lenlength of the ciphertext
Returns
0 on success, negative on failure

◆ encrypt_func

int(* signal_crypto_provider::encrypt_func) (signal_buffer **output, int cipher, const uint8_t *key, size_t key_len, const uint8_t *iv, size_t iv_len, const uint8_t *plaintext, size_t plaintext_len, void *user_data)

Callback for an AES encryption implementation.

Parameters
outputbuffer to be allocated and populated with the ciphertext
cipherspecific cipher variant to use, either SG_CIPHER_AES_CTR_NOPADDING or SG_CIPHER_AES_CBC_PKCS5
keythe encryption key
key_lenlength of the encryption key
ivthe initialization vector
iv_lenlength of the initialization vector
plaintextthe plaintext to encrypt
plaintext_lenlength of the plaintext
Returns
0 on success, negative on failure

◆ hmac_sha256_cleanup_func

void(* signal_crypto_provider::hmac_sha256_cleanup_func) (void *hmac_context, void *user_data)

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

Parameters
hmac_contextprivate HMAC context pointer

◆ hmac_sha256_final_func

int(* signal_crypto_provider::hmac_sha256_final_func) (void *hmac_context, signal_buffer **output, void *user_data)

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

Parameters
hmac_contextprivate HMAC context pointer
outputbuffer to be allocated and populated with the result
Returns
0 on success, negative on failure

◆ hmac_sha256_init_func

int(* signal_crypto_provider::hmac_sha256_init_func) (void **hmac_context, const uint8_t *key, size_t key_len, void *user_data)

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

Parameters
hmac_contextprivate HMAC context pointer
keypointer to the key
key_lenlength of the key
Returns
0 on success, negative on failure

◆ hmac_sha256_update_func

int(* signal_crypto_provider::hmac_sha256_update_func) (void *hmac_context, const uint8_t *data, size_t data_len, void *user_data)

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

Parameters
hmac_contextprivate HMAC context pointer
datapointer to the data
data_lenlength of the data
Returns
0 on success, negative on failure

◆ random_func

int(* signal_crypto_provider::random_func) (uint8_t *data, size_t len, void *user_data)

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

Parameters
datapointer to the output buffer
lensize of the output buffer
Returns
0 on success, negative on failure

◆ sha512_digest_cleanup_func

void(* signal_crypto_provider::sha512_digest_cleanup_func) (void *digest_context, void *user_data)

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

Parameters
digest_contextprivate digest context pointer

◆ sha512_digest_final_func

int(* signal_crypto_provider::sha512_digest_final_func) (void *digest_context, signal_buffer **output, void *user_data)

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.

Parameters
digest_contextprivate digest context pointer
outputbuffer to be allocated and populated with the result
Returns
0 on success, negative on failure

◆ sha512_digest_init_func

int(* signal_crypto_provider::sha512_digest_init_func) (void **digest_context, void *user_data)

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

Parameters
digest_contextprivate digest context pointer
Returns
0 on success, negative on failure

◆ sha512_digest_update_func

int(* signal_crypto_provider::sha512_digest_update_func) (void *digest_context, const uint8_t *data, size_t data_len, void *user_data)

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

Parameters
digest_contextprivate digest context pointer
datapointer to the data
data_lenlength of the data
Returns
0 on success, negative on failure

◆ user_data

void* signal_crypto_provider::user_data

User data pointer


The documentation for this struct was generated from the following file: