Botan 2.19.3
Crypto and TLS for C&
|
#include <botan/ffi.h>
#include <botan/internal/ffi_util.h>
#include <botan/aead.h>
Go to the source code of this file.
Functions | |
int | botan_cipher_clear (botan_cipher_t cipher) |
int | botan_cipher_destroy (botan_cipher_t cipher) |
int | botan_cipher_get_default_nonce_length (botan_cipher_t cipher, size_t *nl) |
int | botan_cipher_get_keyspec (botan_cipher_t cipher, size_t *out_minimum_keylength, size_t *out_maximum_keylength, size_t *out_keylength_modulo) |
int | botan_cipher_get_tag_length (botan_cipher_t cipher, size_t *tl) |
int | botan_cipher_get_update_granularity (botan_cipher_t cipher, size_t *ug) |
int | botan_cipher_init (botan_cipher_t *cipher, const char *cipher_name, uint32_t flags) |
int | botan_cipher_name (botan_cipher_t cipher, char *name, size_t *name_len) |
int | botan_cipher_output_length (botan_cipher_t cipher, size_t in_len, size_t *out_len) |
int | botan_cipher_query_keylen (botan_cipher_t cipher, size_t *out_minimum_keylength, size_t *out_maximum_keylength) |
int | botan_cipher_reset (botan_cipher_t cipher) |
int | botan_cipher_set_associated_data (botan_cipher_t cipher, const uint8_t *ad, size_t ad_len) |
int | botan_cipher_set_key (botan_cipher_t cipher, const uint8_t *key, size_t key_len) |
int | botan_cipher_start (botan_cipher_t cipher_obj, const uint8_t *nonce, size_t nonce_len) |
int | botan_cipher_update (botan_cipher_t cipher_obj, uint32_t flags, uint8_t output_ptr[], size_t orig_output_size, size_t *output_written, const uint8_t input_ptr[], size_t orig_input_size, size_t *input_consumed) |
int | botan_cipher_valid_nonce_length (botan_cipher_t cipher, size_t nl) |
int botan_cipher_clear | ( | botan_cipher_t | hash | ) |
Reset the key, nonce, AD and all other state on this cipher object
Definition at line 39 of file ffi_cipher.cpp.
References BOTAN_FFI_DO, and Botan::SymmetricAlgorithm::clear().
int botan_cipher_destroy | ( | botan_cipher_t | cipher | ) |
Destroy the cipher object
Definition at line 34 of file ffi_cipher.cpp.
References BOTAN_FFI_CHECKED_DELETE.
int botan_cipher_get_default_nonce_length | ( | botan_cipher_t | cipher, |
size_t * | nl | ||
) |
Get the default nonce length of this cipher
Definition at line 212 of file ffi_cipher.cpp.
References BOTAN_FFI_DO, and Botan::Cipher_Mode::default_nonce_length().
int botan_cipher_get_keyspec | ( | botan_cipher_t | cipher, |
size_t * | min_keylen, | ||
size_t * | max_keylen, | ||
size_t * | mod_keylen | ||
) |
Get information about the supported key lengths.
Definition at line 67 of file ffi_cipher.cpp.
References BOTAN_FFI_DO, Botan::SymmetricAlgorithm::key_spec(), and Botan::Key_Length_Specification::minimum_keylength().
int botan_cipher_get_tag_length | ( | botan_cipher_t | cipher, |
size_t * | tag_size | ||
) |
Get the tag length of the cipher (0 for non-AEAD modes)
Definition at line 222 of file ffi_cipher.cpp.
References BOTAN_FFI_DO, and Botan::Cipher_Mode::tag_size().
int botan_cipher_get_update_granularity | ( | botan_cipher_t | cipher, |
size_t * | ug | ||
) |
Return the update granularity of the cipher; botan_cipher_update must be called with blocks of this size, except for the final.
Definition at line 217 of file ffi_cipher.cpp.
References BOTAN_FFI_DO, and Botan::Cipher_Mode::update_granularity().
int botan_cipher_init | ( | botan_cipher_t * | cipher, |
const char * | name, | ||
uint32_t | flags | ||
) |
Initialize a cipher object
Definition at line 21 of file ffi_cipher.cpp.
References BOTAN_CIPHER_INIT_FLAG_ENCRYPT, BOTAN_CIPHER_INIT_FLAG_MASK_DIRECTION, BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_SUCCESS, Botan::Cipher_Mode::create(), Botan::DECRYPTION, Botan::ENCRYPTION, and Botan_FFI::ffi_guard_thunk().
int botan_cipher_name | ( | botan_cipher_t | cipher, |
char * | name, | ||
size_t * | name_len | ||
) |
Return the name of the cipher object
Definition at line 227 of file ffi_cipher.cpp.
References BOTAN_FFI_DO, name, and Botan_FFI::write_str_output().
int botan_cipher_output_length | ( | botan_cipher_t | cipher, |
size_t | in_len, | ||
size_t * | out_len | ||
) |
Return the output length of this cipher, for a particular input length.
Definition at line 49 of file ffi_cipher.cpp.
References BOTAN_FFI_DO, BOTAN_FFI_ERROR_NULL_POINTER, and Botan::Cipher_Mode::output_length().
int botan_cipher_query_keylen | ( | botan_cipher_t | cipher, |
size_t * | out_minimum_keylength, | ||
size_t * | out_maximum_keylength | ||
) |
Get information about the key lengths. Prefer botan_cipher_get_keyspec
Definition at line 57 of file ffi_cipher.cpp.
References BOTAN_FFI_DO, and Botan::SymmetricAlgorithm::key_spec().
int botan_cipher_reset | ( | botan_cipher_t | cipher | ) |
Reset the message specific state for this cipher. Without resetting the keys, this resets the nonce, and any state associated with any message bits that have been processed so far.
It is conceptually equivalent to calling botan_cipher_clear followed by botan_cipher_set_key with the original key.
Definition at line 44 of file ffi_cipher.cpp.
References BOTAN_FFI_DO, and Botan::Cipher_Mode::reset().
int botan_cipher_set_associated_data | ( | botan_cipher_t | cipher, |
const uint8_t * | ad, | ||
size_t | ad_len | ||
) |
Set the associated data. Will fail if cipher is not an AEAD
Definition at line 191 of file ffi_cipher.cpp.
References BOTAN_FFI_ERROR_BAD_PARAMETER, BOTAN_FFI_RETURNING, and BOTAN_FFI_SUCCESS.
int botan_cipher_set_key | ( | botan_cipher_t | cipher, |
const uint8_t * | key, | ||
size_t | key_len | ||
) |
Set the key for this cipher object
Definition at line 82 of file ffi_cipher.cpp.
References BOTAN_FFI_DO, and Botan::SymmetricAlgorithm::set_key().
int botan_cipher_start | ( | botan_cipher_t | cipher, |
const uint8_t * | nonce, | ||
size_t | nonce_len | ||
) |
Begin processing a new message using the provided nonce
Definition at line 88 of file ffi_cipher.cpp.
References BOTAN_FFI_SUCCESS, Botan_FFI::ffi_guard_thunk(), Botan_FFI::safe_get(), Botan::Cipher_Mode::start(), and Botan::Cipher_Mode::update_granularity().
int botan_cipher_update | ( | botan_cipher_t | cipher, |
uint32_t | flags, | ||
uint8_t | output[], | ||
size_t | output_size, | ||
size_t * | output_written, | ||
const uint8_t | input_bytes[], | ||
size_t | input_size, | ||
size_t * | input_consumed | ||
) |
Encrypt some data
Definition at line 99 of file ffi_cipher.cpp.
References BOTAN_ASSERT, BOTAN_CIPHER_UPDATE_FLAG_FINAL, BOTAN_FFI_ERROR_BAD_MAC, BOTAN_FFI_SUCCESS, Botan_FFI::ffi_guard_thunk(), Botan::Cipher_Mode::finish(), Botan::Cipher_Mode::minimum_final_size(), Botan_FFI::safe_get(), Botan::Cipher_Mode::update(), and Botan::Cipher_Mode::update_granularity().
int botan_cipher_valid_nonce_length | ( | botan_cipher_t | cipher, |
size_t | nl | ||
) |
Return if the specified nonce length is valid for this cipher
Definition at line 205 of file ffi_cipher.cpp.
References BOTAN_FFI_RETURNING, and Botan::Cipher_Mode::valid_nonce_length().