Vault 7: Projects

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

// Initialize the block cipher module
BLOCK_CIPHER_ECB_Initialize (&context, AES_Encrypt, AES_Decrypt, AES_BLOCK_SIZE);
Parameters
Parameters Description
context The ECB context to initialize.
encryptFunction Pointer to the encryption function for the block cipher
algorithm being used in ECB mode.
decryptFunction Pointer to the decryption function for the block cipher
algorithm being used in ECB mode.
blockSize The block size of the block cipher algorithm being used in
ECB mode.
Function
void BLOCK_CIPHER_ECB_Initialize ( BLOCK_CIPHER_ECB_CONTEXT * context,
BLOCK_CIPHER_FunctionEncrypt encryptFunction,
BLOCK_CIPHER_FunctionDecrypt decryptFunction, uint32_t blockSize)
1.7.1.2.3 BLOCK_CIPHER_ECB_Encrypt Function
Encrypts plain text using electronic codebook mode.
File
block_cipher_mode_ecb.h
Syntax
void BLOCK_CIPHER_ECB_Encrypt(DRV_HANDLE handle, uint8_t * cipherText, uint32_t *
numCipherBytes, uint8_t * plainText, uint32_t numPlainBytes, void * key,
BLOCK_CIPHER_ECB_CONTEXT * context, uint32_t options);
Module
ECB
Returns
None
Description
Encrypts plain text using electronic codebook mode.
Preconditions
The ECB 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.
Example
// ***************************************************************
// Encrypt data in ECB mode with the AES algorithm.
// ***************************************************************
// System module object variable (for initializing AES)
SYS_MODULE_OBJ sysObject;
// Drive handle variable, to describe which AES module to use
DRV_HANDLE handle;
// ECB mode context
BLOCK_CIPHER_ECB_CONTEXT context;
// Plain text to encrypt
static uint8_t plain_text[] = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d,
0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
1.7 Library Interface MLA - Crypto Library Help Block Cipher Modes
38

e-Highlighter

Click to send permalink to address bar, or right-click to copy permalink.

Un-highlight all Un-highlight selectionu Highlight selectionh