Clear IBM XLC warnings on PowerPC
parent
afe72c50f0
commit
dd4f87fa11
13
modes.cpp
13
modes.cpp
|
|
@ -125,8 +125,8 @@ void CTR_ModePolicy::SeekToIteration(lword iterationCount)
|
||||||
int carry=0;
|
int carry=0;
|
||||||
for (int i=BlockSize()-1; i>=0; i--)
|
for (int i=BlockSize()-1; i>=0; i--)
|
||||||
{
|
{
|
||||||
unsigned int sum = m_register[i] + byte(iterationCount) + carry;
|
unsigned int sum = m_register[i] + (iterationCount & 0xff) + carry;
|
||||||
m_counterArray[i] = static_cast<byte>(sum);
|
m_counterArray[i] = byte(sum & 0xff);
|
||||||
carry = sum >> 8;
|
carry = sum >> 8;
|
||||||
iterationCount >>= 8;
|
iterationCount >>= 8;
|
||||||
}
|
}
|
||||||
|
|
@ -147,10 +147,11 @@ void CTR_ModePolicy::OperateKeystream(KeystreamOperation /*operation*/, byte *ou
|
||||||
|
|
||||||
while (iterationCount)
|
while (iterationCount)
|
||||||
{
|
{
|
||||||
byte lsb = m_counterArray[s-1];
|
const byte lsb = m_counterArray[s-1];
|
||||||
size_t blocks = UnsignedMin(iterationCount, 256U-lsb);
|
const size_t blocks = UnsignedMin(iterationCount, 256U-lsb);
|
||||||
|
|
||||||
m_cipher->AdvancedProcessBlocks(m_counterArray, input, output, blocks*s, BlockTransformation::BT_InBlockIsCounter|BlockTransformation::BT_AllowParallel);
|
m_cipher->AdvancedProcessBlocks(m_counterArray, input, output, blocks*s, BlockTransformation::BT_InBlockIsCounter|BlockTransformation::BT_AllowParallel);
|
||||||
if ((m_counterArray[s-1] = static_cast<byte>(lsb + blocks)) == 0)
|
if ((m_counterArray[s-1] = byte(lsb + blocks)) == 0)
|
||||||
IncrementCounterBy256();
|
IncrementCounterBy256();
|
||||||
|
|
||||||
output = PtrAdd(output, blocks*s);
|
output = PtrAdd(output, blocks*s);
|
||||||
|
|
@ -166,7 +167,7 @@ void CTR_ModePolicy::CipherResynchronize(byte *keystreamBuffer, const byte *iv,
|
||||||
CRYPTOPP_ASSERT(length == BlockSize());
|
CRYPTOPP_ASSERT(length == BlockSize());
|
||||||
|
|
||||||
CopyOrZero(m_register, m_register.size(), iv, length);
|
CopyOrZero(m_register, m_register.size(), iv, length);
|
||||||
m_counterArray = m_register;
|
m_counterArray.Assign(m_register.begin(), m_register.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void BlockOrientedCipherModeBase::UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms)
|
void BlockOrientedCipherModeBase::UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms)
|
||||||
|
|
|
||||||
3
modes.h
3
modes.h
|
|
@ -242,7 +242,8 @@ protected:
|
||||||
void CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length);
|
void CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length);
|
||||||
void SeekToIteration(lword iterationCount);
|
void SeekToIteration(lword iterationCount);
|
||||||
|
|
||||||
SecByteBlock m_counterArray;
|
// adv-simd.h increments the counter
|
||||||
|
mutable SecByteBlock m_counterArray;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief Block cipher mode of operation default implementation
|
/// \brief Block cipher mode of operation default implementation
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue