src/blfwk/RijndaelCTR.h
/*
* File: RijndaelCTR.h
*
* Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
* See included license file for license details.
*/
#if !defined(_RijndaelCTR_h_)
#define _RijndaelCTR_h_
#include "AESKey.h"
#include "AESCounter.h"
#include <string.h>
class RijndaelCTR
{
public:
enum
{
BLOCK_SIZE = 16
};
typedef uint8_t block_t[BLOCK_SIZE];
public:
RijndaelCTR(const AESKey<128> &key, const AESCounter<128> &counter);
void encrypt(const uint8_t *data, unsigned length, uint8_t *dest);
void decrypt(const uint8_t *data, unsigned length, uint8_t *dest);
RijndaelCTR &operator=(const RijndaelCTR &other)
{
m_key = other.m_key;
m_counter = other.m_counter;
return *this;
}
protected:
AESKey<128> m_key;
AESCounter<128> m_counter;
void incrementCounter(AESCounter<128>::counter_t *counter);
void baseProcess(const uint8_t *data, unsigned length, uint8_t *dest);
private:
RijndaelCTR() {}
};
#endif // _RijndaelCTR_h_
RijndaelCTR
Class to compute AES 128 CTR encryption/decryption.
Definition: apps/elftosb/common/RijndaelCTR.h:19
RijndaelCTR::m_counter
AESCounter< 128 > m_counter
Counter value for encrypt/decrypt.
Definition: apps/elftosb/common/RijndaelCTR.h:50
RijndaelCTR::operator=
RijndaelCTR & operator=(const RijndaelCTR &other)
Assignment operator.
Definition: src/blfwk/RijndaelCTR.h:41
RijndaelCTR::block_t
uint8_t block_t[BLOCK_SIZE]
The cipher block data type.
Definition: apps/elftosb/common/RijndaelCTR.h:28
AESCounter< 128 >
RijndaelCTR::BLOCK_SIZE
Number of bytes in one cipher block.
Definition: apps/elftosb/common/RijndaelCTR.h:24
AESKey< 128 >
RijndaelCTR::encrypt
void encrypt(const uint8_t *data, unsigned length, uint8_t *dest)
Encrypt data.
Definition: apps/elftosb/common/RijndaelCTR.cpp:28
RijndaelCTR::m_key
AESKey< 128 > m_key
128-bit key to use for encrypt/decrypt
Definition: apps/elftosb/common/RijndaelCTR.h:49
RijndaelCTR::decrypt
void decrypt(const uint8_t *data, unsigned length, uint8_t *dest)
Encrypt data.
Definition: apps/elftosb/common/RijndaelCTR.cpp:23