mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-26 23:13:16 +02:00
libdvbci: fix for build with openssl 1.1
error: invalid use of incomplete type 'DH' {aka 'struct dh_st'}
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
#include <openssl/dh.h>
|
#include <openssl/dh.h>
|
||||||
#include <openssl/rsa.h>
|
#include <openssl/rsa.h>
|
||||||
#include <openssl/sha.h>
|
#include <openssl/sha.h>
|
||||||
|
#include <openssl/opensslv.h>
|
||||||
|
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
|
||||||
@@ -148,21 +149,37 @@ int dh_gen_exp(uint8_t *dest, int dest_len, uint8_t *dh_g, int dh_g_len, uint8_t
|
|||||||
|
|
||||||
dh = DH_new();
|
dh = DH_new();
|
||||||
|
|
||||||
|
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||||
dh->p = BN_bin2bn(dh_p, dh_p_len, 0);
|
dh->p = BN_bin2bn(dh_p, dh_p_len, 0);
|
||||||
dh->g = BN_bin2bn(dh_g, dh_g_len, 0);
|
dh->g = BN_bin2bn(dh_g, dh_g_len, 0);
|
||||||
dh->flags |= DH_FLAG_NO_EXP_CONSTTIME;
|
dh->flags |= DH_FLAG_NO_EXP_CONSTTIME;
|
||||||
|
#else
|
||||||
|
BIGNUM *p = BN_bin2bn(dh_p, dh_p_len, 0);
|
||||||
|
BIGNUM *g = BN_bin2bn(dh_g, dh_g_len, 0);
|
||||||
|
DH_set0_pqg(dh, p, NULL, g);
|
||||||
|
#endif
|
||||||
|
|
||||||
DH_generate_key(dh);
|
DH_generate_key(dh);
|
||||||
|
|
||||||
len = BN_num_bytes(dh->priv_key);
|
const BIGNUM *pub_key, *priv_key;
|
||||||
|
DH_get0_key(dh, &pub_key, &priv_key);
|
||||||
|
|
||||||
|
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||||
|
len = BN_num_bytes(priv_key);
|
||||||
|
#else
|
||||||
if (len > dest_len) {
|
if (len > dest_len) {
|
||||||
printf("len > dest_len\n");
|
printf("len > dest_len\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
gap = dest_len - len;
|
gap = dest_len - len;
|
||||||
memset(dest, 0, gap);
|
memset(dest, 0, gap);
|
||||||
|
|
||||||
|
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||||
BN_bn2bin(dh->priv_key, &dest[gap]);
|
BN_bn2bin(dh->priv_key, &dest[gap]);
|
||||||
|
#else
|
||||||
|
BN_bn2bin(priv_key, &dest[gap]);
|
||||||
|
#endif
|
||||||
|
|
||||||
DH_free(dh);
|
DH_free(dh);
|
||||||
|
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
#include <openssl/x509v3.h>
|
#include <openssl/x509v3.h>
|
||||||
#include <openssl/sha.h>
|
#include <openssl/sha.h>
|
||||||
#include <openssl/aes.h>
|
#include <openssl/aes.h>
|
||||||
|
#include <openssl/opensslv.h>
|
||||||
|
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "_dh_params.h"
|
#include "_dh_params.h"
|
||||||
@@ -240,7 +241,11 @@ static bool certificate_validate(struct cert_ctx *ctx, X509 *cert)
|
|||||||
ret = X509_verify_cert(store_ctx);
|
ret = X509_verify_cert(store_ctx);
|
||||||
|
|
||||||
if (ret != 1)
|
if (ret != 1)
|
||||||
|
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||||
fprintf(stderr, "%s\n", X509_verify_cert_error_string(store_ctx->error));
|
fprintf(stderr, "%s\n", X509_verify_cert_error_string(store_ctx->error));
|
||||||
|
#else
|
||||||
|
fprintf(stderr, "%s\n", X509_verify_cert_error_string(ret));
|
||||||
|
#endif
|
||||||
|
|
||||||
X509_STORE_CTX_free(store_ctx);
|
X509_STORE_CTX_free(store_ctx);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user