Hello,
I have errors compilation with my program, I think mistakes don't come from code but from the compiler.
here are the errors :
Code:
||=== Build: Debug in crypto (compiler: GNU GCC Compiler) ===|C:\msys64\mingw64\bin\..\lib\gcc\x86_64-w64-mingw32\9.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: C:\openssl-1.0.2j-fips-x86_64\OpenSSL\lib\libcrypto.a(rand_win.o):rand_win.c|| undefined reference to `__imp_GetDeviceCaps'|
C:\msys64\mingw64\bin\..\lib\gcc\x86_64-w64-mingw32\9.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: C:\openssl-1.0.2j-fips-x86_64\OpenSSL\lib\libcrypto.a(rand_win.o):rand_win.c|| undefined reference to `__imp_CreateCompatibleBitmap'|
C:\msys64\mingw64\bin\..\lib\gcc\x86_64-w64-mingw32\9.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: C:\openssl-1.0.2j-fips-x86_64\OpenSSL\lib\libcrypto.a(rand_win.o):rand_win.c|| undefined reference to `__imp_GetObjectW'|
C:\msys64\mingw64\bin\..\lib\gcc\x86_64-w64-mingw32\9.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: C:\openssl-1.0.2j-fips-x86_64\OpenSSL\lib\libcrypto.a(rand_win.o):rand_win.c|| undefined reference to `__imp_GetDIBits'|
C:\msys64\mingw64\bin\..\lib\gcc\x86_64-w64-mingw32\9.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: C:\openssl-1.0.2j-fips-x86_64\OpenSSL\lib\libcrypto.a(rand_win.o):rand_win.c|| undefined reference to `__imp_DeleteObject'|
C:\msys64\mingw64\bin\..\lib\gcc\x86_64-w64-mingw32\9.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: C:\openssl-1.0.2j-fips-x86_64\OpenSSL\lib\libcrypto.a(c_zlib.o):c_zlib.c|| undefined reference to `inflate'|
C:\msys64\mingw64\bin\..\lib\gcc\x86_64-w64-mingw32\9.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: C:\openssl-1.0.2j-fips-x86_64\OpenSSL\lib\libcrypto.a(c_zlib.o):c_zlib.c|| undefined reference to `deflate'|
C:\msys64\mingw64\bin\..\lib\gcc\x86_64-w64-mingw32\9.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: C:\openssl-1.0.2j-fips-x86_64\OpenSSL\lib\libcrypto.a(c_zlib.o):c_zlib.c|| undefined reference to `inflateEnd'|
C:\msys64\mingw64\bin\..\lib\gcc\x86_64-w64-mingw32\9.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: C:\openssl-1.0.2j-fips-x86_64\OpenSSL\lib\libcrypto.a(c_zlib.o):c_zlib.c|| undefined reference to `deflateEnd'|
C:\msys64\mingw64\bin\..\lib\gcc\x86_64-w64-mingw32\9.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: C:\openssl-1.0.2j-fips-x86_64\OpenSSL\lib\libcrypto.a(c_zlib.o):c_zlib.c|| undefined reference to `inflateEnd'|
C:\msys64\mingw64\bin\..\lib\gcc\x86_64-w64-mingw32\9.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: C:\openssl-1.0.2j-fips-x86_64\OpenSSL\lib\libcrypto.a(c_zlib.o):c_zlib.c|| undefined reference to `deflateEnd'|
C:\msys64\mingw64\bin\..\lib\gcc\x86_64-w64-mingw32\9.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: C:\openssl-1.0.2j-fips-x86_64\OpenSSL\lib\libcrypto.a(c_zlib.o):c_zlib.c|| undefined reference to `inflateInit_'|
C:\msys64\mingw64\bin\..\lib\gcc\x86_64-w64-mingw32\9.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: C:\openssl-1.0.2j-fips-x86_64\OpenSSL\lib\libcrypto.a(c_zlib.o):c_zlib.c|| undefined reference to `deflateInit_'|
C:\msys64\mingw64\bin\..\lib\gcc\x86_64-w64-mingw32\9.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: C:\openssl-1.0.2j-fips-x86_64\OpenSSL\lib\libcrypto.a(c_zlib.o):c_zlib.c|| undefined reference to `deflate'|
C:\msys64\mingw64\bin\..\lib\gcc\x86_64-w64-mingw32\9.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: C:\openssl-1.0.2j-fips-x86_64\OpenSSL\lib\libcrypto.a(c_zlib.o):c_zlib.c|| undefined reference to `zError'|
C:\msys64\mingw64\bin\..\lib\gcc\x86_64-w64-mingw32\9.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: C:\openssl-1.0.2j-fips-x86_64\OpenSSL\lib\libcrypto.a(c_zlib.o):c_zlib.c|| undefined reference to `deflate'|
C:\msys64\mingw64\bin\..\lib\gcc\x86_64-w64-mingw32\9.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: C:\openssl-1.0.2j-fips-x86_64\OpenSSL\lib\libcrypto.a(c_zlib.o):c_zlib.c|| undefined reference to `zError'|
C:\msys64\mingw64\bin\..\lib\gcc\x86_64-w64-mingw32\9.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: C:\openssl-1.0.2j-fips-x86_64\OpenSSL\lib\libcrypto.a(c_zlib.o):c_zlib.c|| undefined reference to `deflateInit_'|
C:\msys64\mingw64\bin\..\lib\gcc\x86_64-w64-mingw32\9.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: C:\openssl-1.0.2j-fips-x86_64\OpenSSL\lib\libcrypto.a(c_zlib.o):c_zlib.c|| undefined reference to `inflate'|
C:\msys64\mingw64\bin\..\lib\gcc\x86_64-w64-mingw32\9.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: C:\openssl-1.0.2j-fips-x86_64\OpenSSL\lib\libcrypto.a(c_zlib.o):c_zlib.c|| undefined reference to `zError'|
C:\msys64\mingw64\bin\..\lib\gcc\x86_64-w64-mingw32\9.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe: C:\openssl-1.0.2j-fips-x86_64\OpenSSL\lib\libcrypto.a(c_zlib.o):c_zlib.c|| undefined reference to `inflateInit_'|
||error: ld returned 1 exit status|
||=== Build failed: 22 error(s), 0 warning(s) (0 minute(s), 45 second(s)) ===|
here is code :
Code:
#include <iostream>#include <windows.h>
#include <string>
#include <ec.h>
#include <obj_mac.h>
//#include <err.h>
#include <bn.h>
using namespace std;
int main()
{
EC_KEY * key;
if(NULL == (key = EC_KEY_new_by_curve_name(NID_secp256k1)))
{
std::cout << "erreur" << std::endl;
}
if(1 != EC_KEY_generate_key(key))
{
std::cout << "erreur" << std::endl;
}
BIGNUM * prv = NULL;
EC_POINT * pub = NULL;
if(1 != EC_KEY_set_private_key(key, prv))
{
std::cout << "erreur" << std::endl;
}
if(1 != EC_KEY_set_public_key(key, pub))
{
std::cout << "erreur" << std::endl;
}
}
someone would how to solve the problem? help me please