This module provides optional support for Keyed-Hash Message Authentication Codes. It is intended to comply with RFC 2104. More...
Macros | |
| #define | MAIN_ERR_PREFIX "HMAC: " |
| Message prefix for HMAC module. | |
Enumerations | |
| enum | hmac_alg { HMAC_ALG_SHA1_160, HMAC_ALG_SHA2_256 } |
Functions | |
| int | hmac_sha1_160 (const char *text, size_t text_len, const char *key, size_t key_len, unsigned char *mac) |
| Message Authentication Code based on SHA1-160 hash algorithm. More... | |
| int | hmac_sha2_256 (const char *text, size_t text_len, const char *key, size_t key_len, unsigned char *mac) |
| Message Authentication Code based on SHA2-256 hash algorithm. More... | |
| void | hmac_init (void) |
| Initialize HMAC module. | |
| void | hmac_exit (void) |
| Shutdown HMAC module. | |
Lenght of message authentication codes | |
| #define | HMAC_SHA1_160_LEN (size_t) 20 |
| 160 bit | |
| #define | HMAC_SHA2_256_LEN (size_t) 32 |
| 256 bit | |
This module provides optional support for Keyed-Hash Message Authentication Codes. It is intended to comply with RFC 2104.
| int hmac_sha1_160 | ( | const char * | text, |
| size_t | text_len, | ||
| const char * | key, | ||
| size_t | key_len, | ||
| unsigned char * | mac | ||
| ) |
Message Authentication Code based on SHA1-160 hash algorithm.
| [in] | text | Message |
| [in] | text_len | Message length |
| [in] | key | Key |
| [in] | key_len | Key length |
| [out] | mac | Result |
The values of paramaters text_len and key_len must represent bytes.
On success, the result is written to mac and has a length of HMAC_SHA1_160_LEN bytes.
Definition at line 224 of file hmac.c.
Referenced by core_get_cancel_key().
| int hmac_sha2_256 | ( | const char * | text, |
| size_t | text_len, | ||
| const char * | key, | ||
| size_t | key_len, | ||
| unsigned char * | mac | ||
| ) |
Message Authentication Code based on SHA2-256 hash algorithm.
| [in] | text | Message |
| [in] | text_len | Message length |
| [in] | key | Key |
| [in] | key_len | Key length |
| [out] | mac | Result |
The values of paramaters text_len and key_len must represent bytes.
On success, the result is written to mac and has a length of HMAC_SHA2_256_LEN bytes.
Definition at line 250 of file hmac.c.
Referenced by core_get_cancel_key().