![]() |
Gray C++ Libraries
0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
|
#include <cCipherGCM.h>
Public Member Functions | |
cCipherGCM (bool bEncodeMode, CipherAlgorithm_TYPE eCipherAlgorithm) | |
virtual | ~cCipherGCM () |
virtual HRESULT | SetCipherKey (const void *pKeyData, size_t nKeySize) override |
virtual HRESULT | AuthEncrypt (BYTE *pOutput, const BYTE *pInput, size_t nSize, const BYTE *pIV, size_t nSizeIV, const BYTE *pAdd, size_t nSizeAdd, BYTE *pTag, size_t nSizeTag) override |
virtual HRESULT | AuthDecrypt (BYTE *pOutput, const BYTE *pInput, size_t nSize, const BYTE *pIV, size_t nSizeIV, const BYTE *pAdd, size_t nSizeAdd, const BYTE *pTag, size_t nSizeTag) override |
HRESULT | StartGCM (const BYTE *pIV, size_t nSizeIV, const BYTE *pAdd, size_t nSizeAdd) |
HRESULT | UpdateGCM (BYTE *pOutput, const BYTE *pInput, size_t nSize) |
HRESULT | FinishGCM (BYTE *pTag, size_t nSizeTag) |
UNITTEST_FRIEND (cCipherGCM) | |
![]() | |
cCipherBlockBase (bool bEncodeMode, CipherAlgorithm_TYPE eCipherAlgorithm) noexcept | |
![]() | |
cCipherBase (bool bEncodeMode=true, CIPHER_BLOCK_TYPE eBlockMode=CIPHER_BLOCK_UNK) noexcept | |
virtual | ~cCipherBase () |
void | put_EncodeMode (bool bEncodeMode) noexcept |
bool | get_EncodeMode () const noexcept |
void | put_BlockMode (CIPHER_BLOCK_TYPE eBlockMode) noexcept |
virtual size_t | get_BlockAlignSize () const override |
virtual HRESULT | CipherModeECB (BYTE *pOutput, const BYTE *pInput) |
virtual HRESULT | CipherModeCBC (BYTE *pOutput, const BYTE *pInput, size_t nSize, BYTE *pIV) |
virtual HRESULT | CipherModeCFB (BYTE *pOutput, const BYTE *pInput, size_t nSize, BYTE *pIV, size_t *pIVOffset) |
virtual HRESULT | CipherModeCTR (BYTE *pOutput, const BYTE *pInput, size_t nSize, BYTE *pNonceCounter, size_t *pNCOffset, BYTE *pStreamBlock) |
virtual HRESULT | Cipher (BYTE *pOutput, const BYTE *pInput, size_t nSize) override |
![]() | |
virtual | ~CObject () |
virtual bool | isValidCheck () const noexcept |
< memory allocation and structure definitions are valid. More... | |
virtual void | AssertValid () const |
< memory allocation and structure definitions are valid. More... | |
virtual void | Serialize (cArchive &a) |
Public Attributes | |
UINT64 | m_HL [k_BlockAlign] |
Pre-calculated HTable BuildGCMTable. More... | |
UINT64 | m_HH [k_BlockAlign] |
Pre-calculated HTable. More... | |
UINT64 | m_len |
Total data length. More... | |
UINT64 | m_add_len |
Total pAdd length. More... | |
BYTE | m_base_ectr [k_BlockAlign] |
First ECTR for tag. More... | |
BYTE | m_y [k_BlockAlign] |
Y working value. More... | |
BYTE | m_buf [k_BlockAlign] |
buf working value More... | |
![]() | |
CipherAlgorithm_TYPE | m_eCipherAlgorithm |
cCipherAES or cCipherCamellia More... | |
cNewPtr< cCipherBase > | m_pCipherBase |
cipher base used. cCipherAES or cCipherCamellia More... | |
Static Public Attributes | |
static const size_t | k_BlockAlign = 16 |
static const UINT64 | k_last4 [k_BlockAlign] |
Additional Inherited Members | |
![]() | |
static size_t GRAYCALL | CopyFillX (void *pOutput, size_t nOutSize, const void *pInput, size_t nInputSize) |
![]() | |
bool | m_bEncodeMode |
We are in encode/encrypt mode vs decode/decrypt mode. More... | |
CIPHER_BLOCK_TYPE | m_eBlockMode |
Cipher block mode. How are sequences of blocks treated? More... | |
CIPHER_BLOCK_GCM context structure can use cCipherAES, cCipherCamellia
|
inline |
|
inlinevirtual |
|
overridevirtual |
GCM buffer authenticated decryption using a block cipher Packet-oriented decryption for AEAD modes
Implements GrayLib::cCipherBlockBase.
|
overridevirtual |
GCM buffer encryption/decryption using a block cipher
Implements GrayLib::cCipherBlockBase.
HRESULT GrayLib::cCipherGCM::FinishGCM | ( | BYTE * | pTag, |
size_t | nSizeTag | ||
) |
Generic GCM finalization function. Wraps up the GCM stream and generates the tag. The tag can have a maximum length of 16 bytes.
|
overridevirtual |
GCM initialization (encryption)
Reimplemented from GrayLib::cCipherBase.
HRESULT GrayLib::cCipherGCM::StartGCM | ( | const BYTE * | pIV, |
size_t | nSizeIV, | ||
const BYTE * | pAdd, | ||
size_t | nSizeAdd | ||
) |
Generic GCM stream start function
CIPHER_BLOCK_GCM IV and AD are limited to 2^64 bits, so 2^61 bytes
GrayLib::cCipherGCM::UNITTEST_FRIEND | ( | cCipherGCM | ) |
HRESULT GrayLib::cCipherGCM::UpdateGCM | ( | BYTE * | pOutput, |
const BYTE * | pInput, | ||
size_t | nSize | ||
) |
Generic GCM update function. Encrypts/decrypts using the given GCM context. Expects input to be a multiple of 16 bytes! Only the last call before FinishGCM() can be less than 16 bytes!
|
static |
|
static |
UINT64 GrayLib::cCipherGCM::m_add_len |
Total pAdd length.
BYTE GrayLib::cCipherGCM::m_base_ectr[k_BlockAlign] |
First ECTR for tag.
BYTE GrayLib::cCipherGCM::m_buf[k_BlockAlign] |
buf working value
UINT64 GrayLib::cCipherGCM::m_HH[k_BlockAlign] |
Pre-calculated HTable.
UINT64 GrayLib::cCipherGCM::m_HL[k_BlockAlign] |
Pre-calculated HTable BuildGCMTable.
UINT64 GrayLib::cCipherGCM::m_len |
Total data length.
BYTE GrayLib::cCipherGCM::m_y[k_BlockAlign] |
Y working value.