# Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

### Protego

# MLA -- Crypto Library

1 January, 2012

- 1
- 2
…
- 63
- 64
- 65
- 66
- 67
…
- 119
- 120

void * keyStreamCurrentPosition; Pointer to the current position in the key stream.
uint32_t keyStreamSize; Size of the key stream.
uint32_t bytesRemainingInKeyStream; Number of bytes remaining in the key stream
uint32_t blockSize; Block size of the cipher algorithm being used with the block
cipher mode module
Module
CTR
Description
Context structure for the counter operation
1.7.1.6.2 BLOCK_CIPHER_CTR_Initialize Function
Initializes a CTR context for encryption/decryption.
File
block_cipher_mode_ctr.h
Syntax
void BLOCK_CIPHER_CTR_Initialize(BLOCK_CIPHER_CTR_CONTEXT * context,
BLOCK_CIPHER_FunctionEncrypt encryptFunction, BLOCK_CIPHER_FunctionDecrypt decryptFunction,
uint32_t blockSize, uint8_t * noncePlusCounter, void * keyStream, uint32_t keyStreamSize);
Module
CTR
Returns
None.
Description
Initializes a CTR context for encryption/decryption. The user will specify details about the algorithm being used in CTR mode.
Preconditions
Any required initialization needed by the block cipher algorithm must have been performed.
Example
// Initialize the CTR block cipher module for use with AES.
SYS_MODULE_OBJ sysObject;
DRV_HANDLE handle;
BLOCK_CIPHER_CTR_CONTEXT context;
// Initialization vector for CTR mode
static uint8_t initialization_vector[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f};
//keyStream could also be allocated memory instead of fixed memory
uint8_t keyStream[AES_BLOCK_SIZE*4];
sysObject = DRV_AES_Initialize (DRV_AES_INDEX, NULL);
if (sysObject != SYS_MODULE_OBJ_STATIC)
{
// error
}
handle = DRV_AES_Open (DRV_AES_INDEX, 0);
if (handle != DRV_AES_HANDLE)
{
// error
}
// Initialize the block cipher module
BLOCK_CIPHER_CTR_Initialize (&context, AES_Encrypt, AES_Decrypt, AES_BLOCK_SIZE,
initialization_vector, (void *)&keyStream, sizeof (keyStream));
1.7 Library Interface MLA - Crypto Library Help Block Cipher Modes
65

- 1
- 2
…
- 63
- 64
- 65
- 66
- 67
…
- 119
- 120