summaryrefslogtreecommitdiff
path: root/cmac.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2017-09-05 16:28:00 -0400
committerJeffrey Walton <noloader@gmail.com>2017-09-05 16:28:00 -0400
commit37e02f9e0e2ee627f0f95b7bc0a09f4ba1ce562e (patch)
treec8b8cc1e9b0b56998eed479f29aa6f3da33f1755 /cmac.cpp
parent23b939c62b7f497d6f99bfe97ad639b35287ac61 (diff)
downloadcryptopp-git-37e02f9e0e2ee627f0f95b7bc0a09f4ba1ce562e.tar.gz
Revert AltiVec and Power8 commits
The strategy of "cleanup under-aligned buffers" is not scaling well. Corner cases are still turing up. The library has some corner-case breaks, like old 32-bit Intels. And it still has not solved the AltiVec and Power8 alignment problems. For now we are backing out the changes and investigating other strategies
Diffstat (limited to 'cmac.cpp')
-rw-r--r--cmac.cpp18
1 files changed, 2 insertions, 16 deletions
diff --git a/cmac.cpp b/cmac.cpp
index 367a778c..1b56662d 100644
--- a/cmac.cpp
+++ b/cmac.cpp
@@ -77,8 +77,7 @@ void CMAC_Base::Update(const byte *input, size_t length)
return;
BlockCipher &cipher = AccessCipher();
- const unsigned int blockSize = cipher.BlockSize();
- const unsigned int alignment = cipher.OptimalDataAlignment();
+ unsigned int blockSize = cipher.BlockSize();
if (m_counter > 0)
{
@@ -101,20 +100,7 @@ void CMAC_Base::Update(const byte *input, size_t length)
if (length > blockSize)
{
CRYPTOPP_ASSERT(m_counter == 0);
- const byte* is = input; // m_reg is always aligned
-
- AlignedSecByteBlock i;
- if (!IsAlignedOn(input, alignment))
- {
- i.Assign(input, length);
- is = i.begin();
- }
-
- // size_t leftOver = 1 + cipher.AdvancedProcessBlocks(m_reg, input, m_reg, length-1,
- // BlockTransformation::BT_DontIncrementInOutPointers|BlockTransformation::BT_XorInput);
- const int flags = BlockTransformation::BT_DontIncrementInOutPointers|BlockTransformation::BT_XorInput;
- size_t leftOver = 1 + cipher.AdvancedProcessBlocks(m_reg, is, m_reg, length-1, flags);
-
+ size_t leftOver = 1 + cipher.AdvancedProcessBlocks(m_reg, input, m_reg, length-1, BlockTransformation::BT_DontIncrementInOutPointers|BlockTransformation::BT_XorInput);
input += (length - leftOver);
length = leftOver;
}