Lightweight Cryptography Primitives
|
Hashed Message Authentication Code (HMAC) based on SPARKLE. More...
Go to the source code of this file.
Macros | |
#define | ESCH_256_HMAC_SIZE ESCH_256_HASH_SIZE |
Default size of the output for Esch256-HMAC. | |
#define | ESCH_384_HMAC_SIZE ESCH_384_HASH_SIZE |
Default size of the output for Esch384-HMAC. | |
Typedefs | |
typedef esch_256_hash_state_t | esch_256_hmac_state_t |
State information for the Esch256-HMAC incremental mode. | |
typedef esch_384_hash_state_t | esch_384_hmac_state_t |
State information for the Esch384-HMAC incremental mode. | |
Functions | |
void | esch_256_hmac (unsigned char *out, const unsigned char *key, size_t keylen, const unsigned char *in, size_t inlen) |
Computes a HMAC value using Esch256. More... | |
void | esch_256_hmac_init (esch_256_hmac_state_t *state, const unsigned char *key, size_t keylen) |
Initializes an incremental HMAC state using Esch256. More... | |
void | esch_256_hmac_update (esch_256_hmac_state_t *state, const unsigned char *in, size_t inlen) |
Updates an incremental Esch256-HMAC state with more input data. More... | |
void | esch_256_hmac_finalize (esch_256_hmac_state_t *state, const unsigned char *key, size_t keylen, unsigned char *out) |
Finalizes an incremental Esch256-HMAC state. More... | |
void | esch_384_hmac (unsigned char *out, const unsigned char *key, size_t keylen, const unsigned char *in, size_t inlen) |
Computes a HMAC value using Esch384. More... | |
void | esch_384_hmac_init (esch_384_hmac_state_t *state, const unsigned char *key, size_t keylen) |
Initializes an incremental HMAC state using Esch384. More... | |
void | esch_384_hmac_update (esch_384_hmac_state_t *state, const unsigned char *in, size_t inlen) |
Updates an incremental Esch384-HMAC state with more input data. More... | |
void | esch_384_hmac_finalize (esch_384_hmac_state_t *state, const unsigned char *key, size_t keylen, unsigned char *out) |
Finalizes an incremental Esch384-HMAC state. More... | |
Hashed Message Authentication Code (HMAC) based on SPARKLE.
The HMAC mode provides a method to authenticate a sequence of bytes using either Esch256 or Esch384 as the underlying digest algorithm.
HMAC uses an underlying block size to pad the key data. The SPARKLE block absorption rate of 16 bytes is too short so we use the HMAC-SHA-256 and HMAC-SHA-384 block sizes of 64 and 128 instead.
Reference: https://tools.ietf.org/html/rfc2104
void esch_256_hmac | ( | unsigned char * | out, |
const unsigned char * | key, | ||
size_t | keylen, | ||
const unsigned char * | in, | ||
size_t | inlen | ||
) |
Computes a HMAC value using Esch256.
out | Buffer to receive the output HMAC value; must be at least ESCH_256_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 esch_256_hmac_finalize | ( | esch_256_hmac_state_t * | state, |
const unsigned char * | key, | ||
size_t | keylen, | ||
unsigned char * | out | ||
) |
Finalizes an incremental Esch256-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 ESCH_256_HMAC_SIZE bytes in length. |
void esch_256_hmac_init | ( | esch_256_hmac_state_t * | state, |
const unsigned char * | key, | ||
size_t | keylen | ||
) |
Initializes an incremental HMAC state using Esch256.
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 esch_256_hmac_finalize() call to provide the outer HMAC hashing key.
void esch_256_hmac_update | ( | esch_256_hmac_state_t * | state, |
const unsigned char * | in, | ||
size_t | inlen | ||
) |
Updates an incremental Esch256-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 esch_384_hmac | ( | unsigned char * | out, |
const unsigned char * | key, | ||
size_t | keylen, | ||
const unsigned char * | in, | ||
size_t | inlen | ||
) |
Computes a HMAC value using Esch384.
out | Buffer to receive the output HMAC value; must be at least ESCH_384_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 esch_384_hmac_finalize | ( | esch_384_hmac_state_t * | state, |
const unsigned char * | key, | ||
size_t | keylen, | ||
unsigned char * | out | ||
) |
Finalizes an incremental Esch384-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 ESCH_384_HMAC_SIZE bytes in length. |
void esch_384_hmac_init | ( | esch_384_hmac_state_t * | state, |
const unsigned char * | key, | ||
size_t | keylen | ||
) |
Initializes an incremental HMAC state using Esch384.
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 esch_384_hmac_finalize() call to provide the outer HMAC hashing key.
void esch_384_hmac_update | ( | esch_384_hmac_state_t * | state, |
const unsigned char * | in, | ||
size_t | inlen | ||
) |
Updates an incremental Esch384-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. |