I recently wrote a desktop app for Linux(VirtualBox) that employs openSSL. I’m just using the libraries for encrypting and decrypting files (no network) and it works great. Now, I’m trying to create a Windows version and it’s one of the most frustrating things I’ve ever done.
So far, the online community hasn’t been much help (dozens of proposed solutions, all completely different, and none of them work for me).
Specifics:
I have a 64-bit machine.
I’m using Qt Creator as my IDE and mingw as my compiler (x86_64-w64-mingw32-gcc.exe).
I’ve downloaded and installed Win64 OpenSSL v1.0.1g from http://slproweb.com/products/Win32OpenSSL.html
The build and run paths have C:\OpenSSL-Win64\include\openssl;C:\OpenSSL-Win64\bin;C:\OpenSSL-Win64\lib
In the .pro file I have:
HEADERS += openssl/opensslconf.h openssl/evp
LIBS += -L“C:/OpenSSL-Win64/lib” -llibeay32
CONFIG+= configure.exe -openssl-linked OPENSSL_LIBS=”-llibssl -llibcrypto -lgdi64” -l ws2_64 -l advapi64 -l gdi64 -l user64 -l crypt64 -I -static -no-exceptions
QMAKE_LFLAGS = -static -static-libgcc -static-libstdc+ -openssl-linked
The app compiles and runs, but when I get to this line:
EVP_EncryptInit(&ctxE, EVP_aes_256_cbc(), constKey, constIv);
It crashes with a segmentation fault.
If I use this line before the above (as suggested by another coder), I get the same segmentation fault:
EVP_CIPHER_CTX_init(&ctxD);
So, it has noting to do with the key or iv. It’s like the app can see the header but not the code. I have tried many, many suggested solutions with no progress.
Any help would be greatly appreciated.
↧