EncInit

This function initializes the cipher object for an encrypt operation. It must be called prior to any EncryptUpdate or EncryptFinal calls.

Synopsis

#include “fmciphobj.h”
int (*EncInit)(struct CipherObj * ctx,
int mode,
const void * key, unsigned int klength,
const void * param, unsigned int plength);
Parameter Description
ctx The address of a cipher object instance.
mode The encrypt mode. Different algorithms support different values for this parameter. Please consult Algorithm-Specific Cipher Information for the possible values for a certain algorithm.
key The address of a buffer containing the key value. The encoding of the key is algorithm-dependent. However, for most block ciphers, this buffer contains the key value. Please consult Algorithm-Specific Cipher Information for key encoding information.
klength Number of bytes in the key buffer.
param The address of the buffer containing various parameters for the encrypt operation. The contents and the encoding of this buffer are algorithm and mode dependent. However, for most block ciphers this buffer contains the IV when one of the CBC modes is used. Please consult Algorithm-Specific Cipher Information for key encoding information.
plength Number of bytes in the param buffer.

Return Value

0: The operation was successful.

Otherwise: An error occurred.