SuperpoweredSDK  v2.0.2
Superpowered Audio SDK
Superpowered::AES Struct Reference

A structure to perform AES encryption. The size of the structure is 548 bytes. More...

#include "SuperpoweredAES.h"

Public Member Functions

bool cryptCBC (bool encrypt, unsigned char iv[16], int inputLengthBytes, const unsigned char *input, unsigned char *output)
 Encrypts with Cipher Block Chaining (CBC) block cipher mode. More...
 
int cryptCFB128 (bool encrypt, int ivOffset, unsigned char iv[16], int inputLengthBytes, const unsigned char *input, unsigned char *output)
 Encrypts with Cipher Feedback (CFB) block cipher mode (8 bit feedback). More...
 
void cryptCFB8 (bool encrypt, unsigned char iv[16], int inputLengthBytes, const unsigned char *input, unsigned char *output)
 Encrypts with Cipher Feedback (CFB)) block cipher mode (128 bit feedback). More...
 
int cryptCTR (unsigned char nonceCounter[16], int streamBlockOffset, unsigned char streamBlock[16], int inputLengthBytes, const unsigned char *input, unsigned char *output)
 Encrypts with Counter (CTR) block cipher mode. More...
 
void cryptECB (bool encrypt, const unsigned char input[16], unsigned char output[16])
 Encrypts with Electronic Codeblock (ECB) block cipher mode. More...
 
bool setKey (const unsigned char *key, unsigned int keySizeBits)
 Set the key. More...
 

Public Attributes

unsigned int dc [68]
 Internal variable. More...
 
unsigned int ec [68]
 Internal variable. More...
 
int numberOfRounds
 Internal variable. More...
 

Detailed Description

A structure to perform AES encryption. The size of the structure is 548 bytes.

Member Function Documentation

◆ cryptCBC()

bool Superpowered::AES::cryptCBC ( bool  encrypt,
unsigned char  iv[16],
int  inputLengthBytes,
const unsigned char *  input,
unsigned char *  output 
)

Encrypts with Cipher Block Chaining (CBC) block cipher mode.

Parameters
encryptTrue to encrypt, false to decrypt.
ivInitialization vector (16 bytes).
inputLengthBytesNumber of bytes in input. Must be a multiple of 16.
inputInput data.
outputOutput data. Must be at least inputLengthBytes big.
Returns
True on success, false if inputLengthBytes is not a multiple of 16.

◆ cryptCFB128()

int Superpowered::AES::cryptCFB128 ( bool  encrypt,
int  ivOffset,
unsigned char  iv[16],
int  inputLengthBytes,
const unsigned char *  input,
unsigned char *  output 
)

Encrypts with Cipher Feedback (CFB) block cipher mode (8 bit feedback).

Parameters
encryptTrue to encrypt, false to decrypt.
ivOffsetInitialization vector offset.
ivInitialization vector (16 bytes).
inputLengthBytesNumber of bytes in input.
inputInput data.
outputOutput data. Must be at least inputLengthBytes big.
Returns
The updated, new value of ivOffset.

◆ cryptCFB8()

void Superpowered::AES::cryptCFB8 ( bool  encrypt,
unsigned char  iv[16],
int  inputLengthBytes,
const unsigned char *  input,
unsigned char *  output 
)

Encrypts with Cipher Feedback (CFB)) block cipher mode (128 bit feedback).

Parameters
encryptTrue to encrypt, false to decrypt.
ivInitialization vector (16 bytes).
inputLengthBytesNumber of bytes in input.
inputInput data.
outputOutput data. Must be at least inputLengthBytes big.

◆ cryptCTR()

int Superpowered::AES::cryptCTR ( unsigned char  nonceCounter[16],
int  streamBlockOffset,
unsigned char  streamBlock[16],
int  inputLengthBytes,
const unsigned char *  input,
unsigned char *  output 
)

Encrypts with Counter (CTR) block cipher mode.

Parameters
nonceCounterPseudo-ramdom number, high enough to not repeat for a long time.
streamBlockOffsetStream block offset (start with 0, will be updated).
streamBlockStream block.
inputLengthBytesNumber of bytes in input.
inputInput data.
outputOutput data. Must be at least inputLengthBytes big.
Returns
The updated, new value of streamBlockOffset.

◆ cryptECB()

void Superpowered::AES::cryptECB ( bool  encrypt,
const unsigned char  input[16],
unsigned char  output[16] 
)

Encrypts with Electronic Codeblock (ECB) block cipher mode.

Parameters
encryptTrue to encrypt, false to decrypt.
inputInput data (16 bytes).
outputOutput data (16 bytes).

◆ setKey()

bool Superpowered::AES::setKey ( const unsigned char *  key,
unsigned int  keySizeBits 
)

Set the key.

Parameters
keyThe key.
keySizeBitsThe size of the key in bits. Valid values are: 128, 192, 256.
Returns
True on success, false on error (invalid value in keySizeBits).

Member Data Documentation

◆ dc

unsigned int Superpowered::AES::dc[68]

Internal variable.

◆ ec

unsigned int Superpowered::AES::ec[68]

Internal variable.

◆ numberOfRounds

int Superpowered::AES::numberOfRounds

Internal variable.


The documentation for this struct was generated from the following file: