Vault 7: Projects
This publication series is about specific projects related to the Vault 7 main publication.
Parameters
Parameters Description
context The CTR context to initialize.
encryptFunction Pointer to the encryption function for the block cipher
algorithm being used in CTR mode.
decryptFunction Pointer to the decryption function for the block cipher
algorithm being used in CTR mode.
blockSize The block size of the block cipher algorithm being used in
CTR mode.
noncePlusCounter A security nonce concatenated with the initial value of the
counter for this operation. The counter can be 32, 64, or 128
bits, depending on the encrypt/decrypt options selected.
keyStream Pointer to a buffer to contain a calculated keyStream.
keyStreamSize The size of the keystream buffer, in bytes.
Function
void BLOCK_CIPHER_CTR_Initialize ( BLOCK_CIPHER_CTR_CONTEXT * context,
BLOCK_CIPHER_FunctionEncrypt encryptFunction,
BLOCK_CIPHER_FunctionDecrypt decryptFunction, uint32_t blockSize)
1.7.1.6.3 BLOCK_CIPHER_CTR_KeyStreamGenerate Function
Generates a key stream for use with the counter mode.
File
block_cipher_mode_ctr.h
Syntax
BLOCK_CIPHER_ERRORS BLOCK_CIPHER_CTR_KeyStreamGenerate(DRV_HANDLE handle, uint32_t
numBlocks, void * key, BLOCK_CIPHER_CTR_CONTEXT * context, uint32_t options);
Module
CTR
Returns
Returns a member of the BLOCK_CIPHER_ERRORS enumeration:
• BLOCK_CIPHER_ERROR_NONE - no error.
• BLOCK_CIPHER_ERROR_KEY_STREAM_GEN_OUT_OF_SPACE - There was not enough room remaining in the
context->keyStream buffer to fit the key data requested by the numBlocks parameter.
• BLOCK_CIPHER_ERROR_CTR_COUNTER_EXPIRED - The requesting call has caused the counter number to run out
of unique combinations.
Description
Generates a key stream for use with the counter mode.
Preconditions
The CTR context must be initialized with the block cipher encrypt/decrypt functions and the block cipher algorithm's block
size. The block cipher module must be initialized, if necessary.
The noncePlusCounter parameter in the BLOCK_CIPHER_CTR_CONTEXT structure should be initialized. The size of this
vector is the same as the block size of the cipher you are using.
Example
// ***************************************************************
// Encrypt data in CTR mode with the AES algorithm.
1.7 Library Interface MLA - Crypto Library Help Block Cipher Modes
66
Protego_Release_01_05-Related-OEM-Documentation-MLA_v2013_12_20-help_mla_crypto.pdf