Ordo  0.3.4
Symmetric Cryptography Library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Functions
hmac.h File Reference

Module. More...

#include "ordo/digest/digest.h"
Include dependency graph for hmac.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

ORDO_PUBLIC int hmac_init (struct HMAC_CTX *ctx, const void *key, size_t key_len, prim_t hash, const void *params)
 
ORDO_PUBLIC void hmac_update (struct HMAC_CTX *ctx, const void *in, size_t in_len)
 
ORDO_PUBLIC int hmac_final (struct HMAC_CTX *ctx, void *fingerprint)
 
ORDO_PUBLIC size_t hmac_bsize (void)
 

Detailed Description

Module.

Module for computing HMAC's (Hash-based Message Authentication Codes), which combine a hash function with a cryptographic key securely in order to provide both authentication and integrity, as per RFC 2104.

Function Documentation

ORDO_PUBLIC int hmac_init ( struct HMAC_CTX *  ctx,
const void *  key,
size_t  key_len,
prim_t  hash,
const void *  params 
)

Initializes an HMAC context, provided optional parameters.

Parameters
[in]ctxAn allocated HMAC context.
[in]keyThe cryptographic key to use.
[in]key_lenThe size, in bytes, of the key.
[out]hashA hash function primitive to use.
[out]paramsHash function specific parameters.
Returns
ORDO_SUCCESS on success, else an error code.
Remarks
The hash parameters apply to the inner hash operation only, which is the one used to hash the raw message and masked key.
ORDO_PUBLIC void hmac_update ( struct HMAC_CTX *  ctx,
const void *  in,
size_t  in_len 
)

Updates an HMAC context, feeding more data into it.

Parameters
[in]ctxAn initialized HMAC context.
[in]inThe data to feed into the context.
[in]in_lenThe length, in bytes, of the data.
Remarks
This function has the same properties, with respect to the input buffer, as the digest_update() function.
ORDO_PUBLIC int hmac_final ( struct HMAC_CTX *  ctx,
void *  fingerprint 
)

Finalizes a HMAC context, returning the final fingerprint.

Parameters
[in]ctxAn initialized HMAC context.
[out]fingerprintThe output buffer for the fingerprint.
Returns
ORDO_SUCCESS on success, else an error code.
Remarks
The fingerprint length is equal to the underlying hash function's digest length, which can be queried via hash_digest_length().
ORDO_PUBLIC size_t hmac_bsize ( void  )

Gets the size in bytes of an HMAC_CTX.

Returns
The size in bytes of the structure.
Remarks
Binary compatibility layer.