ccRTP 2.1.2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
hmac.h File Reference

Functions to compute SHA1 HAMAC. More...

#include <stdint.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.

#define SHA1_DIGEST_LENGTH   20
 
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[], uint32_t data_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...
 

Detailed Description

Functions to compute SHA1 HAMAC.

Author
Erik Eliasson elias.nosp@m.son@.nosp@m.it.kt.nosp@m.h.se
Johan Bilien jobi@.nosp@m.via..nosp@m.ecp.f.nosp@m.r
Werner Dittmann

Functions that provide SHA1 HMAC support

Definition in file hmac.h.

Macro Definition Documentation

#define SHA1_DIGEST_LENGTH   20

Definition at line 54 of file hmac.h.

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 70 of file gcrypthmac.cpp.

void freeSha1HmacContext ( void *  ctx)

Free SHA1 HMAC context.

Parameters
ctxa pointer to SHA1 HMAC context

Definition at line 113 of file gcrypthmac.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 47 of file gcrypthmac.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 79 of file gcrypthmac.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 95 of file gcrypthmac.cpp.