UpdatePdata

nn::crypto::AuthenticatedEncryptor::UpdatePdata Member Function

Syntax

virtual size_t UpdatePdata(
     void * pDst,
     size_t dstSize,
     const void * pSrc,
     size_t srcSize
) = 0;

Parameters

Name Description
out pDst Pointer to the buffer storing the encryption results.
in dstSize Size of the buffer specified by pDst.
in pSrc Pointer to the buffer storing the Pdata.
in srcSize Pdata size in bytes.

Return Values

Returns the number of bytes written to pDst.

Description

Specifies the Pdata and gets the encryption result.

The Pdata is data for MAC and also for encryption.

You must call the UpdateAdataFinal function before calling this function.

You can call this function multiple times before calling the UpdatePdataFinal function. However, input data is all handled as a single consolidation, so note that the order of input is significant.

The size of the buffer required for pDst is (the total of all size values specified in the UpdatePdata function calls, including the current call) - (the total of all UpdatePdata function return values, excluding the current call). For instance, if you have called the UpdatePdata function three times and specified size values of 500, 600, and 700, and the return values were 450, 620, and 660. Then in your next call to the UpdatePdata function, you would have to specify a buffer in pDst that is as big as the size value for that plus (500 + 600 + 700) - (450 + 620 + 660) = 70 bytes. The value of (the total of all size values specified in the UpdatePdata function calls, including the current call) - (the total of all UpdatePdata function return values, excluding the current call). That is, the size of the buffer you must specify in pDst cannot be any bigger than (size + the block size).

The function fails and displays an error if the size of the return value is larger than the buffer size specified in dstSize. Data is not written to the buffer beyond the size specified in dstSize. If the size of the return value is not larger than dstSize, the function indicates a successful completion and writes the size of the return value in pDst.

If this function fails, encryption cannot continue. You must then try again, starting by calling the Initialize function.

Revision History

2011/10/27
Initial version.

CONFIDENTIAL