Пакет dump, собираю по науке. Отсюда качаю исходники, распаковываю, патчи накладываю.
Качаю сборочные зависимости ТОЛЬКО с родных репозиториев:deb [trusted=yes] http://ftp.ru.debian.org/debian stretch main contrib non-free
deb-src [trusted=yes] http://ftp.ru.debian.org/debian stretch main contrib non-free
В папке dump-0.4b46 командую: dpkg-buildpackage -us -ucdeb http://download.astralinux.ru/astra/stable/orel/repository orel main contrib non-free
deb-src http://download.astralinux.ru/astra/stable/orel/repository orel main contrib non-free
Всё собирается без ошибок. На выходе, в частности, файл dump_0.4b46-3_amd64.deb
Но если в системе будет установлен пакет libssl-dev, dump не соберётся.
Пакет libssl-dev не знаю, откуда взялся, но я ничего левого не устанавливал, он в родном репозитории, видать, какая-то программа его установила. Под спойлером подробности
подробности ошибки
Shell
gcc -DHAVE_CONFIG_H -I. -I.. -I../dump -I../compat/include -Wdate-time -D_FORTIFY_SOURCE=2 -D_USE_BSD_SIGNAL -D_PATH_DUMPDATES=\"/var/lib/dumpdates\" -D_DUMP_VERSION=\"0.4b46\" -D_PATH_RMT=\"/etc/rmt\" -g -O2 -fdebug-prefix-map=/home/user/dump/dump-0.4b46=. -fstack-protector-strong -Wformat -Werror=format-security -c transformation_ssl.c -fPIC -DPIC -o .libs/transformation_ssl.o
transformation_ssl.c: In function ‘generateIV’:
transformation_ssl.c:218:3: warning: ‘RAND_pseudo_bytes’ is deprecated [-Wdeprecated-declarations]
RAND_pseudo_bytes(salt, *saltlen);
^~~~~~~~~~~~~~~~~
In file included from /usr/include/openssl/e_os2.h:13:0,
from /usr/include/openssl/err.h:13,
from transformation_ssl.c:6:
/usr/include/openssl/rand.h:44:1: note: declared here
DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num))
^
transformation_ssl.c: In function ‘transformation_ssl_factory’:
transformation_ssl.c:518:51: error: dereferencing pointer to incomplete type ‘EVP_CIPHER {aka const struct evp_cipher_st}’
RAND_bytes(t->state.ssl.key, t->state.ssl.cipher->key_len);
^~
Makefile:445: ошибка выполнения рецепта для цели «transformation_ssl.lo»
pkg-config --exists --print-errors openssl
(см Почему pkg-config находит пакет openssl, хотя находить его не должна?). Обращаю внимание, хоть и написано openssl. но pkg-config палит файл /usr/lib/x86_64-linux-gnu/pkgconfig/openssl.pc, принадлежащий пакету libssl-dev , но не пакету openssl
Следствие: создаются инклуд config.h, где прописывается макрос #define HAVE_OPENSSL 1
Следствие: компилятор обрабатывает соответствующий участок кода файла transformation_ssl.c:
Shell
//тут код всякий.
Transformation *t;
//тут код всякий.
#ifdef HAVE_OPENSSL
// we could use this to generate a key from a passphrase.
// using this as the actual encryption key has the problems
// discussed elsewhere.
//EVP_BytesToKey(cipher, EVP_md5(), NULL, buf, strlen(buf), 1, key, iv);
if (enc) {
/* generate random session key */
//EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
//EVP_CIPHER_CTX_init(ctx);
//EVP_CIPHER_CTX_rand_key(ctx, t->state.ssl.key);
//EVP_CIPHER_CTX_cleanup(ctx);
//EVP_CIPHER_CTX_free(ctx);
RAND_bytes(t->state.ssl.key, t->state.ssl.cipher->key_len);
} else {
// how do we get keys?
}
#endif
//тут код всякий.
t->state.ssl.cipher->key_len
Ковыряемся, приходим к тому выводу, что нужно смотреть
const EVP_CIPHER *cipher
Смотрим структуру EVP_CIPHER
Shell
$ sudo find / -name "*.h" -exec grep -l 'struct.*EVP_CIPHER' {} \;
/usr/include/openssl/ossl_typ.h
$
Shell
$ cat /usr/include/openssl/ossl_typ.h | grep EVP_CIPHER
typedef struct evp_cipher_st EVP_CIPHER;
typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX;
$
Shell
$ sudo find / -name "*.h" -exec grep evp_cipher_st {} \;
typedef struct evp_cipher_st EVP_CIPHER;
$
Тут можно много чё наделать, а чё правильно- непонятно. У нормальных людей evp_cipher_st определена в файле evp.h. Давайте тут что ли посмотрим определение структуры evp_cipher_st
https://docs.huihoo.com/doxygen/openssl/1.0.1c/crypto_2ossl__typ_8h_source.html
Нас будет интересовать один членик key_len. Файл /usr/include/openssl/ossl_typ.h вот так перепишем:struct evp_cipher_st
{
int nid;
int block_size;
int key_len; /* Default value for variable length ciphers */
int iv_len;
unsigned long flags; /* Various flags */
int (*init)(EVP_CIPHER_CTX *ctx, const unsigned char *key,
const unsigned char *iv, int enc); /* init key */
int (*do_cipher)(EVP_CIPHER_CTX *ctx, unsigned char *out,
const unsigned char *in, size_t inl);/* encrypt/decrypt data */
int (*cleanup)(EVP_CIPHER_CTX *); /* cleanup ctx */
int ctx_size; /* how big ctx->cipher_data needs to be */
int (*set_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Populate a ASN1_TYPE with parameters */
int (*get_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Get parameters from a ASN1_TYPE */
int (*ctrl)(EVP_CIPHER_CTX *, int type, int arg, void *ptr); /* Miscellaneous operations */
void *app_data; /* Application data */
} /* EVP_CIPHER */;
Сейчас всё собирается. Грязь, конечно, ну так и я не программист....
struct evp_cipher_st
{
int key_len;
}
typedef struct evp_cipher_st EVP_CIPHER;
...