DecryptUpdate

Synopsis

#include “fmciphobj.h”
int (*DecryptUpdate)(struct CipherObj * ctx,
void * tgt, unsigned int tlength, unsigned int * plen,
const void * src, unsigned int length);  

Description

This function is used to decrypt some data. This function can be used in two ways: discovering the output buffer length, or performing decryption.

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 and the input buffer contents are combined, and as many blocks as possible are decrypted. The result of the decrypted blocks are placed in the output buffer. If there are any remaining bytes, they are internally buffered. The number of bytes placed in the target buffer is also written to the variable pointed by plen.

Parameters

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.

src

Address of the buffer containing the input data.

length

Number of bytes in the src buffer.

Return Value

0: Operation completed successfully.

Otherwise: There was an error.