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

encr.h File Reference

#include "common.h"

Go to the source code of this file.

Defines

#define IKEv2_ENCRYPT   1
#define IKEv2_DECRYPT   0

Functions

uint32_t GetEncrKeyLen (uint32_t type, uint16_t keylen)
 Get encryption key length.
uint32_t GetEncrBlockLen (uint32_t type, uint32_t keylen)
 Get length of block for specific encryption algorithm.
int EncrKeyLenValid (uint32_t type, uint32_t keylen)
 Check for valid key length.
void IKEv2Crypt (uint8_t *data, uint32_t dlen, uint8_t *iv, uint8_t *key, uint32_t type, uint32_t keylen, int enc)
 Encrypt/decrypt a block of data.


Define Documentation

#define IKEv2_DECRYPT   0
 

#define IKEv2_ENCRYPT   1
 


Function Documentation

int EncrKeyLenValid uint32_t  type,
uint32_t  keylen
 

Check for valid key length.

Parameters:
type encryption algorithm
keylen encryption algorithm key length in bites
Returns:
0 on success, 1 otherwise

uint32_t GetEncrBlockLen uint32_t  type,
uint32_t  keylen
[inline]
 

Get length of block for specific encryption algorithm.

Parameters:
type type of the encryption algorithm
keylen key length of encryption algorithm (optional)
Returns:
block length of encryption algorithm

uint32_t GetEncrKeyLen uint32_t  type,
uint16_t  keylen
[inline]
 

Get encryption key length.

Parameters:
type type of encryption algorithm
keylen key length in bites (optional)
Returns:
the key len of crypto algo in bytes

void IKEv2Crypt uint8_t *  data,
uint32_t  dlen,
uint8_t *  iv,
uint8_t *  key,
uint32_t  type,
uint32_t  keylen,
int  enc
 

Encrypt/decrypt a block of data.

Parameters:
*data ptr to src buffer = dst buffer
dlen len of data (length should be a multiple of block len)
*iv initialization vector
*key key for cipher
type type of crypt algo
keylen key length parameter (optional)
enc IKEv2_ENCRYPT for encryption, IKEv2_DECRYPT for decryption


Project hosted by: SourceForge.net Logo