I was trying to compile the tutorial example in this webpage:
http://www.cryptopp.com/wiki/Advanced_Encryption_Standard
Specifically the "Encrypting and Decrypting Using AES" part with CFB Mode.
I got several unresolved external linker errors.
So far by trial-and-error, by adding the correct *.cpp modules to the
project, I narrowed downed the errors to 4.
[ilink32 Error] Error: Unresolved external
'CryptoPP::CFB_CipherTemplate<CryptoPP::AbstractPolicyHolder<CryptoPP::CFB_CipherAbstractPolicy,
CryptoPP::CFB_ModePolicy> >::Resynchronize(const unsigned char *, int)'
[ilink32 Error] Error: Unresolved external
'CryptoPP::CFB_CipherTemplate<CryptoPP::AbstractPolicyHolder<CryptoPP::CFB_CipherAbstractPolicy,
CryptoPP::CFB_ModePolicy> >::UncheckedSetKey(const unsigned char *,
unsigned int, CryptoPP::NameValuePairs&)'
[ilink32 Error] Error: Unresolved external
'CryptoPP::CFB_CipherTemplate<CryptoPP::AbstractPolicyHolder<CryptoPP::CFB_CipherAbstractPolicy,
CryptoPP::CFB_ModePolicy> >::ProcessData(unsigned char *, const unsigned
char *, unsigned int)'
[ilink32 Error] Error: Unresolved external
'CryptoPP::CFB_EncryptionTemplate<CryptoPP::AbstractPolicyHolder<CryptoPP::CFB_CipherAbstractPolicy,
CryptoPP::CFB_ModePolicy> >::CombineMessageAndShiftRegister(unsigned char
*, unsigned char *, const unsigned char *, unsigned int)'
Could you perhaps tell me the correct cpp module to add to the project so
that it will link fine ?
And perhaps could you tell me the correct way to setup Crypto++ in C++
Builder XE8 compiler, so that in the future I won't have to add all those
"*.cpp" files to the project in order to get rid of linker errors ?
--------------------------------------------------------------------------------------------------------------
So far I did these:
- Added Crypto++ 5.6.2 path to the include path list of compiler.
- Added these include lines and directives (Otherwise, naturally it won't
recognize names)
#include "aes.h"
#include "osrng.h"
#include "modes.h"
using namespace CryptoPP;
- Added those *.cpp files/modules manually to the project:
"algparam.cpp"
"cpu.cpp"
"cryptlib.cpp"
"filters.cpp"
"fips140.cpp"
"hrtimer.cpp"
"iterhash.cpp"
"misc.cpp"
"modes.cpp"
"mqueue.cpp"
"osrng.cpp"
"queue.cpp"
"randpool.cpp"
"rdtables.cpp"
"rijndael.cpp"
"sha.cpp"
"strciphr.cpp"
By the way, my code is:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
if (OpenDialog1->Execute() == false) return;
const String fullfilename = OpenDialog1->FileName;
const __int64 filesize = GetFileSize (fullfilename);
char* origbuf = new char[filesize];
char* encrbuf = new char[filesize];
const NativeUInt filehandle = FileOpen (fullfilename, fmOpenRead |
fmShareDenyWrite);
FileRead (filehandle, origbuf, filesize);
FileClose (filehandle);
//---file contents copied to "origbuf",
buffer--------------------------------
//---Tutorial Code starts from
here-------------------------------------------------------------------------
AutoSeededRandomPool rnd;
// Generate a random key
SecByteBlock key(0x00, AES::DEFAULT_KEYLENGTH);
rnd.GenerateBlock( key, key.size() );
// Generate a random IV
byte iv[AES::BLOCKSIZE];
rnd.GenerateBlock(iv, AES::BLOCKSIZE);
//////////////////////////////////////////////////////////////////////////
// Encrypt
CFB_Mode<AES>::Encryption cfbEncryption(key, key.size(), iv);
// dst source
length
cfbEncryption.ProcessData((byte*)encrbuf, (byte*)origbuf, filesize);
// ....
//----------------------------------------------------------------------------
delete [] origbuf;
delete [] encrbuf;
}
--
--
You received this message because you are subscribed to the "Crypto++ Users"
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at
http://www.cryptopp.com.
---
You received this message because you are subscribed to the Google Groups
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.