Aktualności:

Nasza strona na Facebooku - poleć znajomym.

Menu główne

crypt_prog

Zaczęty przez mariotti, 06 Lipiec 2013, 13:36

mariotti

Pobrałem świeże źródła BOINC z repozytorium GIT. Doinstalowałem niezbędny soft, skonfigurowałem,
skompilowałem - wszystko poszło bez błędów i bez większych problemów. Jednak nie mogę utworzyć
nowego projektu bo nie mam programu jak w temacie crypt_prog. Próbowałem go kompilować
ręcznie, ale nie udaje się. W pliku make nie mogę znaleźć polecenia kompilującego - prawdopodobnie
skrypt configure w trakcie budowania make w ogóle nie dodał kompilacji crypt_prog.

Zrzut z kompilacji:

test@x:~/boinc/lib$ g++ -O2 -I.. -o crypt_prog crypt_prog.cpp
crypt_prog.cpp: In function 'unsigned int random_int()':
crypt_prog.cpp:111:31: warning: ignoring return value of 'size_t fread(void*, size_t, size_t, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
/tmp/ccIBj1hJ.o: In function `main':
crypt_prog.cpp:(.text.startup+0x8d): undefined reference to `scan_key_hex(_IO_FILE*, KEY*, int)'
crypt_prog.cpp:(.text.startup+0xc9): undefined reference to `sign_file(char const*, R_RSA_PRIVATE_KEY&, DATA_BLOCK&)'
crypt_prog.cpp:(.text.startup+0xdd): undefined reference to `print_hex_data(_IO_FILE*, DATA_BLOCK&)'
crypt_prog.cpp:(.text.startup+0x155): undefined reference to `RSA_generate_key'
crypt_prog.cpp:(.text.startup+0x16f): undefined reference to `openssl_to_keys(rsa_st*, int, R_RSA_PRIVATE_KEY&, R_RSA_PUBLIC_KEY&)'
crypt_prog.cpp:(.text.startup+0x1b8): undefined reference to `print_key_hex(_IO_FILE*, KEY*, int)'
crypt_prog.cpp:(.text.startup+0x1cd): undefined reference to `print_key_hex(_IO_FILE*, KEY*, int)'
crypt_prog.cpp:(.text.startup+0x233): undefined reference to `scan_key_hex(_IO_FILE*, KEY*, int)'
crypt_prog.cpp:(.text.startup+0x274): undefined reference to `scan_hex_data(_IO_FILE*, DATA_BLOCK&)'
crypt_prog.cpp:(.text.startup+0x295): undefined reference to `md5_file(char const*, char*, double&)'
crypt_prog.cpp:(.text.startup+0x2c2): undefined reference to `check_file_signature(char const*, R_RSA_PUBLIC_KEY&, DATA_BLOCK&, bool&)'
crypt_prog.cpp:(.text.startup+0x31e): undefined reference to `scan_key_hex(_IO_FILE*, KEY*, int)'
crypt_prog.cpp:(.text.startup+0x33f): undefined reference to `generate_signature(char*, char*, R_RSA_PRIVATE_KEY&)'
crypt_prog.cpp:(.text.startup+0x39d): undefined reference to `scan_key_hex(_IO_FILE*, KEY*, int)'
crypt_prog.cpp:(.text.startup+0x3d1): undefined reference to `scan_key_hex(_IO_FILE*, KEY*, int)'
crypt_prog.cpp:(.text.startup+0x43e): undefined reference to `encrypt_private(R_RSA_PRIVATE_KEY&, DATA_BLOCK&, DATA_BLOCK&)'
crypt_prog.cpp:(.text.startup+0x483): undefined reference to `decrypt_public(R_RSA_PUBLIC_KEY&, DATA_BLOCK&, DATA_BLOCK&)'
crypt_prog.cpp:(.text.startup+0x4fa): undefined reference to `scan_hex_data(_IO_FILE*, DATA_BLOCK&)'
crypt_prog.cpp:(.text.startup+0x51b): undefined reference to `check_validity(char const*, char const*, unsigned char*, char*)'
crypt_prog.cpp:(.text.startup+0x5e6): undefined reference to `scan_raw_data(_IO_FILE*, DATA_BLOCK&)'
crypt_prog.cpp:(.text.startup+0x60f): undefined reference to `print_hex_data(_IO_FILE*, DATA_BLOCK&)'
crypt_prog.cpp:(.text.startup+0x6a6): undefined reference to `OPENSSL_add_all_algorithms_noconf'
crypt_prog.cpp:(.text.startup+0x6b1): undefined reference to `ERR_load_crypto_strings'
crypt_prog.cpp:(.text.startup+0x6b6): undefined reference to `ENGINE_load_builtin_engines'
crypt_prog.cpp:(.text.startup+0x6c4): undefined reference to `BIO_new_fp'
crypt_prog.cpp:(.text.startup+0x6cc): undefined reference to `BIO_s_file'
crypt_prog.cpp:(.text.startup+0x6d4): undefined reference to `BIO_new'
crypt_prog.cpp:(.text.startup+0x6ea): undefined reference to `BIO_ctrl'
crypt_prog.cpp:(.text.startup+0x701): undefined reference to `RSA_new'
crypt_prog.cpp:(.text.startup+0x73c): undefined reference to `scan_key_hex(_IO_FILE*, KEY*, int)'
crypt_prog.cpp:(.text.startup+0x756): undefined reference to `private_to_openssl(R_RSA_PRIVATE_KEY&, rsa_st*)'
crypt_prog.cpp:(.text.startup+0x786): undefined reference to `PEM_write_RSAPrivateKey'
crypt_prog.cpp:(.text.startup+0x7d1): undefined reference to `scan_hex_data(_IO_FILE*, DATA_BLOCK&)'
crypt_prog.cpp:(.text.startup+0x7fa): undefined reference to `print_raw_data(_IO_FILE*, DATA_BLOCK&)'
crypt_prog.cpp:(.text.startup+0x849): undefined reference to `PEM_read_RSAPrivateKey'
crypt_prog.cpp:(.text.startup+0x86d): undefined reference to `openssl_to_private(rsa_st*, R_RSA_PRIVATE_KEY*)'
crypt_prog.cpp:(.text.startup+0x899): undefined reference to `print_key_hex(_IO_FILE*, KEY*, int)'
crypt_prog.cpp:(.text.startup+0x8d2): undefined reference to `scan_key_hex(_IO_FILE*, KEY*, int)'
crypt_prog.cpp:(.text.startup+0x904): undefined reference to `public_to_openssl(R_RSA_PUBLIC_KEY&, rsa_st*)'
crypt_prog.cpp:(.text.startup+0x90f): undefined reference to `PEM_write_RSA_PUBKEY'
crypt_prog.cpp:(.text.startup+0x91f): undefined reference to `ERR_print_errors'
crypt_prog.cpp:(.text.startup+0x93f): undefined reference to `PEM_read_RSA_PUBKEY'
crypt_prog.cpp:(.text.startup+0x970): undefined reference to `openssl_to_keys(rsa_st*, int, R_RSA_PRIVATE_KEY&, R_RSA_PUBLIC_KEY&)'
crypt_prog.cpp:(.text.startup+0x980): undefined reference to `public_to_openssl(R_RSA_PUBLIC_KEY&, rsa_st*)'
crypt_prog.cpp:(.text.startup+0x9a8): undefined reference to `print_key_hex(_IO_FILE*, KEY*, int)'
crypt_prog.cpp:(.text.startup+0x9e9): undefined reference to `ERR_print_errors'
crypt_prog.cpp:(.text.startup+0xa41): undefined reference to `ERR_print_errors'
collect2: ld returned 1 exit status

