Feistel ciphering class.
Macros:
Definition of the round function parent class. Round functions passed to CapyFeistelCipher methods must inherits this class. It has a dummy 'run' method for test purpose (which simply xor its input with the key). The inheriting class should replace it with its own round function in its constructor. The 'run' method is called by CapyFeistelCipher at each round with arguments: key: a null terminated string, the key to be used by the round function block: the block of data to which apply the round function sizeData: the size in byte of the block of data output: the adress in memory where to write the output of the round function (must be already allocated and have same size as 'block')
Enumerations:
Operation modes of the Feistel network
Typedefs:
Typedef for the keys
Typedef for the list of keys
Round function parent class
Type of the counter for CTR mode
Struct CapyFeistelCipher :
Struct CapyFeistelCipher's properties:
Operation mode
Initialisation vector
Counter for CTR mode
Struct CapyFeistelCipher's methods:
Destructor
Cipher function
Input argument(s):
roundFun: the round function used to cipher
keys: the keys used to cipher, a list of null terminated strings
data: the data to cipher
Output and side effect(s):
Return a newly allocated array of 'sizeData' bytes containing the ciphered data. Exceptions: May raise CapyExc_MallocFailed
Decipher function
Input argument(s):
roundFun: the round function used to decipher
keys: the keys used to decipher, a list of null terminated strings
data: the data to decipher
Output and side effect(s):
Return a newly allocated array of 'sizeData' bytes containing the deciphered data. Exceptions: May raise CapyExc_MallocFailed
Set the initialisation vector for CBC and CTR mode
Input argument(s):
initVector, the initialisation vector Exceptions: May raise CapyExc_MallocFailed
Functions:
Create a CapyFeistelRoundFun
Output and side effect(s):
Return a CapyFeistelRoundFun
Create a CapyFeistelCipher
Input argument(s):
opMode: operation mode
Output and side effect(s):
Return a CapyFeistelCipher
Exception(s):
May raise CapyExc_MallocFailed, CapyExc_UndefinedExecution.
Allocate memory for a new CapyFeistelCipher and create it
Input argument(s):
opMode: operation mode
Output and side effect(s):
Return a CapyFeistelCipher
Exception(s):
May raise CapyExc_MallocFailed, CapyExc_UndefinedExecution.
Free the memory used by a CapyFeistelCipher* and reset '*that' to NULL
Input argument(s):
that: a pointer to the CapyFeistelCipher to free