Vault 7: Projects

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

Description
Initializes a OFB context for encryption/decryption. The user will specify details about the algorithm being used in OFB mode.
Preconditions
Any required initialization needed by the block cipher algorithm must have been performed.
Example
// Initialize the OFB block cipher module for use with AES.
SYS_MODULE_OBJ sysObject;
DRV_HANDLE handle;
BLOCK_CIPHER_OFB_CONTEXT context;
//keyStream could also be allocated memory instead of fixed memory
uint8_t keyStream[AES_BLOCK_SIZE*4];
// Initialization vector for OFB 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_OFB_Initialize (&context, AES_Encrypt, AES_Decrypt, AES_BLOCK_SIZE,
initialization_vector, (void *)&keyStream, sizeof (keyStream));
Parameters
Parameters Description
context The OFB context to initialize.
encryptFunction Pointer to the encryption function for the block cipher
algorithm being used in OFB mode.
decryptFunction Pointer to the decryption function for the block cipher
algorithm being used in OFB mode.
blockSize The block size of the block cipher algorithm being used in
OFB mode.
initializationVector The initialization vector for this operation. The length of this
vector must be equal to the block size of your block cipher.
keyStream Pointer to a buffer to contain a calculated keyStream.
keyStreamSize The size of the keystream buffer, in bytes.
Function
void BLOCK_CIPHER_OFB_Initialize ( BLOCK_CIPHER_OFB_CONTEXT * context,
BLOCK_CIPHER_FunctionEncrypt encryptFunction,
BLOCK_CIPHER_FunctionDecrypt decryptFunction, uint32_t blockSize,
uint8_t * initializationVector, void * keyStream, uint32_t keyStreamSize)
1.7.1.5.3 BLOCK_CIPHER_OFB_KeyStreamGenerate Function
Generates a key stream for use with the output feedback mode.
File
block_cipher_mode_ofb.h
1.7 Library Interface MLA - Crypto Library Help Block Cipher Modes
57

e-Highlighter

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

Un-highlight all Un-highlight selectionu Highlight selectionh