Nie mogę wygooglać w jakich bibliotekach znajdują się brakujące funkcje i nie wiem z czym
zlinkować. Ku ścisłości: kilka wygooglałem, ale włączenie ich nie pomagało.

Pozdrawiam

Karlik

Sprawdziłem u siebie i zadziałało, wystarczyło ./configure --enable-server i make. Na domyślnych, statycznych ustawieniach u mnie wystarczy:
g++ -o crypt_prog crypt_prog.cpp -I.. libboinc_crypt.a libboinc.a -lssl -lcrypto
albo
g++ -o crypt_prog crypt_prog.cpp -I.. -lboinc_crypt -lboinc -lssl -lcrypto

mariotti


g++ -o crypt_prog crypt_prog.cpp -I.. libboinc_crypt.a libboinc.a -lssl -lcrypto
g++ -o crypt_prog crypt_prog.cpp -I.. -lboinc_crypt -lboinc -lssl -lcrypto

U mnie nie działają ani dokładnie przepisane komendy, ani w kilku wariacjach
jakich próbowałem. Nie wiem w jakich bibliotekach są jakie funkcje. Jak to
sprawdzać?


test@x:~/boinc/lib$ g++ -o crypt_prog crypt_prog.cpp -I.. libboinc_crypt.a libboinc.a -lssl -lcrypto
g++: error: libboinc_crypt.a: No such file or directory



g++ -o crypt_prog crypt_prog.cpp -I.. -lboinc_crypt -lboinc -lssl -lcrypto     
/usr/bin/ld: cannot find -lboinc_crypt
/usr/bin/ld: cannot find -lboinc



test@x:~/boinc/lib$ g++ -o crypt_prog -I.. -lssl -lcrypto crypt_prog.cpp libboinc.a libboinc_crypt_la-crypt.o
/tmp/ccmfiCbh.o: In function `main':
crypt_prog.cpp:(.text+0x1bd): undefined reference to `RSA_generate_key'
crypt_prog.cpp:(.text+0xc6f): undefined reference to `OPENSSL_add_all_algorithms_noconf'
crypt_prog.cpp:(.text+0xc74): undefined reference to `ERR_load_crypto_strings'
crypt_prog.cpp:(.text+0xc79): undefined reference to `ENGINE_load_builtin_engines'
crypt_prog.cpp:(.text+0xc97): undefined reference to `BIO_new_fp'
crypt_prog.cpp:(.text+0xca3): undefined reference to `BIO_s_file'
crypt_prog.cpp:(.text+0xcab): undefined reference to `BIO_new'
crypt_prog.cpp:(.text+0xcdc): undefined reference to `BIO_ctrl'
crypt_prog.cpp:(.text+0xd18): undefined reference to `RSA_new'
crypt_prog.cpp:(.text+0xdfe): undefined reference to `PEM_write_RSAPrivateKey'
crypt_prog.cpp:(.text+0xedd): undefined reference to `PEM_write_RSA_PUBKEY'
crypt_prog.cpp:(.text+0xefb): undefined reference to `ERR_print_errors'
..........................................


Pozdrawiam

mariotti

Chyba zadziałała kompilacja takim poleceniem

g++ -o crypt_prog crypt_prog.cpp -I.. -L/usr/lib/x86_64-linux-gnu/ -L. libboinc_crypt_la-crypt.o -lboinc -lssl -lcrypto

mam program, ale jeszcze nie wiem czy działa.

Pozdrawiam