# 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
…
- 42
- 43
- 44
- 45
- 46
…
- 119
- 120

Example
// Initialize the CBC block cipher module for use with AES.
SYS_MODULE_OBJ sysObject;
DRV_HANDLE handle;
BLOCK_CIPHER_CBC_CONTEXT context;
// Initialization vector for CBC mode
static uint8_t initialization_vector[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f};
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_CBC_Initialize (&context, AES_Encrypt, AES_Decrypt, AES_BLOCK_SIZE,
initialization_vector);
Parameters
Parameters Description
context The CBC context to initialize.
encryptFunction Pointer to the encryption function for the block cipher
algorithm being used in CBC mode.
decryptFunction Pointer to the decryption function for the block cipher
algorithm being used in CBC mode.
blockSize The block size of the block cipher algorithm being used in
CBC mode.
initializationVector The initialization vector for this operation. The length of this
vector must be equal to the block size of your block cipher.
Function
void BLOCK_CIPHER_CBC_Initialize ( BLOCK_CIPHER_CBC_CONTEXT * context,
BLOCK_CIPHER_FunctionEncrypt encryptFunction,
BLOCK_CIPHER_FunctionDecrypt decryptFunction, uint32_t blockSize,
uint8_t * initializationVector)
1.7.1.3.3 BLOCK_CIPHER_CBC_Encrypt Function
Encrypts plain text using cipher-block chaining mode.
File
block_cipher_mode_cbc.h
Syntax
void BLOCK_CIPHER_CBC_Encrypt(DRV_HANDLE handle, uint8_t * cipherText, uint32_t *
numCipherBytes, uint8_t * plainText, uint32_t numPlainBytes, void * key,
BLOCK_CIPHER_CBC_CONTEXT * context, uint32_t options);
Module
CBC
Returns
None
1.7 Library Interface MLA - Crypto Library Help Block Cipher Modes
44

- 1
- 2
…
- 42
- 43
- 44
- 45
- 46
…
- 119
- 120