NIST Standard FIPS 198 describes the Keyed-Hash Message Authentication Code (HMAC) which is used as hash function for the DTLS PRF.
#define DTLS_HMAC_BLOCKSIZE 64 |
size of hmac blocks
Definition at line 73 of file hmac.h.
#define DTLS_HMAC_DIGEST_SIZE 32 |
digest size (for SHA-256)
Definition at line 74 of file hmac.h.
max number of bytes in digest
Definition at line 75 of file hmac.h.
List of known hash functions for use in dtls_hmac_init(). The identifiers are the same as the HashAlgorithm defined in Section 7.4.1.4.1 of RFC 5246.
Enumerator |
---|
HASH_NONE |
|
HASH_MD5 |
|
HASH_SHA1 |
|
HASH_SHA224 |
|
HASH_SHA256 |
|
HASH_SHA384 |
|
HASH_SHA512 |
|
Definition at line 83 of file hmac.h.
Completes the HMAC generation and writes the result to the given output parameter result
. The buffer must be large enough to hold the message digest created by the actual hash function. If in doubt, use DTLS_HMAC_MAX
. The function returns the number of bytes written to result
.
- Parameters
-
ctx | The HMAC context. |
result | Output parameter where the MAC is written to. |
- Returns
- Length of the MAC written to
result
.
Definition at line 127 of file hmac.c.
Releases the storage for ctx
that has been allocated by dtls_hmac_new().
- Parameters
-
Definition at line 121 of file hmac.c.
Initializes an existing HMAC context.
- Parameters
-
ctx | The HMAC context to initialize. |
key | The secret key. |
klen | The length of key . |
Definition at line 94 of file hmac.c.
Allocates a new HMAC context ctx
with the given secret key. This function returns 1
if ctx
has been set correctly, or 0
or -1
otherwise. Note that this function allocates new storage that must be released by dtls_hmac_free().
- Parameters
-
key | The secret key. |
klen | The length of key . |
- Returns
- A new dtls_hmac_context_t object or
NULL
on error
Definition at line 83 of file hmac.c.
Updates the HMAC context with data from input
.
- Parameters
-
ctx | The HMAC context. |
input | The input data. |
ilen | Size of input . |
Definition at line 76 of file hmac.c.