Menu

#38 Undefined: Rijndael::Dec::AdvancedProcessBlocks

closed
nobody
None
5
2014-08-24
2011-10-11
Anonymous
No

Rijndael::Enc::AdvancedProcessBlocks and Rijndael::Enc::AdvancedProcessBlocks have different #defines surrounding them. Its causing an undefined reference forRijndael::Dec::AdvancedProcessBlocks.

Windows XP (fully patched), Visual Studio 2005 (fully patched), Pentium 4 (Dell GX 280).

///////////////////////////////////////////////////////////

The least comprehensive Rijndael::Dec::AdvancedProcessBlocks:

#if CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE
size_t Rijndael::Dec::AdvancedProcessBlocks(const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags) const
{
if (HasAESNI())
return AESNI_AdvancedProcessBlocks(AESNI_Dec_Block, AESNI_Dec_4_Blocks, (const __m128i *)m_key.begin(), m_rounds, inBlocks, xorBlocks, outBlocks, length, flags);

return BlockTransformation::AdvancedProcessBlocks(inBlocks, xorBlocks, outBlocks, length, flags);
}
#endif // #if CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE

///////////////////////////////////////////////////////////

The more comprehensive Rijndael::Enc::AdvancedProcessBlocks:

size_t Rijndael::Enc::AdvancedProcessBlocks(const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags) const
{
#if CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE
if (HasAESNI())
return AESNI_AdvancedProcessBlocks(AESNI_Enc_Block, AESNI_Enc_4_Blocks, (const __m128i *)m_key.begin(), m_rounds, inBlocks, xorBlocks, outBlocks, length, flags);
#endif

#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE)
if (HasSSE2())
{
...
}
#endif

return BlockTransformation::AdvancedProcessBlocks(inBlocks, xorBlocks, outBlocks, length, flags);
}

Discussion

  • Anonymous

    Anonymous - 2011-10-11

    ------ Build started: Project: esapi-test, Configuration: Debug Win32 ------
    Linking...
    esapi-lib.lib(CipherImpl.obj) : error LNK2001: unresolved external symbol "public: virtual unsigned int __thiscall CryptoPP::Rijndael::Dec::AdvancedProcessBlocks(unsigned char const *,unsigned char const *,unsigned char *,unsigned int,unsigned int)const " (?AdvancedProcessBlocks@Dec@Rijndael@CryptoPP@@UBEIPBE0PAEII@Z)
    C:\Documents and Settings\Jeffrey Walton\Desktop\owasp-esapi-c++\\Esapi-Windows\Debug\x86\esapi-test.exe : fatal error LNK1120: 1 unresolved externals
    Build log was saved at "file://C:\Documents and Settings\Jeffrey Walton\Desktop\owasp-esapi-c++\Esapi-Windows\Temp\Debug\x86\esapi-test\BuildLog.htm"
    esapi-test - 2 error(s), 0 warning(s)
    ========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

     
  • Anonymous

    Anonymous - 2011-10-11

    I had to open config.h, add "#define CRYPTOPP_DISABLE_AESNI 1" to the config file, and then recompile the library.

    Odd - it was picked up properly when the library was built, but was picked up incorrectly when I included the library's headers in my project.

     
  • Anonymous

    Anonymous - 2011-10-13

    Visual Studio offers /arch:AVX (which should include AESNI) - see http://msdn.microsoft.com/en-us/library/7t5yh4fd.aspx.

    However, there's to way to test for it in preprocessor macros - see http://msdn.microsoft.com/en-us/library/b0084kay\(v=VS.80).aspx.

    So Crypto++ configuration assumes if SSE2 and SSE3 are available (which it is for a Pentium 4), it will allow AESNI.

    // Config.h:
    #if !defined(CRYPTOPP_DISABLE_SSSE3) && !defined(CRYPTOPP_DISABLE_AESNI) && CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE && (CRYPTOPP_GCC_VERSION >= 40400 || _MSC_FULL_VER >= 150030729 || __INTEL_COMPILER >= 1110)
    #define CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE 1
    #else
    #define CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE 0
    #endif