EncryptAndGenerate

nn::crypto::CcmEncryptor::EncryptAndGenerate Member Function

Syntax

static void EncryptAndGenerate(
     void * pMac,
     void * pDst,
     size_t dstSize,
     const void * pAdata,
     size_t adataSize,
     const void * pPdata,
     size_t pdataSize,
     const void * pIv,
     size_t ivSize,
     size_t macSize,
     const BlockCipher & c
);

Parameters

Name Description
out pMac Pointer to the buffer storing the MAC.
out pDst Pointer to the buffer storing the encryption results.
in dstSize Size of the buffer pointed to by pDst.
in pAdata Pointer to the buffer storing the Adata.
in adataSize Adata size in bytes.
in pPdata Pointer to the buffer storing the Pdata.
in pdataSize Pdata size in bytes.
in pIv Pointer to the buffer storing the IV.
in ivSize IV size in bytes.
in macSize MAC size in bytes.
in c Instance of the block encryption implementation used in encryption.

Return Values

None.

Description

Handles batch encryption and MAC generation in CTR mode.

When all data is loaded into memory, you can call this function to encrypt and generate MACs for all of the data at once.

For c, specify an instance of a class derived from the BlockCipher class that implements the block cipher used in encryption. You must have previously used the BlockCipher::SetKey function to set the key used in encryption.

Specify a pointer to an IV object in pIv, and its size in ivSize. The IV is called a "nonce" in CCM mode. The value in ivSize must be at least 7 and no more than 13. You cannot specify 13 if pdataSize exceeds 0x01000000 bytes. Nintendo strongly recommends specifying 12 or 13.

The value in macSize must be an even number of at least 4 and no more than 16. Nintendo strongly recommends specifying 16.

Revision History

2011/10/27
Initial version.

CONFIDENTIAL