Hi, I'm using Crypto++ for the first time, to do some decryption and 
verification.  I've downloaded the 5.6.3 release zip.

I've written some test code using the RSA example on the wiki as a basis, 
but I'm getting memory leaks reported; unfortunately the leak detector I'm 
using only reports the location of the "new", not a full call stack, and 
due to Crypto++'s code structure this doesn't help me find the root cause.

The code is fairly straightfoward:

using namespace CryptoPP;

RSA::PrivateKey privateKey;
privateKey.Load(...);  // verified this doesn't leak; it's a 3072-bit key
std::string ciphertext(raw_ciphertext, sizeof(raw_ciphertext)); // 384 bytes

RSAES_OAEP_SHA_Decryptor decryptor(privateKey);
AutoSeededRandomPool rng;
SecByteBlock decrypted(decryptor.MaxPlaintextLength(ciphertext.size());
auto result = decryptor.Decrypt(rng, (const uint8_t*)ciphertext.data(), 
ciphertext.size(), decrypted);
assert(result.isValidCoding);
decrypted.resize(result.messageLength);
assert(0x20 == result.messageLength);

The resulting decrypted data is correct. but after the function containing 
the above exits (so all objects should have been destroyed) I get the 
following leaks reported:

Memory leak(s) found.
Alloc num (658157) Leak size: 4 Allocated at: misc.h and line: 202. Type: 
"new"
        Memory: <01A698E8> Content:
    0000: 28 63 a6 01                                      |(c..|
Alloc num (658163) Leak size: 4 Allocated at: misc.h and line: 202. Type: 
"new"
        Memory: <01A695D0> Content:
    0000: 50 3c 3c 01                                      |P<<.|
Alloc num (658165) Leak size: 20 Allocated at: integer.cpp and line: 2922. 
Type: "new"
        Memory: <01A43798> Content:
    0000: 48 0d 43 01 cd cd cd cd  02 00 00 00 d8 c2 9f 01 
|H.C.............|
    0010: 00 00 00 00                                      |....|

FWIW, the first two leaks are in NewObject and the last one is in 
NewInteger (as I said, doesn't seem particularly helpful on its own).

Is this a known issue?  Is there something else I need to call to clean up 
the memory?

-- 
-- 
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to cryptopp-users-unsubscr...@googlegroups.com.
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 cryptopp-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to