POK
des.c File Reference

DES crypto protocol. More...

Go to the source code of this file.

Functions

void pok_protocols_des_init ()
void pok_protocols_des_marshall (void *uncrypted_data, pok_size_t uncrypted_size, void *crypted_data, size_t *crypted_size)
void pok_protocols_des_unmarshall (void *crypted_data, pok_size_t crypted_size, void *uncrypted_data, size_t *uncrypted_size)

Variables

unsigned char initVector [8] = POK_PROTOCOLS_DES_INIT
int pok_protocols_des_is_init = 0

Detailed Description

DES crypto protocol.

Author:
Julien Delange
Date:
2009 This file is a wrapper that interfaces with OpenSSL functions. It sets the crypto key, initialisation string and calls OpenSSL function to crypts data.

Definition in file des.c.


Function Documentation

void pok_protocols_des_marshall ( void *  uncrypted_data,
pok_size_t  uncrypted_size,
void *  crypted_data,
size_t *  crypted_size 
)

Function that crypts data.

Definition at line 54 of file des.c.

{
DES_cblock ivec;
DES_key_schedule schedule;
DES_set_key_checked (&cbc_key, &schedule);
memcpy(ivec,initVector,sizeof(initVector));
DES_ncbc_encrypt(uncrypted_data, crypted_data, uncrypted_size, &schedule, &ivec, DES_ENCRYPT);
*crypted_size = 8;
}
void pok_protocols_des_unmarshall ( void *  crypted_data,
pok_size_t  crypted_size,
void *  uncrypted_data,
size_t *  uncrypted_size 
)

Function that uncrypts data.

Definition at line 68 of file des.c.

{
DES_cblock ivec;
DES_key_schedule schedule;
DES_set_key_checked (&cbc_key, &schedule);
memcpy(ivec,initVector,sizeof(initVector));
DES_ncbc_encrypt(crypted_data, uncrypted_data, crypted_size, &schedule, &ivec, DES_DECRYPT);
*uncrypted_size = 8;
}