Botan 3.6.1
Crypto and TLS for C&
|
#include <botan/ffi.h>
#include <botan/mac.h>
#include <botan/internal/ffi_util.h>
Go to the source code of this file.
Functions | |
BOTAN_FFI_DECLARE_STRUCT (botan_mac_struct, Botan::MessageAuthenticationCode, 0xA06E8FC1) | |
int | botan_mac_clear (botan_mac_t mac) |
int | botan_mac_destroy (botan_mac_t mac) |
int | botan_mac_final (botan_mac_t mac, uint8_t out[]) |
int | botan_mac_get_keyspec (botan_mac_t mac, size_t *out_minimum_keylength, size_t *out_maximum_keylength, size_t *out_keylength_modulo) |
int | botan_mac_init (botan_mac_t *mac, const char *mac_name, uint32_t flags) |
int | botan_mac_name (botan_mac_t mac, char *name, size_t *name_len) |
int | botan_mac_output_length (botan_mac_t mac, size_t *out) |
int | botan_mac_set_key (botan_mac_t mac, const uint8_t *key, size_t key_len) |
int | botan_mac_set_nonce (botan_mac_t mac, const uint8_t *nonce, size_t nonce_len) |
int | botan_mac_update (botan_mac_t mac, const uint8_t *buf, size_t len) |
BOTAN_FFI_DECLARE_STRUCT | ( | botan_mac_struct | , |
Botan::MessageAuthenticationCode | , | ||
0xA06E8FC1 | ) |
int botan_mac_clear | ( | botan_mac_t | mac | ) |
Reinitializes the state of the MAC computation. A MAC can be computed (with update/final) immediately.
mac | mac object |
Definition at line 51 of file ffi_mac.cpp.
References BOTAN_FFI_VISIT.
int botan_mac_destroy | ( | botan_mac_t | mac | ) |
Frees all resources of the MAC object
mac | mac object |
Definition at line 35 of file ffi_mac.cpp.
References BOTAN_FFI_CHECKED_DELETE.
int botan_mac_final | ( | botan_mac_t | mac, |
uint8_t | out[] ) |
Finalizes the MAC computation and writes the output to out[0:botan_mac_output_length()] then reinitializes for computing another MAC as if botan_mac_clear had been called.
mac | mac object |
out | output buffer |
Definition at line 59 of file ffi_mac.cpp.
References BOTAN_FFI_VISIT.
int botan_mac_get_keyspec | ( | botan_mac_t | mac, |
size_t * | out_minimum_keylength, | ||
size_t * | out_maximum_keylength, | ||
size_t * | out_keylength_modulo ) |
Get the key length limits of this auth code
mac | the object to read |
out_minimum_keylength | if non-NULL, will be set to minimum keylength of MAC |
out_maximum_keylength | if non-NULL, will be set to maximum keylength of MAC |
out_keylength_modulo | if non-NULL will be set to byte multiple of valid keys |
Definition at line 67 of file ffi_mac.cpp.
References BOTAN_FFI_VISIT.
int botan_mac_init | ( | botan_mac_t * | mac, |
const char * | mac_name, | ||
uint32_t | flags ) |
Initialize a message authentication code object
mac | mac object |
mac_name | name of the hash function, e.g., "HMAC(SHA-384)" |
flags | should be 0 in current API revision, all other uses are reserved and return a negative value (error code) |
Definition at line 18 of file ffi_mac.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_SUCCESS, Botan::MessageAuthenticationCode::create(), and Botan_FFI::ffi_guard_thunk().
int botan_mac_name | ( | botan_mac_t | mac, |
char * | name, | ||
size_t * | name_len ) |
Get the name of this MAC
mac | the object to read |
name | output buffer |
name_len | on input, the length of buffer, on success the number of bytes written |
Definition at line 63 of file ffi_mac.cpp.
References BOTAN_FFI_VISIT, name, and Botan_FFI::write_str_output().
int botan_mac_output_length | ( | botan_mac_t | mac, |
size_t * | output_length ) |
Writes the output length of the message authentication code to *output_length
mac | mac object |
output_length | output buffer to hold the MAC output length |
Definition at line 47 of file ffi_mac.cpp.
References BOTAN_FFI_VISIT.
int botan_mac_set_key | ( | botan_mac_t | mac, |
const uint8_t * | key, | ||
size_t | key_len ) |
Sets the key on the MAC
mac | mac object |
key | buffer holding the key |
key_len | size of the key buffer in bytes |
Definition at line 39 of file ffi_mac.cpp.
References BOTAN_FFI_VISIT.
int botan_mac_set_nonce | ( | botan_mac_t | mac, |
const uint8_t * | nonce, | ||
size_t | nonce_len ) |
Sets the nonce on the MAC
mac | mac object |
nonce | buffer holding the key |
nonce_len | size of the key buffer in bytes |
Definition at line 43 of file ffi_mac.cpp.
References BOTAN_FFI_VISIT.
int botan_mac_update | ( | botan_mac_t | mac, |
const uint8_t * | buf, | ||
size_t | len ) |
Send more input to the message authentication code
mac | mac object |
buf | input buffer |
len | number of bytes to read from the input buffer |
Definition at line 55 of file ffi_mac.cpp.
References BOTAN_FFI_VISIT.