fix commit: fix for build with openssl 1.1

1ce6f8c629

Signed-off-by: Markus Volk <f_l_k@t-online.de>
Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
Markus Volk
2019-02-16 06:47:12 +01:00
committed by Thilo Graf
parent 1ce6f8c629
commit e9c53684e3

View File

@@ -161,17 +161,18 @@ int dh_gen_exp(uint8_t *dest, int dest_len, uint8_t *dh_g, int dh_g_len, uint8_t
DH_generate_key(dh); DH_generate_key(dh);
#if OPENSSL_VERSION_NUMBER < 0x10100000L
len = BN_num_bytes(dh->priv_key);
#else
const BIGNUM *pub_key, *priv_key; const BIGNUM *pub_key, *priv_key;
DH_get0_key(dh, &pub_key, &priv_key); DH_get0_key(dh, &pub_key, &priv_key);
#if OPENSSL_VERSION_NUMBER < 0x10100000L
len = BN_num_bytes(priv_key); len = BN_num_bytes(priv_key);
#else #endif
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);