EncryptFinal

This function must be called to finish an encryption operation. It can be used for either discovering the target buffer length, or for actually performing the operation.

If the target buffer address, tgt, is NULL, then the variable pointed to by plen is updated to contain the length of the output that is required to perform the operation.

If the target buffer address is not NULL, then the currently buffered data is padded (if the mode permits it), and encrypted. The result is placed in the tgt buffer. The number of bytes placed in the target buffer is also written to the variable pointed by plen. If the current mode does not allow padding, and there is buffered data, then an error is returned.

Synopsis

#include “fmciphobj.h”
int (*EncryptFinal)(struct CipherObj * ctx,
void * tgt, unsigned int tlength, unsigned int * plen);
Parameter Description
ctx The address of a cipher object instance.
tgt The address of the output buffer. It may be set to NULL for output buffer length estimation.
tlength Total number of bytes available in the output buffer.
plen Address of a variable that will receive the number of bytes placed in the target buffer. This variable must not be NULL.

Return Value

0: Operation completed successfully.

Otherwise: There was an error.

Comments

This function finalizes the encryption context. EncInit() must be called again to encrypt more data, even when the key is the same.