Main Page | Data Structures | File List | Data Fields | Globals | Related Pages

prf.c File Reference

#include "common.h"
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include "prf.h"
#include "hmac.h"
#include "enums.h"

Functions

int32_t getDigestLength (uint32_t type)
 Get length of digest for a given prf algorithm.
int PrfKeyLenValid (uint32_t type, uint32_t keylen)
 Check for valid prf key length. Current implamentation always return success.
void prf (uint8_t *key, uint32_t klen, const uint8_t *text, uint32_t tlen, uint8_t **res, uint32_t *rlen, uint32_t prftype)
 Pseudo random function (prf).
void prf_plus (uint8_t *key, uint32_t klen, uint8_t *text, uint32_t tlen, uint8_t **res, uint32_t rlen, uint32_t prftype)
 Pseudo random function for longer results (prf+).

Function Documentation

int32_t getDigestLength uint32_t  type  )  [inline]
 

Get length of digest for a given prf algorithm.

Parameters:
type type of prf function
Returns:
length of digest (in bytes)

void prf uint8_t *  key,
uint32_t  klen,
const uint8_t *  text,
uint32_t  tlen,
uint8_t **  res,
uint32_t *  rlen,
uint32_t  prftype
 

Pseudo random function (prf).

Parameters:
*key key for hmac
klen length of key
*text data to be hashed
tlen length of text
**res result
*rlen length of result (output)
prftype type of pseudo random function (see IKEv2 specification)

void prf_plus uint8_t *  key,
uint32_t  klen,
uint8_t *  text,
uint32_t  tlen,
uint8_t **  res,
uint32_t  rlen,
uint32_t  prftype
 

Pseudo random function for longer results (prf+).

Parameters:
*key key for hmac
klen length of key
*text data to be hashed
tlen length of text
**res result
rlen length of result (input)
prftype type of pseudo random function (see IKEv2 specification)

int PrfKeyLenValid uint32_t  type,
uint32_t  keylen
[inline]
 

Check for valid prf key length. Current implamentation always return success.

Parameters:
type type of prf algorithm
keylen key length
Returns:
0 on success, 1 otherwise


Project hosted by: SourceForge.net Logo