ccRTP 2.1.2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
hmac.cpp File Reference
#include <stdint.h>
#include <openssl/hmac.h>
#include <crypto/hmac.h>
Include dependency graph for hmac.cpp:

Go to the source code of this file.

Functions

void hmac_sha1 (uint8_t *key, int32_t key_length, const uint8_t *data, uint32_t data_length, uint8_t *mac, int32_t *mac_length)
 Compute SHA1 HMAC. More...
 
void hmac_sha1 (uint8_t *key, int32_t key_length, const uint8_t *data_chunks[], uint32_t data_chunck_length[], uint8_t *mac, int32_t *mac_length)
 Compute SHA1 HMAC over several data cunks. More...
 
void * createSha1HmacContext (uint8_t *key, int32_t key_length)
 Create and initialize a SHA1 HMAC context. More...
 
void hmacSha1Ctx (void *ctx, const uint8_t *data, uint32_t data_length, uint8_t *mac, int32_t *mac_length)
 Compute SHA1 HMAC. More...
 
void hmacSha1Ctx (void *ctx, const uint8_t *data[], uint32_t data_length[], uint8_t *mac, int32_t *mac_length)
 Compute SHA1 HMAC over several data cunks. More...
 
void freeSha1HmacContext (void *ctx)
 Free SHA1 HMAC context. More...
 

Function Documentation

void* createSha1HmacContext ( uint8_t *  key,
int32_t  key_length 
)

Create and initialize a SHA1 HMAC context.

An application uses this context to create several HMAC with the same key.

Parameters
keyThe MAC key.
key_lengthLenght of the MAC key in bytes
Returns
Returns a pointer to the initialized context

Definition at line 67 of file hmac.cpp.

void freeSha1HmacContext ( void *  ctx)

Free SHA1 HMAC context.

Parameters
ctxa pointer to SHA1 HMAC context

Definition at line 100 of file hmac.cpp.

void hmac_sha1 ( uint8_t *  key,
int32_t  key_length,
const uint8_t *  data,
uint32_t  data_length,
uint8_t *  mac,
int32_t *  mac_length 
)

Compute SHA1 HMAC.

This functions takes one data chunk and computes its SHA1 HMAC.

Parameters
keyThe MAC key.
key_lengthLneght of the MAC key in bytes
dataPoints to the data chunk.
data_lengthLength of the data in bytes
macPoints to a buffer that receives the computed digest. This buffer must have a size of at least 20 bytes (SHA1_DIGEST_LENGTH).
mac_lengthPoint to an integer that receives the length of the computed HMAC.

Definition at line 42 of file hmac.cpp.

void hmac_sha1 ( uint8_t *  key,
int32_t  key_length,
const uint8_t *  data[],
uint32_t  data_length[],
uint8_t *  mac,
int32_t *  mac_length 
)

Compute SHA1 HMAC over several data cunks.

This functions takes several data chunk and computes the SHA1 HAMAC.

Parameters
keyThe MAC key.
key_lengthLneght of the MAC key in bytes
dataPoints to an array of pointers that point to the data chunks. A NULL pointer in an array element terminates the data chunks.
data_lengthPoints to an array of integers that hold the length of each data chunk.
macPoints to a buffer that receives the computed digest. This buffer must have a size of at least 20 bytes (SHA1_DIGEST_LENGTH).
mac_lengthPoint to an integer that receives the length of the computed HMAC.

Definition at line 51 of file hmac.cpp.

void hmacSha1Ctx ( void *  ctx,
const uint8_t *  data,
uint32_t  data_length,
uint8_t *  mac,
int32_t *  mac_length 
)

Compute SHA1 HMAC.

This functions takes one data chunk and computes its SHA1 HMAC. On return the SHA1 MAC context is ready to compute a HMAC for another data chunk.

Parameters
ctxPointer to initialized SHA1 HMAC context
dataPoints to the data chunk.
data_lengthLength of the data in bytes
macPoints to a buffer that receives the computed digest. This buffer must have a size of at least 20 bytes (SHA1_DIGEST_LENGTH).
mac_lengthPoint to an integer that receives the length of the computed HMAC.

Definition at line 76 of file hmac.cpp.

void hmacSha1Ctx ( void *  ctx,
const uint8_t *  data[],
uint32_t  data_length[],
uint8_t *  mac,
int32_t *  mac_length 
)

Compute SHA1 HMAC over several data cunks.

This functions takes several data chunks and computes the SHA1 HAMAC. On return the SHA1 MAC context is ready to compute a HMAC for another data chunk.

Parameters
ctxPointer to initialized SHA1 HMAC context
dataPoints to an array of pointers that point to the data chunks. A NULL pointer in an array element terminates the data chunks.
data_lengthPoints to an array of integers that hold the length of each data chunk.
macPoints to a buffer that receives the computed digest. This buffer must have a size of at least 20 bytes (SHA1_DIGEST_LENGTH).
mac_lengthPoint to an integer that receives the length of the computed HMAC.

Definition at line 86 of file hmac.cpp.