Thanks for your contributions. The BlockOrientedCipherModeBase bug was
reported earlier and the fix is already in CVS. The SSE2 code can actually
already be disabled at run-time through a global variable
CryptoPP::g_sse2Enabled, although it's not documented. You can declare
this in your code:
namespace CryptoPP {extern bool g_sse2Enabled;}
and then set it to true or false at the start of your main() function
based on a registry setting or environment variable. This way you don't
have to recompile Crypto++ to run Purify.
On Wed, Nov 13, 2002 at 11:24:00PM +0100, Francis Pallini wrote:
> Hi Folks !
>
> First of all, I'm sorry to use the mailing list to post bug fixes but as
> a Windows programmer it is painful for me to use CVS... My contributions
> follow.
>
> Regards,
>
> Francis PALLINI
>
> File modes.h
> ------------
> void BlockOrientedCipherModeBase::ProcessData(byte *outString, const
> byte *inString, unsigned int length)
> {
> unsigned int s = BlockSize();
> assert(length % s == 0);
> unsigned int alignment = m_cipher->BlockAlignment();
> bool requireAlignedInput = RequireAlignedInput();
>
> if (IsAlignedOn(outString, alignment))
> {
> if (!requireAlignedInput || IsAlignedOn(inString,
> alignment))
> ProcessBlocks(outString, inString, length / s);
> else
> {
> memcpy(outString, inString, length);
> ProcessBlocks(outString, outString, length / s);
> }
> }
> else
> {
> while (length)
> {
> if (!requireAlignedInput ||
> IsAlignedOn(inString, alignment))
> ProcessBlocks(m_buffer, inString, 1);
> else
> {
> memcpy(m_buffer, inString, s);
> ProcessBlocks(m_buffer, m_buffer, 1);
> }
> memcpy(outString, m_buffer, s);
> // --- Added
> inString += s;
> outString += s;
> // --- End
> length -= s;
> }
> }
> }
>
> File integer.h
> --------------
> SSE2 instructions make it impossible to profile Crypto++ with Purify, so
> allow one to disable SS2 support (added DISABLE_SSE2 macro definition).
>
> #ifdef _M_IX86
> # if ((defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 500)) ||
> (defined(__ICL) && (__ICL >= 500)) && defined(DISABLE_SSE2) == 0)
> # define SSE2_INTRINSICS_AVAILABLE
> # elif defined(_MSC_VER)
> // _mm_free seems to be the only way to tell if the
> Processor Pack is installed or not
> # include <malloc.h>
> # if (defined(_mm_free) && defined(DISABLE_SSE2) == 0)
> # define SSE2_INTRINSICS_AVAILABLE
> # endif
> # endif
> #endif