#define _WIN32_WINNT 0x501 //Must be at top for use with getaddrinfo() #include <iostream>
#define BOOST_THREAD_USE_LIB // Must be before boost #includes
#include <boost\thread.hpp>
#define WIN32_MEAN_AND_LEAN
#include <winsock2.h>
#include <windows.h>
#include <string.h>
#include <WinBase.h>
#include <ws2tcpip.h>
#include <stdio.h>
#include <direct.h>
#include <time.h>
#include <iostream>
#include <fstream>
#include <openssl/rsa.h>
#include <openssl/engine.h>
int main()
{
while(true)
{
const unsigned char * key = new const unsigned char[550] {0x30, 0x82,
0x02, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01,
0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x02, 0x0f, 0x00, 0x30, 0x82, 0x02, 0x0a,
0x02, 0x82, 0x02, 0x01, 0x00, 0xb4, 0xb8, 0x33, 0x6a, 0xf1, 0x6c, 0x08, 0xd7,
0xae, 0xef, 0x9c, 0x8d, 0x68, 0xea, 0x8a, 0xfd, 0xeb, 0x65, 0xed, 0xba, 0x98,
0x7e, 0x4b, 0x2d, 0x8f, 0x42, 0x2b, 0xc5, 0x9e, 0x07, 0xf3, 0xe0, 0x00, 0x70,
0x23, 0xff, 0xb1, 0x24, 0x25, 0x01, 0xc8, 0x9f, 0xd4, 0x02, 0xa7, 0x77, 0x2a,
0x55, 0xe0, 0xa1, 0xb2, 0x9b, 0x10, 0xfa, 0xdb, 0xe2, 0xd3, 0xd4, 0x54, 0xa1,
0x11, 0x2a, 0xd2, 0xb8, 0x81, 0xd9, 0x4b, 0x9d, 0x91, 0x74, 0x54, 0x90, 0x9e,
0xa0, 0x92, 0x5b, 0x58, 0xa5, 0x22, 0x00, 0x6c, 0xe5, 0x23, 0x3b, 0x6e, 0x38,
0x4a, 0xc9, 0x2b, 0x64, 0xda, 0x35, 0x2d, 0x88, 0x1e, 0x36, 0x2c, 0xc0, 0x20,
0x9b, 0xe7, 0xb2, 0x51, 0xe8, 0xd1, 0x29, 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0xf2, 0xed,
0x42, 0xb8, 0xd4, 0x85, 0xec, 0x72, 0x2d, 0xfb, 0x2b, 0x48, 0x76, 0x59, 0x36,
0x15, 0x81, 0xbb, 0xa9, 0x45, 0xee, 0xd4, 0x4c, 0x1b, 0xf1, 0x14, 0x77, 0x09,
0x32, 0x75, 0x9f, 0x65, 0x89, 0xed, 0x48, 0xcc, 0x33, 0x1b, 0x02, 0x03, 0x01,
0x00, 0x01};
RSA * pubrsa = d2i_RSA_PUBKEY(NULL, &key, 550);
RSA_free(pubrsa);
delete[] key;
Sleep(100);
}
}
Hello, I'm using the binary redistributable of openssl's libraries for windows 32-bit XP, and am running into what strongly appears to be a memory leak in d2i_RSA_PUBKEY(). I have tested this function for many hours, looked for examples of its use, and no matter how I implement it run into a leak in the private bytes of my program. As a result, I took the function out to examine it by itself with a newly generated key pair. The source for my test program follows: Distributable: openssl-1.0.0d, 3rd-party 32-bit XP binary (downloaded from slproweb) Compiler information: GNU GCC Compiler (up-to-date), using Code::Blocks IDE Libraries linked: C:\OpenSSL-Win32\lib\MinGW\libeay32.a Other linker options: -static-libgcc, -static-libstdc++ No other compiler flags set. Test code: http://pastebin.com/KU7EhzbT (same as attached) Any assistance in verifying this bug or pointing out what I could possibly be doing wrong would be immensely appreciated - best regards, OpenSSL User
| Hello, I'm using the binary redistributable of openssl's libraries for windows 32-bit XP, and am running into what strongly appears to be a memory leak in d2i_RSA_PUBKEY(). I have tested this function for many hours, looked for examples of its use, and no matter how I implement it run into a leak in the private bytes of my program. As a result, I took the function out to examine it by itself with a newly generated key pair. The source for my test program follows: Distributable: openssl-1.0.0d, 3rd-party 32-bit XP binary (downloaded from slproweb) Compiler information: GNU GCC Compiler (up-to-date), using Code::Blocks IDE Libraries linked: C:\OpenSSL-Win32\lib\MinGW\libeay32.a Other linker options: -static-libgcc, -static-libstdc++ No other compiler flags set. Test code: http://pastebin.com/KU7EhzbT (same as attached) Any assistance in verifying this bug or pointing out what I could possibly be doing wrong would be immensely appreciated - best regards, OpenSSL User |
private.pem
Description: Binary data
public.der
Description: application/x509-ca-cert
