Lightweight Cryptography Primitives
|
Hashed Message Authentication Code (HMAC) based on Romulus-H. More...
Go to the source code of this file.
Macros | |
#define | ROMULUS_HMAC_SIZE ROMULUS_HASH_SIZE |
Default size of the output for Romulus-HMAC. | |
Typedefs | |
typedef romulus_hash_state_t | romulus_hmac_state_t |
State information for the Romulus-HMAC incremental mode. | |
Functions | |
void | romulus_hmac (unsigned char *out, const unsigned char *key, size_t keylen, const unsigned char *in, size_t inlen) |
Computes a HMAC value using Romulus-H. More... | |
void | romulus_hmac_init (romulus_hmac_state_t *state, const unsigned char *key, size_t keylen) |
Initializes an incremental HMAC state using Romulus-H. More... | |
void | romulus_hmac_update (romulus_hmac_state_t *state, const unsigned char *in, size_t inlen) |
Updates an incremental Romulus-HMAC state with more input data. More... | |
void | romulus_hmac_finalize (romulus_hmac_state_t *state, const unsigned char *key, size_t keylen, unsigned char *out) |
Finalizes an incremental Romulus-HMAC state. More... | |
Hashed Message Authentication Code (HMAC) based on Romulus-H.
The HMAC mode provides a method to authenticate a sequence of bytes using Romulus-H as the underlying digest algorithm.
HMAC uses an underlying block size to pad the key data. The Romulus-H block absorption rate of 32 bytes is too short so we use the HMAC-SHA-256 block size of 64 instead.
Reference: https://tools.ietf.org/html/rfc2104
void romulus_hmac | ( | unsigned char * | out, |
const unsigned char * | key, | ||
size_t | keylen, | ||
const unsigned char * | in, | ||
size_t | inlen | ||
) |
Computes a HMAC value using Romulus-H.
out | Buffer to receive the output HMAC value; must be at least ROMULUS_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 romulus_hmac_finalize | ( | romulus_hmac_state_t * | state, |
const unsigned char * | key, | ||
size_t | keylen, | ||
unsigned char * | out | ||
) |
Finalizes an incremental Romulus-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 ROMULUS_HMAC_SIZE bytes in length. |
void romulus_hmac_init | ( | romulus_hmac_state_t * | state, |
const unsigned char * | key, | ||
size_t | keylen | ||
) |
Initializes an incremental HMAC state using Romulus-H.
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 romulus_hmac_finalize() call to provide the outer HMAC hashing key.
void romulus_hmac_update | ( | romulus_hmac_state_t * | state, |
const unsigned char * | in, | ||
size_t | inlen | ||
) |
Updates an incremental Romulus-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. |