what about my implementation of doing the encryption. is it okay though?
Just wonder if I have correctly used the cryptopp functions. thanks.
Wei Dai wrote:
I can't see what valgrind is complaining about. I think it is reporting a
false positive. Please contact valgrind's developer/support forum and see
if this is a bug in their product.
On Tue, Nov 02, 2004 at 10:01:28AM +0800, tikcireviva wrote:
Hi Guys,
This is the first time I've posted an e-mail in
I've tried to compile cryptopp under my linux box, and I have also used
it in my little program as well.
What I concern in here is that, when I ran my program under valgrind
(the memory leak checking tool). It gave me the following error messages.
==8113== Thread 7:
==8113== Use of uninitialised value of size 4
==8113== at 0x80A5133: CryptoPP::RawDES::RawProcessBlock(unsigned&,
unsigned&) const (des.cpp:328)
==8113== by 0x80A5304:
CryptoPP::DES_EDE2::Base::ProcessAndXorBlock(unsigned char const*, unsigned
char const*, unsigned char*) const (des.cpp:361)
==8113== by 0x80EA250:
CryptoPP::BlockTransformation::ProcessBlock(unsigned
char*) const (cryptlib.h:435)
==8113== by 0x814E293: CryptoPP::CBC_Encryption::ProcessBlocks(unsigned
char*, unsigned char const*, unsigned) (modes.cpp:169)
==8113==
I wonder if I am doing anything wrong during the library compilation or
using the cryptopp functions.
And here is my coding and rest of the information for my linux box.
int myCrypt::encryption(unsigned char* msg,
unsigned int msglen,
unsigned char* cipherBlock,
unsigned int cipherSize)
{
// Create Array Sink
ArraySink *pCipherSink = new ArraySink((byte*)cipherBlock,
MAX_ENCRYPT_BLOCK_SIZE);
if(pCipherSink == NULL)
{
printf("Cannot allocate memory for ArraySink\n");
return 0; // zero or -1
}
DefaultEncryptorWithMAC encryptor(m_key, pCipherSink);
// Encrypt the msg block
encryptor.Put((byte*)msg, msglen);
encryptor.MessageEnd();
// Read data from the sink
int rtnCipherSize = pCipherSink->TotalPutLength();
// Delete encryptor and sink
pCipherSink = NULL;
delete pCipherSink;
return rtnCipherSize;
}
version of Crypto++ -- 5.2.1
compiler --
Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.2/specs
Configured with: ../configure --prefix=/usr --libdir=/usr/lib
--with-slibdir=/lib --mandir=/usr/share/man --infodir=/usr/share/info
--enable-shared --enable-threads=posix --disable-checking
--enable-long-long --enable-__cxa_atexit --enable-clocale=gnu
--enable-languages=c,c++,ada,f77,objc,java,pascal
--host=i586-mandrake-linux-gnu --with-system-zlib
Thread model: posix
gcc version 3.3.2 (Mandrake Linux 10.0 3.3.2-6mdk)
operating system --
Linux mandrake10 2.6.3-7mdk #1 Wed Mar 17 15:56:42 CET 2004 i686 unknown
unknown GNU/Linux
I am really appreciate yours help. Guys, please comment on it, and I
will be glad to have some discussion though. Thank you very much.
- tikviva