RijndaelCBCMAC Class Reference

Class to compute CBC-MAC using the AES/Rijndael cipher. More...

`#include <RijndaelCBCMAC.h>`

Collaboration diagram for RijndaelCBCMAC:
[legend]

## Public Types

enum | { BLOCK_SIZE = 16 }
typedef uint8_t | block_t[BLOCK_SIZE]
| The cipher block data type.

## Public Member Functions

| RijndaelCBCMAC ()
| Default constructor. More...
| RijndaelCBCMAC (const AESKey< 128 > &key, const uint8_t *iv=0)
| Constructor. More...
void | update (const uint8_t *data, unsigned length)
| Process data. More...
void | finalize ()
| Signal that all data has been processed. More...
const block_t & | getMAC () const
| Returns a reference to the current MAC value.
RijndaelCBCMAC & | operator= (const RijndaelCBCMAC &other)
| Assignment operator.

## Protected Member Functions

void | updateOneBlock (const uint8_t *data)

## Protected Attributes

AESKey< 128 > | m_key
| 128-bit key to use for the CBC-MAC.
block_t | m_mac
| Current message authentication code value.

## Detailed Description

Class to compute CBC-MAC using the AES/Rijndael cipher.

Currently only supports 128-bit keys and block sizes.

## Member Enumeration Documentation

anonymous enum

Enumerator
BLOCK_SIZE | Number of bytes in one cipher block.

## Constructor & Destructor Documentation

RijndaelCBCMAC::RijndaelCBCMAC | ( |  | ) |

inline

Default constructor.

The key and IV are both set to zero.

RijndaelCBCMAC::RijndaelCBCMAC | ( | const AESKey< 128 > & | key,
|  | const uint8_t * | iv = `0`
| ) |  |

Constructor.

Parameters

  key | The key to use as the CBC-MAC secret.
  iv | Initialization vector. Defaults to zero if not provided.

## Member Function Documentation

void RijndaelCBCMAC::finalize | ( |  | ) |

Signal that all data has been processed.

It appears that some forms of CBC-MAC encrypt the final output block again in order to protect against a plaintext attack. This method is a placeholder for such an operation, but it currently does nothing.

void RijndaelCBCMAC::update | ( | const uint8_t * | data,
|  | unsigned | length
| ) |  |

Process data.

Parameters

  data | Pointer to data to process.
  length | Number of bytes to process. Must be evenly divisible by BLOCK_SIZE.

void RijndaelCBCMAC::updateOneBlock | ( | const uint8_t * | data | ) |

protected

On entry the current value of m_mac becomes the initialization vector for the CBC encryption of this block. The output of the encryption then becomes the new MAC, which is stored in m_mac.

The documentation for this class was generated from the following files:

- RijndaelCBCMAC.h
- RijndaelCBCMAC.cpp