# 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
…
- 66
- 67
- 68
- 69
- 70
…
- 119
- 120

Parameters
Parameters Description
handle A handle that is passed to the block cipher's encrypt/decrypt
functions to specify which instance of the block cipher
module to use. This parameter can be specified as NULL if
the block cipher does not have multiple instances.
numBlocks The number of blocks of key stream that should be created.
context->keyStream should have enough space remaining to
handle this request.
key The key to use when generating this key stream. The format
of this key will depend on the block cipher you are using.
context Pointer to a context structure for this operation. The first call
of this function should have the context->noncePlusCounter
set. This value will be incremented for each block request.
options Block cipher encryption options that the user can specify,
or'd together. If
BLOCK_CIPHER_OPTION_STREAM_START is not
specified then
BLOCK_CIPHER_OPTION_STREAM_CONTINUE is
assumed. Valid options for this function are
• BLOCK_CIPHER_OPTION_STREAM_START
• BLOCK_CIPHER_OPTION_STREAM_CONTINUE
• BLOCK_CIPHER_OPTION_CTR_32BIT
• BLOCK_CIPHER_OPTION_CTR_64BIT
• BLOCK_CIPHER_OPTION_CTR_128BIT
Function
BLOCK_CIPHER_ERRORS BLOCK_CIPHER_CTR_KeyStreamGenerate (DRV_HANDLE handle,
uint32_t numBlocks, void * key, BLOCK_CIPHER_CTR_CONTEXT * context,
uint32_t options)
1.7.1.6.4 BLOCK_CIPHER_CTR_Encrypt Function
Encrypts plain text using counter mode.
File
block_cipher_mode_ctr.h
Syntax
BLOCK_CIPHER_ERRORS BLOCK_CIPHER_CTR_Encrypt(DRV_HANDLE handle, uint8_t * cipherText,
uint8_t * plainText, uint32_t numBytes, 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
1.7 Library Interface MLA - Crypto Library Help Block Cipher Modes
68

- 1
- 2
…
- 66
- 67
- 68
- 69
- 70
…
- 119
- 120