Azinix

compcrypt.c File Reference

#include "evl.h"
#include "cryp.h"

Go to the source code of this file.

Functions

int Ucode_CompressDecompress (Pkt_EthernetHdr_t *pkt, int length, bool doCompress)
 Compress/decompress a packet - changes argument, assumes enough memory has been allocated in the packet itself. Leaves only the ethernet header uncompressed. Using the LZO algorithm on a single packet at a time.
int Ucode_Decompress (Evl_Manager_t *mgr, Pkt_ProcessPkt_t *pp, void **functionStatePtr)
 Decompress a packet.
int Ucode_Compress (Evl_Manager_t *mgr, Pkt_ProcessPkt_t *pp, void **functionStatePtr)
 Compress a packet.
void Ucode_Crypto (Cryp_Aes_t *aes, Pkt_ProcessPkt_t *pp, boolean doEncrypt)
 Encrypt a packet.
void Ucode_EncryptPkt (Evl_Manager_t *mgr, Pkt_ProcessPkt_t *pp, void **functionStatePtr, void *functionArgument)
 Encrypt a packet.
void Ucode_DecryptPkt (Evl_Manager_t *mgr, Pkt_ProcessPkt_t *pp, void **functionStatePtr, void *functionArgument)
 Decrypt a packet.
int decrypt (Evl_Manager_t *mgr, Pkt_ProcessPkt_t *pp, void **functionStatePtr, void *functionArgument)
 Decrypt a packet.
int encrypt (Evl_Manager_t *mgr, Pkt_ProcessPkt_t *pp, void **functionStatePtr, void *functionArgument)
 Encrypt a packet.


Function Documentation

int decrypt ( Evl_Manager_t mgr,
Pkt_ProcessPkt_t pp,
void **  functionStatePtr,
void *  functionArgument 
)

Decrypt a packet.

Directly calls the function Ucode_DecryptPkt - we need to do it this way to be able to export the name decrypt to the sheel

Definition at line 222 of file compcrypt.c.

int encrypt ( Evl_Manager_t mgr,
Pkt_ProcessPkt_t pp,
void **  functionStatePtr,
void *  functionArgument 
)

Encrypt a packet.

Directly calls the function Ucode_EncryptPkt - we need to do it this way to be able to export the name encrypt to the shell

Definition at line 240 of file compcrypt.c.

int Ucode_Compress ( Evl_Manager_t mgr,
Pkt_ProcessPkt_t pp,
void **  functionStatePtr 
)

Compress a packet.

Assuming packet is IP - in particular we set a new ethernet type field to denote the packet is compressed, and to revert we must know what the orig type was. (Perhaps we can play tricks with setting a single bit?)

will change with jumbo frames. see discussion about max increase in pkt size with lzo here http://www.oberhumer.com/opensource/lzo/lzofaq.php

Definition at line 91 of file compcrypt.c.

int Ucode_CompressDecompress ( Pkt_EthernetHdr_t pkt,
int  length,
bool  doCompress 
)

Compress/decompress a packet - changes argument, assumes enough memory has been allocated in the packet itself. Leaves only the ethernet header uncompressed. Using the LZO algorithm on a single packet at a time.

function prototype action->ucodeFunction( mgr, pp, & action->ucodeFunctionState );

Definition at line 33 of file compcrypt.c.

void Ucode_Crypto ( Cryp_Aes_t *  aes,
Pkt_ProcessPkt_t pp,
boolean  doEncrypt 
)

Encrypt a packet.

Only for Ip packets. Keeps header intact, does aes on payload. Not going to encrypt payload shorter than 16 bytes.

Returns 1 on succ encrypt, 0 on payload being too short.

Definition at line 133 of file compcrypt.c.

int Ucode_Decompress ( Evl_Manager_t mgr,
Pkt_ProcessPkt_t pp,
void **  functionStatePtr 
)

Decompress a packet.

Definition at line 63 of file compcrypt.c.

void Ucode_DecryptPkt ( Evl_Manager_t mgr,
Pkt_ProcessPkt_t pp,
void **  functionStatePtr,
void *  functionArgument 
)

Decrypt a packet.

Definition at line 202 of file compcrypt.c.

void Ucode_EncryptPkt ( Evl_Manager_t mgr,
Pkt_ProcessPkt_t pp,
void **  functionStatePtr,
void *  functionArgument 
)

Encrypt a packet.

Definition at line 160 of file compcrypt.c.