Hello, everyone.

I don't know if this has been reported yet, so just in case it hasn't...

This warning appears when compiling the library (downloaded zip file from
CVS) with VC7. Normally, I don't worry too much about warnings but this one
looks like it could cause trouble:

g:\Projects\CryptoPP50Vc7\crypto50_2\strciphr.cpp(19) : warning C4146: unary
minus operator applied to unsigned type, result still unsigned

F:\VS7\Vc7\include\xstring(257) : while compiling class-template member
function 'byte CryptoPP::AdditiveCipherTemplate<BASE>::GenerateByte(void)'
with
[
BASE=CryptoPP::AbstractPolicyHolder<CryptoPP::AdditiveCipherAbstractPolicy,C
ryptoPP::TwoBases<CryptoPP::SymmetricCipher,CryptoPP::RandomNumberGenerator>
>
]
g:\Projects\CryptoPP50Vc7\crypto50_2\strciphr.h(46) : see reference to class
template instantiation 'CryptoPP::AdditiveCipherTemplate<BASE>' being
compiled
with
[
BASE=CryptoPP::AbstractPolicyHolder<CryptoPP::AdditiveCipherAbstractPolicy,C
ryptoPP::TwoBases<CryptoPP::SymmetricCipher,CryptoPP::RandomNumberGenerator>
>
]

g:\Projects\CryptoPP50Vc7\crypto50_2\wake.h(56) : see reference to class
template instantiation 'CryptoPP::WAKE_OFB<B>' being compiled

The warning is because in strciphr.h:
class CFB_CipherTemplate : public BASE

unsigned int m_leftOver; is declared as an unsigned int,

and in strciphr.cpp in
byte AdditiveCipherTemplate<S>::GenerateByte()
return KeystreamBufferEnd()[-m_leftOver--];
it is negated then decremented.

Since the result remains unsigned, m_leftOver just gets decremented, doesn't
it? That doesn't look like what you intended...

Rickey [EMAIL PROTECTED]


Reply via email to