|
Lightweight Cryptography Primitives
|
Hashed Message Authentication Code (HMAC) based on ASCON-HASH. More...
#include "ascon-hash.h"Go to the source code of this file.
Macros | |
| #define | ASCON_HMAC_SIZE ASCON_HASH_SIZE |
| Default size of the output for ASCON-HMAC and ASCON-HMACA. | |
Typedefs | |
| typedef ascon_xof_state_t | ascon_hmac_state_t |
| State information for the ASCON-HMAC and ASCON-HMACA incremental modes. | |
Functions | |
| void | ascon_hmac (unsigned char *out, const unsigned char *key, size_t keylen, const unsigned char *in, size_t inlen) |
| Computes a HMAC value using ASCON-HASH. More... | |
| void | ascon_hmac_init (ascon_hmac_state_t *state, const unsigned char *key, size_t keylen) |
| Initializes an incremental HMAC state using ASCON-HASH. More... | |
| void | ascon_hmac_update (ascon_hmac_state_t *state, const unsigned char *in, size_t inlen) |
| Updates an incremental ASCON-HMAC state with more input data. More... | |
| void | ascon_hmac_finalize (ascon_hmac_state_t *state, const unsigned char *key, size_t keylen, unsigned char *out) |
| Finalizes an incremental ASCON-HMAC state. More... | |
| void | ascon_hmaca (unsigned char *out, const unsigned char *key, size_t keylen, const unsigned char *in, size_t inlen) |
| Computes a HMAC value using ASCON-HASHA. More... | |
| void | ascon_hmaca_init (ascon_hmac_state_t *state, const unsigned char *key, size_t keylen) |
| Initializes an incremental HMAC state using ASCON-HASHA. More... | |
| void | ascon_hmaca_update (ascon_hmac_state_t *state, const unsigned char *in, size_t inlen) |
| Updates an incremental ASCON-HMACA state with more input data. More... | |
| void | ascon_hmaca_finalize (ascon_hmac_state_t *state, const unsigned char *key, size_t keylen, unsigned char *out) |
| Finalizes an incremental ASCON-HMACA state. More... | |
Hashed Message Authentication Code (HMAC) based on ASCON-HASH.
The HMAC mode provides a method to authenticate a sequence of bytes using ASCON-HASH or ASCON-HASHA as the underlying digest algorithm.
HMAC uses an underlying block size to pad the key data. The ASCON-HASH block absorption rate of 8 bytes is too short so we use the HMAC-SHA-256 block size of 64 instead.
Reference: https://tools.ietf.org/html/rfc2104
| void ascon_hmac | ( | unsigned char * | out, |
| const unsigned char * | key, | ||
| size_t | keylen, | ||
| const unsigned char * | in, | ||
| size_t | inlen | ||
| ) |
Computes a HMAC value using ASCON-HASH.
| out | Buffer to receive the output HMAC value; must be at least ASCON_HMAC_SIZE bytes in length. |
| key | Points to the key. |
| keylen | Number of bytes in the key. |
| in | Points to the data to authenticate. |
| inlen | Number of bytes of data to authenticate. |
| void ascon_hmac_finalize | ( | ascon_hmac_state_t * | state, |
| const unsigned char * | key, | ||
| size_t | keylen, | ||
| unsigned char * | out | ||
| ) |
Finalizes an incremental ASCON-HMAC state.
| state | HMAC state to squeeze the output data from. |
| key | Points to the key. |
| keylen | Number of bytes in the key. |
| out | Points to the output buffer to receive the HMAC value; must be at least ASCON_HMAC_SIZE bytes in length. |
| void ascon_hmac_init | ( | ascon_hmac_state_t * | state, |
| const unsigned char * | key, | ||
| size_t | keylen | ||
| ) |
Initializes an incremental HMAC state using ASCON-HASH.
| state | Points to the state to be initialized. |
| key | Points to the key. |
| keylen | Number of bytes in the key. |
The key needs to be preserved until the ascon_hmac_finalize() call to provide the outer HMAC hashing key.
| void ascon_hmac_update | ( | ascon_hmac_state_t * | state, |
| const unsigned char * | in, | ||
| size_t | inlen | ||
| ) |
Updates an incremental ASCON-HMAC state with more input data.
| state | HMAC state to be updated. |
| in | Points to the input data to be incorporated into the state. |
| inlen | Length of the input data to be incorporated into the state. |
| void ascon_hmaca | ( | unsigned char * | out, |
| const unsigned char * | key, | ||
| size_t | keylen, | ||
| const unsigned char * | in, | ||
| size_t | inlen | ||
| ) |
Computes a HMAC value using ASCON-HASHA.
| out | Buffer to receive the output HMAC value; must be at least ASCON_HMAC_SIZE bytes in length. |
| key | Points to the key. |
| keylen | Number of bytes in the key. |
| in | Points to the data to authenticate. |
| inlen | Number of bytes of data to authenticate. |
| void ascon_hmaca_finalize | ( | ascon_hmac_state_t * | state, |
| const unsigned char * | key, | ||
| size_t | keylen, | ||
| unsigned char * | out | ||
| ) |
Finalizes an incremental ASCON-HMACA state.
| state | HMAC state to squeeze the output data from. |
| key | Points to the key. |
| keylen | Number of bytes in the key. |
| out | Points to the output buffer to receive the HMAC value; must be at least ASCON_HMAC_SIZE bytes in length. |
| void ascon_hmaca_init | ( | ascon_hmac_state_t * | state, |
| const unsigned char * | key, | ||
| size_t | keylen | ||
| ) |
Initializes an incremental HMAC state using ASCON-HASHA.
| state | Points to the state to be initialized. |
| key | Points to the key. |
| keylen | Number of bytes in the key. |
The key needs to be preserved until the ascon_hmaca_finalize() call to provide the outer HMAC hashing key.
| void ascon_hmaca_update | ( | ascon_hmac_state_t * | state, |
| const unsigned char * | in, | ||
| size_t | inlen | ||
| ) |
Updates an incremental ASCON-HMACA state with more input data.
| state | HMAC state to be updated. |
| in | Points to the input data to be incorporated into the state. |
| inlen | Length of the input data to be incorporated into the state. |
1.8.6