Добрый день!
Может кто-нибудь подсказать:
Мне необходимо написать программу на C аналогичную
KalkanGOST_test.cpp из примера СДК (SDK 2.0/CC(Kalkan)/examples/cpp/basic/KalkanGOST_test/KalkanGOST_test).
Подготовил для начала тестовый файл "
test.c" в котором следующее:
#include <openssl/engine.h>
#include <openssl/ssl.h>
#include <openssl/pkcs12.h>
#include <openssl/err.h>
#include <stdio.h>
int main()
{
printf("GOST example start...\n");
ENGINE_load_openssl();
ENGINE_load_gost();
OpenSSL_add_all_algorithms();
ENGINE_register_all_pkey_asn1_meths();
/* TODO */
return 0;
}
Для компиляции использую статичную библиотеку -
CC(Kalkan)/Linux/static/x64
Дерево проекта:
/gost
/include
libcrypto.a
libssl.a
test.c
Пишу команду для компиляции:
gcc -o kncatest libcrypto.a libssl.a test.c -I./include
Выдает:
test.c:(.text+0xf): undefined reference to `ENGINE_load_openssl'
test.c:(.text+0x14): undefined reference to `ENGINE_load_gost'
test.c:(.text+0x19): undefined reference to `OPENSSL_add_all_algorithms_noconf'
test.c:(.text+0x1e): undefined reference to `ENGINE_register_all_pkey_asn1_meths'
collect2: error: ld returned 1 exit status
UPDATE
Компилирую:
gcc -o kncatest test.c libcrypto.a libssl.a -I./include
Выдает:
libcrypto.a(libpkcs11.o): In function `C_LoadModule':
/home/ai/git/kkcrypt/engines/ccgost/epkcs11/libp11/libpkcs11.c:94: undefined reference to `dlopen'
libcrypto.a(libpkcs11.o): In function `C_UnloadModule':
/home/ai/git/kkcrypt/engines/ccgost/epkcs11/libp11/libpkcs11.c:180: undefined reference to `dlclose'
libcrypto.a(KNCA_PKCS11.o): In function `C_Finalize':
/home/ai/git/kkcrypt/engines/ccgost/epkcs11/PKCS11/KNCA_PKCS11.c:141: undefined reference to `SCardReleaseContext'
libcrypto.a(KNCA_PKCS11_Sessions.o): In function `KNCA_OpenSession':
/home/ai/git/kkcrypt/engines/ccgost/epkcs11/PKCS11/KNCA_PKCS11_Sessions.c:86: undefined reference to `SCardConnect'
/home/ai/git/kkcrypt/engines/ccgost/epkcs11/PKCS11/KNCA_PKCS11_Sessions.c:106: undefined reference to `g_rgSCardT0Pci'
/home/ai/git/kkcrypt/engines/ccgost/epkcs11/PKCS11/KNCA_PKCS11_Sessions.c:114: undefined reference to `g_rgSCardT1Pci'
libcrypto.a(KNCA_PKCS11_Sessions.o): In function `KNCA_CloseSession':
/home/ai/git/kkcrypt/engines/ccgost/epkcs11/PKCS11/KNCA_PKCS11_Sessions.c:194: undefined reference to `SCardDisconnect'
libcrypto.a(KNCA_PKCS11_SlotsTokens.o): In function `KNCA_UpdateSlotsStates':
/home/ai/git/kkcrypt/engines/ccgost/epkcs11/PKCS11/KNCA_PKCS11_SlotsTokens.c:104: undefined reference to `SCardGetStatusChange'
/home/ai/git/kkcrypt/engines/ccgost/epkcs11/PKCS11/KNCA_PKCS11_SlotsTokens.c:109: undefined reference to `SCardListReaders'
/home/ai/git/kkcrypt/engines/ccgost/epkcs11/PKCS11/KNCA_PKCS11_SlotsTokens.c:125: undefined reference to `SCardListReaders'
/home/ai/git/kkcrypt/engines/ccgost/epkcs11/PKCS11/KNCA_PKCS11_SlotsTokens.c:157: undefined reference to `SCardListReaders'
/home/ai/git/kkcrypt/engines/ccgost/epkcs11/PKCS11/KNCA_PKCS11_SlotsTokens.c:198: undefined reference to `SCardGetStatusChange'
libcrypto.a(KNCA_PKCS11_SlotsTokens.o): In function `KNCA_GetSlotList':
/home/ai/git/kkcrypt/engines/ccgost/epkcs11/PKCS11/KNCA_PKCS11_SlotsTokens.c:383: undefined reference to `SCardEstablishContext'
/home/ai/git/kkcrypt/engines/ccgost/epkcs11/PKCS11/KNCA_PKCS11_SlotsTokens.c:393: undefined reference to `SCardGetStatusChange'
libcrypto.a(dso_dlfcn.o): In function `dlfcn_load':
/home/ai/git/kkcrypt/crypto/dso/dso_dlfcn.c:184: undefined reference to `dlopen'
/home/ai/git/kkcrypt/crypto/dso/dso_dlfcn.c:188: undefined reference to `dlerror'
/home/ai/git/kkcrypt/crypto/dso/dso_dlfcn.c:204: undefined reference to `dlclose'
libcrypto.a(dso_dlfcn.o): In function `dlfcn_unload':
/home/ai/git/kkcrypt/crypto/dso/dso_dlfcn.c:228: undefined reference to `dlclose'
libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_var':
/home/ai/git/kkcrypt/crypto/dso/dso_dlfcn.c:252: undefined reference to `dlsym'
/home/ai/git/kkcrypt/crypto/dso/dso_dlfcn.c:256: undefined reference to `dlerror'
libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_func':
/home/ai/git/kkcrypt/crypto/dso/dso_dlfcn.c:286: undefined reference to `dlsym'
/home/ai/git/kkcrypt/crypto/dso/dso_dlfcn.c:290: undefined reference to `dlerror'
libcrypto.a(dso_dlfcn.o): In function `dlfcn_pathbyaddr':
/home/ai/git/kkcrypt/crypto/dso/dso_dlfcn.c:457: undefined reference to `dladdr'
/home/ai/git/kkcrypt/crypto/dso/dso_dlfcn.c:467: undefined reference to `dlerror'
libcrypto.a(dso_dlfcn.o): In function `dlfcn_globallookup':
/home/ai/git/kkcrypt/crypto/dso/dso_dlfcn.c:474: undefined reference to `dlopen'
/home/ai/git/kkcrypt/crypto/dso/dso_dlfcn.c:478: undefined reference to `dlsym'
/home/ai/git/kkcrypt/crypto/dso/dso_dlfcn.c:479: undefined reference to `dlclose'
libcrypto.a(c_zlib.o): In function `zlib_stateful_init':
/home/ai/git/kkcrypt/crypto/comp/c_zlib.c:155: undefined reference to `inflateInit_'
/home/ai/git/kkcrypt/crypto/comp/c_zlib.c:167: undefined reference to `deflateInit_'
libcrypto.a(c_zlib.o): In function `zlib_stateful_finish':
/home/ai/git/kkcrypt/crypto/comp/c_zlib.c:185: undefined reference to `inflateEnd'
/home/ai/git/kkcrypt/crypto/comp/c_zlib.c:186: undefined reference to `deflateEnd'
libcrypto.a(c_zlib.o): In function `zlib_stateful_compress_block':
/home/ai/git/kkcrypt/crypto/comp/c_zlib.c:207: undefined reference to `deflate'
libcrypto.a(c_zlib.o): In function `zlib_stateful_expand_block':
/home/ai/git/kkcrypt/crypto/comp/c_zlib.c:235: undefined reference to `inflate'
libcrypto.a(c_zlib.o): In function `bio_zlib_free':
/home/ai/git/kkcrypt/crypto/comp/c_zlib.c:520: undefined reference to `inflateEnd'
/home/ai/git/kkcrypt/crypto/comp/c_zlib.c:526: undefined reference to `deflateEnd'
libcrypto.a(c_zlib.o): In function `bio_zlib_read':
/home/ai/git/kkcrypt/crypto/comp/c_zlib.c:553: undefined reference to `inflateInit_'
/home/ai/git/kkcrypt/crypto/comp/c_zlib.c:566: undefined reference to `inflate'
/home/ai/git/kkcrypt/crypto/comp/c_zlib.c:571: undefined reference to `zError'
libcrypto.a(c_zlib.o): In function `bio_zlib_write':
/home/ai/git/kkcrypt/crypto/comp/c_zlib.c:618: undefined reference to `deflateInit_'
/home/ai/git/kkcrypt/crypto/comp/c_zlib.c:653: undefined reference to `deflate'
/home/ai/git/kkcrypt/crypto/comp/c_zlib.c:658: undefined reference to `zError'
libcrypto.a(c_zlib.o): In function `bio_zlib_flush':
/home/ai/git/kkcrypt/crypto/comp/c_zlib.c:701: undefined reference to `deflate'
/home/ai/git/kkcrypt/crypto/comp/c_zlib.c:707: undefined reference to `zError'
libcrypto.a(KNCA_PKCS11_SCardComm.o): In function `KNCASCSendCmd':
/home/ai/git/kkcrypt/engines/ccgost/epkcs11/PKCS11/KNCA_PKCS11_SCardComm.c:34: undefined reference to `SCardTransmit'
libcrypto.a(Gzip.o): In function `ungzip':
/home/ai/git/kkcrypt/engines/ccgost/epkcs11/PKCS11/zlib/Gzip.c:16: undefined reference to `inflateInit2_'
/home/ai/git/kkcrypt/engines/ccgost/epkcs11/PKCS11/zlib/Gzip.c:45: undefined reference to `inflate'
/home/ai/git/kkcrypt/engines/ccgost/epkcs11/PKCS11/zlib/Gzip.c:86: undefined reference to `inflateEnd'
libcrypto.a(Gzip.o): In function `gzip':
/home/ai/git/kkcrypt/engines/ccgost/epkcs11/PKCS11/zlib/Gzip.c:99: undefined reference to `deflateInit2_'
/home/ai/git/kkcrypt/engines/ccgost/epkcs11/PKCS11/zlib/Gzip.c:129: undefined reference to `deflate'
/home/ai/git/kkcrypt/engines/ccgost/epkcs11/PKCS11/zlib/Gzip.c:161: undefined reference to `deflateEnd'
Откуда в стак-стрейсе путь "/home/ai/git/kkcrypt/crypto/"??
Пробовал определить переменную окружения LD_LIBRARY_PATH, также.