diff options
author | madmaxoft <github@xoft.cz> | 2014-01-22 22:26:40 +0100 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2014-01-22 22:26:40 +0100 |
commit | 34f13d589a2ebbcae9230732c7a763b3cdd88b41 (patch) | |
tree | 4f7bad4f90ca8f7a896d83951804f0207082cafb /lib/cryptopp/cbcmac.cpp | |
parent | Replacing CryptoPP with PolarSSL. (diff) | |
download | cuberite-34f13d589a2ebbcae9230732c7a763b3cdd88b41.tar cuberite-34f13d589a2ebbcae9230732c7a763b3cdd88b41.tar.gz cuberite-34f13d589a2ebbcae9230732c7a763b3cdd88b41.tar.bz2 cuberite-34f13d589a2ebbcae9230732c7a763b3cdd88b41.tar.lz cuberite-34f13d589a2ebbcae9230732c7a763b3cdd88b41.tar.xz cuberite-34f13d589a2ebbcae9230732c7a763b3cdd88b41.tar.zst cuberite-34f13d589a2ebbcae9230732c7a763b3cdd88b41.zip |
Diffstat (limited to 'lib/cryptopp/cbcmac.cpp')
-rw-r--r-- | lib/cryptopp/cbcmac.cpp | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/lib/cryptopp/cbcmac.cpp b/lib/cryptopp/cbcmac.cpp deleted file mode 100644 index 6b0e8858e..000000000 --- a/lib/cryptopp/cbcmac.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include "pch.h" - -#ifndef CRYPTOPP_IMPORTS - -#include "cbcmac.h" - -NAMESPACE_BEGIN(CryptoPP) - -void CBC_MAC_Base::UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms) -{ - AccessCipher().SetKey(key, length, params); - m_reg.CleanNew(AccessCipher().BlockSize()); - m_counter = 0; -} - -void CBC_MAC_Base::Update(const byte *input, size_t length) -{ - unsigned int blockSize = AccessCipher().BlockSize(); - - while (m_counter && length) - { - m_reg[m_counter++] ^= *input++; - if (m_counter == blockSize) - ProcessBuf(); - length--; - } - - if (length >= blockSize) - { - size_t leftOver = AccessCipher().AdvancedProcessBlocks(m_reg, input, m_reg, length, BlockTransformation::BT_DontIncrementInOutPointers|BlockTransformation::BT_XorInput); - input += (length - leftOver); - length = leftOver; - } - - while (length--) - { - m_reg[m_counter++] ^= *input++; - if (m_counter == blockSize) - ProcessBuf(); - } -} - -void CBC_MAC_Base::TruncatedFinal(byte *mac, size_t size) -{ - ThrowIfInvalidTruncatedSize(size); - - if (m_counter) - ProcessBuf(); - - memcpy(mac, m_reg, size); - memset(m_reg, 0, AccessCipher().BlockSize()); -} - -void CBC_MAC_Base::ProcessBuf() -{ - AccessCipher().ProcessBlock(m_reg); - m_counter = 0; -} - -NAMESPACE_END - -#endif |