[botan-devel] Valgrind issue

Kacprzak, Marcin UTCFS Marcin.Kacprzak at fs.utc.com
Tue Sep 20 06:50:02 EDT 2011

I have a problem with Botan library.
I'm using AES or DES encryption/decryption. It works great, however when
I run my application using Valgrind, I get a tens of such a messages:
 ==15233== 2,831 bytes in 1 blocks are possibly lost in loss record
1,285 of 1,286
 ==15233==    at 0x402569A: operator new(unsigned int)
 ==15233==    by 0x4233D05: std::string::_Rep::_S_create(unsigned int,
unsigned int, std::allocator<char> const&) (in
 ==15233==    by 0x4234B10: ??? (in /usr/lib/libstdc++.so.6.0.13)
 ==15233==    by 0x4234CF5: std::basic_string<char,
std::char_traits<char>, std::allocator<char> >::basic_string(char
const*, std::allocator<char> const&) (in /usr/lib/libstdc++.so.6.0.13)
 ==15233==    by 0x820BF62: Botan::(anonymous
 ==15233==    by 0x820F4FE: Botan::Library_State::load_default_config()
 ==15233==    by 0x81FC1B1: Botan::Library_State::initialize(bool)
 ==15233==    by 0x81FB18F:
Botan::Global_State_Management::global_state() (botan.cpp:29860)
 ==15233==    by 0x814BCB4: Botan::Allocator::get(bool) (botan.cpp:3452)
 ==15233==    by 0x82AD13F: Botan::MemoryRegion<unsigned
char>::init(bool, unsigned int) (botan.h:639)
 ==15233==    by 0x82A1EEA: Botan::SecureVector<unsigned
char>::SecureVector(unsigned int) (botan.h:793)
 ==15233==    by 0x8286D36: Botan::OctetString::OctetString(unsigned
char const*, unsigned int) (botan.h:1925)
where botan.cpp is amalgamation of the whole library.
My decryption code is nothing special:
 using namespace Botan;
 int iBytesEncrypted = _iBytesRead - _iBytesRead%8;
 SecureVector<byte> vct;
 char* sMsg;
  SymmetricKey bc_key =
char*>(_arrOriginalKey), KEYLENGTH));
  Pipe dec(new Hex_Decoder, get_cipher("TripleDES/ECB/NoPadding",
bc_key, DECRYPTION));
  vct = dec.read_all();
  sMsg = (char*)vct.begin();
 catch(std::exception& e)
  gLog.Error("Cannot decrypt message: "+string(e.what()));
Thanks for any suggestions.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.randombit.net/pipermail/botan-devel/attachments/20110920/0b7d2944/attachment.html>

More information about the botan-devel mailing list